<!--
//document.onload = rnRotAndDroplist(); //with () parantheses for ie/mozilla
document.onmousedown = toggleDroplist; //without () parantheses for ie (will not work with parantheses)

function rnRotAndDroplist() {
	swapDroplist();
	bnrCycle();
}

function detectBrowser() {
	if (document.childNodes && !document.all && !navigator.taintEnabled && !accentColorName) browser='saf';
	else if (navigator.product=='Gecko') browser='nn'; //nn6+, mozilla and other gecko
	else if (document.all) browser='ie';
	//browser='saf';
	return browser;
}
function swapDroplist() {

	if (detectBrowser()!='ie') return;
		
	if (document.getElementById('formsDroplistHolder')) document.getElementById('formsDroplistHolder').innerHTML = '<img src="/img/sg/common/dropdown/dropdowndefault.gif" alt="" width="110" height="17" border="0" id="dbs_formsdropdown" />';
	if (document.getElementById('ratesDroplistHolder')) document.getElementById('ratesDroplistHolder').innerHTML = '<img src="/img/sg/common/dropdown/dropdowndefault.gif" alt="" width="110" height="17" border="0" id="dbs_ratesdropdown" />';
	if (document.getElementById('toolsDroplistHolder')) document.getElementById('toolsDroplistHolder').innerHTML = '<img src="/img/sg/common/dropdown/dropdowndefault.gif" alt="" width="110" height="17" border="0" id="dbs_toolsdropdown" />';
	if (document.getElementById('lifestyleDroplistHolder')) document.getElementById('lifestyleDroplistHolder').innerHTML = '<img src="/img/sg/common/dropdown/dropdowndefault.gif" alt="" width="110" height="17" border="0" id="dbs_lifestyledropdown" />';
	if (document.getElementById('idealFormsDroplistHolder')) document.getElementById('idealFormsDroplistHolder').innerHTML = '<img src="/img/sg/common/dropdown/dropdownidealforms.gif" alt="" width="110" height="17" border="0" id="dbs_idealformsdropdown" />';
}
function toggleDroplist(e) {
	if (detectBrowser()!='ie') return;
	/*alert(e.target.id);
	var trg;
	//var e = window.event;
	if (e.target) trg = e.target;
	else if (e.srcElement) trg = e.srcElement;
	if (trg.nodeType == 3) // defeat Safari bug
		trg = trg.parentNode;
	var imgId = trg.id;
	*/
		
		
	var imgId = window.event.srcElement.id; //find the id of the item the user clicked on
	//alert(imgId);
	if (!getImgIdMatch(imgId)) { //if the item clicked on is not a drop list img
		hideAllDroplist();		
		return;
	}
	else {
		var dropListId = imgId+'lyr';
		hideAllDroplist(dropListId); //hide all drop lists except the one clicked on
		
		//get absolute position of dropdownlist image
		var selectedPosX = 0, selectedPosY = 0;
		var el = document.getElementById(imgId);
		while(el != null){
			selectedPosX += el.offsetLeft;
			selectedPosY += el.offsetTop;
			el = el.offsetParent;
		}
		//set position and visibility of iframe
		var lyr = document.getElementById(dropListId);
		lyr.style.left=selectedPosX;
		lyr.style.top=selectedPosY+17;
		lyr.style.visibility = (lyr.style.visibility=='hidden') ? 'visible':'hidden'; //toggle layer visibility
	}
}
//checks for a match on drop list img id, returns false if not found
function getImgIdMatch(imgId) {
	var aryImg = new Array('dbs_formsdropdown', 'dbs_ratesdropdown', 'dbs_toolsdropdown' ,'dbs_lifestyledropdown', 'dbs_idealformsdropdown');
	for (var i=0; i<aryImg.length; i++) {
		if (aryImg[i]==imgId) return true;
	}
	return false;
}
//hides all drop down lists except 'exception', if any
function hideAllDroplist(exception) {
	var aryLyr = new Array('dbs_formsdropdownlyr', 'dbs_ratesdropdownlyr', 'dbs_toolsdropdownlyr' ,'dbs_lifestyledropdownlyr', 'dbs_idealformsdropdownlyr');
	for (var i=0; i<aryLyr.length; i++) {
		if (document.getElementById(aryLyr[i]))
			if (aryLyr[i]!=exception) document.getElementById(aryLyr[i]).style.visibility='hidden';
	}
}
function jumpToIframe(url,target,droplistId) {
	if (target=='_blank') window.open(url,''); //if menu elm has target="_blank"
	else parent.location=url;
}


function init(){
}
function open_window(link){
	window.open(link,"NewPage");
}
function open_window2(url){
	window.open(url,"billcorp","toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=no,width=780,height=500");
}
function open_square(url){
	window.open(url,"square","toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=no,width=540,height=540");
}
function open_window3(link){
	windowprops="location=yes,scrollbars=yes,menubar=yes,toolbar=yes,resizable=yes";
	window.open(link,"NewPage",windowprops);
}
function open_window4(url){
       window.open(url,"billcorp","toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=no,width=510,height=500");
}
function open_window5(url){
	window.open(url,"billcorp","toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes,width=780,height=500");
}
function CPFPINOpen(url) {
       window.open(url,'CPF','WIDTH=380,HEIGHT=380,toolbar=no,directories=no,status=no,scrollbars=no,resize=no,menubar=no,top=100,left=200');
}

function getCookie(name) { // use: getCookie("name");
    var index = document.cookie.indexOf(name + "=");
    if (index == -1) return null;
    index = document.cookie.indexOf("=", index) + 1; // first character
    var endstr = document.cookie.indexOf(";", index);
    if (endstr == -1) endstr = document.cookie.length; // last character
    return unescape(document.cookie.substring(index, endstr));
  }

  function showlink(redirectUrl) {
        //document.write('cookie is '+getCookie("DBS_Url"));
     if (getCookie("DBS_Url")!=redirectUrl) {
    document.write('<table width="131" cellspacing="0" cellpadding="0" border="0">'
		  + '<!-- start startpage -->'
		  + '<tr bgcolor="#FFF2EB">'		
		  + '<td colspan="2"><img src="/0.gif" width="1" height="5" alt="" border="0"></td>'
		  + '</tr>'
		  + '<tr bgcolor="#FFF2EB">'
		  + '<td class="MCcellPad"><img src="/img/common/icon_start.gif" alt="" width="13" height="17" border="0">&#160;'
		  + '<a href="/webapp/home.jsp?url='+redirectUrl+'" class="start">'
		  + 'Start on this page the next time you visit DBS.com</a></td>'
		  + '<td><img src="/0.gif" width="8" height="1" alt="" border="0"></td>'
		  + '</tr>'
		  + '<tr bgcolor="#FFF2EB">'
		  + '<td colspan="2"><img src="/0.gif" width="1" height="5" alt="" border="0"></td>'
		  + '</tr>'
		  + '<tr bgcolor="#FFFFFF">'
		  + '<td colspan="2"><img src="/0.gif" width="1" height="5" alt="" border="0"></td>'
		  + '</tr>'
		  + '<!-- end startpage -->'
		  + '</table>'
		  );
     
     }
  }


function land(ref, target)
{
lowtarget=target.toLowerCase();
if (lowtarget=="_self") {window.location=loc;}
else {if (lowtarget=="_top") {top.location=loc;}
else {if (lowtarget=="_blank") {window.open(loc);}
else {if (lowtarget=="_parent") {parent.location=loc;}
else {parent.frames[target].location=loc;};
}}}
}

function jump(menu)
{
ref=menu.dbs_dropdown.options[menu.dbs_dropdown.selectedIndex].value;
splitc=ref.lastIndexOf("*");
target="";
if (splitc!=-1)
{loc=ref.substring(0,splitc);
target=ref.substring(splitc+1,1000);}
else {loc=ref; target="_self";};
if (ref != "") {land(loc,target);}
}

//-->

