browser = navigator.appName;
ie = "Microsoft Internet Explorer";
netscape = "Netscape";

//Mouseover
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&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<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) selObj.selectedIndex=0;
}
//-->

//** Drop Nav Centered on Site **//
// IE and Mozilla friendly way to get id's
function findId(id) {
	if (document.getElementById) {
		return document.getElementById(id);
	} else if (document.all) {
		return document.all.id;
	}
}

tdLastId = "";
tdCurrentId = "";
waiting = 0;
waitTime = 50;
timeoutId = "";

function navFlip(id, that, xOffset, yPos) {
	//alert(xOffset)
	if (!xOffset) xOffset = 0;
	if (!yPos) yPos = 0;
	if (waiting) {
		if (id != tdLastId) {
			clearTimeout(timeoutId);
			that_saved = that;
			timeoutId = setTimeout('clearWait(' + xOffset + ', ' + yPos + ')', waitTime);
		}
		tdLastId = id;
		return;
	}

	if (tdCurrentId != id) {
			if (id) {
				lyr = findId(id);
				if (lyr) { //Error fix 4/20/04
					if (that) {
						lyr.style.left = findPosX(that) + xOffset;
						if (yPos) {
							lyr.style.top = yPos;
						}
					}
		
					lyr.style.visibility = "visible";
		
					waiting = id;
				}// end lyr
			}
	
			if (tdCurrentId) {
				//alert('dis: ' + tdCurrentId + ' waiting:' + waiting);
	
				lyr = findId(tdCurrentId);
				if (lyr) { //Error fix 4/20/04
					lyr.style.visibility = "hidden";
				}// end if
			}
			tdCurrentId = id;
		}
		tdLastId = id;
	}

function clearWait(xOffset, yPos) {
	//alert('clearing: ' + waiting);
	waiting = 0;
	navFlip(tdLastId, that_saved, xOffset, yPos);
}

// Functions to find positions of static images
function findPosX(obj) {
	var curleft = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	} else if (obj.x) {
		curleft += obj.x;
	}

	return curleft;
}

function findPosY(obj) {
	var curtop = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	} else if (obj.y) {
		curtop += obj.y;
	}

	return curtop;
}

//Popup
<!-- Begin
function NewWindow1(mypage, myname, w, h, scroll) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}
//  End -->

function SetFormValue(formStr,field,value) {
	
	form=(MM_findObj(formStr))
	
	if (form) {
		if (null != (form.elements[field])) {
			if ((browser == netscape)&&(form.elements[field].type=='select-one')){
				sellength=form.elements[field].length;
				for (i=0; i< sellength; i++) {
					if (form.elements[field].options[i].value==value)
						form.elements[field].options[i].selected=true;
				}
			} 
			else 
				form.elements[field].value=value;
		}		
	}
}

function SubmitForm(formStr) {
	form=(MM_findObj(formStr))
	if(form) form.submit();
}

function SetShipping(){
	if (document.PageForm.SetShipCheckbox.checked==true){
		document.PageForm.ShipFirstName.value = document.PageForm.FirstName.value
		document.PageForm.ShipLastName.value = document.PageForm.LastName.value
		document.PageForm.ShipTitle.value = document.PageForm.Title.value
		document.PageForm.ShipAddress1.value = document.PageForm.Address1.value
		document.PageForm.ShipAddress2.value = document.PageForm.Address2.value
		document.PageForm.ShipCity.value = document.PageForm.City.value
		document.PageForm.ShipState.value = document.PageForm.State.value
		document.PageForm.ShipZip.value = document.PageForm.Zip.value
		document.PageForm.ShipCountry.value = document.PageForm.Country.value
		document.PageForm.ShipPhone.value = document.PageForm.Phone.value
		document.PageForm.ShipFax.value = document.PageForm.Fax.value
		document.PageForm.ShipEmail.value = document.PageForm.Email.value
	}
	else{
		document.PageForm.ShipFirstName.value = ""
		document.PageForm.ShipLastName.value = ""
		document.PageForm.ShipTitle.value = ""
		document.PageForm.ShipAddress1.value = ""
		document.PageForm.ShipAddress2.value = ""
		document.PageForm.ShipCity.value = ""
		document.PageForm.ShipState.value = ""
		document.PageForm.ShipZip.value = ""
		document.PageForm.ShipCountry.value = ""
		document.PageForm.ShipPhone.value = ""
		document.PageForm.ShipFax.value = ""
		document.PageForm.ShipEmail.value = ""
	}
}

//PHONE NUMBER VALIDATION**********************************************************
// VARIABLE DECLARATIONS

var digits = "0123456789";
// non-digit characters which are allowed in phone numbers
var phoneNumberDelimiters = "()- ";
// characters which are allowed in US phone numbers
var validUSPhoneChars = digits + phoneNumberDelimiters;
// U.S. phone numbers have 10 digits.
// They are formatted as 123 456 7890 or (123) 456-7890.
var digitsInUSPhoneNumber = 10;
var sPhone = "Phone Number"
var iUSPhone = "This field must be a 10 digit U.S. phone number (like 415 555 1212). Please reenter it now."
var pUSPhone = "10 digit U.S. phone number (like 415 555 1212)."
var defaultEmptyOK = false

// Check whether string s is empty.
function isEmpty(s)
{   
return ((s == null) || (s.length == 0))
}

function isDigit (c)
{   return ((c >= "0") && (c <= "9"))
}

function isInteger (s)
{   

	var i;

    if (isEmpty(s))
	{ 
       if (isInteger.arguments.length == 1) return defaultEmptyOK;
       else return (isInteger.arguments[1] == true);
	}
    // Search through string's characters one by one
    // until we find a non-numeric character.
    // When we do, return false; if we don't, return true.
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);

        if (!isDigit(c)) return false;
    }

    // All characters are numbers.
    return true;
}


// Removes all characters which appear in string bag from string s.
function stripCharsInBag (s, bag)

{   var i;
    var returnString = "";

    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.

    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }

    return returnString;
}


// Notify user that contents of field theField are invalid.
// String s describes expected contents of theField.value.
// Put select theField, pu focus in it, and return false.
function warnInvalid (theField, s)
{   theField.focus()
    theField.select()
    alert(s)
    return false
}

function reformat (s)
{   var arg;
    var sPos = 0;
    var resultString = "";

    for (var i = 1; i < reformat.arguments.length; i++) {
       arg = reformat.arguments[i];
       if (i % 2 == 1) resultString += arg;
       else {
           resultString += s.substring(sPos, sPos + arg);
           sPos += arg;
       }
    }
    return resultString;
}


// isUSPhoneNumber (STRING s [, BOOLEAN emptyOK])
// 
// isUSPhoneNumber returns true if string s is a valid U.S. Phone
// Number.  Must be 10 digits.
//
// NOTE: Strip out any delimiters (spaces, hyphens, parentheses, etc.)
// from string s before calling this function.
//
// For explanation of optional argument emptyOK,
// see comments of function isInteger.
function isUSPhoneNumber (s)
{   
	if (isEmpty(s))
	{
	  	if (isUSPhoneNumber.arguments.length == 1) 
			return defaultEmptyOK;
		else 
			return (isUSPhoneNumber.arguments[1] == true);
	}
	return (isInteger(s) && s.length == digitsInUSPhoneNumber)
}


// takes USPhone, a string of 10 digits
// and reformats as (123) 456-789
function reformatUSPhone (USPhone)
{   return (reformat (USPhone, "(", 3, ") ", 3, "-", 4))
}


function GetOptVal(OptVal){
var OptVal;
var OptVal2=OptVal;
if(OptVal=="USA") 
{
document.getElementById('row1').style.display='';
}
else
{
document.getElementById('row1').style.display='none';
}
}


// checkUSPhone (TEXTFIELD theField [, BOOLEAN emptyOK==false])
//
// Check that string theField.value is a valid US Phone.
//
// For explanation of optional argument emptyOK,
// see comments of function isInteger.

function checkUSPhone (theField, emptyOK)
{   
	if (checkUSPhone.arguments.length == 1) emptyOK = defaultEmptyOK;
    if ((emptyOK == true) && (isEmpty(theField.value))) return true;
    else
    {  
		var normalizedPhone = stripCharsInBag(theField.value, phoneNumberDelimiters)
		if (normalizedPhone.length>10)
	   	{
	   		normalizedPhoneNum=normalizedPhone.substring(0,10);
			normalizedPhoneExt=normalizedPhone.substring(10,normalizedPhone.length);
			if (!isUSPhoneNumber(normalizedPhoneNum, false))
			{ 
	          	return warnInvalid (theField, iUSPhone);
			}
	       	else 
	       	{  // if you don't want to reformat as (123) 456-789, comment next line out
	          	
				formattedPhone = reformatUSPhone(normalizedPhoneNum);
				formattedPhone = formattedPhone+" "+normalizedPhoneExt;
				theField.value = formattedPhone;
	          	return true;
	       	}
	   	}
		else
		{
		   	if (!isUSPhoneNumber(normalizedPhone, false)) 
	          	return warnInvalid (theField, iUSPhone);
	       	else 
	       	{  // if you don't want to reformat as (123) 456-789, comment next line out
				theField.value = reformatUSPhone(normalizedPhone)
	          	return true;
	       	}
		}
    }
}