function checkMail(email_address)
{
	// original filter
	// var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;

	//from http://www.regular-expressions.info/email.html; supposedly matches 99% of the email addresses in use today.
	//var filter  = /^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;

	var filter = /^[a-z0-9][^()<>@?!' ^|,;:\\/{}"\[\]]*\@[a-z0-9][a-z0-9\-\.]*\.[a-z]{2,4}$/i;

	if (email_address.indexOf(" ") >= 0) return false;

	return filter.test(email_address);
}

function checkPhoneNumber(phone)
{
    if (!phone) return true;
	var filter = /^[2-9]\d{2}-\d{3}-\d{4}$/i;

	return filter.test(phone);
}

function checkZipPostalCode(zip)
{
    if (!zip) return true;
    var filter = /^((\d{5}-\d{4})|(\d{5})|([AaBbCcEeGgHhJjKkLlMmNnPpRrSsTtVvXxYy]\d[A-Za-z]\s?\d[A-Za-z]\d))$/i;
    return filter.test(zip);
}

function isValidURL(url){
	var filter1 = /^[^()<>@',;\\"{}[\]]+$/i;

	if (url.indexOf("..") >= 0) return false;
	if (url.indexOf(" ") >= 0) return false;

	if (filter1.test(url)) return true;
	return false;
}

function chkWBTitle(object1,object2,wb_id,bChkTitle)
{
    if (wb_id==null)
        wb_id='';
    if (bChkTitle==null) 
        bChkTitle=false;
 
    if (object2==null)
    {
	    if (trim(object1.value)=="")
		{
				alert('A Web box must have a unique title – please enter a unique title to continue.');
				object1.focus();
				return false;
		}
	}
	else
	{
		var errorMessage='Error: You must enter a link display name that is less than 50 characters and a link URL.';
		if (trim(object1.value)=="")
		{
	    	alert(errorMessage);
			object1.focus();
			return false;
		}
		if (trim(object2.value)=="")
		{
			alert(errorMessage);
			object2.focus();
			return false;
		}
	}
    if (bChkTitle)
    {
        var url = "checkWBTitle.asp?wb_id="+wb_id+"&title="+object1.value;
        if (makePOSTRequest(url,'',true).indexOf("<bWBTitleExist>true</bWBTitleExist>")>-1)
        {
            alert("A Web box must have a unique title – please enter a unique title to continue.");
            object1.focus();
            return false;
        }
     }
	return true;
}

// general string functions
function trim(sString)
{
    return Trim(sString);
}

function Trim(sString){
  if(sString.length < 1)
  {
      return"";
  }
  sString = RTrim(sString);
  sString = LTrim(sString);
  if(sString=="")
  {
      return "";
  }
  else
  {
      return sString;
  }
}

function RTrim(sString)
{
  var w_space = String.fromCharCode(32);
  var v_length = sString.length;
  var strTemp = "";

  if(v_length < 0)
  {
    return"";
  }

  var iTemp = v_length -1;
  while(iTemp > -1)
  {
    if(sString.charAt(iTemp) == w_space){
		} else {
			strTemp = sString.substring(0,iTemp +1);
			break;
		}
		iTemp = iTemp-1;
  }

  return strTemp;
}

function LTrim(sString)
{
  var w_space = String.fromCharCode(32);
  if(v_length < 1)
  {
      return"";
  }
  var v_length = sString.length;
  var strTemp = "";

  var iTemp = 0;
  while(iTemp < v_length)
  {
    if(sString.charAt(iTemp) == w_space)
    {
    } else {
      strTemp = sString.substring(iTemp,v_length);
      break;
    }
    
    iTemp = iTemp + 1;
  }
  
  return strTemp;
}

function Left(sString, n)
{
	if (n <= 0)
		return "";
	else if (n > sString.length)
		return sString;
	else
		return sString.substring(0,n);
}

function Right(sString, n)
{
	if (n <= 0)
		return "";
	else if (n > sString.length)
		return sString;
	else
	{
		var iLen = sString.length;
		return sString.substring(iLen, iLen - n);
	}
}

function isDate(DateToCheck)
{
  if(DateToCheck=="")
      {return true;}
  var m_strDate = FormatDate(DateToCheck);

  if(m_strDate==""){
      return false;
  }
  var m_arrDate = m_strDate.split("/");
  var m_DAY = m_arrDate[0];
  var m_MONTH = m_arrDate[1];
  var m_YEAR = m_arrDate[2];
  if(m_YEAR.length > 4){return false;}
  m_strDate = m_MONTH + "/" + m_DAY + "/" + m_YEAR;
  var testDate=new Date(m_strDate);
  if(testDate.getMonth()+1==m_MONTH)
  {
      return true;
  }
  else
  {
      return false;
  }
}

function FormatDate(DateToFormat,FormatAs)
{
  if(DateToFormat==""){return "";}

  if(!FormatAs){FormatAs="dd/mm/yyyy";}

  var strReturnDate;
  FormatAs = FormatAs.toLowerCase();
  DateToFormat = DateToFormat.toLowerCase();
  var arrDate
  var arrMonths = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
  var strMONTH;
  var Separator;

  while(DateToFormat.indexOf("st")>-1)
  {
      DateToFormat = DateToFormat.replace("st","");
  }
  while(DateToFormat.indexOf("nd")>-1)
  {
      DateToFormat = DateToFormat.replace("nd","");
  }
  while(DateToFormat.indexOf("rd")>-1)
  {
      DateToFormat = DateToFormat.replace("rd","");
  }

  while(DateToFormat.indexOf("th")>-1)
  {
      DateToFormat = DateToFormat.replace("th","");
  }

  if(DateToFormat.indexOf(".")>-1)
  {
      Separator = ".";
  }

  if(DateToFormat.indexOf("-")>-1)
  {
      Separator = "-";
  }

  if(DateToFormat.indexOf("/")>-1)
  {
      Separator = "/";
  }

  if(DateToFormat.indexOf(" ")>-1)
  {
      Separator = " ";
  }

  arrDate = DateToFormat.split(Separator);
  DateToFormat = "";
	for(var iSD = 0;iSD < arrDate.length;iSD++)
	{
		if(arrDate[iSD]!="")
		{
				DateToFormat += arrDate[iSD] + Separator;
		}
	}
  DateToFormat = DateToFormat.substring(0,DateToFormat.length-1);
  arrDate = DateToFormat.split(Separator);

  if(arrDate.length < 3)
  {
      return "";
  }

  var DAY = arrDate[0];
  var MONTH = arrDate[1];
  var YEAR = arrDate[2];

  if(parseFloat(arrDate[1]) > 12)
  {
      DAY = arrDate[1];
      MONTH = arrDate[0];
  }

  if(parseFloat(DAY) && DAY.toString().length==4)
  {
      YEAR = arrDate[0];
      DAY = arrDate[2];
      MONTH = arrDate[1];
  }

  for(var iSD = 0;iSD < arrMonths.length;iSD++)
  {
      var ShortMonth = arrMonths[iSD].substring(0,3).toLowerCase();
      var MonthPosition = DateToFormat.indexOf(ShortMonth);
			if(MonthPosition > -1)
			{
				MONTH = iSD + 1;
				if(MonthPosition == 0)
				{
						DAY = arrDate[1];
						YEAR = arrDate[2];
				}
				break;
			}
  }

  var strTemp = YEAR.toString();
  if(strTemp.length==2)
  {
    if(parseFloat(YEAR)>40)
    {
        YEAR = "19" + YEAR;
    }
    else
    {
        YEAR = "20" + YEAR;
    }
  }
  if(parseInt(MONTH)< 10 && MONTH.toString().length < 2)
  {
      MONTH = "0" + MONTH;
	}
	if(parseInt(DAY)< 10 && DAY.toString().length < 2)
	{
			DAY = "0" + DAY;
	}

	switch (FormatAs)
	{
			case "dd/mm/yyyy":
			return DAY + "/" + MONTH + "/" + YEAR;
			case "mm/dd/yyyy":
			return MONTH + "/" + DAY + "/" + YEAR;
			case "dd/mmm/yyyy":
			return DAY + " " + arrMonths[MONTH -1].substring(0,3) + " " + YEAR;
			case "mmm/dd/yyyy":
			return arrMonths[MONTH -1].substring(0,3) + " " + DAY + " " + YEAR;
			case "dd/mmmm/yyyy":
			return DAY + " " + arrMonths[MONTH -1] + " " + YEAR;
			case "mmmm/dd/yyyy":
			return arrMonths[MONTH -1] + " " + DAY + " " + YEAR;
			default:
			return arrMonths[MONTH -1] + " " + DAY + " " + YEAR;
	}

	return DAY + "/" + strMONTH + "/" + YEAR;
}

// CALLED BY on ACTIONS TO CHANGE THE BG COLOR OF DIV TAGS
function setBG(id, bgcolor) {
  if (document.getElementById) {
      document.getElementById(id).style.backgroundColor = bgcolor;
  }
}

// FORM SUBMISSION VIA IMAGE
function mySubmit() {
  if (document.formName.login.value == '') {
      alert('You must enter a value');
      return false;
  }
  else {
      alert('Submitting');
      return true;
  }
}

function myReset() {
    alert('Resetting');
}

// hide rows in a table
function toggleRows(tablename, startrow){
	var tbl = document.getElementById(tablename);
	var len = tbl.rows.length;

	for(var i=startrow ; i< len; i++){
		if (tbl.rows[i].style.display == "none")
		 tbl.rows[i].style.display = ""
		else
		 tbl.rows[i].style.display = "none";
	 }

	var displayflag = document.getElementById(tablename+"RowsStatus");
	if (displayflag.value.length > 0)
		displayflag.value = ""
	else
		displayflag.value = "show";
}

// function used to force maximum data length in TEXTAREA field
// does not handle right-click pasting of text
function ismaxlength(obj){
	var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
	if (obj.getAttribute && obj.value.length>mlength)
		obj.value=obj.value.substring(0,mlength)
}

// image handling functions
// note: some duplication exists and should be cleaned up at some point
function _preLoad() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=_preLoad.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function _swapR() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function _find(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=_find(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function _swap() { //v3.0
  var i,j=0,x,a=_swap.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=_find(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

// popup window script
// note: some duplication exists and should be cleaned up at some point
function preview(mypage,myname,w,h,pos,infocus){
	if(pos=="random"){
		myleft=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;
		mytop=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;
	}
	if(pos=="center"){
		myleft=(screen.width)?(screen.width-w)/2:100;
		mytop=(screen.height)?(screen.height-h)/2:100;
	}
	else
		if((pos!='center' && pos!="random") || pos==null){myleft=0;mytop=20}

	settings="width=" + w + ",height=" + h + ",top=" + mytop + ",left=" + myleft + ",scrollbars=yes,location=yes,directories=yes,status=yes,menubar=yes,toolbar=yes,resizable=yes";
	win=window.open(mypage,myname,settings);
	win.focus();
}

function popup(mypage,myname,w,h,pos,infocus){
	if(pos=="random"){
		myleft=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;
		mytop=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;
	}
	if(pos=="center"){
		myleft=(screen.width)?(screen.width-w)/2:100;
		mytop=(screen.height)?(screen.height-h)/2:100;
	}
	else
		if((pos!='center' && pos!="random") || pos==null){myleft=0;mytop=20}

	settings="width=" + w + ",height=" + h + ",top=" + mytop + ",left=" + myleft + ",scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes";
	win=window.open(mypage,myname,settings);
	win.focus();
}

function openWindow(url)
{
  curr_window_height = top.document.body.offsetHeight;
  curr_window_width = top.document.body.offsetWidth;
  if (navigator.appName.indexOf('Microsoft')!=-1)  curr_window_height -=20;
  window.open(url, "_blank", "titlebar, location, menubar, scrollbars, resizable, toolbar, width="+curr_window_width+", height="+curr_window_height+"");
}

function openURL(object)
{
    return openURL(object, 'The URL is not valid and cannot be loaded.');
}

function openURL(object, sCustomMessage)
{
	var URL=trim(object.value);
	var objNumber = /^\d/;
	var n;
	var tempstr;
	var strArray;

	try
	{
		if ((URL.length == 0) || (Right(URL,3) == "://") || (Right(URL,2) == ":/") || (Right(URL,1) == ":") || (URL.indexOf("@")>0))
			throw "";

		var newURL = ModifyURL(URL);

		window.open(newURL,"_blank");
	}
	catch (e)
	{
		alert(sCustomMessage);
		return false;
	}

	return true;
}

function ModifyURL(URLstring)
{
	var filter=/^(http|https|ftp|file)+\:\/\/|^(news|telnet|gopher)+\:/;

	if (filter.test(URLstring))
		return URLstring;
	else
		if (URLstring.indexOf(":")>0)
			return URLstring;
		else
			return "http://" + URLstring;
}

function GP_popupConfirmMsg(msg) {
  document.MM_returnValue = confirm(msg);
}

function getMonthName(mnth) 
{
	if (mnth == 0) 
	{
	name = "January";
	}
	else if(mnth==1) 
	{
	name = "February";
	}
	else if(mnth==2) 
	{
	name = "March";
	}
	else if(mnth==3) 
	{
	name = "April";
	}
	else if(mnth==4) 
	{
	name = "May";
	}
	else if(mnth==5) 
	{
	name = "June";
	}
	else if(mnth==6) 
	{
	name = "July";
	}
	else if(mnth==7) 
	{
	name = "August";
	}
	else if(mnth==8) 
	{
	name = "September";
	}
	else if(mnth==9) 
	{
	name = "October";
	}
	else if(mnth==10) 
	{
	name = "November";
	}
	else if(mnth==11) 
	{
	name = "December";
	}
	return name;

	}//getMonthName()

	/**
	* Get the number of days in the month based on the year.
	*/

	function getNoOfDaysInMnth(mnth,yr) 
	{

	rem = yr % 4;
	if(rem ==0) 
	{
	 leap = 1;
	}
	else 
	{
	leap = 0;
	}

	noDays=0;

	if ( (mnth == 1) || (mnth == 3) || (mnth == 5) ||
			(mnth == 7) || (mnth == 8) || (mnth == 10) ||
			(mnth == 12)) 
	{
	noDays=31;
	}
	else if (mnth == 2) 
	{
		 noDays=28+leap;
	}
	else 
	{
		 noDays=30;
	}

	return noDays;
}
  
function fillDates(sDate,aOpenHouseDate,bPreview,picURL,bClick,clickDate) 
{
    dt = new Date(sDate);
    iMonth = dt.getMonth(); /* 0-11*/
    dayOfMnth = dt.getDate(); /* 1-31*/
    dayOfWeek = dt.getDay(); /*0-6*/
    iYear = dt.getFullYear(); /*4-digit year*/
  
    mnthName = getMonthName(iMonth)+ " ";
    document.calendar.month.value = iMonth;
    document.calendar.year.value = iYear;
    document.calendar.currMonth.value = iMonth;
    document.calendar.currYear.value = iYear;
    document.getElementById("monthYear").innerHTML= mnthName;
    noOfDaysInMnth = getNoOfDaysInMnth(iMonth+1,iYear);

    iMonth=iMonth+1;
    if (iMonth<10) 
    {
        iMonth="0"+iMonth;
    }

    for(var i=1; i<43; i++) 
    {
       str = "s"+i;
       document.getElementById(str).innerHTML="   ";
       document.getElementById(str).onclick=null;
       document.getElementById(str).style.backgroundColor="";
    }
    startSlotIndx = dayOfWeek+1;
    slotIndx = startSlotIndx;
    result="";
    for(var i=1; i<(noOfDaysInMnth+1); i++) 
    {
        slotName = "s"+slotIndx;
        sTDID="td" + slotIndx;
        val="";
        if (i<10) 
        {
            val = " "+i+" ";
            iDay="0"+i;
        }
        else
        {
            val = i;
            iDay=i;
        }
        iDate=iYear+"/"+iMonth+"/"+iDay;
        bOpenHouse=false;
        for(j=0;j<aOpenHouseDate.length;j++)
        {
            if (aOpenHouseDate[j]==iDate)
            {
                bOpenHouse=true;
                break;
            }
        }
        document.getElementById(slotName).innerHTML=val;
        if (bOpenHouse)
        {
           document.getElementById(slotName).title=iDate;
           document.getElementById(slotName).innerHTML='<a href="'+'http://'+window.location.host+window.location.pathname+'?opendate='+iDate+bPreview+'&click=true" style="text-align:left;vertical-align:top;">'+document.getElementById(slotName).innerHTML+'</a><a href="'+'http://'+window.location.host+window.location.pathname+'?opendate='+iDate+bPreview+'&click=true">'+picURL+'</a>';
           document.getElementById(slotName).onclick=function(){document.getElementById((this.id).replace('s','td')).style.background='#0099CC';}
           if (bClick=='0' && clickDate==iDate)
           {
                document.getElementById(sTDID).style.background='#0099CC';
                result=iDate;
           }
           else if (result=="")
            result=iDate;
        }
        slotIndx++;
    }
    return result;
}

function thisMonth(aOpenHouseDate,c_date,bPreview,picURL,bClick) 
{
	var bPrev=false;
	var curdate;


	if (c_date=="" && aOpenHouseDate.length>0)
	{
		 dt=new Date(aOpenHouseDate[0]);
	}
	else
	{
			if (c_date.length==0)
				dt = new Date();
			else
				dt = new Date(c_date);
	}
	mnth  = dt.getMonth(); /* 0-11*/
	yr = dt.getFullYear(); /*4-digit year*/
	startStr = (mnth+1)+"/1/"+yr;
	curdate=fillDates(startStr,aOpenHouseDate,bPreview,picURL,bClick,c_date);
	  
	if (curdate!="")
	{
		var cDate=new Date(curdate);
		var cWeekday;
		switch (cDate.getDay())
		{
				case 0:
						cWeekday="Sunday";
						break;
				case 1:    
						cWeekday="Monday";
						break;
				case 2:    
						cWeekday="Tuesday";
						break;
				case 3:    
						cWeekday="Wednesday";
						break;
				case 4:    
						cWeekday="Thursday";
						break;
				case 5:    
						cWeekday="Friday";
						break;
				case 6:    
						cWeekday="Saturday";
						break;
		}
		document.getElementById("op_detail").innerHTML= "Details for open houses for " + cWeekday + ", " + mnthName + " " + cDate.getDate() ;
	}  
	if (c_date=="")
	{
		if (curdate.length>0)
		{
				var reDate=new Date(curdate);
				var currentDate=new Date();
	      
				if (reDate.getMonth()==currentDate.getMonth())
						bPrev=true;
		}
		else
				bPrev=true;
	}  
	else
	{
		if (!(isPrevMonth(yr,mnth)))
				bPrev=true;
	} 
	if (bPrev)
		document.getElementById("prev").style.display="none";
}

function nextMonth(aOpenHouseDate,bPreview,picURL)  
{
     var currMnth = document.calendar.month.value;
     currYr = document.calendar.year.value;

     if (currMnth == "11") 
     {
        nextMnth = 0;
        nextYr = currYr;
        nextYr++;
     } 
     else 
     {
       nextMnth=currMnth;
       nextMnth++;
       nextYr = currYr;
     }
     str = (nextMnth+1)+"/1/"+nextYr;
     return str;   
}

function prevMonth(aOpenHouseDate,bPreview,picURL) 
{
     var currMnth = document.calendar.month.value;
     currYr = document.calendar.year.value;

     if (currMnth == "0") 
     {
        prevMnth = 11;
        prevYr = currYr;
        prevYr--;
     } 
     else 
     {
       prevMnth=currMnth;
       prevMnth--;
       prevYr = currYr;
     }
     str = (prevMnth+1)+"/1/"+prevYr;
     if (!(isPrevMonth(prevYr,prevMnth+1)))
        return "false";
     return str;
 
}

function prevOpen(aOpenHouseDate,bPreview,picURL) 
{
    iDate=prevMonth(aOpenHouseDate,bPreview,picURL);
    if (iDate=="false")
    {
        document.getElementByID("prew").style.display='none';
    }
    else
    {
        var url='http://'+window.location.host+window.location.pathname+'?opendate='+iDate+bPreview;
        window.open(url,'_self');
    }
        
    
}

function nextOpen(aOpenHouseDate,bPreview,picURL) 
{
    var iDate=nextMonth(aOpenHouseDate,bPreview,picURL);
    var url='http://'+window.location.host+window.location.pathname+'?opendate='+iDate+bPreview;
    window.open(url,'_self');
}

function isPrevMonth(year,mon)
{
     var str = mon+"/1/"+year;
     var dt = new Date(str);
     var c_now=new Date();
     var s_date=new Date(c_now.getFullYear(),c_now.getMonth(),'1');
     if (dt.getTime() < s_date.getTime())
        return false;
     else 
        return true;   
}        

// Search through string's characters one by one.
// If character is not in bag, append to returnString.
function stripCharsInBag(s, bag)
{
	var i;
	var returnString = "";

	for (i = 0; i < s.length; i++)
	{   
		var c = s.charAt(i);
		if (bag.indexOf(c) == -1) returnString += c;
	}

	return returnString;
}

function isZipValid(s)
{   
	var i;
	s=s.toLowerCase();

	for (i = 0; i < s.length; i++)
	{   
		var c = s.charAt(i);
		if (((c < "0") || (c > "z"))) 
		{
			return false;
		} else {
			if (((c > "9") && (c < "a"))) 
			{
				return false;
			}
		}
	}

	return true;
}

// see if all characters are numbers.
function isInteger(s)
{
	var i;

	for (i = 0; i < s.length; i++)
	{   
		var c = s.charAt(i);
		if (((c < "0") || (c > "9")))
			return false;
	}

	return true;
}

function checkInternationalPhone(strPhone){
	var minDigitsInIPhoneNumber = 10;
	var validWorldPhoneChars = "()- +";

	s=stripCharsInBag(strPhone, validWorldPhoneChars);

	return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
}


var win=null;

MM_reloadPage(true);
