function initDropdowns() {
	if (document.all && document.getElementById) {
		navRoot = document.getElementById("MainNav");
		if(navRoot!=null){
	
			for (i = 0; i < navRoot.childNodes.length; i++) {
				node = navRoot.childNodes[i];
				if (node.nodeName=="LI") {
					node.onmouseover=function() {
						this.className+=" over";
					}
					node.onmouseout=function() {
						this.className=this.className.replace(" over", "");
					}
				}
			}
		}


	}
}

window.onload = initDropdowns;

function doPopup(context, url, wnd)
{
  if (url.length > 0)
  {
    window.open(context + url, wnd,"width=600,height=400,scrollbars=1,resizable=1,toolbar=0,location=0,menubar=0,status=0,directories=0")
    return;
  } 
}

function doPrint()
{
  window.print();
}

function doEmail(context, handle, wnd)
{
  //var url = "/teamsingapore/en/tools/email.html?url=" + handle;
    var url = "/Corporate/en/tools/email.html?url=" + handle;

  doPopup(context, url, wnd);
}

function doGotoURL(context, url)
{
  if (url.length > 0)
  {
    document.location= context + url;
    return;
  } 
}


function doIFrameResize(id)
{
  var a = navigator.userAgent;
  var isSF = (a.indexOf("Safari") > 0) ? true : false;
  var isIE = (a.indexOf("MSIE") > 0) ? true : false;
  
  var time;
  var delay = 200;

  var docHeight = (isIE) ? document.body.scrollHeight +4 : document.body.offsetHeight;
   var docWidth = (isIE) ? document.body.scrollWidth +2 : document.body.offsetWidth;
  var docHeight = (isSF) ? docHeight + 20 : docHeight;

  //alert("docHeight:" + docHeight);

  if (docHeight == null || docHeight <= 10)
  {
    var func = "doIFrameResize('"+ id +"')";
    time = setTimeout(func, delay);    
  } 
  else 
  {  
    if (time)
      clearTimeout(time);
    
    try
    {
      if (isIE) {
        window.parent.document.getElementById(id).style.height = docHeight;
		window.parent.document.getElementById(id).style.width = docWidth;
      }
      else 
        window.parent.document.getElementById(id).height = docHeight;
    } catch(e)
    {
     //alert(e);  
    }
  }
}

function loadDoc(url, id)
{
	document.getElementById(id).innerHTML = "Please wait...";

	var requester;

	try
	{
		requester = new XMLHttpRequest();
	}
	catch (error)
	{
		try
		{
			requester = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch (error)
		{
			return false;
		}
	}

	requester.onreadystatechange = function()
	{
		if (requester.readyState == 4) // state = completed
		{
			if (requester.status && requester.status == 200) // status = success
			{
				document.getElementById(id).innerHTML = requester.responseText;
				return true;
			}
			else
			{
				document.getElementById(id).innerHTML = "Error!";
				return false;
			}
		}
	}

	requester.open("GET", url, true);
	requester.send(null);
}


function go()
{
   box = document.getElementById("qlink").quicklink;
   destination = box.options[box.selectedIndex].value;
   if (destination) 
     location.href = destination;
}

