function openNewWindow(fileName,windowName,theWidth,theHeight,theLeft,theTop)
{
	if (windowName == "newMessageWindow") 
		{
		//generate random window ID
		 windowName = new String(Math.round(Math.random() * 100000));
		}
	var childwindow = window.open(fileName,windowName,"dependent, alwaysRaised, toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width="+theWidth+",height="+theHeight)
	var ScreenWidth = window.screen.width;
	var ScreenHeight = window.screen.height;
	if(theLeft>0 && theTop>0)
		{
		if(theLeft+theWidth>ScreenWidth)
			theLeft = (ScreenWidth-theWidth)/2;
		if(theTop+theHeight>ScreenHeight)
			theTop = (ScreenHeight-theHeight)/2;
		try
			{
			childwindow.moveTo(theLeft, theTop);
			}
		catch(e)
			{
			}
		}
	return childwindow;
}
	
	
function openNewWindowFinan(fileName,windowName,theWidth,theHeight,theLeft,theTop)
{
	if (windowName == "newMessageWindow") 
		{
		//generate random window ID
		 windowName = new String(Math.round(Math.random() * 100000));
		}
	var childwindow = window.open(fileName,windowName,"dependent, alwaysRaised, toolbar=1,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=1,width="+theWidth+",height="+theHeight)
	var ScreenWidth = window.screen.width;
	var ScreenHeight = window.screen.height;
	if(theLeft>0 && theTop>0)
		{
		if(theLeft+theWidth>ScreenWidth)
			theLeft = (ScreenWidth-theWidth)/2;
		if(theTop+theHeight>ScreenHeight)
			theTop = (ScreenHeight-theHeight)/2;
		try
			{
			childwindow.moveTo(theLeft, theTop);
			}
		catch(e)
			{
			}
		}
	return childwindow;
}

function getPhoto(agent_id,type,reload)
{
	var sReloadCode = '';
	if(reload==1)
		sReloadCode = '&reload=1';
	
	var sTypeCode = '';
	if(type!='')
		sTypeCode = '&orig=start&type=' + type;
	
	openNewWindow(protocol + domain + '/wizards/photo/wiz_addphotowhich.asp?opcode=add&agent_id=' + agent_id + sReloadCode + sTypeCode,'newMessageWindow',400,400,200,90);
	return;
}

function BugReport()
{
	openNewWindow(protocol + domain + '/tools/bug_report/bug_report.asp','newMessageWindow',405,358,0,0);
}

function openNewMapWindow(fileName,windowName,theWidth,theHeight,theLeft,theTop)
{
	if (windowName == "newMessageWindow") 
		{
		//generate random window ID
		 windowName = new String(Math.round(Math.random() * 100000));
		}
	var childwindow = window.open(fileName,windowName,"dependent, alwaysRaised, toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width="+theWidth+",height="+theHeight)
	var ScreenWidth = window.screen.width;
	var ScreenHeight = window.screen.height;
	if(theLeft>0 && theTop>0)
		{
		if(theLeft+theWidth>ScreenWidth)
			theLeft = (ScreenWidth-theWidth)/2;
		if(theTop+theHeight>ScreenHeight)
			theTop = (ScreenHeight-theHeight)/2;
		try
			{
			childwindow.moveTo(theLeft, theTop);
			}
		catch(e)
			{
			}
		}
}

function ValidateEmail(thisform)
{
	if(thisform.Email1.value > '' && thisform.Client1.selectedIndex > 0){
		alert('Please enter an E-Mail address OR select a client for recipient 1.');
		return false;
	}
	if(thisform.Email2.value > '' && thisform.Client2.selectedIndex > 0){
		alert('Please enter an E-Mail address OR select a client for recipient 2.');
		return false;
	}
	if(thisform.Email3.value > '' && thisform.Client3.selectedIndex > 0){
		alert('Please enter an E-Mail address OR select a client for recipient 3.');
		return false;
	}
	if(thisform.Email4.value > '' && thisform.Client4.selectedIndex > 0){
		alert('Please enter an E-Mail address OR select a client for recipient 4.');
		return false;
	}
	if(thisform.Email5.value > '' && thisform.Client5.selectedIndex > 0){
		alert('Please enter an E-Mail address OR select a client for recipient 5.');
		return false;
	}

	if(thisform.Email1.value == '' && thisform.Client1.selectedIndex < 1 && thisform.Email2.value == '' && thisform.Client2.selectedIndex < 1)
	{
		alert('Please select a recipient for this report.');
		return false;
	}
	else
		return true;
}
function ValidateEmail2(thisform) {
    if (!confirm('Do not email Agent Reports to the Public.  Doing so may violate your fiduciary responsibility of Sellers confidential information.\n')) {
        return false;
    }
    if (thisform.Email1.value > '' && thisform.Client1.selectedIndex > 0) {
        alert('Please enter an E-Mail address OR select a client for recipient 1.');
        return false;
    }
    if (thisform.Email2.value > '' && thisform.Client2.selectedIndex > 0) {
        alert('Please enter an E-Mail address OR select a client for recipient 2.');
        return false;
    }
    if (thisform.Email3.value > '' && thisform.Client3.selectedIndex > 0) {
        alert('Please enter an E-Mail address OR select a client for recipient 3.');
        return false;
    }
    if (thisform.Email4.value > '' && thisform.Client4.selectedIndex > 0) {
        alert('Please enter an E-Mail address OR select a client for recipient 4.');
        return false;
    }
    if (thisform.Email5.value > '' && thisform.Client5.selectedIndex > 0) {
        alert('Please enter an E-Mail address OR select a client for recipient 5.');
        return false;
    }

    if (thisform.Email1.value == '' && thisform.Client1.selectedIndex < 1 && thisform.Email2.value == '' && thisform.Client2.selectedIndex < 1) {
        alert('Please select a recipient for this report.');
        return false;
    }
    else
        return true;
}

function SarCalc()
{
	//openNewWindow(protocol + domain + '/mortTools1.htm','newMessageWindow',600,500,0,0);
	openNewWindowFinan(protocol + domain + '/Java/index.html','newMessageWindow',775,600,0,0);
}
function logoff()//cross-browser
{
	 var a = confirm("Are you sure you want to log off?");
	 if(a)
		location.href = protocol + domain + "/Logoff.asp";
}
