// ********* RETURN form submit
isFunction = false;
submitterName = null;
validate=false;

function rtSubmit(e) {
	if(validate) {
		if(!e) {
			if(window.event) {
				e = window.event;
			} else {
				return;
			}
		}

		if( typeof( e.which ) == 'number' ) {
		//NS 4, NS 6+, Mozilla 0.9+, Opera
			e = e.which;
		} else if( typeof( e.keyCode ) == 'number' ) {
		//IE, NS 6+, Mozilla 0.9+
			e = e.keyCode;
		} else if( typeof( e.charCode ) == 'number' ) {
		//also NS 6+, Mozilla 0.9+
			e = e.charCode;
		} else {
			return;
		}

		if(submitterName != null || submitterName != "") {
			if(e == 13) {
				if(isFunction) {
					// execute js function
					if(submitterName.charAt(submitterName.length - 1) == ")") {
						eval(submitterName);
					}
				} else {
					// submit form
					eval("document.forms['" + submitterName + "'].submit");
				}
			}
		}
	}
}

document.onkeypress = rtSubmit;
// *********

function t(e){var oBj=document.getElementById(e);if(oBj.className=='ac')oBj.className='ina';else oBj.className='ac';}
function m3(n){
   	var menu, arrowImg, par;

     	menu = document.getElementById("mnu" + n);
		par = document.getElementById("mpar" + n);
      // Determine if the menu is currently showing.
     	if (menu.style.display == 'block'){

        	// If it is showing, hide the menu and update the twisty image.
       	menu.style.display = 'none';
       	par.className = 'm3pD';
      }else{

      	// Hide all layers first.
       	var divs = document.getElementsByTagName("div");
			var anchs = document.getElementsByTagName("a");

       	for (var i = 0; i < divs.length; i++)
        		if (divs[i].id.indexOf("mnu") >= 0)
            	divs[i].style.display = 'none';

       	for (var j = 0; j < anchs.length; j++){
        		if (anchs[j].id.indexOf("mpar") >= 0){
            	anchs[j].className = 'm3pD';
				}
			}

        	// Show the menus and update their twisty images.
       	i = 1;
       	while (n.length >= i)
        	{
         	menu = document.getElementById("mnu" + n.substring(0, i));
         	par = document.getElementById("mpar" + n.substring(0, i));
         	menu.style.display = "block";
         	par.className = 'm3pA';
         	i += 1;
        	}
   	}
	}


// function to show and hide the menu
function updateMenu(n, loc, callingObj){

 var menu;

 menu = document.getElementById("mnu" + n);

 // If already showing then close menu 
 if(menu.style.display != 'none') {
 
 	menu.style.display = 'none';
  	callingObj.className = 'm3pD'; //was m3pD

 } else {

 	// If not showing then display menu   
   	menu.style.display = 'block';
   	callingObj.className = 'm3pD';    

 	location.href = loc; 
 }


}

function toggleFAQ(which) {
	var oBj=document.getElementById(which + 'A');
	var oBj2=document.getElementById(which + 'T');
	if(oBj.style.display=='none'){
		oBj.style.display='';
		oBj2.firstChild.data='Hide Answer';
	} else {
		oBj.style.display='none';
		oBj2.firstChild.data='Show Answer';
	}
}

function getPrintWindowParams() {
	return "width=664,menubar=yes,status=yes,scrollbars=yes,resizable=yes,top=20,left=20";
}


// the following function for the global search is necessary for as form 
// would require being placed inside the div, however eWebEditPro strips 
// the form out and places it around the div

function searchSubmit() {
	if ((document.getElementById("QueryText").value=='') || (document.getElementById("QueryText").value=='Search...')) { alert('Please enter a search term.'); return; }
	var search_url = "/portal/site/oca/menuitem.43cc470fed4d9ee33109002b8c8ac7a0/?vgnextoid=0b116c499f632010VgnVCM100000c8a87c0aRCRD&Page=1&Paging=true&QuerySubmit=true";
	var query_text = "QueryText=" + escape(document.getElementById("QueryText").value);
	document.location.href = search_url + "&" + query_text;
}

// The following function is to be called from the primary nav as a fix to
// a bug within ie5. It is required as anchor tags on images are not registered
// if a float style is applied to the anchor tag.
function ie5PrimaryNavFix(objRef) {
	if(is_ie && navigator.userAgent.indexOf("MSIE 5.01")!=-1 && navigator.userAgent.toLowerCase().indexOf("mac") == -1) {
		document.location.href = objRef.href;
	}
}

//WT - 1.0.8c
function drop(tag,drop_class,selected) {
for (i = 0; i < document.getElementsByTagName(tag).length; i++)
	{
		var elem = document.getElementsByTagName(tag)[i];
		if ((elem.id != selected) && (elem.className == drop_class))
		{
			elem.style.display = "none";
		}
		if ((elem.id == selected) && (elem.className == drop_class))
		{
			elem.style.display = "block";
		}
	}
}

function redirect(dest_url) {
if (dest_url) {
		// if ( dest_url.substring(0,8) != "/portal/" ) { window.open(dest_url, "_blank"); }
		if ( (dest_url.indexOf('/portal/site/') == -1) && (dest_url.indexOf('my.optus.com.au') == -1) ) { window.open(dest_url, "_blank"); }
		else { window.open(dest_url, "_parent"); }
		}
}

// browser compatibility style changes
document.write("<style type=\"text/css\">");
// mac:
if(!is_ff && navigator.userAgent.toLowerCase().indexOf("mac") != -1) {
	document.write("#section-header{float:left;}");
	document.write("#result-heading{clear:right;border:#ffffff solid 2px;width:589px;}");
	document.write("#home-region-d{height: 74px}");
	document.write("div.sec-space{height: 15px;}");
	document.write("#home-region-b-col1,#home-region-b-col2{height: 187px;}");
	if (is_ie) { // if it's IE on MacOS
		if(navigator.userAgent.indexOf("MSIE 5")!=-1) {
			document.write("#home-col-c,#home-region-e{width:151px;}");
			document.write("#global-qLinks select{width:155px;}");
			document.write("#global-search .go,#global-qLinks .go{position:static;}");
		}
		// Spacing between region A & Wholesale & Business
		if(navigator.userAgent.indexOf("MSIE 5.23")!=-1) {
			document.write("#home-region-d {height: 74px}");
			document.write("#home-region-d-inner1,#home-region-d-inner2{height:33px;}");
			document.write("div.sec-space {height: 15px;}");
		}
	}
	if (is_opera)  {
		document.write("#result-summary{overflow:auto;}");
		document.write("#home-region-d {height: 74px}");
	    document.write("#home-region-d-inner1,#home-region-d-inner2{height:33px;}");
	    document.write("div.sec-space {height: 15px;}");
	}
// ns 6-6.x:
} else if(is_nav && (navigator.vendorSub.substring(0,1) == "6")) {
	document.write("#content{float:none;display:table;}");
	document.write("#content-full{float:none;position:relative}");
	document.write("#content-full form{position:relative;}");
	document.write("#content-main, #content-main-full, #content-generic, #content-generic-full{display:table;}");
	document.write("#float-tank{float:none;background-color:#ffffff;}");
	document.write("#float-tank-inner{float:none;}");
	document.write("#ln{clear:none;}");
	//document.write("#control{display:table;}");
	document.write("#control{margin-bottom:10px}");
	document.write("#control div{display:table;left:-30px;}");
	document.write("#home-region-a-col4{height:148px;}");
	document.write("#logo{height:43px;}");
	document.write("#home-region-c-col2{height:92px;}");
	document.write("#home-region-d{height:75px;}");
	document.write("#home-region-e{height:223px;}");	
	if(navigator.vendorSub == "6.2.3") {
		document.write("#col-e{display:table;}");
		document.write("#home-region-d{height:76px;}");
		document.write("#home-region-d-inner1,#home-region-d-inner2{height:33px;}");
		document.write("#home-region-e{height:228px;}");
		document.write("div.sec-space {HEIGHT: 15px;}");
	}	
} else if(is_ie) { // if IE
	document.write("#home-region-d{height:73px;}");
	document.write("#home-region-d-inner1,#home-region-d-inner2{height:32px;}");
	// ie5
	if(navigator.userAgent.indexOf("MSIE 5")!=-1) {
		document.write("div.faq-question span.faq-question-label-full{width:460px;}");
		document.write("div.rhs-promo-border,div.highlight-border{width:138px;}");
		document.write("#global-qLinks,#global-search{padding-top:0px;font-size:11px;height:48px;vertical-align:middle;}");
	}
	// ie5.01
	if (navigator.userAgent.indexOf("MSIE 5.01")!=-1) {
		document.write("#float-tank{width:auto;}");
		document.write("#float-tank-inner{width:auto;}");
	}
	// ie7 - note that this is the same tweaks as FireFox :)
	if (navigator.userAgent.indexOf("MSIE 7.")!=-1) {
		document.write("#home-region-d{height: 74px}");
		document.write("#home-region-d-inner1,#home-region-d-inner2{height:33px;}");
		document.write("div.sec-space{height: 15px;}");
		document.write("#home-col-a{height: 225px;}");
		document.write("#home-region-b-col1,#home-region-b-col2{height: 187px;}");
	}
// Mozilla Firefox 1.0: Spacing between region A & Wholesale & Business
} else if (is_ff) {
	document.write("#home-region-d{height: 74px}");
	document.write("#home-region-d-inner1,#home-region-d-inner2{height:33px;}");
	document.write("div.sec-space{height: 15px;}");
	document.write("#home-col-a{height: 225px;}");
	document.write("#home-region-b-col1,#home-region-b-col2{height: 187px;}");
// Mozilla
} else if (is_moz) {
	document.write("div.faq-answer-rhs-active{border-top:1px solid #c8e6ea;clear:both;background-color:#FFF3BF;visibility:visible;display:block;border-left:1px solid #c8e6ea;border-right:1px solid #c8e6ea;padding:3px;width:441px}");
	document.write("#formStyle{display:block;font-size:11px;height:350px;width:728px;background-color:#dce6ec;border:#046684 solid 1px;padding:10px;margin-top:10px; margin-bottom:10px}");
	// Mozilla 1.1 and Mozilla 1.2
	if (navigator.userAgent.indexOf("1.1")!=-1 || navigator.userAgent.indexOf("1.2")!=-1) {
		document.write("#home-region-a-col4{height:148px;}");
		document.write("#home-region-c-col2{height:92px;}");
	}
// Netscape > 7
} else if (is_nav7up)  {
	document.write("div.faq-answer-rhs-active{border-top:1px solid #c8e6ea;clear:both;background-color:#FFF3BF;visibility:visible;display:block;border-left:1px solid #c8e6ea;border-right:1px solid #c8e6ea;padding:3px;width:442px}");
    document.write("#formStyle{display:block;font-size:11px;height:350px;width:728px;background-color:#dce6ec;border:#046684 solid 1px;padding:10px;margin-top:10px; margin-bottom:10px}");
    // Netscape 7 and Netscape 7.01 - Fix for: Optus Zoo & Give your business simplicity regions stretch outside the boundary
    if (navigator.userAgent.indexOf("7.0")!=-1 || navigator.userAgent.indexOf("7.01")!=-1) {
		document.write("#home-region-a-col4{height:148px;}");
		document.write("#home-region-c-col2{height:92px;}");
	}
	// Netscape 7.2: Spacing between region A & Wholesale & Business
	if (navigator.userAgent.indexOf("7.2")!=-1) {
		document.write("#home-region-d {height: 74px}");
		document.write("#home-region-d-inner1,#home-region-d-inner2{height:33px;}");
		document.write("div.sec-space {height: 15px;}");
	}

// Opera
} else if (is_opera)  {
	document.write("#result-summary{overflow:auto;}");
	document.write("#home-region-d {height: 74px}");
	document.write("#home-region-d-inner1,#home-region-d-inner2{height:33px;}");
	document.write("div.sec-space {height: 15px;}");
}

// not(ns 6-6.x):	
if(!(is_nav && (navigator.vendorSub.substring(0,1) == "6"))) {
	document.write("#search-content{float:left;}");
}

// Always display vertical scrollbar to prevent page shifting horizontally
document.write("html { min-height: 100%; margin-bottom: 1px; }");
document.write("</style>");


