	
var status="";

//-------------------------------------------------
// Begin, added on 2007-10-24
//        For handling layer cover IE controls problem.
function DivSetVisible(state) 
{ 
    var DivRef = document.getElementById('topMenuQuick'); 
    var IfrRef = document.getElementById('DivShim'); 
  if(IfrRef != null)
  {
    if(state) 
    {
//        IfrRef.style.width = DivRef.offsetWidth; 
//        IfrRef.style.height = DivRef.offsetHeight; 
//        IfrRef.style.top = DivRef.style.top; 
//        IfrRef.style.left = DivRef.style.left; 
        IfrRef.style.width = "390px"; 
        IfrRef.style.height = "228px"; 
        IfrRef.style.top = "50px"; 
        IfrRef.style.left = "450px";

	DivRef.style.zIndex = 200;
        IfrRef.style.zIndex = DivRef.style.zIndex - 20; 
        IfrRef.style.display = "block"; 
    } 
    else 
    { 
        IfrRef.style.display = "none"; 
    } 
  }
}
// End, added on 2007-10-24
//-------------------------------------------------

	

function menuoperate(i1){

		//if status=="", then open the required menu

		//alert(i1);

	
	if (status==""){

			menuopen(i1);

			status=i1;


//			return;
		}
 else if (status!=i1){
 //if status!=i1, means one menu opened, another need open.

		

			menuclose(status);

			menuopen(i1);

		

		

			status=i1;


//			return;

		}
 else if (status==i1){ // if status==i1..... means one menu onclick again
		

			menuclose(i1);

			status="";

//			return;

		}

//sleep(1000);
//DivSetVisible(true);
	
}

// this is for top menu original size:
/*$("#topMenuQuick").hide();
			$("#topMenuComment").hide();
			$("#topmenube").hide();
			$("#topMenuSearch").animate({
 			  height: 'toggle', opacity: 'toggle'
			 }, 500);*/
var widths;
var heights;
widths=new Array();
heights=new Array();


widths["#topMenuQuick"]=680;
widths["#topmenube"]=520;
widths["#topMenuSearch"]=270;
heights["#topMenuQuick"]=280;
heights["#topmenube"]=38;
heights["#topMenuSearch"]=66;



// all menu have width/height
	// when status close, menu =menu * 0.5
	// when status open, menu= menu*2


function menuopen(i1){

	//if ($(i1).css("display")=='none'){

		//var widths=parseInt($(i1).css("width"));

		//var heights=parseInt($(i1).css("height"));

		//widths=widths*2;

		//heights=heights*2;

		//alert(widths+"_"+heights);

		//widths=500;

		//heights=500;

		$(i1).animate({

  			width: widths[i1], height: heights[i1],  opacity: 'show'
 
 		}, 500);

		//t=setTimeout('$("'+i1+'").css({width: "'+widths+'", height: "'+heights+'"});', 1000);

	//}

//-------------------------------------------------
// Begin, added on 2007-10-24
//        For handling layer cover IE controls problem.
DivSetVisible(true);
// End, added on 2007-10-24
//-------------------------------------------------
}




function menuclose(i1){

	//if ($(i1).css("display")=='inline'){

		//var widths=parseInt($(i1).css("width"));

		//var heights=parseInt($(i1).css("height"));

		www=widths[i1];

		hhh=heights[i1];

		widthss=parseInt(www/2);

		heightss=parseInt(hhh/2);

		$(i1).animate({

  			width: widthss, height: heightss,  opacity: 'hide' 

 		}, 500);

		//t=setTimeout('$("'+i1+'").css({width: "'+widths+'", height: "'+heights+'"});', 1000);

	//}



//-------------------------------------------------
// Begin, added on 2007-10-24
//        For handling layer cover IE controls problem.
DivSetVisible(false);
// End, added on 2007-10-24
//-------------------------------------------------

}



	
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

		function switchMenu(num){
			var $FirstNode = $('#IndexBannerButton > a'); 
			$FirstNode.css({ color: "#006e46", background: "#b9d4c8" });
			$FirstNode.eq(num).css({ color: "black", background: "#FFFFFF" });
			$("#IndexBannerInlineTextTitle").text(obj[num][0]);
			$("#IndexBannerInlineText").html(obj[num][2]);		
			$("#IndexBannerImage").attr("src",obj[num][1]);
			$("#IndexBannerImage").attr("alt",obj[num][3]);
			$("#IndexBannerImage").show(1000);
		}




		function showMenuQuick(){

			

			//$("#topMenuSearch").hide();

			//$("#topMenuComment").hide();

			//$("#topMenuQuick").toggle();

			//$("#topmenube").hide();

			/*$("#topMenuQuick").animate({

   height: 'toggle', opacity: 'toggle'

   			
 }, 500);*/
	

			menuoperate("#topMenuQuick");

			


		}





		/*function showMenuComment(){
			$("#topMenuSearch").hide();

			$("#topMenuQuick").hide();

			$("#topmenube").hide();

			$("#topMenuComment").animate({
   height: 'toggle', opacity: 'toggle'
 }, 500);

			menuoperate();
	
		}*/

		function showMenuSearch(){
			/*$("#topMenuQuick").hide();
			$("#topMenuComment").hide();
			$("#topmenube").hide();
			$("#topMenuSearch").animate({
 			  height: 'toggle', opacity: 'toggle'
			 }, 500);*/
			menuoperate("#topMenuSearch");
		}
	function showtopmenube(){
		//release it when you plug-in
		/*$("#topMenuQuick").hide();
		$("#topMenuComment").hide();
		$("#topMenuSearch").hide();
		$("#topmenube").animate({
			height: 'toggle', opacity: 'toggle'
			}, 500);*/
		menuoperate("#topmenube");
		
	}
		function HideAllMenu(){
			menuclose("#topMenuQuick");
			menuclose("#topMenuSearch");
			menuclose("#topmenube");
			
			//$("#topMenuQuick").hide();
			//$("#topMenuSearch").hide();
			//$("#topMenuComment").hide();

			//$("#topmenube").hide();

			
			$('#menucommentarrow').attr("src","/_layouts/Manulife/en/images/arrow.gif");
			$('#menuquickarrow').attr("src","/_layouts/Manulife/en/images/arrow.gif");
			$('#menusearcharrow').attr("src","/_layouts/Manulife/en/images/arrow.gif");
		}
function checkpos(event){
	x=event.clientX;
	y=event.clientY;
		//de('1 '+x+','+y);
		if( (x<455)  || (x>838) || (y>254) ){
			//de('hidden!');
			menuclose("#topMenuQuick");
		}	
		if( (x<635)  || (x>899) || (y>91) ){
			menuclose("#topMenuSearch");
		}	
		if( (x<725)  || (x>950) || (y>100) ){
			//de('1 '+x+','+y);
			$("span[@id=topMenuComment]").hide();
		}	
		if( (x<725)  || (x>950) || (y>100) ){
			//de('1 '+x+','+y);
			menuclose("#topmenube");
		}	
}
		 $(document).ready(function() {
			var urls=document.location.href;    
      var is_wm_ok=urls.indexOf('wm/Pages');
      var is_wm_fund=urls.indexOf('buid=2');

		  $.ajax({type: "GET",processData: false,contentType:"text/html",url: "/_layouts/Manulife/en/header.html?session=" + new Date().getTime(),dataType: "html",
		  		success: function(msg){

   			$('#HeaderTop').html(msg);
		 	$('#menuquick').mouseover(function() { $('#menuquickarrow').attr("src","/_layouts/Manulife/en/images/arrow_over.gif"); } );
		 	$('#menuquick').mouseout(function() { $('#menuquickarrow').attr("src","/_layouts/Manulife/en/images/arrow.gif"); } );
		 	$('#menucomment').mouseover(function() { $('#menucommentarrow').attr("src","/_layouts/Manulife/en/images/arrow_over.gif"); } );
		 	$('#menucomment').mouseout(function() { $('#menucommentarrow').attr("src","/_layouts/Manulife/en/images/arrow.gif"); } );
		 	$('#menusearch').mouseover(function() { $('#menusearcharrow').attr("src","/_layouts/Manulife/en/images/arrow_over.gif"); } );
		 	$('#menusearch').mouseout(function() { $('#menusearcharrow').attr("src","/_layouts/Manulife/en/images/arrow.gif"); } );

 			if((is_wm_ok != -1)||(is_wm_fund != -1) ){
            			$('#topLogo > img').attr("src","/_layouts/Manulife/en/images/manulife_logo.gif");
     			}
			 }

 			});
	var footer_page;
		if((is_wm_ok != -1)||(is_wm_fund != -1)){
			footer_page = "/_layouts/Manulife/en/wm_footer.html";
  		} else {
			footer_page = "/_layouts/Manulife/en/footer.html";
		}
		  $.ajax({type: "GET",processData: false,contentType:"text/html",url: footer_page + "?session=" + new Date().getTime(),dataType: "html",
		  		success: function(msg){
   						$('#FooterBottom').html(msg);
				 }
 			});

		 	$("#menu_container").mouseover( function () { HideAllMenu();});




 		});

 		

 		
 		
var curfontsize=0;
var curlineheight=18;
var manuLifePWSGobalZoomControl=2;
function fontZoomA(){
	if(curfontsize > -1){
        if (curfontsize == 1) {
           manuLifePWSGobalZoomControl=-4 
        } else {
		    manuLifePWSGobalZoomControl=-2
        }		
		curfontsize = -1;
		manuLifePWSFontSizeClassChange();		
  	}
}
function fontZoomB(){
	if(curfontsize != 0){
        if (curfontsize == 1) {
           manuLifePWSGobalZoomControl=-2 
        } else {
		    manuLifePWSGobalZoomControl=+2
        }		
	    curfontsize = 0;
		manuLifePWSFontSizeClassChange();		

  	}
}

function fontZoomC(){
	if(curfontsize < 1){
        if (curfontsize == 0) {
           manuLifePWSGobalZoomControl=+2 
        } else {
		    manuLifePWSGobalZoomControl=+4
        }		
		curfontsize = 1;
		manuLifePWSFontSizeClassChange();
  	}
}

function AddPix(className,addValue){
    var classObj = $(className);
    if (!classObj) return;
	var result = classObj.css("font-size");
	if (!result) return;
	var unit = result.substring(result.length-2);
	result = result.substring(0, result.length-2);
	return (parseInt(result)+(addValue))+unit;
}

function manuLifePWSFontSizeClassChange(){

	//$(".manuLifePWSBody").css("font-size", AddPix(".manuLifePWSBody",manuLifePWSGobalZoomControl));
	$(".manuLifePWSLifeEventContactBox").css("font-size", AddPix(".manuLifePWSLifeEventContactBox",manuLifePWSGobalZoomControl));

	$(".manuLifePWSMainPageNewsHeaderText").css("font-size", AddPix(".manuLifePWSMainPageNewsHeaderText",manuLifePWSGobalZoomControl));
	$(".manuLifePWSMainPageNewsBoxText").css("font-size", AddPix(".manuLifePWSMainPageNewsBoxText",manuLifePWSGobalZoomControl));

	////manuLifePWSLifeEventContactStar
	$(".manuLifePWSLifeEventContactStar").css("font-size", AddPix(".manuLifePWSLifeEventContactStar",manuLifePWSGobalZoomControl));
	$(".manuLifePWSLifeEventContactStarText").css("font-size", AddPix(".manuLifePWSLifeEventContactStarText",manuLifePWSGobalZoomControl));
	$(".manulifeNewsHyperlink").css("font-size", AddPix(".manulifeNewsHyperlink",manuLifePWSGobalZoomControl));
	$(".manulifeNewsDate").css("font-size", AddPix(".manulifeNewsDate",manuLifePWSGobalZoomControl));

	$(".manuLifePWSLendingPageImageWebPartContentTableTd").css("font-size", AddPix(".manuLifePWSLendingPageImageWebPartContentTableTd",manuLifePWSGobalZoomControl));
	$(".manuLifePromotionWebPartLinkListTable a").css("font-size", AddPix(".manuLifePromotionWebPartLinkListTable a",manuLifePWSGobalZoomControl));

	$(".manulifeContentCustom-Header-BU-Lending").css("font-size", AddPix(".manulifeContentCustom-Header-BU-Lending",manuLifePWSGobalZoomControl));
	$(".manulifeContentCustom-Body-BU-Lending").css("font-size", AddPix(".manulifeContentCustom-Body-BU-Lending",manuLifePWSGobalZoomControl));
	$(".manulifeContentCustom-Header1-20px").css("font-size", AddPix(".manulifeContentCustom-Header1-20px",manuLifePWSGobalZoomControl));
	$(".manulifeContentCustom-Header2-14px").css("font-size", AddPix(".manulifeContentCustom-Header2-14px",manuLifePWSGobalZoomControl));
	$(".manulifeContentCustom-Body").css("font-size", AddPix(".manulifeContentCustom-Body",manuLifePWSGobalZoomControl));
	$(".manulifeContentCustom-Bullet").css("font-size", AddPix(".manulifeContentCustom-Bullet",manuLifePWSGobalZoomControl));
	$(".manulifeContentCustom-BulletLink").css("font-size", AddPix(".manulifeContentCustom-BulletLink",manuLifePWSGobalZoomControl));
	$(".manulifeContentCustom-BulletText").css("font-size", AddPix(".manulifeContentCustom-BulletText",manuLifePWSGobalZoomControl));
	$(".manulifeContentCustom-Footer").css("font-size", AddPix(".manulifeContentCustom-Footer",manuLifePWSGobalZoomControl));
	$(".manulifeContentCustom-Footer-Green").css("font-size", AddPix(".manulifeContentCustom-Footer-Green",manuLifePWSGobalZoomControl));
	$(".manulifeContentTable-4 tr.manulifeContentTableFooterRow-4").css("font-size", AddPix(".manulifeContentTable-4 tr.manulifeContentTableFooterRow-4",manuLifePWSGobalZoomControl));
	$(".manulifeContentTable-4 tr.manulifeContentTableOddRow-4  a").css("font-size", AddPix(".manulifeContentTable-4 tr.manulifeContentTableOddRow-4  a",manuLifePWSGobalZoomControl));
	$(".manulifeContentTable-4 td.manulifeContentTableFirstCol-4").css("font-size", AddPix(".manulifeContentTable-4 td.manulifeContentTableFirstCol-4",manuLifePWSGobalZoomControl));
	$(".manulifeContentCustom-Body-Link").css("font-size", AddPix(".manulifeContentCustom-Body-Link",manuLifePWSGobalZoomControl));
	$(".manulifeNewsLearnMore").css("font-size", AddPix(".manulifeNewsLearnMore",manuLifePWSGobalZoomControl));
	$(".manulifeNewsStartDate").css("font-size", AddPix(".manulifeNewsStartDate",manuLifePWSGobalZoomControl));
	$(".manulifeNewsTitle").css("font-size", AddPix(".manulifeNewsTitle",manuLifePWSGobalZoomControl));
	$(".manulifeNewsSummary").css("font-size", AddPix(".manulifeNewsSummary",manuLifePWSGobalZoomControl));
	$(".manulifeNewsRoomMainTrTdDate ").css("font-size", AddPix(".manulifeNewsRoomMainTrTdDate",manuLifePWSGobalZoomControl));
	$(".manulifeNewsRoomMainTrTdTitle").css("font-size", AddPix(".manulifeNewsRoomMainTrTdTitle",manuLifePWSGobalZoomControl));
	$(".manulifeNewsRoomMainTrTdDate div").css("font-size", AddPix(".manulifeNewsRoomMainTrTdDate div",manuLifePWSGobalZoomControl));
	$(".manulifeNewsRoomMainTrTdTitle a").css("font-size", AddPix(".manulifeNewsRoomMainTrTdTitle a",manuLifePWSGobalZoomControl));
	
	//$(".manuLifePWSIndexBannerInlineTextTitle").css("font-size", AddPix(".manuLifePWSIndexBannerInlineTextTitle",manuLifePWSGobalZoomControl)+"px");
	//$(".manuLifePWSIndexBannerInlineText").css("font-size", AddPix(".manuLifePWSIndexBannerInlineText",manuLifePWSGobalZoomControl)+"px");
	////manulifePWSTopTitle
	//$(".manulifePWSTopTitle").css("font-size", AddPix(".manulifePWSTopTitle",manuLifePWSGobalZoomControl)+"px");
	////manuLifePWSTopManuBarSearchTitle
	//$(".manuLifePWSTopManuBarSearchTitle").css("font-size", AddPix(".manuLifePWSTopManuBarSearchTitle",manuLifePWSGobalZoomControl)+"px");
	////manuLifePWSTopMenuQuickHeader
	//$(".manuLifePWSTopMenuQuickHeader").css("font-size", AddPix(".manuLifePWSTopMenuQuickHeader",manuLifePWSGobalZoomControl)+"px");
	////manuLifePWSTopMenuQuickStar
	//$(".manuLifePWSTopMenuQuickStar").css("font-size", AddPix(".manuLifePWSTopMenuQuickStar",manuLifePWSGobalZoomControl)+"px");
	////manuLifePWSBUEditBoxContent
	////Not Use Class
	////$(".manuLifePWSBUEditBoxContent").css("font-size", AddPix(".manuLifePWSBUEditBoxContent",manuLifePWSGobalZoomControl)+"px");
	////manuLifePWSRatingBoxTitle
	////Not Use Class
	////$(".manuLifePWSRatingBoxTitle").css("font-size", AddPix(".manuLifePWSRatingBoxTitle",manuLifePWSGobalZoomControl)+"px");
	////manuLifePWSMainPageNewsHeaderText
	//$(".manuLifePWSMainPageNewsHeaderText").css("font-size", AddPix(".manuLifePWSMainPageNewsHeaderText",manuLifePWSGobalZoomControl)+"px");
	////manuLifePWSFooterCorpRight
	//$(".manuLifePWSFooterCorpRight").css("font-size", AddPix(".manuLifePWSFooterCorpRight",manuLifePWSGobalZoomControl)+"px");
	////manulifeContentCustom-Content
	//$(".manulifeContentCustom-Content").css("font-size", AddPix(".manulifeContentCustom-Content",manuLifePWSGobalZoomControl)+"px");
	////alert(AddPix(".manulifeContentCustom-ArticleTitle",manuLifePWSGobalZoomControl));
}

function changeloc(){
	var urls=document.location.href;	
	//alert(urls);
	var temps=urls.split("/");
	//d(temps.length);
	var roc="";
	//change word
	for(var key in temps ){
		if (temps[key]=='en'){
			temps[key]='zh';
		}else if(temps[key]=='zh'){
			temps[key]='en';
		}
		roc+=temps[key]+'/'; 
	}
	//del last '/'
	var lasts=roc.lastIndexOf('html');
	var ans="";
	if (lasts!=-1){
		for(i=0;i<lasts+4; i++){
			ans+=roc.charAt(i);	
		}
	}else{
		for(i=0;i<roc.length-1; i++){
			ans+=roc.charAt(i);
		}
			
	}
	//document.write(ans);	
	//alert(ans);
	document.location.href=ans;
}	
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

}
	