
//<!--
	/**********************************************************
	 *	DDi Solutions Common Methods.
	 *********************************************************/
	var scroll_height=2048;
	function getMeasurements(){scroll_height=(document.body.scrollHeight > document.body.offsetHeight)? document.body.scrollHeight : document.body.offsetHeight; var o = $("divResults");}
	function foldElement(objId, height)
	{
		o = $(objId);
		if (o){
			if ( o.className == 'FoldDownPanel' )//(parseInt(o.style.height) > 0)
			{
				collapseElement(objId);
				o.className = 'FoldUpPanel';
			}
			else
			{
				o.className = 'FoldDownPanel';
				displayElement(objId, height);
			}
		}
	}			
	function displayElement (obj, height){
		var o = $(obj);
		if ( o==null) {alert("The object " + objId + " could not be located and displayed."); return;}
		var speed = (o.id=='divResults')? 300 : 50;
		var t = parseInt(o.style.top);
		var h = parseInt(o.style.height);
		
		if ( o.id=='ControlPanel' && h < parseInt(height) )
		{
			h+=speed;
			if (h > parseInt(height)) h=height;
			o.style.height = h + "px";
			window.setTimeout("displayElement('" + obj + "', " + height + ")", 5);
		}
		else if ( o.id=='divResults' && t < 213 )
		{
			o.style.display = 'block';
			t+=speed;
			if ( t > 213 ) t=213;
			o.style.top = t+"px";
			window.setTimeout("displayElement('" + obj + "', " + height + ")", 5);
		}
		else if ( h < parseInt(height) )
		{
			h+=8;
			if (h > parseInt(height)) h=height;
			o.style.height = h + "px";
			window.setTimeout("displayElement('" + obj + "', " + height + ")", 5);
		}
		$('ScrollTop').value = '0';		
	}
	function collapseElement (objId){
		var o = $(objId);
		if ( o==null ) {alert("The object " + objId + " could not be located and collapsed."); return;}
		var speed = (o.id=='divResults')? 300 : 50;
		var t = parseInt(o.style.top);
		var h = parseInt(o.style.height);
		h = (o.id=='divResults' && isNaN(h))? scroll_height : h;

		if ( o.id=='ControlPanel' && h > 1 )//6)
		{
			h-=speed;
			if ( h < 1 ) h=1;
			o.style.height= h + "px";
			window.setTimeout("collapseElement('" + objId + "')", 5);
		}
		else if ( o.id=='divResults' && t > -(scroll_height-213) )
		{
			o.style.display = 'none';
			t-=speed;
			o.style.top = t + "px";
			window.setTimeout("collapseElement('" + objId + "')", 5);
		}
	}
	function closeMe(){
			try{ $('details').style.visibility = 'hidden'; }catch(e){}
			try{ $('pnlContact').style.visibility = 'hidden'; }catch(e){}			  	
		getMeasurements();
			collapseElement('ControlPanel');
			displayElement('divResults', parseInt(scroll_height)-200);			
	}
	function showPanel(id){
		var pnl = $(id);
		var arrayXY = getSize();
		var w = !isNaN(pnl.style.width) ? parseInt(pnl.style.width) : (id=='pnlContact' ? 400 : 320 );
		var h = !isNaN(pnl.style.height) ? parseInt(pnl.style.height) : (id=='pnlContact' ? 390 : 190 );
		//alert(arrayXY[0,1])
		pnl.style.left = ((arrayXY[0,0]-w)/2)+'px';
		pnl.style.top = ((arrayXY[0,1]-h)/2)+'px';
		pnl.style.visibility = 'visible';
	}
	function findPos(obj) {
		var curleft = curtop = 0;
		if (obj.offsetParent) {
			do {
				curleft += obj.offsetLeft;
				curtop += obj.offsetTop;
			} while (obj = obj.offsetParent);
		}
		return [curleft,curtop];
	}
//-->
