// JavaScript Document var WEB = "http://www.bavariansoundwerks.com"; var openPictureWin=''; var openTellFriendWin=''; var openGenericWin=''; var openCardWin=''; var openAddToOrderWin=''; var openInfoWin=''; function openPictureWindow(img,nm,picnm,w,h){ window.openPictureWin=dhtmlwindow.open(picnm, "iframe", img, nm, "width=" + w + "px,height=" + h + "px,resize=1,scrolling=0,center=1", "recal") window.openPictureWin.onclose=function(){ return true; } } function openTellFriendWindow(pg,nm,w,h){ window.openTellFriendWin=dhtmlwindow.open('tellf', "iframe", pg, nm, "width=" + w + "px,height=" + h + "px,resize=1,scrolling=0,center=1", "recal") window.openTellFriendWin.onclose=function(){ return true; } } function openGenericWindow(pg,nm,w,h,sc,ctr){ window.openGenericWin=dhtmlwindow.open('genw', "iframe", pg, nm, "width=" + w + "px,height=" + h + "px,resize=0,scrolling=" + sc + ",center=" + ctr, "recal") window.openGenericWin.onclose=function(){ return true; } } function openCardWindow(pg,w,h){ window.openCardWin=dhtmlwindow.open('card', "iframe", pg, 'Payment Method', "width=" + w + "px,height=" + h + "px,resize=1,scrolling=0,center=1", "recal") window.openCardWin.onclose=function(){ window.location.href='payment.php'; return true; } } function openAdminCardWindow(pg,w,h){ window.openCardWin=dhtmlwindow.open('card', "iframe", pg, 'Payment Method', "width=" + w + "px,height=" + h + "px,resize=1,scrolling=0,center=1", "recal") window.openCardWin.onclose=function(){ return true; } } function submitRating(iid,ca){ if( document.getElementById('ratingvote') ){ var vote = document.getElementById('ratingvote').options[document.getElementById('ratingvote').selectedIndex].value; var url = "/log_rating.php?itemID=" + iid + "&CA=" + ca + "&vote=" + vote; openGenericWindow(url,'Rate Product',300,150,1,1); } } function openAddToOrderWindow(pg,nm,w,h,sc,ctr){ window.openAddToOrderWin=dhtmlwindow.open('addToOrderProcessor', "iframe", pg, nm, "width=" + w + "px,height=" + h + "px,resize=0,scrolling=" + sc + ",center=" + ctr, "recal") window.openAddToOrderWin.onclose=function(){ displayAddedPostOrderItems(); return true; } } function openInfoWindow(pg,unique,nm,w,h,sc,ctr){ //getPageContent(pg); //open_generic_prompt(currentpagecontent); window.openInfoWin=dhtmlwindow.open(unique, "iframe", pg, nm, "width=" + w + "px,height=" + h + "px,resize=0,scrolling=1,center=" + ctr, "recal") window.openInfoWin.onclose=function(){ return true; } } var currentpagecontent = ''; function display_content(surl){ jQuery.ajax({ url: surl, cache: false, success: function(html){ currentpagecontent = html; open_prompt(html); }, error: function(o,m,e){ //alert( "Load Data NOT Saved: " + m + " : " + e ); } }); return 0; } function open_prompt(msg){ jQuery.prompt(msg,{ buttons:{ }, prefix:'tqa', submit: function(v,m,f){ } }); } function buildQS(theForm) { var url = ''; for (i=0;i< theForm.length;i++) { var tempobj = theForm.elements[i]; var nm = tempobj.name; var val = ''; if(tempobj.type.toString().charAt(0)=="s"){ val = tempobj.options[tempobj.selectedIndex].value; } else { val = tempobj.value; } url = url + "&" + nm + "=" + val } return url; } function submitProduct(fid){ var which = document.getElementById(fid); if( !checkpostorderoptions(which)){ return false; } var qs = buildQS(which); var url = "/assets/ajax/addToOrder.php?" + qs; openAddToOrderWindow(url,'Adding To Order',300,200,1,1); var imgbuttonnotdone = fid + "_button_notdone"; var imgbuttondone = fid + "_button_done"; var imgbuttonid = fid + "_button"; if(document.getElementById(imgbuttonid)){ document.getElementById(imgbuttonid).src = '/images/Added-to-Post-Order.png'; document.getElementById(imgbuttonid).src = '/images/clear.gif'; //document.getElementById(imgbuttonid).setAttribute('onclick',''); } if( document.getElementById(imgbuttonnotdone) ){ //document.getElementById(imgbuttonnotdone).display = 'none'; /* if (window.attachEvent) { document.getElementById(imgbuttonid).attachEvent("onclick",''); } else if (window.addEventListener) { document.getElementById(imgbuttonid).addEventListener("onclick",'',true); } */ } if( document.getElementById(imgbuttondone) ){ //document.getElementById(imgbuttondone).display = 'block'; } return false; } function removeProduct(pid){ removeProduct2(pid); var formid = "form_" + pid; var imgbuttonid = "form_" + pid + "_button"; var imgbuttonnotdone = "form_" + pid + "_button_notdone"; var imgbuttondone = "form_" + pid + "_button_done"; if(document.getElementById(imgbuttonid)){ document.getElementById(imgbuttonid).src = '/images/Add-to-Post-Order.png'; } if( document.getElementById(imgbuttondone) ){ //document.getElementById(imgbuttondone).display = 'none'; } if( document.getElementById(imgbuttonnotdone) ){ //document.getElementById(imgbuttonnotdone).display = 'block'; } return false; } function refreshParent(url){ return true; window.parent.location.href=url; } // constants to define the title of the alert and button text. var ALERT_TITLE = "Oops!"; var ALERT_BUTTON_TEXT = "Close"; var ALERT_HEIGHT_MARGIN = "50px"; // over-ride the alert method only if this a newer browser. // Older browser will see standard alerts if(document.getElementById) { window.alert = function(txt) { //createCustomAlert(txt); open_prompt(txt); } } function createCustomAlert(txt) { // shortcut reference to the document object d = document; // if the modalContainer object already exists in the DOM, bail out. if(d.getElementById("modalContainer")) return; // create the modalContainer div as a child of the BODY element mObj = d.getElementsByTagName("body")[0].appendChild(d.createElement("div")); mObj.id = "modalContainer"; // make sure its as tall as it needs to be to overlay all the content on the page mObj.style.height = document.documentElement.scrollHeight + "px"; // create the DIV that will be the alert alertObj = mObj.appendChild(d.createElement("div")); alertObj.id = "alertBox"; alertObj.style.marginTop = ALERT_HEIGHT_MARGIN; // MSIE doesnt treat position:fixed correctly, so this compensates for positioning the alert if(d.all && !window.opera) alertObj.style.top = document.documentElement.scrollTop + "px"; // center the alert box alertObj.style.left = (d.documentElement.scrollWidth - alertObj.offsetWidth)/2 + "px"; // create an H1 element as the title bar h1 = alertObj.appendChild(d.createElement("h1")); h1.appendChild(d.createTextNode(ALERT_TITLE)); // create a paragraph element to contain the txt argument msg = alertObj.appendChild(d.createElement("p")); msg.innerHTML = txt; // create an anchor element to use as the confirmation button. btn = alertObj.appendChild(d.createElement("a")); btn.id = "closeBtn"; btn.appendChild(d.createTextNode(ALERT_BUTTON_TEXT)); btn.href = "#"; // set up the onclick event to remove the alert when the anchor is clicked btn.onclick = function() { removeCustomAlert();return false; } } // removes the custom alert from the DOM function removeCustomAlert() { document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer")); } /******* Disable "Enter" key in Form script **********/ function handleEnter (field, event) { var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode; if (keyCode == 13) { var i; for (i = 0; i < field.form.elements.length; i++) if (field == field.form.elements[i]) break; i = (i + 1) % field.form.elements.length; field.form.elements[i].focus(); return false; } else return true; } function showcontent(cid){ document.getElementById(cid).style.display="block"; return; } function hidecontent(cid){ document.getElementById(cid).style.display="none"; return; } function toggle_element(ID,mode) { if(mode == 'hide') { document.getElementById(ID).style.display = 'none'; } else if(mode == 'show') { document.getElementById(ID).style.display = ''; } } function checkForm(frm) { if (frm.agree && !frm.agree.checked){ alert('You must check the box agreeing to our Terms and Conditions'); return false; } /* if(frm.salesID){ var found_it; for (var i=0; i
If no one, then please select the "No one / Im not sure" choice.'); return false; } */ return true; } function autoSubmit(form) { window.location.href = form.shipMethod.options[form.shipMethod.selectedIndex].value; } function setDisplaySelected(){ document.cookie = "DISPLAYSELECTED=1"; return true; } function displayAll(){ document.cookie = "myMake="; document.cookie = "mySeries="; document.cookie = "myChassis="; document.cookie = "myBody="; document.cookie = "DISPLAYSELECTED=1"; return true; } button2 = new Image(); button2.src = "/images/submitSecureButton-clicked.gif"; var theForm; var requestSubmitted = false; function disableButton(btn,form,buttonType) { if (!requestSubmitted){ if (buttonType != null) { var buttonName = buttonType; btn.src = buttonName.src; // image swap happens here } theForm = form; btn.disabled = true; requestSubmitted = true; setTimeout("submitIt()", 250); } else { return false; } } function submitIt() { theForm.submit(); return false; } function swap_cat_arrow(itemID) { var imgName = "cat_arrow_"+itemID; document.imgName.src = '/images/arr_white.gif'; } // Generic function to open a window function openAWindow( pageToLoad, winName, width, height, center, scroll) { openInfoWindow(pageToLoad,winName,'',width,height,scroll,center); return; // if 'center' == 1, then center window, otherwise put in top left corner xposition=0; yposition=0; if ((parseInt(navigator.appVersion) >= 4 ) && (center)){ xposition = (screen.width - width) / 2; yposition = (screen.height - height) / 2; } // Window Properties args = "width=" + width + "," + "height=" + height + "," + "location=0," + "menubar=0," + "resizable=1," + "scrollbars=" + scroll + "," + "status=0," + "titlebar=0," + "toolbar=0," + "hotkeys=0," + "screenx=" + xposition + "," //NN Only + "screeny=" + yposition + "," //NN Only + "left=" + xposition + "," //IE Only + "top=" + yposition; //IE Only // open and focus window newWin = window.open( pageToLoad,winName,args ); newWin.focus(); return newWin; } function goback() { window.history.go(-1) } function goback2() { window.history.go(-2) } function checkrequired(which,margin) { return checkrequired2(which,margin); var message = ""; message +="The form was not submitted due to the following error(s).\n"; message += "Please correct these errors and resubmit\n"; message += "____________________________________________\n\n"; message += "The following required fields are empty:\n"; var pass=true; var comma = ""; if (document.images) { for (i=0;i0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i