var headClassName="GlobalQuestionContainer";
var headSelectedClassName="GlobalQuestionContainerSelected";
var bodyClassName="GlobalAnswerContainer";
var contentClassname="";
var faq_contentID_match_string="GlobalContentContainer";
var parentsStore=new Array();
var parentContentHeights=new Array();
var expColDivs=new Array();
var expandAll="GlobalExpandAll";
var collapseAll="GlobalCollapseAll";
var expandCollapse="masterECContainer";
var faqContainer="masterFAQContainer";
var faqContainersCount=0;
var expandCollapseStatusArray=new Array();
var exp_collapse_slideSpeed = 15; // Higher value = faster
var exp_collapse_timer = 0; // Lower value = faster
var objectIdToSlideDown = false;
var exp_collapse_contenttiveId = false;
var exp_collapse_slideInProgress = false;
var expandAllcollapseAll_slideInProgress=false;
var totalDivs=0;
var questionWidthPadding=16;
var exp_collapse_enter = false;

function getParents(obj){
	
	var parents=new Array();
    var i=1;
	var numericId = (obj.id).replace(/[^0-9]/g,'');
	var tempDiv=faq_contentID_match_string+numericId;
	
	var parentDiv=obj.parentNode;
    
	while(parentDiv.tagName!="BODY"){
		
			while(parentDiv.tagName!='DIV'){
				parentDiv=parentDiv.parentNode;
			}
			
			if((parentDiv.id).match(faq_contentID_match_string)==faq_contentID_match_string){
				parents[i]=parentDiv;
				i++;
				
			}
		    parentDiv=parentDiv.parentNode;
		
    }
    
    return parents;

}


function showHideEXPContent(e,inputId)
{ 
	
   if(exp_collapse_slideInProgress)	 return;
   exp_collapse_slideInProgress = true;
   if(!inputId)inputId = this.id;
   inputId = inputId + '';
    objectIdToSlideDown = false;
   if(inputId.match(expandAll)==expandAll){

		expandAllContent(inputId);   

   
   }else if(inputId.match(collapseAll)==collapseAll){
	
		collapseAllContent(inputId);  		
   
   }else {
				//alert("Beforeinput:"+inputId);
				if(inputId.match('span')=='span'){
				inputId=inputId.split('span')[1];
				}
				if(inputId.match('arrowDiv')=='arrowDiv'){
				inputId=inputId.split('arrowDiv')[1];
				}
				//alert("Afterinput:"+inputId);
			   var numericId = inputId.replace(/[^0-9]/g,'');
			   var answerDiv = document.getElementById(bodyClassName + numericId);
			  
			 
			   if(!answerDiv.style.display || answerDiv.style.display=='none')
			   {   
				   
				  answerDiv.style.display='block';
				  answerDiv.style.visibility = 'visible'; 
				  var temp=document.getElementById(headClassName+ numericId);
				  slideEXPContent(numericId,exp_collapse_slideSpeed);
				  
				  
				  } else{ 
				 var temp=document.getElementById(headClassName + numericId);
				 slideEXPContent(numericId,(exp_collapse_slideSpeed*-1));  
				 //exp_collapse_contenttiveId = false;
			   } 
   }
}



var collapseDirection=0;
var expandDirection=0;
var deltaHeight=0;

function slideEXPContent(inputId,direction){ 
   
   var obj =document.getElementById(bodyClassName + inputId);
   var contentObj = document.getElementById(faq_contentID_match_string + inputId);
   height = obj.clientHeight;
   var temp=parentsStore[inputId];
   if(height==0){
      height = obj.offsetHeight;
   }
   height = height + direction;
   rerunFunction = true;
   
   if(height>contentObj.offsetHeight){
      deltaHeight=height - contentObj.offsetHeight;
	  
      height = contentObj.offsetHeight;
      rerunFunction = false;
   }
   
   if(height<=1){
     height = 1;
     rerunFunction = false;
   }
 
   obj.style.height = height + 'px';
   

   if(direction>0){
		 
		 if(temp.length!=0){

		   //for(var i=1;i<(temp.length);i++){
				 var parentObj=temp[(temp.length-1)];
				 var testId=parentObj.id;
				 var numericId =testId.replace(/[^0-9]/g,'');
				 expandDirection=expandDirection + exp_collapse_slideSpeed;
				 var test=parentContentHeights[numericId]+ height;
				 var parContentDiv=document.getElementById(bodyClassName+numericId);
				 parContentDiv.style.height=test + "px";
				//alert("initHeight"+parentContentHeights[numericId]+"relativeHeight"+height+"total height"+parContentDiv.offsetHeight);
		  //}

		 }

	}else{

		if(temp.length!=0){

		  //for(var i=1;i<temp.length;i++){
		     var parentObj=temp[(temp.length-1)];
		     var testId=parentObj.id;
        	 collapseDirection=collapseDirection + exp_collapse_slideSpeed;
		     var numericId = testId.replace(/[^0-9]/g,'');
             var test= parseInt(parentContentHeights[numericId]) - collapseDirection;
             var parContentDiv=document.getElementById(bodyClassName+numericId);
             parContentDiv.style.height=test + "px";
             //alert("initHeight"+parentContentHeights[numericId]+"relativeHeight"+height+"total height"+parContentDiv.offsetHeight);
		   //}

	    }
     }
   
   var topPos = height - contentObj.offsetHeight;

   if(topPos>0){ 
   topPos=0;
   }
 
   contentObj.style.top = topPos + 'px';
   
   if(rerunFunction){
    //alert(inputId+"----"+direction);
	 setTimeout('slideEXPContent(' + inputId + ',' + direction + ')',exp_collapse_timer);  
		//pausecomp(100);
		//slideEXPContent(inputId,direction);
  
  }else{

      if(height<=1){   
         obj.style.display='none'; 
          
		  if(objectIdToSlideDown && objectIdToSlideDown!=inputId){
				document.getElementById(bodyClassName + objectIdToSlideDown).style.display='block';
				document.getElementById(headClassName + objectIdToSlideDown).style.visibility='visible';
				slideEXPContent(objectIdToSlideDown,exp_collapse_slideSpeed);    
          }else{
			    if(!expandAllcollapseAll_slideInProgress){
						exp_collapse_slideInProgress = false;
				}
                expandCollapseStatusArray[inputId]=false;
				var tempQuestionDiv=document.getElementById(headClassName+inputId);
	            tempQuestionDiv.className=headClassName;	
				document.getElementById('arrowDiv'+headClassName+inputId).className = 'arrowDiv';
                var temp=parentsStore[inputId];
    
				if(temp.length!=0){

	                 for(var i=1;i<(temp.length);i++){
	 
						 var parentObj=temp[i];
						 var testId=parentObj.id;
						 var numericId = testId.replace(/[^0-9]/g,'');
						 var parContentDiv=document.getElementById(bodyClassName+numericId);

						 if(i!=(temp.length-1)){		
								 var tempHeight = parseInt(parentContentHeights[numericId]) - collapseDirection;
								 parContentDiv.style.height=tempHeight + "px";
						 }

						
	                     parentContentHeights[numericId]=parContentDiv.offsetHeight;

						
	                }
	           }

	           collapseDirection=0;

			   checkAllExpandCollapse();
			
			
			  
       }
  
  }else{
  
      exp_collapse_contenttiveId = inputId;
      
	  if(!expandAllcollapseAll_slideInProgress){
			exp_collapse_slideInProgress = false;
	   }		
	  expandCollapseStatusArray[inputId]=true;
	  
	  var tempQuestionDiv=document.getElementById(headClassName+inputId);
	  tempQuestionDiv.className=headSelectedClassName;	
	  document.getElementById('arrowDiv'+headClassName+inputId).className = 'arrowDivStlSelected';
      var tempBodyDiv=document.getElementById(bodyClassName+inputId);
      parentContentHeights[inputId]=tempBodyDiv.offsetHeight;
      var temp=parentsStore[inputId];
         
		 if(temp.length!=0){

	          for(var i=1;i<(temp.length);i++){
	 
					 var parentObj=temp[i];
					 var testId=parentObj.id;
					 var numericId = testId.replace(/[^0-9]/g,'');
					 var parContentDiv=document.getElementById(bodyClassName+numericId);

	                 if(i!=(temp.length-1)){
		                 
						 var tempHeight = parseInt(parentContentHeights[numericId]) + expandDirection;
						 parContentDiv.style.height=tempHeight + "px";
	                 }

					 if(i==(temp.length-1)){

						 var tempHeight = parseInt(parentContentHeights[numericId]) + expandDirection;
						 parContentDiv.style.height=tempHeight + "px";
					 
					 }
					 parentContentHeights[numericId]=parContentDiv.offsetHeight;
					
	          }

	      }

       expandDirection=0;
	   
       checkAllExpandCollapse(); 	
	   //document.getElementById('GlobalAnswerContainer'+inputId).style.overflow = 'visible';
	  
   }
 }
}




function initExpandCollapse(){


	var divs=document.getElementsByTagName('DIV');
    var testCount=1;
	for (var i=0;i<divs.length ;i++ )
	{
     
			if(divs[i].className==faqContainer){
			
					divs[i].id = faqContainer+testCount;	
					
					testCount++;
			}
	}
	
    faqContainersCount=testCount;
	
	
	var arrowCount=1;
	for (var j=0;j<divs.length ;j++ )
	{
     
			if(divs[j].className=="arrowDiv"){
			
					divs[j].id = "arrowDiv"+headClassName+arrowCount;	
					divs[j].onclick = showHideEXPContent;
					arrowCount++;
			}
	}

	
    var divCounter = 1;
	
    for(var no=0;no<divs.length;no++){
	
		if(divs[no].className==headClassName){
			exp_collapse_enter = true;
			divs[no].id = headClassName+divCounter;
			parentsStore[divCounter]=getParents(divs[no]);
			//divs[no].onclick = showHideEXPContent;
			//New Change 24Dec
			var spanDivs=divs[no].getElementsByTagName('SPAN');
			spanDivs[0].id="span"+headClassName+divCounter;
			spanDivs[0].onclick = showHideEXPContent;
			//var atags=divs[no].getElementsByTagName('a');   
			//divs[no].style.width=(atags[0].offsetWidth)+'px';
		    var questionParent=divs[no].parentNode;
			
			var body = questionParent.nextSibling;

		    while(body && body.tagName!='DIV'){
			body = body.nextSibling;
		    }
		    body.id = bodyClassName+divCounter; 
			//alert(body.id);
			parentContentHeights[divCounter]=body.offsetHeight;
		    contentDiv = body.getElementsByTagName('DIV')[0];
		    //contentDiv.style.top = 0 - contentDiv.offsetHeight + 'px';  
		    // contentDiv.className='faq_body_content';
		    contentDiv.id = faq_contentID_match_string + divCounter;
			divCounter++;
		}	
	}
    
	totalDivs=divCounter;
    for(var i=1;i<divCounter;i++){
	var tempBodyDiv=document.getElementById(bodyClassName+i);
	tempBodyDiv.style.display='none';
	tempBodyDiv.style.height='1px';

	}

}


function skipChildExpandCollapse(obj){

		
			var childDivs=obj.getElementsByTagName('DIV');
			var temp=childDivs.length;
				
			return temp;

}


function skipChildFaqContainer(obj){

		
			var childDivs=obj.getElementsByTagName('DIV');
			var temp=childDivs.length;
				
			return temp;

}




function expandAllContent(inpId){
           
		  
		   expandAllcollapseAll_slideInProgress=true;
		   var numericId = inpId.replace(/[^0-9]/g,'');
		   var expDiv = document.getElementById(expandCollapse + numericId);
		   var expChildDivs=expDiv.getElementsByTagName('DIV');
		   
		   for(i=0;i<expChildDivs.length;i++) {
					 
					 if((expChildDivs[i].id).match(expandCollapse)==expandCollapse){
						
						 var t=skipChildExpandCollapse(expChildDivs[i]);
						 i=i+t;
						 

					 }

					if((expChildDivs[i].id).match(faqContainer)==faqContainer){
						
						 var t=skipChildFaqContainer(expChildDivs[i]);
						 i=i+t;
						 

					 }



				    if((expChildDivs[i].id).match(headClassName)==headClassName){
							
							var input=expChildDivs[i].id;
							input=input+'';
							var numericId = input.replace(/[^0-9]/g,'');
							
							var answerDiv = document.getElementById(bodyClassName+numericId);
										
							if(answerDiv.style.display=='none'){
									
									answerDiv.style.display='block';
									answerDiv.style.visibility = 'visible';
									slideEXPContent(numericId,exp_collapse_slideSpeed);
							}
				 }
           }   	
		
		//exp_collapse_slideInProgress=false;
} 


function collapseAllContent(inpId){
			
			for(var k=1;k<totalDivs;k++){
		
				document.getElementById('GlobalAnswerContainer'+k).style.overflow = 'hidden';
			}
		
		   expandAllcollapseAll_slideInProgress=true;	
		   var numericId = inpId.replace(/[^0-9]/g,'');
		   var expDiv = document.getElementById(expandCollapse + numericId);
		   var expChildDivs=expDiv.getElementsByTagName('DIV');
		
		   for(i=0;i<expChildDivs.length;i++) {


							 if((expChildDivs[i].id).match(expandCollapse)==expandCollapse){
						
								 var t=skipChildExpandCollapse(expChildDivs[i]);
								 i=i+t;
								 

							 }

							if((expChildDivs[i].id).match(faqContainer)==faqContainer){
								
								 var t=skipChildFaqContainer(expChildDivs[i]);
								 i=i+t;
								 

							 }
							 
				 if((expChildDivs[i].id).match(headClassName)==headClassName){
							
							var input=expChildDivs[i].id;
							input=input+'';
							var numericId = input.replace(/[^0-9]/g,'');
							
							var answerDiv = document.getElementById(bodyClassName+numericId);
								
							if(answerDiv.style.display=='block'){
									slideEXPContent(numericId,(exp_collapse_slideSpeed*-1));
							}
				 }
           }   
		  // exp_collapse_slideInProgress=false;	
}

var tempFlag=false;
function checkAllExpandCollapse(){
        
		
		for(var j=1;j<totalExpBoxColDivs;j++){
		
			var tempDiv=document.getElementById(expandCollapse+j);
			var innerDivs=tempDiv.getElementsByTagName('DIV');
			var sectempCount=0;
            var firsttempCount=0; 

			for(i=0;i<innerDivs.length;i++){
				
							
							 if((innerDivs[i].id).match(expandCollapse)==expandCollapse){
						
								 var t=skipChildExpandCollapse(innerDivs[i]);
								 i=i+t;
								 

							 }

							if((innerDivs[i].id).match(faqContainer)==faqContainer){
								
								 var t=skipChildFaqContainer(innerDivs[i]);
								 i=i+t;
								 

							 }
				

             
								if((innerDivs[i].id).match(bodyClassName)==bodyClassName){
										firsttempCount++;			
										var numericId = (innerDivs[i].id).replace(/[^0-9]/g,'');
										if(expandCollapseStatusArray[numericId]==true){
										sectempCount++;
										}

								}
									
			}
			
			  
			if(firsttempCount==sectempCount){
			
						document.getElementById(expandAll+j).style.display='none'; 	
						document.getElementById(collapseAll+j).style.display='block';
						exp_collapse_slideInProgress=false;	
						expandAllcollapseAll_slideInProgress=false;
			}else if(sectempCount==0){
				
						document.getElementById(collapseAll+j).style.display='none';
						document.getElementById(expandAll+j).style.display='block'; 
						exp_collapse_slideInProgress=false;
						expandAllcollapseAll_slideInProgress=false;
			}
					
		
		}

}



function initExpandAllCollapseAll(){
		
	var divs=document.getElementsByTagName('DIV');
    var divCounter = 1;
	
    for(var no=0;no<divs.length;no++){
	
    		if(divs[no].className==collapseAll){

					divs[no].id = collapseAll+divCounter;
					
					divs[no].onclick = showHideEXPContent;
					//var atags=divs[no].getElementsByTagName('a');   
					//divs[no].style.width=(atags[0].offsetWidth)+'px';
					var expanddiv = divs[no].nextSibling;
		            while(expanddiv && expanddiv.tagName!='DIV'){
						expanddiv = expanddiv.nextSibling;
						
		            }	
			
			        expanddiv.id = expandAll+divCounter;
					expanddiv.onclick = showHideEXPContent;
					//var atags=expanddiv.getElementsByTagName('a');   
					//expanddiv.style.width=(atags[0].offsetWidth)+'px';
					divCounter++;		
			}


	}

    var count=1;
    for(var no=0;no<divs.length;no++){
	       
    		if(divs[no].className==expandCollapse){

					divs[no].id = expandCollapse+count;
					//expColDivs[count]=storeExpandCollapseInnerDivs(divs[no]);
					count++;
			}
	}

     totalExpBoxColDivs=count;

	
}


function initMethod(){
    
	initTooltip();//tooltip	
	showCountry(); //Global Address	
	initShowHideDivs(); //accordion
	showBannerInit();//Banner Home
	initExpandCollapse();  //ExpandCollapse 
    initExpandAllCollapseAll(); //ExpandAllCollapseAll
	initTabMenu(); //tabs
    showComponentAll();	// Unhide all components	
	if(document.getElementById('AccordionWrapper')) {
		slideContentAccordion(1,10);
	}
		
	
}


function showComponentAll(){
var allDIVsObj=document.getElementsByTagName('DIV');
var totDivCount= allDIVsObj.length;
	for (var counter =0, tagIDtempVar=""; counter<totDivCount;counter++)
		{
			if (allDIVsObj[counter].getAttribute('ID') != null)
			{
			tagIDtempVar=allDIVsObj[counter].getAttribute('ID');
				if(tagIDtempVar.indexOf('Loader') != -1)
					{
					document.getElementById(tagIDtempVar).style.display='block';
					}				
			}			
		}
}

window.onload = initMethod;

	var menuAlignment = 'left';	// Align menu to the left or right?		
	var topMenuSpacer = 0; // Horizontal space(pixels) between the main menu items	
	var activateSubOnClick = false; // if true-> Show sub menu items on click, if false, show submenu items onmouseover
	var leftAlignSubItems = false; 	// left align sub items t

	var activeMenuItem = false;	// Don't change this option. It should initially be false
	var activeTabIndex = 0;	// Index of initial active tab	(0 = first tab) - If the value below is set to true, it will override this one.


	var MSIE = navigator.userAgent.indexOf('MSIE')>=0?true:false;
	var Opera = navigator.userAgent.indexOf('Opera')>=0?true:false;
	var navigatorVersion = navigator.appVersion.replace(/.*?MSIE ([0-9]\.[0-9]).*/g,'$1')/1;
	var bookmarkTabStatus=false;
	
		
	function showHide()
	{
		if(activeMenuItem){
			activeMenuItem.className = 'inactiveMenuItem'; 	
			var theId = activeMenuItem.id.replace(/[^0-9]/g,'');			
			document.getElementById('submenu_'+theId).style.display='none';					
		}	
		//var tabElementLostFocus = activeMenuItem.hash.substr(1);
		
		activeMenuItem = this;		
		
		//var tabElementGainedFocus = activeMenuItem.hash.substr(1);
		this.className = 'activeMenuItem';
		var theId = this.id.replace(/[^0-9]/g,'');
		document.getElementById('submenu_'+theId).style.display='block';	
		/*dynamicJSMethod(tabElementLostFocus,tabElementGainedFocus);*/
		//trackEvent('tab','tabAnchor:'+tabElementGainedFocus);
	}
	
	function linkTab(obj){
		//alert(obj.firstChild.href);
		//window.location.href=obj.firstChild.href;	
		var noTab = false;
		var nVal = 1;
		if(document.getElementById('topTabs')) {
			var nHref = obj.href;
			var nLocate = document.getElementById('topTabs').getElementsByTagName('a');
			for(z=0;z<nLocate.length;z++) {
				if(nLocate[z].href == nHref) {
					if(activeMenuItem){
						activeMenuItem.className = 'inactiveMenuItem'; 	
						var theId = activeMenuItem.id.replace(/[^0-9]/g,'');			
						document.getElementById('submenu_'+theId).style.display='none';					
					}	
					nVal = z;
					activeMenuItem = nLocate[z];
					nLocate[z].className = 'activeMenuItem';
					var theId = nLocate[z].id.replace(/[^0-9]/g,'');	
					document.getElementById('submenu_'+theId).style.display='block'
					noTab = true;
				}
			}
			if(!noTab) {			
				location.href = '/System/CustomMetLife404.html';				
			}	
		}
	}
	function initTabMenu()
    {
		
		  subCounter=1;
		var divs = document.getElementsByTagName('DIV');    	
        for(var no=0;no<divs.length;no++){
    
            if(divs[no].className=='submenuTab'){
                divs[no].id="submenu_"+subCounter;
            subCounter++;
			
			}

		}
	    divCounter=1;
		
    	if(document.getElementById('mainMenu')) {
      // added from here on 6th Nov 08
         var answerDiv=document.getElementById('submenu_'+divCounter);
					//alert(document.getElementById('submenu').style.borderTop);			   
				if(document.getElementById('topTabs')!=null){

					document.getElementById('submenu').style.borderTop='0px none';
					}
				//document.getElementById('submenu').style.border-top='none':void();
				
				answerDiv.style.display='none';
				document.getElementById('mainMenu').style.display = 'block';


		var mainMenuObj = document.getElementById('mainMenu');

		var mainMenuLinks = mainMenuObj.getElementsByTagName('A');
		
		var PageLink=location.hash;       
	  	//var PageLink=document.URL
		
		for(var i=0;i<mainMenuLinks.length;i++){
			var temp=mainMenuLinks[i].hash;  
			
			if(temp==PageLink){
			activeTabIndex=i;
			bookmarkTabStatus=true;
			}
		}
		
	    if(!bookmarkTabStatus){		
			if(PageLink){
				//window.location='http://PageNotFound.html';
				//window.location = window.location.href.split('#')[0];
				activeTabIndex=0;
			}
		}
		var masterTabContentControllerObj = document.getElementById('submenuTabContent');
		var tabContentTitleObj = masterTabContentControllerObj.getElementsByTagName('H2');
		for(countTabTitle=0;countTabTitle<tabContentTitleObj.length;countTabTitle++){
			var isJsDisabledHdrObj = tabContentTitleObj[countTabTitle].getAttribute("ID");
			if (isJsDisabledHdrObj)
			tabContentTitleObj[countTabTitle].style.display='none';
		}
		if(mainMenuObj != null )
		{		
		var menuItems = mainMenuObj.getElementsByTagName('A');
		if(document.all){		
			mainMenuObj.style.visibility = 'hidden';
			document.getElementById('submenu').style.visibility='hidden';
		}		
		
		var currentLeftPos = 15;
		for(var no=0;no<menuItems.length;no++){			
			if(activateSubOnClick)menuItems[no].onclick = showHide; else menuItems[no].onclick = showHide;
			menuItems[no].id = 'mainMenuItem' + (no+1);
						
						
			if(no==activeTabIndex){
				window.location=menuItems[no].href;
				menuItems[no].className='activeMenuItem';
				activeMenuItem = menuItems[no];				
							
			}else menuItems[no].className='inactiveMenuItem';
			if(!document.all)menuItems[no].style.bottom = '-1px';
			if(MSIE && navigatorVersion < 6)menuItems[no].style.bottom = '-2px';
		}		
		
		
			var subCounter = 1;
			var parentWidth = mainMenuObj.offsetWidth;
			while(document.getElementById('submenu_' + subCounter)){
			var subItem = document.getElementById('submenu_' + subCounter);

			
			if(subCounter==(activeTabIndex+1)){
				subItem.style.display='block';
			}else{
				subItem.style.display='none';
			}
			
			subCounter++;
		}
		if(document.all){
			mainMenuObj.style.visibility = 'visible';
			document.getElementById('submenu').style.visibility='visible';
		}		
		document.getElementById('submenu').style.display='block';
	}}//alert(document.getElementById('mainMenu').innerHTML);
}

function selectedItem(formIdName,selvalue,optClsName) {
	if(optClsName != '' || selvalue != 'none' && selvalue != 'tools') {
		if(optClsName == 'samePge') {
			document.getElementById(formIdName).action=selvalue
			document.getElementById(formIdName).submit();   
		}
		else if(optClsName == 'newPge') {
			if (window.screen) { 		
				var w = document.all?window.screen.availWidth-10:window.screen.availWidth;
				var h = document.all?window.screen.availHeight-162:window.screen.availHeight;	
			}
			window.open(selvalue,'DropdownList','width='+w+',height='+h+',top=0,left=0,bottom=0,toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes'); 			
		}
	} 	
}



/*Global Address : Starts*/

var GlobalLocationStatus=false;
var bookmarkGlobalStatus=false;
var idArray = new Array();            
function showCountry() {       
	
	
                var num = 0;
                var divs = document.getElementsByTagName('DIV');
                for(var no=0;no<divs.length;no++){
                                if(divs[no].className =='globalAddress') {
                                //            var cntyANav = document.getElementById('globalLocLtCnt').getElementsByTagName('a');
                                //            for(l=0;l<cntyANav.length;l++) {                                                               
                                //                            cntyANav[l].removeAttribute('href');
                                //            }
                                GlobalLocationStatus=true;
                                                var cntyA = document.getElementById('globalLocRtCnt').getElementsByTagName('a');
                                                for(k=0;k<cntyA.length;k++) {
                                                                if(cntyA[k].className == 'gblbBlankId') {
                                                                                cntyA[k].id = '';
                                                                }
                                                }
                                                var cntyDiv = document.getElementById('globalLocRtCnt').getElementsByTagName('DIV');
                                                for(j=0;j<cntyDiv.length;j++) {
                                                                if(cntyDiv[j].className == 'cntyHd') {
                                                                                idArray[num] = cntyDiv[j].id;
                                                                                num++;
                                                                }
                                                }                                              
                                                for(i=0; i<idArray.length; i++) {                                  
                                                                if(idArray[i] != 'grlCntLocAdrs') {
                                                                                document.getElementById(idArray[i]).style.display = 'none';
                                                                }
                                                }                                              
                                                break;
                                }
                }

		if(GlobalLocationStatus){
                        var PageLink=location.hash;
                                if(PageLink){
									
                                   var GBContacts=document.getElementById('globalLocLtCnt');

                                   var aTags=GBContacts.getElementsByTagName('a');
                                                                
                                   for(i=0;i<aTags.length;i++){

                                              if(aTags[i].hash==PageLink){
												  
                                                         showThisCntry(aTags[i],i+1);     
										                  bookmarkGlobalStatus = true;
                                              } 

                                   }
									 if(!bookmarkGlobalStatus) {
										
														window.location = window.location.href.split('#')[0];
													}				

                              }

							 

        }
        
}
function showThisCntry(obj,Cnme) {
                
                var Cname = "country"+Cnme;
                var aTag = document.getElementById('globalLocLtCnt').getElementsByTagName('a');
                document.getElementById('grlCntLocAdrs').style.display = 'none';
                for(j=0; j<aTag.length; j++)
                                aTag[j].style.color = '';
                for(i=0; i<idArray.length; i++) {                                  
                                document.getElementById(idArray[i]).style.display = 'none';
                }
                document.getElementById(Cname).style.display = 'block';
                obj.style.color= '#7EB764';
}
/*Global Address : Ends*/


function webFormOverlayclose(clsNum) {
	document.getElementById('webFormOverlayCnt'+clsNum).style.display='none';
	document.getElementById('webFormOvrlyBg').style.display='none';	
	var selct = document.getElementsByTagName('select');	
	for(var k=0;k<selct.length;k++){		
		if(selct[k].style.visibility != 'visible')
			selct[k].style.visibility = 'visible';

	}
}
function webfrmClick(frmNum) {	
	var selct = document.getElementsByTagName('select');	
	for(var k=0;k<selct.length;k++){		
		if(selct[k].style.visibility != 'hidden')
			selct[k].style.visibility = 'hidden';
		
	}	
	var selctWebFrm = document.getElementById('webFormOverlayCnt'+frmNum).getElementsByTagName('select');	
   	if(selctWebFrm.length) {
		for(var l=0;l<selctWebFrm.length;l++){		
			selctWebFrm[l].style.visibility = 'visible';
		}
    } 
	var as = document.getElementsByTagName('span');	
	//document.getElementById('webFormOvrlyBg').style.height = screen.availHeight - 135;
	for(var j=0;j<as.length;j++){		
		if(as[j].className =='webFrmOverlayLnk') {
			var asa = as[j].getElementsByTagName('a'); 				
			asa[0].href = '#';
		}
	}	
	 getWindowSize();
	
   var totalHt=myHeight;
   var totalWt=myWidth; 
   
	var divs = document.getElementsByTagName('DIV');
	for(var no=0;no<divs.length;no++){		
		
		if(divs[no].className =='webFormOverlayContent') {
			
			if (document.all) {
				if(myHeight < 855) {
				document.getElementById('webFormOvrlyBg').style.height =document.documentElement.clientHeight;
				}
				else {
					document.getElementById('webFormOvrlyBg').style.height = document.documentElement.scrollHeight;
				}
				document.getElementById('webFormOvrlyBg').style.width =myWidth;
			}
			else {
				document.getElementById('webFormOvrlyBg').style.height = document.documentElement.scrollHeight+"px";
				document.getElementById('webFormOvrlyBg').style.width = document.documentElement.scrollWidth+"px";
			}
			document.getElementById('webFormOverlayCnt'+frmNum).style.display='block';
			document.getElementById('webFormOvrlyBg').style.display='block';
		}
	}	
}
window.onresize = webformOverlayDetect;
function webformOverlayDetect() {
                if(document.getElementById('webFormOvrlyBg')) {
                                webformOverlayPrintWdHt();
                }
}
function webformOverlayPrintWdHt() {
                getWindowSize();
                
   var totalHt=myHeight;
   var totalWt=myWidth; 
               if (document.all) {
				if(myHeight < 855) {
				document.getElementById('webFormOvrlyBg').style.height =document.documentElement.clientHeight;
				}
				else {
					document.getElementById('webFormOvrlyBg').style.height = document.documentElement.scrollHeight;
				}
				document.getElementById('webFormOvrlyBg').style.width =myWidth;
			}
			else {
				document.getElementById('webFormOvrlyBg').style.height = document.documentElement.scrollHeight+"px";
				document.getElementById('webFormOvrlyBg').style.width = document.documentElement.scrollWidth+"px";
			}
}


/* Accordion*/


var accordion_slideSpeed = 25; // Higher value = faster
	var accordion_timer = 10; // Lower value = faster
	var objectIdToSlideDown = false;
	var accordion_activeId = false;
	var accordion_slideInProgress = false;
	//var collapsedHash;
	//var expandedHash;
	function showHideContentAccordion(e,inputId)
	{ 
   //  collapsedHash=location.hash;
	 
		
		if(accordion_slideInProgress)return;
 		accordion_slideInProgress = true;
 		if(!inputId)inputId = this.id;
 		inputId = inputId + '';
 		var numericId = inputId.replace(/[^0-9]/g,'');
		
		var bodyDiv = document.getElementById('accordion_a' + numericId);
		//document.getElementById('open_button'+ numericId).src='Images/icon_green_open.gif';

 		objectIdToSlideDown = false;
 
 		if(!bodyDiv.style.display || bodyDiv.style.display=='none')
		{  			
   			if(accordion_activeId &&  accordion_activeId!=numericId)
			{   
 				//document.getElementById('open_button'+ accordion_activeId).src = 'Images/icon_blue_close.gif';
   				objectIdToSlideDown = numericId;
   				
   				var temp=document.getElementById("accordion_q"+ numericId);
				temp.className='accordion_head_selected';
                 

               var divs = document.getElementsByTagName('DIV');
                var divCounter = 1;
                 for(var no=0;no<divs.length;no++){
                if(divs[no].id=='accordion_q'+divCounter){
                     if(numericId!=divCounter){
						var temp=document.getElementById("accordion_q"+ divCounter);
						temp.className='accordion_head';
      				  }
			           divCounter++; 
				      }
				 }
				slideContentAccordion(accordion_activeId,(accordion_slideSpeed*-1));

   			}
			else
			{ 
				bodyDiv.style.display='block';
				bodyDiv.style.visibility = 'visible';
				var temp=document.getElementById("accordion_q"+ numericId);
				temp.className='accordion_head_selected';
				slideContentAccordion(numericId,accordion_slideSpeed);
  			}
 		}
		else
		{ 
			accordion_slideInProgress=false;
 		} 
	}


function slideContentAccordion(inputId,direction)
{
	
	var obj =document.getElementById('accordion_a' + inputId);
	var contentObj = document.getElementById('accordion_ac' + inputId);

	 height = obj.clientHeight;
	 if(height==0)height = obj.offsetHeight;
	 height = height + direction;
	 rerunFunction = true;
	 if(height>contentObj.offsetHeight){
	  height = contentObj.offsetHeight;
	  rerunFunction = false;
	 }
	 if(height<=1){
	  height = 1;
	  rerunFunction = false;
	 }
	 obj.style.height = height + 'px';
	 var topPos = height - contentObj.offsetHeight;
	 if(topPos>0)topPos=0;
	 contentObj.style.top = topPos + 'px';
	 if(rerunFunction){
	  setTimeout('slideContentAccordion(' + inputId + ',' + direction + ')',accordion_timer);
	 }else{
	  if(height<=1){
	   obj.style.display='none'; 
	   if(objectIdToSlideDown && objectIdToSlideDown!=inputId){
		document.getElementById('accordion_a' + objectIdToSlideDown).style.display='block';
		document.getElementById('accordion_a' + objectIdToSlideDown).style.visibility='visible';
		slideContentAccordion(objectIdToSlideDown,accordion_slideSpeed);    
	   }else{
		accordion_slideInProgress = false;
	   }
	  }else{
		//  expandedHash=location.hash;
		  if(accordion_activeId && accordion_activeId!=inputId){
			    var accOldHead=document.getElementById("accordion_q"+inputId);
				var accNewHead=document.getElementById("accordion_q"+accordion_activeId);				
				var newATags=accOldHead.getElementsByTagName('span');
				var oldATags=accNewHead.getElementsByTagName('span');
				var stringOld = (oldATags[0].id).split(' ').join('');
				var stringNew = (newATags[0].id).split(' ').join('');
		  		/*dynamicJSMethodAccordion(stringNew,stringOld);*/
				//trackEvent('rr','divTagName:'+stringNew);
	      }  
	   accordion_activeId = inputId;
	   accordion_slideInProgress = false;
	  }
	 }
}
 
/*function dynamicJSMethodAccordion(stringNew,stringOld){

//alert("HashPart collapsed--->"+collapsedHash +"HashPart Expanded--->"+expandedHash);  // Replace it with your code block

alert("Collapsed--->"+stringOld +"     Expanded--->"+stringNew);
//alert(document.getElementById('AccordionWrapper').innerHTML);
}*/

function initShowHideDivs()
{

var imgdivs = document.getElementsByTagName('img');
 var imgCounter = 1;
 for(var no=0;no<imgdivs.length;no++)
 {
	 if(imgdivs[no].className!=null){
  if(imgdivs[no].className=='accordionimgclose'){
  imgdivs[no].id='open_button'+imgCounter;
  imgCounter++
  }
 
	 }
 }

var divs = document.getElementsByTagName('DIV');
 var divCounter = 1;
 for(var no=0;no<divs.length;no++)
 {
  if(divs[no].className=='accordion_head_selected')
  	{	  	
	   divs[no].onclick = showHideContentAccordion;
	   divs[no].className='accordion_head';
	   divs[no].id = 'accordion_q'+divCounter;
	 	//document.getElementById('open_button'+divCounter).src='Images/icon_blue_close.gif';
	   var body = divs[no].nextSibling;
	   while(body && body.tagName!='DIV')
	   {
			body = body.nextSibling;
   	   }
   body.id = 'accordion_a'+divCounter; 
   contentDiv = body.getElementsByTagName('DIV')[0];
   //contentDiv.style.top = 0 - contentDiv.offsetHeight + 'px';  
   contentDiv.className='accordion_body_content';
   contentDiv.id = 'accordion_ac' + divCounter;
   body.style.visibility='hidden';
   body.style.overflow='hidden';   
   body.style.display='none';
   body.style.height='1px';
   
   divCounter++;
  
var answerDiv = document.getElementById('accordion_a'+1);
answerDiv.style.display='block';
answerDiv.style.visibility = 'visible'; 
var questionDiv = document.getElementById('accordion_q'+1);
questionDiv.className='accordion_head_selected';
//document.getElementById('open_button1').src='Images/icon_green_open.gif';
//slideContentAccordion(1,10);

  }  
 } 
 
}
 function validate()
{
	var contactemail = document.test.EmailAddress.value;
	document.getElementById('form-emailaddress').className='text_office rep_text_office';
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(contactemail))
	{
		document.getElementById('first_label').className='text all_fields_visible';
		document.getElementById('second_label').className='required fields_hidden';
	}
	else
	{
		document.getElementById('form-emailaddress').className='text_office rep_text_office fieldError';
		document.getElementById('first_label').className='text fields_hidden';
		document.getElementById('second_label').className='required all_fields_visible';
	}
}


/*Accordion*/



/* banner Home*/
var width=0;

function showHidden(e,inputId){

			if(!inputId)inputId = this.id;
			 
			inputId = inputId +'';

			var numericId = inputId.replace(/[^0-9]/g,'');

			var outDiv=document.getElementById('outDiv'+numericId);
			var overDiv=document.getElementById('overDiv'+numericId);

			var BgoutDiv=document.getElementById('outBg'+numericId);
			var BgoverDiv=document.getElementById('overBg'+numericId);

			outDiv.style.display='none';
			BgoutDiv.style.display='none';

			overDiv.style.display='block';
			BgoverDiv.style.display='block';

			overDiv.onmousemove=retainShowOver;
			BgoverDiv.onmousemove=retainShowOver;

			overDiv.onmouseout=hideShowOver;
			BgoverDiv.onmouseout=hideShowOver;


}


function hideShowOver(e,inputId){

			if(!inputId)inputId = this.id;
			 inputId = inputId + '';
			 var numericId = inputId.replace(/[^0-9]/g,'');

			var outDiv=document.getElementById('outDiv'+numericId);
			var overDiv=document.getElementById('overDiv'+numericId);

			var BgoutDiv=document.getElementById('outBg'+numericId);
			var BgoverDiv=document.getElementById('overBg'+numericId);

			outDiv.style.display='block';
			BgoutDiv.style.display='block';


			overDiv.style.display='none';
			BgoverDiv.style.display='none';


}

function retainShowOver(e,inputId){
			
			if(!inputId)inputId = this.id;
			 inputId = inputId + '';
			 var numericId = inputId.replace(/[^0-9]/g,'');


			var outDiv=document.getElementById('outDiv'+numericId);
			var overDiv=document.getElementById('overDiv'+numericId);

			var BgoutDiv=document.getElementById('outBg'+numericId);
			var BgoverDiv=document.getElementById('overBg'+numericId);

			outDiv.style.display='none';
			BgoutDiv.style.display='none';


			overDiv.style.display='block';
			BgoverDiv.style.display='block';



}



function showBannerInit(){

var divs=document.getElementsByTagName('DIV');

var outdivCounter = 1;
var overdivCounter=1;
var counter=0;
var overcounter=0;
   for(var no=0;no<divs.length;no++){
    
	 if(divs[no].className=='outDiv'){

     divs[no].onmouseover = showHidden;

    // divs[no].onmouseout = hide;   
     
     divs[no].id = 'outDiv'+outdivCounter;
     
	 divs[no].style.display='block';
	 counter++;
	 outdivCounter++;
     }

    if(divs[no].className==('overDiv'+overdivCounter)){

     divs[no].id = 'overDiv'+overdivCounter;
     overcounter++;
	 
    divs[no].className='overDiv';
	  divs[no].style.display='none';
	var bg = divs[no].nextSibling;
   while(bg && bg.tagName!='DIV'){
    bg = bg.nextSibling;
   }

     bg.id='overBg'+overdivCounter;
	 bg.className='overBg';
	  bg.style.display='none';
      
	  
	  
	  
		overdivCounter++;
		}

}

width=666/counter;

var divs=document.getElementsByTagName('DIV');

var divCounter=1;
leftValue=0;
for(var no=0;no<divs.length;no++){
    
	 if(divs[no].className=='outDiv'){

       divs[no].style.left=leftValue+'px';
	   divs[no].style.width=width-10+'px';
       
       var bg = divs[no].nextSibling;
       while(bg && bg.tagName!='DIV'){
       bg = bg.nextSibling;
       }
       bg.id='outBg'+divCounter;
	   bg.style.display='block';
       bg.style.left=leftValue+'px';
	   bg.style.width=width-1+'px';
      divCounter++;

	  leftValue=leftValue+width;
     }
  }


var divs=document.getElementsByTagName('DIV');


var val=0;
var overValue=0;
for(var no=0;no<divs.length;no++){
    
	 if(divs[no].className=='overBg'){
      
	  divs[no].style.left=val+'px';
	  divs[no].style.width=width-1+'px';
	  divs[no].style.display='none';
	  val=val+width;
	   }

	 if(divs[no].className=='overDiv'){
      divs[no].style.left=overValue+'px';
	  divs[no].style.width=width-10+'px';
	  overValue=overValue+width;
	 }
}

}

/*Banner Home*/


/*Pagination*/
var currentPage = 1;
var pgIntCntWdth = 0;
function checkAndLoadHash() {
  if(location.hash!="") {
    if(isNaN(location.hash.split("#")[1])==false) {
      if(parseInt(location.hash.split("#")[1]) > 0) {
        if(currentPage!=parseInt(location.hash.split("#")[1])) {
          return parseInt(location.hash.split("#")[1]);
        }
      }
    }
  }
  return currentPage;
}
function updateHash() {
  if(currentPage!=checkAndLoadHash()) {
    showDiv(checkAndLoadHash());
  }
}
var setCount = 10;
var prevCount = 5;
var generatePagination = function() {
  var returnString = "";
  if(totalPages > 0) {
    //Previous Anchor
	if(totalPages < 10) { pgIntCntWdth = (totalPages * 31);	}
	else { pgIntCntWdth = 290; }
    if(currentPage > 1) {	 
      returnString += "<div class=\"prvsDiv\"><a class=\"prvs\" href=\"#" + (currentPage - 1) + "\" onclick=\"showDiv(" + (currentPage - 1) + ");\"></a></div>";
    } else {	 
      returnString += "<div class=\"prvsDiv\" style=\"display: none\"> </div>";
    }
	 pgIntCntWdth += 15;
    //Main Pagination
    returnString += "<div><ul class=\"navDiv\">";
    var startNumber = (totalPages <= setCount)?1:(((currentPage - prevCount) < 1)?1:(currentPage - prevCount));
    var endNumber = ((startNumber + setCount)>(totalPages + 1))?(totalPages + 1):(startNumber + setCount);
    startNumber = ((endNumber - startNumber) < (setCount))? ((startNumber - ((setCount) - (endNumber - startNumber))) < 1 ? 1 : (startNumber - ((setCount) - (endNumber - startNumber)))) :startNumber;
    for(var currentNumber=startNumber; currentNumber < endNumber; currentNumber++) {
      if(currentNumber == currentPage) {
		  if (currentNumber == (endNumber-1)) { returnString += "<li class=\"selPageNumEnd\">" + currentNumber + "</li>"; }
		  else { returnString += "<li class=\"selPageNum\">" + currentNumber + "</li>"; }        
      } else {
		  if (currentNumber == (endNumber-1)) { returnString += "<li class=\"pgnLst\"><a href=\"#" + currentNumber + "\" onclick=\"showDiv(" + currentNumber + ");\">" + currentNumber + "</a></li>"; }
		  else { returnString += "<li><a href=\"#" + currentNumber + "\" onclick=\"showDiv(" + currentNumber + ");\">" + currentNumber + "</a></li>"; }
      }
    }
    returnString += "</ul></div>";
    //Count Label
    returnString += "<div class=\"cntDiv\"> of<span id=\"PageCount\">" + totalPages + "</span> </div>";
	pgIntCntWdth += 100;
    //Next Anchor
    if(currentPage < totalPages) {
      returnString += "<div class=\"nxtDiv\"><a class=\"nxt\" href=\"#" + (currentPage + 1) + "\" onclick=\"showDiv(" + (currentPage + 1) + ");\"> </a></div>";
    } else {	 	  
      returnString += "<div class=\"nxtDiv\" style=\"display: none\"> </div>";
    }
	pgIntCntWdth += 11;
	pgIntCntWdth = pgIntCntWdth + 'px'
	document.getElementById('paginationInrContent').style.width = pgIntCntWdth;		
    return returnString;
  } else {
    return returnString;
  }
}

//Callback Handler For Page Number Clicks
function showDiv(divNumber) {
if(document.getElementById("div" + divNumber)) {
  if(currentPage!=divNumber) {
    document.getElementById("div" + currentPage).style.display = "none";
    document.getElementById("div" + divNumber).style.display = "block";
    //Update currentPage
    currentPage = divNumber;	
  }
   else {
	   if(!window.location.hash) {
 		window.location=window.location+'#1';
	   }
  }
  document.getElementById("paginationInrContent").innerHTML = generatePagination();
} else { 
		//window.location='http://PageNotFound.html'; 
		window.location = window.location.href.split('#')[0];
	}
}

//Generate Divs Function For Unit Testing
/*function generateDivs() {
  var returnString = "";
  for(var i=1; i<=totalPages; i++) {
    returnString += "<div class=\"searchResultsDiv \" id=\"div" + i + "\" " + ((i!=1)?"style=\"display:none\"":"") + ">Div Content " + i + "</div>";
	//returnString += document.getElementById('divContent'+i).innerHTML;
  }
  document.getElementById("searchResults").innerHTML = returnString;
}*/



/*Pagination*/


// Contextual Help ---- start

var currShow = false; 
var boxHeight, cntHeight;
function setOpacity(obj, opacity) {
  opacity = (opacity == 100)?99.999:opacity;

  // IE/Win
  obj.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=98);";

  // Safari<1.2, Konqueror
  obj.style.KHTMLOpacity = opacity/100;

  // Older Mozilla and Firefox
  obj.style.MozOpacity = opacity/100;

  // Safari 1.2, newer Firefox and Mozilla, CSS3
  obj.style.opacity = opacity/100;
}


var maxTooltipHt=false;


function ShowChildFunction(inputId, numericId){
			
			var inputId= inputId;
			var numericId=numericId;
			currShow=numericId;	
		    var x = document.getElementById("tooltipBody"+numericId);
					
			//leftX = x.offsetLeft;
			//topY = x.offsetTop;	
			//alert(currShow);
			leftX = findPosX(x);
			topY = findPosY(x);
			//alert(leftX+" "+topY);
			
			//alert(leftX+"------"+topY);
			
            if(maxTooltipHt){
			 //alert("showed max height before");
				var element = document.getElementById('toolTip');
				while (element.firstChild) {
				  element.removeChild(element.firstChild);
				}
				//alert(document.getElementById('toolTip').innerHTML);
                var newTooltip=document.createElement('div');
				newTooltip.id='tooltipBox';
				var parTooltip=document.getElementById('toolTip');
				parTooltip.appendChild(newTooltip);
			    maxTooltipHt=false;  
			
			 }
             
			  if(numericId==1){
			 //alert("showed max height before");
				var element = document.getElementById('toolTip');
				while (element.firstChild) {
				  element.removeChild(element.firstChild);
				}
				//alert(document.getElementById('toolTip').innerHTML);
                var newTooltip=document.createElement('div');
				newTooltip.id='tooltipBox';
				var parTooltip=document.getElementById('toolTip');
				parTooltip.appendChild(newTooltip);
                //alert(document.getElementById('tooltipBox').id);   
			   // maxTooltipHt=false;  
			
			 }
     		document.getElementById('copays').style.display = "block";
			setOpacity(document.getElementById("arrow"), 98);
			 
           //alert(document.getElementById('copays').innerHTML);

			//var delayed=setTimeout("document.getElementById('copays').style.display='none';",2000);
			//document.getElementById('tooltipBox').innerHTML = null;
			//alert("document.getElementById('tooltipBox').offSetHeight: "+document.getElementById('tooltipBox').offsetHeight);
			document.getElementById('tooltipBox').innerHTML = document.getElementById('tooltipContent'+numericId).innerHTML;
			//alert("document.getElementById('tooltipBox').offSetHeight: "+document.getElementById('tooltipBox').offsetHeight);
			//alert("document.getElementById('toolTip').offSetHeight: "+document.getElementById('toolTip').offsetHeight);
			
			

            getPosition('copays',leftX,topY,'arrow',currShow);


}

function showdiv(e,inputId){    

             
            boxHeight = 0;
			cntHeight = 0;
			if(!inputId)inputId = this.id;
			inputId = inputId + '';
			var numericId = inputId.replace(/[^0-9]/g,'');
			document.getElementById(inputId).className = 'tooltipHeadSelected';
			pausecomp(500);
			ShowChildFunction(inputId,numericId);
			
			
}

function pausecomp(millis)
{
var date = new Date();
var curDate = null;

do { curDate = new Date(); }
while(curDate-date < millis);
} 


function showTooltip(numId){
			var numericId=numId;
		    //	alert("retain"+numericId);
			//alert("showTooltip");
            var x = document.getElementById("tooltipBody"+numericId);
			leftX = findPosX(x);
			topY = findPosY(x);
			
			document.getElementById('copays').style.display = "block";
			//document.getElementById('tooltipBox').innerHTML = document.getElementById('tooltipContent'+numericId).innerHTML;
			//getPosition('copays',leftX,topY,'arrow',currShow);
}


function findPosX(obj)
  {
			var curleft = 0;
			if(obj.offsetParent)
				while(1) 
				{
				  curleft += obj.offsetLeft;
				  if(!obj.offsetParent)
					break;
				  obj = obj.offsetParent;
				}
			else if(obj.x)
				curleft += obj.x;
			return curleft;
  }

  function findPosY(obj)
  {
			var curtop = 0;
			if(obj.offsetParent)
				while(1)
				{
				  curtop += obj.offsetTop;
				  if(!obj.offsetParent)
					break;
				  obj = obj.offsetParent;
				}
			else if(obj.y)
				curtop += obj.y;
			return curtop;
  }

function getPosition(divnamePos,leftX,topY,arrowDiv, divCount){

			var screenW,screenH;
			screenW = screen.width;
			screenH = screen.height;
		    var divNumber=divCount;
			var divLeft, divTop;
			divLeft = leftX;
			divTop = topY;					
			var spaceX=screenW - divLeft;
			var spaceY=screenH - divTop;
			var positionId;

           //alert(screenW+"-----"+screenH);
           //alert("display top"+divLeft+"display top"+divTop);
		  
		  
		  
		  
		  
		  
		   
           getWindowSize();

		   var totalHt=myHeight;
		   var totalWt=myWidth;
		   //alert("pageHt"+totalHt);
		  
		  
			  var myWindowWidth = 0, myWindowHeight = 0;
			  if( typeof( window.innerWidth ) == 'number' ) {
				//Non-IE
				myWindowWidth = window.innerWidth;
				myWindowHeight = window.innerHeight;
			  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
				//IE 6+ in 'standards compliant mode'
				myWindowWidth = document.documentElement.clientWidth;
				myWindowHeight = document.documentElement.clientHeight;
			  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
				//IE 4 compatible
				myWindowWidth = document.body.clientWidth;
				myWindowHeight = document.body.clientHeight;
			  }
			//alert( 'Width = ' + myWidth );
			//alert( 'Height = ' + myHeight );
			screenW=myWindowWidth;
			screenH=myWindowHeight;
			
			//alert(screenH);

		   
		   var scrollHt=document.documentElement.scrollTop;
		  
		  var scrollBt=document.documentElement.scrollLeft;
		  //alert(scrollBt);
		   var visibleScreen=(scrollHt) + (screenH);
          
		  
		  
		   
		   
		   
//code by Chandan lakkkoju
			boxHeight =  document.getElementById("tooltipBox").offsetHeight;
             var boxWidth=document.getElementById("tooltipBox").offsetHeight;			
            
			
			var tooltipY=divTop+boxHeight + 38;
				
			 
			
			//alert(tooltipY+"------"+visibleScreen);
			

			//alert("boxHeight : "+boxHeight);

             

			if(boxHeight >= 440){
				
				cntHeight = 430;
				//alert("if loop boxHeight:"+boxHeight+"cntHeight: "+cntHeight);

				//document.getElementById("cntxtHlpInnrCnt").style.height = cntHeight;
                document.getElementById("cntxtHlpInnrCnt").style.overflow='hidden';
				//document.getElementById('copays').style.height = cntHeight;
                document.getElementById('tooltipBox').style.height='440px';
                document.getElementById('tooltipBox').style.overflow='hidden';
                maxTooltipHt=true;
			}else{
				
				
				cntHeight = boxHeight;
				//alert("else loop boxHeight:"+boxHeight+"cntHeight: "+cntHeight);
				//document.getElementById("cntxtHlpInnrCnt").style.height = boxHeight;
				//document.getElementById('copays').style.height = boxHeight;

			}
//ends here	

           var tempDiv1=document.getElementById('tooltipHead'+divNumber);
                 tempDivX1=findPosX(tempDiv1);
				 var tiplength1 = divLeft-tempDivX1;
           
           if(((divLeft-scrollBt)-tiplength1)> 200 && (screenW - (divLeft-scrollBt))>200 &&boxHeight<440 && (divTop-scrollHt)>(boxHeight+100)){
		   
		      
			  //alert("top");
			  var tempDiv=document.getElementById('tooltipHead'+divNumber);
                 tempDivX=findPosX(tempDiv);
				 var tiplength = divLeft-tempDivX;
				 tiplength=tiplength/2;
			  document.getElementById(divnamePos).style.left= (divLeft - 200 - tiplength) + "px";
			  if(document.all){
			 document.getElementById(divnamePos).style.top = (divTop - (cntHeight+90)) + "px";
			  }
			  else{
			 document.getElementById(divnamePos).style.top = (divTop - (cntHeight+80)) + "px";
			  }
			  positionId="top";
			    
		   
		 //  }

		  // if((divLeft<800) && (divTop>750)){
            /* to display top*/
			//alert("display top"+divLeft+"display top"+divTop);
			//document.getElementById(divnamePos).style.left= (divLeft - 250) + "px";
		//	document.getElementById(divnamePos).style.top = (divTop - (cntHeight+80)) + "px";
             
          
			//positionId="top";
              } else{
			     if((screenW - divLeft) > 420 ){
				 //position to the right
			  	 //alert("right");
				 document.getElementById(divnamePos).style.left = (divLeft+12) + "px";	
				positionId="right";
			   	 }else{
				 //position to the left
			    // alert("left");
				 
				 var tempDiv=document.getElementById('tooltipHead'+divNumber);
                 tempDivX=findPosX(tempDiv);
				 var tiplength = divLeft-tempDivX;
				// added on 2nd Nov
				 if(((divLeft-scrollBt)-tiplength)<(screenW - (divLeft-scrollBt))){

				  document.getElementById(divnamePos).style.left = (divLeft+10) + "px";
				  positionId="right";
				 }else {
			     /* browser compatibility */
				 //alert(document.getElementById(divnamePos).id);
				
				 document.getElementById(divnamePos).style.left = ((divLeft-tiplength-425)) + "px";
				  positionId="left";
				 }
				 // end 2 nd Nov
		         }
			
			    if((screenH - divTop) > 500 ){
				//position to the TOP
			   //alert("bottom");
				
               

                  if(boxHeight>440){
					  var tempValue=divTop+480;   // 400 for box as we reduces the height
                      // alert(tempValue+"======"+visibleScreen);
                       if(tempValue>visibleScreen){
					  
					      var tempHeight=tempValue-visibleScreen;
				          document.getElementById(divnamePos).style.top = (divTop - (tempHeight)) + "px";
					      }else{
							
		                        var tempHeight=tooltipY-visibleScreen;
				                document.getElementById(divnamePos).style.top = (divTop- 20) + "px";
					           } 
							   
				  }		   
					else{
                           
						if(tooltipY>visibleScreen){
							 
						var tempHeight=tooltipY-visibleScreen;
						document.getElementById(divnamePos).style.top = (divTop- (tempHeight)) + "px";
						
						}else {
                           
						document.getElementById(divnamePos).style.top = (divTop - 20) + "px"; 
						
						}
				
			        }

				
				
				//document.getElementById(divnamePos).style.top = (divTop - 200) + "px";
				//document.getElementById(arrowDiv).style.top = 200 + "px";
			    }else{
				//position to the Bottom
				//document.getElementById(divnamePos).style.top = '500px';
				//alert("top");
                 if(boxHeight>440){
					  var tempValue=divTop+480;   // 400 for box as we reduces the height
                       //alert(tempValue+"======"+(visibleScreen));
                       if(tempValue>(visibleScreen)){
					          
					      var tempHeight=tempValue-visibleScreen;
				          document.getElementById(divnamePos).style.top = (divTop - (15 + tempHeight)) + "px";
					      }else{
							   
		                        var tempHeight=tooltipY-visibleScreen;
				                document.getElementById(divnamePos).style.top = (divTop - 20) + "px";
					           } 
							   
				  }		   
					else{
                        
						if(tooltipY>visibleScreen){
							
						var tempHeight=tooltipY-visibleScreen;
						document.getElementById(divnamePos).style.top = (divTop- (15 + tempHeight)) + "px";
						 
						}else {
						document.getElementById(divnamePos).style.top = (divTop - 20) + "px"; 
						 
						}
				
			        }

				//document.getElementById(divnamePos).style.top = (divTop + 200) + "px";
			    //document.getElementById(arrowDiv).style.top = (divTop-200) + "px";
			   }
         }
		
		if(positionId=="top"){
		//alert("arrtop");
			document.getElementById(arrowDiv).style.left= 190 + "px";
			if(document.all) {
				document.getElementById(arrowDiv).style.top = (cntHeight+68) + "px";
				document.getElementById(arrowDiv).style.backgroundImage = 'url(images/arrow.gif)'; 
			}
			else {
				document.getElementById(arrowDiv).style.top = (cntHeight+59) + "px"; 
				document.getElementById(arrowDiv).style.backgroundImage = 'url(images/arrowff.gif)'; 
			}

			
			document.getElementById('arrow').style.width = '34px';
			document.getElementById('arrow').style.height = '24px';			
			document.getElementById('cntxtHlpBgId').style.height= (cntHeight+46) + "px";
		
		} else if(positionId=="right"){
		//alert("right");
		
		document.getElementById(arrowDiv).style.left= -16+ "px";
		if(boxHeight>440){
					  var tempValue=divTop+480;   // 400 for box as we reduces the height
                     //  alert(tempValue+"======"+visibleScreen);
                       if(tempValue>visibleScreen){
					   //  alert("tooltip out of visible area");
					      var tempHeight=tempValue-visibleScreen;
						 
				          document.getElementById(arrowDiv).style.top = (tempHeight + 10) + "px";
					      }else{
		                        var tempHeight=tooltipY-visibleScreen;
				                document.getElementById(arrowDiv).style.top = 15 + "px";
					           } 
							   
				  }		   
					else{

						if(tooltipY>visibleScreen){
						var tempHeight=tooltipY-visibleScreen;
                        document.getElementById(arrowDiv).style.top = (tempHeight + 10) + "px";

						}else {
						document.getElementById(arrowDiv).style.top = 15 + "px"; 

						}
				
			        }

		document.getElementById(arrowDiv).style.backgroundImage = "url(images/arrow_lt_1.gif)"; 		
			document.getElementById('arrow').style.width = '20px';
			document.getElementById('arrow').style.height = '35px';
        document.getElementById('cntxtHlpBgId').style.height= (cntHeight+40) + "px";
		}
		else if(positionId=="left"){
		//alert("left");
		document.getElementById(arrowDiv).style.left= 401+ "px";
		
		if(boxHeight>440){
					  var tempValue=divTop+480;   // 450 for box as we reduces the height
                      // alert(tempValue+"======"+visibleScreen);
                       if(tempValue>visibleScreen){
					     //alert("tooltip out of visible area");
					      var tempHeight=tempValue-visibleScreen;
						  //alert(tempHeight);
				             
						  document.getElementById(arrowDiv).style.top = (tempHeight + 10) + "px";
					      }else{
							    
		                        var tempHeight=tooltipY-visibleScreen;
				                document.getElementById(arrowDiv).style.top = 15 + "px";
					           } 
							   
				  }		   
					else{

						if(tooltipY>visibleScreen){
						var tempHeight=tooltipY-visibleScreen;
                        document.getElementById(arrowDiv).style.top = (tempHeight + 10) + "px";
						
						}else {
						document.getElementById(arrowDiv).style.top = 15 + "px"; 
						
						}
				
			        }
		document.getElementById(arrowDiv).style.backgroundImage = "url(images/arrow_rt_12.gif)";
			document.getElementById('arrow').style.width = '23px';
			document.getElementById('arrow').style.height = '25px'; 
		document.getElementById('cntxtHlpBgId').style.height= (cntHeight+40) + "px";
        }
		
		
		
}


function closediv()
{           
	       pausecomp(500);
            //document.getElementById('tooltipBox').display = "none";
			//document.getElementById('toolTip').display = "none";
			document.getElementById('copays').style.display = "none";
			document.getElementById('tooltipHead'+currShow).className = 'tooltipHead';
             // var delayed=setTimeout('closeChildFunction()',500);  
			
			
}


function closeChildFunction(){
pausecomp(500);
document.getElementById('tooltipHead'+currShow).className = 'tooltipHead';
document.getElementById('copays').style.display = "none";

}

function closeTooltip(closeId)
{           
	      
			//document.getElementById('tooltipBox').display = "none";
			//document.getElementById('toolTip').display = "none";
            //var delayed=setTimeout('closeChildFunction()',500);
			document.getElementById('copays').style.display = "none";
			document.getElementById('tooltipHead'+currShow).className = 'tooltipHead';
	
}


function initTooltip(){

        
		var spans=document.getElementsByTagName('span');
		
		spanCounterOne=1;
        spanCounterTwo=1;
		for(var no=0;no<spans.length;no++){

            if(spans[no].className=='tooltipHead'){

               spans[no].id='tooltipHead'+spanCounterOne;
             spans[no].onmouseover=showdiv;
			  
			  
			  
			  // for ddelayed result

			 /* spans[no].onmouseover= function() {
		delayhide=setTimeout('showdiv('+window.event+','+spans[no]+')',500);
		}*/
			  
			  
			  spans[no].onmouseout =closediv;
              
			   spanCounterOne++;
			}

            if(spans[no].className=='tooltipBody'){
					
               spans[no].id='tooltipBody'+spanCounterTwo;
              // spans[no].onmouseover=showdiv;
               //spans[no].onmouseout=closediv; 
			   spanCounterTwo++
			}

		}

        var divs=document.getElementsByTagName('div');
		var divCounter=1;
		for(var no=0;no<divs.length;no++){

            if(divs[no].className=='tooltipContent'){

               divs[no].id='tooltipContent'+divCounter;
               
			   divCounter++;
			}

		}

              if(document.getElementById('copays')){
        var tooltipContainer=document.getElementById('copays');
		//  tooltipContainer.onmouseover=showdiv;
		//tooltipContainer.onmouseout=closediv;
		tooltipContainer.onmouseover = function() {
		showTooltip(currShow);
		}
		tooltipContainer.onmouseout=closeTooltip;

		 //for delayed result
		/*tooltipContainer.onmouseout = function() {
		delayhide=setTimeout('closeTooltip(' + currShow + ')',8500);
		}*/
		//document.getElementById('tooltipCloseBox').onclick=closediv;
		document.getElementById('tooltipCloseBox').onclick=closediv;
			  }
}

function getWindowSize() {
if( (typeof( window.innerWidth ) == 'number') || ( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) ) {
    //Non-IE
    myWidth = document.body.clientWidth;
    myHeight =document.body.clientHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 4 in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  }
  /*else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 6+ compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  */
}
 
 /*To strip unsafe characters from search queries*/
 function validate_theme_search_form(thisform) {
  var searchInput = document.getElementById('query').value;
  for (var i=0; i<searchInput.length; ++i) {
   // Check for dangerous characters
   if ( searchInput[i] == ';' || 
     searchInput[i] == '<' ||
     searchInput[i] == '>' || 
     searchInput[i] == '\\' ||
     searchInput[i] == '&') {
    // alert('bad input, using substring: ' + searchInput.substring(0,i));
    // If a bad char is found, strip off the rest of the string
    document.getElementById('form-refineSearchQuery').value = searchInput.substring(0,i);
    return true;
   }
  }
  return true;
 }


var myWindow;
function printVersion() {
     myWindow=window.open('dummyPrint.html', "PopUpWindow",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=950,height=600' );
	 
}

/*print script */
function PrintContents() {	
	 printedDiv=document.getElementById("wrapper");	
	 /* This inserts a Print button onto the print preview page.  We may or may not use this. */
     var printContents="<div class='printPopHead'><a href='#' onclick='window.print()' class='popPrintLink'>Print</a></div>";
     printContents+=printedDiv.innerHTML;
	 printContents+="<br/>";
	 /* Uncomment the line below to display Parent Page URL in the Print Preview Window*/
	 /*printContents+="<div class='pgURL'>"+window.location+"</div>"*/
	 /* This sets the conents of the popup window to the html that was copied from the parent. */
     myWindow.document.body.innerHTML=printContents;
	 var aPrint = myWindow.document.body.getElementsByTagName('a');	 
	 for(l=0;l<aPrint.length;l++) {	
	 	if(aPrint[l].className != 'popPrintLink') {
			aPrint[l].removeAttribute('href');
			aPrint[l].style.cursor = 'text';
			aPrint[l].style.color = '#000';
			
		}
	 }
}

/*function trackEvent(compType,hrefName) {
		alert("Component Type : "+compType+" Href Name : "+hrefName);
}*/