var remote=null;
function rs(n,u,w,h,x) {
	args="width="+w+",height="+h+",resizable=no,scrollbars=no,status=0";
	remote=window.open(u,n,args);
	if (remote != null) {
		if (remote.opener == null) {
			remote.opener = self;
		}
	}
	if (x == 1) { return remote; }
}

function swap_it(id, newImage)
			{
				if (document.images)
				document.images[id].src = newImage;
			}

function submitForm(frm,hidden_tmp)
{
	if(hidden_tmp.value == "submit"){
		frm.submit();
	}else if(hidden_tmp.value == "reset"){
		frm.reset();
	}
	return false;
}

function setTmp(val)

{
	document.form1.tmp.value = val;
}

function openNewWindow(strURL,strWindowName,theWidth,theHeight)
{

	if ("newMessageWindow" == strWindowName)
	{
		//generate random window ID
		 strWindowName = new String(Math.round(Math.random() * 100000));

	}
 
	NewWin = window.open(strURL,strWindowName,"toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=0,resizable=0,maximized=1,width="+theWidth+",height="+theHeight);
	NewWin.focus();
}
function openNewWindow2(strURL,strWindowName,theWidth,theHeight)
{ //used for Privacy Policy page

	if ("newMessageWindow" == strWindowName)
	{
		//generate random window ID
		 strWindowName = new String(Math.round(Math.random() * 100000));

	}
 
	NewWin = window.open(strURL,strWindowName,"toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,maximized=1,width="+theWidth+",height="+theHeight);
	NewWin.focus();
}


function popup(link)
{
    /*Ex2*/
        window.open(link, "", "toolbar=0,menubar=0,scrollbars=1,resizable=1,maximized=1,width=550,height=500");
}

function isValidPhone(phone)
/*Validates telephone number to template (XXX) XXX-XXXX
re1=/^\(+([0-9]{3})+\)\s?([0-9]{3})+(\-)+([0-9]{4})$/;*/
/*Validates telephone number using the following template XXX-XXX-XXXX re2=
/^([0-9]{3}\-){2}[0-9]{4}$/;*/
{
    //str = stores entered phone data into variable
    var str = phone.value;
    var re1 = /^\(+([0-9]{3})+\)\s?([0-9]{3})+(\-)+([0-9]{4})$/;
    var re2 = /^([0-9]{3}\-){2}[0-9]{4}$/;
    /*this is the validation string (Regular Expression) to match*/
    /*the match string allows re1(###)###-####; re1(###) ###-####; and re2###-###-####*/
    if (str == "" || str == "Enter Number" || (re1.test(str) == false && re2.test(str) == false)) {
        /*If fails validation, display warning and reset focus to field*/
        alert("" + str + " failed validation!\nPlease try again using the format:\n\n###-###-####");
	phone.value = "";
        return false; /*forces form to not go onto next step*/
    }
}

function isan(string) {
    if (string.length == 0)
        return false;
    for (var i=0;i < string.length;i++)
        if ((string.substring(i,i+1) < '0') || (string.substring(i,i+1) > '9'))
            return false;
    
    return true;
}

function validateInt(iString) {
    // no leading 0s allowed
    return (("" + parseInt(iString)) == iString);
}

