currentBlackBox = 1;
maxOneTitle = 4;
urlHome = "";
vr = 0;
url1=url2=url3=url4=0;
$('.blackBox').ready(function(){
	//$('.blackBox > img').each(function(){
		
			//setBlack();
			//animat();
			//alert('rrr');
			vr++;
	//});	
});
function checc(x){
	if(x==1)
		url1=1;
	if(x==2)
		url2=1;
	if(x==3)
		url3=1;
	if(x==4)
		url4=1;
	if(url1==1&&url2==1&&url3==1&url4==1){
		w = window.innerWidth;
		setTimeout('setBlack('+w+')',2000);
		animat();
	}
		
}
function swapsource_and_dosomething(url,handler,element){
	var img=new Image();
	img.onload=function(){
		element.src= url;
		vr++;
		return handler(vr);
	}
	img.src=url;
}
$(document).ready(function(){
	$(".linksideer").click(function(){
		window.location=urlHome;
	});	
});
function setCounter(x){
	maxOneTitle=x;
}
function setURLH(x){
	urlHome = x;
}
function setBlack(x){
	
	
	//alert(w);
	neww = w*0.48;
	$(".blackBox").width(neww);
	$(".blackBox > img").each(function(){
		$(this).width(neww);
	})
	$(".blackBox-title-sec").each(function(){
		$(this).width(neww);
		e = $("#backBox-"+currentBlackBox).height();
		//e = e - $(this).height();
		e = e - 5;
		$(this).css("marginTop",e);
	});
	$(".waiting").hide();
	$("#backBox-"+currentBlackBox).show();
	$("#blackBox-title-"+currentBlackBox).show();
	$("#darksideHammal").height(e+5);
	//alert(neww);
	//alert(maxOneTitle);
}
function toggleBlackBoxImage(x) {
	$("#backBox-"+currentBlackBox).hide();
	$("#blackBox-title-"+currentBlackBox).hide();
	
	
	$("#backBox-"+x).fadeIn(500);
	$("#blackBox-title-"+x).show();
	
	
	
	$("#blackBox-thumb-"+currentBlackBox).show();
	$("#blackBox-thumb-"+x).hide();
	currentBlackBox = x;
}
function animat(){
	if(currentBlackBox==4)
		x = 1;
	else
		x = currentBlackBox +1;
	toggleBlackBoxImage(x);
	setTimeout("animat()", 8000);
}
function setAvToItsPlacce(){
	id = $("#inside_pic_av").attr('src');
	img = '<img src="'+id+'" style="float:left;">';
	$(".box1").html(img+$(".box1").html());
}