jQuery(document).ready(function(){
	function hoverout(){};
	function hoverover(){
		//var hoverimg=jQuery(this).attr('src');
		var path='xml/ajax/';
		var title='';
		if(jQuery(this).attr('id')=='topautosbutton'){
			file=path+'topads.php?ads=car';
			title='Top Autos';
		}
		else if(jQuery(this).attr('id')=='tophomesbutton'){
			file=path+'topads.php?ads=home';
			title='Top Homes';
		}
		else if(jQuery(this).attr('id')=='toprentalsbutton'){
			file=path+'topads.php?ads=rent';
			title='Top Rentals';
		}
		jQuery('#topads_listings_title').text(title);
		jQuery('#topads_listings').html('<li><h3>Loading...</h3></li>');
		jQuery.get(file, function(data){
		  jQuery('#topads_listings').html(data);
		});
		return false;
	};
	var config = {    
	sensitivity: 3, // number = sensitivity threshold (must be 1 or higher)    
	interval: 25, // number = milliseconds for onMouseOver polling interval    
	over: hoverover, // function = onMouseOver callback (REQUIRED)    
	timeout: 500, // number = milliseconds delay before onMouseOut    
	out: hoverout // function = onMouseOut callback (REQUIRED)    
	};
	$("#topautosbutton").hoverIntent(config);
	$("#tophomesbutton").hoverIntent(config);
	$("#toprentalsbutton").hoverIntent(config);
	/*
	jQuery("#topautosbutton").mouseover(function(){
		var path='xml/ajax/';
		var title='';	
		file=path+'topads.php?ads=car';
		title='Top Autos';
		jQuery.get(file, function(data){
		  jQuery('#topads_listings_title').text(title);
		  jQuery('#topads_listings').html(data);
		});
		return false;
	});
	jQuery("#tophomesbutton").mouseover(function(){
		var path='xml/ajax/';
		var title='';	
		file=path+'topads.php?ads=home';
		title='Top Homes';
		jQuery.get(file, function(data){
		  jQuery('#topads_listings_title').text(title);
		  jQuery('#topads_listings').html(data);
		});
		return false;
	});
	jQuery("#toprentalsbutton").mouseover(function(){
		var path='xml/ajax/';
		var title='';	
		file=path+'topads.php?ads=rent';
		title='Top Rentals';
		jQuery.get(file, function(data){
		  jQuery('#topads_listings_title').text(title);
		  jQuery('#topads_listings').html(data);
		});
		return false;
	});
	*/
	$('.topadlistitem').livequery('click',function(){
		var adid=$(this).attr('title');
		window.open( "topads_detail.php?id="+adid, "TopAdsWindow", "status = 1, height = 400, width = 450,scrollbars=yes,resizable=yes" );
		return false;
	});
	$('.topadlistall').livequery('click',function(){
		var adid=$(this).attr('title');
		window.open( "topads_detail.php?action="+adid, "TopAdsWindow", "status = 1, height = 400, width = 450,scrollbars=yes,resizable=yes" );
		return false;
	});
});