// ----- Server Definitions -----------------------------------------
var sLocal  = "/";
var sSwitch = "http://okcmar.marketlinx.net/";
var sStaff  = "/";
var sTips   = "http://okcmar.marketlinx.net/";
var sHelpDeskMail = "helpdesk@okcrealtors.com";


// ----- Navigation Base Functions ----------------------------------
function GoTo        (ser,add)  {top.location.href      = ser + add;} // blow away any frames
function GoToDocument(ser,add)  {document.location.href = ser + add;} // load in frame
function GoToNewUI   (ser,add)  {top.main.location.href = ser + add;} // blow away any frames
function Replace(ser, add)		{document.location.replace(ser+add);} // replace in history
function Redirect(ser, add)		{Replace(ser, add); document.location.reload();} //redirect a page. 
function PopupNewWindow(ser,add)
{
	var url = ser + add;
	window.open(url, "Tulsa");
	return;
}
function PopupNewWindowSmall(ser,add)
{
	var url = ser + add;
	window.open(url, "TulsaSmall","width=500,height=600,scrollbars=1,resizable=1");
	return;
}
// ----- Specific Web Navigation Functions ---------------------------
function GetAddEditWeb()
{
	GoToNewUI(sLocal, "Edit/NewUI.html");
	top.menu.changeVariable("edit");
	top.menu.activateCell(1);
	return;
}
function GetAgent(pubID)          { PopupNewWindowSmall(sLocal, GetRosterPath()+"Scripts/Member.asp?PubID="+pubID); }
function GetBroker(BkrCode)       { PopupNewWindowSmall(sLocal, GetRosterPath()+"Scripts/OfficeSrhPopUp.asp?OfficeID="+BkrCode); }
function GetBrokerHeadWeb()
{
	GoToNewUI(sLocal, "BrokerHead/DefaultNew.htm");
	top.menu.changeVariable("headbroker");
	top.menu.activateCell(1);
	return;
}
function GetBrokerOfficePath()    { return "BrokerOffice/"; }
function GetBrokerOfficeWeb()
{
	GoToNewUI(sLocal, "BrokerOffice/DefaultNew.htm");
	top.menu.changeVariable("officebroker");
	top.menu.activateCell(1);
	return;
}
function GetBrokerOfficeWebEdit() { GoTo(sLocal,GetBrokerOfficePath() + 'Scripts/BrokerEdit.idc' ); }
function GetCustomSearch(sid)     { GoToDocument(sLocal, GetSearchPath()+"Scripts/CSS/CusSrh.asp?Id=" + sid); }
// This next function is only used in Prospects/Scripts/ProspectShow.asp. We do not use prp anymore.
function GetCustomPrpSearch(prp, sid) { return GetCustomSearch(sid); }
function GetDiscussionWeb()       { GoTo(sLocal,"Discussion/Default.htm"); }
function GetDownloadAction()      { return sLocal + GetSearchPath()+"Scripts/Download/Information.asp"; }
function GetEmailWeb()            { return sLocal + "Email/Scripts/EmailForm.asp"; }
function GetFinancialWeb()        { GoTo(sLocal,"Financial/Default.htm"); }
function GetInfoWeb()             { GoTo(sLocal,"Info/default.htm"); }
function GetMlsNo()               { GoToDocument(sLocal,GetSearchPath()+"Mls.htm"); }
function GetNewsLetterWeb()       { GoTo(sTips,"NewsLetter/newsletter/pageone.htm"); }
function GetMyPageWeb()           { GoTo(sLocal,"Subscriber/MyPage.asp"); }
function GetPartnersWeb()         { GoTo(sLocal,"Partners/Default.htm"); }
function GetPrintListing(prp, mls) { return GetSearchDetailPath()+"Scripts/PrtAgtFul/PrtAgtFul.asp?MlsNumList=" +mls+ "&prp=" +prp; }
function GetProspectsWeb()        { GoTo(sLocal,"Prospects/Default.htm"); }
function GetReportsPath()         { return "Reports/"; }
function GetReportsMenu()         { GoToDocument(sLocal,GetReportsPath() + "Scripts/Default.asp"); }
function GetReportsWeb()          { GoTo(sLocal,GetReportsPath() + "Default.htm"); }
function GetReportsWebAct()       { GoTo(sLocal,GetReportsPath() + "Act.htm"); }
function GetRosterPath()          { return  "Roster/"; }           
function GetRosterWeb()           { GoTo(sLocal, GetRosterPath() + "Default.htm"); }
function GetRTHome()              { GoTo(sLocal,"/Subscriber/thome.htm"); }
function GetSearchDetailPath()    { return "SearchDetail/"; }
function GetSearchDetailWeb()     { GoTo(sLocal,GetSearchDetailPath() + "Default.htm"); }
function GetSearchMenu()          { GoToDocument(sLocal,GetSearchDetailPath() + "DefaultMenu.htm"); }
function GetSearchPath()          { return "Search/"; }
function GetSearchWeb()           { GoTo(sLocal,GetSearchDetailPath() + "Default.htm"); }
function GetStf()
{
	GoToNewUI(sLocal, "StfMaint/Default.asp");
	top.menu.changeVariable("staff");
	top.menu.activateCell(1);
	return;
}
function GetStfData()             { GoTo(sStaff,"StfData/default.asp"); }
function GetStfMaint()            { GoTo(sStaff,"StfMaint/default.asp"); }
function GetStfPicturesPath()     { return "StfPictures"; }
function GetStfPictures()         { GoTo(sStaff,GetStfPicturesPath()+"/default.asp"); }
function GetThirdParty()          { return "/ThirdParty/"; }
function ReturnTaxWeb()           { return(sLocal + "Tax/"); }
function GetTipsPath()            { return (sTips + "Tips/"); }
function GetTipsWeb()             { GoTo(sTips,"Tips/Default.htm"); }
function GetTipsWelcome()         { return GetTipsPath() + "Welcome.htm"; }
function RedirectSearch()       { Redirect(sLocal,GetSearchDetailPath() + "Default.htm");}
function RedirectBrokerHead()   { Redirect(sLocal,"BrokerHead/Default.htm");}
function RedirectReports()      { Redirect(sLocal,GetReportsPath() + "Default.htm");}     
// ----- Functions Which Do Specific Tasks --------------------------
// This functions builds the url string necessary to display
// an agent quarter page w/o photo.
function GetPrtNoP4(mls, prp)
{
	var RetVal = "/" + GetSearchDetailPath() + "Scripts/PrtNoP4/PrtNoP4.asp";
	RetVal += "?prp="+prp;
	RetVal += "&MlsNumList="+mls;
	return (RetVal);
}
function PrintListing(proptype, mlsNumber)
{
	GoToDocument(sLocal, GetSearchDetailPath()+"Scripts/PrtAgtFul/PrtAgtFul.asp?MlsNumList=" +mlsNumber+ "&prp=" +proptype     );
}
function PrintEditListing(proptype, uid)
{
	var d = new Date();
	var t = d.getTime();
	PopupNewWindow(sLocal, GetSearchDetailPath()+"Scripts/PrtNoPFul/PrtNoPFul.asp"
		+"?UidList=" + uid
		+"&EditMode=true"
		+"&prp=" +proptype
		+"&time=" + t);
}
// ----- Client Side functions to print HTML ------------------------   
var thisDD = new Date();
function GetCopyright()
{
	return('<font Size=1><img src ="/share/images/miscellaneous/tempotransparent.gif" border="0">Software Copyright &copy; MarketLinx, Inc.1997-'+thisDD.getFullYear()+' All Rights Reserved</font><br>');
}
function GetDataCopyright()
{
	return('<Font Size=1>MLS Data Copyright &copy; Northeast Oklahoma Real Estate Services, Inc. &copy; 2001-'+thisDD.getFullYear()+' All Rights Reserved <B>Support:</B><A HREF="mailto:helpdesk@tulsarealtors.com"> helpdesk@tulsarealtors.com</A> </Font>')
}
function PrintCopyright()
{
	document.write('<p align="center">'+GetCopyright()+GetDataCopyright()+'</p>');
}
function PrintDataCopyright() {}
function GetLogo()
{
	return("<img src=/Custom/Images/Headers/pageLogo.jpg>")
}
function PrintGetLogo()
{
	document.write(GetLogo());
}
function GetProSub()
{
	return ("<img src =/Share/Images/Headers/ProSub.jpg>")
}
function PrintGetProSub()
{
	document.write(GetProSub());
}
function GetProHeader()
{
	return ("<img src =/Share/Images/Headers/ProHeader.jpg>")
}
function PrintGetProHeader()
{
	document.write(GetProHeader());
}
// ----- Help Page Functions ----------------------------------------
// check to make sure that we should include help 
// vHelpPage is include in the 'outside' page to indicate
// if help should be included or not.  
// If it is defined and blank, then use our standard naming convention of 
// <basefilename>help.htm
// If it is defined and not blank, then use its value as our help file to open
// This function will open the specific page given to it based
// on the current web location. Meaning it takes the page url
// such as "/Edit/Scripts/Hidden.asp", removes the "Hidden.asp"
// part and appends the url passed in. It then opens it in a new
// window.
function OpenHelpWindow(szPageUrl)
{
	var wAttrib = "width=500,height=400,toolbar=0,status=0,location=0,directories=0,menubar=0,scrollbars=1,resizable=1";
	var szTmp = new String(location.pathname);
   szTmp = szTmp.substring( 0, szTmp.lastIndexOf('/')+1);
   window.open(szTmp + szPageUrl, "Help", wAttrib);
}
var helpURL;
function Click4Help() 
{
	var wAttrib = "'width=500,height=400,scrollbars=1,resizable=1'"
	helpURL = helpURL + ",'Help'," + wAttrib;
	eval("window.open("+helpURL+");");
}
function OpenHelp(overrideURL)
{
	// this does not work if parameters are passed
	if((overrideURL=="undefined")||(overrideURL==''))
	{  
		// default action
		helpURL = new String(self.location.href);
		if(helpURL.indexOf("?")>0)
		{
			helpURL = helpURL.substring(0, helpURL.indexOf("?"));
		}
		if(helpURL.lastIndexOf(".")>0)
		{
			helpURL = helpURL.substring(0, helpURL.lastIndexOf("."));
		}
		helpURL += "help.htm";
	}
	else
	{
		helpURL = overrideURL;
	}
	// add ' to front and back of URL
	helpURL = "'"+helpURL+"'";
	var wAttrib = "'width=500,height=400,scrollbars=1,resizable=1'"
	document.write ('<a href="javascript: Click4Help()" >');
	document.write ('<img src="/Share/images/Navigation/BBHelpRed.jpg" alt="Help with this Page" border="0" width="63" height="72"></a>')
}  
function HelpFooter()
{
	document.write('<form method="POST">');
    document.write('<div align="center"><p><input onClick="window.close()" type="button" value="Close Window" name="close">');
	// flag for browser type.
	var bNetscape = (navigator.appName == "Netscape") ? true : false;
	if (bNetscape == true)
	{
		document.write('<input onClick="window.print()" type="button" ');
		document.write('value="Print" name="close"></p>');
	}
	else
	{
		document.write('<p><font size=2 color="#OOOOFF">To <font size=4><b>PRINT</b></font>, right click and select "Print"</font></p>');
	}
	document.write('</div></form>');
}
// More hacked code in the locator file!
function isExplorer5()
{
	// convert all characters to lowercase to simplify testing 
	var agt=navigator.userAgent.toLowerCase(); 
	// *** BROWSER VERSION *** 
    // Note: On IE5, these return 4, so use is_ie5up to detect IE5.
	var is_major = parseInt(navigator.appVersion); 
	var is_ie   = (agt.indexOf("msie") != -1); 
	var is_ie3  = (is_ie && (is_major < 4)); 
	var is_ie4  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")==-1) ); 
	var is_ie5up  = (is_ie  && !is_ie3 && !is_ie4); 
	return is_ie5up;
}
function PopUp(url)
{
	window.open(url,"PopUp","height=350,width=200,scrollbars=yes");
	return;
}
function GetListPopUp(ListBox,FormVar)
{
	window.open('/Search/ListPopUp.asp?ListBox=' + ListBox + '&amp;FormVar=' + FormVar,'ListBox','height=350,width=600,scrollbars=yes'); 
}
