
var $j = jQuery.noConflict();
/*
 * Use $j instead of $ for any Jquery
 * example $('selector').hide();
 * $j('selector').hide();
 */

//Banner TItle & Banner 
var bannerTitle = new Array();
var bannerText = new Array();
var bannerLink = new Array();

bannerTitle['hp-header-1']	=	"Performance manufactures affordable, quality office furniture to suit the needs of all office environments." ;
bannerText['hp-header-1']	=	'Sofa seating collection &#8250;' ;
bannerLink['hp-header-1']	=	"/seating/sofa-collections";

bannerTitle['hp-header-2']	=	"Performance manufactures affordable, quality office furniture to suit the needs of all office environments." ;
bannerText['hp-header-2']	=	"Board Room Collection &#8250;" ;
bannerLink['hp-header-2']	=	"/ez-linx-conference-and-seminar-tables";

bannerTitle['hp-header-3']	=	"Performance manufactures affordable, quality office furniture to suit the needs of all office environments." ;
bannerText['hp-header-3']	=	"View Product Line &#8250;" ;
bannerLink['hp-header-3']	=	"/tables/classic-conference-table";

bannerTitle['hp-header-4']	=	"Performance manufactures affordable, quality office furniture to suit the needs of all office environments." ;
bannerText['hp-header-4']	=	"View Product Line &#8250;" ;
bannerLink['hp-header-4']	=	"/storage-cabinets";



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

$j(document).ready(function (){
	rotate();
	/* HOMEPAGE BANNER*/
	var rotateInt = '';
	var bannerText = new Array();
	
	if ($j(".cms-home").length)	{
		var firstRun = true; // the first time through, this will prevent the 'fast' switching effect
		$j(".image-container ul#banner-controls li").click(function(e){
			e.preventDefault();

			if (rotateInt)
			{
				clearInterval(rotateInt);
			}
			$j(".image-container ul#banner-controls li").removeClass('current'); // remove all .current classes from all <li>
			var prev = $j(e.target).prev("li"); // grab the previous <li>
			if (!prev.length) // 
			{
				prev = $j(".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
	
	//alert($j('.hp-pods').html());
	
	// Menu Tabs

	$j(".tab_content").hide(); //Hide all content
	$j("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$j(".tab_content:first").show(); //Show first tab content

	//On Click Event
	$j("ul.tabs li").click(function() {

		$j("ul.tabs li").removeClass("active"); //Remove any "active" class
		$j(this).addClass("active"); //Add "active" class to selected tab
		$j(".tab_content").hide(); //Hide all tab content
		//alert($(this).html());
		var activeTab = $j(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		//alert(activeTab);
		$j(activeTab).fadeIn(); //Fade in the active ID content
		return false;
	});
	
	
});

function rotate() {
	//bannerTitle['hp-header-1']		=	'title 1' ;
	//alert(bannerTitle['hp-header-1']);
	var next = $j(".image-container ul#banner-controls li:first");
	if ($j(".image-container ul#banner-controls li.current").next("li").length)
	{
		next = $j(".image-container ul#banner-controls li.current").next("li");
	}
	var filename = next.attr('id');

	$j(".image-container ul#banner-controls li").removeClass('current');
	next.addClass('current');
	$j(".image-container img").fadeOut(700, function(){
			$j(".banner-link").attr('href', bannerLink[filename]);
			$j(".banner-txt .banner-title").html(bannerTitle[filename]);
			$j(".banner-txt .banner-text").html(bannerText[filename]);
		$j(this).attr('src','/skin/frontend/default/performancefurnishings/images/'+filename+'.jpg').load(function(){
			$j(".image-container img").fadeIn(700);
		});
	});


}


// Carousel banner
/*
function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
        auto: 3,
        wrap: 'last',
        scroll: '1',
        initCallback: mycarousel_initCallback
    });
});
*/
