// JavaScript Document #new.n

function PriceMinMaxGo_onclick()
{
    var elementMin = document.getElementById('MoreSearchCriteriaPrice_m_ddlListPriceMin');
    var elementMax = document.getElementById('MoreSearchCriteriaPrice_m_ddlListPriceMax');
    window.open('/PropertySearchResults.aspx?N=12+' + elementMin.value + '+' + elementMax.value, '_self');
}

function MM_findObj(n, d) { //v4.01
	var p,i,x;  

	if(!d) 
		d=document; 

	if((p=n.indexOf("?"))>0&&parent.frames.length) 
	{
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
	}

	if(!(x=d[n])&&d.all) 
		x=d.all[n]; 

	for (i=0;!x&&i<d.forms.length;i++) 
		x=d.forms[i][n];

	for(i=0;!x&&d.layers&&i<d.layers.length;i++) 
		x=MM_findObj(n,d.layers[i].document);

	if(!x && d.getElementById) 
		x=d.getElementById(n); 

	return x;
}

function MM_showHideLayers() 
{ //v6.0
	var i,p,v,obj,args=MM_showHideLayers.arguments;
	for (i=0; i<(args.length-2); i+=3) 
		if ((obj=MM_findObj(args[i]))!=null) 
		{	
			v=args[i+2];

			/*Code to eliminate flicker on images on firefox (Firefox bug)*/
			var objmore = window.document.getElementById('scroll' + obj.id);

			if (obj.style) 
			{ 
				obj=obj.style; 
				v=(v=='show')?'visible':(v=='hide')?'hidden':v; 
			}
			obj.visibility=v; 

			/*Code to eliminate flicker on images on firefox (Firefox bug)*/
			if (objmore != null)
			{
				if (v=='visible')
				{
					objmore.style.overflow = 'auto';
				}
				else
				{
					objmore.style.overflow = '';
				}
			}

		}
}

var globalHide = false;
var objPostCard;
var cursorPos = {x:0, y:0};
var iclientCursorPostCardY;

function delayhide(obj, idelaytime) 
{
	cursorposition();

	if (window.document.getElementById(obj))
	{
		if (objPostCard && objPostCard != obj)
		{
			MM_showHideLayers('iframe' + objPostCard,'','hide');
			MM_showHideLayers(objPostCard,'','hide');
		}
		objPostCard = obj;
		globalHide = true;
		iclientCursorPostCardY = cursorPos.y;

		setTimeout("show_stuff()", idelaytime);
	}
}

function show_stuff(obj) 
{
	if (globalHide == true) 
	{
		MM_showHideLayers(objPostCard,'','show');
		MM_showHideLayers('iframe' + objPostCard,'','show');
	}

		var objauxPostCard = window.document.getElementById(objPostCard);
		var objauxIframe = window.document.getElementById('iframe' + objPostCard);
	
		/*Positioning the box into the screen*/
		var iobjtop = -188;
		var iobjheight = 276;
		var iavailheight = 0;

		if (document.body.clientHeight > document.documentElement.clientHeight)
		{
			iavailheight = document.documentElement.clientHeight;	//IE and FF
		}
		else
		{
			iavailheight = document.body.clientHeight;				//Opera
		}
		
		if (iclientCursorPostCardY == 0)
		{
			iclientCursorPostCardY = cursorPos.y;
		}

		var iclientY = iclientCursorPostCardY;

		var ipartobjdown = iobjheight + iobjtop;
		var ipartobjup = iobjtop * -1;
		var ipartavaildown = iavailheight - iclientY;
		var ipartavailup = iclientY;

		if ((ipartobjdown + 100) > ipartavaildown)
		{
			var inewtop = iobjtop - ipartobjdown + ipartavaildown - 100;
		
			objauxPostCard.style.top = inewtop.toString() + 'px';
			objauxIframe.style.top = inewtop.toString() + 'px';
		}
		else
		{
			objauxPostCard.style.top = iobjtop.toString() + 'px';
			objauxIframe.style.top = iobjtop.toString() + 'px';
		}

		if (ipartobjup > ipartavailup)
		{
			var inewtop = iobjtop + ipartobjup - ipartavailup;
			objauxPostCard.style.top = inewtop.toString() + 'px';
			objauxIframe.style.top = inewtop.toString() + 'px';
		}
}

function MM_showHideLayersIframe(obj) 
{
	globalHide = false;
	MM_showHideLayers(objPostCard,'','hide');
	MM_showHideLayers('iframe' + objPostCard,'','hide');
}

function MM_showHideLayersTwistyMore(obj, objthis) 
{
	var objaux = window.document.getElementById(obj);
	var objthisaux = window.document.getElementById(objthis);

  	// Hide all layers first.
	var divs = document.getElementsByTagName("div");

	for (var i = 0; i < divs.length; i++)
	{
		if (divs[i].id != objaux.id)
		{
			if (divs[i].id.indexOf("moreframe") >= 0)
			{
				if (divs[i].style.visibility == 'visible')
				{
					MM_showHideLayers(divs[i].id,'','hide');
				}
			}
		}
	}

	if (objaux.style.visibility=='visible')
	{
		MM_showHideLayers(objaux.id,'','hide');
		//objthisaux.style.textDecoration="inherit";
	}
	else
	{
		MM_showHideLayers(objaux.id,'','show');
		//objthisaux.style.textDecoration="none";

		/*Positioning the box into the screen*/
		/*
		var iobjtop = -40;
		var iobjheight = 190;

		var iavailheight = 0;

		if (document.body.clientHeight > document.documentElement.clientHeight)
		{
			iavailheight = document.documentElement.clientHeight;	//IE and FF
		}
		else
		{
			iavailheight = document.body.clientHeight;				//Opera
		}

		var iclientY = cursorPos.y;

		var ipartobjdown = iobjheight + iobjtop;
		var ipartobjup = iobjtop * -1;
		var ipartavaildown = iavailheight - iclientY;
		var ipartavailup = iclientY;

		if ((ipartobjdown) > ipartavaildown)
		{
			var inewtop = iobjtop - ipartobjdown + ipartavaildown;
			objaux.style.top = inewtop.toString() + 'px';
		}
		else
		{
			objaux.style.top = iobjtop.toString() + 'px';
		}

		if ((ipartobjup) > ipartavailup)
		{
			var inewtop = iobjtop + ipartobjup - ipartavailup + 20;
			objaux.style.top = inewtop.toString() + 'px';
		}
		*/
	}
}

function setvariable() 
{
	globalHide = false;
} 

function eventHandler(e)
{
	e = e || window.event;
	if (e.pageX || e.pageY) 
	{		
		cursorPos.x = e.pageX - document.documentElement.scrollLeft;
		cursorPos.y = e.pageY - document.documentElement.scrollTop;
	}
	else 
	{
		cursorPos.x = e.clientX;
		cursorPos.y = e.clientY;
	}
}

function cursorposition()
{
	//if (window.Event) 
	//{
	//	document.captureEvents(window.Event.MOUSEMOVE);
	//}
	document.onmousemove = eventHandler;
}


function showmoresearchcriteriaframe()
{
	objmoresearchcriteriaframe = window.document.getElementById('moresearchcriteriaframe');
	
	if (objmoresearchcriteriaframe.style.display == 'block')
	{
		objmoresearchcriteriaframe.style.display = 'none';
	}
	else
	{
		objmoresearchcriteriaframe.style.display = 'block';
	}
}
