var bName = navigator.appName; var bVer = parseInt(navigator.appVersion); var NS4 = (bName == "Netscape" && bVer >= 4); var IE4 = (bName == "Microsoft Internet Explorer" && bVer >= 4); var NS3 = (bName == "Netscape" && bVer < 4); var IE3 = (bName == "Microsoft Internet Explorer" && bVer < 4); var preloadFlag = false; var showing = 0; var nomove = null; // var idiv = null; // Pointer to infodiv container var isNS4 = ( document.layers ) ? true : false; var isIE4 = ( document.all && !document.getElementById ) ? true : false; var isIE5 = ( document.all && document.getElementById ) ? true : false; var x = 0; var y = 0; var winW = 800;//800,600,500 var winH = 600; // Current help position and main window size var IWIDTH = 500; // Tip box width var px = "px"; document.onmousemove = mousemove; // Returns true if Javascript uses IE Style Objects function is_ie() { var ie = (document.all) ? 1 : 0; // Returns 1 for IE, NS6, Mozilla return ie; } function is_mozilla() { var bname = navigator.appName; var bVer = parseInt(navigator.appVersion); var mozilla = 0; if ((bname == 'Netscape') && (bVer >= 5)) { mozilla = 1; } return mozilla; } //BUTTON ROLLOVER function change(Name, No) { if (document.images && (preloadFlag)) { document.images[Name].src = eval(Name + No + ".src"); } return true } function change_shadow(Name, State) { if (document.images && (preloadFlag)) { document.images[Name].src = eval("leftshadow_" + State + ".src"); } return true } function change_product_shot(Name, Value) { if (document.images && (preloadFlag)) { document.images[Name].src = eval(Value + ".src"); } return true } //Function To Open Window function popup(url, width, height) { if (isNaN(width)) { width=350; } if (isNaN(height)) { height=365; } var window_left = (screen.width-width)/2; var window_top = (screen.height-height)/2; details = window.open(url,'details','width='+width+',height='+height+',menubar=yes,resizable=no,scrollbars=yes,top=' + window_top + ',left=' + window_left + ''); details.window.focus(); } // Once a submit button is clicked, run through ALL of the forms and disable all the buttons function submitonce(object) { var sendingdatatext = "Saving"; var sendingdatatext = object.value + '.'; var alreadysubmitted = 0; if (is_ie() || is_mozilla()) { //screen thru every element in the form, and hunt down "submit" and "reset" for (formcounter=0; formcounter < document.forms.length; formcounter++) { theform = document.forms[formcounter]; for (i=0;i 0)) { return true; } else { alert(errorstr); return false; } } else if (event.type == 'change') { var object = ie ? event.srcElement : event.target; if (isNaN(object.value) == false) { return true; } else { alert(errorstr); object.focus(); return false; } } else if (event.type == 'paste') { // Only works in IE // NS6 Catch Event, validate/display error, but won't set field back to old value // Mozilla sends a keypress event! if (ie) { var object = event.srcElement; pastetext = window.clipboardData.getData("Text"); if (isNaN(pastetext) == false) { return true; } else { alert(errorstr); return false; } } } return true; } function MakeHex(x) { if((x >= 0) && (x <= 9)) return x; else { switch(x) { case 10: return "A"; case 11: return "B"; case 12: return "C"; case 13: return "D"; case 14: return "E"; case 15: return "F"; } } } function NumToHex(strNum) { baseS = new String; remS = new String; base = strNum / 16; rem = strNum % 16; base = base - (rem / 16); baseS = MakeHex(base); remS = MakeHex(rem); return "" + baseS + remS; } function css_class_change(who, method) { var currentcolor = who.style.backgroundColor; var newcolor; var basecolor = 'transparent'; var highlightcolor = '#dee4e6'; var selectedcolor = '#b5d7c2'; // Reformat the rgb(255, 255, 255) from Mozilla/Opera back into IE Style if (currentcolor.substring(0, 3) == "rgb") { rgbvaluesstr = currentcolor.substring(currentcolor.indexOf("(") + 1, currentcolor.indexOf(")")); rgbvalues = rgbvaluesstr.split(","); currentcolor = NumToHex(rgbvalues[0]) + NumToHex(rgbvalues[1]) + NumToHex(rgbvalues[2]); currentcolor = "#" + currentcolor.toLowerCase(); } if(currentcolor == basecolor || currentcolor == '') { if(method == 'highlight') { newcolor = highlightcolor; } else if(method == 'select') { newcolor = selectedcolor; } } else if(currentcolor == highlightcolor) { if(method == 'highlight') { newcolor = basecolor; } else if(method == 'select') { newcolor = selectedcolor; } } else if(currentcolor == selectedcolor) { if(method == 'highlight') { newcolor = currentcolor; } else if(method == 'select') { newcolor = highlightcolor; } } who.style.backgroundColor = newcolor; } function autogenkey() { var chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; str = ""; for( i = 0; i < 50; i++ ) str += chars[ Math.floor(chars.length*Math.random()) ]; document.getElementById( 'api_key' ).value = str; } function autocardcodegen() { var chars = "0123456789"; str = chars[ Math.floor((chars.length-1)*Math.random() + 1) ]; var length = Math.floor(Math.random()*5+7); for( i = 0; i < length; i++ ) { str += chars[ Math.floor(chars.length*Math.random()) ]; } document.getElementById( 'card_code' ).value = str; } function gettip ( name ) { return ( document.layers && document.layers[name] ) ? document.layers[name] : ( document.all && document.all[name] && document.all[name].style ) ? document.all[name].style : document[name] ? document[name] : ( document.getElementById(name) ? document.getElementById(name).style : 0 ); } function show ( name ) { if ( showing ) { hideAll(); return; } if ( idiv ) { hideAll (); } idiv = gettip ( name ); if ( idiv ) { if ( isIE5 == false ) { winW = ( window.innerWidth ) ? window.innerWidth - 16 : document.body.offsetWidth - 40; winH = ( window.innerHeight ) ? window.innerHeight : document.body.offsetHeight; if ( x <= 0 || y <= 0 ) { // konqueror can't get mouse position x = ( winW - IWIDTH ) / 2 + ( window.pageXOffset ? window.pageXOffset : 0 ); y = ( winH - 50 ) / 2 + ( window.pageYOffset ? window.pageYOffset : 0 ); // middle of window } } showtip(); showing = 1; } } function showtip () { if ( isIE5 == false ) { idiv.left = ( ( ( x + IWIDTH ) < winW ) ? x : winW - IWIDTH ) + px; idiv.top = ( ( ( y + 90 ) < winH ) ? y + -120 : y - 220 ) + px; } idiv.visibility = isNS4 ? "show" : "visible"; nomove = true; } function hideAll () { if ( idiv ) { idiv.visibility = isNS4 ? "hide" : "hidden"; } idiv = null; nomove = null; showing = 0; } function mousemove ( e ) { if ( e ) { x = e.pageX ? e.pageX : e.clientX ? e.clientX : 0; y= e.pageY ? e.pageY : e.clientY ? e.clientY : 0; } else if ( event ) { x = event.clientX; y = event.clientY; } else { x=0; y=0; } // Workaround for scroll offset of IE if ( ( isIE4 || isIE5 ) && document.documentElement ) { x += document.documentElement.scrollLeft; y += document.documentElement.scrollTop; } if ( idiv && !nomove ) { showtip(); } } /* TRYING TO DEPRECATE THESE */ // KNOWN PLACES BEING USED: Editing company addresses function loadExisting (mode, querystring) { // reload page using selection to fill form var view; var currlocation; var qs; var myindex = document.editing.editable.selectedIndex; if (document.editing.editable.options[myindex].value != "0") { view = document.editing.editable.options[myindex].value; } currlocation = location.href; if (currlocation.indexOf('\?') > 0) { currlocation = currlocation.slice(0, currlocation.indexOf('\?')); } if (typeof(querystring) != 'undefined') { qs = querystring } else { qs = ''; } var locString = qs; if ((qs.search(/[\&|\?]iid=\d*/) != -1) && (view == '')) { qs = locString.replace(/[&|?]?iid=\d+/, ''); } else if (locString.search(/[\&|\?]iid=\d*/) != -1) { qs = locString.replace(/iid=\d*/, 'iid=' + view); } else if (locString.indexOf('\?') != -1) { qs = locString + "&iid=" + view; } else { qs = locString + "?iid=" + view; } // in case there is a partnerID to be aware of if (document.editing.partnerID) { var p = document.editing.partnerID.value; if (locString.indexOf('\?') != -1) { qs += "&p=" + p; } else { qs += "?p=" + p; } } if ((qs.charAt(0) != '?') && (qs.length > 0)) { qs = '?' + qs; } window.location = currlocation + qs; } function toggle_table_rows_display(tableid, startrow, endrow){ var grpObj = document.getElementById(tableid); var firstTD = grpObj.rows[startrow-1].cells[0].innerHTML; var flag = firstTD.substring(0, 1); if(flag=='+'){ display = ''; grpObj.rows[startrow-1].cells[0].innerHTML = firstTD.replace(/^\+/,'-'); }else{ display = 'none'; grpObj.rows[startrow-1].cells[0].innerHTML = firstTD.replace(/^-/,'+'); } for(i=startrow; i<=endrow; i++){ grpObj.rows[i].style.display=display; } }