// JavaScript Document
var submenuCount=4;
var SiteRoot="/";
var TimeoutHandle=null;
var ActiveMenu=null;
function OnResize()
{
	var contentTable;
	var leftcoumnHeight;
	var leftcoumn;
	contentTable=GetTargetFromID('contentTable');
	if (contentTable!=null)
	{
		leftcoumnHeight=contentTable.clientHeight;
		leftcoumnHeight=parseInt(leftcoumnHeight);
	}
	leftcoumn=GetTargetFromID('leftcolumn');
	if (leftcoumn!=null)
	{
		leftcoumn.style.height=leftcoumnHeight+'px';
	}


}
function OnLoad()
{
	var menuID;
	var smenu;
	
	for (menuID=1;menuID<=submenuCount;menuID++)
	{
		smenu=document.getElementById("submenu"+menuID+"Title");
		if (smenu!=null)
		{
			smenu.onmouseover=OpenSubmenu;
		}
	}
	OnResize();
}
function HideActiveMenu()
{
	if (ActiveMenu!=null)
	{
		ActiveMenu.style.display="none";	
		ActiveMenu=null;
		TimeoutHandle=null;
	}
}
function HideSubMenu(e)
{
	var tname="DIV";
	if(!e)
	{
		e=window.event;
	}
	if (e)
	{
		if (e.toElement)
		{
			tname=e.toElement.tagName;
		}
		else
		{
			if (e.relatedTarget)
			{
			tname=e.relatedTarget.tagName;
			}
		}
	}
	if (tname=="UL" || tname=="A" || tname=="LI" || tname=="DIV")
	{
		return false;
	}
	ActiveMenu=this;
	TimeoutHandle=setTimeout('HideActiveMenu()',1000);
}
function OpenFlashSubMenu(menuID,Px,Py)
{
	var obj;
	var n;
	var point;
	if (ActiveMenu!=null && TimeoutHandle!=null)
	{
		clearTimeout(TimeoutHandle);
		ActiveMenu=null;
		TimeoutHandle=null;
	}
	for (n=1;n<submenuCount;n++)
	{
		if (n!=Number(menuID))
		{
			obj=document.getElementById("submenu"+n);
			if (obj!=null)
			{
				obj.style.display="none";
			}
		}
	}
	obj=document.getElementById("submenu"+menuID);
	obj.style.display="block";
	Py-=28;
	Px-=10;
	point=new TPoint(Px,Py);
	/*
	obj.style.left=Px+"px";
	obj.style.top=Py+"px";
	*/
	MoveElementTo(obj,point);
	obj.onmouseout=HideSubMenu;
}
function OpenSubmenu()
{
		var MenuPos=new TPoint();
		var Offset=0;
		var page;
		page=document.getElementById("page");
		MenuPos=findXYPos(page);
		Offset=MenuPos.x;
		MenuPos=findXYPos(this);
		MenuPos.x=MenuPos.x-Offset;
		MenuPos.y=MenuPos.y+44;
		if (this.menuid==null)
		{
			this.menuid=String(this.id);
			if (this.menuid==null)
			{
				return;
			}
			this.menuid=this.menuid.replace("submenu","");
			this.menuid=this.menuid.replace("Title","");
			this.menuid=Number(this.menuid);
		}
		OpenFlashSubMenu(this.menuid,MenuPos.x,MenuPos.y)
}

function searcnTBOXKeyPress(e)
{
	if(!e)
	{
		e=window.event;
	}
	if(window.event) // IE
	  {
		if (e.keyCode==13) 	
		{
			SearchClick();
			return false;
		}
	  }
	else if(e.which) // Netscape/Firefox/Opera
	  {
		if (e.which==13)
		{
			SearchClick();
			return false;
		}
	  }
}
function SearchClick(e)
{
	var qstr;
	if (searchTBOX )
	{
		if (searchTBOX.value!="")
		{
			qstr = "cx=015262809807746233484:ivaiyjeuxfy&cof=FORID:9&q=" +encodeURIComponent(searchTBOX.value);
			//qstr=Server.UrlEncode(qstr);
			window.location="results.htm?"+qstr;
		}
	}
}
function Enlarge(source,title)
{
	var src;
	if (title==undefined || title==null)
	{
		title="";
	}
	src=source.src;
	src=src.substring(src.indexOf("img="));
	src=src.substring(0,src.indexOf('&'));
	src=src.replace("img=","img="+SiteRoot);
	src=src.replace('=','~');
	src="/Thumbswebhandler.ashx!"+src+"$w~800$h~600$p~1$c~1";
	src=SiteRoot+"enlarge.htm?src="+src+"&title="+title;
	window.location=src;
}
function pausecomp(mills) 
{
var date = new Date();
var curDate = null;

do { curDate = new Date(); } 
while(curDate-date < mills);
} 
	if (window)
	{
		window.onresize=OnResize;
		window.onload=OnLoad;
	}
	else
	{
		document.onresize=OnResize;
		document.onload=OnLoad;
	}

	var searchTBOX, homesearchTBOX,searchBTN; 
	searchTBOX=document.getElementById("searchTBOX");
	if (searchTBOX)
	{
		searchTBOX.onkeypress=searcnTBOXKeyPress;
	}
	homesearchTBOX=document.getElementById("homesearchTBOX");
	if (homesearchTBOX)
	{
		searchTBOX=homesearchTBOX;
		searchTBOX.onkeypress=searcnTBOXKeyPress;
	}
	
	searchBTN=document.getElementById("searchBTN");
	if (searchBTN)
	{
		searchBTN.onclick=SearchClick;
	}
