
/***********************************************
* Drop Down/ Overlapping Content- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var ie4=document.all;
var ns6=document.getElementById&&!document.all;
var subobj;
var delayhide;
var currentCountryId = 0;

function getposOffset(overlay, offsettype){
	var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
	var parentEl=overlay.offsetParent;
	while (parentEl!=null){
		totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
		parentEl=parentEl.offsetParent;
	}
	return totaloffset;
}

function overlay(curobj, subobjstr, iso, cid, country)
{
	if (typeof subobj!="undefined")
	{
		if (subobj.style.visibility != "hidden")
		{
			hidemenu(false);
		}
	}

	replaceLinks(cid);
	replaceCountry(iso, country);
	currentCountryId = cid;
	if (document.getElementById){
		subobj=document.getElementById(subobjstr);

		var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0) ;
		var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0);

		subobj.style.left=xpos+"px";
		subobj.style.top=ypos+"px";
		subobj.style.display = "block";
		return false;
	}
	else
	{
		return true;
	}
}

function overlayclose(subobj)
{
	document.getElementById(subobj).style.display="none"
}

function hidemenu(e)
{
	if (typeof subobj!="undefined")
	{
		if (ie4||ns6)
			subobj.style.display="none"
	}
}

function contains_ns6(a, b) 
{
	while (b.parentNode)
		if ((b = b.parentNode) == a)
			return true;
	return false;
}

function dynamichide(e)
{
	if (ie4&&!subobj.contains(e.toElement))
		delayhidemenu()
	else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
		delayhidemenu()
}

function delayhidemenu(){
	if (ie4||ns6)
		delayhide=setTimeout("hidemenu()",500)
}

function clearhidemenu(){
	if (typeof delayhide!="undefined")
		clearTimeout(delayhide);
}

function replaceLinks(id)
{ 
	for (i in links)
	{
		if (typeof links[i] == "string")
		{
			document.getElementById(i).href = links[i].replace(/424242/, id);
		}
	}
}

function replaceCountry(iso, name)
{ 
	document.getElementById('subcontentLand').innerHTML = name;
	document.getElementById('subcontentLand').style.backgroundImage =  "url(" + HTML_ROOT + "pix/flags/" + iso + ".gif)";
}