var T;
var d = document;
function show(id) {

	for (var i=1; i<4 ; i++ ) {
		if($('#i_'+i)) {
			$('#i_'+i).hide();
		}
	}
	
	for (var i=1; i<4 ; i++ ) {
		$('#ii_'+i).css('position','static');
	}
	
	$('#ii_'+ id ).css('position','relative');
	$('#i_' + id).fadeIn(300);
	
}
function over() { clearTimeout(T) }
function hide(id) {
	T = setTimeout(function(){
			$('#i_'+ id ).hide();
			$('#ii_'+ id ).css('position','static');
		}, 200);
}

function show_news(){
	$('#news_lent').hide();
	$('#action').fadeIn(600);
	$('#nws').fadeIn(300);
	$('#nws_1').hide();
	$('#act').hide();
	$('#act_1').fadeIn(300);
	$('#nws_11').hide();
	$('#nws_10').fadeIn(300);
}
function show_action(){
	$('#news_lent').fadeIn(600);
	$('#action').hide();
	$('#nws_10').hide();
	$('#nws_1').fadeIn(300);
	$('#nws_11').fadeIn(300);
	$('#nws').hide();
	$('#act_1').hide();
	$('#act').fadeIn(300);
}

function sh_i(){
	$('#liise').show();
	$('#liis').hide();
	$('#ger1').hide();
	$('#ger4').hide();
	$('#ger2').show();
	$('#ger3').show();
}
function hid_i(){
	$('#liis').show();
	$('#liise').hide();
	$('#ger2').hide();
	$('#ger3').hide();
	$('#ger1').show();
	$('#ger4').show();
}

function in_cart(id) {
	$.ajax({
	    url: '/incart/' + id,             
	    dataType : "text",                     
	    success: function (data, textStatus) { 
			if (textStatus == 'success') {	
				$('#item_' + id).hide();
				$('#item_of_' + id).show();
				$('#count_in_cart').text(data);
			}
	    }
	});
}

function of_cart(id) {
	$.ajax({
	    url: '/of_cart/' + id,            
	    dataType : "text",                     
	    success: function (data, textStatus) { 
			if (textStatus == 'success') {
				
				$('#item_' + id).show();
				$('#item_of_' + id).hide();
				$('#count_in_cart').text(data);

			}
	    }
	});
}

$(document).ready(function(){
	$.ajax({
	    url: '/count_in_cart/',          
	    dataType : "text",                  
	    success: function (data, textStatus) { 
			//alert();
			if (textStatus == 'success') {
				$('#count_in_cart').text(data);
			}
	    }
	});
});
