$(function(){
		   
/*var offset=$("#menuLeftBg").offset();
	var left=parseInt(offset.left);
	var top=parseInt(offset.top);
	top=top+35;
	//alert(left);
	alert(top);
	$("#Layer1").css('top',top);
	$("#Layer1").css('left',left);*/

		   $('a[rel=lightbox-tour]').lightBox();
		   
	$(".img").fadeTo("fast",0.6);
	
$(".img").hover(function () {
      $(this).fadeTo("fast", 1);
    },function(){
	$(this).fadeTo("fast", 0.6);
	})


	$("#gore img").hover(function(){
//alert("khgkh");
img=$(this).attr('src');
$("#PictureShow").html("<img src=\""+img+"\" border=0>");
},function(){
$("#PictureShow").html("");
})
	//if(parseInt($("#list").width())>=768){
	/*	$("#controls").after('<div style="position:absolute; z-index:999999"><a href="#"><div id="left" onclick="left();" style="position: relative; cursor:hand; width:17px; height:20px; top: -75px; left: 24px;background-image: url(http://test3.cleardesign.com.ua/images/str_28.gif);background-repeat: no-repeat;"></div></a><a href="#"><div id="right" onclick="right();" style="position: relative; cursor:hand; width:17px; height:20px; left:303px; top: -95px; background-image: url(http://test3.cleardesign.com.ua/images/str_30.gif);background-repeat: no-repeat;"></div></a></div>');
		$("#controls2").after('<div style="position:absolute; z-index:999999"><a href="#"><div id="left" onclick="left();" style="position: relative; cursor:hand; width:17px; height:20px; top: 0px;background-image: url(http://test3.cleardesign.com.ua/images/str_28.gif);background-repeat: no-repeat;"></div></a><a href="#"><div id="right" onclick="right();" style="position: relative; cursor:hand; width:17px; height:20px; left:303px; top: -95px; background-image: url(http://test3.cleardesign.com.ua/images/str_30.gif);background-repeat: no-repeat;"></div></a></div>');
	//}*/
	
	$(".img[sub=fav]").click(function(){
		$.post("http://" + top.location.host + "/mods/request.php", {
			sub: "fav",
			target: $(this).attr('refresh'),
			id: $(this).attr('id')
		}, function(data){
			$("#refresh").html(data);
		})
	})
	
	$(".img[sub=off]").click(function(){
		$.post("http://" + top.location.host + "/mods/request.php", {
			sub: "off",
			id: $(this).attr('id')
		}, function(data){
			$("#refresh").html(data);
		})
	})
	
	$(".img[sub=proj]").click(function(){
		$.post("http://" + top.location.host + "/mods/request.php", {
			sub: "proj",
			id: $(this).attr('id')
		}, function(data){
			$("#refresh").html(data);
		})
	})
	
	$(".menuA[r=t]").click(function(){
		$(".crop[id="+$(this).attr('id')+"]").attr({'class':''});
		$(this).attr({'r':'r'});
		$(this).html('');
	})


  })//end

function returnImg()
{
	$("#PictureShow").html("");
}

function showDiv(id){
	//alert(id);
	var elem = document.getElementById(id);
	//alert(s);
	//$('#'+id).show();
	if($('#'+id).css('display')=="none")
		 {
			// alert("dfgdfg");
			 //$('#'+id).css({'visibility': 'visible'});
			//$('#'+id).css({'position': 'relative'});
			//alert("dfgdfg");
			 $('#'+id).show();
			 //$('#'+id).css({'position': 'relative'}).show();
		 }
		 else
		 {
			 //$('#'+id).css({'visibility': 'hidden'});
			// $('#'+id).css({'position': 'absolute'});
			  $('#'+id).hide();
		 }
		}

function changeImg(id,obj)
{
	//alert("dfgsdfgdsf");
	offset=$("#"+id).offset();
	var left=parseInt(offset.left);
	left=left+50;
	var top=parseInt(offset.top);
	top=top+35;
	//alert(left);
	//alert(top);
	$("#PictureShow").css('top',top);
	$("#PictureShow").css('left',left);
	img=obj.attr('src');
	//alert(img);
	$("#PictureShow").html("<img src="+img+" border=0>");
	
}

function right(id){
	//alert("ertertert");
			var limit = parseInt($("#"+id).css("left"));
			//alert(limit);
			var width = parseInt($('#table_'+id).width());
			//alert(width);
			if (limit <= 0) {
				//alert(limit);
				if (limit <= 0 && limit >= -parseInt($("#"+id).width())+550 -width ) {
					$("#"+id).animate({
						left: limit - 80 + 'px'
					}, {
						queue: false,
						duration: 80
					})
				}
			}else{
				$("#"+id).css({"left":'0px'})
			}
			
		}
function left(id){
	//alert("ertertert");
			var limit = parseInt($("#"+id).css("left"));
			if (limit < 0) {
				$("#"+id).animate({
						left: limit + 80 + 'px'
					}, {
						queue: false,
						duration: 80
					})
			}
			
		}
		
