/*



Popup windows

							

Version History

2001-07-04	v1.0	Created					Shaun McCarthy (shaunm@web.co.nz)

2001-11-12	v1.1	Updated to move the form after popup 	Shaun McCarthy (shaunm@web.co.nz)



Copyright The Web Limited, 2001. All rights reserved.

This program may not be duplicated or transmitted in any way 

without the express written permission of The Web Limited.



*/



defaultHeight = 500;

defaultWidth  = 792;

demoWidth = 600;

demoHeight = 500;

moveToX = 20;

moveToY = 20;

toolHeight = 500;

toolWidth = 787;



function PopupDemo(url) {

	var newWindow = window.open(url, "onlineDemo", "width=" + demoWidth + ",height=" + demoHeight + ",scrollbars=no,status=no,resizable=yes");

	return false;

}



function popup(url, window_name, width, height) {

	var newWindow = window.open(url, window_name, "width=" + width + ",height=" + height + ",scrollbars=yes,status=yes,resizable=yes");

	return false;

}



function popup_exact(url, window_name, width, height, scroll, resize) {

	var newWindow = window.open(url, window_name, "width=" + width + ",height=" + height + ",scrollbars=" + scroll + ",status=no,resizable=" + resize);

	return false;

}



function popup_form(url) {

	popup(url, "telecom_form", defaultWidth, defaultHeight);

	return false;

}





function popup_tool(url) {

	popup(url, "telecom_tool", toolWidth, toolHeight);

	return false;

}



function popup_jobs(url) {

	popup_exact(url, "tcnzjobs", "675", "550", "no", "yes");

	return false;

}



/* function CloseWindow

 *

 * This funciton will close the popup window and redirect the parent window to  

 * a different page

 *

 */



function CloseWindow(url) {

	window.opener.location = url;

	window.opener.focus();

//	window.close();

	return false;

}



function launch(newURL, newName, newFeatures, orgName) {

  var remote = open(newURL, newName, newFeatures);

  remote.focus();

  if (remote.opener == null)

    remote.opener = window;

  remote.opener.name = orgName;

  return remote;

}



function launchRemote(url) {

  myRemote = launch(url, "myRemote", "height=400,width=400,screenX=150,left=150,screenY=150,top=150,channelmode=0,dependent=1,directories=0,fullscreen=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0", "myWindow");

}





//This should be opened in a seperate window the same size as

//The name that number functionality. 370 (H) x 450 (W).

//Preferably this window will open over the center or right hand side of the page.



function launchLargeRemote(url) {

  myRemote = launch(url, "myRemote", "height=490,width=460,screenX=150,left=150,screenY=150,top=150,channelmode=0,dependent=1,directories=0,fullscreen=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0", "myWindow");

}

/* this popup function is used in the temporary page called International Recruitment */
function openPopUp(elem, param )
{
	try {
		var pos = elem.href.indexOf("=");
		var windowName = elem.href.substr(pos+1); //strip "applLinkOut.jsp?url="
		windowName = windowName.replace(/[^\w]/ig, "");//strip everything except a word
	}catch (error) {
		//do nothing
	}
	window.open(elem.href, windowName, param);
}