
var NS4 = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) >=4);
_show = (NS4) ?"show" : "visible";
_hide = (NS4) ?"hide" : "hidden";
var TableHight = ((CountryList.length/3)*12)+50;

function world_up(_pos,top_pos){
x  = _pos-10;
map_top = top_pos;
worldmap = getLayer('world');
continent = getLayer('asia');
	worldmap.top = x;
	if(x > map_top) setTimeout("world_up(x,map_top)",5);
	else{
		document.loaded = true;
		continent.top = worldmap.top;
	}//End if
}//End func

function world_down(pos,bottom){
x=pos+10;
b=bottom;
worldmap = getLayer('world');
Continent = getLayer('asia');
worldmap.top = x;
Continent.visibility = _hide;
	if(x < b) setTimeout("world_down(x,b)",5);
	else{
		worldmap.visibility = _hide;
		worldmap.top = 0;
		document.loaded = false;
	}//end if
}//End func


function ShowHide_Office(mode,Obj){

var Country = getCountry(Obj,CountryList);

Obj = Obj.toLowerCase();
getLayer(Obj).left = parseInt(getLayer('world').left)+100;

var LayerTop = parseInt(getLayer(Obj).top);
var RowDown = parseInt(LayerTop)+5;

var LayerLeft = parseInt(getLayer(Obj).left)+3;

RowMax =(NS4)?innerHeight-20 : document.body.clientHeight-20;

getLayer(Obj).visibility = mode;

for(i=0;i<Country.length;i++){
	if(RowDown > RowMax) LayerLeft =(NS4)?LayerLeft+118: LayerLeft+120;
	RowDown = (RowDown < RowMax)?(RowDown+=12) : (LayerTop+17);
	Val = getLayer(Country[i][0]);
	Val.top =  RowDown;
	Val.left = LayerLeft;
	Val.visibility = mode;
}//End for
}//End f

function getCountry(Obj,Val){
var SelObj= new Array();
for(i=0;i<Val.length;i++) if(Val[i][2] == Obj) SelObj[SelObj.length] = Array(Val[i][0],Val[i][1]);
return SelObj;
}//End f

function getLayer(Layer){
	if(NS4) return document.layers[Layer];
	else return document.all[Layer].style;
}//End f

function swapbackground(Obj,Mode){
if(NS4) getLayer(Obj).background.src =(Mode=='show')? "images/gray.gif" : "images/clear.gif";
else getLayer(Obj).background = (Mode=='show')? "#CCCCCC" : "";
}//End f

function AA_world(){

var map_pos = (NS4)? innerHeight : document.body.clientHeight;
var map_top = map_pos-280;
var worldmap = getLayer('world');
	if(typeof document.loaded=="undefined" || document.loaded==false){
		getLayer('world').top = map_top;
		getLayer('world').left = 200;
		getLayer('world').visibility = _show;
		world_up(map_pos,map_top);
	}else{
		world_down(map_top,map_pos);
		ShowHide_Office(_hide,'Asia');
	}//End if
}//End func


function InitLayer(){
var ValObj = new Array('world','asia');

document.writeln('<div id="'+ValObj[0]+'" class="popup">');
document.writeln('<img src="images/world.gif" width="396" height="283" border="0" usemap="#map_down">');
document.writeln('</div>');

document.writeln('<div id="'+ValObj[1]+'" class="popup">');
document.writeln('<table width="360" border="1" cellspacing="0" cellpadding="0">');
document.writeln('<tr bgcolor="#CCCCCC"><td class="ne" colspan="3"><b>Asia</b></td></tr>');
document.writeln('<tr bgcolor="#FFFFFF"><td class="ne" height="'+TableHight+'" width="120">&nbsp;</td>');
document.writeln('<td class="ne" height="'+TableHight+'" width="120">&nbsp;</td>');
document.writeln('<td class="ne" height="'+TableHight+'" width="120">&nbsp;</td></tr>');
document.writeln('</table>');
document.writeln('</div>');

getLayer('asia').height = TableHight;
var Continent = getCountry('Asia',CountryList);

for(i=0;i<Continent.length;i++){
	document.writeln('<div id="'+Continent[i][0]+'" class="popup">');
	document.writeln('<table width="116" border="0" cellspacing="0" cellpadding="0"><tr><td class="ne">');
	document.writeln('<a href="JavaScript:getContact(\''+Continent[i][0]+'\')" class="ne" onMouseover="swapbackground(\''+Continent[i][0]+'\',\'show\');MM_displayStatusMsg(\''+Continent[i][1]+'\')" onMouseout="swapbackground(\''+Continent[i][0]+'\',\'hide\')">');
	document.writeln(Continent[i][1]+'</a>');
	document.writeln('</td></tr></table>');
	document.writeln('</div>');
}//End for


}//End f

function MM_Init(){
if(document.loaded){
	if(!NS4){
		document.loaded = false;
		document.all['world'].style.top =document.body.clientHeight;
		document.all['world'].style.visibility =_hide;
		ShowHide_Office(_hide,'Asia');
	}//End if
	
}//end if
}//End

function SaveCookie(name,value,hr){
   var expire=new Date()
   expire.setTime(expire.getTime()+(60*1000)*hr)
	document.cookie=name+'='+escape(value)+';path=/'+((expire==null)?'':';expires='+expire.toGMTString())
}//End Func

function getContact(Val){
var officeURL = "./office_info.php?office_code="+Val;
winName = 'openOffice';
features = (NS4)?'width=350,height=450' : 'width=350,height=410';

	SaveCookie('AA_Office_Code',Val,0.8);
	window.open(officeURL,winName,features);
}//End func

