// JavaScript Document
// JavaScript Document
// This is a sample script


function mk_newWindow(url) {
 openWindow("national",url,780,505,"toolbar=yes, titlebar=yes, resizable=yes, location=yes, scrollbars=yes,menubar=yes",window,"left","top",10,10,"");
}


var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

// lower right hand side banner - top 
function rotatingAdvert() { //user friendly version of rotating image adverts script
 
	     var how_many_ads = 4;
         var now = new Date()
         var sec = now.getSeconds()
         var ad = sec % how_many_ads;
               ad +=1;
			   
			  if (ad==1) {
                 url="http://www.mlc.com.au/InsuranceGapCalculator/"
                 target="_blank";
                 alt="Insurance Gap Calculator";
                 advert="/cms/dynamic/resources/images/igc_tile.gif";
                 width="185";
                 height="60";
              }
			 if (ad==2) {
                 url="/cms/dynamic/Personal_Home_Page/Personal__Investments/1_30_00_00_20.html";
                 target="_self";
                 alt="MLC MasterKey Business Super takes the 2006 Asset Magazine Innovation Award";
                 advert="/cms/dynamic/resources/images/webcontent/asset_banner.gif";
                 width="185";
                 height="60";
              }

		 	if (ad==3) {
                 url="/cms/dynamic/Personal_Home_Page/Personal__Investments/1_30_00_00_10.html";
                 alt="Winner Best New Product of the Year Rainmaker Excellence Awards 2006";
                 advert="/cms/dynamic/resources/images/webcontent/rainmaker_banner.gif";
		 target="_self";                 
		 width="185";
                 height="60";
              }
			if (ad==4) {
                 url="/cms/dynamic/Personal_Home_Page/Personal__News_and_Information/1_60_70.html";
                 alt="Will you have to pay more tax? Find out more.";
                 advert="/cms/dynamic/resources/images/webcontent/tile_tax.jpg";
		 target="_self";                 
		 width="185";
                 height="60";
              }


			document.write('<a href="' + url + '"target="' + target + '" >');
                        document.write('<img src="' + advert + '" width=')
              		document.write(width + ' height=' + height + ' ');
              		document.write('alt=\"' + alt + '\" border=0></a>');
} 

// lower right hand side banner - bottom
function rotatingAdvert2() { //user friendly version of rotating image adverts script
 
	     var how_many_ads = 3;
         var now = new Date()
         var sec = now.getSeconds()
         var ad = sec % how_many_ads;
               ad +=1;


	   	if (ad==1) {
                 url="javascript:openWindow('retirement','http://www.mlc.com.au/retirement_savings_gap/rsg_calc.html?Tile',728,524,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no',window,'left','top',0,0,''); void(0);";
                 alt="Are you on track to fund your retirement? - Find out more";
                 advert="/cms/dynamic/resources/images/webcontent/retirement_tile.gif";
                 width="185";
                 height="60";
              }
			  if (ad==2) {
                 url="https://www.mlc.com.au/supercheck/index.html?mlc";
                 alt="MLC 1 minute super check. Find out more.";
                 advert="/cms/dynamic/resources/images/webcontent/mlc_supercheck_tile_2.gif";
                 width="185";
                 height="60";
              }
			  if (ad==3) {
                 url="http://www.mlc.com.au/CaseStudies/index.html?tile";
                 alt="Case Studies on the Value of Advice";
                 advert="/cms/dynamic/resources/images/webcontent/casestudy_tile.gif";
                 width="185";
                 height="60";
              }
		 if (ad==2 || ad==3 ) {
			document.write('<a href="' + url + '" target=_blank>');
		} else {    
              		document.write('<a href="' + url + '">');
		}
			  
              document.write('<img src="' + advert + '" width=')
              document.write(width + ' height=' + height + ' ');
              document.write('alt=\"' + alt + '\" border=0></a>');

}

//Popup script for parameterised campaign popups
xPos = (screen.width) ? (screen.width - 800)/2 : 0;
yPos = (screen.height) ? (screen.height - 465)/2 : 0;

function pop_window (target,windowname,w,h,x,y,scrollbars,resizable) {
	var newWindow = null; var i = 0;
	if (navigator.appName == 'Microsoft Internet Explorer')	{
		if ( (navigator.appVersion.indexOf('Windows 3.1') < 0) && (navigator.appVersion.indexOf('Macintosh') < 0) ) {
			newWindow = window.open('',windowname,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+scrollbars+',resizable='+resizable+',copyhistory=no,width='+w+',height='+h+',screenX='+xPos+',screenY='+yPos+',left='+xPos+',top='+yPos);
			if (newWindow) {
				newWindow.close();
				while ((! newWindow.closed) && (i<100)) i++;
			}
		}
	}
	newWindow = window.open(target,windowname,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+scrollbars+',resizable='+resizable+',copyhistory=no,width='+w+',height='+h+',screenX='+xPos+',screenY='+yPos+',left='+xPos+',top='+yPos);
	if (navigator.appName != 'Microsoft Internet Explorer')	{
		newWindow.focus();
	}
}
	

//********************************
//Function to read querystring and determine which popup to load (if any)
function campaignPopUp() {
	var testQueryString = window.location.search.substring(1);
		//Do an if statement for each campaign that is running
		if (testQueryString == "campaign=superadvice") {
			pop_window('http://www.mlc.com.au/superadvice/content.html','superadvice',728,524,20,20,'no','no');	
		}
}
onLoad=setTimeout("campaignPopUp();", 2000);
//*******************************