function OpenWindow(url) { popupWin = window.open(url,"BigCover","top=0,left=0,height=600,width=450,toolbar=no,menubar=no,location=no,directories=no,resizable=1,scrollbars=YES,status=no");
}
function ValidateEmail(sEmail) { var chkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-.@_/"; var chkStr = sEmail; var bValid = true; var check_AtSign = false; var check_Period = false; for (i = 0; i < chkStr.length; i++) { ch = chkStr.charAt(i); for (j = 0; j < chkOK.length; j++) { if (ch == chkOK.charAt(j)) break; if (j == chkOK.length) { bValid = false; break; } } if (ch == '@') check_AtSign = true if (ch == '.') check_Period = true } if (!bValid) return false; if (!check_AtSign || !check_Period) return false; return true; }
function ValidatePhone(sPhone) { if (trim(sPhone) != "" ) { var chkOK = "0123456789-(). "; var chkStr = sPhone; var bValid = true; for (i = 0; i < chkStr.length; i++) { ch = chkStr.charAt(i); for (j = 0; j < chkOK.length; j++) if (ch == chkOK.charAt(j)) break; if (j == chkOK.length) { bValid = false; break; } } if (!bValid) return false; } return true; }
/*
* Cross-browser event handling, by Scott Andrew
*/
function addEvent(element, eventType, lamdaFunction, useCapture) {
if (element.addEventListener) {
element.addEventListener(eventType, lamdaFunction, useCapture);
return true;
} else if (element.attachEvent) {
var r = element.attachEvent('on' + eventType, lamdaFunction);
return r;
} else {
return false;
}
}
/*
* Kills an event's propagation and default action
*/
function knackerEvent(eventObject) {
if (eventObject && eventObject.stopPropagation) {
eventObject.stopPropagation();
}
if (window.event && window.event.cancelBubble ) {
window.event.cancelBubble = true;
}
if (eventObject && eventObject.preventDefault) {
eventObject.preventDefault();
}
if (window.event) {
window.event.returnValue = false;
}
}
/*
* Safari doesn't support canceling events in the standard way, so we must
* hard-code a return of false for it to work.
*/
function cancelEventSafari() {
return false;
}
/*
* Cross-browser style extraction, from the JavaScript & DHTML Cookbook
* <http://www.oreillynet.com/pub/a/javascript/excerpt/JSDHTMLCkbk_chap5/index5.html>
*/
function getElementStyle(elementID, CssStyleProperty) {
var element = document.getElementById(elementID);
if (element.currentStyle) {
return element.currentStyle[toCamelCase(CssStyleProperty)];
} else if (window.getComputedStyle) {
var compStyle = window.getComputedStyle(element, '');
return compStyle.getPropertyValue(CssStyleProperty);
} else {
return '';
}
}
/*
* CamelCases CSS property names. Useful in conjunction with 'getElementStyle()'
* From <http://dhtmlkitchen.com/learn/js/setstyle/index4.jsp>
*/
function toCamelCase(CssProperty) {
var stringArray = CssProperty.toLowerCase().split('-');
if (stringArray.length == 1) {
return stringArray[0];
}
var ret = (CssProperty.indexOf("-") == 0)
? stringArray[0].charAt(0).toUpperCase() + stringArray[0].substring(1)
: stringArray[0];
for (var i = 1; i < stringArray.length; i++) {
var s = stringArray[i];
ret += s.charAt(0).toUpperCase() + s.substring(1);
}
return ret;
}
/*
* Disables all 'test' links, that point to the href '#', by Ross Shannon
*/
function disableTestLinks() {
var pageLinks = document.getElementsByTagName('a');
for (var i=0; i<pageLinks.length; i++) {
if (pageLinks[i].href.match(/[^#]#$/)) {
addEvent(pageLinks[i], 'click', knackerEvent, false);
}
}
}
/*
* Cookie functions
*/
function createCookie(name, value, days) {
var expires = '';
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days*24*60*60*1000));
var expires = '; expires=' + date.toGMTString();
}
document.cookie = name + '=' + value + expires + '; path=/';
}
function readCookie(name) {
var cookieCrumbs = document.cookie.split(';');
var nameToFind = name + '=';
for (var i = 0; i < cookieCrumbs.length; i++) {
var crumb = cookieCrumbs[i];
while (crumb.charAt(0) == ' ') {
crumb = crumb.substring(1, crumb.length); /* delete spaces */
}
if (crumb.indexOf(nameToFind) == 0) {
return crumb.substring(nameToFind.length, crumb.length);
}
}
return null;
}
function eraseCookie(name) {
createCookie(name, '', -1);
}
/*
* Clear Default Text: functions for clearing and replacing default text in
* <input> elements.
*
* by Ross Shannon, http://www.yourhtmlsource.com/
*/
addEvent(window, 'load', init, false);
function init() {
var formInputs = document.getElementsByTagName('input');
for (var i = 0; i < formInputs.length; i++) {
var theInput = formInputs[i];
if (theInput.type == 'text' && theInput.className.match(/\bcleardefault\b/)) {
/* Add event handlers */
addEvent(theInput, 'focus', clearDefaultText, false);
addEvent(theInput, 'blur', replaceDefaultText, false);
/* Save the current value */
if (theInput.value != '') {
theInput.defaultText = theInput.value;
}
}
}
}
function clearDefaultText(e) {
var target = window.event ? window.event.srcElement : e ? e.target : null;
if (!target) return;
if (target.value == target.defaultText) {
target.value = '';
}
}
function replaceDefaultText(e) {
var target = window.event ? window.event.srcElement : e ? e.target : null;
if (!target) return;
if (target.value == '' && target.defaultText) {
target.value = target.defaultText;
}
}
<script type="text/javascript"> <!-- var Page_ValidationSummaries = new Array(document.getElementById("valSum")); var Page_Validators = new Array(document.getElementById("CustomFormValidator"), document.getElementById("RequiredADD1validator"), document.getElementById("RequiredCityvalidator"), document.getElementById("Customstatevalidator"), document.getElementById("Customzipvalidator"), document.getElementById("RequiredEMailValidator"), document.getElementById("CustomEMailvalidator")); // --> </script>
<script type="text/javascript"> <!--
var Page_ValidationActive = false; if (typeof(ValidatorOnLoad) == "function") { ValidatorOnLoad(); }
function ValidatorOnSubmit() { if (Page_ValidationActive) { return ValidatorCommonOnSubmit(); } else { return true; } } // --> </script> <script type="text/javascript">document.getElementById("shipFirstName").focus();</script></form>
<script language="javascript">
function ValidationSetFocusOnSubmit() { var ElementToFocus = "";
if (typeof(Page_ValidationSummaries) == "undefined") return;
/* if (! ValidateDemos()) { return false; } */ if (!Page_IsValid) { for (i=0; i<Page_Validators.length; i++) { if (!Page_Validators[i].isvalid && ElementToFocus == "") { ElementToFocus = Page_Validators[i].controltovalidate; break; } } }
if (ElementToFocus != "") { var control = document.all[ElementToFocus]; if (control) { if (control.focus) { control.focus(); } } } }
function DisableMe() { setTimeout('DisableButton()', 10) }
function DisableButton() { document.subNewForm.billingSubmitBtn.disabled = true; } function billMe_OnSelected() { if (document.getElementById("billMe").checked) { if (document.getElementById("ccType")) { document.getElementById("ccType").selectedIndex = 0; } } }
function ccType_OnSelectIndexChanged() { if (document.getElementById("ccType").selectedIndex > 0) { document.getElementsByName("paymentType").item(0).checked = true; if (document.getElementById("billMe")) { document.getElementById("billMe").checked = false; } } }
function isDemoChecked(demoType) { var iLength = 0;
for (iLength = 0; iLength < document.subNewForm[demoType].length; iLength ++) { if (document.subNewForm[demoType][iLength].checked) { if (document.subNewForm[demoType][iLength].value == "Y") { return true; } else { return false; } } } }
function selectedDemoCountForBM() { var selectedDemoCount = 0;
if (isDemoChecked("T4")) { selectedDemoCount += 1; }
if (isDemoChecked("CN")) { selectedDemoCount += 1; }
}
function submitFormForNewRates() { var noOfDemosSelected = 0;
noOfDemosSelected = selectedDemoCountForBM();
if (noOfDemosSelected == 0) { alert("Please select atleast one edition."); return false; } else { document.subNewForm.submit(); } } </script>
<script language="JavaScript"> function checkNumeric(objName,minval, maxval,comma,period,hyphen) { var numberfield = objName; if (chkNumeric(objName,minval,maxval,comma,period,hyphen) == false) { numberfield.select(); numberfield.focus(); return false; } else { return true; } }
function chkNumeric(objName,minval,maxval,comma,period,hyphen) { // only allow 0-9 be entered, plus any values passed // (can be in any order, and don't have to be comma, period, or hyphen) // if all numbers allow commas, periods, hyphens or whatever, // just hard code it here and take out the passed parameters var checkOK = "0123456789" + comma + period + hyphen; var checkStr = objName; var allValid = true; var decPoints = 0; var allNum = "";
for (i = 0; i < checkStr.value.length; i++) { ch = checkStr.value.charAt(i); for (j = 0; j < checkOK.length; j++) if (ch == checkOK.charAt(j)) break; if (j == checkOK.length) { allValid = false; break; } if (ch != ",") allNum += ch; } if (!allValid) { alertsay = "Please enter only these values \"" alertsay = alertsay + checkOK + "\" in the \"" + checkStr.name + "\" field." //alert(alertsay); return (false); }
// // set the minimum and maximum // var chkVal = allNum; // var prsVal = parseInt(allNum); // if (chkVal != "" && !(prsVal >= minval && prsVal <= maxval)) // { // alertsay = "Please enter a value greater than or " // alertsay = alertsay + "equal to \"" + minval + "\" and less than or " // alertsay = alertsay + "equal to \"" + maxval + "\" in the \"" + checkStr.name + "\" field." // alert(alertsay); // return (false); // }
return (true); } </script>
<script type="text/javascript" language="javascript"> function AlertTotalAmt(oThis, orderAmt, freightAmt) { var totalOrderAmt = 0 totalOrderAmt = parseFloat(orderAmt) + parseFloat(freightAmt);
alert('Your total order amount will be : $' + totalOrderAmt.toFixed(2)); }
function OnChange(dropdown) { var myindex = dropdown.selectedIndex var SelValue = dropdown.options[myindex].value var SelText = dropdown.options[myindex].text