/*
var onImg = new Array();
var offImg = new Array();

var imageDir = documentRoot + "graphics/";
var imageNames = new Array('nav_newproducts','nav_daisy','nav_powerline','nav_powerlinesl','nav_winchester','nav_avanti','nav_precisionmax','nav_collectibles','nav_logomerch');
if (document.images) {
  for (var i = 0; i < imageNames.length; i++) {
    refName = imageNames[i];
    imgName = imageDir + refName + "_off.gif";
	imgHLName = imageDir + refName + "_on.gif";
	onImg[refName] = new Image();
	offImg[refName] = new Image();
	onImg[refName].src = imgHLName;
	offImg[refName].src = imgName;
  };
};

// Swap images on based on a name array
function imageOn(name) {
   if (document.images) {
    document.images[name].src = onImg[name].src
   };
};

// Swap images off based on a name array
function imageOff(name) {
   if (document.images) {
    document.images[name].src = offImg[name].src
   };
};
*/

//Functinons for New Products page DHTML
/*
var allGuns = new Array( '2004_1000sb', '2004_1000sc', '2004_840bgrizzly', '2004_840bgrizzlyk', '2004_backyard', '2004_pl2856', '2004_pl617x', '2004_pl856k', '2004_pl8856', '2004_pltp953', '2004_redryder' );
var allAccessories = new Array(  '2004_plthenatural', '2004_sb6shooter', '2004_sbtargetholders', '2004_sbtargets' );

var allGuns = new Array( '2004_pl8856', '2004_pl856k', '2004_pl880k', '2004_840bgrizzly', '2004_redryder', '2004_840bgrizzlyk', '2004_pltp953', '2004_1000sc', '2004_1000sb', '2004_pl617x' );
var allAccessories = new Array( '2004_sb6shooter', '2004_sbtargetholders', '2004_plthenatural', '2004_sbtargets' );
*/
var daisyguns = new Array( '2005_nodaisy' );
var plguns = new Array( '2005_pl_kit_953', '2005_pl_r_901' ); // , '2005_pl_p_008'
var slingshots = new Array( '2005_nodaisy' ); // '2005_pl_sl_erg'
var winchester = new Array( '2005_nowinchester' );
var accessories = new Array( '2005_lasersight' ); // '2005_glasses'


function showNewProduct (whichProduct)
	{
	el = 'product_' + whichProduct;
	document.getElementById(el).style.display = 'block';
	}

function hideNewProduct (whichProduct)
	{
	el = 'product_' + whichProduct;
	//alert (el);
	document.getElementById(el).style.display = 'none';
	}


function showAllNewProducts (productType)
	{
	switch (productType)
		{
		case 'daisyguns' :
			hideAllNewProducts ();
			for ( var i = 0; (i <= (daisyguns.length - 1)); i++) 
				{
				showNewProduct (daisyguns[(i)]);
				}
			break;
			
		case 'plguns' :
			hideAllNewProducts ();
			for ( var i = 0; (i <= (plguns.length - 1)); i++) 
				{
				showNewProduct (plguns[(i)]);
				}
			break;
			
		case 'slingshots' :
			hideAllNewProducts ();
			for ( var i = 0; (i <= (slingshots.length - 1)); i++) 
				{
				showNewProduct (slingshots[(i)]);
				}
			break;
			
		case 'winchester' :
			hideAllNewProducts ();
			for ( var i = 0; (i <= (winchester.length - 1)); i++) 
				{
				showNewProduct (winchester[(i)]);
				}
			break;
			
		case 'accessories' :
			hideAllNewProducts ();
			for ( var i = 0; (i <= (accessories.length - 1)); i++) 
				{
				showNewProduct (accessories[(i)]);
				}
			break;

		default :
			for ( var i = 0; (i <= (daisyguns.length - 1)); i++) 
				{
				showNewProduct (daisyguns[(i)]);
				}
			for ( var i = 0; (i <= (plguns.length - 1)); i++) 
				{
				showNewProduct (plguns[(i)]);
				}
			for ( var i = 0; (i <= (slingshots.length - 1)); i++) 
				{
				showNewProduct (slingshots[(i)]);
				}
			for ( var i = 0; (i <= (winchester.length - 1)); i++) 
				{
				showNewProduct (winchester[(i)]);
				}
			for ( var i = 0; (i <= (accessories.length - 1)); i++) 
				{
				showNewProduct (accessories[(i)]);
				}
			break;
			
		}
	}

function hideAllNewProducts (productType)
	{
	switch (productType)
		{
		case 'daisyguns' :
			for ( var i = 0; (i <= (daisyguns.length - 1)); i++) 
				{
				hideNewProduct (daisyguns[(i)]);
				}
			break;
			
		case 'plguns' :
			for ( var i = 0; (i <= (plguns.length - 1)); i++) 
				{
				hideNewProduct (plguns[(i)]);
				}
			break;
			
		case 'slingshots' :
			for ( var i = 0; (i <= (slingshots.length - 1)); i++) 
				{
				hideNewProduct (slingshots[(i)]);
				}
			break;
			
		case 'winchester' :
			for ( var i = 0; (i <= (winchester.length - 1)); i++) 
				{
				hideNewProduct (winchester[(i)]);
				}
			break;
			
		case 'accessories' :
			for ( var i = 0; (i <= (accessories.length - 1)); i++) 
				{
				hideNewProduct (accessories[(i)]);
				}
			break;
			
		default :
			for ( var i = 0; (i <= (daisyguns.length - 1)); i++) 
				{
				hideNewProduct (daisyguns[(i)]);
				}
			for ( var i = 0; (i <= (plguns.length - 1)); i++) 
				{
				hideNewProduct (plguns[(i)]);
				}
			for ( var i = 0; (i <= (slingshots.length - 1)); i++) 
				{
				hideNewProduct (slingshots[(i)]);
				}
			for ( var i = 0; (i <= (winchester.length - 1)); i++) 
				{
				hideNewProduct (winchester[(i)]);
				}
			for ( var i = 0; (i <= (accessories.length - 1)); i++) 
				{
				hideNewProduct (accessories[(i)]);
				}
			break;
			
		}
	}


function scrollToProducts ()
	{
	window.scrollTo(0, 550 );
	}



/*
 * Function for talking to Flash on Home Page movies
 * Flash movie "listener" for _level0:command variable
 */
function sendFlash (whichMovie, a)
	{
	if ('main' == whichMovie)
		{
		document.main.setVariable('command', a);
		}
	else if ('overlay' == whichMovie)
		{
		document.overlay.setVariable('command', a);
		}
	else if ('all' == whichMovie)
		{
		document.main.setVariable('command', a);
		document.overlay.setVariable('command', a);
		}
	}

/*
 * Functions for Flash to talk to JavaScript through fscommands
 */
var htmlLoaded = 0;
var movie1Loaded = 0;
var movie2Loaded = 0;

var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1; // Handle all the the FSCommand messages in a Flash movie

// functions from Flash Movie1
function main_DoFSCommand(command, args)
	{
  var movie1Obj = InternetExplorer ? main : document.main;

	switch (command)
		{
		case "browserAlert" :
			alert (args);
			break;

		case "checkHtmlLoaded" :
			sendFlash ('main', 'htmlLoaded');
			break;

		case"reportMovieLoaded" :
			sendFlash ('overlay', 'otherMovieLoaded');
			movie1Loaded = 1;
			break;

		case "checkOtherMovieLoaded" :
			if (1 == movie2Loaded)
				{
				sendFlash ('main', 'otherMovieLoaded')
				}
			else
				{
				return;
				}
			break;

		} // end switch
	} // end function

// functions from Flash Movie2
function overlay_DoFSCommand(command, args)
	{
  var movie1Obj = InternetExplorer ? overlay : document.overlay;

	switch (command)
		{
		case "browserAlert" :
			alert (args);
			break;

		case "checkHtmlLoaded" :
			sendFlash ('overlay', 'htmlLoaded');
			break;

		case"reportMovieLoaded" :
			sendFlash ('main', 'otherMovieLoaded');
			movie2Loaded = 1;
			break;

		case "checkOtherMovieLoaded" :
			if (1 == movie1Loaded)
				{
				sendFlash ('overlay', 'otherMovieLoaded')
				}
			else
				{
				return;
				}
			break;

		} // end switch
	} // end function

function setHtmlLoaded()
	{
	htmlLoaded = 1;
	if ((document.getElementById) && (navigator.appName.indexOf("Microsoft") != -1) && (navigator.appVersion.indexOf("MSIE 5") == -1))
		{
		sendFlash ('main', 'htmlLoaded');
		sendFlash ('overlay', 'htmlLoaded');
		}
	}


function popUp(whatType)
{
	var popUpURL, popupName, popUpParams;
	
	switch (whatType)
	{
	case "aiae_award" :
		popUpURL = documentRoot + '_managepassword.phtml';
		popupName = 'managePassword';
		popUpParams = 'toolbar=1,status=0,scrollbars=1,resizable=0,height=400,width=600';
		break;

	default :
		if (arguments.length >= 1)
		{
			alert (arguments.length);
		}
		else
		{
		return false;
		}
		break;
	}
	window.open(popUpURL, popupName, popUpParams);
}

function returnFalse ()
{
	return false;
}










function affidavitformcheck()
{
	if (document.getElementById)
	{
		if ( document.getElementById('pending_membership') )
		{
			if ( (document.getElementById('pending_membership').value.indexOf('Yes') == -1) && (document.getElementById('pending_membership').value.indexOf('Affidavit') == -1) )
			{
				alert ('You have SELECTED that you DO NOT have an affidavit of age on file. \n \nYou must have an affidavit of age on file BEFORE you place an order. \nIf you already have an affidavit of age on file, please select "Yes-Affidavit currently on file," above.\n');
				return false;
			}
			else
			{
				return true;
			}
		}
		else
		{
			return true;
		}
	}
	else
	{
		return true;
	}
}