//	Filename:		_jsFunctions.js
//	Application:	Cariten Senior Health web site
//	Programmer:		Larry Luke
//	Created:		11/11/2008
//	LastUpdate:		11/13/2008


// file path to images
var fPath = 'http://www.caritenseniorhealth.com';


// image swap variable and functions on site navigation
Image0 = new Image(20,20);
Image0.src = fPath + '/images/arrowB_20x20.jpg';

Image1 = new Image(20,20);
Image1.src = fPath + '/images/arrowR_20x20.jpg';

function iSwapA(iID,tID) {
	document.images[iID].src = fPath + '/images/arrowR_20x20.jpg';
	document.getElementById(tID).style.color = '#d5231c';
}
function iSwapB(iID,tID) {
	document.images[iID].src = fPath + '/images/arrowB_20x20.jpg';
	document.getElementById(tID).style.color = '#24166c';
}


// name the document
self.name = 'content'


// function to display and hide child elements of nav menu	
function showBranch(branch){
	var objBranch = document.getElementById(branch).style;
	if(objBranch.display=="block") {
		objBranch.display="none";
	}
		
	else {
		objBranch.display="block";
	}
   
	if(document.getElementById(branch).id == "adv") {
		objBranch = document.getElementById("ptd").style.display = "none";
		objBranch = document.getElementById("enr").style.display = "none";		
		objBranch = document.getElementById("why").style.display = "none";		
		objBranch = document.getElementById("med").style.display = "none";		

			if(screen.width <= 800) {
				document.getElementById(branch).style.position='absolute';
				document.getElementById(branch).style.top='300';
				document.getElementById(branch).style.left='258';	
				document.getElementById(branch).style.zIndex=1;	
			}
			if(screen.width > 800 && screen.width <= 1024) {
				document.getElementById(branch).style.position='absolute';
				document.getElementById(branch).style.top='300';
				document.getElementById(branch).style.left='372';	
				document.getElementById(branch).style.zIndex=1;						
			}
			if(screen.width > 1024 && screen.width < 1280) {
				document.getElementById(branch).style.position='absolute';
				document.getElementById(branch).style.top='300';
				document.getElementById(branch).style.left='438';	
				document.getElementById(branch).style.zIndex=1;	
			}
			if(screen.width >= 1280) {
				document.getElementById(branch).style.position='absolute';
				document.getElementById(branch).style.top='300';
				document.getElementById(branch).style.left='499';	
				document.getElementById(branch).style.zIndex=1;	
			}
	}
	
	if(document.getElementById(branch).id == "ptd") {
		objBranch = document.getElementById("adv").style.display = "none";
		objBranch = document.getElementById("enr").style.display = "none";		
		objBranch = document.getElementById("why").style.display = "none";		
		objBranch = document.getElementById("med").style.display = "none";		

			if(screen.width <= 800) {
				document.getElementById(branch).style.position='absolute';
				document.getElementById(branch).style.top='330';
				document.getElementById(branch).style.left='258';	
				document.getElementById(branch).style.zIndex=1;	
			}
			if(screen.width > 800 && screen.width <= 1024) {
				document.getElementById(branch).style.position='absolute';
				document.getElementById(branch).style.top='330';
				document.getElementById(branch).style.left='372';	
				document.getElementById(branch).style.zIndex=1;						
			}
			if(screen.width > 1024 && screen.width < 1280) {
				document.getElementById(branch).style.position='absolute';
				document.getElementById(branch).style.top='330';
				document.getElementById(branch).style.left='438';	
				document.getElementById(branch).style.zIndex=1;	
			}
			if(screen.width >= 1280) {
				document.getElementById(branch).style.position='absolute';
				document.getElementById(branch).style.top='330';
				document.getElementById(branch).style.left='499';	
				document.getElementById(branch).style.zIndex=1;	
			}
	}

	if(document.getElementById(branch).id == "enr") {
		objBranch = document.getElementById("adv").style.display = "none";
		objBranch = document.getElementById("ptd").style.display = "none";		
		objBranch = document.getElementById("why").style.display = "none";		
		objBranch = document.getElementById("med").style.display = "none";		

			if(screen.width <= 800) {
				document.getElementById(branch).style.position='absolute';
				document.getElementById(branch).style.top='364';
				document.getElementById(branch).style.left='258';	
				document.getElementById(branch).style.zIndex=1;	
			}
			if(screen.width > 800 && screen.width <= 1024) {
				document.getElementById(branch).style.position='absolute';
				document.getElementById(branch).style.top='374';
				document.getElementById(branch).style.left='372';	
				document.getElementById(branch).style.zIndex=1;						
			}
			if(screen.width > 1024 && screen.width < 1280) {
				document.getElementById(branch).style.position='absolute';
				document.getElementById(branch).style.top='374';
				document.getElementById(branch).style.left='438';	
				document.getElementById(branch).style.zIndex=1;	
			}
			if(screen.width >= 1280) {
				document.getElementById(branch).style.position='absolute';
				document.getElementById(branch).style.top='374';
				document.getElementById(branch).style.left='499';	
				document.getElementById(branch).style.zIndex=1;	
			}
	}

	if(document.getElementById(branch).id == "why") {
		objBranch = document.getElementById("adv").style.display = "none";
		objBranch = document.getElementById("ptd").style.display = "none";		
		objBranch = document.getElementById("enr").style.display = "none";		
		objBranch = document.getElementById("med").style.display = "none";		

			if(screen.width <= 800) {
				document.getElementById(branch).style.position='absolute';
				document.getElementById(branch).style.top='418';
				document.getElementById(branch).style.left='258';	
				document.getElementById(branch).style.zIndex=1;	
			}
			if(screen.width > 800 && screen.width <= 1024) {
				document.getElementById(branch).style.position='absolute';
				document.getElementById(branch).style.top='418';
				document.getElementById(branch).style.left='372';	
				document.getElementById(branch).style.zIndex=1;						
			}
			if(screen.width > 1024 && screen.width < 1280) {
				document.getElementById(branch).style.position='absolute';
				document.getElementById(branch).style.top='418';
				document.getElementById(branch).style.left='438';	
				document.getElementById(branch).style.zIndex=1;	
			}
			if(screen.width >= 1280) {
				document.getElementById(branch).style.position='absolute';
				document.getElementById(branch).style.top='418';
				document.getElementById(branch).style.left='499';	
				document.getElementById(branch).style.zIndex=1;	
			}
	}

	if(document.getElementById(branch).id == "med") {
		objBranch = document.getElementById("adv").style.display = "none";
		objBranch = document.getElementById("ptd").style.display = "none";		
		objBranch = document.getElementById("enr").style.display = "none";		
		objBranch = document.getElementById("why").style.display = "none";		

			if(screen.width <= 800) {
				document.getElementById(branch).style.position='absolute';
				document.getElementById(branch).style.top='460';
				document.getElementById(branch).style.left='258';	
				document.getElementById(branch).style.zIndex=1;	
			}
			if(screen.width > 800 && screen.width <= 1024) {
				document.getElementById(branch).style.position='absolute';
				document.getElementById(branch).style.top='460';
				document.getElementById(branch).style.left='372';	
				document.getElementById(branch).style.zIndex=1;						
			}
			if(screen.width > 1024 && screen.width < 1280) {
				document.getElementById(branch).style.position='absolute';
				document.getElementById(branch).style.top='460';
				document.getElementById(branch).style.left='438';	
				document.getElementById(branch).style.zIndex=1;	
			}
			if(screen.width >= 1280) {
				document.getElementById(branch).style.position='absolute';
				document.getElementById(branch).style.top='460';
				document.getElementById(branch).style.left='499';	
				document.getElementById(branch).style.zIndex=1;	
			}
	}
}


// function to change nav elements based on height of page content
function getHgt (id) {  
	var saH = document.getElementById('pgcontent').clientHeight;				
	document.getElementById(id).style.height="auto";
		
	if (document.all) { gh = document.getElementById(id).offsetHeight + 10; }
	else { gh = document.getElementById(id).offsetHeight + 23; }

	if(screen.width <= 800) { nHeight = 0; }

	if(screen.width > 800 && screen.width <= 1024) { nHeight = gh - 248; }

	if(screen.width > 1024) { nHeight = gh - 152; }
	
	if(nHeight < saH) { nHeight = 3; }
			
	if(nHeight > 0) { document.getElementById('btmTbl').style.height = nHeight + 60; }
	else { document.getElementById('btmTbl').style.height = 0; }		
}


// launch modeless dialog box with parameters sent in link
function getModeless(url, horiz, vert, rz) {	
	var uagent = navigator.userAgent.toLowerCase();
	
	if(rz > 0) { var reSz = 'yes' }
	else { var reSz = 'no' }
	
	var dvals = 'dialogWidth: ' + horiz + 'px; dialogHeight: ' + vert + 'px; center: Yes; help: No; resizable:' + reSz + '; status: No; edge: Raised;';
	var wProps = "config='width=" + horiz + ", height=" + vert + ", toolbar=no, menubar=no, scrollbars=no, resizable=" + reSz + ", location=no, directories=no, status=no'";
			
	// if IE launch modeless dialog		
	if(uagent.indexOf('msie') != -1) { showModelessDialog(url, "", dvals); }

	// if NOT IE open new window
	else { window.open(url, 'newwindow', wProps); }	
}


// function to redirect to MyHeaklthZone
function getMHZ() {
	window.open('http://www.cariten.com/cfml/portals/member/mhz.cfm', 'newwindow', config='height=480, width=765, toolbar=yes, menubar=yes, scrollbars=yes, resizable=yes, location=no, directories=no, status=no');
}


// function to log traffic and redirect to non Cariten site
function getxSite(selem) {
	var rsite = document.location;
	var gsite = fPath + '/common/_extRedir.cfm?eurl=' + selem + '&rurl=' + rsite;	
	window.open(gsite, 'Cariten_Healthcare', config='height=480, width=765, top=25, left=25, toolbar=yes, menubar=yes, scrollbars=yes, resizable=yes, location=yes, directories=no, status=yes');
}


// disclaimer for new plan year content not yet available
function comingSoon() { alert('The Cariten Senior Health 2008 information is not currently available.  Please check back soon.'); }


// functions to disable context sensitive menu
function noRgtClick() {
	if (event.button==2){ 		
		var tDate = new Date();
		var tYear = tDate.getYear();
		window.status = '(C) Copyright   2000 - ' + tYear + '     Cariten Healthcare / PHP Companies, Inc.' ;
		for (i=0; i < 1000000; i++){i++;}
		window.status = '' ;
		return false;
	}
 }

//document.onmousedown=noRgtClick;
//document.oncontextmenu = function(){return false}
