










function left() {
	k = $("#mat_content li").size();
	//alert (k);
	z = k*184;
	w = z-920;
	//alert (w);
	y = 0-w;
	//alert (y);
		n = $("#mat_content ul").css("margin-left");
		//alert (n);
		n = parseInt(n);
		//alert (n);
		if (y < n) {
		$('#rarrow').attr('href', '#');
		m = n-184;
		//alert (m);
	$("#mat_content ul").animate({style: "margin-left: "+m+"px;"}, 700);
	setTimeout("add_llink()", 700);
}

}

function add_llink() {
	$('#rarrow').attr('href', 'javascript:left()');
}

function right() {
		n = $("#mat_content ul").css("margin-left");
		//alert (n);
		n = parseInt(n);
		//alert (n);
		if (n < 0) {
		$('#larrow').attr('href', '#');
		m = n+184;
		//alert (m);
		$("#mat_content ul").animate({style: "margin-left: "+m+"px;"}, 700);
		setTimeout("add_rlink()", 700);
	}
}

function add_rlink() {
	$('#larrow').attr('href', 'javascript:right()');
}









function add_llinki() {
	$('#indlarrow').attr('href', 'javascript:lefti()');
}

function add_rlinki() {
	$('#indrarrow').attr('href', 'javascript:righti()');
}





function nya(){
	//alert (346);
	if ($('#pic_text').css('display')=="none") {
		a = $('#big_pic_img').height()-100;
		$('#pic_text').css('height', a+'px');
		$('#pic_text').css('display', 'block');
	}else{
		$('#pic_text').css('display', 'none');
	}
}

function slide() {
	
}


/* Alfuken BEGIN */

function loadpic(id)
{
	// slide(); // когда будет готов слайдер, будем слайдить
	$("#big_pic_img").attr('src','/images/des/'+id+'_big.jpg');
	$("#pic_text").html(  $("#desc_"+id).html() );
}

function loadcat(id, img)
{
	a = $('#big_pic_img').height()-100;
	$('#pic_text').css('height', a+'px');
	// slide(); // когда будет готов слайдер, будем слайдить
	$("#big_pic_img").attr('src','/uploads/'+img);
	$("#pic_text").html(  $("#desc_"+id).html() );
}


/* Alfuken END */

var init_bo_bo;
init_bo_bo = 1;


function roll1() {
	$("#menu_li").css('display', 'none');
	c = $("#main").height();
	$("#main_table").animate({style: 'margin-top: -'+c+' px;'}, 1500, "easeOutElastic");
	setTimeout("show1()", 1500);
}	

function show1() {
	$("#portf_content").css('display', 'none');
	$('#serv_content').css('display', 'none');
	$("#cont_content").css('display', 'none');
	$('#about_content').css('display', 'block');

	$('#menu').css('background-image', 'url(/images/menu1.jpg)');
	y = $("#about_content").height();
	$("#main_table").animate({style: 'margin-top: -20px;'}, 1500, "easeOutBounce");
	setTimeout("show_link()", 1500);
}

function roll2() {
	$("#menu_li").css('display', 'none');
	c = $("#main").height();
	$("#main_table").animate({style: 'margin-top: -'+c+' px;'}, 1500);
	setTimeout("show2()", 2500);
}	

function show2() {
	$('#serv_content').css('display', 'block');
	$("#portf_content").css('display', 'none');
	$('#about_content').css('display', 'none');
	$("#cont_content").css('display', 'none');
	$('#menu').css('background-image', 'url(/images/menu2.jpg)');
	i = $("#serv_content").height();
	$("#main_table").animate({style: 'margin-top: -20px;'}, 1500);
	setTimeout("show_link()", 1500);
}

function roll3() {
	$("#menu_li").css('display', 'none');
	c = $("#main").height();
	$("#main_table").animate({style: 'margin-top: -'+c+' px;'}, 1500, "easeOutElastic");
	setTimeout("show3()", 1500);
}	

function show3() {
	$('#about_content').css('display', 'none');
	$('#serv_content').css('display', 'none');
	$("#cont_content").css('display', 'none');
	$("#portf_content").css('display', 'block');
	$('#menu').css('background-image', 'url(/images/menu3.jpg)');
	c = $("#portf_content").height();
	$("#main_table").animate({style: 'margin-top: -20px;'}, 1500, "easeOutBounce");
	setTimeout("show_link()", 1500);
}


function roll4() {
	$("#menu_li").css('display', 'none');
	c = $("#main").height();
	$("#main_table").animate({style: 'margin-top: -'+c+' px;'}, 1500, "easeOutElastic");
	setTimeout("show4()", 1500);
}	

function show4() {
	$('#about_content').css('display', 'none');
	$('#serv_content').css('display', 'none');
	$("#portf_content").css('display', 'none');
	$("#cont_content").css('display', 'block');
	$('#menu').css('background-image', 'url(/images/menu4.jpg)');
	c = $("#cont_content").height();
	$("#main_table").animate({style: 'margin-top: -20px;'}, 1500, "easeOutBounce");
	setTimeout("show_link()", 1500);
}

function show_link() {
	$("#menu_li").css('display', 'block');
}

function lm1(a,b){
	$(".level_2").remove();
	$(".l1sl").attr('class',"");
	$(".l1s").attr('class',"");
	$(a).attr('class','l1sl');
	$(a).parent().attr('class','l1s');
	$("<div></div>").load('level2.php?n='+b+'&r='+Math.random()*5).appendTo($(a).parent()).attr('class', 'fixed_blad');
	return false;
}


function lm2(a,b){
	$(".level_3").parent().remove();
	$(".l2sl").attr('class',"");
	$(".l2s").attr('class',"");
	$("<div></div>").load('level3.php?n='+b+'&r='+Math.random()*5).appendTo($(a).parent()).attr('class', 'fixed_blad');
	$(a).attr('class','l2sl');
	$(a).parent().attr('class','l2s');
	return false;
}



function lm3(a,b){
	$(".level_4").parent().remove();
	$(".l3sl").attr('class',"");
	$(".l3s").attr('class',"");
	$("<div></div>").load('level4.php?n='+b+'&r='+Math.random()*5).appendTo($(a).parent()).attr('class', 'fixed_blad');
	$(a).attr('class','l3sl');
	$(a).parent().attr('class','l3s');
	return false;
}



function lm4(a,b){
	$(".l4sl").attr('class',"");
	$(".l4s").attr('class',"");
	$(a).attr('class','l4sl');
	$(a).parent().attr('class','l4s');
//	alert(b);
	tb_show(null,'/print.php?id='+b+'&KeepThis=true&width=380&height=500&modal=true', false);

	$('#TB_window').css('background', 'transparent').css('border','none');

	return false;

}





function lm3_t(a,b){
	if (init_bo_bo==1){
		init_bo_bo=2;
		$("#razdel").fadeIn('slow');
	}
	$('#shop_info').load('/shop/'+b+'/'+Math.random()*5)



	$(".level_3").parent().remove();
	$(".l2sl").attr('class',"");
	$(".l2s").attr('class',"");


$(a).attr('class','l2sl');
	$(a).parent().attr('class','l2s');
	return false;
}




function lefti() {
    if (cc == count - 5) {
	} else {
        cc = cc + 1;
        lefts = cc * 131;
        $('#fbl').animate({
            style: "left:-" + lefts + "px"
        },
        500);
    }
}

function righti() {
    if (cc == 0) {

	} else {
        cc = cc - 1;
        lefts = cc * 131;
        $('#fbl').animate({
            style: "left:-" + lefts + "px"
        },
        500);
    }
}








this.tooltip = function(){	
	/* CONFIG */		
		xOffset = -10;
		yOffset = 20;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	$("a.tooltip").hover(function(e){											  
		this.t = this.title;
		this.title = "";									  
		$("body").append("<p id='tooltip'>"+ this.t +"</p>");
		
		if (e.pageX>700) e.pageX=e.pageX-455;
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		

    },
	function(){
		this.title = this.t;		
		$("#tooltip").remove();
    });	
	$("a.tooltip").mousemove(function(e){
				if (e.pageX>700) e.pageX=e.pageX-455;
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};


















