// JavaScript Document

var imageFolder = "images";
var dotAsia = new Array("manhattangroup.asia", "www.manhattangroup.asia");
var dotEu	= new Array("manhattangroup.eu", "www.manhattangroup.eu");

function login()
{
	disableBackground();
	setTimeout('showLoginBox()',100);
}


function disableBackground()
{
	var div = document.createElement("div");
	div.setAttribute("id","disablePlat");
	div.style.height = document.documentElement.scrollHeight+"px";
	document.body.appendChild(div);
}


function showLoginBox()
{
	var loginForm = "<form method='post' enctype='multipart/form-data' action='http://digital88.com.au/mgo/candidate/cand.php?login=1'><table cellpadding='0' cellspacing='0'><tr><th colspan='2'><table width='100%' cellpadding='0' cellspacing='0' style='padding:0px; margin:0px;'><tr><th width='10%'>&nbsp;</th><th>Login!</th><th width='10%' align='right'><img src='http://manhattangroup.com.au/images/cancel.gif' onclick='removeWindow(\"divForm\")' title='Close Window' /></th><tr></table></th></tr><tr><td class='heading'>Username:</td><td><input type='hidden' name='PHPSESSID' value='ed2d86b7ebae77ddc560e46fc582a8bd' /><input type='text' name='username' /></td></tr><tr><td class='heading'>Password:</td><td><input type='password' name='password' /></td></tr><tr><td class='button' colspan='2'><input type='submit' name='Login' value='Login' /></td></tr></table></form>";
	var formDiv = document.createElement("div");
	formDiv.setAttribute("id","divForm");
	formDiv.style.top =  (document.documentElement.clientHeight / 2) - 175 + "px";
	formDiv.style.left = (document.documentElement.clientWidth / 2) - 122 + "px";
	formDiv.innerHTML = loginForm;
	document.body.appendChild(formDiv);
}

var rootDir = "http://digital88.com.au/mgo/candidate/";
//var rootDir = "http://218.185.14.51/mgo/candidate/";
var theURL = "";

function register(url)
{
	disableBackground();
	theURL = rootDir+url;
	setTimeout('showIframe()',100);	
}

function popWindow()
{
	window.open(rootDir+'jobalert.php','Job Alert','location=1,status=1,scrollbars=0,width=300,height=250');	
}


function getFunctions(theDivId)
{
	var divFunction = document.createElement("div");
	divFunction.setAttribute("id","function");
	
	//Cancel
	var cancelButton = document.createElement("img");
	cancelButton.setAttribute("src", "http://manhattangroup.com.au/images/cancel.gif");
	cancelButton.onclick = new Function ("removeWindow('"+theDivId+"');");
	cancelButton.setAttribute("title", "Close Window");
	
	//Print
	var printButton = document.createElement("img");
	printButton.setAttribute("src", "http://manhattangroup.com.au/images/print.gif");
	printButton.onclick = new Function ("printWindow();");
	printButton.setAttribute("title", "Print");
	
	divFunction.appendChild(printButton);
	divFunction.appendChild(cancelButton);
	return divFunction;	
}

function removeWindow(someWindowId)
{
	var someWindow = document.getElementById(someWindowId);
	var disablePlat = document.getElementById("disablePlat");
	document.body.removeChild(someWindow);
	document.body.removeChild(disablePlat);
}

function printWindow()
{
	window.frames['goodIFrame'].print(); 
}

function showIframe()
{
	var iframe = document.createElement("iframe");
	var iframediv = document.createElement("div");
	iframe.setAttribute("id","goodIFrame");
	iframe.setAttribute("name","goodIFrame");
	iframediv.setAttribute("id","iframeDiv");
	//alert(theURL);
	iframe.setAttribute("src",theURL);
	iframe.setAttribute("frameborder","0");
	iframediv.style.top =  (document.documentElement.clientHeight / 2) - 225 + "px";
	iframediv.style.left = (document.documentElement.clientWidth / 2) - 375 + "px";
	var littleFunctions = getFunctions("iframeDiv");
	iframediv.appendChild(littleFunctions);
	iframediv.appendChild(iframe);
	document.body.appendChild(iframediv);
}

