<!-- 
// +------------------------------------------------------------+
// | Created 11/07/2003              Last Modified 03/31/2006   |
// | Web Site:             http://catalog.AmericanCatholic.org  |
// +------------------------------------------------------------+
// | Contains all the scripts for the new parish Catalog ;     	|
// | Less clutter on page				       				    |
// |                                                            |
// | 															|
// +------------------------------------------------------------+

// +------------------------------------------------------------+
// "openAddToCart" Script begins
var objAddToCart;
var calURL;
var calWinWidth;
var calWinHeight;
var calOptions;


function openAddToCart(calURL) {
calWinWidth = 400;
calWinHeight = 280;
var calOptions = "width=" + calWinWidth + ",height=" + calWinHeight + ",scrollbars=no,resizable=yes,menubar=no,status=no,toolbar=no,location=no,directories=no";
 if (calURL) {  
  if (!objAddToCart || objAddToCart.closed){
    objAddToCart = window.open(calURL,'AddToCartwin', calOptions);  // Open a new window and show the specified page
    objAddToCart.focus();
	objAddToCart.moveTo(250,350);   
   									  }
  else{
    objAddToCart.close();
	objAddToCart = window.open(calURL,'AddToCartwin', calOptions);  // Open a new window and show the specified page
    objAddToCart.focus();
	objAddToCart.moveTo(250,350);
  	  }
 	    }
}

// Script Ends -->
// +------------------------------------------------------------+

// +------------------------------------------------------------+
	function open_win(site)
	{
	window.open(site,'winCustInfo','width=350,height=400,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no,resizable=no');
	}
// +------------------------------------------------------------+

// "StartSearch" Script begins
// +------------------------------------------------------------+
// +----------used to choose between 3 forms values and action:
// indexCatSearch form displays the search results of all categories  -or- 
// indexSearch form displays the search results of 1 user selected category ----------+
// +----------3 forms are used:  searchForm displays the textbox and dropdown list box
// the indexCatSearch and indexSearch  forms hold special values and different actions----------+		
   function StartSearch() {
	if (document.searchForm.elements[1].selectedIndex==0){
	  document.indexCatSearch.elements[0].value=document.searchForm.elements[0].value; //s-q
	  document.forms['indexCatSearch'].submit();
	  //document.indexCatSearch.submit();
	 }else{
	  document.indexSearch.elements[0].value=document.searchForm.elements[0].value; //s-q
	  document.indexSearch.elements[1].value=document.searchForm.elements[1].value; //s-q-1
	  document.forms['indexSearch'].submit();
	  //document.indexSearch.submit();
	    } 
	}
 
// +------------------------------------------------------------+
// Script Ends -->

// +------------------------------------------------------------+
  var mac = navigator.appVersion.indexOf("Mac")>-1
  var opera = navigator.userAgent.indexOf("Opera")>-1
  
// if (navigator.appName == "Netscape" && parseFloat(navigator.appVersion) < 5.00 && !mac){
//           document.write ("<link rel=\"stylesheet\" href=\"/retail/ns_style_v5.css\" type=\"text/css\">")
//   } else {
//   document.write ("<link rel=\"stylesheet\" href=\"/retail/ie_style_v5.css\" type=\"text/css\">")
// }
// +------------------------------------------------------------+
 
// +------------------------------------------------------------+
        //NS resize bug fix
         if(!window.saveInnerWidth) {
       window.onresize = resizeIt;
       window.saveInnerWidth = window.innerWidth;
       window.saveInnerHeight = window.innerHeight;
     }
// +------------------------------------------------------------+
     function resizeIt() {
         if (saveInnerWidth < window.innerWidth || 
             saveInnerWidth > window.innerWidth || 
             saveInnerHeight > window.innerHeight || 
             saveInnerHeight < window.innerHeight ) 
         {
             window.history.go(0);
         }
     }
// +------------------------------------------------------------+

//CHECKS BILLING_INFO FORM starts the checking of the form data
function CheckBillingInfoForm(objForm)
{
	if (IsCustomerInfoFormComplete("billing_info") == true)
		return true;
    else
		return false;
}
//**************END FUNCTION****************************

//CHECKS CREATE_SHIPPING_ADDR FORM starts the checking of the form data
function CheckCreateShippingAddrForm(objForm)
{
	if (IsCustomerInfoFormComplete("create_shipping_addr") == true)
		return true;
    else
		return false;
}
//**************END FUNCTION****************************

//CHECK FORM starts the checking of the form data
function CheckCreateAccountForm(objForm)
{
	if (IsCreateAccountFormComplete("CreateAccount") == true)
		return true;
    else
		return false;
}
//**************END FUNCTION****************************


/********Validates Billing Info Form********************************
DESCRIPTION: IS FORM COMPLETE? Loops through all the form elements validating data..

PARAMETERS:
   FormName - form name 
   ElemName - form element name
   FormOk - boolean 

RETURNS:
   True if valid, otherwise false.
*************************************************/

function IsCustomerInfoFormComplete(FormName)
{
var x = 0;
var FormOk = true;

while ((x < document.forms[FormName].elements.length) && (FormOk))
   {  //if NO value in text box, and the form element isn't Preview, DeliveryDate, failload (hidden element)
      //&& (document.forms[FormName].elements[x].name!='expire_month') && (document.forms[FormName].elements[x].name!='expire_year')
     if ((document.forms[FormName].elements[x].value == '') && (document.forms[FormName].elements[x].name!='bill_title') && (document.forms[FormName].elements[x].name!='bill_suffix') && (document.forms[FormName].elements[x].name!='bill_institution') && (document.forms[FormName].elements[x].name!='bill_department') && (document.forms[FormName].elements[x].name!='bill_address_two')  && (document.forms[FormName].elements[x].name!='bill_address_three') && (document.forms[FormName].elements[x].name!='bill_state_or_province')  && (document.forms[FormName].elements[x].name!='bill_fax') && (document.forms[FormName].elements[x].name!='form_action') && (document.forms[FormName].elements[x].name!='addr') && (document.forms[FormName].elements[x].name!='form_type')) 
     {
        if (document.forms[FormName].elements[x].name == 'bill_first_name')
		{
				alert('Please type your first name and then try again.')
		}
        if (document.forms[FormName].elements[x].name == 'bill_last_name')
		{
				alert('Please type your last name and then try again.')
		}
       // if (document.forms[FormName].elements[x].name == 'bill_institution')
		//{
				//alert('Please type your institution and then try again.')
		//}
        if (document.forms[FormName].elements[x].name == 'bill_address_one')
		{
				alert('Please type your street address and then try again.')
		}
        if (document.forms[FormName].elements[x].name == 'bill_city')
		{
				alert('Please type your city and then try again.')
		}
        //if (document.forms[FormName].elements[x].name == 'bill_state_or_province')
		//{
				//alert('Please choose your state or province\-\-or NOT LISTED\-\-and then try again.')
		//}
        if (document.forms[FormName].elements[x].name == 'bill_postal_code')
		{
				alert('Please type your Zip\/Postal code and then try again.')
		}
        if (document.forms[FormName].elements[x].name == 'bill_country')
		{
				alert('Please choose your country and then try again.')
		}
        if (document.forms[FormName].elements[x].name == 'bill_phone')
		{
				alert('Please type the phone number and then try again.')
		}
        if (document.forms[FormName].elements[x].name == 'bill_email')
		{
				alert('Please type your e-mail address and then try again.')
		}
        document.forms[FormName].elements[x].focus();
        FormOk = false;
     }
	 else // the field is not empty but needs further checking -------------------------------
	 {
		if (document.forms[FormName].elements[x].name == 'bill_postal_code')
			if (document.forms[FormName].elements['bill_state_or_province'].value.length < 2)
			{
				// do not check foreign(FO) Postal Code cuz so varied (see IsZipValid Tech Notes)
			}
			else
	        {
			    {
		        FormOk = IsZipValid(FormName,document.forms[FormName].elements[x].name)
		        }
			}
		if (document.forms[FormName].elements[x].name == 'bill_email')
		{
		        FormOk = IsEmailValid(FormName,document.forms[FormName].elements[x].name)
		}
}
     x ++
   }
return FormOk
}
//**************END FUNCTION****************************


/********Validates CreateAccount Form********************************
DESCRIPTION: IS FORM COMPLETE? Loops through all the form elements validating data..

PARAMETERS:
   FormName - form name 
   ElemName - form element name
   FormOk - boolean 

RETURNS:
   True if valid, otherwise false.
*************************************************/

function IsCreateAccountFormComplete(FormName)
{
var x = 0;
var FormOk = true;

while ((x < document.forms[FormName].elements.length) && (FormOk))
   {  //if NO value in text box, and the form element isn't username, assword, verify_password, (hidden element)
      //&& (document.forms[FormName].elements[x].name!='expire_month') && (document.forms[FormName].elements[x].name!='expire_year')
     if ((document.forms[FormName].elements[x].value == '') && (document.forms[FormName].elements[x].name!='radioAccountType') && (document.forms[FormName].elements[x].name!='radioBillType') && (document.forms[FormName].elements[x].name!='form_action')) 
     {
        if (document.forms[FormName].elements[x].name == 'user_name')
		{
				alert('Please type your username and then try again.')
		}
        if (document.forms[FormName].elements[x].name == 'password')
		{
				alert('Please type your \"Password\" and then try again.')
		}
        if (document.forms[FormName].elements[x].name == 'verify_password')
		{
				alert('Please type your password again in \"Re-enter Password\" and then try again.')
		}
        if (document.forms[FormName].elements[x].name == 'bill_email')
		{
				alert('Please type your e-mail address and then try again.')
		}
			if (document.forms[FormName].elements[x].name == 'radioAccountType')
			{
			//document.FORMNAME.RADIOGROUP[1].focus()
			document.forms[FormName].radioAccountType[0].focus();
			}
			else if (document.forms[FormName].elements[x].name == 'radioBillType')
	        {
			document.forms[FormName].radioBillType[0].focus();
			}
			else
	        {
			document.forms[FormName].elements[x].focus();			
			}
        FormOk = false;
     }
	 else // the field is not empty but needs further checking -------------------------------
	 {
		if ((document.forms[FormName].elements['password'].value.length < 5))
		{
		        alert('Please enter a password that is 5 characters or longer.')
				FormOk = false;
		}
		if ((document.forms[FormName].elements['verify_password'].value.length < 5))
		{
		        alert('Please re-enter a password that is 5 characters or longer.')
				FormOk = false;
		}
		if (document.forms[FormName].elements['password'].value != document.forms[FormName].elements['verify_password'].value)
		{
		        alert('The passwords do not match.  Please re-enter passwords.')
				FormOk = false;
		}
		if (document.forms[FormName].elements[x].name == 'bill_email')
		{
		        FormOk = IsEmailValid(FormName,document.forms[FormName].elements[x].name)
		}
	 }
     x ++
   }
return FormOk
}
//**************END FUNCTION****************************


/******** Validates Length and IsNumeric of other_textbox ********************************
DESCRIPTION: Validates other_textbox textbox for length and custom IsNumber() function below
			Has to be a number between 10 and 1000.
PARAMETERS:
   FormName - form name 
   ElemName - form element name


RETURNS:
   True if valid, otherwise false.
*************************************************/
function ValidNumericLength(FormName,ElemName) {
var iTextBox = document.forms[FormName].elements[ElemName].value; //value of other_textbox text box
if (isNumber(iTextBox)==false)
  {
    alert("Error... not a number! \nPlease type in a donation amount between 10 and 1000 dollars. \nJust the number with no dollar sign, please.");
    return false;
  }
else
  {
	  if (parseInt(iTextBox) < 10 || parseInt(iTextBox) > 1000)
	  {
		alert("Please type in a donation amount between 10 and 1000 dollars. \nJust a whole number with no dollar sign, please.");
        document.forms[FormName].elements[ElemName].value=parseInt(iTextBox); //(Sender or Recipient) e-mail text box excised of all spaces
		return false;
	  }
  }
  
  return true;
}
//**************END FUNCTION****************************


//************ TRIM FUNCTIONS **************************
// Description: Trim functions trim strings of spaces
//     on (1)both ends, (2)left, (3)right and (4)All spaces 
//     whether on the ends or between characters in the string. 
//     
// Returns:String
//
// Trim(i_value);
function Trim(String) {
 if (String == null) {
    return (false);
   }
    return String.replace(/(^\s+)|(\s+$)/g,"");
   }
// TrimAllDashes(i_value);
function TrimAllDashes(str) {
 if (str == null) {
    return (false);
   }
    return str.replace(/(\-+)/g,"");
   }

// TrimAll(i_value);
function TrimAll(str) {
 if (str == null) {
    return (false);
   }
    return str.replace(/(\s+)/g,"");
   }

// TrimLeft(i_value);
function trimLeft(str) {
	// remove all spaces on left
	var newstr = str.replace(/[ ]*/,"");
	return (newstr);
}

// TrimRight(i_value);
function trimRight(str) 
{
	// remove all spaces on right
	var newstr = str.replace(/[ ]*$/,"");
	return (newstr);
}

// TrimBOTH(i_value);   !!!// Trim(i_value); above is better!!!
function trimBoth(str) {
	// reomve all spaces on both side
	var newstr = trimRight(trimLeft(str));
	return (newstr);
}
//**************END FUNCTION****************************


/************** ZIP CODE VALIDATION *********************
DESCRIPTION: validates zip

TECH NOTES:
-----------------------------------------------------------------------------
These "regexpFilter" variables use the RegExp object and its functions to find patterns
created with a sequence of characters and symbols

// do not check foreign(FO) cuz so varied:
				//from http://www.webmasterworld.com/forum23/2755.htm
				//UK it's an alpha-numeric mixture of anywhere between 6-8 characters
				//New Zealand: ...in New Zealand we have them but I don't know anyone who uses them
				//South Africa: In South Africa we also use postal codes, a 4 digit number
				//Switzerland we use a four digit postal code
				//Ireland: We have no post/zip codes in Ireland
				//Australia: ([a-zA-Z]){2,3} space ([0-9]){2,4}
-----------------------------------------------------------------------------
PARAMETERS: FormName, ElemName

RETURNS: ZipOk
   True if valid, otherwise false.
*************************************************/
function IsZipValid(FormName,ElemName)
{
var ZipOK  = true;
var sTextBox = document.forms[FormName].elements[ElemName].value; //value of Sender or Recipient text box

// Checks US only for the general format of Zip (xxxxxxxxx, xxxxx, xxxxx-xxxx) 
//var regexpFilter = /^(\d{5}|\d{9}|\d{5}-\d{4})$/; 
// Checks US and CANADA for the general format of Zip (xxxxxxxxx, xxxxx)
			   //CANADA:  ANA space NAN (A=alpha, N=numeric) e.g., G3H 6A3
//var regexpFilter = /^[0-9]{9}$|^[0-9]{5}-[0-9]{4}$|^[0-9]{5}$|^[A-Z][0-9][A-Z][\s]{1}[0-9][A-Z][0-9]{1}$/; 
var regexpFilter = /^[0-9]{9}$|^[0-9]{5}$|^([A-Z][0-9][A-Z]){1}[\s]?([0-9][A-Z][0-9]){1}$/; 
				// modified from http://regexlib.com/REDetails.aspx?regexp_id=23
				
sTextBox=TrimAll(sTextBox); //text box excised of all spaces
document.forms[FormName].elements[ElemName].value=sTextBox; // text box excised of all spaces
if (!regexpFilter.test(sTextBox)) 
	{
      alert('Please enter a valid Zip\/Postal Code. \n\nExamples: 45202 or 452026498 or G3H 6A3')
      ZipOK = false;
	}
return (ZipOK);
}
//**************END FUNCTION****************************


/**************** EMAIL VALIDATION FUNCTION *************
DESCRIPTION: validates email

TECH NOTES:
-----------------------------------------------------------------------------
These "regexpFilter" variables use the RegExp object and its functions to find patterns
created with a sequence of characters and symbols
var regexpFilter = 
				//   /............/ creates a new RegExp object
				// ^ Start of a string. 
			 	// ^.  -Match Any character at beginning of string
				// $ End of a string. 
				// . Any character (except \n newline) 
				// | Alternation. 
				// {...} Explicit quantifier notation. 
            	// .{2,4}$  -At least two characters but no more than four at the end of the string
				// [...] Explicit set of characters to match. 
				// (...) Logical grouping of part of an expression. 
				// * 0 or more of previous expression. 
				// + 1 or more of previous expression. 
				// ? 0 or 1 of previous expression; also forces minimal matching when an expression might match several strings within a search string. 
				// \ Preceding one of the above, it makes it a literal instead of a special character. Preceding a special matching character, see below. 
            	// \.  -a period (.)
				// . Matches any character except \n. If modified by the Singleline option, a period character matches any character. For more information, see Regular Expression Options. 
				// [aeiou] Matches any single character included in the specified set of characters. 
				// [^aeiou] Matches any single character not in the specified set of characters. 
				// [0-9a-fA-F] Use of a hyphen (–) allows specification of contiguous character ranges. 
				// \w Matches any word character. Equivalent to the Unicode character categories [\p{Ll}\p{Lu}\p{Lt}\p{Lo}\p{Nd}\p{Pc}]. If ECMAScript-compliant behavior is specified with the ECMAScript option, \w is equivalent to [a-zA-Z_0-9]. 
				// \W Matches any nonword character. Equivalent to the Unicode categories [^\p{Ll}\p{Lu}\p{Lt}\p{Lo}\p{Nd}\p{Pc}]. If ECMAScript-compliant behavior is specified with the ECMAScript option, \W is equivalent to [^a-zA-Z_0-9]. 
				// \s Matches any white-space character. Equivalent to the Unicode character categories [\f\n\r\t\v\x85\p{Z}]. If ECMAScript-compliant behavior is specified with the ECMAScript option, \s is equivalent to [ \f\n\r\t\v]. 
				// \S Matches any non-white-space character. Equivalent to the Unicode character categories [^\f\n\r\t\v\x85\p{Z}]. If ECMAScript-compliant behavior is specified with the ECMAScript option, \S is equivalent to [^ \f\n\r\t\v]. 
				// \d Matches any decimal digit. Equivalent to \p{Nd} for Unicode and [0-9] for non-Unicode, ECMAScript behavior. 
				// \D Matches any nondigit. Equivalent to \P{Nd} for Unicode and [^0-9] for non-Unicode, ECMAScript behavior. 
-----------------------------------------------------------------------------
PARAMETERS: FormName, ElemName

RETURNS: EmailOk
   True if valid, otherwise false.
*************************************************/
function IsEmailValid(FormName,ElemName)
{
var EmailOk  = true;
var strTextBox = document.forms[FormName].elements[ElemName].value; //value of Sender or Recipient text box

var regexpFilter = /^([a-zA-Z0-9_\+\&\-])+(\.([a-zA-Z0-9_\+\&\-])+)*@((\[(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5]))\]))|((([a-zA-Z0-9])+(([\-])+([a-zA-Z0-9])+)*\.)+([a-zA-Z])+(([\-])+([a-zA-Z0-9])+)*))$/;
				// modified from http://regexlib.com/RETester.aspx?regexp_id=284
				
strTextBox=TrimAll(strTextBox); //value of Sender e-mail or Recipient e-mail text box excised of all spaces
document.forms[FormName].elements[ElemName].value=strTextBox; //(Sender or Recipient) e-mail text box excised of all spaces
//strTextBox=dropSpaces(strTextBox)
// Checks for the general format of e-mail addresses (x@x.xx or x@x.xxx)
if (!regexpFilter.test(strTextBox)) 
	{
      alert('Please enter a valid e-mail address. \n\nExample: stanthony@americancatholic.org')
      EmailOk = false;
	}
return (EmailOk);
}
//**************END FUNCTION****************************


/********MORE VALIDATION FUNCTIONS *************************
DESCRIPTION: validates credit cards
    	
TECH NOTES:
-----------------------------------------------------------------------------
Matches major credit cards including: 
Visa (length 16, prefix 4), 
Mastercard (length 16, prefix 51-55), 
Discover (length 16, prefix 6011), 
American Express (length 15, prefix 34 or 37). 
All 16 digit formats accept optional hyphens (-) between each group of four digits. 
-----------------------------------------------------------------------------

PARAMETERS:

RETURNS:
   True if valid, otherwise false.
   
*************************************************/
function isValidCreditCard(FormName, type, ccnum) {
  ccnum=TrimAll(ccnum); //value of credit_card_number text box excised of all spaces
  ccnum=TrimAllDashes(ccnum); //value of credit_card_number text box excised of all dashes
  document.forms[FormName].elements['credit_card_number'].value=ccnum; //repopulate credit_card_number text box excised of all spaces
   if (type == "Visa") {
      // Visa: length 16, prefix 4, dashes optional.
      var creditcardPattern = /^4\d{3}-?\d{4}-?\d{4}-?\d{4}$/;
   } else if (type == "MC") {
      // Mastercard: length 16, prefix 51-55, dashes optional.
      var creditcardPattern = /^5[1-5]\d{2}-?\d{4}-?\d{4}-?\d{4}$/;
   } else if (type == "Disc") {
      // Discover: length 16, prefix 6011, dashes optional.
      var creditcardPattern = /^6011-?\d{4}-?\d{4}-?\d{4}$/;
   } else if (type == "AmEx") {
      // American Express: length 15, prefix 34 or 37.
      var creditcardPattern = /^3[4,7]\d{13}$/;
   } else if (type == "Diners") {
      // Diners: length 14, prefix 30, 36, or 38.
      var creditcardPattern = /^3[0,6,8]\d{12}$/;
   }

   if (!creditcardPattern.test(ccnum)) 
     {
    alert("Error... credit card number is invalid! \nPlease try again.")
    return false;
     }
   else if (isCardNumValid(ccnum)) 
     {
    alert("Checksum Error...  credit card number is invalid! \nPlease try again.")
    return false;
     }
   else
	 {
    return true;
	 }
}

function isCardNumValid(num) {
	var num1, num2, tempNum;
	if (!isNumber(num)) {
		return true;
	}
	num1 = ""
   // Add even digits in even length strings or odd digits in odd length strings.
	if (!(num.length%2==0)) {
		for(var j=0; j < num.length; j++) {
			if ((j+1)%2==0){
				tempNum = 2 * num.charAt(j);
			}
			else {
				tempNum = 1 * num.charAt(j);
			}
			num1 = num1 + tempNum.toString();
		}
	}
	else{
		for(var j=0; j < num.length; j++){
			if ((j+1)%2==0){
				tempNum = 1 * num.charAt(j);
			}
			else{
				tempNum = 2 * num.charAt(j);
			}
			num1 = num1 + tempNum.toString();
		}
	}
	num2 = 0;
	for (var j = 0; j < num1.length; j++) {
		num2 = num2 + parseInt(num1.charAt(j));
	}
	if (num2%10==0) {
		return false;
	}
	else {
		return true;
	}
}

function isNumber(value) {
	for (var i=0; i < value.length; i++) {
		a = parseInt(value.charAt(i));
		if (isNaN(a)) {
			return false;			
			break;
		}
	}
	return true;
}
// +------------------------------------------------------------+


// +------------------------------------------------------------+
// "updateClose" Script begins
var timerOnLoad = '';
var agent = navigator.userAgent;

function updateBrowser() {
		if (agent.indexOf("Netscape6")!= -1) {
			window.document.location.reload()
		}
		else if (agent.indexOf("MSIE")!= -1) {
			window.navigate(window.opener.document.location.href);
		}
		else if (agent.indexOf("Mozilla/4")!= -1) {
			
			window.document.location.reload()
		}
		else { 
			window.document.location.reload()
		}
    
}
// Script Ends -->
// +------------------------------------------------------------+


// +------------------------------------------------------------+
//******** Phone # VALIDATION
function IsPhoneValid(elm)
{
    var regexp = /^(\d{3} \d{3}-\d{4}|\d{10}|\(\d{3}\)\s\d{3}-\d{4}|\(\d{3}\)\d{3}-\d{4}|\d{3}-\d{3}-\d{4}|\d{3}\.\d{3}\.\d{4})$/;
    return regexp.test(elm.value);
}
//**************END FUNCTION****************************

//******** Domestic Phone VALIDATION
function IsDomesticPhoneValid(elm)
{
    var thisphone = elm.value;
    var i = 0;
    var j = 0;
    for (i = 0; i < thisphone.length; i++){
        if (thisphone.charCodeAt(i)>47 && thisphone.charCodeAt(i)<58){
            j+=1;
        }
    }
    if ( j == 10){return true;}
    else {return false;}
}
//**************END FUNCTION****************************

//******** Intl Phone VALIDATION
function IsIntlPhoneValid(elm)
{
    var thisphone = elm.value;
    var i = 0;
    var j = 0;
    for (i = 0; i < thisphone.length; i++){
        if (thisphone.charCodeAt(i)>47 && thisphone.charCodeAt(i)<58){
            j+=1;
        }
    }
    if ( j>9 && j<15){return true;}
    else {return false;}
}
//**************END FUNCTION****************************


/******** makeBillingAddress3Visible AND  makeShippingAddress3Visible *************************
DESCRIPTION: Makes the row visible with the text input box  for the 3rd Address 
if "bill_state_or_province" is "FO" "International"
    	
TECH NOTES:
-----------------------------------------------------------------------------

-----------------------------------------------------------------------------
PARAMETERS:

RETURNS:
   True if "International"  is selected, otherwise false.
   
*************************************************/

function makeBillingAddress3Visible(objForm){ 
  var list = document.billing_info.bill_state_or_province;
     if (list.options[list.selectedIndex].value.length < 2)  
	 { 
	  // if option is selected make visible
	  showAddress3()
     }else{ 
	  //make invisible
	  hideAddress3()
     }
}

function makeShippingAddress3Visible(objForm){ 
  var list = document.create_shipping_addr.bill_state_or_province;
     if (list.options[list.selectedIndex].value.length < 2)  
	 { 
	  // if option is selected make visible
	  showAddress3()
     }else{ 
	  //make invisible
	  hideAddress3()
     }
}

function showAddress3(){
document.getElementById('bill_address_three_row_id').style.display = ""
}

function hideAddress3(){
document.getElementById('bill_address_three_row_id').style.display = "none"
}

/**************END FUNCTION****************************/



/********   END  functions   ********************************/
//-->
