//**********************************************************************************
// Text Counter 
//**********************************************************************************

/*function textCounter(field, countfield, maxlimit) {
	var textCount = field.value.length;
	var plural = "s";
	
	if (field.value.match(/\r\n/)) {
		//Some browsers count newline as two characters
		var numNewlines = field.value.match(/\r\n/g).length;
		textCount = field.value.length + (numNewlines * 2);
	}
	
	else if(field.value.match(/\n/)) {
		//Some browsers count newline as one character
		var numNewlines = field.value.match(/\n/g).length;
		textCount = field.value.length + (numNewlines * 3);
	}
	
	if (textCount > maxlimit) {
		field.value = field.value.substring(0, maxlimit);
		countfield.innerHTML = '0 characters left';
	}
	
	else {
		if ((textCount == maxlimit-1) || (textCount == maxlimit+1))
		plural = "";
		countfield.innerHTML = (maxlimit - textCount) + ' character' + plural + ' left';
	}
	
}
*/

function textCounter(fieldZ, countfieldZ, maxlimitZ) {
	var textCount = fieldZ.value.length;
	var plural = "s";
	
	if (fieldZ.value.match(/\r\n/)) {
		//Some browsers count newline as two characters
		var numNewlines = fieldZ.value.match(/\r\n/g).length;
		textCount = fieldZ.value.length + (numNewlines * 2);
	}
	
	else if(fieldZ.value.match(/\n/)) {
		//Some browsers count newline as one character
		var numNewlines = fieldZ.value.match(/\n/g).length;
		textCount = fieldZ.value.length + (numNewlines * 3);
	}
	
	if (textCount > maxlimitZ) {
		fieldZ.value = fieldZ.value.substring(0, maxlimitZ);
		countfieldZ.innerHTML = '0 characters left';
	}
	
	else {
		if ((textCount == maxlimitZ-1) || (textCount == maxlimitZ+1))
		plural = "";
		countfieldZ.innerHTML = (maxlimitZ - textCount) + ' character' + plural + ' left';
	}
	
}



//**********************************************************************************
// Button rollovers 
//**********************************************************************************
	
if (document.images) {
	
// ON SCRIPT
	img1_on = new Image();
	img1_on.src = "images/featuredArrowOn.gif";       
    
			      
// OFF SCRIPT
	img1_off = new Image();
	img1_off.src = "images/featuredArrowOff.gif";         
}

	
// Function to turn on images.
	function onImgs(imgName) {
		if (document.images) {
			document[imgName].src = eval(imgName + "_on.src");
		}
	}

// Function to turn off images.
	function offImgs(imgName) {
		if (document.images) {
			document[imgName].src = eval(imgName + "_off.src");
		}
	}





//*********************************************************************************
// Change image on rollover function -- use with multiple instances of same graphic
//*********************************************************************************

if (document.images) {
	// ON SCRIPT
	arrow1_on = new Image();
	arrow1_on.src = "../../images/featuredArrowOn.gif";
	
	// OFF SCRIPT
	arrow1_off = new Image();
	arrow1_off.src = "../../images/featuredArrowOff.gif"; 
}

function changePic(picName,imgName)
 {
   if (document.images)
    {
      imgOn=eval(imgName + ".src");
      document[picName].src = imgOn;
    }
 }





//**********************************************************************************
// Menu Toggle Functions
//**********************************************************************************


function toggleLevel3Nav(div){  
	document.getElementById(div).style.display = 'block';
}

function toggleLevel4Nav(div){  
	document.getElementById(div).style.display = 'block'; 
}





//**********************************************************************************
// Toggle Function
//**********************************************************************************

var rightmenu = new Array('00', '01' , '02' , '03' , '04' , '05');

function toggleThis(div)
{  
    for(a = 1; a < rightmenu.length; a++)
	{
		if (div == rightmenu[a])
			document.getElementById(rightmenu[a]).style.display = 'block';
		else
			document.getElementById(rightmenu[a]).style.display = 'none';
	}			
}





//*********************************************************************************
// Pop up window function
//*********************************************************************************

function OpenBrWindow(theURL,winName,features) { 
  window.open(theURL,winName,features);
}





//*********************************************************************************
//Search Box
//*********************************************************************************

function clearDefaultText(controlID, defaultText)
{
    if (document.getElementById(controlID).value == defaultText)
        document.getElementById(controlID).value = '';
}





//*********************************************************************************
//Browser and Platform Sniffer
//*********************************************************************************

var exclude=1;
var agt=navigator.userAgent.toLowerCase();
var win=0;var mac=0;var lin=1;
if(agt.indexOf('win')!=-1){win=1;lin=0;}
if(agt.indexOf('mac')!=-1){mac=1;lin=0;}
var lnx=0;if(lin){lnx=1;}
var ice=0;
var ie=0;var ie4=0;var ie5=0;var ie6=0;var com=0;var dcm;
var op5=0;var op6=0;var op7=0;
var ns4=0;var ns6=0;var ns7=0;var mz7=0;var kde=0;var saf=0;
if(typeof navigator.vendor!="undefined" && navigator.vendor=="KDE"){
	var thisKDE=agt;
	var splitKDE=thisKDE.split("konqueror/");
	var aKDE=splitKDE[1].split("; ");
	var KDEn=parseFloat(aKDE[0]);
	if(KDEn>=2.2){
		kde=1;
		ns6=1;
		exclude=0;
		}
	}
else if(agt.indexOf('webtv')!=-1){exclude=1;}
else if(typeof window.opera!="undefined"){
	exclude=0;
	if(/opera[\/ ][5]/.test(agt)){op5=1;}
	if(/opera[\/ ][6]/.test(agt)){op6=1;}
	if(/opera[\/ ][7-9]/.test(agt)){op7=1;}
	}
else if(typeof document.all!="undefined"&&!kde){
	exclude=0;
	ie=1;
	if(typeof document.getElementById!="undefined"){
		ie5=1;
		if(agt.indexOf("msie 6")!=-1){
			ie6=1;
			dcm=document.compatMode;
			if(dcm!="BackCompat"){com=1;}
			}
		}
	else{ie4=1;}
	}
else if(typeof document.getElementById!="undefined"){
	exclude=0;
	if(agt.indexOf("netscape/6")!=-1||agt.indexOf("netscape6")!=-1){ns6=1;}
	else if(agt.indexOf("netscape/7")!=-1||agt.indexOf("netscape7")!=-1){ns6=1;ns7=1;}
	else if(agt.indexOf("gecko")!=-1){ns6=1;mz7=1;}
	if(agt.indexOf("safari")!=-1 || (typeof document.childNodes!="undefined" && typeof document.all=="undefined" && typeof navigator.taintEnabled=="undefined")){mz7=0;ns6=1;saf=1;}
	}
else if((agt.indexOf('mozilla')!=-1)&&(parseInt(navigator.appVersion)>=4)){
	exclude=0;
	ns4=1;
	if(typeof navigator.mimeTypes['*']=="undefined"){
		exclude=1;
		ns4=0;
		}
	}
if(agt.indexOf('escape')!=-1){exclude=1;ns4=0;}
if(typeof navigator.__ice_version!="undefined"){exclude=1;ie4=0;}