/* 

stdFuncs.js - INTERNET
Cam Morton 10-SEP-2002
Sets any JavaScript variables and provides commonly used functions in a central file

*/

// writes the date to the current part of the page
// usage <script lanugage="JavaScript">getPageDate();</script>
// formatting can be put around this

function getPageDate() {
	var strCurrDate;
	currDate = new Date();
	
	if (currDate.getDay() == 0) {day = "Sunday";}
	else if (currDate.getDay() == 1) {day = "Monday";}
	else if (currDate.getDay() == 2) {day = "Tuesday";}
	else if (currDate.getDay() == 3) {day = "Wednesday";}
	else if (currDate.getDay() == 4) {day = "Thursday";}
	else if (currDate.getDay() == 5) {day = "Friday";}
	else if (currDate.getDay() == 6) {day = "Saturday";}
	
	if (currDate.getMonth() == 0) {month = "January";}
	else if (currDate.getMonth() == 1) {month = "February";}
	else if (currDate.getMonth() == 2) {month = "March";}
	else if (currDate.getMonth() == 3) {month = "April";}
	else if (currDate.getMonth() == 4) {month = "May";}
	else if (currDate.getMonth() == 5) {month = "June";}
	else if (currDate.getMonth() == 6) {month = "July";}
	else if (currDate.getMonth() == 7) {month = "August";}
	else if (currDate.getMonth() == 8) {month = "September";}
	else if (currDate.getMonth() == 9) {month = "October";}
	else if (currDate.getMonth() == 10) {month = "November";}
	else if (currDate.getMonth() == 11) {month = "December";}
	
	year = currDate.getYear();	
	// for netscape
	if (year < 1900)
	    year = 1900 + year;

	strCurrDate = currDate.getDate() + " " + month + " " + year;
	document.write(strCurrDate);
} // end getDate

//return ME ABN
function getME_ABN() {
document.write("ME Bank Bank Pty Ltd ABN 56 070 887 679");

}
//return ME ABN in short form
function getME_ABN_AFS() {
document.write("ABN 56 070 887 679 AFS Licence: 229500");

}
//return ME Phone number
function getMeContactPhoneNumber() {
	//document.write("1300 654 990");
	document.write("13 15 63");
}

function getMeExistingCustContactPhoneNumber() {
	document.write("1300 654 998");
}

function getMeSBLContactPhoneNumber() {
	document.write("1300 658 108");
}

function getMeSBLFreeCallContactPhoneNumber() {
	document.write("1800 500 680");
}

function getMeBusDirectContactPhoneNumber() {
	document.write("1300 654 991");
}

function getMeMasterCardOSPhoneNumber() {
	document.write("61 3 9605 6717");
}

function getMeFaxNumber() {
	document.write("(03) 9605 6999");
}

// set the window opener properties and call the login handler page
function goLogin()
{
        var loginWin;   
        var HOST_NAME = "www1.membersequitybank.com.au";
        
        // if it is an external request - direct user to www1.membersequitybank.com.au      
        if (window.top.location.hostname) {
                temp_HOST_NAME = window.top.location.hostname.toUpperCase();
                // if it is not an external call - assign to the machine name
                if (temp_HOST_NAME.indexOf("MEMBERSEQUITY") ==  -1) {
                        HOST_NAME=temp_HOST_NAME;
                }                       
        }

        if ((screen.Height >=0) && (screen.Width >=0))
        {
                var sWidth = screen.Width - 10;
                var sHeight = screen.Height - 55;
        }
        else if ((screen.availHeight >= 0) && (screen.availWidth >= 0))
        {
                var sHeight = screen.availHeight - 25;
                var sWidth = screen.availWidth - 10;
        }
        sOptions = "toolbar=no,status=yes,location=no,menubar=no,directories=no,scrollbars=yes,";
        sOptions = sOptions + "resizable=yes,screenX=0,screenY=0,left=0,top=0,";
        sOptions = sOptions + "height=" + sHeight + ",width=" + sWidth;        
		sLoc = "https://" + HOST_NAME + "/DIYLogin.html";
	    sTitle = "Members_Equity_Internet_Banking"; 
        loginWin = window.open(sLoc,sTitle,sOptions);
}

function closeWin()
{       
        loginWin.close();
}

// for 
function openCalcWin(file) {

		sHeight=585;
		sWidth=800;
        sOptions = "toolbar=no,status=yes,location=no,menubar=no,directories=no,scrollbars=yes,";
        sOptions = sOptions + "resizable=yes,screenX=0,screenY=0,left=10,top=10,";
        sOptions = sOptions + "height=" + sHeight + ",width=" + sWidth;
		sTitle = "Members_Equity_Application_Form";   
		sLoc = file;
		loginWin = window.open(sLoc,sTitle,sOptions);	

}
// for opening the PDF application in a new window to make printing easier
function openAppWin(file) {

 		 if ((screen.Height >=0) && (screen.Width >=0))
        {
                var sWidth = screen.Width -40;
                var sHeight = screen.Height -95;
        }
        else if ((screen.availHeight >= 0) && (screen.availWidth >= 0))
        {
                var sWidth = screen.availWidth -40;
                var sHeight = screen.availHeight - 75;
        }

        sOptions = "toolbar=no,status=yes,location=no,menubar=no,directories=no,scrollbars=yes,";
        sOptions = sOptions + "resizable=yes,screenX=0,screenY=0,left=10,top=10,";
        sOptions = sOptions + "height=" + sHeight + ",width=" + sWidth;
		sTitle = "Members_Equity_Application_Form";   
		sLoc = file;
		loginWin = window.open(sLoc,sTitle,sOptions);	
		
}


var PDSDisc = "<li>This product advice has been prepared without taking account your objectives, financial situation or needs. Before you make any decisions about this product you should consider the appropriateness of the advice for you and read the <a href='/productDisclosure.html'>Product Disclosure Statement</a> available from ME Bank Bank Pty Ltd ABN 56 070 887 679 AFS Licence: 229500</li>";

var BAFooter = "<li>This product advice has been prepared without taking account your objectives, financial situation or needs. ABN 56 070 887 679 AFS Licence: 229500</li>";

// To use with the interest rate disclaimer. This must be used inside a <UL> tag.
function writeIntPDSDisc() {	
	document.writeln(PDSDisc);
}

// To use on the Business Account pages
function writeBAFooter() {	
	document.writeln(BAFooter);
}


// to use as a single disclaimer item (eg - with no interest rate disclaimer).
function writePDSDisc() {
	document.writeln("<ul class='fine'>");
	document.writeln(PDSDisc);
	document.writeln("</ul>");
}

// to insert email address into web page for hiding from spammers.
function generate_address( username ) {
  var domain = "membersequity.com.au";
  var atsign = "&#64;";
  var addr = username + atsign + domain;
  document.write( 
    "<" + "a" + " " + "href=" + "mail" + "to:" + addr + ">" +
    addr +
    "<\/a>");
}

// to insert email address into web page for hiding from spammers.
function generate_address_with_title( username, title ) {
  var domain = "membersequity.com.au";
  var atsign = "&#64;";
  var addr = username + atsign + domain;
  document.write( 
    "<" + "a" + " " + "href=" + "mail" + "to:" + addr + ">" +
    title +
    "<\/a>");
}

// to create a cookie for return visitor tracking in ClickTracks.

function getCookie(mecookie)
{
if (document.cookie.length>0)
  {
  var c_start=document.cookie.indexOf(mecookie + "=")
  if (c_start!=-1)
    { 
    c_start=c_start + mecookie.length+1 
    var c_end=document.cookie.indexOf(";",c_start)
    if (c_end==-1) c_end=document.cookie.length
    return unescape(document.cookie.substring(c_start,c_end))
    } 
  }
return ""
}

function setCookie(mecookie,value,expiredays)
{
var exdate=new Date()
exdate.setDate(exdate.getDate()+expiredays)
document.cookie=mecookie+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString())+";path=/"
}

function checkCookie()
{
var mesession=getCookie('mesession')
if (mesession==null || mesession=="")
    {
    setCookie('mesession',Math.random(),365)
    }
}


