var ns4=document.layers?true:false;
var ie4=document.all?true:false;
var ns6=document.getElementById&&!document.all?true:false;

function URLJump(formname,url) {
	this.document[formname].action = url;
	this.document[formname].submit();
};

function invalidChars(testie) {
	var invalid = /[<>"'|_!@#$%^&*:()+~`,.]/  
	return invalid.test(testie);
};

function validEmail(testie) {
	var invalid = new RegExp("^[-0-9a-z_][-0-9a-z_.]*[^.]@[0-9a-z_][-0-9a-z.]*[0-9a-z_]\.[0-9a-z_]{2,3}$", "i");
	return !(invalid.test(testie));
};

function validURL(testie) {
	var invalid = new RegExp("xox.co.il|bool.co.il|is-cool.co.il|is-sexy.co.il|is-the-best.co.il", "i");
	return !(invalid.test(testie));
};

function isNumber(testie,canBeEmpty) {
	if (canBeEmpty) {
		var valid = /^[0-9-]*$/
	} else {
		var valid = /^[0-9-]+$/
	};
	return valid.test(testie);
};

function showError(msg) {
	if (ns4){
		alert(msg);
	} else {
		document.getElementById('errorimage').innerHTML='<img src="images/error.gif" border="0">';
		document.getElementById('errormsg').innerHTML=msg;
	};
};

function ClearSpaces(str) 
	{
		while (str.indexOf(" ") != -1) 
			{
				str = str.replace(" ","");
			}
		return str;
	}


function IsHebrewChar(c){

		return (((c.charAt(0) >= "à") && (c.charAt(0) <= "ú")) || ((escape(c.charAt(0)) >= "%u05D0") && (escape(c.charAt(0)) <= "%u05EA")))
		}
			function isNotHebrew(field_value){
				
				for (i=0;i< field_value.length;i++){
				var c = field_value.charAt(i);
					if (IsHebrewChar(c)) {
					return true
				}
			}
		return false;
	}


function isURL(testie) {

  if (testie.indexOf(" ") != -1)
    return false;
  else if (testie.indexOf("http://") == -1)
    return false;
  else if (testie == "http://")
    return false;
  else if (testie.indexOf("http://") > 0)
    return false;

  testie = testie.substring(7, testie.length);
  if (testie.indexOf(".") == -1)
    return false;
  else if (testie.indexOf(".") == 0)
    return false;
  else if (testie.charAt(testie.length - 1) == ".")
    return false;

  if (testie.indexOf("/") != -1) {
    testie = testie.substring(0, testie.indexOf("/"));
    if (testie.charAt(testie.length - 1) == ".")
      return false;
  }

  if (testie.indexOf(":") != -1) {
    if (testie.indexOf(":") == (testie.length - 1))
      return false;
    else if (testie.charAt(testie.indexOf(":") + 1) == ".")
      return false;
    testie = testie.substring(0, testie.indexOf(":"));
    if (testie.charAt(testie.length - 1) == ".")
      return false;
  }

return true;

}


<!--
// ---------------------------------------------------------------------
function CheckCC(CC_Num,CC_Type)
// ---------------------------------------------------------------------
    {
// ---------------------------------------------------------------------
// CCN_digits stores just the digits from the Credit Card Number
// ---------------------------------------------------------------------
    var CCN_digits = ""

// ---------------------------------------------------------------------
// get the digits from the entered Card Number
// Note - the isNaN (Not a Number) function is not used 
// because it is not supported by JavaScript 1.0
// ---------------------------------------------------------------------
    for (var i = 0; i < CC_Num.length; i++)
        {
        if ((CC_Num.charAt(i) == "0") || 
            (CC_Num.charAt(i) == "1") ||
            (CC_Num.charAt(i) == "2") || 
            (CC_Num.charAt(i) == "3") ||  
            (CC_Num.charAt(i) == "4") || 
            (CC_Num.charAt(i) == "5") || 
            (CC_Num.charAt(i) == "6") || 
            (CC_Num.charAt(i) == "7") || 
            (CC_Num.charAt(i) == "8") || 
            (CC_Num.charAt(i) == "9"))
            {
             CCN_digits = CCN_digits + CC_Num.charAt(i);
            }
        }

// ---------------------------------------------------------------------
// validcard is the true/false indicator for a valid card 
//  - it is returned to the calling routine.
// ---------------------------------------------------------------------
    var validcard = false;

// ---------------------------------------------------------------------
// msgind is used to communicate the type of alert to 
// post in case of a problem
//    1=invalid prefix (prefix does not match card type)
//    2=invalid number of digits in card number 
//        for the card type selected
// ---------------------------------------------------------------------
    var msgind = 0;

// ---------------------------------------------------------------------
// Check the card for having a valid prefix and number of  
// digits (length) for the card type.
// Note - the if, else if construct was used here because 
// switch/case is not supported by JavaScript 1.0
// ---------------------------------------------------------------------
// VALID LENGTH AND PREFIX VALUES
// ---------------------------------------------------------------------
//  AMEX Discover MasterCard Visa 
// LENGTHS 15 16 16 13/16 
// PREFIXES 34 6011 51 4 
//  37  52  
//    53  
//    54  
//    55  
 

    if (CC_Type == "AMERICAN EXPRESS")
        if (CCN_digits.length == 15)
            if ((CCN_digits.substring (0, 2) == "34") || 
                (CCN_digits.substring (0, 2) == "37"))
                validcard = true;
            else
                msgind = 1;
        else    
            msgind = 2;
    else if (CC_Type == "Discover")
        if (CCN_digits.length == 16)
            if (CCN_digits.substring (0, 4) == "6011")
                validcard = true;
            else
                msgind = 1;
        else    
            msgind = 2;
    else if (CC_Type == "MASTER CARD" || CC_Type == "Euro Card")
        if (CCN_digits.length == 16)
            if ((CCN_digits.substring (0, 2) >= "51") && 
                (CCN_digits.substring (0, 2) <= "55"))
                validcard = true;
            else
                msgind = 1;
        else    
            msgind = 2;
    else if (CC_Type == "VISA")
        if ((CCN_digits.length == 16) || 
            (CCN_digits.length ==13))
            if (CCN_digits.substring (0, 1) == "4")
                validcard = true;
            else
                msgind = 1;
        else    
            msgind = 2;
    else
// ---------------------------------------------------------------------
// Invalid card type - this should be impossible to reach as 
// long  as all valid card types are in the list above....
// ---------------------------------------------------------------------
//        alert ("Sorry, "+ CC_Type + " is not currently being accepted - please contact us by phone or email.");
		showError(CC_Type + " is not currently being accepted<br>- please contact us by phone or email.");
    if (!validcard)
        {
        if (msgind == 1)
// ---------------------------------------------------------------------
//            Invalid prefix
// ---------------------------------------------------------------------
//            alert ("The Card Number ("+CC_Num + ") and the Card Type (" + CC_Type + ") do not match.");
		showError("The Card Number ("+CC_Num + ") and the<br>Card Type (" + CC_Type + ") do not match.");
        else if (msgind == 2)
// ---------------------------------------------------------------------
//            Invalid number of digits (length)
// ---------------------------------------------------------------------
//            alert ("The Card Number ("+CC_Num + ") is not the right length for the Card Type (" + CC_Type + ").");
		showError("The Card Number ("+CC_Num + ")<br>is not the right length<br> for the Card Type (" + CC_Type + ").");
        }

    if (!validcard)
        return (validcard);

// ---------------------------------------------------------------------
// Perform the mod10 check sum routine on the 
//  digits in the card number
//    1) Go through the Credit Card Number digits, starting on 
//        the RIGHT.
//            If the position is odd
//                 add the digit to the checksum tally. 
//            If the position is even
//                 multiply the digit by 2
//                 if the result is greater than 9
//                     divide the result by 10 
//                     and add the remainder 
//                         to the checksum tally
//                     add 1 to the checksum tally
//                 if the result is 9 or less
//                     add the result to the checksum tally
//        Repeat for each digit.
//    2) Divide the checksum tally by 10
//    3) If there is a remainder
//                     the Credit Card Number is not valid.
// ---------------------------------------------------------------------
    var CheckSum = 0;
// ---------------------------------------------------------------------
// for loop to look at the Credit Card Number
// ---------------------------------------------------------------------
    for (var x = 1; x <= CCN_digits.length; x++)
        {
// ---------------------------------------------------------------------
// x is subtracted from the length of the CCN 
// to point at the digits from RIGHT to LEFT
// ---------------------------------------------------------------------
        var CurrentDigit = CCN_digits.charAt
                                            (CCN_digits.length - x);
        if (x % 2 == 0)
            {
// ---------------------------------------------------------------------
// even position in credit card number 
// (2nd, 4th, etc. from RIGHT of Credit Card Number)
// ---------------------------------------------------------------------
            var WorkDigit = CurrentDigit * 2;    
            if (WorkDigit > 9)
                { 
                CheckSum = CheckSum + (1 - 0);
                CheckSum = CheckSum + (WorkDigit % 10);
                }
            else
                {
                CheckSum = CheckSum + (WorkDigit - 0);
                }     
            }
        else
            {
// ---------------------------------------------------------------------
// odd position in credit card number 
// (1st, 3rd, etc. from RIGHT of Credit Card Number)
// ---------------------------------------------------------------------
            CheckSum = CheckSum + (CurrentDigit - 0);
            }
        }
// ---------------------------------------------------------------------
// end for loop
// ---------------------------------------------------------------------

    if (CheckSum % 10) 
        { 
// ---------------------------------------------------------------------
// The CheckSum does not divide evenly by 10
// ---------------------------------------------------------------------
        validcard = false; 
//        alert ("I'm sorry, the Card Number ("+ CC_Num +") is not correct - perhaps there is a typo or two numbers are reversed?"); 
		showError("The Card Number ("+ CC_Num +") is not correct<br>- perhaps there is a typo or two numbers are reversed?");
        } 
    return (validcard); 
    }
// ---------------------------------------------------------------------
// end function 
// ---------------------------------------------------------------------
//-->

function openwindow(){
	window.open("index.html","Help","toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=790,height=600");
};


// Returns true if character c is an English letter 
// (A .. Z, a..z).
//
// NOTE: Need i18n version to support European characters.
// This could be tricky due to different character
// sets and orderings for various languages and platforms.

function isLetter (c)
{   return ( ((c >= "a") && (c <= "z")) || ((c >= "A") && (c <= "Z")) )
}



// Returns true if character c is a digit 
// (0 .. 9).

function isDigit (c)
{   return ((c >= "0") && (c <= "9"))
}



// Returns true if character c is a letter or digit.

function isLetterOrDigit (c)
{   return (isLetter(c) || isDigit(c))
}


// isAlphanumeric (STRING s [, BOOLEAN emptyOK])
// 
// Returns true if string s is English letters 
// (A .. Z, a..z) and numbers only.
//
// For explanation of optional argument emptyOK,
// see comments of function isInteger.
//
// NOTE: Need i18n version to support European characters.
// This could be tricky due to different character
// sets and orderings for various languages and platforms.

function isAlphanumeric (s)

{   var i;

    if (isEmpty(s)) 
       if (isAlphanumeric.arguments.length == 1) return defaultEmptyOK;
       else return (isAlphanumeric.arguments[1] == true);

    // Search through string's characters one by one
    // until we find a non-alphanumeric 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 or letter.
        var c = s.charAt(i);

        if (! (isLetter(c) || isDigit(c) ) )
        return false;
    }

    // All characters are numbers or letters.
    return true;
}

