/* #################################################################################################################*/




/* #################################################################################################################*/




function initShowHideDivs()
{
	var nav =  document.getElementById('nav');
	var divs = nav.getElementsByTagName('DIV');
	var divCounter = 1;
	for(var no=0;no<divs.length;no++){
		if(divs[no].className=='nav-top' || divs[no].className=='gray' || divs[no].className=='green' || divs[no].className=='blue' || divs[no].className=='orange' || divs[no].className=='teal'){
			divs[no].onclick = showHideContent;
			divs[no].id = 'nav-q'+divCounter;
			var drop = divs[no].nextSibling;
			while(drop && drop.tagName!='DIV'){
				drop = drop.nextSibling;
			}
			drop.id = 'nav-a'+divCounter;	
			contentDiv = drop.getElementsByTagName('DIV')[0];
			
			
			contentDiv.style.top = 0 - contentDiv.offsetHeight + 'px'; 	
			contentDiv.className='nav-drop-content-' + divs[no].className ;
			contentDiv.id = 'nav-ac' + divCounter;
			drop.style.display='none';
			drop.style.height='1px';
			divCounter++;
		}		
	}	
}

/* #################################################################################################################*/





/* #################################################################################################################*/

var nav_vel = 100;	// Higher value = faster
var nav_interval =0;	// Lower value = faster

var objectIdToSlideDown = false;
var nav_activeId = false;
var nav_slideInProgress = false;
var openId = '';


function showHideContent(e,inputId) {

		if(nav_slideInProgress)return;
		nav_slideInProgress = true;
		if(!inputId)inputId = this.id;
		inputId = inputId + '';
		var numericId = inputId.replace(/[^0-9]/g,'');
		var dropDiv = document.getElementById('nav-a' + numericId);
		
		objectIdToSlideDown = false;
		
		if(!dropDiv.style.display || dropDiv.style.display=='none'){		
			if(nav_activeId &&  nav_activeId!=numericId){			
				objectIdToSlideDown = numericId;
				openId = numericId;
				slideContent(nav_activeId,(nav_vel*-1));
			}else{
				dropDiv.style.display='block';
				dropDiv.style.visibility = 'visible';
				openId = numericId;
				slideContent(numericId,nav_vel);
				//dimContent(nav_vel);
			}
		}else{
			openId = '';
			slideContent(numericId,(nav_vel*-1));
			nav_activeId = false;
			//dimContent(nav_vel*-1);
			highlight2('selected', mainColor, 1);
		}	
}



/* #################################################################################################################*/


/* #################################################################################################################*/



function slideContent(inputId,direction,closer)
{	
	setTopColor(inputId, direction, closer);
	var obj = document.getElementById('nav-a' + inputId);
	var contentObj = document.getElementById('nav-ac' + inputId);
	height = obj.clientHeight;
	
	if(height==0)height = obj.offsetHeight;
	
	height = height + direction;
	
	rerunFunction = true;
	
	var textHeight;
	var endHeight = contentObj.offsetHeight;
	var setFlag = false;
	var insideDivs = contentObj.getElementsByTagName('DIV');
	for(var j=0;j<insideDivs.length;j++){
		if (insideDivs[j].className == 'page-text-2-1')
		{
			//alert(insideDivs[j].className);
			setFlag = true;
		}
		textHeight = insideDivs[j].offsetHeight;
		
		if (textHeight>endHeight)
		{
			endHeight = textHeight;
		}
	}

//if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)){ 
//	if(setFlag){
//		endHeight = endHeight + 50;
//	}else{
//	endHeight = endHeight + 30;
//}	

//}

if (inputId == 1)
{
	endHeight = 205;
}else if (inputId == 2)
{
	endHeight = 230;
}else if (inputId == 3)
{
	endHeight = 205;
}


	
	if(height>endHeight){
		height = endHeight;
		
		rerunFunction = false;
	}
	if(height<=1){
		height = 1;
		
		rerunFunction = false;
	}

	obj.style.height = height + 'px';
	
	var topPos = height - endHeight;
	if(topPos>0)topPos=0;
	contentObj.style.top = topPos + 'px';
	if(rerunFunction){
		setTimeout('slideContent(' + inputId + ',' + direction + ')',nav_interval);
	}else{
		if(height<=1){
			obj.style.display='none'; 
			if(objectIdToSlideDown && objectIdToSlideDown!=inputId){
				document.getElementById('nav-a' + objectIdToSlideDown).style.display='block';
				document.getElementById('nav-a' + objectIdToSlideDown).style.visibility='visible';
				slideContent(objectIdToSlideDown,nav_vel);				
			}else{
				nav_slideInProgress = false;
			}
		}else{
			nav_activeId = inputId;
			nav_slideInProgress = false;
		}
	}
}









/* #################################################################################################################*/



/* #################################################################################################################*/

var stopId = '';

function setTopColor(c,d,cl) {
	
	setSelectedDivColor(d);
	var obj = document.getElementById('nav-a' + c);
	var col = obj.className;
	var topColObj = document.getElementById('nav-q' + c);
	if (d > 0){
		stopId = 'nav-q'+c;
		if(col == 'nav-drop-gray'){
			topColObj.style.backgroundColor = '#29abae';
		}

		if(col == 'nav-drop-green'){
			topColObj.style.backgroundColor = '#8cc63f';
		}

		if(col == 'nav-drop-blue'){
			topColObj.style.backgroundColor = '#29abae';
		}

		if(col == 'nav-drop-orange'){
			topColObj.style.backgroundColor = '#fbb03b';
		}
		if(col == 'nav-drop-teal'){
			topColObj.style.backgroundColor = '#2fade3';
		}
			
			unhighlight2('selected');

	}else{
		if(cl = 1)
		{
		topColObj.style.backgroundColor = '#534741';
		}
		stopId = '';
	}
	
}


/* #################################################################################################################*/



/* #################################################################################################################*/
var selectedClassName = '';
function setSelectedDivColor(d) {
var selectedObj = document.getElementById('selected');
	if (d > 0)
	{	
		if(selectedObj.className != 'nav-top') {
			selectedClassName = selectedObj.className;
			selectedObj.className = 'nav-top';
		}
		
		
	}else {
		//alert("I am Here: " + selectedClassName);
		selectedObj.className = selectedClassName;
	}
}


/* #################################################################################################################*/




/* #################################################################################################################*/



/* #################################################################################################################*/

function closeNav(id, dir, mark) {
	stopId = '';
	slideContent(id, dir, mark);
	openId = '';
	highlight2('selected', mainColor, 1);
}

/* #################################################################################################################*/



/* #################################################################################################################*/

function closeAll() {
	if(openId != ''){
		stopId = '';
		slideContent(openId, -100);
		openId = '';
	}
}






/* #################################################################################################################*/


function highlight (s, color) {
//alert('ID:'+s+'  COL:' + color);
var navHLObj = document.getElementById(s);
	if(color == 'gray'){
		navHLObj.style.backgroundColor = '#847c79';
	}

	if(color == 'green'){
		navHLObj.style.backgroundColor = '#8cc63f';
	}

	if(color == 'blue'){
		navHLObj.style.backgroundColor = '#29abae';
	}

	if(color == 'orange'){
		navHLObj.style.backgroundColor = '#fbb03b';
	}
	if(color == 'teal'){
		navHLObj.style.backgroundColor = '#2fade3';
	}

	if(color == 'home'){
		navHLObj.style.backgroundColor = '#29abae';
	}
}
/* #################################################################################################################*/





/* #################################################################################################################*/
function unhighlight (s) {
//alert('ID:'+s+'  UN');
var navUHLObj = document.getElementById(s);

if (s != stopId)
{
	navUHLObj.style.backgroundColor = '#534741';
}

}





/* #################################################################################################################*/
var mainColor = '';

function highlight2 (s, color, marker) {
	mainColor = color;
//alert('ID:'+s+'  COL:' + color);
var navHLObj = document.getElementById(s);
if(openId != '' || marker == 1){
	if(color == 'gray'){
		navHLObj.style.backgroundColor = '#847c79';
	}

	if(color == 'green'){
		navHLObj.style.backgroundColor = '#8cc63f';
	}

	if(color == 'blue'){
		navHLObj.style.backgroundColor = '#29abae';
	}

	if(color == 'orange'){
		navHLObj.style.backgroundColor = '#fbb03b';
	}
	if(color == 'teal'){
		navHLObj.style.backgroundColor = '#2fade3';
	}

	if(color == 'home'){
		navHLObj.style.backgroundColor = '#29abae';
	}
}
}
/* #################################################################################################################*/





/* #################################################################################################################*/
function unhighlight2 (s) {

var navUHLObj = document.getElementById(s);

if(openId != ''){
	navUHLObj.style.backgroundColor = '#534741';
}

}





/* #################################################################################################################*/






/* #################################################################################################################*/

function dimContent(dir) {
	
	if (dir > 0)
	{	
		var dimObj = document.getElementById('content');
		//dimObj.style.display = 'none';
		dimObj.style.backgroundImage = 'url()';
		dimObj.style.backgroundColor = 'black';
		dimObj.style.opacity = 8/10;
		dimObj.style.filter = 'alpha(opacity=' + 8*10 + ')';

	}else{
		var dimObj = document.getElementById('content');
		//dimObj.style.display = 'block';
		dimObj.style.backgroundImage = 'url(../../member-central/images/sub-page/interior-page-bg.png)';
		dimObj.style.backgroundRepeat = 'repeat-x';
		dimObj.style.backgroundColor = '#ffffff';
		dimObj.style.opacity = 10/10;
		dimObj.style.filter = 'alpha(opacity=' + 10*10 + ')';

	}
}


/* #################################################################################################################*/






/* #################################################################################################################*/

function highLightPromo(s) {
	var promo = document.getElementById(s);
	var promoDiv = promo.getElementsByTagName('DIV')[0];
	promoDiv.style.backgroundImage = 'url(/member-central/images/index/10-spot/promo-spot-bg-white.png)';

}

/* #################################################################################################################*/






/* #################################################################################################################*/



function unhighLightPromo(s) {
		var promo = document.getElementById(s);
	var promoDiv = promo.getElementsByTagName('DIV')[0];
	promoDiv.style.backgroundImage = 'url(/member-central/images/index/10-spot/promo-spot-bg.png)';

}


/* #################################################################################################################*/






/* #################################################################################################################*/



function CheckIsIE()
{
if (navigator.appName.toUpperCase() == 'MICROSOFT INTERNET EXPLORER') { return true;}
else { return false; }
}


function printer()
{

if (CheckIsIE() == true)
{

 for (var i=0; i<window.frames.length; i++) {
    window.frames[i].focus();
    //window.frames[i].print();
  }
}
window.print();


}

function toggleSubnav(a,b){
var subnav = a;
var id = b;
var subnav_obj = document.getElementById(subnav);
var img_obj = document.getElementById(id);
if(subnav_obj.style.display == 'none'){
	subnav_obj.style.display = 'block';
	img_obj.src = '/member-central/images/common/left_nav_close_button.png';
}else {
subnav_obj.style.display = 'none';
img_obj.src = '/member-central/images/common/left_nav_open_button.png';
}


}



