// JavaScript Document<!--
var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1];
var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0; //extra height in px to add to iframe in FireFox 1.0+ browsers

	function setElementHeight(el, ht)
	{
		if (navigator.userAgent.indexOf("MSIE",0) > 0)
		{
			//window.alert('adjusting for IE');
			el.height = (ht/1 + 18/1);
			el.style.height = (ht/1 + 18/1) + 'px';
		}
		else if (navigator.userAgent.indexOf("Firefox",0) > 0)
		{
			//window.alert('adjusting for FF');
			el.height = (ht/1 - 0/1);
			el.style.height = (ht/1 - 0/1) + 'px';
		}
		else
		{
			//window.alert('adjusting for UNK');
			el.height = ht;
			el.style.height = ht + 'px';
		}
	}
	function getElementHeight(el)
	{
		var ht = 0;
		if (el && !window.opera)
		{
			//theElement.style.display="block";
			if (el.offsetHeight) //ns6 syntax
				ht = el.offsetHeight+FFextraHeight; 
			else if (el.scrollHeight) //ie5+ syntax
				ht = el.scrollHeight;
		}
		return ht;
	}
	function Max(val1,val2)
	{
		if ((val1/1) >= (val2/1))
			return val1;
		else
			return val2;
	}

	function evenHeight(lftEl,midEl,rtEl)
	{
		setElementHeight(lftEl,0);
		setElementHeight(midEl,0);
		try {
			setElementHeight(rtEl,0);
		}
		catch(e)
		{
		}
		var elMCL = document.getElementById('Main_col_left');
		var lftHt = getElementHeight(elMCL);
		//window.alert('lftHt = ' + lftHt);
		var elMCM = document.getElementById('Main_col_middle');
		if (elMCM == null)
		{
			elMCM = document.getElementById('Main_col_middle_right');
		}
		var midHt = getElementHeight(elMCM)
		//window.alert('midHt = ' + midHt);
		var elMCR = document.getElementById('Main_col_right');
		var rtHt = getElementHeight(elMCR);
		//window.alert('rtHt = ' + rtHt);
		var maxHt = Max(lftHt,Max(midHt,rtHt));
		var lftAdj = maxHt - lftHt;
		var midAdj = maxHt - midHt;
		var rtAdj = maxHt - rtHt;
		if (lftAdj > 0)
		{
			//window.alert('lftEl.clientHeight = ' + lftEl.clientHeight + '; lftAdj = ' + lftAdj);
			setElementHeight(lftEl,Max(lftEl.clientHeight,0) + lftAdj);
			//window.alert('lftEl.clientHeight = ' + lftEl.clientHeight + ':' + lftEl.height + ':' + lftEl.style.height);
		}
		if (midAdj > 0)
		{
			//window.alert('midEl.clientHeight = ' + midEl.clientHeight + '; midAdj = ' + midAdj);
			setElementHeight(midEl,Max(midEl.clientHeight,0) + midAdj);
			//window.alert('midEl.clientHeight = ' + midEl.clientHeight + ':' + midEl.height + ':' + midEl.style.height);
		}
		if (rtAdj > 0)
		{
			//window.alert('rtEl.clientHeight = ' + rtEl.clientHeight + '; rtAdj = ' + rtAdj);
			try
			{
				setElementHeight(rtEl,Max(rtEl.clientHeight,0) + rtAdj);
			}
			catch(e)
			{
			}
			//window.alert('rtEl.clientHeight = ' + rtEl.clientHeight + ':' + rtEl.height + ':' + rtEl.style.height);
		}
		try {
			setElementHeight(document.getElementById('divLoginForm'),getElementHeight(document.getElementById('resourceContent'))-19					)
		}
		catch(e)
		{
		}
	}
	
	function elementSwitchDisplay(theElement)
	{
		if (theElement.style.display == 'none')
		{
			theElement.style.display = '';
			theElement.style.visibility = 'visible';
		}
		else
		{
			theElement.style.display = 'none';
			theElement.style.visibility = 'hidden';
		}
	}

	function j_trim(str)

	{  while(str.charAt(0) == (" ") )

  {  str = str.substring(1);

  }

  while(str.charAt(str.length-1) == " " )

  {  str = str.substring(0,str.length-1);

  }


  str=str.replace(/</g, "");

  while(str.match(">")) {

  y= str.indexOf(">")

  if ((y) > -1) str=(str.substr(y+1));

  }

  return str;

}
function ValidateRegistrationForm_Sjodin(form_id) {

for(i=0; i<form_id.elements.length; i++) {

                        j_trim(form_id.elements[i].value);

                        var p;

                        valid = true;

                        var k = form_id.elements[i].name;

                        var x = form_id.elements[i].value;

                        var y = form_id.elements[i].id;

                        var z = form_id.elements[i].title

                        if ((k) == "fname" || (k) == "lname" || (k) == "company" || (k) == "title" || (k) == "industry" || (k) == "address" || (k) == "city" || (k) == "state" || (k) == "zip" || (k) == "email" || (k) == "phone" || (k) == "salespeople" || (k) == "manage" || (k) == "revenue") {

                        if ((x) == "") {

                        window.alert('Please verify that all required fields are complete.');

                        form_id.elements[i].focus();

                        valid = false;

                        return valid;

                        }

                        
                        }

            }
 

 

return valid;

}


	function validateForm(theForm)
	{
		if (j_trim(theForm.fname.value) == '')
		{
			window.alert('Please provide your first name.');
			theForm.fname.focus();
			return false;
		}
		else if (j_trim(theForm.lname.value) == '')
		{
			window.alert('Please provide your last name.');
			theForm.lname.focus();
			return false;
		}
		else if (j_trim(theForm.company.value) == '')
		{
			window.alert('Please provide your company name.');
			theForm.company.focus();
			return false;
		}
		else if (j_trim(theForm.title.value) == '')
		{
			window.alert('Please provide your title.');
			theForm.title.focus();
			return false;
		}
		else if (j_trim(theForm.industry.value) == '')
		{
			window.alert('Please provide your industry.');
			theForm.industry.focus();
			return false;
		}
		else if (j_trim(theForm.address.value) == '')
		{
			window.alert('Please provide your address.');
			theForm.address.focus();
			return false;
		}
		else if (j_trim(theForm.city.value) == '')
		{
			window.alert('Please provide your city.');
			theForm.city.focus();
			return false;
		}
		else if (j_trim(theForm.state.value) == '')
		{
			window.alert('Please provide your state or province.');
			theForm.state.focus();
			return false;
		}
		else if (j_trim(theForm.zip.value) == '')
		{
			window.alert('Please provide your postal code.');
			theForm.zip.focus();
			return false;
		}
		else if (j_trim(theForm.email.value) == '')
		{
			window.alert('Please provide your email address.');
			theForm.email.focus();
			return false;
		}
		else if (j_trim(theForm.phone.value) == '')
		{
			window.alert('Please provide your phone number.');
			theForm.phone.focus();
			return false;
		}
		else if (j_trim(theForm.salespeople.value) == '')
		{
			window.alert('Please provide the size of your sales force.');
			theForm.salespeople.focus();
			return false;
		}
		else if (j_trim(theForm.manage.value) == '')
		{
			window.alert('Please provide the number of salespeople you manage.');
			theForm.manage.focus();
			return false;
		}
		else if (j_trim(theForm.revenue.value) == '')
		{
			window.alert('Please provide your annual sales volume.');
			theForm.revenue.focus();
			return false;
		}
		else if (theForm.attendance[0].checked == false && theForm.attendance[1].checked == false && theForm.attendance[2].checked == false)
		{
			window.alert('Please check an attendance option.');
			theForm.attendance[1].focus();
			return false;
		}
			else if ((theForm.attendance[1].checked == true || theForm.attendance[2].checked == true) && (theForm.workshop146.checked == false))
		{
			window.alert('Please select the workshop option.');
			theForm.workshop146.focus();
			return false;
		}
	}

	function ResourceLibraryLogin(theForm)
	{
		if (theForm.elements[0].value == 'leadership')
		{
			document.getElementById('divLoginForm').style.visibility = 'hidden'
		}
		else
		{
			theForm.reset();
		}
	}

	var arrImage = new Array();
	arrImage[0] = '/leadership/phi2008/images/spkr_carr_bob1.jpg';
	arrImage[1] = '/leadership/phi2008/images/FS_steele_jim.jpg';
	var arrCounter = 0;	
	function rotateImageSource(imgID)
	{
		document.getElementById(imgID).src = arrImage[arrCounter];
		arrCounter++;
		if (arrCounter >= arrImage.length)
		{
			arrCounter = 0;
		}
	}
	

