// Popup
var newWindow;

function openMe(url) {
	newWindow = window.open(url, 'IHS', 'height=606, width=875', 'scrollbars=no', 'resizable=no', 'menubar=no', 'toolbar=no', 'location=no');
	if(window.focus) {newWindow.focus()};
}

// Scriptaculous!
function appear(title) {
	
	var xml = "swf/xml/" + title + ".xml";
	
	// <![CDATA[
	
	var so = new SWFObject("swf/imgviewer.swf", "imgviewer", "875", "606", "9", "#000000");
	so.addVariable("xmlLoad", xml);
	so.addVariable("ptitle", title);	
	so.write("ximg");
	
	// ]]>
	
	Effect.Appear('popbg', {duration:0.4, from:0.0, to:0.6});
	Effect.Appear('ximg', {delay:0.4});
	return false;
}

function showmap() {
	document.getElementById('map').style.display = 'block';
}

function disappear() {
	document.getElementById('ximg').style.display='none';
	Effect.Appear('popbg', {
				  duration:0.4,
				  from:0.6,
				  to:0.0,
				  afterFinish:function() {
					  document.getElementById('popbg').style.display='none';
				  }
			  }); return false;
}

// Random applets
if (document.getElementById)
document.documentElement.className = 'jsclass'; //hide content for DOM capable browsers

var randomcontentdisplay={
	divholders:new Object(),
	masterclass: "randomcontent",

	init:function(){
		if (!document.getElementById)
			return
		var alldivs=document.getElementsByTagName("div")
		var randomcontentsearch=new RegExp(this.masterclass+"\\s+(group\\d+)", "i") //check for CSS class="randomcontent groupX" (x=integer)
		for (var i=0; i<alldivs.length; i++){
			if (randomcontentsearch.test(alldivs[i].className)){
				if (typeof this.divholders[RegExp.$1]=="undefined") //if array to hold this group of divs doesn't exist yet
					this.divholders[RegExp.$1]=new Array() //create array first
					this.divholders[RegExp.$1].push(alldivs[i]) //add this div to the array
			}
		}
	this.showone()
	},

	showone:function(){
		for (group in this.divholders){ //loop thru each array within object
			var chosenOne=Math.floor(Math.random()*this.divholders[group].length) //randomly pick one entry from array
			this.divholders[group][chosenOne].style.display="block" //display content corresponding to the chosen entry
		}
	}
}

// JavaScript fix for nav zIndex
var obj;
function iezfix(obj) {
	obj.style.zIndex = 99;
	//alert(obj.style.zIndex);
	obj.onmouseout = function() {
		obj.style.zIndex = 1;	
	}
}

// Browser Detection
var bNm = navigator.appName;
var bAg = navigator.userAgent;
var bVr;

function brChk() {
	
	if((verOffset = bAg.indexOf("MSIE"))!=-1) {
		bNm = "Microsoft Internet Explorer";
		bVr = parseFloat(bAg.substring(verOffset+5));
	}
}

// Navigation stick on IE7 and FF only
var mypage;

function stickMeNav() {
	brChk();
	if(bNm == "Microsoft Internet Explorer" && bVr <=6) {

	} else if(mypage != undefined) {
		document.getElementById(mypage).className = 'stick';
	}
}

// pagelinks functions on IE7 and FF only
var mylink;
var demo;
var btnShow = '0';

function stickMePage() {
	brChk();
	
	if(bNm == "Microsoft Internet Explorer" && bVr <=6) {
		
	} else if(mylink != undefined) {
		document.getElementById(mylink).className = 'stickPage';
	}
	
	if(demo == '1') {
		document.getElementById('p4').style.visibility = 'visible';
	}
	
	if(btnShow == '1') {
		document.getElementById('pageBtns').style.display = 'none';
		document.getElementById('privacy').style.display = 'block';
	}
}

// Call all functions to load at runtime
function initPage() {
	stickMePage();
	stickMeNav();
}

window.onload = initPage;

// Newsletter hover

var element;
var csstyle;
function headerOver(element, csstyle) {
	element.className = csstyle;
}

function headerOut(element, csstyle) {
	element.className = csstyle;	
}

//Newsletter IE6 Enter key submit form fix
function sendForm(event) {
	if(event.keyCode == 13) {
		submitForm();
	}
}

function submitForm() {
	document.getElementById('form1').submit();
}

function get_cookie(cookie_name) {
	var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );
	
	if ( results ) {
		return ( unescape ( results[2] ) );
	} else {
		return null;
	}
}

function redirect(url) {
	window.location = url;
}

// Newsletter textbox
function clearMe(e) {
		e.value = '';
}

// Takes care of the error that is received in the support panel
var support = '';
															 
															 
															 
															 