//******************************************************************************************//
// 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("menu")) {
        var hdnOptionsPane = parent.document.getElementById('hdnOptionsPane');

        if (document.getElementById && document.createTextNode) {
            m = document.getElementById("menu");
            if (hdnOptionsPane) {

                if (typeof (action) != "undefined") {
                    if (action == 1) {
                        if (hdnOptionsPane.value == '1') {
                            trig = "block";
                            document.getElementById('optionsImage').src = sRapMLSImages + 'opopenedout.gif';
                            document.getElementById('optionsImage').title = "Click to Collapse Options Pane";
                        }
                        else {
                            trig = "none";
                            document.getElementById('optionsImage').src = sRapMLSImages + 'opclosedout.gif';
                            document.getElementById('optionsImage').title = "Click to Expand Options Pane";
                        }
                    }
                } //if (typeof (action) != "undefined")
                else {
                    trig = m.style.display;

                    if (trig == "" && hdnOptionsPane.value == '1') {
                        trig = "block"
                    }
                    if (trig == "block") {
                        trig = "none";
                        document.getElementById('optionsImage').src = sRapMLSImages + 'opclosedout.gif';
                        document.getElementById('optionsImage').title = "Click to Expand Options Pane";
                        document.getElementById('optionsImage').style.paddingRight = "0px";
                        parent.document.forms["Form1"].hdnOptionsPane.value = '0'
                    }
                    else {
                        trig = "block";
                        document.getElementById('optionsImage').src = sRapMLSImages + 'opopenedout.gif';
                        document.getElementById('optionsImage').title = "Click to Collapse Options Pane";
                        parent.document.forms["Form1"].hdnOptionsPane.value = '1'
                    }
                } //else
            } //if (hdnOptionsPane)

            m.style.display = trig;

            hdnOptionsPane.value = ((trig == "block") ? '1' : '0');
        } //if (document.getElementById && document.createTextNode)
    } //if(document.getElementById("menu"))
	try{ResizeTabs();}catch(e){}
}

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" style="padding-right: 10px">'
				+'<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" style="padding-right: 10px">'
				+'<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() {
    if (parent.document.getElementById('hdnOptionsPane')) {
        var hdnOptionsPane = parent.document.getElementById('hdnOptionsPane');
    }
    else {
        var hdnOptionsPane = 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 (getIsWK()) {
        $(".MenuDivMagic").addClass("MenuDivSafari");
        $(".MenuDivSafari").removeClass("MenuDivMagic");
        $(".MenuDivSafari").css("height", "100%");
    }
}

function out() {
    if (parent.document.getElementById('hdnOptionsPane')) {
        var hdnOptionsPane = parent.document.getElementById('hdnOptionsPane');
    }
    else {
        var hdnOptionsPane = 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 (getIsWK()) {
        $(".MenuDivMagic").addClass("MenuDivSafari");
        $(".MenuDivSafari").removeClass("MenuDivMagic");
        $(".MenuDivSafari").css("height", "100%");
        $(".ScreenOnly").css("overflow", "hidden");
    }
}



