
function open_window(url,name,width,height) 
{
	//alert(url);
	window.open(url,
		name,
		'toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=1,scrollbars=1,width='
		+ width 
		+ ',height='+height);
}

function openParentWindow(url, parent)
{
	window.open(url, parent);
	window.close();
}

function setSessionTimer(iTimer)
{
	setTimeout('sessionTimeout()',60000 * iTimer);
}
function sessionTimeout()
{
	if(window.location.hostname == "qualityservice.org")
	{
		alert("Your session has expired");
		document.location.href="search.aspx";
	}
}
function getHeaderSearch()
{
	if(txtSearchName.value != "Type member`s name here" && txtSearchName.value != "")
	{
		window.location.href="search.aspx?member=" + txtSearchName.value;
		return true;
	}
	else 
	{
		window.location.href="search.aspx";
	}
}
function lockFranchise(bLock)
{
	if(!bLock)
	{
		document.getElementById('ddlFranchiseList').className = "SearchData";
		document.getElementById('ddlFranchiseList').disabled = false;
	}
	else
	{
		document.getElementById('ddlFranchiseList').className = "SearchData readonly";
		document.getElementById('ddlFranchiseList').disabled = true;
	}
}

function buttonNav(sUrl)
{
	document.frmHeadSearch.action = sUrl;
	if(!NoDB)
	{
		document.getElementById('txtNewSearch').value = false;
		document.getElementById('ddlStateList').value = 0;
	}
	document.frmHeadSearch.submit();
}
function __doPostBack(eventTarget, eventArgument, eventProperty)
{
	var theform;
	if (window.navigator.appName.toLowerCase().indexOf('microsoft') > -1)
	{
		theform = document.frmSearch;
	}
	else
	{
		theform = document.forms['frmSearch'];
	}
	theform.__EVENTARGUMENT.value = eventArgument;
	theform.__EVENTPROPERTY.value = eventProperty;
	theform.__EVENTTARGET.value = eventTarget.split('$').join(':');
	theform.submit();
}
function submitSearch()
{
	var text = "none";
	var bChecked = document.getElementById("rdoReal").checked 
		? document.getElementById("rdoReal").checked 
		: document.getElementById("rdoMort").checked;
	if(!bChecked)
		text = "Please select an Industry";
	if(text != "none")
	{
		alert(text);
		document.getElementById("rdoReal").select();
		return false;
	}
	else
	{
		document.getElementById('bdyConsumer').style.cursor = "wait";
		document.getElementById('txtNewSearch').value = true;
		document.frmHeadSearch.submit();
		return true;
	}
}
function showHand(Object)
{
	Object.style.cursor = "Hand";
}
function clearHand(Object)
{
	Object.style.cursor = "";
}
function clearSearch()
{
	document.getElementById('txtSearchName').value = "Type member's name here";
	document.getElementById('rdoReal').checked = false;
	document.getElementById('rdoMort').checked = false;
	document.getElementById('ddlStateList').selectedIndex = 0;
	document.getElementById('txtCompanyName').value = "Enter company name (optional)";
	document.getElementById('ddlFranchiseList').selectedIndex = 0;
	document.getElementById('chkCSR').checked = false;
	document.getElementById('chkWebSites').checked = false;
	document.getElementById('ddlFranchiseList').className = "SearchData";
	document.getElementById('ddlFranchiseList').disabled = false;
	return false;
}

function resizeSearchBox()
{
	var oLong = document.getElementById('tbLongSearch');
	var oSearchButtons = document.getElementById('tbSearchButtons');
	var oSearchMore = document.getElementById('hlSearchMore');
	var oButton = document.getElementById('dvSearchButtons');
	var oSearchMode = document.getElementById('txtLongSearch');
	//var oPBSearchMode = document.getElementById('txtLong');
	oLong.className='LongSearchOpen';
	oSearchButtons.className='SearchButtonOpen';
	oSearchMore.className+=' Hidden';
	oButton.style.left = "-60px";
	oSearchMode.value='true';
	//oPBSearchMode.value='true';
}

function selectMap(eventTarget, eventArgument, eventProperty)
{
	var sUrl = "search.aspx?"
	if(eventTarget == "statemap")
	{
		sUrl += "stateId=";
		sUrl += eventArgument;
	}
	else
	{
		sUrl += "countryId="
		sUrl += eventArgument
		sUrl += "&industryId="
		sUrl += eventProperty;
	}
	window.location.href = sUrl;
}

function getIndustry(iIndustryId)
{
	window.location.href = "search.aspx?IndustryId=" + iIndustryId;
}

function redirect_window(url)
{
	window.location.href = url;
}
function getOnlineProgram(bMortgage) 
{
	var sURL = sBasePath;
	var iHeight = 720;
	if (bMortgage)
	{
		sURL += "onlineprogram/mortgage/olprogram.htm" ;
	}
	else
	{
		sURL += "OnlineProgram/OnlineProgram2"
	}
	if (screen.availHeight < 700) {
		var iheight=640;
	}
	window.open(sURL
		,'_new'
		,'toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=1,scrollbars=1,width=700,height=' 
		+ iHeight 
		+ ',screenX=0,screenY=0');
}

function getNewImage(iAgentId)
{
	open_window("..\controls\fileupload.ascx","NewImage",100,100)
}