$(document).ready(function() { 
	$('#mark').change(function(){
		var mark = $('#mark')[0].value;
		getCarModelByMark(mark);
	});
 
	//$('table.catalouge thead a').addClass('');
}); 
function openSpecification(){	$('.info').hide();	$('.spec').show();}function openDescription(){	$('.spec').hide();	$('.info').show();	}
function GetPageContent(page_body){
	$('.Middle').html('');
	$('.Middle').html(page_body);
}

/**************************************
* Mazā groziņa satura izmēra palielināšana
**************************************/
function changeShoppingCartSize(){
	var height = $('.shopping_cart')[0].clientHeight;
	height = height + 42;
	$('.shopping_cart').css('height', height);
}

/**************************************
* Mazā groziņa satura atjaunošana
**************************************/
function refreshCart(){
	$.post("proces.php", { refreshCart: "1" },
		function(data){
	    refreshCartContent(data);
	}, "html");
}
function refreshCartContent(content){	
}

/**************************************
* MAŠĪNAS 
**************************************/
function getCarModelByMark(mark){
	$.post("proces.php", { getCarModel: "1", mark: mark },
		function(data){
			$('#model').html(data);
	}, "html");
}


/**************************************
* DISKI - satura iegūšanas un pievienošanas funkcijas
**************************************/
function getRimInfo(id){	
	$.post("proces.php", { getRimInfo: "1", id: id },
		function(data){
	    openInfoPanel(data);
	}, "html");
}


/**************************************
* RIEPAS - satura iegūšanas un pievienošanas funkcijas
**************************************/
function getTireInfo(id){
	$.post("proces.php", { getTireInfo: "1", id: id },
		function(data){
	    openInfoPanel(data);
	}, "html");
}


function openInfoPanel(panelText){
	$.blockUI({ 
	    message: panelText,             
		css: {top: '10%',left: '20%', width: '700px', height: '400px'}
				
	}); 
	$('.blockOverlay').click($.unblockUI);
}

/**************************************
* SHOPPING CART
**************************************/
function addProductToShoppingCart(product, id){
	$.post("proces.php", { addProductToShoppingCart: "1", id: id, product: product },
		function(data){
			$('#shopping_cart').append(data);
	}, "html");
}