//Lang file.
var lang = 'pl';
var vehicles_loading = '';
var kubatura = '';
var wymiary = '';

function show_car(carid){
	
	if(window.lang == 'pl'){
		window.vehicles_loading = ' Trwa wczytywanie...';
		window.kubatura = 'Kubatura';
		window.wymiary = 'Wymiary';
	}
	else{
		window.vehicles_loading = " Loading...";
		window.kubatura = 'Cubic measure';
		window.wymiary = 'Sizes';
	}

	$("#car").css("display", "block");
	$("#zdjecie").attr("src", "templates/default/images/mozilla_blu.gif");
	$("#nazwa").html("<img src='templates/default/images/mozilla_blu.gif' alt='"+window.vehicles_loading+"'/><span style='font-size: 10px; color: #000'>"+window.vehicles_loading+"</span>");
	$("#pojemnosc").html("-");		
	$("#osoby").html("-");	
	$("#wyposazenie").html("-");
	if ($("kubatura").html() != "")
		$("#kubatura").html("-");
	if ($("wymiary").html() != "")
		$("#wymiary").html("-");			
	$("#l_12").html("-");	
	$("#l_36").html("-");	
	$("#l_713").html("-");	
	$("#l_1429").html("-");	
	$("#l_31").html("-");
	$("#n_12").html("-");	
	$("#n_36").html("-");	
	$("#n_713").html("-");	
	$("#n_1429").html("-");	
	$("#n_31").html("-");	

	$.ajax({
	   type: "GET",
	   dataType: "json",
	   cache: false,
	   url: 'ajax.php?module=vehicles&carid='+carid,
	   
		success: function(msg){
			//alert(msg.samochod.l_12);
			$("#nazwa").html(msg.samochod.nazwa);
			$("#pojemnosc").html(msg.samochod.pojemnosc);
			$("#osoby").html(msg.samochod.osoby);
			$("#wyposazenie").html(msg.samochod.wyposazenie);
			$("#zdjecie").attr("src", msg.samochod.zdjecie);
			
			if (msg.samochod.cubic != ""){
				$("#div_kubatura").html("<p>"+window.kubatura+":</p>");
				$("#kubatura").html("<p>"+msg.samochod.cubic+"</p>");
			}
			else{
				$("#div_kubatura").html("");
				$("#kubatura").html("");
			}
			
			if (msg.samochod.size != ""){
				$("#div_wymiary").html("<p style='margin-bottom: 24px'>"+window.wymiary+":</p>");
				$("#wymiary").html("<p>"+msg.samochod.size+"</p>");
			}
			else{
				$("#div_wymiary").html("");
				$("#wymiary").html("");
			}
			
			$("#l_12").html(msg.samochod.l_12);	
			$("#l_36").html(msg.samochod.l_36);	
			$("#l_713").html(msg.samochod.l_713);	
			$("#l_1429").html(msg.samochod.l_1429);	
			$("#l_31").html(msg.samochod.l_31);
			$("#n_12").html(msg.samochod.n_12);	
			$("#n_36").html(msg.samochod.n_36);	
			$("#n_713").html(msg.samochod.n_713);	
			$("#n_1429").html(msg.samochod.n_1429);	
			$("#n_31").html(msg.samochod.n_31);				
		},
		
		error: function(msg){
		}
	});
}
