jQuery(document).ready(function(){
    jQuery("#menu a").mouseover(function(){
        jQuery(this).stop();
        jQuery(this).animate({ opacity: 0 }, 300);
    });
    jQuery("#menu a").mouseout(function(){
        jQuery(this).stop();
        jQuery(this).animate({ opacity: 1.0 }, 300);
    });
});

/*
 * Image preview script 
 * powered by jQuery (http://www.jquery.com)
 * 
 * written by Alen Grakalic (http://cssglobe.com)
 * 
 * for more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
 *
 */
 
this.imagePreview = function(){	
	/* CONFIG */
		
		xOffset = 400;
		yOffset = 250;
		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result
		
	/* END CONFIG */
	jQuery("a.preview").hover(function(e){
		this.t = this.title;
		this.title = "";	
		var c = (this.t != "") ? "<br/>" + this.t : "";
		jQuery("body").append("<p id='preview'><img src='"+ this.href +"' alt='Image preview' />"+ c +"</p>");								 
		jQuery("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");						
    },
	function(){
		this.title = this.t;	
		jQuery("#preview").remove();
    });	
	jQuery("a.preview").mousemove(function(e){
		jQuery("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};


// starting the script on page load
jQuery(document).ready(function(){
	imagePreview();
});

/*
 * Tooltip script 
 * powered by jQuery (http://www.jquery.com)
 * 
 * written by Alen Grakalic (http://cssglobe.com)
 * 
 * for more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
 *
 */
 


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 */		
	jQuery("a.tooltip").hover(function(e){											  
		this.t = this.title;
		this.title = "";									  
		jQuery("body").append("<p id='tooltip'>"+ this.t +"</p>");
		jQuery("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },
	function(){
		this.title = this.t;		
		jQuery("#tooltip").remove();
    });	
	jQuery("a.tooltip").mousemove(function(e){
		jQuery("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};



// starting the script on page load
jQuery(document).ready(function(){
	tooltip();
});

/*
 * 
 * 
 * 'id=' +id
 * */
 function GetPart(part) {
 jQuery.get('/ajax.php?mode=getpart&part='+part,  function(data){
  //alert("Data Loaded: " + data);
  document.getElementById('choosepart2').innerHTML = data;
  });
};
 function GetPrice(part) {
 jQuery.get('/ajax.php?mode=getprice&part='+part,  function(data){
  //alert("Data Loaded: " + data);
  document.getElementById('partprice').style.display="block";
  document.getElementById('partprice').innerHTML = data;
  });
};
/*************/
function changemake(id) {
 jQuery.post('/auto/getmodel/', {'id': id},  function(data){
  //alert("Data Loaded: " + data);
  document.getElementById('modelselect').innerHTML = data;
  
  });

}
function LoadMainSearchModels(part) {
	 jQuery.get('/ajax.php?mode=getmodel&part='+part,  function(data){
  document.getElementById('mainsearchmodel').style.display="block";
  document.getElementById('mainsearchmodel').innerHTML = data;
  });
}
function UpdateYears() {
	document.getElementById('year1').disabled=false;
	document.getElementById('year2').disabled=false;
}