<!--
A="block";B="none";C="hide";D="show";E="Expand";F="Collapse";
var co=new Image();co.src="images/home_plus.gif";
var ex=new Image();ex.src="images/home_expanded.gif";
if(document.styleSheets){
	if(document.styleSheets[0].rules){
		document.styleSheets[0].rules[1].style.display="none";
		document.styleSheets[0].rules[2].style.display="none";
		document.styleSheets[0].rules[3].style.display="none";
	}else if(document.styleSheets[0].cssRules){
		document.styleSheets[0].cssRules[1].style.display="none";
		document.styleSheets[0].cssRules[2].style.display="none";
		document.styleSheets[0].cssRules[3].style.display="none";
	}
}
function init(){
	if(document.layers)return;
	var l=getLayer('1');
	l.className='first';
}


function OpenURL(l){
	alert(l);
}


//Added by Stephen
function MenuHistory(){
        var curLoc=location.href;
        switch (curLoc) {
                case location.protocol + "//" + location.host + "/" :
                case location.protocol + "//" + location.host + "/cards/" :
                        testopenLayer(0);
                        break;
                case "http://www.icsinsurance.com.sg/" :
                        testopenLayer(0);
                        break;
                case "http://www.dbsam.com.sg/" :
                        testopenLayer(0);
                        break;
                case "http://www.dbssecurities.com/" :
                        testopenLayer(0);
                        break;
                case location.protocol + "//" + location.host + "/ratesonline/shut.html" :
                        testopenLayer(2);
                        testopenLayer(3);
                        break;
                case location.protocol + "//" + location.host + "/ratesonline/dddd.html" :
                case location.protocol + "//" + location.host + "/ratesonline/fdsgd.html" :
                case location.protocol + "//" + location.host + "/ratesonline/fdfdc.html" :
                        testopenLayer(2);
                        testopenLayer(5);
                        break;
                case location.protocol + "//" + location.host + "/ratesonline/fxbra.html" :
                case location.protocol + "//" + location.host + "/ratesonline/fdacu.html" :
                case location.protocol + "//" + location.host + "/ratesonline/euroconv.html" :
                        testopenLayer(2);
                        testopenLayer(7);
                        break;
                case location.protocol + "//" + location.host + "/ratesonline/lnplc.html" :
                case location.protocol + "//" + location.host + "/ratesonline/lnpld.html" :
                case location.protocol + "//" + location.host + "/ratesonline/lnplr.html" :
                case location.protocol + "//" + location.host + "/ratesonline/lnhla.html" :
                case location.protocol + "//" + location.host + "/ratesonline/lnclp.html" :
                case location.protocol + "//" + location.host + "/ratesonline/lnclf.html" :
                case location.protocol + "//" + location.host + "/ratesonline/lnclm.html" :
                        testopenLayer(2);
                        testopenLayer(9);
                        break;
                case location.protocol + "//" + location.host + "/ratesonline/" :
                        testopenLayer(2);
                        break;
                case location.protocol + "//" + location.host + "/webapp/calculator?type=homeassist" :
                case location.protocol + "//" + location.host + "/webapp/calculator?type=carassist" :
                case location.protocol + "//" + location.host + "/webapp/calculator?type=renoassist" :
                case location.protocol + "//" + location.host + "/webapp/calculator?type=facassist" :
                case location.protocol + "//" + location.host + "/webapp/calculator?type=macassist" :
                case location.protocol + "//" + location.host + "/webapp/calculator?type=faclefsassist" :
                case location.protocol + "//" + location.host + "/webapp/calculator?&type=maclefsassist" :
                case location.protocol + "//" + location.host + "/tools/calculators/saye.html" :
                case location.protocol + "//" + location.host + "/webapp/calculator?type=fcfd" :
                case location.protocol + "//" + location.host + "/webapp/calculator?type=mywaycalc" :
                        testopenLayer(14);
                        testopenLayer(15);
                        break;
                case location.protocol + "//" + location.host + "/tools/planner/interactive.html" :
                        testopenLayer(14);
                        break;
                default :
                        break;
        }
}

//Added by Stephen
function testopenLayer(n){
        if(document.layers)return;
        var cl,cc=null;
        var l=getLayer(parseInt(n));
        showImage(l);
        var c=classToCode(l.className);
        if(c==0)for(var i=0;i<getLayersCount();i++){
                var cl=getLayer(i);
                var cc=classToCode(cl.className);
                if(cc==0&&cl.id!=l.id){
                        swapToOpenLayer(i);
                        closeAllChildren(i);
                        hideImage(cl);
                }
        }
        openChild(n);
        return false;
}
function openLayer(t){
	if(document.layers)return;
	var n=t.name.slice(2,t.name.lastIndexOf("Anchor"));
	var cl,cc=null;
	var l=getLayer(parseInt(n));
	
	
			showImage(l);
		
	
	var c=classToCode(l.className);
	if(c==0)for(var i=0;i<getLayersCount();i++){
		var cl=getLayer(i);
		var cc=classToCode(cl.className);
		if(cc==0&&cl.id!=l.id){
			swapToOpenLayer(i);
			closeAllChildren(i);
			
			
				hideImage(cl);
			
			
			
		}
	}
	openChild(n);
	t.onclick=new Function("closeLayers(this);");
	return false;
}
function closeLayers(t){
	if(document.layers)return;
	var n=t.name.slice(2,t.name.lastIndexOf("Anchor"));
	closeAllChildren(n);
	hideImage(getLayer(parseInt(n)));
	//t.onclick=new Function("openLayer(this);return false;");
	t.onclick=new Function("openLayer(this);");
	return false;
}
function closeAllChildren(n){
	var cl,cc=null;
	var l=getLayer(parseInt(n));
	var c=classToCode(l.className);
	for(var i=parseInt(n)+1;i<getLayersCount();i++){
		cl=getLayer(i);
		cc=classToCode(cl.className);
		if(parseInt(c)==cc)break;
		hideNode(cl);
		swapToOpenLayer(i);
	}
}
function openChild(n){
	var cl,cc=null;
	var l=getLayer(parseInt(n));
	var c=classToCode(l.className);
	for(var i=parseInt(n)+1;i<getLayersCount();i++){
		cl=getLayer(i);
		cc=classToCode(cl.className);
		if(parseInt(c)==cc)break;
		if(parseInt(c)+1==cc)showNode(cl);
	}
}
function hideImage(l){
	var i=getImage(l.id);
	
	//alert(l.id);
	
	if ( l.id == 'el4' ||  l.id == 'el8' || l.id == 'el10') {
	
		
	}	
	else {
		if(typeof i=="object"&&i.src){
					i.src=co.src;
					i.alt=co.alt;
		}
	
	}
}
function showImage(l){
	
	
	var i=getImage(l.id);
	if ( l.id == 'el4' ||  l.id == 'el8' || l.id == 'el10') {
		
			
		}	
	else {
	if(typeof i!="undefined"&&i.src){
		i.src=ex.src;
		i.alt=ex.alt;
	}
	}
}
function hideNode(l){
	hideImage(l);
	l=(l.style)?l.style:l;
	if(document.layers)l.visibility=C;
	else l.display=B;
}
function showNode(l){
	l=(l.style)?l.style:l;
	if(document.layers)l.visibility=D;
	else l.display=A;
}
function swapToOpenLayer(n){
	a=getAnchor(n);
	if(a!=false&&typeof a!="undefined")a.onclick=new Function("openLayer(this);");
}
function getLayersCount(){
	if(document.getElementsByTagName)return document.getElementsByTagName("DIV").length
	if(document.all){
		var n=0;
		while(eval("document.all.el"+n))n+=1;
		return n;
	}
}
function getLayer(i){
	if(document.getElementById)if(document.getElementById("el"+i))return document.getElementById("el"+i);
	if(document.all)if(document.all["el"+i])return document.all["el"+i];
	return new Object();
}
function getAnchor(n){
	if(document.getElementById)if(document.getElementById("el"+n+"Anchor"))return document.getElementById("el"+n+"Anchor");
	else if(document.all)if(document.all["el"+n+"Anchor"])return document.all["el"+n+"Anchor"];
	else return false;
}
function getImage(n){
	n=n.slice(2);
	if(document.getElementById)if(document.getElementById("el"+n+"img"))return document.getElementById("el"+n+"img");
	if(document.getElementByName)if(document.getElementByName("el"+n+"img"))return document.getElementByName("el"+n+"img");
	if(document.getElementsByTagName){
		im=document.getElementsByTagName("IMG");
		for(var i=0;i<im.length;i++){
			if(im[i].name=="el"+n+"img")return im[i];
		}
	}
	if(document.all)return document.all["el"+n+"img"];
	return new Object();
}
function classToCode(id){
	switch(id){
		case "root":return 0;
		case "first":return 1;
		case "second":return 2;
		case "third":return 3;
		default:return null;
	}
}
function openCurrent(){
	var h=window.location.search;
	if(h.length>1){
		h=h.slice(1);
		var a=h.split("&");
		for(var i=0;i<a.length;i++){
			if(a[i].indexOf("el")==0){
				a[i]=a[i].slice(5);
				openChild(a[i]);
				
				showImage(getLayer(a[i]).id)
			}
		}
	}
}
//-->

