
//var $j = jQuery.noConflict(); 
//Banner TItle & Banner 
var bannerTitle = new Array();
var bannerText = new Array();

bannerTitle['hp-header-1']		=	"Houle Games &amp; Entertainment" ;
bannerText['hp-header-1']		=	'<strong>Interactive Games, Entertainment & Activity Rentals For Any Event!</strong> <br /> Supplying entertainment for Corporate, Community, Private Parties, School & Grad Events in the Greater Vancouver Area. <strong> Call Houle Games 604-469-0359</strong> for all of your entertainment needs. We will make your event a success and leave your guests talking about it for a long time to come!' ;

bannerTitle['hp-header-2']		=	"Deluxe Cash Grab Money Booth" ;
bannerText['hp-header-2']		=	"<strong>Do you need a promotional or marketing tool that will capture everyones attention?</strong> <br /> The Cash Grab Money Booth has all the bells and whistles! Create your own special coupons or use our phony greenbacks and watch the frenzied excitement as guests try to catch as many swirling bills out of the air as they can, in a pre-determined amount of time." ;

bannerTitle['hp-header-3']		=	"Arcade and Video Games" ;
bannerText['hp-header-3']		=	"<strong>Make your next party a memorable one!</strong><br /> Houle Games can provide arcade and video game rentals for your next event: Dance Dance Revolution, Rockband, Golf, XBox & Wii! Be sure to ask about out Ski & Snowboard Simulators!" ;

bannerTitle['hp-header-4']		=	"Micro Stock Car Racing" ;
bannerText['hp-header-4']		=	"<strong>The absolute Best interactive sport participation game on the market today!</strong> <br /> Our Micro Stock Car Racing is an exciting, action packed activity that allows players to race giant remote controls cars around a 28 foot track! Race 4 to 10 giant SLOTLESS nascar-style remote control cars driven from your own steering stations. Perfect for team play or individual tournament races at any event." ;

var FirstBannerText = bannerText['hp-header-1'];

jQuery(document).ready(function(){

	/* HOMEPAGE BANNER*/
	var rotateInt = '';
	var bannerText = new Array();

	// Show Text and title at start up
	jQuery(".banner-txt .banner-title").html(bannerTitle['hp-header-1']);
	jQuery(".banner-txt .banner-text").html( FirstBannerText);

	if (jQuery(".cms-home").length)	{
		var firstRun = true; // the first time through, this will prevent the 'fast' switching effect
		jQuery(".image-container ul#banner-controls li").click(function(e){
			if (rotateInt)
			{
				clearInterval(rotateInt);
			}
			jQuery(".image-container ul#banner-controls li").removeClass('current'); // remove all .current classes from all <li>
			var prev = jQuery(e.target).prev("li"); // grab the previous <li>
			if (!prev.length) // 
			{
				prev = jQuery(".image-container ul#banner-controls li:last"); // if there isn't one, set the previous <li> to the last one in the <ul>
			}
			prev.addClass('current'); // add the .current class to the previous element
			if (!firstRun)
			{
				setTimeout("rotate()",10); // if it's not the first run, do a 'fast' switching effect
			}
			firstRun = false;
			rotateInt = setInterval("rotate()",8000);
		}).eq(1).click();

	}// end if

	/* Add to Quote product list*/
	jQuery(".products-list li .product-shop .btn-quote").click(function(e){
		openListQuoteForm(e);
	})

	/* Add to Quote product view */
	/*
	jQuery(".product-view .product-shop .btn-quote-view").click(function(e){
		openViewQuoteForm(e);
	})
	*/
	

});


function rotate() {
	//bannerTitle['hp-header-1']		=	'title 1' ;
	//alert(bannerTitle['hp-header-1']);
	var next = jQuery(".image-container ul#banner-controls li:first");
	if (jQuery(".image-container ul#banner-controls li.current").next("li").length)
	{
		next = jQuery(".image-container ul#banner-controls li.current").next("li");
	}
	var filename = next.attr('id');
	jQuery(".image-container ul#banner-controls li").removeClass('current');
	next.addClass('current');
	jQuery(".image-container img").fadeOut(700, function(){
			jQuery(".banner-txt .banner-title").html(bannerTitle[filename]);
			jQuery(".banner-txt .banner-text").html(bannerText[filename]);
		jQuery(this).attr('src','/skin/frontend/default/houlegames/images/'+filename+'.jpg').load(function(){
			jQuery(".image-container img").fadeIn(700);
		});
	});


}

function openListQuoteForm(e){
	var target = jQuery(e.target);
	var selectedProduct = target.parent().parent().children("h2.product-name").children("a").attr("title");

	//Ajax
	jQuery.post("/skin/frontend/default/houlegames/extra/quoteForm/request-quote-helper.php", {
		productName: selectedProduct}, 
			function(data){
			quoteWin = window.open('/skin/frontend/default/houlegames/extra/quoteForm/request-a-quote.php', 'popup', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=625, height=600');
				//alert("data loaded: " + data);
				
	});	
}

function openViewQuoteForm(e){
	var target = jQuery(e.target);
	var selectedProduct = target.parent().siblings(".product-name").children("h1").html();
	//Ajax
	jQuery.post("/skin/frontend/default/houlegames/extra/quoteForm/request-quote-helper.php", {
		productName: selectedProduct}, 
			function(data){
			quoteWin = window.open('/skin/frontend/default/houlegames/extra/quoteForm/request-a-quote.php', 'popup', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=625, height=600');
				
	});	
}
