//--------------------------------------------------------------------------------------
// Function: SetChangeFlag
// Set Cookie to indicate a change has occured
//--------------------------------------------------------------------------------------
function SetChangeFlag() {
	document.cookie = "SetupChange=1";
}

//--------------------------------------------------------------------------------------
// Function: ClearChangeFlag
// ReSet Cookie to indicate a change has NOT occured
//--------------------------------------------------------------------------------------
function ClearChangeFlag() {
	document.cookie = "SetupChange=0";
}


//--------------------------------------------------------------------------------------
// Function: Feedback
// Go to Feedback
//--------------------------------------------------------------------------------------	
function Feedback()
{
	if (typeof(document.all) !== 'undefined') {
		if (document.all.btnPlay) { Play(0); }	
	}	
	var wndSub1 = window.open("","wndFeedback","resizable=yes,location=no,height=550,width=800,left=0,top=20");
//	var wndSub1 = window.open("","wndFeedback","");
	document.frmHidden.action = "/v5/Members/other/feedback1.asp?type=1&pg=" + strPageName;
	document.frmHidden.target = "wndFeedback";

	document.frmHidden.hdnFB.value = "";
	// Divide Feedback into multiple form values
	if (typeof(document.all) !== 'undefined')
	{
		var FormLimit = 102399;
		var strOuterHTML = new String;
		strOuterHTML = document.all[0].outerHTML;
		
		//alert(document.all[1].outerHTML);
		
		document.frmHidden.hdnFB.value = strOuterHTML.substr(0, FormLimit);
		strOuterHTML = strOuterHTML.substr(FormLimit);			
		while (strOuterHTML.length > 0)
		{
			var objINPUT = document.createElement("INPUT");
			objINPUT.type = "hidden";
			objINPUT.name = "hdnFB";
			objINPUT.value = strOuterHTML.substr(0, FormLimit);
			document.frmHidden.appendChild(objINPUT);
			strOuterHTML = strOuterHTML.substr(FormLimit);
		}
	}
	document.frmHidden.submit();		
}

//--------------------------------------------------------------------------------------
// Function: Suggestion Box
// Go to Suggestion Box
//--------------------------------------------------------------------------------------	
function SuggestionBox()
{
	if (typeof(document.all) !== 'undefined') {
		if (document.all.btnPlay) { Play(0); }	
	}	
	var wndSub1 = window.open("","wndFeedback","resizable=yes,location=no,height=550,width=800,left=0,top=20");
	document.frmHidden.action = "/v5/Members/other/feedback1.asp?type=2&pg=" + strPageName;
	document.frmHidden.target = "wndFeedback";

	document.frmHidden.hdnFB.value = "";
	// Divide Feedback into multiple form values
	if (typeof(document.all) !== 'undefined')
	{
		var FormLimit = 102399;
		var strOuterHTML = new String;
		strOuterHTML = document.all[0].outerHTML;
		document.frmHidden.hdnFB.value = strOuterHTML.substr(0, FormLimit);
		strOuterHTML = strOuterHTML.substr(FormLimit);			
		while (strOuterHTML.length > 0)
		{
			var objINPUT = document.createElement("INPUT");
			objINPUT.type = "hidden";
			objINPUT.name = "hdnFB";
			objINPUT.value = strOuterHTML.substr(0, FormLimit);
			document.frmHidden.appendChild(objINPUT);
			strOuterHTML = strOuterHTML.substr(FormLimit);
		}
	}	
	document.frmHidden.submit();		
}

//--------------------------------------------------------------------------------------
// Function: BeginNewLookup
// Prepare to do a new Lookup
//--------------------------------------------------------------------------------------	
function BeginNewLookup()
{													
	if (typeof(document.all) !== 'undefined') {
		if (document.all.btnPlay) { Play(0); }	
	}	
	
	document.frmHidden.hdnCK.value = "";
	document.frmHidden.hdnCAT.value = "";
	if (document.frmHidden.hdnLT.value == 2) {
		document.frmHidden.hdnLT.value = "";
	}
	document.frmHidden.hdnDCIPT.value = "";
	document.frmHidden.hdnVQ.value = "";
	document.frmHidden.hdnPN.value = "";
	document.frmHidden.hdnPQ.value = "";
	document.frmHidden.hdnAP.value = "";
	document.frmHidden.hdnPT.value = "";
	document.frmHidden.hdnFB.value = "";
	document.frmHidden.hdnSuperCategory.value = "";
	document.frmHidden.hdnCategory.value = "";
	document.frmHidden.hdnSubCategory.value = "";
	document.frmHidden.hdnPartType.value = "";
	document.frmHidden.hdnMM.value = "";

	if (document.frmHidden.hidVehicle != null && document.getElementById('ifVehicleModule') != null)
	{
		if (document.frmHidden.hidVehicle.value == "true")
		{			
			document.frmHidden.action = "http://" + window.location.host + "/v5/Modules/Default.asp?Module=Vehicle";
			document.frmHidden.target = "ifVehicleModule"
			document.frmHidden.submit();			
		}
	}
	
	if (document.frmHidden.hidEngine != null && document.getElementById('ifEngineModule') != null)
	{
		if (document.frmHidden.hidEngine.value == "true")
		{		
			document.frmHidden.action = "http://" + window.location.host + "/v5/Modules/Default.asp?Module=Engine";
			document.frmHidden.target = "ifEngineModule"
			document.frmHidden.submit();	   
		}
	}
		
	document.frmHidden.target = "_self"
	document.frmHidden.action = "/v5/Members/lookups/default.asp";
	document.frmHidden.submit();
}

//--------------------------------------------------------------------------------------
// Function: GotoPage
// Goto a new page; save session values in Hidden form
//--------------------------------------------------------------------------------------	
function GotoPage(strURL)
{
	if (typeof(document.all) !== 'undefined') {
		if (document.all.btnPlay) { Play(0); }	
	}	
	document.frmHidden.action = strURL;
	if (strURL.indexOf('/setup/') == 0)
	{
		document.frmHidden.hdnCK.value = "";
	}	
	document.frmHidden.hdnFB.value = "";
	//document.frmHidden.target = "_top";
	document.frmHidden.submit();
}

//--------------------------------------------------------------------------------------
// Function: GotoSecurePage
// Goto a secure page
//--------------------------------------------------------------------------------------	
function GotoSecurePage(strURL)
{
	if (typeof(document.all) !== 'undefined') {
		if (document.all.btnPlay) { Play(0); }	
	}	
	var wndSub1 = window.open("","wndSecure","resizable=yes,toolbar=yes,location=no,scrollbars,height=550,width=800,left=0,top=20");
	document.frmHidden.action = strURL;
	document.frmHidden.target = "wndSecure";
	document.frmHidden.submit();
}

//--------------------------------------------------------------------------------------
// Function: Catalogs
// Display available catalogs
//--------------------------------------------------------------------------------------	
function Catalogs()
{
	if (typeof(document.all) !== 'undefined') {
		if (document.all.btnPlay) { Play(0); }	
	}	
	var wndSub1 = window.open("","wndCatalogs","resizable=yes,location=no,scrollbars,height=500,width=800,left=0,top=20");
	document.frmHidden.action = "../other/AvailCatalogs.asp";
	document.frmHidden.target = "wndCatalogs";
	document.frmHidden.submit();	
}

//--------------------------------------------------------------------------------------
// Function: WhatsNew
// Display what's new
//--------------------------------------------------------------------------------------	
function WhatsNew()
{
	if (typeof(document.all) !== 'undefined') {
		if (document.all.btnPlay) { Play(0); }	
	}	
	var wndSub1 = window.open("","wndWhatsNew","resizable=yes,location=no,scrollbars,height=550,width=800,left=0,top=20");
	document.frmHidden.action = "../support/whatsnew.asp";
	document.frmHidden.target = "wndWhatsNew";
	document.frmHidden.submit();	
}
