function trim(inputString) 
{
	if (typeof inputString != "string") { return inputString; }
	var retValue = inputString;
	var ch = retValue.substring(0, 1);
	while (ch == " ") 
	{
		retValue = retValue.substring(1, retValue.length);
		ch = retValue.substring(0, 1);
	}
	ch = retValue.substring(retValue.length-1, retValue.length);
	while (ch == " ") 
	{ 
		retValue = retValue.substring(0, retValue.length-1);
		ch = retValue.substring(retValue.length-1, retValue.length);
	}
	while (retValue.indexOf(" ") != -1) 
	{ 
		retValue = retValue.substring(0, retValue.indexOf(" ")) + retValue.substring(retValue.indexOf(" ")+1, retValue.length); // Again, there are two spaces in each of the strings
	}
	return retValue; 
} 

function validateForm(thisForm)
{
	req_fields_ok = "y";
	for (i=0; i < thisForm.elements.length; i++)
	{
		if ((trim(thisForm.elements[i].value) == "") && (thisForm.elements[i].name.indexOf("req_") == 0))
		{
			req_fields_ok = "n";
		}
	}
	if (req_fields_ok == "n")
	{
		alert("Please enter information in the fields marked with asterisk (*) ");
		return (false);
	}
	else
	{
		return (true);
	}
}

function listFields(thisForm)
{
	thisForm.form_fieldlist.value = "<FIELDLIST>";
	for (i=0; i < thisForm.elements.length; i++)
	{
		if ((thisForm.elements[i].name > "") && (thisForm.elements[i].name.indexOf("form_") != 0))
		{
			thisForm.form_fieldlist.value = thisForm.form_fieldlist.value + "<FNAME>" + thisForm.elements[i].name + "</FNAME>";
		}
	}
	thisForm.form_fieldlist.value = thisForm.form_fieldlist.value + "</FIELDLIST>";
}

function moveto(t)
{
	var obj=t;
	window.navigate(t.value);
}

function win_new(mpath)
{
	win1 = window.open(mpath, "first", "toolbar=no,menubar=no,width=680,height=500,scrollbars=yes");
}

function colorTable(tableGUID) 
{
        var objTable = document.all(tableGUID);
        var objRows = objTable.getElementsByTagName("tr");
        var counter = 0;
        var isHeading = false;
        for(var i = 0; i < objRows.length; i++) 
        {
		isHeading = objRows[i].getAttribute("heading") == "Yes";
		if(objRows[i].name == "data" && !isHeading) 
		{
                	if(counter % 2 == 0) 
                	{
				objRows[i].style.backgroundColor = "#DEEFFF";
                	}
                	counter++;
		}
        }
}

function hide_all() 
{
	hide("topnav_menu_public_products", "topnav_label_public_products");
	hide("topnav_menu_public_financial_advice", "topnav_label_public_financial_advice");
	hide("topnav_menu_public_resources", "topnav_label_public_resources");
	hide("topnav_menu_public_education", "topnav_label_public_education");
	hide("topnav_menu_public_about_us", "topnav_label_public_about_us");
	hide("topnav_menu_public_help", "topnav_label_public_help");
	hide("topnav_menu_adviser_products", "topnav_label_adviser_products");
	hide("topnav_menu_adviser_technical_sales", "topnav_label_adviser_technical_sales");
	hide("topnav_menu_adviser_resources", "topnav_label_adviser_resources");
	hide("topnav_menu_adviser_help", "topnav_label_adviser_help");
	hide("topnav_menu_adviser_online_services", "topnav_label_adviser_online_services");
	hide("topnav_menu_customer_products", "topnav_label_customer_products");
	hide("topnav_menu_customer_financial_advice", "topnav_label_customer_financial_advice");
	hide("topnav_menu_customer_resources", "topnav_label_customer_resources");
	hide("topnav_menu_customer_education", "topnav_label_customer_education");
	hide("topnav_menu_customer_help", "topnav_label_customer_help");
	hide("topnav_menu_customer_online_services", "topnav_label_customer_online_services");
	hide("topnav_menu_msc_public_about_ing", "topnav_label_msc_public_about_ing");
	hide("topnav_menu_msc_public_learning_centre", "topnav_label_msc_public_learning_centre");
	hide("topnav_menu_msc_public_forms_and_brochures", "topnav_label_msc_public_forms_and_brochures");
	hide("topnav_menu_msc_public_performance", "topnav_label_msc_public_performance");
	hide("topnav_menu_msc_secure_your_account", "topnav_label_msc_secure_your_account");
}

function set_show_hide_topnav() 
{
	set_show_hide("public_products");
	set_show_hide("public_financial_advice");
	set_show_hide("public_resources");
	set_show_hide("public_education");
	set_show_hide("public_about_us");
	set_show_hide("public_help");
	set_show_hide("adviser_products");
	set_show_hide("adviser_technical_sales");
	set_show_hide("adviser_resources");
	set_show_hide("adviser_help");
	set_show_hide("adviser_online_services");
	set_show_hide("customer_products");
	set_show_hide("customer_financial_advice");
	set_show_hide("customer_resources");
	set_show_hide("customer_education");
	set_show_hide("customer_help");
	set_show_hide("customer_online_services");
	set_show_hide("msc_public_about_ing");
	set_show_hide("msc_public_learning_centre");
	set_show_hide("msc_public_forms_and_brochures");
	set_show_hide("msc_public_performance");
	set_show_hide("msc_secure_your_account");
}

function set_show_hide(element_id)
{
	var master_element_id = "topnav_" + element_id;
	var menu_element_id = "topnav_menu_" + element_id;
	var label_element_id = "topnav_label_" + element_id;
	var master_node = document.getElementById(master_element_id);
	var menu_node = document.getElementById(menu_element_id);
	var label_node = document.getElementById(label_element_id);
	if ((label_node != null) && (label_node.className == 'navActive') && (active_topnav_id == '')) 
	{
		active_topnav_id = label_element_id;
	}
	if ((master_node != null) && (menu_node != null))
	{
		master_node.onmouseover=function()
		{
			show(menu_element_id, label_element_id);
		}
		master_node.onmouseout=function()
		{
			delay_hide(menu_element_id, label_element_id);
		}
	}
}

function show(menu_element_id, label_element_id)
{
	clear_timer();
	hide_all();
	if (label_element_id != null) 
	{
		var label_obj = document.getElementById(label_element_id);
		if ((label_obj != null) && (label_obj.className != 'navActive')) 
		{
			label_obj.className = 'navActive';
 		}
 	}
 	var menu_obj = document.getElementById(menu_element_id);
 	if (menu_obj != null)
 	{
		menu_obj.style.visibility = "visible";
	}
}

function hide(menu_element_id, label_element_id)
{
	menu_obj = document.getElementById(menu_element_id);
	if (menu_obj != null)
	{
		menu_obj.style.visibility = "hidden";
	}
	label_obj = document.getElementById(label_element_id);
	if ((label_obj != null) && (label_element_id != active_topnav_id)) 
	{
		label_obj.className = '';
	}
}

function delay_hide() 
{
	timer_ID = setTimeout('hide_all()', 100); 
}

function clear_timer() 
{
	clearTimeout(timer_ID);
}
<!-- below is new code for v6_apps_prod details page Jump menu -->

function MM_jumpMenu2(targ,selObj,restore)
{ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}


// below functions used for the login script
var currentDiv = 'scriptjs';
var scriptDiv = 'scriptjs';
function showDiv(div) {
    document.getElementById(scriptDiv)
      .style.visibility = 'visible';
   currentDiv = scriptDiv;
 }
  
var currentLayer = 'dLogin';
function showLayer(lyr) {
   hideLayer(currentLayer);
   document.getElementById(lyr)
      .style.visibility = 'visible';
   currentLayer = lyr;
 }
 function hideLayer(lyr) {
   document.getElementById(lyr).
      style.visibility = 'hidden';
}




function setHrefTarget(source){
  if(source=="adviser"){
    	document.getElementById('infoAnchor').href='/public/v6_public_8391.asp'; 
    	document.getElementById('regoAnchor').href='/public/shortcuts/ingadviserrego.asp';
	document.getElementById('regoAnchor').target='_blank';
    	document.getElementById('loginAnchor').href='/reddot/8897.asp';
        document.getElementById('loginAnchor').target='_self';
	document.getElementById('infoAnchor').style.textDecoration = 'underline' ;
	document.getElementById('regoAnchor' ).style.textDecoration = 'underline' ;
	document.getElementById('loginAnchor').style.textDecoration = 'underline' ;
	document.getElementById('infoAnchor').style.color = 'white' ;
	document.getElementById('regoAnchor').style.color = 'white' ;
	document.getElementById('loginAnchor').style.color = 'white' ;
	document.getElementById('regoAnchor').style.cursor = 'hand' ;
  }
  else if(source=="customer"){
    	document.getElementById('infoAnchor').href='/public/v6_public_8390.asp';
    	document.getElementById('regoAnchor').href='/public/shortcuts/ingcustomerrego.asp';
    	document.getElementById('regoAnchor').target='_blank';
    	document.getElementById('loginAnchor').target='_self';
    	document.getElementById('loginAnchor').href='/reddot/8898.asp'; 
	document.getElementById('infoAnchor').style.color = 'white' ;
	document.getElementById('regoAnchor').style.color = 'white' ;
	document.getElementById('loginAnchor').style.color = 'white' ;
	document.getElementById('infoAnchor').style.textDecoration = 'underline' ;
	document.getElementById('regoAnchor' ).style.textDecoration = 'underline' ;
	document.getElementById('loginAnchor').style.textDecoration = 'underline' ;
	document.getElementById('regoAnchor').style.cursor = 'hand' ;
	
  }else if(source=="employer"){
    	document.getElementById('infoAnchor').href='/public/v6_public_8392.asp';
    	document.getElementById('regoAnchor').href='/public/shortcuts/ingemployerrego.asp';
    	document.getElementById('regoAnchor').target='_blank';
    	document.getElementById('loginAnchor').href='https://www.superchoice.com.au/ING/';
    	document.getElementById('loginAnchor').target='_blank';
    	document.getElementById('infoAnchor').style.color = 'white' ;
	document.getElementById('regoAnchor').style.color = 'white' ;
	document.getElementById('loginAnchor').style.color = 'white' ;
	document.getElementById('infoAnchor').style.textDecoration = 'underline' ;
	document.getElementById('regoAnchor' ).style.textDecoration = 'underline' ;
	document.getElementById('loginAnchor').style.textDecoration = 'underline' ;
	document.getElementById('regoAnchor').style.cursor = 'hand' ;
	
  }else if(source=="portfolio"){
    	document.getElementById('infoAnchor').href='/public/v6_public_8400.asp';
    	document.getElementById('regoAnchor').target='_self';
	document.getElementById('regoAnchor').href='#';
    	document.getElementById('loginAnchor').href='http://www.portfolioone.ing.com.au';
	document.getElementById('loginAnchor').target='_blank';
	document.getElementById('infoAnchor').style.color = 'white' ;
	document.getElementById('regoAnchor').style.color = '#666666' ;
	document.getElementById('loginAnchor').style.color = 'white' ;
	document.getElementById('infoAnchor').style.textDecoration = 'underline' ;
	document.getElementById('regoAnchor' ).style.textDecoration = 'none' ;
	document.getElementById('loginAnchor').style.textDecoration = 'underline' ;
	document.getElementById('regoAnchor').style.cursor = 'text' ;
	
  }
}

function showlogin(delImage) {
var source = ""; 

document.write ("<table class='headerTableLogins' cellpadding=0 cellspacing=0 border='0' >");
document.write ("<tr>");
document.write ("<td><TABLE class='headerPageLogins' cellPadding=0 cellSpacing=0 >");
document.write ("<TBODY>");
document.write ("<TR><TD class='headerLogins'>");
//document.write ("<font style='font-weight:bolder; font-size: 12px; color: #FFFFFF; padding: 0 0 0 4; font-family: Verdana, Arial, Helvetica, sans-serif;'  >");
document.write ("LOGINS");
//document.write ("</font>");
document.write ("</TD></TR>");
//document.write (" <hr  color='white' width='140px' >");
document.write ("<TR><TD class='headerLoginText'>");
//document.write ("<font style='font-weight:bold;  font-size: 11px; font-family: Verdana, Arial, Helvetica, sans-serif; color: #333333; ' >"); 
document.write ("<input id='adviserRadioButton' type=radio name='RadioGroup' value='adviser' onClick=\"setHrefTarget('adviser')\" /> Adviser or Dealer<br /><br />");
document.write ("<input id='customerRadioButton' type=radio name='RadioGroup' value='customer' onClick=\"setHrefTarget('customer')\" /> Customer<br /><br />");
document.write ("<input id='employerRadioButton' type=radio name='RadioGroup' value='employer' onClick=\"setHrefTarget('employer')\" /> Employer<br /><br />");
document.write ("<input id='portfolioRadioButton' type=radio name='RadioGroup' value='portfolio1' onClick=\"setHrefTarget('portfolio')\" /> PortfolioOne");
//document.write (" <hr  color='white' width='140px' >");
document.write ("</TD></TR><TR><TD class='headerLoginLink' height=15 align='center'>");
document.write ('<a class= "whiteutilities A:hover" id="infoAnchor">Info</a>&nbsp;:&nbsp;<a class= "whiteutilities A:hover" id="regoAnchor" >Register</a>&nbsp;:&nbsp;<a class= "whiteutilities A:hover" id="loginAnchor" >Login</a>');
document.write ("</TD></TR></TBODY> </TABLE>");
document.getElementById('infoAnchor').style.color = '#666666' ;
document.getElementById('regoAnchor').style.color = '#666666' ;
document.getElementById('loginAnchor').style.color = '#666666' ;
//document.getElementById('infoAnchor').href='javascript:;';
//document.getElementById('regoAnchor').href='javascript:;';
//document.getElementById('loginAnchor').href='javascript:;';

document.getElementById('adviserRadioButton').checked = false;
document.getElementById('customerRadioButton').checked = false;
document.getElementById('employerRadioButton').checked = false;
document.getElementById('portfolioRadioButton').checked = false;

// randomimg used for ING homepage header images located in images directory and contains prefix img_header_public currently goes from 0 to 4
var randomimg=Math.floor(Math.random()*4 );

document.write (" </td> ");
document.write ("<td class='headerPageImage'>");
//alert(delImage);
if (!delImage){
	document.write ("<a href='http://www.ing.com.au/public/v6_public_14595.asp#market?TCID=HomeBannerYourFin'><img src='/public/header_images/img_header_public" );
	document.write (randomimg);
	document.write (".jpg' border='0'></a>" );
}
document.write ("</tr>");
document.write ("</td>");
document.write ("</table></div>");

}


