$(function(){


$("img").load(function(evt){
      $(this).fadeIn(1000);
});

$(".image_thmb img").live("load",function () { $(this).fadeIn(); });
$("#big-img").load(function () { $("#big-img").fadeIn(); });
$("#more_image img").load(function () {$(this).fadeIn(); });
/*
$("#big-img").hide();
$("#more_image img").hide();
$("#more_image img").hide();
$(".image_thmb img").hide();
*/

/*
$("#more_image img").hide();

$("#big-img").load(function () {
$("#big-img").fadeIn();
});
*/



$("#src").hide();
$("#total").hide();

if($("#en_site").text()=='en'){
var images_gallery_folder="../img/gallery/pages/";	
var images_folder="../img/";	
}else{
var images_gallery_folder="../img/gallery/";
var images_folder="../img/";		
}



var number;
var total=$(".images_show_div img").length;
//alert(total);
var domain=$("#domain").text();
var cat=$("#image_thmb_cont1").attr("cat");
var cat_name=$("#image_thmb_cont1").attr("cat_name");

$("#over").hide();
$("#big-div-cont").hide();

//alert(images_gallery_folder);
//alert(total);

var window_height=$(document).height();


$("#over").css({"height":window_height+"px"});




$(".images_show_div img").live("click",function(){

number=$(this).attr("index");
//alert(number);
$("#big-div").show();
$("#big-div-cont").show();
$("#image-close").slideDown(500);
$("#image-desc").text($(this).attr("title"));
$("#big-img").attr("src","");
$("#big-img").attr("src",$(this).attr("src"));
$("#over").show();
//alert($(this).attr("src"));

//alert(total);

});		


$(".image_thmb_cont img").live("click",function(){

number=$(this).attr("index");
//alert(number);
$("#big-div").show();
$("#big-div-cont").show();
$("#image-close").slideDown(500);
$("#image-desc").text($(this).attr("title"));
$("#big-img").attr("src","");
$("#big-img").attr("src",$(this).attr("src"));
$("#over").show();
//alert($(this).attr("src"));




});		


   

$("#close").click(function(){
$("#big-div").hide(200);
$("#big-div-cont").hide();
$("#over").hide(200);

});	



$("#image-prev").click(function(){
//alert(number);

	
if (parseInt(number)>1 ){
number=parseInt(number)-1;
//alert(number);
}else{

number=parseInt(total);
// alert(number);	
//number=total;
}

//alert(total);
//alert(number);

$("#big-img").attr("src","");
$("#big-img").attr("src",images_folder+"empty.jpg");
img_src=$(".images_show_div img[index="+number+"]").attr("src");
$("#mag_big").hide();
$("#big-img").attr("src",img_src);
$("#image-desc").text($(".images_show_div img[index="+number+"]").attr("title"));


});	


$("#image-next").click(function(){

//alert(total);
	
if (parseInt(number)<total ){
number=parseInt(number)+1;
}else{
number=1;
}


//alert($(".images_show_div img[index="+number+"]").attr("src"));

//alert(number);
$("#big-img").attr("src","");
$("#big-img").attr("src",images_folder+"empty.jpg");
img_src=$(".images_show_div img[index="+number+"]").attr("src");
$("#mag_big").hide();
$("#big-img").attr("src",img_src);
$("#image-desc").text($(".images_show_div img[index="+number+"]").attr("title"));


});





});


