$(document).ready(function(){
	getModels();
	getManifacturers();

	$("#sendToFriendButton").bind("click", function(){
		if ($("#sendToFriendForm").css("display") == "none"){
			$("#sendToFriendForm").slideDown();
		}else{
			$("#sendToFriendForm").slideUp();
		}
	});
    hs.graphicsDir = '/images/highslide/';
    hs.outlineType = 'rounded-white';
    hs.outlineWhileAnimating = true;

	 $('a.highslide').click(function() {
		 return hs.expand(this,	{ outlineType: 'rounded-white' });
	 });
});

function getManifacturers(){
	$("select[name=product_type_id]").bind("change", function(){
		$.ajax({
			type: "POST",
			url: "getManifacturers.php",
			data: "product_type_id="+$(this).val(),
			success: function(data){
				$("#manifacturers").empty();
				$("#manifacturers").append(data);
				getModels();
			},
			error: function(p1,p2,p3){
				alert(p1);
				alert(p2);
				alert(p3);
			}
		});
	});
}

function getModels(){
	$("select[name=manifacturer_id]").bind("change", function(){
		$.ajax({
			type: "POST",
			url: "getModels.php",
			data: "manifacturer_id="+$(this).val(),
			success: function(data){
				$("#models").empty();
				$("#models").append(data);
			},
			error: function(p1,p2,p3){
				alert(p1);
				alert(p2);
				alert(p3);
			}
		});
	});
}