if (top == self) self.location.replace('default.htm'); 
var message="Copyright, 2006-2008, Exeter 1031 Exchange Services, LLC, All Rights Reserved.";
function clickIE4(){
	if (event.button==2){
		alert(message);
		return false;
	}
}
function clickNS4(e){
	if (document.layers||document.getElementById&&!document.all){
		if (e.which==2||e.which==3){
			alert(message);
			return false;
		}
	}
}
if (document.layers){
	document.captureEvents(Event.MOUSEDOWN);
	document.onmousedown=clickNS4;
	}
else if (document.all&&!document.getElementById){
	document.onmousedown=clickIE4;
}
document.oncontextmenu=new Function("alert(message);return false")
// ====================================
function showHideHelp() {
	if (document.getElementById) { 
  		menustyle = document.getElementById('divHelp').style; 
  	} else {
		var doc = document.layers; 
		var style = '';
	    menustyle = eval('doc.divHelp' + style);
	}
	if (menustyle.visibility=='hidden') {
		menustyle.visibility='visible';
		createCookie("help","show",0);
	} else {
		menustyle.visibility='hidden';
		createCookie("help","hide",0);
	}
}
// ====================================
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}
// ====================================
function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
// ====================================
function setupHelp() {
	var strCookie = readCookie("help");
	if (strCookie == "show") {
		showHideHelp();
	} else {
		if (strCookie == "hide") {
			// hide
		} else {
			showHideHelp();
		}
	}
}
// ====================================
function PostTo(strPage) {
if (Validate() == true ) {
	document.WizardForm.ToPage.value = strPage;
	document.WizardForm.submit();
	}
}
// ====================================
function isDigit (c){   
	return ((c >= "0") && (c <= "9"))
}
// ====================================
function isInteger (s) {   
	var i;
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (!isDigit(c)) return false;
    }
    return true;
}
// ====================================
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 checkPhone (theField){  
	var normalizedPhone = stripCharsInBag(theField.value, "()-. ");
    return (isInteger(normalizedPhone) && normalizedPhone.length == 10);
}
// ====================================
function checkZipCode (theField) {   
 var normalizedZIP = stripCharsInBag(theField.value, "-");
 return (isInteger(normalizedZIP) && ((normalizedZIP.length == 5) || (normalizedZIP.length == 9)));
}
// ====================================
function checkEmail(theField) {
	return (theField.value.indexOf("@") + "" != "-1" &&
  		theField.value.indexOf(".") + "" != "-1" &&
  		theField.value != "") 
}
// ====================================
var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
 if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/4:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
 settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
 win=window.open(mypage,myname,settings);
}
// ====================================
function daysInFebruaryX (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
// ====================================
function DaysArrayX(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31;
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this;
}
// ====================================
function isDateX(dtStr){
	var dtCh= "/";
	var minYear=1900;
	var maxYear=2100;
	var daysInMonth = DaysArrayX(12);
	var pos1=dtStr.indexOf(dtCh);
	var pos2=dtStr.indexOf(dtCh,pos1+1);
	var strMonth=dtStr.substring(0,pos1);
	var strDay=dtStr.substring(pos1+1,pos2);
	var strYear=dtStr.substring(pos2+1);

	strYr=strYear;
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1);
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1);
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	var month=parseInt(strMonth);
	var day=parseInt(strDay);
	var year=parseInt(strYr);
	if (pos1==-1 || pos2==-1){
		alert("The date format should be : mm/dd/yyyy");
		return false;
	}
	if (strMonth.length<1 || month<1 || month>12){
		alert("Please enter a valid month");
		return false;
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruaryX(year)) || day > daysInMonth[month]){
		alert("Please enter a valid day");
		return false;
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear);
		return false;
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		alert("Please enter a valid date");
		return false;
	}
	return true;
}

