// JavaScript Document
<!--
//Brower Support-->NS4+, IE4+, Mozilla1+, Opera6+

//initialize variables
var timerID=null;
var offImgName=null;
var offImg=null;
var offElement=null;
var navFlag=0;
var divFlag=0;
var wait=80;
var preloadFlag=false;
var IEfade=0;			//Set to 0 for no fade on IE+
var operaFlag=0;

//Check browser type and version
var isDOM = (document.getElementById) ? true : false;
var isIE4 = (document.all) ? true : false;
var isNS4 = (document.layers) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") !=-1);


//Opera6 resize fix for positioned elements
function loadHandler() {
	if(isOpera && navigator.userAgent.indexOf("Opera 6") != -1) {
		origWidth = this.innerWidth;
		origHeight = this.innerHeight;
		resizeHandler();
	}
}

function resizeHandler() {
	if(this.innerWidth != origWidth || this.innerHeight != origHeight)
		location.reload();
	setTimeout('resizeHandler()',500);
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function swapImage() {
	if (document.images && (preloadFlag == true)) {	    
		alert(document[swapImage.arguments[0]].src);
	}
}

function mouseOnNav(imgname, img, element) {
	clearTimeout(timerID);
	navFlag=1;
	if(offElement != null && element != offElement)
		showMenu(offElement,false);
	if((offImgName != null && offImg != null) && imgname != offImgName)
		swapImage(offImgName, offImg);
	if(!divFlag || imgname != offImgName) {
		swapImage(imgname, img);
		showMenu(element,true);
	}
}

function mouseOffNav(imgname, img, element) {
	navFlag=0;
	offImgName = imgname;
	offImg = img;
	offElement = element;
	var mouseOverWait = "swapImage('" + imgname + "','" + img + "'); showMenu('" + element + "',false); divFlag=0;";
	timerID=setTimeout(mouseOverWait, wait);
}

function showMenu(element,state) {
	if (isNS4) {
		var current_element = eval("document." + element);
		current_element.visibility = (state) ? "show" : "hide";
	}
	else if(isOpera) {
		var current_element = element;
		current_element = document.getElementById(current_element);
		current_element.style.visibility = (state) ? "visible" : "hidden";
	}
	else if (isIE4) {
		var current_element = eval(element);
		if(IEfade) {
			if(current_element.filters.blendTrans.status != .99) {
				alert("a");
				current_element.filters.blendTrans.apply();
				current_element.style.display = (state) ? "block" : "none";
				current_element.filters.blendTrans.play();
			}
		}
		else{
			current_element.style.display = (state) ? "block" : "none";
		}
	}
	else if (isDOM) {
		var current_element = element;
		current_element = document.getElementById(current_element).style;
		current_element.display = (state) ? "block" : "none";
	}
}

function mouseOnDiv() {
	divFlag=1;
	clearTimeout(timerID);
}

function mouseOffDiv() {
	var setTimerStuff = "checkState(); divFlag=0;";
	timerID=setTimeout(setTimerStuff, wait);
}

//Check rollover state for NS4 event bug
function checkState() {
	if(!navFlag) {
		swapImage(offImgName, offImg);
		showMenu(offElement, false);
	}
}

var wt = screen.width+60;
var wta = screen.width+110;
//var wta = screen.width
function setAmericaDiv(w){
	  
		w = w-1024 ;
		wt = w/2 ;
		wt = wt + 271 ;
}


function setAsiaDiv(w){

	w = w -1024;
	wta = w * 0.664;
	
   	wta = wta + 510 ;
}
	
	
//Check to position layers properly for Opera6 browsers
if((!isOpera && !operaFlag) || (isOpera && operaFlag)) {

	if(wt > 1024){
		
		setAmericaDiv(wt);
		
	}
	else{
		wt = 270 ;
	}
	
	if(wta > 1024){
		
		setAsiaDiv(wta);
		
	}
	else{
		wta = 535 ;
	}
	<!--alert(wt); -->
//Start America Region
	if(isNS4)
		document.write('<layer name="americaDiv" visibility="hide" top="410px" left="'+wt+'px" onMouseOver="javascript:mouseOnDiv();" onMouseOut="javascript:mouseOffDiv();">');
	else
		document.write('<div id="americaDiv" style="position:absolute;z-index:999;display:none; top:410px; left:'+wt+'px;filter:blendTrans(duration=.99);" onMouseOver="javascript:mouseOnDiv();" onMouseOut="javascript:mouseOffDiv();">');
	
	document.write('<table cellpadding="4" cellspacing="0" border="0" width="236" height="305">');
	document.write('		<tr>');
	document.write('			<td background="../images/location/american_region.jpg">');
	document.write('				<table cellpadding="2" cellspacing="0" border="0" width="100%">');
	document.write('					<tr><td colspan="2" class="text" align="center"><b>America Region</b></td></tr>');
	document.write('					<tr><td colspan="2" height="10"></td></tr>');
	document.write('					<tr><td colspan="2" class="location_country"><b>USA</b></td></tr>');
	document.write('					<tr><td width="15"></td><td><a class="location_text" href="javascript:sndReq(\'corporate-headquater.html\');mouseOffNav(\'americaNav\',\'../images/location/american_region.jpg\',\'americaDiv\')">Corporate Headquarters</a></td></tr>');
	document.write('					<tr><td width="15"></td><td><a class="location_text" href="javascript:sndReq(\'new-york-office.html\');mouseOffNav(\'americaNav\',\'../images/location/american_region.jpg\',\'americaDiv\')">New York</a></td></tr>');
	document.write('					<tr><td colspan="2" class=location_country><b>Canada</b></td></tr>');
	document.write('					<tr><td width="15"></td><td><a class="location_text" href="javascript:sndReq(\'canada-office.html\');mouseOffNav(\'americaNav\',\'../images/location/american_region.jpg\',\'americaDiv\');">Toronto</a></td></tr>');
	document.write('					<tr><td colspan="2" height="120"></td></tr>');
	document.write('				</table>');
	document.write('			</td>');
	document.write('		</tr>');
	document.write('	</table>');

	if(isNS4)
		document.write('</layer>');
	else
		document.write('</div>');
//End America Region
	
//Start Asia Region
	
	if(isNS4)
		document.write('<layer name="asiaDiv" visibility="hide" top="410px" left='+wta+'px" onMouseOver="javascript:mouseOnDiv();" onMouseOut="javascript:mouseOffDiv();">');
	else
		document.write('<div id="asiaDiv" style="position:absolute;z-index:999;display:none; top:410px; left:'+wta+'px; filter:blendTrans(duration=.99);" onMouseOver="javascript:mouseOnDiv();" onMouseOut="javascript:mouseOffDiv();">');
	
	document.write('<table cellpadding="4" cellspacing="0" border="0" width="176" height="305">');
	document.write('		<tr>');
	document.write('			<td background="../images/location/asian_region.jpg">');
	document.write('				<table cellpadding="2" cellspacing="0" border="0" width="100%">');
	document.write('					<tr><td colspan="2" class="text" align="center"><b>Asia Pacific</b></td></tr>');
	document.write('					<tr><td colspan="2" height="15"></td></tr>');
	document.write('					<tr><td colspan="2" class=location_country><b>Bangladesh</b></td></tr>');
	document.write('					<tr><td width="5"></td><td><a class="location_text" href="javascript:sndReq(\'development-center.html\');mouseOffNav(\'asiaNav\',\'../images/location/asian_region.jpg\',\'asiaDiv\');">Dhaka</a></td></tr>');
	document.write('					<tr><td colspan="2" height="120"></td></tr>');
	document.write('				</table>');
	document.write('			</td>');
	document.write('		</tr>');
	document.write('	</table>');
	if(isNS4)
		document.write('</layer>');
	else
		document.write('</div>');
//End Asia Region

}
operaFlag++;
