
function hideShowCont(imgObj,indexId){
	var contId=indexId;
	var minusImg="../images/blue_arrow_down2.gif";
	var plusImg="../images/blue_arrow_left.gif";
	var contObj=document.getElementById(contId);
	if(contObj.style.display=='' || contObj.style.display=='block') {
	contObj.style.display='none'; imgObj.src=plusImg;
	} else {
	 contObj.style.display='block'; imgObj.src=minusImg;
	}

}

function homepage_1()
{
document.getElementById('hometab2').src='../../../eDaman/en/images/new_07.jpg'
document.getElementById('hometab1').src='../../../eDaman/en/images/tab_hover_06.jpg'
document.getElementById('hometab3').src='../../../eDaman/en/images/new_08.jpg'
document.getElementById('hometab4').src='../../../eDaman/en/images/new_09.gif'
document.getElementById('ban1').style.display='block'
document.getElementById('ban2').style.display='none'
document.getElementById('ban3').style.display='none'
document.getElementById('ban4').style.display='none'
}
function homepage_2()
{
document.getElementById('hometab2').src='../../../eDaman/en/images/tab_hover_07.jpg'
document.getElementById('hometab1').src='../../../eDaman/en/images/tab_normal_06.jpg'
document.getElementById('hometab3').src='../../../eDaman/en/images/new_08.jpg'
document.getElementById('hometab4').src='../../../eDaman/en/images/new_09.gif'
document.getElementById('ban2').style.display='block'
document.getElementById('ban1').style.display='none'
document.getElementById('ban3').style.display='none'
document.getElementById('ban4').style.display='none'
}
function homepage_3()
{
document.getElementById('hometab2').src='../../../eDaman/en/images/new_07.jpg'
document.getElementById('hometab1').src='../../../eDaman/en/images/tab_normal_06.jpg'
document.getElementById('hometab4').src='../../../eDaman/en/images/new_09.gif'
document.getElementById('hometab3').src='../../../eDaman/en/images/tab_hover_08.jpg'
document.getElementById('ban2').style.display='none'
document.getElementById('ban1').style.display='none'
document.getElementById('ban3').style.display='block'
document.getElementById('ban4').style.display='none'
}

function homepage_4()
{
document.getElementById('hometab2').src='../../../eDaman/en/images/new_07.jpg'
document.getElementById('hometab1').src='../../../eDaman/en/images/tab_normal_06.jpg'
document.getElementById('hometab4').src='../../../eDaman/en/images/tab_hover_09.gif'
document.getElementById('hometab3').src='../../../eDaman/en/images/new_08.jpg'
document.getElementById('ban2').style.display='none'
document.getElementById('ban1').style.display='none'
document.getElementById('ban3').style.display='none'
document.getElementById('ban4').style.display='block'
}

function load_parent()
{
window.location.href="renew_or_upgrade.html";
}

function renew_or_upgrade()
{
window.location.href="renew_or_upgrade.html";
}
function Member_endorsement()
{
window.location.href="Member_endorsement.html";
}
function show_renew(frm)
{
result = window.showModalDialog("sample_popup.html",frm,"dialogWidth:310px; dialogHeight:300px; center:yes");

}
function advsearchresult_reg()
{
window.location.href="Advanced_search_provider_result_Reg.html";
}

function parseCheckMessage(message) {
	
	var a = document.getElementById("auth");
	var div3 = document.getElementById("signInDivRenewal");
	var div4 = document.getElementById("signOutDivRenewal");
	var endorDivIn =document.getElementById("endorseOutDiv");
	var endorDivOut =document.getElementById("endorseInDiv");
	if(message=='true'){
		document.getElementById('tab7').href = "/eDamanApp/j_acegi_logout"
		a.style.backgroundPosition = "-817px -72px";
		document.getElementById('tab7').style.backgroundPosition = "-817px -72px";
		document.getElementById('tab7').style.cursor = "pointer";
		document.getElementById('tab7').onmouseover = function(){document.getElementById('tab7').style.backgroundPosition = "-817px -108px";};
		document.getElementById('tab7').onmouseout = function(){document.getElementById('tab7').style.backgroundPosition = "-817px -72px";};
		if(div3 != null || div4 != null){
		div3.style.display='block';
		div4.style.display='none';
		}
		if(endorDivIn != null || endorDivOut != null){
			endorDivIn.style.display='block';
			endorDivOut.style.display='none';
		}	
	}
	else{
		document.getElementById('tab7').href = "/eDamanApp/loadMyPortalPage.action";
		a.style.backgroundPosition = "-817px 0px";
		document.getElementById('tab7').style.backgroundPosition = "-817px 0px";
		document.getElementById('tab7').onmouseover = function(){document.getElementById('tab7').style.backgroundPosition = "-817px -36px";};
		document.getElementById('tab7').onmouseout = function(){document.getElementById('tab7').style.backgroundPosition = "-817px 0px";};
		if(div3 != null || div4 != null){
		div3.style.display='none';
		div4.style.display='block';
		}
		if(endorDivIn != null || endorDivOut != null ){
				endorDivIn.style.display='none';
				endorDivOut.style.display='block';
		} 
	}


   }	   

function parseMessage(message) {
    var listDiv = document.getElementById("categoryList");
     try{
	    if(message != null && listDiv != null) {
	      listDiv.style.display='block';
	      listDiv.innerHTML = message; 
	    }
	
	   listDiv = document.getElementById("categoryList");
	   var errorCheck = listDiv.innerHTML;
	  
	   if(errorCheck.indexOf("is not available") != -1 || errorCheck.indexOf("Error reading resource from path") != -1 || errorCheck.indexOf("Service Temporarily") != -1)
	     listDiv.style.display='none';
   } catch(err) {}

}

//document.links[pos].href = document.addresses.list[sel].value;
function switchEnglishArabic() {
  var currentURL = window.location.href;
   if(  currentURL.indexOf("news_april28_2008.html")!= -1 || currentURL.indexOf("news_april15_2008.html")!= -1 || currentURL.indexOf("news_april1_2008.html")!= -1 || currentURL.indexOf("events.html?div=MediaEvent&subdiv=submenu12")!= -1 || currentURL.indexOf("site_map.html")!= -1 || currentURL.indexOf("FAQ.html")!= -1 || currentURL.indexOf("glossary.html")!= -1 || currentURL.indexOf("termsconditions.html")!= -1  || currentURL.indexOf("BrandManagementOfficer.html")!= -1 || currentURL.indexOf("MarketingExecutive.html")!= -1 || currentURL.indexOf("medicalClaimsProcessor.html")!= -1 ||
currentURL.indexOf("medicalReviewOfficer.html")!= -1){
  location.href = "#" ;
  }
 else{
	  if(currentURL.indexOf(".action") == -1 && currentURL.indexOf(".jsp") == -1) {
	     var newURL = currentURL.replace("/en/","/ar/");
	     location.href = newURL;
	
	  } else if(currentURL.indexOf(".action") != -1 || currentURL.indexOf(".jsp") != -1) {
	    switchURL(currentURL)
	  } 
   }
}

function switchURL(currentURL) {
    if(currentURL.indexOf("?") == -1) {
                var newURL = currentURL+"?request_locale=ar";    
                location.href = newURL;
     }else if(currentURL.indexOf("?") != -1 && currentURL.indexOf("request_locale=") == -1)      {
                var newURL = currentURL+"&&request_locale=ar";    
                location.href = newURL;
     }else if(currentURL.indexOf("?") != -1 && currentURL.indexOf("request_locale=") != -1)      {
        var newURL = currentURL.replace("request_locale=en","request_locale=ar");
        location.href = newURL;
     }     
}

function search(query,url) {
  document.googleSearch.action = url;
  document.googleSearch.submit();
}

function loadStaticCheck() {
	ahrefs = document.getElementsByTagName("a");  
	for (i = 0; i < ahrefs.length; i++) {
	    if( (ahrefs[i].id) == "bookmark") {
	      ahrefs[i].href = ahrefs[i].href+"?bookmark="+ahrefs [i].name+"#"+ahrefs [i].name;
	      }
	}
}
function loadSearchCheck() {
	 if(document.getElementById('damanQuery')!=null) {
		 document.getElementById('googleSearchCriteria').value = document.getElementById('damanQuery').value;
	}
}


function highlightMenuItem(){
	var menuItem=document.getElementById('MenuItem');
	var tab6 = document.getElementById('tab6');
	var tab3 = document.getElementById('tab3');
	var tab5 = document.getElementById('tab5');
	var tab2 = document.getElementById('tab2');
	var tab0 = document.getElementById('tab0');
	var tab1 = document.getElementById('tab1');
	var tab4 = document.getElementById('tab4');
	var tab7 = document.getElementById('tab7');
	if (menuItem != null && (menuItem.value=='TITLE_CALLBACK'||menuItem.value=='TITLE_FEEDBACK'||menuItem.value=='TITLE_SPONSORSHIP_REQUEST_CONTACT_US'||menuItem.value=='TITLE_LARGE_GROUP_QUOTE')){ 
		tab6.style.backgroundPosition = "-632px -72px";
		tab6.style.cursor = "default";
	}else if(menuItem != null && ( menuItem.value=='TITLE_PREMIUM_CALCULATOR' || menuItem.value.indexOf("QUOTE")!=-1)){
		tab3.style.backgroundPosition = "-266px -72px";
		tab3.style.cursor = "default";
	}else if (menuItem != null && (menuItem.value.indexOf("PROFILE")!=-1||menuItem.value=='TITLE_PROVIDER_SEARCH' || menuItem.value=='PROVIDER_RATING_TITLE') ){
		tab5.style.backgroundPosition = "-487px -72px";
		tab5.style.cursor = "default";
	}else if(menuItem != null && menuItem.value=='TITLE_SPONSORSHIP_REQUEST_ABOUT_US'){
		tab2.style.backgroundPosition = "-178px -72px";
		tab2.style.cursor = "default";
	}else if(menuItem != null && menuItem.value=='TITLE_SEARCH'){
	    document.getElementById('nav_search').style.paddingLeft = '4px';
		document.getElementById('start').style.backgroundPosition = "0px 0px";
		tab0.style.backgroundPosition = "-15px 0px";
		tab0.onmouseover = function(){tab0.style.backgroundPosition = "-15px -36px";};
		tab0.onmouseout = function(){tab0.style.backgroundPosition = "-15px 0px";};
		tab1.style.backgroundPosition = "-80px 0px";
		tab1.onmouseover = function(){tab1.style.backgroundPosition = "-80px -36px";};
		tab1.onmouseout = function(){tab1.style.backgroundPosition = "-80px 0px";};
		tab2.style.backgroundPosition = "-178px 0px";
		tab2.onmouseover = function(){tab2.style.backgroundPosition = "-178px -36px";};
		tab2.onmouseout = function(){tab2.style.backgroundPosition = "-178px 0px";};
		tab3.style.backgroundPosition = "-266px 0px";
		tab3.onmouseover = function(){tab3.style.backgroundPosition = "-266px -36px";};
		tab3.onmouseout = function(){tab3.style.backgroundPosition = "-266px 0px";};
		tab4.style.backgroundPosition = "-353px 0px";
		tab4.onmouseover = function(){tab4.style.backgroundPosition = "-353px -36px";};
		tab4.onmouseout = function(){tab4.style.backgroundPosition = "-353px 0px";};
		tab5.style.backgroundPosition = "-487px 0px";
		tab5.onmouseover = function(){tab5.style.backgroundPosition = "-487px -36px";};
		tab5.onmouseout = function(){tab5.style.backgroundPosition = "-487px 0px";};
		tab6.style.backgroundPosition = "-632px 0px";
		tab6.onmouseover = function(){tab6.style.backgroundPosition = "-632px -36px";};
		tab6.onmouseout = function(){tab6.style.backgroundPosition = "-632px 0px";};
		document.getElementById('blank').style.backgroundPosition = "-732px 0px";
		authenticate();
		document.getElementById('arabic').style.backgroundPosition = "-904px 0px";
	}else{
		tab1.style.backgroundPosition = "-80px -72px";
		tab1.style.cursor = "default"; 
	}
}

function damanHome()
{
window.location.href="/eDamanApp/loadMyPortalPage.action?request_locale=en";
}

function resizeDivBtns(){
	divObj=document.getElementsByTagName("DIV");
	for(i=0;i<divObj.length;i++) {
		divClass=divObj[i].className;
		if(divClass=="buttonalt"){
			resizeBtnDiv(divObj[i]);			
		}
		
	}
	
}

function resizeBtnDiv(vdivObj){
  var totalWidth = 0;
  for (j=0; j<vdivObj.childNodes.length; j++) {
  divItem = vdivObj.childNodes[j];
  if (divItem.nodeName=="DIV") {
     totalWidth+= divItem.offsetWidth;
			/* Changing Style Dynamically for RTL STARTS */
			if(document.body.dir!=''){
				if(document.body.dir.toUpperCase()=='RTL'){	
					if(j==0){
					vdivObj.childNodes[0].className='btnalt_ArabicLeft';
					vdivObj.childNodes[2].className='btnalt_ArabicRight';
					}
				}
			}

			/* Changing Style Dynamically for RTL ENDS */
   }
  }
  vdivObj.style.width = totalWidth;
}

function bodyOnLoadForEnglish() {

resizeDivBtns();

}

function googleSearchHref() {
	searchHref = document.getElementsByTagName("a");  
	for (i = 0; i < searchHref.length; i++) {
	    searchCheck = searchHref[i].href;
		    if(searchCheck.indexOf("search?") != -1) {
		      searchCheck  = searchCheck.replace("search?","search.jsp?");
		      searchHref[i].href = searchCheck;
		    }
	}
}

function opnzoom(win)
 {
window.open(win, 'gallery', 'height=730,width=518,location=0, toolbar=0,titlebar=0,scrollbars=1,resizable=0,menubar=0,status=1');
}

function loadGlossarycheck() {

var hferLinksredefine = document.getElementsByTagName("a");  
	for (i = 0; i < hferLinksredefine .length; i++) {
		var link = hferLinksredefine [i].href;
		if( (hferLinksredefine[i].id) != "bookmark" && link.indexOf("#") != -1 && link.indexOf("Compare_Plans.html") != -1) {
			link = link.replace("Compare_Plans.html","Compare_PlanTypes.html");
			hferLinksredefine[i].href = link;
		}
	
		if(link.indexOf("glossary.html") != -1) {
			link = link.replace("glossary.html","GlossaryClaims.html");
			hferLinksredefine[i].href = link;
		}
	
		if( (hferLinksredefine[i].id) == "bookmark") {
			hferLinksredefine[i].href = hferLinksredefine[i].href+"?bookmark="+hferLinksredefine[i].name+"#"+hferLinksredefine[i].name;
		}
	}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

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_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

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_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

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];}
}

function switchLocaleTo(){
	var menuItem=document.getElementById('MenuItem');
	var currUrl=window.location.href;
	if (currUrl.indexOf("request_locale")==-1)
	{
		if(currUrl.indexOf("?")==-1)
			currUrl=currUrl+"?request_locale=en";
		else
			currUrl=currUrl+"&request_locale=en";
	}
	if (menuItem != null && (menuItem.value=='TITLE_REQUEST_QUOTE'|| menuItem.value=='TITLE_PREMIUM_CALCULATOR'||menuItem.value=='TITLE_SEARCH')){
		currUrl=currUrl.replace(/request_locale=en/,"request_locale=ar");
	}
	else{
	return;
	}
	
	window.location.href=currUrl;
}

UTF8 = {
     	encode: function(s){
     		for(var c, i = -1, l = (s = s.split("")).length, o = String.fromCharCode; ++i < l;
     			s[i] = (c = s[i].charCodeAt(0)) >= 127 ? o(0xc0 | (c >>> 6)) + o(0x80 | (c & 0x3f)) : s[i]
     		);
    		return s.join("");
    	},
    	decode: function(s){
    		for(var a, b, i = -1, l = (s = s.split("")).length, o = String.fromCharCode, c = "charCodeAt"; ++i < l;
    			((a = s[i][c](0)) & 0x80) &&
    			(s[i] = (a & 0xfc) == 0xc0 && ((b = s[i + 1][c](0)) & 0xc0) == 0x80 ?
    			o(((a & 0x03) << 6) + (b & 0x3f)) : o(128), s[++i] = "")
    		);
    		return s.join("");
    	}
    };
    
function disableGlossaryLink() {

var hferLinksredefine = document.getElementsByTagName("a");  
	for (i = 0; i < hferLinksredefine .length; i++) {
		var link = hferLinksredefine [i].href;	
		if( (hferLinksredefine[i].id) == "bookmark") {
			hferLinksredefine[i].href = "#";
		}
	}
}
function xonload()
{
document.getElementById('frameWrapper').id = 'frameWrapper2';
document.getElementById('branLocator').style.visibility = 'visible';
}
function hideSpinner() { 
 document.getElementById('spinner').style.display = "none";
}

function loadStaticLink() {
	ahrefs = document.getElementsByTagName("a");  
	for (i = 0; i < ahrefs.length; i++) {
	    if( (ahrefs[i].id) == "HealthGuides" || (ahrefs[i].id) == "MemberBenefits" || (ahrefs[i].id) == "providerDirectory") {
	          ahrefs[i].href = ahrefs[i].href+"?div="+ahrefs [i].id+"&subdiv="+ahrefs [i].name;
	    }
	}
}

function authenticate(){
if (document.getElementById("signinDiv")){
		var tab8 = document.getElementById('tab7');
		tab8.style.backgroundPosition = "-817px 0px";
		tab8.style.cursor = "pointer";
		tab8.onmouseover = function(){tab8.style.backgroundPosition = "-817px -36px";};
		tab8.onmouseout = function(){tab8.style.backgroundPosition = "-817px 0px";};
}else if (document.getElementById("signoutDiv")){
		var tab8 = document.getElementById('tab7');
		tab8.style.backgroundPosition = "-817px -72px";
		tab8.style.cursor = "pointer";
		tab8.onmouseover = function(){tab8.style.backgroundPosition = "-817px -108px";};
		tab8.onmouseout = function(){tab8.style.backgroundPosition = "-817px -72px";};
}
}
function bodyOnLoadForArabic(){
	highlightMenuItem();resizeDivBtns();
}
