// JavaScript Document

$(document).ready(function () { init() });

var anitimer = 500;
var currenttab = 1;
var navtab = 1;
var currentproduct = 1;

// ////////////////////////////////////////////////////////
function showtab (number)
{
	if (currenttab == number){
	} else {
		currenttab = Number(number);
		$('#tab01').hide();
		$('#tab02').hide();
		$('#tab03').hide();
		$('#tab04').hide();
		$('#tm01').removeClass('tabselected');
		$('#tm02').removeClass('tabselected');
		$('#tm03').removeClass('tabselected');
		$('#tm04').removeClass('tabselected');
		$('#tab'+number).fadeIn(anitimer);
		$('#tm'+number).addClass('tabselected');
	}
};

function prevtab (){
	navtab = Number(currenttab - 1);
	if (navtab < 1){
		navtab = 4;
	}
	showtab('0'+navtab);
};

function nexttab (){
	navtab = Number(currenttab + 1);
	if (navtab > 4){
		navtab = 1;
	}
	showtab('0'+navtab);
};

function showlocator ()
{
	hidesocial();
	hideretailer();
	$('#locator').slideDown(anitimer);
};

function hidelocator ()
{
	$('#locator').slideUp(anitimer);
};

function showsocial ()
{
	hidelocator();
	hideretailer();
	$('#social').slideDown(anitimer);
};

function hidesocial ()
{
	$('#social').slideUp(anitimer);
};

function showretailer ()
{
	$('#rc_noerror').show();
	$('#rc_error').hide();
	hidelocator();
	hidesocial();
	$('#retailer').slideDown(anitimer);
};

function hideretailer ()
{
	$('#retailer').slideUp(anitimer);
	document.getElementById('password').value = "";
};

function init ()
{
	$('#locator').hide();
	$('#social').hide();
	$('#retailer').hide();
};






var params = {allowFullscreen:"true", allowScriptAccess:"always", wmode:"transparent"}
var attributes = {id: "flash"};

swfobject.embedSWF("intro.swf", "hotsoxflash", "966", "472", "9.0.45", "", null, params, attributes);

SWFAddress.onChange = function() {
	switch (SWFAddress.getValue()){
		case "/?product=1":
			showproduct(1);
		break;
		case "/?product=2":
			showproduct(2);
		break;
		case "/?product=3":
			showproduct(3);
		break;
		case "/?product=4":
			showproduct(4);
		break;
		case "/?product=5":
			showproduct(5);
		break;
		case "/?product=6":
			showproduct(6);
		break;
		default:
		break;
	};
}

function showproduct (number){
	currentproduct = number;
	$('#pi01').hide();
	$('#pi02').hide();
	$('#pi03').hide();
	$('#pi04').hide();
	$('#pi05').hide();
	$('#pi06').hide();
	$('#pr01').hide();
	$('#pr02').hide();
	$('#pr03').hide();
	$('#pr04').hide();
	$('#pr05').hide();
	$('#pr06').hide();
	$('#popup').hide();
	$('#overlay').fadeIn(anitimer, showproductcontent);
	$('#pi0'+number).show();
	$('#pr0'+number).show();
	SWFAddress.setValue(("/?product="+currentproduct));
};

function hideproduct (){
	$('#overlay').hide();
	SWFAddress.setValue("");
};

function showproductcontent (){
	$('#popup').fadeIn(anitimer);
};

function nextproduct () {
	currentproduct++;
	if (currentproduct > 6){
		currentproduct = 1;
	}
	showproduct (currentproduct);
};

function previousproduct(){
	currentproduct--;
	if (currentproduct < 1){
		currentproduct = 6;
	}
	showproduct (currentproduct);
};

function trycatalog (){
	if (document.getElementById('password').value == "7952"){
		window.open('pdf/HTSX_FA10_Cat_W_100406_LD1.pdf','_blank','width=800,height=600,screenX=200,screenY=200');
		hideretailer();
	}	else {
		$('#rc_noerror').hide();
		$('#rc_error').fadeIn(anitimer);
	}
};