// JavaScript Document
function go_subsubType(targetId) {
	obj=document.getElementById(targetId);
	if(obj.className=="on") 
		obj.className="off";
	else
		obj.className="on";
}

function onLoad(){

}

function openPopup(movieURL, movieWidth, movieHeight) {
	var width = movieWidth;// + 50;
	var height = movieHeight;// + 18;
	
	var winl = (screen.width - width) / 2;
	var wint = (screen.height - height) / 2;
	var winprops = 'height='+height+',width='+width+',top='+wint+',left='+winl+',location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,fullscreen=no';	
	var newwindow = window.open(movieURL, '', winprops);
	
	if (window.focus) {newwindow.focus()}
	return false;
}

function Show_OneLayer2(GroupName, Total, LayerID) {
	var targetId;

	targetId = GroupName + LayerID;
	
	document.getElementById(targetId).style.display = 'block';
	
	for (var i=1; i<Total+1; i++) {
		if (i != LayerID)
		{
			targetId = GroupName + i;
			document.getElementById(targetId).style.display = 'none';
		}
	}
}

function Show_OneLayer(GroupName,CloseGroup, Total, LayerID) {
	var targetId;
	var closeId;
	var targetId_bg;
	var targetId_fg;
	
	var menuobj3=ie5? document.all.popitmenu_bg_pic : document.getElementById("popitmenu_bg_pic")
	//	alert(GroupName + " " + CloseGroup + " " + Total + " " + LayerID);
	menuobj3.style.visibility="visible"
	//menuobj3.innerHTML='<p class="plusclass"></p>'
	menuobj3.style.left=14+"px"

	targetId = GroupName + LayerID;
	targetId_bg = targetId + '_bg';
	targetId_fg = targetId + '_fg';
	closeId = CloseGroup + LayerID;
	document.getElementById(targetId).style.display = 'block';
	document.getElementById(closeId).style.display = 'block';
	document.getElementById(targetId_bg).style.display = 'block';
	document.getElementById(targetId_fg).style.display = 'block';
	
	var coord = document.getElementById("popup"+LayerID).offsetTop;
	coord +=45; //28
	
	var tempHeight = ((250 - document.getElementById(targetId).height)/2) + coord + 6;
	var tempLeft = 16 + ((250 - document.getElementById(targetId).width)/2);
	
	if((coord+250) > document.body.clientHeight){
		coord = document.body.clientHeight - 255;
		tempHeight = ((250 - document.getElementById(targetId).height)/2) + coord;
		document.getElementById(targetId).style.top = tempHeight+'px';
		document.getElementById(targetId).style.left = tempLeft+'px';
		coord+=4;
		menuobj3.style.top=coord+'px';
		document.getElementById(closeId).style.top = coord+'px';
		
		document.getElementById(targetId_bg).style.top = coord+2+'px';
		document.getElementById(targetId_fg).style.top = coord+'px';
	}
	else{
		document.getElementById(targetId).style.top = tempHeight+'px';
		document.getElementById(targetId).style.left = tempLeft+'px';
		coord+=4;
		menuobj3.style.top=coord+'px';
		document.getElementById(closeId).style.top = coord+'px';
		
		document.getElementById(targetId_bg).style.top = coord+2+'px';
		document.getElementById(targetId_fg).style.top = coord+'px';
	}

	for (var i=1; i<Total+1; i++) {
		if (i != LayerID)
		{
			targetId = GroupName + i;
			closeId = CloseGroup + i;
			targetId_bg = targetId + '_bg';
			targetId_fg = targetId + '_fg';
			document.getElementById(targetId).style.display = 'none';
			document.getElementById(closeId).style.display = 'none';
			document.getElementById(targetId_bg).style.display = 'none';
			document.getElementById(targetId_fg).style.display = 'none';
		}
	}
}


function Hide_OneLayer(GroupName, CloseGroup, Total, LayerID) {
	var targetId;
	var targetId_bg;
	var targetId_fg;
	var closeId;

	targetId = GroupName + LayerID;
	targetId_bg = targetId + '_bg';
	targetId_fg = targetId + '_fg';
	closeId = CloseGroup + LayerID;
	
	document.getElementById(targetId).style.display = 'none';
	document.getElementById(targetId_bg).style.display = 'none';
	document.getElementById(targetId_fg).style.display = 'none';
	document.getElementById(closeId).style.display = 'none';
}

function Show_access(GroupName, CloseGroup, Total, LayerID) {
	var targetId;
	var closeId;

	targetId = GroupName + LayerID;
	closeId = CloseGroup + LayerID;
	
	document.getElementById(targetId).style.display = 'block';
	document.getElementById(closeId).style.display = 'block';
}

function openMoviePopup(movieURL, movieWidth, movieHeight) {
	var width = movieWidth + 50;
	var height = movieHeight + 50;
	var playerHeight = movieHeight + 15;
	
	var winl = (screen.width - width) / 2;
	var wint = (screen.height - height) / 2;
	var winprops = 'height='+height+',width='+width+',top='+wint+',left='+winl+',location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,fullscreen=no';	
	var newwindow = window.open('', 'movie', winprops);
	var doc = newwindow.document;
	doc.writeln('<html>');
	doc.writeln('<head>');
	doc.writeln('<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">');
	doc.writeln('<title>UNHCR - Against All Odds - Factual Web</title>');
	doc.writeln('</head>');
	doc.writeln('<body bgcolor="black">');
	doc.writeln('<center>');	
	doc.writeln('<object width="'+movieWidth+'" height="'+playerHeight+'" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab">');
	doc.writeln('<param name="src" value="'+movieURL+'">');
	doc.writeln('<param name="autoplay" value="true">');
	doc.writeln('<param name="controller" value="true">');
	doc.writeln('<embed src="'+movieURL+'" width="'+movieWidth+'" height="'+movieHeight+'" autoplay="true" controller="false" pluginspage="http://www.apple.com/quicktime/download/"></embed>');
	doc.writeln('</object>');
	doc.writeln('</center>');
	doc.writeln('</body>');
	doc.writeln('</html>');
	if (window.focus) {newwindow.focus()}
	return false;
}


// JavaScript Document
function menuOn(imgName, imgNumber) {
	if (document.images) {
		imgOn=eval("menu" + imgNumber + "on.src");
		document[imgName].src= imgOn;
	}
}

function menuOff(imgName, imgNumber) {
	if (document.images) {
		imgOff=eval("menu" + imgNumber + "off.src");
		document[imgName].src= imgOff;
	}
}


function openGameWindow(tUrl, tName) {
	var tWindowName= (tName == undefined) ? "mainwindow" : tName;
	
	var agnt = navigator.userAgent.toLowerCase();
	var theVersion = parseFloat(navigator.appVersion);
	var isOpera = (navigator.appName=="Opera") ? 1:0
	var ie = (document.all && !isOpera) ? 1:0
	var ie4 = (navigator.userAgent.indexOf("MSIE 4")>-1) ? 1:0
	var ns4 = (navigator.appName=="Netscape" && theVersion<5) ? 1:0;
	var ns6 = document.getElementById && !document.all;
	var isWin = ((navigator.appVersion.indexOf('Windows')!=-1) && (navigator.appVersion.indexOf('3.1')==-1));
	var isNs = (ns4 || ns6);
	var isMac = (navigator.appVersion.indexOf('Mac') != -1);
	var isW3C = (document.getElementById && !ie) ? 1:0
	var havePluginJsSupport = ((ie && isWin) || ns4);

	var width, height,x,y;
	width = (screen.availWidth?screen.availWidth:800) -10;
	height= (screen.availHeight?screen.availHeight:600) - 28;
	x=0;
	y=0;
	if(isMac){
		if(isNs){
			height +=40;
			//height=screen.height-45
			width += 10;
		}else{
			width += 10;
			height += 6;
		}
	}else{
		x=-1;
		y=-3;
		if(ns6){
			width +=4;
			height +=2;
		}
	}
	
	fullWin = window.open(tUrl,tWindowName,"left="+x+"0,top="+y+",width=" + width + ",height=" + height + ",fullscreen=no,scrollbars=no,resizable=yes,menubar=no,toolbar=no");
	fullWin.moveTo(x,y);
	if(fullWin && isMac && fullWin.moveTo && fullWin.resizeTo){
		fullWin.moveTo(x,y);
		fullWin.resizeTo(width,height);
		fullWin.focus();
	}
		//self.location = "newlocation";
}
// JavaScript Document

var defaultMenuWidth="150px" //set default menu width.

////No need to edit beyond here

var ie5=document.all && !window.opera
var ns6=document.getElementById

if (ie5||ns6){
document.write('<div id="popitmenu" onMouseover="clearhidemenu();" onMouseout="dynamichide(event)"></div>')
document.write('<div id="popitmenu_bg"></div>')
document.write('<div id="popitmenu_bg_pic"></div>')
}

function iecompattest(){
return (document.compatMode && document.compatMode.indexOf("CSS")!=-1)? document.documentElement : document.body
}

function apa(){
	//alert("tjoho")
}

function showmenu(which, optWidth,LayerID, layerName){
if (!document.all&&!document.getElementById)
return
clearhidemenu()
var menuobj=ie5? document.all.popitmenu : document.getElementById("popitmenu")
var menuobj2=ie5? document.all.popitmenu_bg : document.getElementById("popitmenu_bg")
menuobj.innerHTML='<div><p>' + layerName + '</p> <img src="images/btn_layer_close_white.gif" onclick="hidemenu2()" width="7" height="7" /></div><p>'+which+'</p>' //<p class="plusclass">'+which+'</p>'
menuobj.style.width=(typeof optWidth!="undefined")? optWidth : defaultMenuWidth
menuobj.contentwidth=menuobj.offsetWidth
menuobj.contentheight=menuobj.offsetHeight
menuobj.style.left=230+"px"
menuobj.style.top=document.getElementById("popup"+LayerID).offsetTop+60+"px" //215  document.getElementById("popup_layer"+LayerID).offsetTop

alert(menuobj.contentheight + " " + menuobj.offsetHeight);
menuobj2.innerHTML='<div><p></p></div><p></p>' //<p class="plusclass"></p>'
//alert(menuobj2.style.width)
var defaultMenuWidth2=menuobj.contentheight-85+"px";
var optWidth2=menuobj.contentheight-85+"px";
alert(optWidth2);
menuobj2.style.width=(typeof optWidth!="undefined")? optWidth : defaultMenuWidth
menuobj2.style.height=(typeof optWidth2!="undefined")? optWidth2 : defaultMenuWidth2
menuobj2.contentwidth=menuobj2.offsetWidth
menuobj2.contentheight=menuobj2.offsetHeight
menuobj2.style.left=230+"px"
menuobj2.style.top=document.getElementById("popup"+LayerID).offsetTop+66+"px" //215  document.getElementById("popup_layer"+LayerID).offsetTop
menuobj2.contentheight=menuobj.offsetHeight;
//alert(menuobj2.style.left + " " + menuobj2.contentwidth + " " + menuobj2.offsetWidth);

//menuobj2.contentheight = 900;
//menuobj2.offsetWidth = 900;

var coord = menuobj.offsetTop;
if((coord+menuobj.offsetHeight) > document.body.clientHeight){
	//alert(menuobj2.style.top);
	//menuobj.style.top = document.body.clientHeight - menuobj.offsetHeight - 30+"px";
	//menuobj2.style.top = document.body.clientHeight - menuobj.offsetHeight - 24+"px";
	//alert(menuobj2.style.top);
}

coord = menuobj2.offsetTop;
if((coord+menuobj2.offsetHeight) > document.body.clientHeight){
	//alert(coord);
	//menuobj.style.top = document.body.clientHeight - menuobj2.offsetHeight - 30+"px";
	//menuobj2.style.top = document.body.clientHeight - menuobj2.offsetHeight - 24+"px";
}

menuobj.style.visibility="visible"
menuobj2.style.visibility="visible"

return false
}

function contains_ns6(a, b) {
//Determines if 1 element in contained in another- by Brainjar.com
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function hidemenu(){
if (window.menuobj)
menuobj.style.visibility="hidden"
}

function dynamichide(e){

}

function clearhidemenu(){
if (window.delayhide)
clearTimeout(delayhide)
}
