﻿
function hideImage(id){
    document.getElementById(id).style.display="none";
}

function showImage(id){
    document.getElementById(id).style.display="inline";
}

function hidediv(id) {
    if (document.getElementById) { // DOM3 = IE5, NS6
    document.getElementById(id).style.visibility = 'hidden';
    }else {
        if (document.layers) { // Netscape 4
            document.hideShow.visibility = 'hidden';
        }
        else { // IE 4
            document.all.hideShow.style.visibility = 'hidden';
        }
    }
}

function showdiv(id) {
    if (document.getElementById) { // DOM3 = IE5, NS6
        document.getElementById(id).style.visibility = 'visible';
    }else {
        if (document.layers) { // Netscape 4
            document.hideShow.visibility = 'visible';
        }
        else { // IE 4
            document.all.hideShow.style.visibility = 'visible';
        }
    }
}

function changeTab(showTab, imgActive, hideTab, imgUnactive)
{
	if(showTab=="divaboutMPESA" || showTab=="divaboutGLOBE")
    {
        document.getElementById("tabImg1").src = imgActive;
        document.getElementById("tabImg2").src = imgUnactive;
    }
    else if(showTab=="divfqa")
    {
        document.getElementById("tabImg2").src = imgActive;
        document.getElementById("tabImg1").src = imgUnactive;
    }
	document.getElementById(hideTab).style.display="none";
	document.getElementById(showTab).style.display="block";
} 

function launch(url)
{
    window.location.href = url;
}
function getposOffset(what, offsettype){
    var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
    var parentEl=what.offsetParent;
    while (parentEl!=null){
        totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
        parentEl=parentEl.offsetParent;
    }
    return totaloffset;
}
function show_ajax_wait(obj,dv_ajax_wait_id){
    var left = getposOffset(obj, "left")+obj.offsetWidth + 5;
	var top = getposOffset(obj, "top") - 5;
	var dv = document.getElementById(dv_ajax_wait_id);
	var px = "px";
	//var browser=navigator.appName;
	//if(browser == "Microsoft Internet Explorer"){
	//	px = "";	
	//}
	dv.style.left = left + px;
	dv.style.top = top + px;
}

function showThumbHome(idThumbnailBg, idThumbnail)
{	
//	var heightScreen = document.body.scrollHeight;
//	var widthScreen = document.body.clientWidth;
//    var clientheight = document.body.clientHeight;
//	popup   = document.getElementById(idThumbnail);	
//	popupBg = document.getElementById(idThumbnailBg);
	frame = document.getElementById("frameThumb");
	
	
//	popupBg.style.top      	= 0;
//	popupBg.style.left     	= 0;
//	popupBg.style.display  	= "block";	
//	popupBg.style.width	 	= widthScreen;
//	popupBg.style.height	= heightScreen;
//	popup.style.top      = getScrollXY()[1] + ClientScreen()[1]/3;
//	//popup.style.top      = heightScreen/2;
//	popup.style.left     = widthScreen/2 - 250;
//	popup.style.display  = "block";	
	var offsetTrail;
	
//    window.scroll(0,heightScreen/3);	
	offsetTrail = document.getElementById("ctl00_ddlCity");
	if(!offsetTrail){
	    offsetTrail = document.getElementById("ddlCity");
	}


	if(offsetTrail){
         var offsetLeft = 0;
         var offsetTop = 0;
         while (offsetTrail) {
             offsetLeft += offsetTrail.offsetLeft;
             offsetTop += offsetTrail.offsetTop;
             offsetTrail = offsetTrail.offsetParent;
         }
    	
	    frame.style.top      = offsetTop;
	    frame.style.left     = offsetLeft;
	    frame.style.display  = "block";	
	}
	

}

//Close Tip
function closeThumbnail(idThumbnailBg, idThumbnail)
{
//	document.getElementById(idThumbnail).style.display = "none";
//	document.getElementById(idThumbnailBg).style.display = "none";
	document.getElementById("frameThumb").style.display = "none";
}

function getScrollXY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return [ scrOfX, scrOfY ];
}

function ClientScreen() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
//  window.alert( 'Width = ' + myWidth );
//  window.alert( 'Height = ' + myHeight );
  return [ myWidth, myHeight ];
}
