var t;
var defaultLinkIndex = 0;

function timedCount()
{
	defaultLinkIndex = defaultLinkIndex + 1;
	if (defaultLinkIndex == $(".items1").length) {
		defaultLinkIndex = 0;
	}
	$("#hidTest").val(defaultLinkIndex);
	$(".items1").eq(defaultLinkIndex).trigger('mouseover');	
	t = setTimeout("timedCount()", 5000); //8000
}


function stopCount()
{
	clearTimeout(t);
}


jQuery(function($) {
	
	//$("a.app").fancybox();	
	
	
	
	/*$(".items1").bind('mouseover', function() {  
		itemMouseover(this);
		stopCount();
	});
	
	$(".items1").bind('mouseout', function() {		
		itemMouseout(this);	
		t = setTimeout("timedCount()", 5000);
	});	

	$(".banner_content_left1").bind('mouseover', function() {		
		stopCount();
	});
	
	$(".banner_content_left1").bind('mouseout', function() {		
		t = setTimeout("timedCount()", 5000);
	});	
	
	
	
	timedCount();*/
	
	//Fix one doller banner height and width
	$("a.oneDollerBanner").fancybox({	 
		'frameWidth': 378,
		'frameHeight': 155,
		'overlayOpacity' : .65,
		'zoomSpeedIn' : 600,
		'zoomSpeedOut' : 500,
		'easingIn'	: 'easeOutBack',
		'easingOut'	: 'easeInBack',
		'zoomOpacity' : true
	});	
	
});


/*'overlayShow'			: false,
		'zoomSpeedIn'			: 600,
		'zoomSpeedOut'			: 500,
		'easingIn'				: 'easeOutBack',
		'easingOut'				: 'easeInBack'*/



function itemMouseover(obj)
{ 
	var itemHTML = $(obj).children("span").html(); 
	itemHTML = itemHTML.toLowerCase();
	itemHTML = itemHTML.replace(' ', '_');
	$('.banner_content_left1').hide();	
	$('#'+itemHTML).show(); //3000

	newClass = $(obj).attr("class").replace(/image/g, '');		
			
	// Remove current class from all items i.e. unset from all and then ...
	$(".items1").removeClass('current');
	$(".items1").removeClass('first');
	$(".items1").removeClass('last');

	// Add current class to mouseover element		
	if ($(".items1").index(obj) == 0) {
		$(obj).addClass('first');
	} else if ($(".items1").index(obj) == ($(".items1").length - 1)) {
		$(obj).addClass('last');
	} else {
		$(obj).addClass('current');
	}		
	
	defaultLinkIndex = $(".items1").index(obj);
}


function itemMouseout(obj)
{
	oldClass = $(obj).attr("class") + ' image';
}


