//******************************************************************************************//
// FUNCTION:																				//
//	resetbtn()																				//
//																							//
// PURPOSE:																					//
//	Resets the buttons in the main frame to blank, which will removes the buttons from the form	//
//																							//
// Thomas Gluckman - 3/3/05																	//
//******************************************************************************************//
function resetbtn()
{
	if (parent.document.getElementById('pageTitleCenter'))
	{
	parent.document.getElementById('pageTitle').innerHTML =""; 
	parent.document.getElementById('pageTitleCenter').innerHTML =""; 
	parent.document.getElementById('pageTitleRight').innerHTML =""; 
	if(!document.getElementById('errorsExist'))
	{
		parent.document.getElementById('toolBarButtons').innerHTML ="";
	}	
	}
}
function openCloseOptions(which, action)
{
	if(document.getElementById('DesktopOP'))
	{
		document.getElementById('DesktopOP').style.padding = "4px 0px 0px 4px";
	}
	try
	{
		if(parent.Form1.hdnOptionsPane)
		{
			if (document.getElementById && document.createTextNode)
			{
				m = document.getElementById("menu");
				trig = m.getElementsByTagName("div").item(which).style.display;
				// Philippe - if first time in the Form - Look @ flag in Parent form 
				// then set to Reverse of Position (C=Closed)
				
				if(action == 1)
				{
					if(parent.Form1.hdnOptionsPane.value == '1')
					{
						trig="block";
						document.getElementById('optionsImage').src = sRapMLSImages+'opopenedout.gif';
						document.getElementById('tdOptionsImgMagic').title = "Click to Collapse Options Pane";
					}
					else
					{
						trig="none";
						document.getElementById('optionsImage').src = sRapMLSImages+'opclosedout.gif';
						document.getElementById('tdOptionsImgMagic').title = "Click to Expand Options Pane";

					}
				}
				else
				{
					if (trig == "" && parent.Form1.hdnOptionsPane.value == '1')
						{
							trig = "block"
						} 
					if (trig == "block") 
					{
						trig="none";
						document.getElementById('optionsImage').src = sRapMLSImages+'opclosedout.gif';
						document.getElementById('tdOptionsImgMagic').title = "Click to Expand Options Pane";
					
						parent.Form1.hdnOptionsPane.value = '0'
					}
					else 
					{
						trig="block";
						document.getElementById('optionsImage').src = sRapMLSImages+'opopenedout.gif';
						document.getElementById('tdOptionsImgMagic').title = "Click to Collapse Options Pane";

						parent.Form1.hdnOptionsPane.value = '1'
					}
				}
				m.getElementsByTagName("div").item(which).style.display = trig;
				resizeTabs();
			}
		}
	}
	catch(e)
	{
		// do nothing.
	}
}

function pageHeaderDataUpdate(centerLabelStr,bDisplayChecked)
{
	if (!bDisplayChecked)bDisplayChecked = false
	{
		
	}
	//pageHeaderDataUpdate(recordsFound,labelFoundStr,centerLabelStr)
	if (parent.document.getElementById('pageTitleRight')&&bDisplayChecked)
	{
	parent.document.getElementById('pageTitleRight').innerHTML = '<TABLE id="Results" cellspacing="0" cellpadding="0" align="right">'
		+'<TR>'
			+'<TD align="right">'
				+'<B><SPAN id="counter1"></SPAN></B>&nbsp;checked'
			+'</TD>'
		+'</TR>'
	+'</TABLE>'
	}
	if (parent.document.getElementById('pageTitleRight')&&bDisplayChecked)
	{
	parent.document.getElementById('pageTitleRight').innerHTML = '<TABLE id="Results" cellspacing="0" cellpadding="0" align="right">'
		+'<TR>'
			+'<TD align="right">'
				+'<B><SPAN id="counter1"></SPAN></B>&nbsp;checked'
			+'</TD>'
		+'</TR>'
	+'</TABLE>'
	}

/*	parent.document.getElementById('pageTitleRight').innerHTML = '<TABLE id="Results" cellspacing="0" cellpadding="0" align="right">'
		+'<TR>'
			+'<TD align="right">'
				+'<B><SPAN id="counter1"></SPAN></B>&nbsp;checked of '
				+'<SPAN id="listingsfound"><B>'+recordsFound+'</B>&nbsp;'+labelFoundStr+'</SPAN>'

			+'</TD>'
		+'</TR>'
	+'</TABLE>'*/

	if (parent.document.getElementById('pageTitleCenter'))
	{
	parent.document.getElementById('pageTitleCenter').innerHTML = centerLabelStr
	//'<TABLE id="Results" cellspacing="0" cellpadding="0" align="center">'
	//	+'<TR>'
	//		+'<TD align="center">'
	//			+centerLabelStr
	//		+'</TD>'
	//	+'</TR>'
	//+'</TABLE>'
	}
					//+'<B><SPAN id="checked" style="display:none><SPAN id="counter1"></SPAN></B>&nbsp;checked of </SPAN>'
}

//show OR hide funtion depends on if Module is shown or hidden
function showHideModule(id) { 
	
	if (document.getElementById) { // DOM3 = IE5, NS6
		if (document.getElementById(id).style.display == "none"){
			document.getElementById(id).style.display = 'block';
			filter(("img"+id),'imgin');
			strOpenClose = 'O';
		} else {
			filter(("img"+id),'imgout');
			document.getElementById(id).style.display = 'none';
			strOpenClose = 'C';
		}	
	} else { 
		if (document.layers) {
			if (document.id.display == "none"){
				document.id.display = 'block';
				filter(("img"+id),'imgin');
			} else {
				filter(("img"+id),'imgout');
				document.id.display = 'none';
			}
		} else {
			if (document.all.id.style.visibility == "none"){
				document.all.id.style.display = 'block';
			} else {
				filter(("img"+id),'imgout');
				document.all.id.style.display = 'none';
			}
		}
	}
	if (parent.hdnOptionsPane)
	{
		parent.hdnOptionsPane.value = strOpenClose;
	}
		
}
// ITG#408609 JTiu 09/11/2007. Added parameter "useTarget" to give an option to use new window or current window.
//	Opens a new .NET page with Navigation - without Menu & Status Bar
function openLookUpWinWHLT(url, width, height, left, top, useNavigation, isPublic, mls, useTarget) 
{
	var MagicPath = '/scripts/mgrqispi.dll?APPNAME=MLSDevelop04&PRGNAME=MLSLookupWindow';
	if (width == null) width = 0;
	if (height == null) heigth = 0;
	if (left == null) left = 0;
	if (top == null) top = 0;
	if (isPublic == null) isPublic = false;
	if (mls == null) mls = "";
	
	// ITG#408609 JTiu 09/11/2007. If useTarget is null then let's default it to 'Lookup' window name since this has been the default name before.
	if (useTarget == null) useTarget = 'Lookup';
	
	// sMLS usually gets its value from the PageHeader. When the a lookup is shown in a lookup no pageheader is available, so we have to send it in.
	if(mls != "") sMLS = mls;
	
	if(!isPublic)
	{
		window.open(SearchDomain + 'LookupWindow.aspx?hidMLS=' + sMLS + '&MLS='+sMLS+'&URL=' + URLEncode(MagicDomain + url) +'&showNavigation='+useNavigation ,useTarget,"status=yes,toolbar=no,location=no,menu=no,resizable=yes,height=" + height + ",width=" + width + ",left=" + left + ",top=" + top);
	}
	else
	{		
		window.open(MagicDomain + url ,useTarget,"status=yes,toolbar=no,location=no,menu=no,resizable=yes");
	}
}

// This function encodes the URL
function URLEncode(strURL) 
{
	return escape(strURL); 
}

function over()
{
	var hdnOptionsPane = parent.document.getElementById('hdnOptionsPane');
	
	if(hdnOptionsPane != null)
	{
		if(hdnOptionsPane.value == 1)
		{
			document.getElementById('optionsImage').src = sRapMLSImages + 'opopenedover.gif';
		}
		else
		{
			document.getElementById('optionsImage').src = sRapMLSImages + 'opclosedover.gif';
		}
	}//if(hdnOptionsPane != null)
}

function out()
{
	var hdnOptionsPane = parent.document.getElementById('hdnOptionsPane');
	
	if(hdnOptionsPane != null)
	{
		if(hdnOptionsPane.value == 1)
		{
			document.getElementById('optionsImage').src = sRapMLSImages + 'opopenedout.gif';
		}
		else
		{
			document.getElementById('optionsImage').src = sRapMLSImages + 'opclosedout.gif';
		}
	}//if(hdnOptionsPane != null)
}