
function fnPrint() {
	TakeMeThereNew('index.asp?menuID='+menuID+'&fprint=Y',menuID);
}

function TakeMeThereNew(action, vMenu_ID) {
	var settings = 'toolbar=0,status=1,location=no,menubar=no,directories=no,scrollbars=yes,resizable=yes,top=0,left=0,width=800,height=600';
	var mywin = window.open('blank.htm','subPrintWin', settings);
	this.document.forms[0].vMenu_ID.value = vMenu_ID;
	this.document.forms[0].target = 'subPrintWin';
	this.document.forms[0].method = 'post';
	this.document.forms[0].action = action;
	this.document.forms[0].submit();
}

function getLink(strCtrlName){
	TakeMeIPublish('/index.asp', $(strCtrlName).options[$(strCtrlName).selectedIndex].value);
}

function fnOnlineServices(strbutton) {
	var strURL = '';
    var strURLsame = '';
	if (strbutton == 'INFO') {
		if ($('radInternet').checked) { strURLsame = 'index.asp?menuid=100.140'; }
		if ($('radRewarder').checked) { strURLsame = 'index.asp?menuid=100.060.030'; }
		if ($('radInsurance').checked) { strURLsame = 'index.asp?menuid=110.030'; }
	}
	if (strbutton == 'LOGIN') {
		if ($('radInternet').checked) { strURL = 'http://online.coastline.com.au'; }
		if ($('radRewarder').checked) { strURL = 'https://www.rewarderpoints.com.au'; }
		if ($('radInsurance').checked) { strURLsame = 'index.asp?menuid=100.110.020'; }
	}
   
	if(strURL != '') { window.open(strURL,'_new');}
    if (strURLsame != '') { top.location.href = strURLsame; }
}



//////////////////////////////////////////////////////////////////////
// iPublishMenus
//////////////////////////////////////////////////////////////////////

function iPublishMenuInit() {
	var M;
	var bContinue = true;
	for (var i=0; bContinue; i++) {
		if ($('iPublishMenu'+i)) {
			DynarchMenu.setup('iPublishMenu'+i, { vertical: true, electric: true });
		} else bContinue = false;
	}
}


//////////////////////////////////////////////////////////////////////
// STYLE SHEET ACCESSIBILITY FUNCTIONS!
//////////////////////////////////////////////////////////////////////

function fontsizeup() {
  active = getActiveStyleSheet();
  switch (active) {
    case 'A--' : 
      setActiveStyleSheet('A-');
      break;
    case 'A-' : 
      setActiveStyleSheet('A');
      break;
    case 'A' : 
      setActiveStyleSheet('A+');
      break;
    case 'A+' : 
      setActiveStyleSheet('A++');
      break;
    case 'A++' :
      break;
    default :
      setActiveStyleSheet('A-');
      break;
  }
}

function fontsizedown() {
  active = getActiveStyleSheet();
  switch (active) {
    case 'A++' : 
      setActiveStyleSheet('A+');
      break;
    case 'A+' : 
      setActiveStyleSheet('A');
      break;
    case 'A' : 
      setActiveStyleSheet('A-');
      break;
    case 'A-' : 
      setActiveStyleSheet('A--');
      break;
    case 'A--' : 
       break;
    default :
      setActiveStyleSheet('A-');
      break;
  }
}

function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  return ('A-');
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}


window.onload = function(e) {
  var cookie = readCookie("style");
  var title = cookie ? cookie : getPreferredStyleSheet();
  setActiveStyleSheet(title);
  iPublishMenuInit();

  if ($('dvRelatedinfo') && $('tblRelatedinfo')) {
    if ($('dvRelatedinfo').innerHTML != "") {
      $('tblRelatedinfo').style.display = "";
    }
  }
}

window.onunload = function(e) {
  var title = getActiveStyleSheet();
  createCookie("style", title, 365);
}

var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
if (title == 'null') {
  title = getPreferredStyleSheet();
}

