//Launches Javascript Specific Size Windows.

//!-- Launches Help Window
// Uses a variable for the URL

function launchhelp(url) {
  self.name = "opener";
  remote = open(url, "help_window", "resizable,scrollbars,width=548,height=565");
}

//!-- Launches member only login Window
// Uses a variable for the URL

function launchlogin(url) {
  self.name = "main";
  remote = open(url, "login_window","width=430,height=360,left=200,top=150");
}

function launchmap(url) {
  self.name = "main";
  remote = open(url, "map_window","width=655,height=535,left=10,top=10");
}
function launchXWeb(url) {
var winl = (screen.width - 800) / 2;
//var wint = (screen.height - 600) / 4;
winprops = 'height=600,width=800,top=10,left='+winl+',scrollbars,resizable,menubar,toolbar'
win = window.open(url, "remote", winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}
function launchKB(url) {
var winl = (screen.width - 800) / 2;
//var wint = (screen.height - 600) / 4;
winprops = 'height=543,width=800,top=10,left='+winl+','
win = window.open(url, "remote", winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function launchCTaxemail() {
  self.name = "opener";
  remote = open('/servlets-prod/iWebStreamer2?page_id=7224', "email_window","width=467,height=370,left=50,top=50");
}

function launchEcomedia() {
  self.name = "opener";
  remote = open('/servlets-prod/iWebStreamer2?page_id=7393', "email_window","width=467,height=370,left=50,top=50");
}

function launchEcoOutlook() {
  self.name = "opener";
  remote = open('/servlets-prod/iWebStreamer2?page_id=7413', "email_window","width=467,height=370,left=50,top=50");
}

function launchEcobroadcasts() {
  self.name = "opener";
  remote = open('/servlets-prod/iWebStreamer2?page_id=7398', "email_window","width=467,height=370,left=50,top=50");
}

function launchmemberlogin(url) {
  self.name = "main";
  remote = open(url, "login_window", "width=430,height=180,left=200,top=200");
}

function launchcheck_login(currentWindow) {
	self.name = "main";
	var win = window.open("", "win","width=250,height=120,left=100,top=100"); // a window object
	var doc = win.document;
	doc.open("text/html", "replace");
	doc.write("<html><head><link rel='stylesheet' type='text/css' href='/Stylesheets/hia.css'>");
	doc.write("<title>HIA - Member Login</title>");
	doc.write("<script language='JavaScript'>");
	doc.write("function submitMemberForm(){");
	doc.write("document.MemberLogin.target = 'main';");
	doc.write("document.MemberLogin.method = 'post';");
	doc.write("document.MemberLogin.action = 'https://www.buildingonline.com.au/index.jsp?sitearea=members_login';");	
	doc.write("document.MemberLogin.submit();");
	doc.write("self.close();");
	doc.write("}");
	doc.write("</script>");
	doc.write("</head><body bgcolor='#F0F0F0' leftmargin='0' topmargin='0'>");
	doc.write("<table border='0' width='100%' cellspacing='0' cellpadding='0'><tr>");
	doc.write("<td colspan='2' class='title'><b>&nbsp;HIA Member Login</b></td></tr>");
	doc.write("<form name='MemberLogin'><input type = 'hidden' name = 'actionFlag' value = 'authenticate'>");
	doc.write("<input type = 'hidden' name = 'referer' value = ''><input type = 'hidden' name = 'redirect' value = " + currentWindow + ">");
	doc.write("<tr><td width='157'></td><td width='71'></td></tr>");
	doc.write("<tr><td width='157'></td><td width='71'></td></tr>");
	doc.write("<tr><td width='157' align='right'><p align='left'><b>&nbsp;HIA Member No:</b></p></td>");
	doc.write("<td width='71'><input type = 'text' name = 'un' size='10' maxlength='10' tabindex='1'></td></tr>");
	doc.write("<tr><td width='157' align='right'><p align='left'><b>&nbsp;Password:</b></p></td>");
	doc.write("<td width='71'><input type = 'password' name = 'pw' size='10' tabindex='2'></td></tr>");
	doc.write("<tr><td width='157'></td><td width='71'></td></tr><tr>");
	doc.write("<td colspan='2'><a href='javascript:submitMemberForm()'><img border='0' src='/hia/images/buttons/Member%20Login.gif' width='113' height='20' tabindex='3'></a></td></tr>");
	doc.write("</form></table></body></html>");
  	doc.close;
}

//!-- Launches the login Window
// Uses a variable for the URL

function launchlogin(url) {
  self.name = "main";
  remote = open(url, "login_window","width=430,height=360,left=200,top=150");
}

//!-- Launches a PDF Window
// Uses a variable for the URL

function launchpdf(url) {
  self.name = "main";
  remote = open(url, "pdf_window", "width=500,height=500,resizable,scrollbars,left=10,top=10");
}

//!-- Launches Security Information Window
// URL is hardcoded

function opensecurity() {
  self.name = "opener";
  remote = open("hia_security.html", "Security", "width=453,height=453");
}

//!-- Launches Store,Training and Events Information Windows
// Uses a variable for the URL

function launchinfo(url) {
	self.name = "main"; // names current window as "main"
	var windowopt = "resizable,scrollbars,width=755,height=600,left=10,top=10";
	OpenWindow = window.open(url, "remote", windowopt); // opens remote control
}

//!-- Launches HIA Specific Terms of Use of this Website.
// Uses a variable for the URL

function launchterms(url) {
  self.name = "terms";
  remote = open(url, "terms_of_use", "resizable,scrollbars,width=515,height=470");
}


//!-- Reloads the window if Nav4 resized (Bug with Netscape)
function MM_reloadPage(init) {  
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);


function launchMoreInfo(url) {
  self.name = "main";
  remote = open(url, "remote", "scrollbars,resizable,width=400,height=400");
}

function launchwin(url) {
	self.name = "main"; // names current window as "main"
	var windowopt = "width=802,height=570,left=0,top=0";
	OpenWindow = window.open(url, "remote", windowopt); // opens remote control
}

function launchab(url) {
	self.name = "main"; // names current window as "main"
	var windowopt = "width=585,height=500,left=0,top=0";
	OpenWindow = window.open(url, "remote", windowopt); // opens remote control
}

function launchabSpon(url) {
	self.name = "main"; // names current window as "main"
	var windowopt = "width=585,height=425,left=0,top=0";
	OpenWindow = window.open(url, "remote", windowopt); // opens remote control
}

function launchXMap(url) {
	self.name = "main"; // names current window as "main"
	var windowopt = "width=1000,height=605,left=0,top=0,scrollbars";
	OpenWindow = window.open(url, "remote", windowopt); // opens remote control
}

function startPoll() {
	openCenteredWindow("http://polls.buildingonline.com.au/doors/intro.asp", "0.75", '0.75','favouritedoorpoll','status=no,menu=no,scrollbars=yes,resizeable=yes');
}
function startFavoriteDoorPoll() {
	openCenteredWindow("http://polls.buildingonline.com.au/doors/intro.asp", "0.75", '0.75','favouritedoorpoll','scrollbars,resizeable');
}

function openCenteredWindow(url, height, width, name, parms) {
	if (height <= 1) { height = Math.floor(screen.height * height); }
   	if (width <= 1) { width = Math.floor(screen.width * width); }
	var left = Math.floor( (screen.width - width) / 2);
	var top = Math.floor( (screen.height - height) / 2);
	var winParms = "top=" + top + ",left=" + left + ",height=" + height + ",width=" + width;
	if (parms) { winParms += "," + parms; }
	var win = window.open(url, name, winParms);
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
	return win;
}

function openBPNApp(url, height, width, name, parms) {
	if (height <= 1) { height = Math.floor(screen.height * height); }
   	if (width <= 1) { width = Math.floor(screen.width * width); }
	var left = Math.floor( (screen.width - width) / 2);
	var winParms = "top=0,left=" + left + ",height=" + height + ",width=" + width;
	if (parms) { winParms += "," + parms; }
	var win = window.open(url, name, winParms);
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
	return win;
}
