


// POPUP CHECKER FUNCTIONS


function test(str) {
	if(str == "checker1")   
   {
    str = document.frmChecker.txtTelephone.value;
    openIT(str);
}
if(str == "checker2") {
    str = document.frmChecker2.txtTelephone.value;
    openTHAT(str);
   }
}
function openIT(str) {
	if(str!="")
  openNewWin("../checker/step1.asp?action=submit&txtTelephone="+escape(str) ,500,450);
  else
  return;
  window.location= window.location.href;
}
function openTHAT(str) {
  if(str!="")
  openNewWin("../checker/preorder_direct.asp?action=submit&txtTelephone="+escape(str) ,500,450);
  else
  return;
  window.location = window.location.href;
}






// ==============================
// ::::: Select Region Menu :::::
// ==============================
function selectRegion() {
	if (document.regionForm.Regions.options[document.regionForm.Regions.selectedIndex].value != "#"){ 
		n = document.regionForm.Regions.options[document.regionForm.Regions.selectedIndex].value;
		location = "region_" + n + ".cfm";
	}        
}

// ==================================
// ::::: Display Region in Menu :::::
// ==================================
function displayRegionInMenu(n) {
	if (n == 0) { 
		document.regionForm.Regions.options[0].selected = true;
	} else {
		for (i = 0; i < document.regionForm.Regions.options.length; ++i) {
			val = document.regionForm.Regions.options[i].value;
			if (val == n) {
				document.regionForm.Regions.options[i].selected = true;
			}
		}
	}
}


// =================================
// ::::: Refresh Parent Window :::::
// =================================
function refreshParent() {
	var parentManager;
	var parentLocation;
	
	parentManager = window.opener;
	parentLocation = parentManager.location;
	parentLocation.reload();
	
	window.close();
}


// ===========================
// ::::: Validate Number :::::
// ===========================
function IsNumeric(InString, ValidString) {
	var IsNumericFlag = true;
	RefString = ValidString;
	DecimalPoints = 0;
	
	if (InString == "") {
		IsNumericFlag = false
	} else {
		for (i=0; i<InString.length; i++) {
			TempChar = InString.substring ( i, i+1 );
			if ( TempChar == "." ) { DecimalPoints++; } /* Can only have zero or one decimal point in a number */
			if (( TempChar == "-" ) && ( i != 0 )) IsNumericFlag = false /* If the hyphen is not in the first pos. */
			/* Check if current character is valid */
			if ( RefString.indexOf (TempChar,0) == -1) { 
				/* character not found in RefString */
				IsNumericFlag = false;
			}
		}
		if ( DecimalPoints > 1 ) IsNumericFlag = false
	}
	return IsNumericFlag;
} 


// =======================================
// ::::: Confirm Database Add Record :::::
// =======================================
function confirmInsert() {
	if (confirm("Are you sure you want to add this record into the database?\n\nIf you are sure Click OK to Continue."  )) {
		return true; 
	} else return false;
}


// ==========================
// ::::: Confirm Cancel :::::
// ==========================
function confirmCancel() {
	if (confirm("Are you sure you want to Cancel?\n\nIf you are sure Click OK to Continue."  )) {
		return true; 
	} else return false;
}


// ==========================================
// ::::: Confirm Database Delete Record :::::
// ==========================================
function confirmDelete() {
	if (confirm("Are you sure you want to delete this record from the database?\n\nIf you are sure Click OK to Continue."  )) {
		return true;
	} else return false;
}


// ==========================================
// ::::: Confirm Database Update Record :::::
// ==========================================
function confirmUpdate() {
	if (confirm("Are you sure you want to update this record?\n\nIf you are sure Click OK to Continue."  )) {
		return true;
	} else return false;
}


// =========================
// ::::: Confirm Reset :::::
// =========================
function confirmReset() {
	if (confirm("Are you sure you want to Reset?\n\nIf you are sure Click OK to Continue."  )) {
		return true;
	} else return false;
}


// =================================
// ::::: Open More Info Window :::::
// =================================
function openMoreInfoWin(id, w, h) {
	window.open(id,'','status=no,scrollbars=yes,resizable=yes,width='+w+',height='+h+'');
}


// =================================
// ::::: Open Window :::::
// =================================
function openWindow(page,width,height) {
        window.open(page,'windowRef','resizable=yes,width='+width+',height='+height+',scrollbars=yes');
 }
// -->



// ===========================
// ::::: Open New Window :::::
// ===========================
function openNewWin(id, w, h) {
	window.open(id,'','status=no,scrollbars=yes,resizable=yes,toolbar=no,width='+w+',height='+h+'');
}

