
function ci(p1, p2) { // changeimage
   document[p1].src = "res/img/" + p2;
}


function IsValidEmail(EmailAddr) {
    //return (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(EmailAddr))
    return (/^[a-z0-9\-\._]+@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(EmailAddr));
}
function IsValidCreditCard(number) {
	var total = 0;
	var flag  = 0;
	for (var i=(number.length - 1);i>=0; i--) {
		if (flag == 1) {
			var digits = number.charAt(i) * 2;
			if (digits > 9) digits -= 9;
			total += digits;
			flag = 0;
		} else {
			total += parseInt(number.charAt(i));
			flag = 1;
		}
	}
	return ((total%10) == 0);
}
function Trim(str) { // trim leading whitespace and trailing whitespace 
    if (!str) return "";
    return str.replace(/^\s+/,"").replace(/\s+$/,"");
}
function changeObjectVisibility(objectId, newVisibility) {
    // first get a reference to the cross-browser style object 
    // and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
	    styleObject.visibility = newVisibility;
	    return true;
    } else {
	    // we couldn't find the object, so we can't change its visibility
	    return false;
    }
}

function IsNumeric(strString) {      //  check for valid numeric strings  

  var strValidChars = "0123456789";
  var strChar;
  var blnResult = true;

  strString = strString.replace(/ /g, ""); // remove spaces
  if (strString.length == 0) return false;

  //  test strString consists of valid characters listed above
  for (i = 0; i < strString.length && blnResult == true; i++) {
     strChar = strString.charAt(i);
     if (strValidChars.indexOf(strChar) == -1) blnResult = false;
  }
  return blnResult;
}


function checksearchdata() { 
    var sSearchfor = document.fittsearch.searchfor.value;
    sSearchfor = sSearchfor.replace(/ /g, ""); // remove spaces
    if (sSearchfor.length ==0 || sSearchfor == "Search") {
        document.fittsearch.searchfor.value = "Search";
        return false;
    }
}
function SetPass() {
    var cPass = prompt("Well?",'');
    document.cookie="fa=" + escape(cPass) + ";path=/;";
    history.go(); 
} 



