

function GetElementsObjs(typ, tagNames, searchValue) 
{
	var aryTagNames = tagNames.split('|');	
    var elements = new Array();	
    var aryMatches = new Array();
	
	for (var j = 0; j < aryTagNames.length; j++)
	{
	    elements = document.getElementsByTagName(aryTagNames[j]);
	
		if (typ == 'id')
		{
		    for (var i = 0; i < elements.length; i++) 
			{
				if (elements[i].id && elements[i].id.length > 0 && elements[i].id == searchValue)
				{
					aryMatches[aryMatches.length] = elements[i];
				}
			}
		}
		else if (typ == 'clz')
		{
		    for (var i = 0; i < elements.length; i++) 
			{
				if (elements[i].className.length > 0 && elements[i].className == searchValue)
				{
					aryMatches[aryMatches.length] = elements[i];
				}
			}
		}
	}

   	return aryMatches;
}



	function doPayPal()
	{
		document.Form1.action = 'https://www.paypal.com/cgi-bin/webscr';
		document.Form1.submit();
	}

	function doPayPal(fname)
	{
		document.forms[fname].action = 'https://www.paypal.com/cgi-bin/webscr';
		document.forms[fname].submit();
	}

	function doFormSubmitView(oForm, oEvent, sEvent, oControl, sControlId, oView, sViewKey)
	{
		//alert(sEvent);
		//alert(sControlId);
		//alert(sViewKey);
		oEvent.value = sEvent;
		oControl.value = sControlId;
		oView.value = sViewKey;
		disableForm(oForm);
		oForm.submit();
	}

	function doFormSubmit(oForm, oEvent, sEvent, oControl, sControlId)
	{
		//alert(sEvent);
		//alert(sControlId);

		oEvent.value = sEvent;
		oControl.value = sControlId;
		disableForm(oForm);
		oForm.submit();
	}

	function myFormSubmit (oForm, oEle, val)
	{
		oEle.value = val;
		disableForm(oForm);
		// alert(val);
		oForm.submit();
	}

	function doLogout(v)
	{
		window.location.href = "/Default.aspx?evt=person.logout&landingPage=" + v; 
	}
	
	function textBoxKeyPress (e, oForm, oEle, val)
	{
		var bt = document.getElementById(oEle); 
		if (typeof bt == 'object')
		{ 
			if(navigator.appName.indexOf("Netscape")>(-1))
			{ 
				if (e.keyCode == 13)
				{ 
					myFormSubmit(oForm, oEle, val);
					return false; 
				} 
			} 
			if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
			{ 
				if (event.keyCode == 13)
				{ 
					// bt.click(); 
					myFormSubmit(oForm, oEle, val);
					return false; 
				} 
			} 
		} 
	}
	
	function disableForm(theform) 
	{
		if (document.all || document.getElementById) 
		{
			for (i = 0; i < theform.length; i++) 
			{
				var tempobj = theform.elements[i];
				if (tempobj != null && tempobj.type && tempobj.type.toLowerCase() == "submit")
				{
					tempobj.disabled = true;
				}
			}
	  	}
	}

	function changeDiv(id, method)
	{
		var itm = null;
		if (document.getElementById) {
			itm = document.getElementById(id);
		} else if (document.all)     {
			itm = document.all[id];
		} else if (document.layers)   {
			itm = document.layers[id];
		}
		
		if (itm.style)
		{
			if ( method == 'show' ) {
				itm.style.display = "";
			} else {
				itm.style.display = "none";
			}
		}	else {
			itm.visibility = "show";
		}
	}

	function setVal(oEle, val) {
		oEle.value = val;
	}

	function myFormAddAnother(oEle, val) {
		oEle.value = val;
	}

	var popupHandle;

	function closePopup() {
		if(popupHandle != null && !popupHandle.closed) 
			popupHandle.close();
	}	

	function doDisplayPopup(url, name, height, width) 
	{
		var properties = "toolbar=0, location=0, scrollbars=1, height=" + height;
		properties = properties + ", width=" + width;
		var leftprop, topprop, screenX, screenY, cursorX, cursorY, padAmt;

		if (navigator.appName == "Microsoft Internet Explorer") 
		{
//			screenY = document.body.offsetHeight;
			screenY = window.screen.availHeight;
			screenX = window.screen.availWidth;
		} 
		else 
		{
			screenY = window.outerHeight;
			screenX = window.outerWidth;
		}		

		leftvar = (screenX - width) / 2;
		rightvar = (screenY - height) / 2;

		if (navigator.appName == "Microsoft Internet Explorer") 
		{
			leftprop = leftvar;
			topprop = rightvar;
		} 
		else 
		{
			leftprop = (leftvar - pageXOffset);
			topprop = (rightvar - pageYOffset);
		}	
		properties = properties + ", left=" + leftprop + ", top=" + topprop;		

		closePopup();
		popupHandle = open(url, name, properties);
	}				

	
	function chgImg(o, v) {
		o.src = v;
	}

	function textCounter(field,cntfield,maxlimit) {
		if (field.value.length > maxlimit) {
			field.value = field.value.substring(0, maxlimit);
			alert('Maximum character count is ' + maxlimit + '.');
		}	else {
			cntfield.value = maxlimit - field.value.length;
		}
	}

		
	function endNow() {
	 close();
	}
		
	
	/* sets the active stylesheet for content */
	function setStyleSheets()
	{
		var tags = document.getElementsByTagName("link");
		var i, a;
		for(i = 0; i < tags.length; i++)
		{
			a = tags[i];
			if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title"))
			{
				a.disabled = false;
			}
		}
	}

	/* onload */
	function onloadfunction() 
	{
		// set healthcenter style
		var agt=navigator.userAgent.toLowerCase();
		if (agt.indexOf("msie") < 0) 
		{
			setStyleSheets();   //load multiple stylesheets; only firefox
		}
	}

	if (window.addEventListener) { window.addEventListener("load", onloadfunction, false); }
	else if (window.attachEvent) { window.attachEvent("onload", onloadfunction); } 
	else if (document.getElementById) { window.onload=onloadfunction; }
		
		


/* ---------------------------------------- */
/*  BEGIN IHT.COM							*/
/* ---------------------------------------- */		

		
	/**
This file contains all the functions related to the cookie
and how it functions.  Most of the things in here are 
functions but there are some function calls and global variables
that are set and the order of the execution is very important.
*/

// creates a cookie with the given parameters
function createCookie(name,value,days)
{
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
		var expires = "; expires=" + date.toGMTString();
	} 
	else 
	{
		var expires = "";
	}
	document.cookie = name + "=" + value + expires + "; path=/";
}

// locates and reads the value of a cookie with a specified name
function readCookie(name){
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

// deletes a cookie with a specified name
function eraseCookie(name){
	createCookie(name,"",-1);
}

// parses the value of the cookie
// returns an array of the different values
function parseCookie(cookievalues){
	if (cookieValues.length > 0){
		var cookieValuesArray = new Array(3);
		var CookiesArray = cookievalues.split("&");
		for (var i = 0; i < CookiesArray.length; i++){
			var v = CookiesArray[i].split(":");
			cookieValuesArray[i] = v[1];
		}
		return cookieValuesArray;
	} else {
		return null;
	}
}

// cookieValues is a global variable that is an array of the different
// cookie values.  Check first if the cookie exists, if not then create 
// a cookie with the default values.
var cookieValues = new Array(3);
var cv = readCookie("ihtuserdata");
if (cv){
	cookieValues = parseCookie(cv);
// else, there is no cookie so try to create one
} else {
	createCookie("ihtuserdata","columnMode:3&fontSize:12&clippings:",7);
	cv = readCookie("ihtuserdata");
	if (cv){
		// the cookie was created, parse the values
		cookieValues = parseCookie(cv);
	} else {
		// the cookie was not created, use default values,
		// i.e. cookies may be blocked
		cookieValues[0] = "3"; // column mode
		cookieValues[1] = "12"; // font size
		cookieValues[2] = ""; // clippings (leave it empty)
	}
}




function MM_preloadImages() { 
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { 
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { 
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { 
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


/* -- Adobe GoLive JavaScript Library */

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}
function changeImagesArray(array) {
/*	if (preloadFlag == true) { */
		var d = document; var img;
		for (var i=0; i<array.length; i+=2) {
			img = null; var n = array[i];
			if (d.images) {img = d.images[n];}
			if (!img && d.getElementById) {img = d.getElementById(n);}
			if (img) {img.src = array[i+1];}
		}
/*	}*/
}
function changeImages() {
	changeImagesArray(changeImages.arguments);
}
CSStopExecution=false;
function CSAction(array) {return CSAction2(CSAct, array);}
function CSAction2(fct, array) { 
	var result;
	for (var i=0;i<array.length;i++) {
		if(CSStopExecution) return false; 
		var aa = fct[array[i]];
		if (aa == null) return false;
		var ta = new Array;
		for(var j=1;j<aa.length;j++) {
			if((aa[j]!=null)&&(typeof(aa[j])=="object")&&(aa[j].length==2)){
				if(aa[j][0]=="VAR"){ta[j]=CSStateArray[aa[j][1]];}
				else{if(aa[j][0]=="ACT"){ta[j]=CSAction(new Array(new String(aa[j][1])));}
				else ta[j]=aa[j];}
			} else ta[j]=aa[j];
		}			
		result=aa[0](ta);
	}
	return result;
}
CSAct = new Object;
function CSScrollDown(action){
	if(navigator.appVersion.charAt(0) >=4) {
		var container = 0	
		if (action[2] > 0)		{
			while (container < action[1]) {
   				window.scrollBy(0,action[2]);
   				container = container + action[2];  
			} 	
      	}
	}
}
function CSClickReturn () {
	var bAgent = window.navigator.userAgent; 
	var bAppName = window.navigator.appName;
	if ((bAppName.indexOf("Explorer") >= 0) && (bAgent.indexOf("Mozilla/3") >= 0) && (bAgent.indexOf("Mac") >= 0))
		return true; /* dont follow link */
	else return false; /* dont follow link */
}
function CSScrollUp(action){
	if(navigator.appVersion.charAt(0) >=4) {
		var container = 0	
		if (action[2] > 0)		{
			while (container < action[1]) {
   				window.scrollBy(0,-action[2]);
   				container = container + action[2];  
			} 	
      	}
	}
}