/**** window handling related functions ****/

// POPUP STANDARD open a promo window - opens at top left of screen
// to use: <a href="http://www.suncorp.com.au" target="_blank" onclick="open_window(this.href);return false;">Suncorp</a>
function open_window(url) {
	w = window.open(url, "_blank", "width=700,height=450,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,screenX=0,screenY=0,left=0,top=0");
	w.opener = this;
	w.focus();
}

// POPUP LARGE open a promo window - opens at top left of screen
// to use: <a href="http://www.suncorp.com.au" target="_blank" onclick="open_window_large(this.href);return false;">Suncorp</a>
function open_window_large(url) {
	w = window.open(url, "_blank", "width=700,height=550,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,screenX=0,screenY=0,left=0,top=0");
	w.opener = this;
	w.focus();
}


// EXTERNAL STANDARD open an external window at 640 x 450 - opens at top left of screen
// to use: <a href="http://www.suncorp.com.au" target="_blank" onclick="open_external(this.href);return false;">Suncorp</a>
function open_external(url) {
	w = window.open(url, "_blank", "width=700,height=450,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,screenX=0,screenY=0,left=0,top=0");
	w.opener = this;
	w.focus();
}
// APPLICATION STANDARD open an application in a full screen size window
function open_application(url) {
	var sw=screen.availWidth - 12;
	var sh=screen.availHeight - 53;
	w = window.open(url, "_blank", "width=" + sw + ",height=" + sh + ",toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,screenX=0,screenY=0,left=0,top=0");
	if (w!=null)
	{
	    w.opener = this;
	    w.focus();
	}
	else
	{
	    alert('A popup window may have just been blocked. Please allow popups in your web browser and try again.');
	}
}
function open_ib_demo(url) {
	var xpos = (window.screen.width/2) - (740/2);
	var ypos = (window.screen.height/2) - (496/2) - 20;
	w = window.open(url, "Demo", "directories=0,width=740,height=496,top=" + ypos + ",left=" + xpos + ",location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no");
	w.opener = this;
	w.focus();
}
// to load a different page in the parent window
function load_opener(url) {
	if (window.opener) {
		window.opener.location = url;
		window.opener.focus();
	} else {
		open_external(url);
	}
}
// to close any window neatly
// to use: <a href="javascript:close_window();">Suncorp</a>
function close_window() {
	if (window.opener) {
		window.opener.focus();
	}
	window.close();
}

// PI Internet function - added 1st Sept
function open_fullscreen(theURL,winName, unusedfeatures) 
{ //new version from Bailee
	var sw=screen.availWidth - 12;
	var sh=screen.availHeight - 53;
	w = window.open(theURL, winName, "scrollbars=yes,resizable=yes,width=" + sw + ",height=" + sh + ",toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,screenX=0,screenY=0,left=0,top=0");
	w.opener = this;
	w.focus();
}

function open_centerscreen(theURL,winName, unusedfeatures) 
{ 
	var sw=(screen.availWidth - 874)/2;
	var sh=(screen.availHeight - 600)/2;
	w = window.open(theURL, winName, "scrollbars=yes,resizable=yes,width=874,height=600,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,screenX=0,screenY=0,left=" + sw + ",top=" + sh);
	w.opener = this;
	w.focus();
}