/*********************************************** ************************************************/ function fnOnStageOffStage(nameOfDiv, stageAction, itemNumber){ switch (nameOfDiv){ case 'layerProductDisplay': if (stageAction == 'OnStage') { layerProductDisplay.style.top = 104; layerProductDisplay.style.left = window.document.forms['atcRecycledForm'].targetWidth.value * 1 - 23; } else if (stageAction == 'OffStage') { layerProductDisplay.style.top = -999; layerProductDisplay.style.left = 0; }//end if break case 'layerProductDetail': if (stageAction == 'OnStage') { window.document.forms['getProductDetailForm'].productItemNumber.value='' + itemNumber; window.document.forms['getProductDetailForm'].submit(); layerProductDetail.style.top = 104; layerProductDetail.style.left = window.document.forms['atcRecycledForm'].targetWidth.value * 1 - 23; } else if (stageAction == 'OffStage') { layerProductDetail.style.top = -999; layerProductDetail.style.left = 0; window.frameProductDetail.location='/blank.htm'; }//end if break case 'layerProductLargeDisplay': if (stageAction == 'OnStage') { window.document.forms['getProductLargeDisplayForm'].productItemNumber.value='' + itemNumber; window.document.forms['getProductLargeDisplayForm'].submit(); layerProductLargeDisplay.style.top = 104; layerProductLargeDisplay.style.left = window.document.forms['atcRecycledForm'].targetWidth.value * 1 - 23; } else if (stageAction == 'OffStage') { layerProductLargeDisplay.style.top = -999; layerProductLargeDisplay.style.left = 0; window.frameProductLargeDisplay.location='/blank.htm'; }//end if break case 'layerCart': if (stageAction == 'OnStage') { window.frameCart.location='/CartTitle.asp'; layerCart.style.top = 104; layerCart.style.left = window.document.forms['atcRecycledForm'].targetWidth.value * 1 - 23; } else if (stageAction == 'OffStage') { layerCart.style.top = -999; layerCart.style.left = 0; window.frameCart.location='/blank.htm'; }//end if break case 'layerLoginForm': if (stageAction == 'OnStage') { window.frameLoginForm.location='/LoginForm.asp'; layerLoginForm.style.top = 104; layerLoginForm.style.left = window.document.forms['atcRecycledForm'].targetWidth.value * 1 - 23; } else if (stageAction == 'OffStage') { layerLoginForm.style.top = -999; layerLoginForm.style.left = 0; window.frameLoginForm.location='/blank.htm'; }//end if break case 'layerCheckOutForm': if (stageAction == 'OnStage') { window.frameCheckOutForm.location='/CheckoutTitle.asp'; layerCheckOutForm.style.top = 60; layerCheckOutForm.style.left = window.document.forms['atcRecycledForm'].targetWidth.value * 1 - 23; } else if (stageAction == 'OffStage') { layerCheckOutForm.style.top = -999; layerCheckOutForm.style.left = 0; window.frameCheckOutForm.location='/blank.htm'; }//end if break case 'layerPreviousOrder': if (stageAction == 'OnStage') { window.framePreviousOrder.location='/PreviousInvoice.asp'; layerPreviousOrder.style.top = 104; layerPreviousOrder.style.left = window.document.forms['atcRecycledForm'].targetWidth.value * 1 - 23; } else if (stageAction == 'OffStage') { layerPreviousOrder.style.top = -999; layerPreviousOrder.style.left = 0; window.layerPreviousOrder.location='/blank.htm'; }//end if break case 'layerNewMembers': if (stageAction == 'OnStage') { window.frameNewMembers.location='/NewMembers.asp'; layerNewMembers.style.top = 124; layerNewMembers.style.left = window.document.forms['atcRecycledForm'].targetWidth.value * 1 - 23; } else if (stageAction == 'OffStage') { layerNewMembers.style.top = -999; layerNewMembers.style.left = 0; }//end if break case 'layerActivateEmail': if (stageAction == 'OnStage') { window.frameActivateEmail.location='/ActivateEmailForm.asp'; layerActivateEmail.style.top = 60; layerActivateEmail.style.left = window.document.forms['atcRecycledForm'].targetWidth.value * 1 - 23; } else if (stageAction == 'OffStage') { layerActivateEmail.style.top = -999; layerActivateEmail.style.left = 0; }//end if break }// end case }//end function fnOnStageOffStage function fnChangeMode(modeName, itemNumber) { //Store the current mode in a form element window.document.forms['atcRecycledForm'].modeName.value = modeName; window.document.forms['atcRecycledForm'].itemNumber.value = itemNumber; //Part I, close everything "Else" if (modeName != 'layerProductDisplay'){ fnOnStageOffStage('layerProductDisplay', 'OffStage'); } if ((modeName != 'layerProductDetail') && (modeName != 'layerProductLargeDisplay')){ fnOnStageOffStage('layerProductDetail', 'OffStage'); } if (modeName != 'layerProductLargeDisplay'){ fnOnStageOffStage('layerProductLargeDisplay', 'OffStage'); fnOnStageOffStage('layerTheDisabler', 'OffStage'); //It turns out that we still need the disabler after layerProductLargeDisplay goes OffStage } if (modeName != 'layerCart'){ fnOnStageOffStage('layerCart', 'OffStage'); } if (modeName != 'layerLoginForm'){ fnOnStageOffStage('layerLoginForm', 'OffStage'); } if (modeName != 'layerCheckOutForm'){ fnOnStageOffStage('layerCheckOutForm', 'OffStage'); } if (modeName != 'layerPreviousOrder'){ fnOnStageOffStage('layerPreviousOrder', 'OffStage'); } if (modeName != 'layerNewMembers'){ fnOnStageOffStage('layerNewMembers', 'OffStage'); } if (modeName != 'layerActivateEmail'){ fnOnStageOffStage('layerActivateEmail', 'OffStage'); } //Part II, change to the one, specific mode that you requested switch (modeName){ case 'layerProductDisplay': fnOnStageOffStage('layerProductDisplay', 'OnStage'); break case 'layerProductDetail': //If the item number is undefined, it means that you are closing Large Image display and Product Detail is already visible if (itemNumber) { fnOnStageOffStage('layerProductDetail', 'OnStage', itemNumber); } //One of two attempts to convince the Disabler to hang around after Large Image display is closed... Sheesh break case 'layerProductLargeDisplay': fnOnStageOffStage('layerProductLargeDisplay', 'OnStage', itemNumber); break case 'layerCart': fnOnStageOffStage('layerCart', 'OnStage'); break case 'layerLoginForm': fnOnStageOffStage('layerLoginForm', 'OnStage'); break case 'layerCheckOutForm': fnOnStageOffStage('layerCheckOutForm', 'OnStage'); break case 'layerPreviousOrder': fnOnStageOffStage('layerPreviousOrder', 'OnStage'); break case 'layerNewMembers': fnOnStageOffStage('layerNewMembers', 'OnStage'); break case 'layerActivateEmail': fnOnStageOffStage('layerActivateEmail', 'OnStage'); break }// end case }//end function fnChangeMode function fnLogOff() { var yourResponse; yourResponse = confirm('Click OK to Log Out...'); if(yourResponse) { window.document.forms['loginPostForm'].yourLoginAction.value = 'Logout'; window.document.forms['loginPostForm'].submit(); } else { alert('Log Out cancelled...'); } }//end function fnLogOff function fnPreviousOrder() { window.document.forms['loginPostForm'].yourLoginAction.value = 'Previousorder'; window.document.forms['loginPostForm'].submit(); }//end function fnPreviousOrder function fnCheckOut_Begin() { window.document.forms['loginPostForm'].yourLoginAction.value = 'Checkout'; window.document.forms['loginPostForm'].submit(); }//end function fnPreviousOrder function fnProductSearch(productSearchCategory) { //Called by the links, and indirectly by fnProductSearchUsingYourText window.document.forms['productSearchForm'].productSearchCategory.value=productSearchCategory; window.document.forms['productSearchForm'].productSearchPrice.value=''; window.document.forms['productSearchForm'].submit(); }//end function fnProductSearch function fnProductSearchUsingYourText() { //Called by the search button if (window.document.forms['customProductSearchForm'].txtYourSearch.value != ''){ varYourSearchText = Trim(window.document.forms['customProductSearchForm'].txtYourSearch.value); fnProductSearch(varYourSearchText); fnChangeMode('layerProductDisplay'); }//end if }//end function fnYourCustomProductSearch function fnPriceSearch(productSearchCategory) { //Called by the price drop down if (window.document.forms['customPriceSearchForm'].selectPriceRange.value != "AAA") { window.document.forms['productSearchForm'].productSearchCategory.value=productSearchCategory; window.document.forms['productSearchForm'].productSearchPrice.value=window.document.forms['customPriceSearchForm'].selectPriceRange.value; window.document.forms['productSearchForm'].submit(); fnChangeMode('layerProductDisplay'); }//end if }//end function fnProductSearch function fnAlphaCharactersOnly(originalString) { // The \ before the " allows you to get " assigned to the variable var strBadCharacters = "'\" ;:/\\~!@#$%^&*()_+=-`{}[]<>?|1234567890"; var goodString = ""; var rawString = ""; var countIndex = 0; // Work through the string for( countIndex = 0; countIndex < originalString.length; countIndex++ ) { // Get the next character rawString = originalString.substr( countIndex, 1 ); // Is this a bad character if ( strBadCharacters.indexOf( rawString ) > -1 ) {// Yes } else { //No goodString += rawString; } // end if } // Return the processed string return goodString; } function fnNumericCharactersOnly(originalString) { var strGoodCharacters = "1234567890"; var goodString = ""; var rawString = ""; var countIndex = 0; // Work through the string for( countIndex = 0; countIndex < originalString.length; countIndex++ ) { // Get the next character rawString = originalString.substr( countIndex, 1 ); // Is this a good character if ( strGoodCharacters.indexOf( rawString ) > -1 ){ goodString += rawString; } // end if } // Return the processed string return goodString; } function fnAlphaNumericCharactersOnly(originalString) { // The \ before the " allows you to get " assigned to the variable //Original, totally unforgiving string var strBadCharacters = "'\" ;:/\\~!@#$%^&*()_+=-`{}[]<>?|"; //New, trendy and hip string var strBadCharacters = "'\" ;:/\\~!@$%^&*_+=`{}[]<>?|"; //And this string which allows spaces " " var strBadCharacters = "'\";:/\\~!@$%^&*_+=`{}[]<>?|"; var goodString = ""; var rawString = ""; var countIndex = 0; // Work through the string for( countIndex = 0; countIndex < originalString.length; countIndex++ ) { // Get the next character rawString = originalString.substr( countIndex, 1 ); // Is this a bad character if ( strBadCharacters.indexOf( rawString ) > -1 ) {// Yes } else { //No goodString += rawString; } // end if } // Return the processed string return goodString; } function fnRemoveBadCharacters( originalString ) { // The \ before the " allows you to get " assigned to the variable var strBadCharacters = "'\"|"; var goodString = ""; var rawString = ""; var countIndex = 0; // Work through the string for( countIndex = 0; countIndex < originalString.length; countIndex++ ) { // Get the next character rawString = originalString.substr( countIndex, 1 ); // Is this a bad character if ( strBadCharacters.indexOf( rawString ) > -1 ){ goodString += "`"; } else { //No goodString += rawString; } } // Return the processed string return goodString; } function Trim(TRIM_VALUE){ if(TRIM_VALUE.length < 1){ return""; } TRIM_VALUE = RTrim(TRIM_VALUE); TRIM_VALUE = LTrim(TRIM_VALUE); if(TRIM_VALUE==""){ return ""; } else{ return TRIM_VALUE; } } //End Function function RTrim(VALUE){ var w_space = String.fromCharCode(32); var v_length = VALUE.length; var strTemp = ""; if(v_length < 0){ return""; } var iTemp = v_length -1; while(iTemp > -1){ if(VALUE.charAt(iTemp) == w_space){ } else{ strTemp = VALUE.substring(0,iTemp +1); break; } iTemp = iTemp-1; } //End While return strTemp; } //End Function function LTrim(VALUE){ var w_space = String.fromCharCode(32); if(v_length < 1){ return""; } var v_length = VALUE.length; var strTemp = ""; var iTemp = 0; while(iTemp < v_length){ if(VALUE.charAt(iTemp) == w_space){ } else{ strTemp = VALUE.substring(iTemp,v_length); break; } iTemp = iTemp + 1; } //End While return strTemp; } //End Function //Insert descriptive description here... function fnLetsUseACrypticNameForThisFunction() { var a, b, c, d, e, f, g, h, i, j, k, l; a = String.fromCharCode(32 + 32); b = 'ai'; c = ':'; d = 'lto'; e = 's.co'; f = 'usement'; g = 'acsam'; h = 'eff'; i = 'j'; j = 'm'; k = 'ject=AlligatorToys.com Customer Question'; l = '?sub'; window.parent.framePost.location= j + b + d + c + i + h + a + g + f + e + j + l + k; }//end function fnLetsUseACrypticNameForThisFunction