//this variable to hold the iframe height
var if_height=0;
//get iframe source to keep tack when refresh the page
function getifsrc(){
	return document.getElementById("container").src;
}
//this function to resize the iframe container when page resize [called from flash]
function resizecontainer(height){
	document.getElementById("container").style.height= height+"px";
	//iframe height
	if_height=height;
	
	//resize bing map [mymap div] height
	//if(document.getElementById("container").contentWindow.myMap)
	var myMapdiv=window.frames['container'].document.getElementById('myMap');
	if(myMapdiv)
		myMapdiv.style.height=height+"px";
}
/********************************************************************/
//this function to resize the menu container so that not to disable items below it [called from flash]
function resizemenu(scale){
	if(scale == "up"){
		document.getElementById("menu_layer").style.height= "600px";
		//hide the iframe when hover menu.swf (this is for stupid firefox)
		if((navigator.userAgent).indexOf("Firefox") != -1){
			//document.getElementById("content_layer").style.display="none";
			document.getElementById("container").style.height="0px";
		}
	}
	else{
		document.getElementById("menu_layer").style.height= "150px";
		//show the iframe when hover menu.swf if the source is not blank .html i.e. there is a page displyed(this is for stupid
		//firefox)
		if((navigator.userAgent).indexOf("Firefox") != -1){
			if(document.getElementById("container").src != "http://localhost/adventure/blank.html")
				//document.getElementById("content_layer").style.display="block";
				document.getElementById("container").style.height=if_height;
		}
	}
}
/********************************************************************/
/*
				load pages into iframe - create two way connection
				
1-flash "menu.swf" connect javascript [call_loadpage()]
2-javascript "call_loadpage()" connect flash "main.swf" [call_flash_loadpage()]
3-flash "main.swf" connect javascript "loadpage()"
*/
function call_loadpage(pageurl) {
    thisMovie("main").call_flash_loadpage(pageurl);
}

function thisMovie(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[movieName]
    }
    else {
        return document[movieName]
    }
}
/********************************************************************/
//this function to load pages into iframe [called from flash]
function loadpage(pageurl){
	/*document.getElementById("content_layer").innerHTML="<iframe src='"+pageurl+"' name='container' id='container' width='624' marginwidth='0' height='448' marginheight='0' scrolling='auto' frameborder='0'></iframe>";*/
	if(!pageurl)
		pageurl="home.php";
	document.getElementById("container").src=pageurl;
	document.getElementById("content_layer").style.display="block";
}
/********************************************************************/
//this function to hide the current pages (to show home) [called from flash]
function hidepage(){
	document.getElementById("container").src="blank.html";
	document.getElementById("content_layer").style.display="none";
}
/*******************************************************************/
//reset the coords variable to be used as as global (var)
var coords="0,0";
//this function to get the mouse coordinates [called from flash]
function getMouseCoords(){
	return coords;
}
/******************************************************************/
function updateCoords(e){
	if(window.event){
		mouseX = event.clientX + document.body.scrollLeft;
		mouseX= mouseX>21? (mouseX-21):mouseX;
		mouseY = event.clientY + document.body.scrollTop;
	}else{
		mouseX = e.pageX;
		mouseX= mouseX>21? (mouseX-21):mouseX;
		mouseY = e.pageY;
	}
	coords = mouseX+","+mouseY;
}
document.onmousemove=updateCoords;

