// JavaScript Document

/*------------------------------ GENERAL SCRIPTS -----------------------------------------*/

function editClass(id){
	var sendStr='act=8&sid='+id;
	var resp=getXML(sendStr,'_processAjax.cfm');
	//crawlXML(resp);
	var chk=resp.getElementsByTagName('success')[0].firstChild.data;
	if (chk!='true'){
		document.getElementById('response').innerHTML=resp.getElementsByTagName('message')[0].firstChild.data;
		if (confirm("An error occurred while attempting to transfer session info. To try again, click 'OK'. If this problem persists, please click 'Cancel' and  contact Big Giant Media for assistance."))	editClass(id); 
	} else {
		var obForm=document.sessionDetails;
		obForm.sid.value=resp.getElementsByTagName('sid')[0].firstChild.data;
		obForm.sessionType.value=resp.getElementsByTagName('level')[0].firstChild.data;
		obForm.sessionStartDate.value=resp.getElementsByTagName('dateFrom')[0].firstChild.data;
		obForm.sessionEndDate.value=resp.getElementsByTagName('dateTo')[0].firstChild.data;
		for (i=0;i<obForm.startHour.length;i++) {if (obForm.startHour[i].value==resp.getElementsByTagName('timeFromHour')[0].firstChild.data) obForm.startHour.selectedIndex=i};
		for (i=0;i<obForm.startMinute.length;i++) {if (obForm.startMinute[i].value==resp.getElementsByTagName('timeFromMin')[0].firstChild.data) obForm.startMinute.selectedIndex=i};
		for (i=0;i<obForm.startAMPM.length;i++) {if (obForm.startAMPM[i].value==resp.getElementsByTagName('timeFromAMPM')[0].firstChild.data) obForm.startAMPM.selectedIndex=i};
		for (i=0;i<obForm.endHour.length;i++) {if (obForm.endHour[i].value==resp.getElementsByTagName('timeToHour')[0].firstChild.data) obForm.endHour.selectedIndex=i};
		for (i=0;i<obForm.endMinute.length;i++) {if (obForm.endMinute[i].value==resp.getElementsByTagName('timeToMin')[0].firstChild.data) obForm.endMinute.selectedIndex=i};
		for (i=0;i<obForm.endAMPM.length;i++) {if (obForm.endAMPM[i].value==resp.getElementsByTagName('timeToAMPM')[0].firstChild.data) obForm.endAMPM.selectedIndex=i};
		var DoW=resp.getElementsByTagName('DoW')[0].firstChild.data;
		for (i=0;i<obForm.days.length;i++){ if (DoW.indexOf(obForm.days[i].value)!=-1){ obForm.days[i].checked=true } else { obForm.days[i].checked=false}} 
	}
	
}

function expand(obj){
	var objDsp=obj.parentNode.getElementsByTagName('div')[0].style.display;
	obj.parentNode.getElementsByTagName('div')[0].style.display=(objDsp=='block'?'none':'block');
	obj.innerHTML=(objDsp=='block'?'[&nbsp;MORE&nbsp;INFO&nbsp;]':'[&nbsp;HIDE&nbsp;INFO&nbsp;]');
	obj.blur();
}

function exceptionSubmit(objForm){
	var sendStr='act=9';
	for (i=0;i<objForm.length;i++){
		sendStr=sendStr+'&'+objForm[i].name+'='+objForm[i].value;
	};
	var resp=getXML(sendStr,'_processAjax.cfm');
	var chk=resp.getElementsByTagName('success')[0].firstChild.data;
	if (chk!='true'){
		document.getElementById('response').innerHTML=resp.getElementsByTagName('message')[0].firstChild.data;
		if (confirm("An error occurred while attempting to save session info. To try again, click 'OK'. If this problem persists, please click 'Cancel' and  contact Big Giant Media for assistance.")); 
	} else {
		document.getElementById('exceptionTbl').innerHTML=resp.getElementsByTagName('htm')[0].firstChild.data;
		makeDateFields(document.getElementById('exceptionTbl'));
	}
	objForm.reset();
}

function exceptionDelete(id){
	var msg='You are about to delete an exception. Continue?';
	if (confirm(msg)){
		var sendStr='act=10&id='+id;
		var resp=getXML(sendStr,'_processAjax.cfm');
		var chk=resp.getElementsByTagName('success')[0].firstChild.data;
		if (chk!='true'){
			document.getElementById('response').innerHTML=resp.getElementsByTagName('message')[0].firstChild.data;
			if (confirm("An error occurred while attempting to save session info. To try again, click 'OK'. If this problem persists, please click 'Cancel' and  contact Big Giant Media for assistance.")); 
		} else {
			document.getElementById('exceptionTbl').innerHTML=resp.getElementsByTagName('htm')[0].firstChild.data;
			makeDateFields(document.getElementById('exceptionTbl'));
		}
	}
}

function resendConfEmail(ordID){
	var msg='You are about to send an email confirmation to this customer. Please make sure you have saved any changes to the reservation before sending the confirmation. Do you want to send the email now?';
	if (confirm(msg)){
		var sendStr='act=12&id='+ordID;
		var resp=getXML(sendStr,'_processAjax.cfm');
		var chk=resp.getElementsByTagName('success')[0].firstChild.data;
		if (chk!='true'){
			document.getElementById('response').innerHTML=resp.getElementsByTagName('message')[0].firstChild.data;
			if (confirm("An error occurred while attempting to send the email. To try again, click 'OK'. If this problem persists, please click 'Cancel' and  contact Big Giant Media for assistance.")); 
		} else {
			alert('The confirming email has been sent.');
		}
	}
}


function reservationDelete(id){
	var msg='You are about to delete an reservation. Continue?';
	if (confirm(msg)){
		var sendStr='act=11&id='+id;
		var resp=getXML(sendStr,'_processAjax.cfm');
		var chk=resp.getElementsByTagName('success')[0].firstChild.data;
		if (chk!='true'){
			document.getElementById('response').innerHTML=resp.getElementsByTagName('message')[0].firstChild.data;
			if (confirm("An error occurred while attempting to delete the reservation. To try again, click 'OK'. If this problem persists, please click 'Cancel' and  contact Big Giant Media for assistance.")); 
		} else {
			document.location.reload(true);
		}
	}
}

var countdown, start=new Date()
function updateCount(){
	now=new Date()
	countdown=now.getTime()-start.getTime();
	countdown=9-Math.round(countdown/1000);
	document.getElementById('countdown').innerHTML=countdown;
}
function setupGlance(obj){
	var tds=obj.getElementsByTagName('td');
	for (i=1;i<tds.length;i++){
		origText=tds[i].innerHTML;
		rotText='';
		for (j=0;j<=origText.length;j++) rotText=rotText+'<br />'+origText.substr(j,1).toUpperCase();
		tds[i].innerHTML=rotText;
	}
	document.getElementById('parksGlance').style.display='block';
}

function getScroll(){
	var position = [0, 0];
	if (typeof window.pageYOffset != 'undefined')
	{
	position = [
	window.pageXOffset,
	window.pageYOffset
	];
	}
	else if (typeof document.documentElement.scrollTop
	!= 'undefined' && document.documentElement.scrollTop > 0)
	{
	position = [
	document.documentElement.scrollLeft,
	document.documentElement.scrollTop
	];
	}
	else if (typeof document.body.scrollTop != 'undefined')
	{
	position = [
	document.body.scrollLeft,
	document.body.scrollTop
	];
	}
	return position;
}
function chkScrollPos(){
	if (isLTIE7) return;
	var scrollPos=getScroll()
	if (parseInt(scrollPos[1]) > 220 && document.getElementById('title').style.position!='fixed'){
		document.getElementById('title').style.position='fixed';
		document.getElementById('title').style.top='-220px';
	} else
	if (parseInt(scrollPos[1]) < 220 && document.getElementById('title').style.position!='absolute'){
		document.getElementById('title').style.position='absolute';
		document.getElementById('title').style.top='0px';
	}
}

var opac=0, imgIdx=1, prvIdx=0, currentImg, nextImg; 

function startCycle(){
	setTimeout('cycle()',2000)
 }
 
	function cycle(imgSrc){
		if (typeof(timr2)!='undefined') return false;
		nextImg=document.createElement('img');
			nextImg.style.position='absolute';
			nextImg.style.top='0px';
			nextImg.style.left='0px';
			nextImg.style.filter='alpha(opacity=0)';
			nextImg.style.MozOpacity=0;
			nextImg.style.opacity=0;
			nextImg.style.KhtmlOpacity=0;
			nextImg.onload=function(){timr2=setInterval('imgFade()',20);}
			if (document.getElementById('portfolioImg2')){
				nextImg.style.width='560px';
				nextImg.style.height='420px';
			} else if (document.getElementById('portfolioImg')){
				nextImg.style.width='600px';
				nextImg.style.height='360px';
			}
		if (typeof(imgSrc)!='undefined'){
			if (imgSrc==-1) {
				imgSrc=prvIdx>0?prvIdx-1:imgArray.length-1;
				prvIdx=imgSrc;
			} else {
				prvIdx=imgSrc;
			}
			nextImg.src=imgArray[imgSrc][0];
			imgIdx=(prvIdx<imgArray.length-1)?prvIdx+1:0;
		} else {
			nextImg.src=imgArray[imgIdx][0];
			prvIdx=imgIdx;
			imgIdx=(imgIdx<imgArray.length-1)?imgIdx+1:0;
		}
		currentImg=document.getElementById(document.getElementById('slideImg')?'slideImg':'portfolioImg2').getElementsByTagName('img')[0];
		document.getElementById(document.getElementById('slideImg')?'slideImg':'portfolioImg2').appendChild(nextImg);
	}
	
	function imgFade(){
		if (opac<99){
			opac+=3;
			opacOther=opac/100;
			nextImg.style.filter='alpha(opacity='+opac+')';
			nextImg.style.MozOpacity=opacOther;
			nextImg.style.opacity=opacOther;
			nextImg.style.KhtmlOpacity=opacOther;
		} else {
			document.getElementById(document.getElementById('slideImg')?'slideImg':'portfolioImg2').removeChild(currentImg);
			opac=0;
			clearInterval(timr2);
			delete(timr2);
			if (document.getElementById('slideShowFrame')) {
				setTimeout('cycle()',4000);
				var counters=document.getElementById('animCounter').getElementsByTagName('img');
				for (i=0;i<counters.length;i++) counters[i].style.backgroundColor='#999999';
				counters[prvIdx].style.backgroundColor='#FFFFFF';
				document.getElementById('animCaption').innerHTML=imgArray[prvIdx][1];
			} else {
				document.getElementById('animCaption').innerHTML=imgArray[prvIdx][1];
			}
		}
	}

/*-------------------------------GOOGLE MAP SETUP SCRIPTS--------------------*/

var map;
var rect;
var custIcon=new Array();
var markers=new Array();
var localCoords=new Array();
var geocoder;
var origin;
var locIndex=0;

function load() {

  	if (GBrowserIsCompatible()) {
		geocoder = new GClientGeocoder();  //----necessary for GeoCoder functions in 'COORD FINDER'
		map = new GMap2(document.getElementById("map"));
		map.addControl(new GSmallZoomControl());
		if (location.href.indexOf('maps')!=-1) map.addControl(new GMapTypeControl());
		//origin=new GLatLng(locLat,locLon);
		//map.setCenter(origin,11);
		processLocals();
	}
}

function processLocals(){
	rect=new GLatLngBounds(origin,origin);
	locIndex=0;
	custIcon=new GIcon();
	custIcon.image='http://mv3.biggiantmedia.com/images/locator-icon.png';
	//custIcon[i].shadow='http://www.therealtorconnection.com/images/iconShadow.png';
	custIcon.iconSize = new GSize(29, 41);
	//custIcon[i].shadowSize = new GSize(21, 20);
	custIcon.iconAnchor = new GPoint(14,20);
	//custIcon[i].id=comms[i][0];
	//custIcon[i].infoWindowAnchor = new GPoint(8,8);*/
	for (i=0;i<comms.length;i++){
		var pos=new GLatLng(comms[i][4],comms[i][5]);
		placeIcon(pos,i);
		//eval('geocoder.getLatLng(comms[i][3],function(x) {placeIcon(' + pos + ',' + i + ')})');
	}
}
var marker=new Array();
	function placeIcon(response,index){
	if(response==null) return false;
	//alert(response);
		position=response;
			//position=new GLatLng(comms[i][0], -comms[i][1]);
		rect.extend(position);
		map.setCenter(rect.getCenter(),Math.min(map.getBoundsZoomLevel(rect),11));
		marker[index] = new GMarker(position, {title:comms[index][2]});
		eval('GEvent.addListener(marker[index], "click", function() {document.location.href="recreation-facilities-hemet.cfm?park='+comms[index][1]+'";})');
			//markers[i] = new GMarker(position, {title:comms[i][3]});
			//eval('GEvent.addListener(markers[i], "click", function() {document.location.href="realtor_results.cfm?id='+comms[i][4]+'";})');
			//eval('GEvent.addListener(markers[i], "mouseover", function() {ComImg'+comms[i][0]+'();})');
			//var msg='<b>'+comms[i][3]+'</b><br>';
			//msg=msg+'<a href=realtor_results2.cfm?id='+comms[i][0]+'>More Information</a>';
			//eval("GEvent.addListener(markers[i], 'mouseover', function() {this.openInfoWindowHtml('"+msg+"');})");
		map.addOverlay(marker[index]);
	}

function centerZoom(add){
	eval('geocoder.getLatLng(add,function(x) {cz2(x,' + i + ')})');
	
}
	function cz2(x){
		map.setCenter(x,15);
		scrollTo(0,250);
	}
function resetZoom(){
	map.setCenter(rect.getCenter(),map.getBoundsZoomLevel(rect));
}
	 
function clearIt(){
 	map.clearOverlays();
	map.setCenter(origin, 13);
	HQmarker = new GMarker(origin, iconPlane);
	map.addOverlay(HQmarker);
	rect=new GLatLngBounds(origin,origin);
	
}


/*-------------------------------START IT ALL SCRIPT --------------------------------*/

var isLTIE7=false;
var isLTIE8=false;
var isSafari=false;

function setup(){

	isSafari=(navigator.appVersion.indexOf('AppleWebKit')!=-1);
	ieVer=parseInt(navigator.appVersion.split("MSIE")[1]);
	isLTIE7=(ieVer<7);
	isLTIE8=(ieVer<8);

	if (document.location.href.indexOf('/admin/')==-1) enableOverlay(); // must happen before other setup features...

	if (ieVer<7) replacePNG(document);
	timer();
	//if (document.getElementById('content').offsetHeight<(document.body.clientHeight-280)){
	//	document.getElementById('content').style.height=(document.body.clientHeight-280)+'px';
	//}
	if (document.getElementById('nav')) {
		setupNav(document.getElementById('nav')); 
		setInterval('animate()',20);
	}
	if (document.getElementById('rowParkHeader')) setupGlance(document.getElementById('rowParkHeader'));
	setInterval('timer()',992);
	makeCorners(document);
	makeDateFields(document);
	activateComboBox();
	initAjax();
	headlines(document);
	document.onmousedown=selectmouse; // for drag and drop function
	document.onmouseup=endDrag; // for drag and drop also
	//window.onscroll=chkScrollPos;
	//printNum();
}

window.onload=setup;

/*-------------------------SIMPLE DRAG ME SCRIPT --------------------------------*/

var ie=document.all;
var nn6=document.getElementById&&!document.all;

var isdrag=false;
var x,y;
var dobj;

function movemouse(e)
{
  if (isdrag)
  {
    dobj.style.left = (nn6 ? tx + e.clientX - x : tx + event.clientX - x) + 'px';
    dobj.style.top  = (nn6 ? ty + e.clientY - y : ty + event.clientY - y) +'px';
    return false;
  }
}

function selectmouse(e) {
  var fobj       = nn6 ? e.target : event.srcElement;

  while (fobj.tagName != "HTML" && fobj.className != "dragme" && fobj.className != "editPanel") {
    fobj = fobj.parentNode;
  }

  if (fobj.className=="dragme" || fobj.className=='editPanel') {
    isdrag = true;
	 if (fobj.className=='editPanel') {
	 	dobj=fobj;
		tx=0;
		ty=0;
	} else {
	 	dobj = fobj
		tx = parseInt(dobj.style.left+0);
		ty = parseInt(dobj.style.top+0);
	 };
    x = (nn6 ? e.clientX : event.clientX)-dobj.offsetLeft;
    y = (nn6 ? e.clientY : event.clientY)-dobj.offsetTop;
	 dobj.style.zIndex='10000000000';
    document.onmousemove=movemouse;
    return false;
  }
}

function endDrag(){
	if (dobj){
		//dobj.style.top='0px';
		//dobj.style.left='0px';
	}
	isdrag=false;
}

/*------------------------------------CUSTOM HEADLINES SCRIPT--------------------------*/

var charWidth1=new Array(52,49,44,60,46,61,60,42,43,53,52,55,40,51,41,60,58,45,59,54,57,57,56,58,58,54,44,34,63,44,64,52,67,61,56,54,60,53,54,55,61,38,50,57,56,65,60,59,53,61,58,54,53,63,59,77,59,59,55,45,62,46,53,58,42,52,55,46,52,46,50,46,51,37,40,50,38,68,51,47,55,49,47,43,46,52,50,63,54,52,52,47,38,42,60)

var charStart1=new Array(0,52,101,145,205,251,312,372,414,457,510,562,617,657,708,749,809,867,912,971,1025,1082,1139,1195,1253,1311,1365,1409,1443,1506,1550,1614,1666,1733,1794,1850,1904,1964,2017,2071,2126,2187,2225,2275,2332,2388,2453,2513,2572,2625,2686,2744,2798,2851,2914,2973,3050,3109,3168,3223,3268,3330,3376,3429,3487,3529,3581,3636,3682,3734,3780,3830,3876,3927,3964,4004,4054,4092,4160,4211,4258,4313,4362,4409,4452,4498,4550,4600,4663,4717,4769,4821,4868,4906,4948,5008)

var charHt1=67;

var charWidth2=new Array(26,24,22,30,23,31,30,21,21,27,26,27,20,26,20,30,29,23,29,27,29,28,28,29,29,27,22,17,32,22,32,26,33,31,28,27,30,26,27,28,30,19,25,29,28,32,30,30,26,31,29,27,26,32,29,39,29,30,27,23,31,23,26,29,21,26,28,23,26,23,25,23,25,19,20,25,19,34,25,24,27,25,23,22,23,26,25,31,27,26,26,24,19,21,30)

var charStart2=new Array(0,26,50,72,102,125,156,186,207,228,255,281,308,328,354,374,404,433,456,485,512,541,569,597,626,655,682,704,721,753,775,807,833,866,897,925,952,982,1008,1035,1063,1093,1112,1137,1166,1194,1226,1256,1286,1312,1343,1372,1399,1425,1457,1486,1525,1554,1584,1611,1634,1665,1688,1714,1743,1764,1790,1818,1841,1867,1890,1915,1938,1963,1982,2002,2027,2046,2080,2105,2129,2156,2181,2204,2226,2249,2275,2300,2331,2358,2384,2410,2434,2453,2474,2504)

var charHt2=35;

/*var charWidth3=new Array(29,30,27,28,33,37,36,28,29,26,28,27,28,25,28,29,33,29,33,31,34,32,32,32,32,33,24,26,27,30,28,33,26,38,31,37,38,32,31,38,39,28,28,37,30,42,38,38,34,41,32,33,32,38,36,41,34,34,33,29,26,32,21,39,35,30,30,32,37,29,29,33,36,25,27,32,28,38,35,34,29,38,29,29,30,35,32,36,32,31,30,25,30,26,25)

var charStart3=new Array(0,29,59,86,114,147,184,220,248,277,303,331,358,386,411,439,468,501,530,563,594,628,660,692,724,756,789,813,839,866,896,924,957,983,1021,1052,1089,1127,1159,1190,1228,1267,1295,1323,1360,1390,1432,1470,1508,1542,1583,1615,1648,1680,1718,1754,1795,1829,1863,1896,1925,1951,1983,2004,2043,2078,2108,2138,2170,2207,2236,2265,2298,2334,2359,2386,2418,2446,2484,2519,2553,2582,2620,2649,2678,2708,2743,2775,2811,2843,2874,2904,2929,2959,2985,3010)

var charHt3=24;*/


function headlines(obj){
	for (k=1;k<3;k++){
		var hs=obj.getElementsByTagName('h'+k);
		for (i=0;i<hs.length;i++){
			if (ieVer>=7 || isNaN(ieVer)){
				var str=hs[i].innerText?hs[i].innerText:hs[i].textContent;
				var divWd=0;
				var newH=document.createElement('b');
				newH.innerHTML=str;
				hs[i].innerHTML='';
				var frameAlpha=document.createElement('div');
				for (j=0;j<str.length;j++){
					var arrIndex=str.charCodeAt(j)-32;
					if (k==1) divWd+=(eval('charWidth'+k+'['+arrIndex+']')-25);
					if (k==2) divWd+=(eval('charWidth'+k+'['+arrIndex+']')-10);
					var divAlpha=document.createElement('div');
					divAlpha.style.position='relative';
					divAlpha.style.height=eval('charHt'+k)+'px';
					divAlpha.style.width=eval('charWidth'+k+'['+arrIndex+']')+'px';
					divAlpha.style.cssFloat='left';
					divAlpha.style.styleFloat='left';
					if (arrIndex>=64){
						if (k==1) divAlpha.style.marginRight='-25px';
						if (k==2) divAlpha.style.marginRight='-11px';
					} else {
						if (k==1) divAlpha.style.marginRight='-25px';
						if (k==2) divAlpha.style.marginRight='-11px';
					}
					divAlpha.style.backgroundImage='url(images/alpha' + k + '.gif)'
					divAlpha.style.backgroundRepeat='no-repeat';
					divAlpha.style.backgroundPosition=(-eval('charStart'+k+'['+arrIndex+']'))+'px top'; 
					frameAlpha.appendChild(divAlpha);
				}
				frameAlpha.style.height=eval('charHt'+k)+'px';
				frameAlpha.style.width=divWd+'px';
				hs[i].appendChild(frameAlpha);
				hs[i].appendChild(newH);
			}
			hs[i].style.visibility='visible';
		}
	}
}

		var cumsum=0;  /* required for setup only*/
		function printNum(){
		for (k=0;k<charWidth2.length;k++){
			cumsum=cumsum+charWidth2[k];
			document.getElementById('response').innerHTML=document.getElementById('response').innerHTML+','+cumsum;
		}
		}
		


/*------------------------------------AJAX FUNCTIONS---------------------------------------*/

if (window.ActiveXObject) {
	var srvrConnect=new ActiveXObject('Microsoft.XMLHTTP');
} else if (window.XMLHttpRequest) {
	var srvrConnect=new XMLHttpRequest();
}

function initAjax(){
	var inputs=document.getElementsByTagName('input');
	for (i=0;i<inputs.length;i++){
		if (inputs[i].getAttribute&&inputs[i].getAttribute('ajaxEnable')!=null){
			switch(inputs[i].getAttribute('ajaxEnable')){
				case "num": 
					inputs[i].onblur=function(){doAjax(this,1)}
				break
				case "date":
					inputs[i].onblur=function(){if(confDate(this,this.value)) doAjax(this,1)}
				break
				case "radio":
					inputs[i].onchange=function(){doAjax(this,1)}
				break
				default:
					inputs[i].onblur=function(){doAjax(this,1)}
			}
		}
	}
	var inputs=document.getElementsByTagName('textarea');
	for (i=0;i<inputs.length;i++){
		if (inputs[i].getAttribute&&inputs[i].getAttribute('ajaxEnable')!=null){
			inputs[i].onblur=function(){doAjax(this,1)};
		}
	}
	var inputs=document.getElementsByTagName('select');
	for (i=0;i<inputs.length;i++){
		if (inputs[i].getAttribute&&inputs[i].getAttribute('ajaxEnable')!=null){
			inputs[i].onblur=function(){doAjax(this,1)}
		}
	}
}

function ajaxSave(obj){
		str='act=1&field=' + obj.name + '&value=' + obj.value;
		srvrConnect.open('post','_processAjax.cfm',0);
		srvrConnect.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		srvrConnect.send(str);
		document.getElementById('response').innerHTML=srvrConnect.responseText;
}

function doAjax(obj,act){
	var sendStr='act='+act+'&field='+obj.name+'&value='+escape(obj.value);
	var resp=getXML(sendStr,'_processAjax.cfm');
	//crawlXML(resp);
	var chk=resp.getElementsByTagName('success')[0].firstChild.data;
	if (chk!='true'){
		document.getElementById('response').innerHTML=resp.getElementsByTagName('message')[0].firstChild.data;
		if (confirm("An error occurred while attempting to save your data. To try again, click 'OK'. If this problem persists, please click 'Cancel' and  contact Big Giant Media for assistance.")) obj.focus();
	}
}

function getXML(sendStr,template){
	srvrConnect.open('post',template,0);
	srvrConnect.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	srvrConnect.send(sendStr);
	//alert(srvrConnect.responseText);
	try {
		var resp=srvrConnect.responseXML;
		var notWhitespace = /\S/
		var xmlData=resp.getElementsByTagName('data')[0];
		for (i=0;i<xmlData.childNodes.length;i++){
			if ((xmlData.childNodes[i].nodeType == 3)&&(!notWhitespace.test(xmlData.childNodes[i].nodeValue))) {
				xmlData.removeChild(xmlData.childNodes[i])
				i--
			}
		}
		return xmlData;
	} catch(err) {
		document.getElementById('response').innerHTML=srvrConnect.responseText;
		var xml=document.createDocumentFragment();
		var node=xml.createElement('success');
		xml.appendChild(node);
		var contents=xml.createTextNode('false');
		node.appendChild(contents);
		var node2=xml.createElement('message');
		var contents2=xml.createTextNode(srvrConnect.responseText);
		node2.appendChild(contents2);
		xml.appendChild(node2);
	 	return xml;
	}
}

			var _xmlStr;	
			function crawlXML(doc) {   /* -----PARSES AND DISPLAYS XML DOCUMENT AS UNORDERED LIST  - FOR DEBUGGING -----*/
				if(doc.hasChildNodes()) {  
					_xmlStr+='<ul><li>'+doc.tagName+'> ';       
					for(var i=0; i<doc.childNodes.length; i++) {   
					crawlXML(doc.childNodes[i]);                
					}                                              
					_xmlStr+='</li></ul>';                         
				} else {                                          
					_xmlStr+=doc.nodeValue;                        
				}                                                 
			document.getElementById('response').innerHTML=_xmlStr;	
			} 


/*------------------------------GENERIC FORM VALIDATION SCRIPT----------------------------------------*/

function val(obj){
	//if (obj.name=='resForm' && (document.getElementById('selectedDate').value=='' && document.getElementById('openTicket').checked==false)) {
	if (obj.name=='resForm' && document.getElementById('selectedDate').value=='') {
		alert('You must select a date by clicking the appropriate box in the calendar.');
		return false;
	}
	if (obj.name=='resForm' && (isNaN(document.getElementById('numPassengers').value) || document.getElementById('numPassengers').value>maxPass)) {
		return false;
	}
	var inputs=obj.getElementsByTagName('input');
	for (ind=0;ind<inputs.length;ind++){
	  if (inputs[ind].name=='tnc'&&!inputs[ind].checked){
	  	alert('You must check the box confirming that you have read and agree to the terms and conditions.');
		return false;
	  }
	  if (inputs[ind].getAttribute&&inputs[ind].getAttribute('required')!=null&&(inputs[ind].value==''||inputs[ind].value=='Value Needed')){
		alert('You omitted a required value. We will take you to the empty field. Please supply a response and submit again');
		inputs[ind].value='Value Needed';
		inputs[ind].select();
		inputs[ind].focus();
		return false;
	  }
	 // if (obj.name=='resForm2'){
	 //		if (inputs[ind].name=='voucherNums' && inputs[ind].value=='') inputs[ind].value='n/a';	
	 // }
	  
	  // ------------ REQUIRES INPUT FIELD TYPE OF "EMAIL" ------------------//
	  
	  if (inputs[ind].getAttribute&&inputs[ind].getAttribute('type')=='email'&&inputs[ind].value!=''){
	  	if (inputs[ind].value.substr(0,1)=='@' || inputs[ind].value.indexOf('@.')!=-1 || inputs[ind].value.replace(/[^@]/g,'')!='@'){
			alert('Email address is incorrectly formatted.');
			inputs[ind].select();
			inputs[ind].focus();
			return false;
		} else {
			var emailStrip=inputs[ind].value.replace(/\w/g,'').split('@');
			if (emailStrip[0].replace(/\./g,'').length>0 || emailStrip[1].replace(/\./g,'').length>0){
				alert('Email address is incorrectly formatted.');
				inputs[ind].select();
				inputs[ind].focus();
				return false;
			}
		}
	  }

	  // ------------ REQUIRES INPUT FIELD NAMES OF USER_PASSWORD AND CONFIRM_PASSWORD ------------------//
	  
	  if (inputs[ind].id=='User_Password' && inputs[ind].value!=document.getElementById('confirm_Password').value){
	  	alert('Password entries do not match');
		inputs[ind].select();
		inputs[ind].focus();
		return false;
	  }
	  
	  // ------------------------END SPECIAL MOD--------------------//
	  
	}
	
	var inputs=obj.getElementsByTagName('textarea');
	for (ind=0;ind<inputs.length;ind++){
	  if (inputs[ind].getAttribute&&inputs[ind].getAttribute('required')!=null&&(inputs[ind].value==''||inputs[ind].value=='Value Needed')){
		alert('You omitted a required value. We will take you to the empty field. Please supply a response and submit again');
		inputs[ind].value='Value Needed';
		inputs[ind].select();
		inputs[ind].focus();
		return false;
	  }
	}
	
}

/*------------------------------TRANSPARENT PNG REPLACEMENT FOR <IE7 ----------*/

function replacePNG(obj){
	var xPNG=obj.getElementsByTagName('img');
	var szMthd='image';
	for (i=0;i<xPNG.length;i++){
		if (xPNG[i].src.toLowerCase().indexOf('.png')!=-1) {
			var file=xPNG[i].src;
			xPNG[i].src='images/1x1.gif';
			xPNG[i].style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+file+'", sizingMethod="'+szMthd+'")';
		}
	}
}

/*------------------------------NEW IMPROVED OVERLAY SCRIPT------------------------------*/

/*	 USAGE NOTES:

		activateOverlay(type,content,dragTF,scrColor,scrOpacPercent)
		
		type=img,document;
		content=link to image or document;
		dragTF=true for draggable, false for static;
		scrColor=color name or hex code for background screen color;
		scrOpacPercent=0-100, 100 completely opaque
*/

var bodyOv, docElOv;
var bgm_scrollWidth;

function enableOverlay(){

	var scr=document.createElement('div');
		scr.id='bgm_pgScreen';
		scr.style.position='absolute';
		scr.style.top='0px';
		scr.style.left='0px';
		scr.style.width='100%';
		scr.style.height='100%';
		scr.style.zIndex=3;
		scr.style.display='none';
	var bgm_overlay=document.createElement('div');
		bgm_overlay.id='bgm_overlay';
		bgm_overlay.style.backgroundRepeat='repeat-y';
		bgm_overlay.style.backgroundPosition='center center';
		bgm_overlay.style.padding='1px 1px 1px 1px';
		bgm_overlay.style.position='absolute';
		bgm_overlay.style.zIndex=90000;
		bgm_overlay.style.visibility='hidden';
		bgm_overlay.style.overflow='hidden';
		bgm_overlay.style.display='block';
		bgm_overlay.style.top='0px';
	var bgm_bttnClose=document.createElement('img');
		bgm_bttnClose.id='bgm_Ocloser';
		bgm_bttnClose.src='images/window-close.png';
		bgm_bttnClose.style.position='absolute';
		bgm_bttnClose.style.top='2px';
		bgm_bttnClose.style.width='32px';
		bgm_bttnClose.style.height='31px';
		bgm_bttnClose.style.cursor='pointer';
		bgm_bttnClose.style.display='none';
		bgm_bttnClose.onclick=function(){closeIt=setInterval('resizeOverlay(0,0)',20)};
		
	if (document.getElementById('topDiv')) {
		document.getElementById('topDiv').appendChild(scr);
	} else {
		document.body.appendChild(scr);
	}
	document.body.appendChild(bgm_overlay);

	bgmScreen=document.getElementById('bgm_pgScreen');
	bgmOverlay=document.getElementById('bgm_overlay');
	bgmOverlay.appendChild(bgm_bttnClose);
	bgm_bttn=document.getElementById('bgm_Ocloser');
	if (isLTIE7) replacePNG(bgm_bttn.parentNode);

	var testBox=document.createElement('div');
	testBox.id='testbox';
	testBox.style.width='150px';
	testBox.style.height='150px';
	testBox.style.position='absolute';
	testBox.style.left='100px';
	testBox.style.top='100px';
	testBox.style.overflow='scroll';
	document.body.insertBefore(testBox,document.body.firstChild);
	bgm_scrollWidth=parseFloat(document.getElementById('testbox').offsetWidth)-parseFloat(document.getElementById('testbox').clientWidth);
	document.body.removeChild(document.getElementById('testbox'));
	
}

var winW, winH, maxW, maxH, ovType;

function activateOverlay(type,content,dragTF,scrColor,scrOpacPercent){
	ovType=type;

	if (document.getElementById('bgm_overlayImage')||document.getElementById('bgm_overlayDoc')) {
		bgmScreen.style.display='none';
		bgmOverlay.removeChild(bgmOverlayObj);
		bgmOverlay.style.visibility='hidden';
		bgm_bttn.style.left='0px';
		bgmOverlay.onmousedown=null;
		bgmIndex=1;
		lastX=null;
		lastY=null;
		disableOverlay();
	}
	if (isLTIE7){
		var sels=document.getElementsByTagName('select');
		for (u=0;u<sels.length;u++){
			sels[u].style.visibility='hidden';
		}
	}
	
	if (document.getElementById('overCap')){
		document.getElementById('overCap').parentNode.removeChild(document.getElementById('overCap'))
	}

	if (scrColor&&scrOpacPercent){
		bgmScreen.style.backgroundColor=scrColor;
		bgmScreen.style.filter='alpha(opacity='+scrOpacPercent+')';
		bgmScreen.style.opacity=scrOpacPercent/100;
		bgmScreen.style.height=Math.max(document.documentElement.scrollHeight,document.documentElement.clientHeight)+'px';
		if (isLTIE7) bgmScreen.style.height=document.body.scrollHeight+'px';
		bgmScreen.style.display='block';
	}
	
	if (type!='html'){
		bgmOverlay.style.border='1px outset #999999';
		bgmOverlay.style.backgroundImage='url(images/window-bckgrd.png)';
		bgm_bttn.style.top='2px';
	} else {
		bgmOverlay.style.border='none';
		bgmOverlay.style.backgroundImage='none';
		bgm_bttn.style.top='10px';
	}

	if (dragTF==true) bgmOverlay.className='dragme';
		
	winW=document.documentElement.clientWidth;
	if (winW==0) winW=document.body.clientWidth;
	winH=document.documentElement.clientHeight;
	if (winH==0) winH=document.body.clientHeight;

	if (type=='image'||type=='imgWithCap'){
		var bgm_overlayImage=document.createElement('img');
			bgm_overlayImage.id='bgm_overlayImage';
			bgm_overlayImage.style.border='1px inset #999999';
			bgm_overlayImage.onload=function(){activate_2(type)};
		bgmOverlay.appendChild(bgm_overlayImage);

		bgmOverlayObj=document.getElementById('bgm_overlayImage');
		bgmOverlayObj.src=content;
		bgmOverlayObj.oncontextmenu=function(){
			alert('Sorry. This image is copyrighted and may not be used without permission.');
			return false;
		}
	} else if (type=='html'){
		var bgm_overlayDoc=document.createElement('div');
			bgm_overlayDoc.id='bgm_overlayDoc';
			bgm_overlayDoc.style.textAlign='center';
			str='act=6&id=' + content;
			srvrConnect.open('post','_processAjax.cfm',0);
			srvrConnect.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
			srvrConnect.send(str);
		bgmOverlay.appendChild(bgm_overlayDoc);
		bgmOverlayObj=document.getElementById('bgm_overlayDoc');
		bgmOverlayObj.innerHTML=srvrConnect.responseText;
		headlines(document.getElementById('bgm_overlayDoc'));
		//bgmOverlay.onclick=function(){closeIt=setInterval('resizeOverlay(0,0)',20)};
		activate_2(type);
	}else{
		var bgm_overlayDoc=document.createElement('div');
			bgm_overlayDoc.id='bgm_overlayDoc';
			bgm_overlayDoc.style.border='1px inset #999999';
			bgm_overlayDoc.style.backgroundColor='#000000';
		var bgm_ifr=document.createElement('iframe');
			bgm_ifr.frameBorder='0';
			bgm_ifr.style.width='100%';
			bgm_ifr.style.height='100%';
			bgm_ifr.src=content;
			bgm_ifr.id='bgmIFrame';
			bgm_ifr.name='bgmIFrame';
			if (isSafari) bgm_ifr.onload=function(){
				window.frames['bgmIFrame'].scrollBy(1,100);
			};
		bgmOverlay.appendChild(bgm_overlayDoc);
		bgmOverlayObj=document.getElementById('bgm_overlayDoc');
		bgmOverlayIframe=bgm_ifr;
		activate_2(type);
	}
}

function disableOverlay(){
		//document.documentElement.style.overflow='auto';
		//document.body.style.paddingRight='0px';
		if (isSafari){
			window.scrollBy(0,1);
		}
}

function activate_2(type){
	var scrollOffset=parseInt(document.body.scrollTop!=0?document.body.scrollTop:document.documentElement.scrollTop);
	if (type=='image'){
		maxW=Math.min(parseInt(bgmOverlayObj.offsetWidth),winW-80);
		maxH=Math.min(parseInt(bgmOverlayObj.offsetHeight),winH-60);
		document.getElementById('bgm_Ocloser').style.display='block';
	} else if (type=='imgWithCap'){
		maxW=Math.min(parseInt(bgmOverlayObj.offsetWidth),winW-80);
		maxH=Math.min(parseInt(bgmOverlayObj.offsetHeight),winH-60);
		document.getElementById('bgm_Ocloser').style.display='block';
		var fileName=bgmOverlayObj.src.substr(bgmOverlayObj.src.lastIndexOf('/')+1);
			str='act=4&file=' + fileName.replace(/\&/g,'|||');
			srvrConnect.open('post','_processAjax.cfm',0);
			srvrConnect.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
			srvrConnect.send(str);
		if (srvrConnect.responseText.search(/\w/)!=-1){
			var cap=document.createElement('div');
			cap.id='overCap';
			cap.style.color='white';
			cap.style.backgroundColor='black';
			cap.style.filter='alpha(opacity=60)';
			cap.style.opacity='0.60';
			cap.style.padding='5px 0px';
			cap.style.fontSize='11pt';
			cap.style.textAlign='center';
			cap.style.position='absolute';
			cap.style.top=(maxH-30)+'px';
			cap.style.width=maxW+'px';
			cap.style.left='0px';
			cap.innerHTML=srvrConnect.responseText;
			bgmOverlay.appendChild(cap);
			//document.getElementById('response').innerHTML=srvrConnect.responseText;
		}
	} else if (type=='custom'){
		maxW=600;
		maxH=Math.min(parseInt(winH*0.95),530);
		document.getElementById('bgm_Ocloser').style.display='block';
	} else if (type=='html'){
		document.getElementById('bgm_Ocloser').style.display='none';
		maxW=440;
		maxH=parseInt(bgmOverlayObj.offsetHeight);
	} else if (type=='login'){
		maxW=450;
		maxH=260;
		document.getElementById('bgm_Ocloser').style.display='block';
	} else if (type=='wait'){
		maxW=400;
		maxH=260;
	} else if (type=='calendar'){
		maxW=250;
		maxH=501;
		document.getElementById('bgm_Ocloser').style.display='block';
	} else {
		maxW=parseInt(winW*0.8);
		maxH=parseInt(winH*0.8);
		document.getElementById('bgm_Ocloser').style.display='block';
	}

	bgmOverlayObj.style.height='0px';
	bgmOverlayObj.style.width='0px';
	bgmOverlay.style.left=(winW/2-10)+'px';
	bgmOverlay.style.top=(winH/2-20)+scrollOffset+'px';
	sizeIt=setInterval('resizeOverlay('+maxW+','+maxH+')',20)
}

var bgmIndex=1;
var objOpac=100;

function resizeOverlay(w,h,act){
	var oWidth=parseInt(bgmOverlayObj.style.width);
	var oHeight=parseInt(bgmOverlayObj.style.height);
	var scrollOffset=parseInt(document.body.scrollTop!=0?document.body.scrollTop:document.documentElement.scrollTop);
	if (bgmOverlay.style.visibility=='hidden')bgmOverlay.style.visibility='visible';
	if (w>0&&h>0){
		if (oWidth<w || oHeight<h){
			if (oWidth<w) {
				bgmOverlayObj.style.width=(oWidth+Math.max((w-oWidth)/2,1))+'px';
				bgm_bttn.style.left=(parseInt(bgmOverlayObj.style.width)-30)+'px';
				bgmOverlay.style.left=(winW/2-parseInt(bgmOverlayObj.style.width)/2-10)+'px';
				lastX=bgmOverlay.style.left;
			} else
			if (oHeight<h) {
				bgmOverlayObj.style.height=(oHeight+Math.max((h-oHeight)/2,1))+'px';
				bgmOverlay.style.top=(winH/2+scrollOffset-parseInt(bgmOverlayObj.style.height)/2-0)+'px';
				lastY=bgmOverlay.style.top;
			}
		} else {
			clearInterval(sizeIt);
			if (!isLTIE7) {
				bgmOverlay.style.position='fixed';
				bgmOverlay.style.top=parseInt(bgmOverlay.style.top)-scrollOffset+'px';
			}
			if (typeof(bgmOverlayIframe)!='undefined'&&bgmOverlayIframe.src.indexOf('.pdf')!=-1) bgmOverlay.style.paddingTop='25px';
			if (bgmOverlayObj.tagName=='DIV'&&typeof(bgmOverlayIframe)!='undefined') bgmOverlayObj.appendChild(bgmOverlayIframe);
		}
	} else {
		//if (document.getElementById('bgmIFrame')) bgmOverlayObj.removeChild(bgmOverlayIframe);
		if (bgmScreen.style.display=='block') bgmScreen.style.display='none';
		if (!isLTIE7&&bgmOverlay.style.position=='fixed'){
			bgmOverlay.style.position='absolute';
			lastY=parseInt(bgmOverlay.style.top)+scrollOffset+'px';
			lastX=bgmOverlay.style.left;
		}
		
		if (objOpac>0) {
			bgmOverlay.style.filter='alpha(opacity='+objOpac+')';
			bgmOverlay.style.opacity=objOpac/100;
			objOpac-=20;
				bgmOverlay.style.left=(parseInt(lastX)+(oWidth-parseInt(bgmOverlayObj.style.width))/2)+'px';
				bgmOverlay.style.top=(parseInt(lastY)+(oHeight-parseInt(bgmOverlayObj.style.height))/2)+'px';
		
		/*if (oWidth>60 || oHeight>60){
			if (oWidth>0) {
				bgmOverlayObj.style.width=oWidth*(100-Math.pow(bgmIndex,2))/100+'px';
				bgm_bttn.style.left=(parseInt(bgmOverlayObj.style.width)-38)+'px';
				bgmOverlay.style.left=(parseInt(lastX)+(oWidth-parseInt(bgmOverlayObj.style.width))/2)+'px';
				lastX=bgmOverlay.style.left;
			}
			if (oHeight>0) {
				bgmOverlayObj.style.height=oHeight*(100-Math.pow(bgmIndex,2))/100+'px';
				bgmOverlay.style.top=(parseInt(lastY)+(oHeight-parseInt(bgmOverlayObj.style.height))/2)+'px';
				lastY=bgmOverlay.style.top;
			}
			bgmIndex++;*/
		} else {
			clearInterval(closeIt);
			delete(bgmOverlayIframe);
			bgmOverlay.removeChild(bgmOverlayObj);
			bgmOverlay.style.visibility='hidden';
			bgmOverlay.style.filter=null;
			bgmOverlay.style.opacity=1;
			bgmOverlay.onmousedown=null;
			bgmIndex=1;
			objOpac=100;
			lastX=null;
			lastY=null;
			if (isLTIE7){
				var sels=document.getElementsByTagName('select');
				for (u=0;u<sels.length;u++){
					sels[u].style.visibility='visible';
				}
			}
			if (ovType!='image') disableOverlay();
			if (typeof(act)!='undefined' && act=='jump'){document.location.href='employee_docs.cfm'}
			if (typeof(act)!='undefined' && act=='refresh'){document.location.href=document.location.href.replace(/logout=1/g,'')}
		}
	}
}

function printHist(){
	window.top.frames[0].focus();
	window.top.frames[0].print();
}
function createPDF(){
	window.top.frames[0].document.workOrder.submit();
}
function showButtons(){
	window.top.document.getElementById('showCalendar').style.display='inline';
}



/* -------------------------------SEARCHED WORD HIGHLIGHT FUNCTIONS -------------------------------*/

function highlightWord(node,word) {
  // Iterate into this nodes childNodes
  if (node.hasChildNodes) {
    var hi_cn;
    for (hi_cn=0;hi_cn<node.childNodes.length;hi_cn++) {
      highlightWord(node.childNodes[hi_cn],word);
    }
  }

  // And do this node itself
  if (node.nodeType == 3) { // text node
    tempNodeVal = node.nodeValue.toLowerCase();
    tempWordVal = word.toLowerCase();
    if (tempNodeVal.indexOf(tempWordVal) != -1) {
      pn = node.parentNode;
      if (pn.className != "searchword") {
        // word has not already been highlighted!
        nv = node.nodeValue;
        ni = tempNodeVal.indexOf(tempWordVal);
        // Create a load of replacement nodes
        before = document.createTextNode(nv.substr(0,ni));
        docWordVal = nv.substr(ni,word.length);
        after = document.createTextNode(nv.substr(ni+word.length));
        hiwordtext = document.createTextNode(docWordVal);
        hiword = document.createElement("span");
        hiword.className = "searchword";
        hiword.appendChild(hiwordtext);
        pn.insertBefore(before,node);
        pn.insertBefore(hiword,node);
        pn.insertBefore(after,node);
        pn.removeChild(node);
      }
    }
  }
}

/*-------------------------------NAVIGATION SCRIPT --------------------------------*/

var shadows=false;
var isHorizontal=false;
var primaryVertOffset=5;
var secondaryVertOffset=0;
var secondaryHorizontalOffset=5;
var alpha=90;

var colors=new Array('#e1e1e1','#c2c2c2','#999999','#666666','#3e3e3e','#1f1f1f','#0b0b0b')
var navWidth=202;
var shadWidth=0;

var ieVer=parseInt(navigator.appVersion.split("MSIE")[1]);

function setupNav(nav){
	//nav.style.marginLeft=(980-nav.offsetWidth)/2+'px';
	var links=nav.getElementsByTagName('a');
	var lis=nav.getElementsByTagName('li');
	for (n=0;n<links.length;n++){                  // Determine minimum subnav width necessary for longest link text
		links[n].innerHTML=links[n].innerHTML.replace(/ /g,'&nbsp;');
		if (links[n].parentNode.parentNode.id!='nav') navWidth=Math.max(navWidth,links[n].offsetWidth);
	}
	for (n=0;n<links.length;n++){                 // Make all subnav equal width
		if (links[n].parentNode.parentNode.id!='nav') {
			links[n].style.display='block';
			var navMax=Math.max(navWidth,links[n].parentNode.parentNode.parentNode.offsetWidth);
			//links[n].style.width=navMax+'px';
		}
	}
	//for (n=0;n<links.length;n++){	                // Remeasure width inlcuding padding so shadows are correct width
	//	if (links[n].parentNode.parentNode.id!='nav') shadWidth=Math.max(shadWidth,links[n].offsetWidth);
	//}
	var uls=nav.getElementsByTagName('ul');
	flyouts=new Object();
	closers=new Object();
	tmr=new Object();
	for (m=0;m<uls.length;m++){
		if (uls[m].parentNode.parentNode.id=='nav') {
			uls[m].style.top=primaryVertOffset+'px';
			if (isHorizontal) {
				uls[m].style.marginLeft=-navWidth+'px';
			} else {
				uls[m].style.marginLeft=-(navWidth-secondaryHorizontalOffset-uls[m].parentNode.firstChild.offsetWidth)+'px';
			}
			uls[m].style.top=(primaryVertOffset-uls[m].offsetHeight)+'px';
		} else {
			uls[m].style.top=secondaryVertOffset+'px';
			uls[m].style.marginLeft=secondaryHorizontalOffset+'px';
		}
		uls[m].id=m;
		
		// shadow stuff start
		if (shadows){
			if (document.all && !window.opera){
					a=document.createElement('div');
					a.style.width=(uls[m].offsetWidth-3)+'px'
					a.style.height=(uls[m].offsetHeight-3)+'px'
					a.className='shadowIE';
					a.style.border='1px solid  black';
					a.style.backgroundColor='black';
					uls[m].insertBefore(a,uls[m].firstChild);
				
			}else{
			
				for (n=0;n<7;n++){
					a=document.createElement('div');
					a.style.width=shadWidth+'px';
					a.style.top=n+'px';
					a.style.left=n+'px';
					a.style.height=uls[m].offsetHeight+'px';
					a.style.position='absolute';
					a.className='shadowOther';
					if (window.opera &&parseInt(window.opera.version())<9) 	a.style.borderColor=colors[6-n];
					a.style.filter='alpha(opacity='+((7-n)*10+n)+')';
					a.style['opacity']=((7-n)/10+n/100);
					a.style['-moz-opacity']=(7-n)/10+n/100;
					a.style['-khtml-opacity']=(7-n)/10+n/100;
					uls[m].insertBefore(a,uls[m].firstChild);
				}
				
			}
		}
		// shadow stuff end
		
	}
	for (o=0;o<lis.length;o++){
			lis[o].style.zIndex=lis.length-o;	
	}
	for (i=0;i<links.length;i++){
			if (links[i].parentNode.parentNode.id!='nav'){
				links[i].style.filter='alpha(opacity='+alpha+')';
				links[i].style['opacity']=alpha/100;
				links[i].style['-moz-opacity']=alpha/100;
				links[i].style['-khtml-opacity']=alpha/100;
			}
			links[i].onmouseover=function(){showSub(this)};
			links[i].onmouseout=function(){hideSub(this)};
			links[i].onfocus=function(){this.blur()};
			if (links[i].href.indexOf('#')!=links[i].href.length-1){
				links[i].onclick=function(){hideSub(this)};
			} else {
				links[i].onclick=function(){return false};
			}	
	}
	nav.style.visibility='visible';
}

function showSub(prime){
	var obj=prime;
	var sub=prime.parentNode.getElementsByTagName('ul');
	while (obj.id!='nav'){
		if (obj.tagName.toLowerCase()=='ul' && tmr[obj.id]) clearTimeout(tmr[obj.id]);
		obj=obj.parentNode;
	}
	if (sub.length>0){
		if (tmr[sub[0].id]) clearTimeout(tmr[sub[0].id]);
		expTimer=setTimeout(function(){flyouts[sub[0].id]=sub[0]},200);
	}
}

function hideSub(prime){
	if (typeof(expTimer)!='undefined') clearTimeout(expTimer);
	var sub=prime.parentNode.getElementsByTagName('ul');
	if (sub.length>0){
		  tmr[sub[0].id]=setTimeout('delete flyouts['+sub[0].id+'];closers['+sub[0].id+']='+sub[0].id,125);
	}
	var obj=prime;
	while (obj.id!='nav'){
			if (obj.tagName.toLowerCase()=='ul'){
		 	  tmr[obj.id]=setTimeout('delete flyouts['+obj.id+'];closers['+obj.id+']='+obj.id,125);
			}
			obj=obj.parentNode;
	}
}


function animate(){
	for (j in flyouts){
		var curValue=(isNaN(parseInt(flyouts[j].style.left))?0:parseInt(flyouts[j].style.left));
		var curY=(parseInt(flyouts[j].style.top));
		if (isHorizontal && flyouts[j].parentNode.parentNode.id=='nav' && curY<primaryVertOffset){
				flyouts[j].style.left=navWidth+'px';
				flyouts[j].style.top=Math.ceil((primaryVertOffset+curY)/2)+'px';;
				flyouts[j].style.clip='rect('+(-(curY-primaryVertOffset)/2)+'px 2500px 2500px 0px)';
		} else if (curValue<flyouts[j].offsetWidth && !(isHorizontal && flyouts[j].parentNode.parentNode.id=='nav')) {
				if (flyouts[j].parentNode.parentNode.id=='nav') flyouts[j].style.top=primaryVertOffset+'px';
				flyouts[j].style.left=(curValue+Math.ceil((flyouts[j].offsetWidth-curValue)/2))+'px';
				flyouts[j].style.clip='rect(0px 2500px 2500px ' + ((flyouts[j].offsetWidth-curValue)/2-2)+ 'px)';
		} else {
				delete flyouts[j];
		}
	}
	for (k in closers){
		var curUL=document.getElementById(closers[k]);
		var curValue=parseInt(curUL.style.left);
		var curY=parseInt(curUL.style.top);
		if (isHorizontal && curUL.parentNode.parentNode.id=='nav' && curY>(primaryVertOffset-curUL.offsetHeight)){
				curUL.style.top=curY-Math.ceil((+curUL.offsetHeight+curY-primaryVertOffset)/2)+'px';;
				curUL.style.clip='rect('+((primaryVertOffset-curY+curUL.offsetHeight)/2)+'px 2500px 2500px 0px)';
		} else if (curValue>0 && (curUL.parentNode.parentNode.id!='nav' || !isHorizontal)) {
				curUL.style.left=(curValue=curValue-Math.ceil(curValue/2)-10)+'px';
				curUL.style.clip='rect(0px 2500px 2500px ' + (curUL.offsetWidth-curValue)+ 'px)';
		} else {
			if (curUL.parentNode.parentNode.id=='nav') curUL.style.top=(primaryVertOffset-curUL.offsetHeight)+'px';
			curUL.style.clip='rect(0px 2500px 2500px 2500px)';
			delete closers[k];
		}
	}
}

/*-------------------------------CLOCK SCRIPT --------------------------------*/

var month=new Array('January','February','March','April','May','June','July','August','September','October','November','December');
var days=new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
var timeFlag=false;
	
function timer(){
	if (document.getElementById('timeHolder')) document.getElementById('timeHolder').innerHTML=calcTime();
}

function calcTime(){
	var now=new Date();
	var seconds=now.getSeconds()<10?'0'+now.getSeconds():now.getSeconds();
	var minutes=now.getMinutes()<10?'0'+now.getMinutes():now.getMinutes();
	//var timeStr=now.getHours()>11?((now.getHours()==12?12:now.getHours()-12))+':'+minutes+':'+seconds+' PM':(now.getHours()==0?12:now.getHours())+':'+minutes+':'+seconds+' AM';
	var timeStr=now.getHours()>11?((now.getHours()==12?12:now.getHours()-12))+':'+minutes+':'+seconds:(now.getHours()==0?12:now.getHours())+':'+minutes+':'+seconds;
	var dayStr=days[now.getDay()]+ ' ' + (now.getMonth()+1)+'-'+now.getDate()+'-'+now.getFullYear().toString().substr(2,2);
	return dayStr  + ' - '+ timeStr;
}

/*------------------------------- ROUNDED CORNERS AND DROPSHADOW ROUTINE -------------*/

	function makeCorners(node){
	
		if (node.hasChildNodes) {
				var iteration;
				for (iteration=0;iteration<node.childNodes.length;iteration++) {
					makeCorners(node.childNodes[iteration]);
				}
		}
		  
  // format for ATTRIBUTE: corners="round,[radius (0 if none)],[color (0 if background or none)],[shadowOffset (0 if none)],[shadowOpacity (0-1)]"
  // ex: corners=round,10,#000FFF,10,0.50"
		  
		if (node.getAttribute&&(sty=node.getAttribute('corners'))){
		   
			var selectBoxes=node.getElementsByTagName('select');
			var tempStorage=new Array();
			for (xx=0;xx<selectBoxes.length;xx++){
				tempStorage[selectBoxes[xx].name]=selectBoxes[xx].selectedIndex
			}			

			var arrSty=sty.split(',');
			sty=arrSty[0];
			cornerRadius=parseInt(arrSty[1]);
			shadowOffset=parseInt(arrSty[3]);
			shadowOpacity=arrSty[4];
			
			var n=node;
			
			if (arrSty[2]!=0) {
				borderColor=arrSty[2];
			} else {
				borderColor=n.style.backgroundColor;
			}
						
			if (parseInt(n.offsetWidth)!=0){  

				elWidth=n.offsetWidth;
				elHeight=n.offsetHeight;
				
			} else {  //ROUTINE TO DETERMINE SIZE OF display:none ELEMENTS
			
				var elTemp=document.createElement('div');
				elTemp.style.position='absolute';
				elTemp.style.visibility='hidden';
				document.body.insertBefore(elTemp,document.body.firstChild);
				nodeTemp=n.cloneNode(true);
				elTemp.appendChild(nodeTemp);
				elWidth=nodeTemp.offsetWidth;
				elHeight=nodeTemp.offsetHeight;
				elTemp.parentNode.removeChild(elTemp);
			
			}
			
			var newDiv=document.createElement('div');
			newDiv.style.width=elWidth+(!document.all?0:0)+'px';
			newDiv.style.styleFloat=n.style.styleFloat;
			newDiv.style.cssFloat=n.style.cssFloat;
			newDiv.style.display=n.style.display;
			newDiv.style.marginLeft=n.style.marginLeft;
			newDiv.style.marginRight=n.style.marginRight;
			newDiv.style.marginTop=n.style.marginTop;
			newDiv.style.marginBottom=n.style.marginBottom;
			newDiv.style.position=n.style.position==''?'relative':n.style.position;
			newDiv.style.top=n.style.top;
			newDiv.style.left=n.style.left;
			newDiv.style.zIndex=n.style.zIndex;

			if (sty=='round' && cornerRadius!=0){
			
				var topCorners=document.createElement('div');
				var bottomCorners=document.createElement('div');
				
				for (i=cornerRadius;i>0;i--){
					var newLine=document.createElement('div');
					newLine.style.height='1px';
					newLine.style.overflow='hidden';
					newLine.style.position='relative';
					newLine.style.zIndex='10';
					var mrgn=cornerRadius-Math.cos(Math.asin(i/cornerRadius))*cornerRadius;
					newLine.style.margin='0px ' + mrgn + 'px';
					newLine.style.backgroundColor=borderColor;
					topCorners.appendChild(newLine);	
				}
				newDiv.appendChild(topCorners);	
				
				var orig=n.cloneNode(true);
				orig.setAttribute('corners',null);
				orig.style.position='relative';
				orig.style.top='0px';
				orig.style.left='0px';
				orig.style.marginLeft='0px';
				orig.style.marginRight='0px';
				orig.style.marginTop='0px';
				orig.style.marginBottom='0px';
				orig.style.cssFloat='';
				orig.style.styleFloat='';
				newDiv.appendChild(orig);
				
				for (i=1;i<=cornerRadius;i++){
					var newLine=document.createElement('div');
					newLine.style.height='1px';
					newLine.style.overflow='hidden';
					newLine.style.position='relative';
					var mrgn=cornerRadius-Math.cos(Math.asin(i/cornerRadius))*cornerRadius;
					newLine.style.margin='0px ' + mrgn + 'px';
					newLine.style.backgroundColor=borderColor;
					bottomCorners.appendChild(newLine);	
				}
				newDiv.appendChild(bottomCorners);	
			
			} else {
			
				var orig=n.cloneNode(true);
				orig.style.position='relative';
				orig.style.top='0px';
				orig.style.left='0px';
				orig.style.marginLeft='0px';
				orig.style.marginRight='0px';
				orig.style.marginTop='0px';
				orig.style.marginBottom='0px';
				orig.style.cssFloat='';
				orig.style.styleFloat='';
				newDiv.appendChild(orig);
				
			}

			n.parentNode.replaceChild(newDiv,n);
				
			var selectBoxes=newDiv.getElementsByTagName('select');
			for (xx=0;xx<selectBoxes.length;xx++){
				selectBoxes[xx].selectedIndex=tempStorage[selectBoxes[xx].name]
			}	
					
			if (shadowOffset!=0){
			
				
				if (orig.style.backgroundColor!='' && orig.style.backgroundColor!='transparent'){
					var shad=document.createElement('div');
					shad.style.width=elWidth+'px';
					var contentBox=document.createElement('div');
					contentBox.style.height=elHeight+'px';
					contentBox.style.width=elWidth+'px';
					contentBox.style.backgroundColor='#000000';
					if (topCorners) shad.appendChild(topCorners.cloneNode(true));
					shad.appendChild(contentBox);
					if (bottomCorners) shad.appendChild(bottomCorners.cloneNode(true));
				} else {
					var shad=newDiv.cloneNode('true')
					if (!document.all||window.opera){
						var shadImgs=shad.getElementsByTagName('img');
						for (s=0;s<shadImgs.length;s++) {
							var oldW=shadImgs[s].width;
							var oldH=shadImgs[s].height;
							shadImgs[s].src='images/_black.gif';
							shadImgs[s].style.width=oldW+'px';
							shadImgs[s].style.height=oldH+'px';
						}
					}
					var shadInputs=shad.getElementsByTagName('input')
					for (i=0;i<shadInputs.length;i++){
						shadInputs[i].id='';
					}
				}
			
				if (document.all && !window.opera){
					shad.style.position='absolute';
					shad.style.marginLeft='0px';
					shad.style.marginRight='0px';
					shad.style.marginTop='0px';
					shad.style.marginBottom='0px';
					shad.style.top=-shadowOffset/2+'px';
					shad.style.left=-shadowOffset/2+'px';
					shad.style.filter='progid:DXImageTransform.Microsoft.Blur(PixelRadius="'+shadowOffset+'", MakeShadow="true", ShadowOpacity="'+shadowOpacity+'")';
					newDiv.insertBefore(shad,newDiv.firstChild);
				} else {
					shad.style.marginLeft='0px';
					shad.style.marginRight='0px';
					shad.style.marginTop='0px';
					shad.style.marginBottom='0px';
					var allDivs=shad.getElementsByTagName('div');
					for (i=0;i<allDivs.length;i++){
						if (allDivs[i].style.backgroundColor!='' && allDivs[i].style.backgroundColor!='transparent'){
							allDivs[i].style.backgroundColor='#000000';
							allDivs[i].style.borderColor='#000000';
						} else {
							allDivs[i].style.color='#000000';
						}
					}
					shad.style.position='absolute';
					shadowOffset+=5;
					for (x=1;x<=shadowOffset;x++){
						var shad2=shad.cloneNode(true);
						shad2.style.top=x+'px';
						shad2.style.left=x+'px';
						shad2.style.zIndex=0;
						shad2.style.opacity=shadowOpacity/(1*x);
						newDiv.insertBefore(shad2,newDiv.firstChild);
					}
				}
			}
		}
	}

/*--------------------------------CUSTOM DATE FIELD SCRIPT-----------------------*/

	function confDate(obj,str){
		if (str=='') return;
		str=str.replace(/-|\./g,'/');
		var dateArray=str.split('/')
		if (dateArray.length<3){
			alert('Improper date format!\n\nThe date must be formatted in the following way: xx/xx/xxxx.');
			obj.value='';
			setTimeout(function(){obj.select()},100);
			return false;;
		}
		if (dateArray[0]>12||dateArray[0]<1){
			alert('Month value seems unlikely!');
			obj.value='';
			setTimeout(function(){obj.select()},100);
			return false;
		}
		if (dateArray[1]>31||dateArray[1]<1){
			alert('Day value seems unlikely!');
			setTimeout(function(){obj.select()},100);
			return false; ;
		}
		for (i=0;i<2;i++){
			if (dateArray[i].length<2) dateArray[i]='0'+dateArray[i];
			if (dateArray[i].length>2){
				alert('Improper date format!\n\nThe date must be formatted in the following way: xx/xx/xxxx.');
			setTimeout(function(){obj.select()},100);
				return false; ;
			}
		}
		if (dateArray[2].length<4){
			alert('Please enter full year (4 digits).');
			setTimeout(function(){obj.select()},100);
			return false; ;
		}
		str=dateArray[0]+'/'+dateArray[1]+'/'+dateArray[2];
		obj.value=str;
	}

	/*--------------------------CREATE CALENDAR SCRIPT FOR DATE FIELD ---------------------------------*/

	var headerColor='#aaaaff';
	var daysColor='#777777';
	var bodyColor='#ffffdd';
	var todayColor='#000077';
	var hiliteColor='#ddddff';
	var numColor='#000000';
	

	var month=new Array('January','February','March','April','May','June','July','August','September','October','November','December');
	
	var thisMonth, thisYear, origDate, cutoffDate


	function makeCalendar(obj,dir,objShadow,objInput){
		if (obj.firstChild) obj.removeChild(obj.firstChild);
		
		if (cutoffDate!=''&&cutoffDate!=null) {
			var dateParts=cutoffDate.split('/');
			var mo=dateParts[0]-1;
			var dy=dateParts[1];
			var yr=dateParts[2];
			var cutoffDate=new Date(yr,mo,dy)
		} else {
			cutoffDate=new Date(1900,1,1); //----USE IF DATES IN THE PAST ARE NOT ALLOWED, set date to arbitrary date in past to allow past dates
		}
				
		switch(dir){
			case 1:
				thisMonth=thisMonth<11?thisMonth+1:0;
				thisYear=thisMonth==0?thisYear+1:thisYear
				today=new Date(thisYear,thisMonth,1);
				break;
			case -1:
				thisMonth=thisMonth>0?thisMonth-1:11;
				thisYear=thisMonth==11?thisYear-1:thisYear;
				today=new Date(thisYear,thisMonth,1);
				break;
			default:
				today=new Date()
				origDate=today;
				if (cutoffDate>today){
					var today=cutoffDate
				}
				thisMonth=today.getMonth();
				thisYear=today.getFullYear();
		}
	
		var dateArray=new Array(), monthsLength=new Array(31,28,31,30,31,30,31,31,30,31,30,31);
		if (Math.floor(today.getFullYear()/4)==today.getFullYear()/4) monthsLength[1]=29;
		var dayNum=today.getDate(), weekDay=today.getDay(), firstDay;
		while (dayNum>7){
			dayNum-=7;
		}
		firstDay=weekDay-dayNum+1;
		firstDay+=(7*(firstDay<0));
		for (i=0;i<42;i++) {
			if (i<firstDay) {
				dateArray[i]=document.createTextNode(' ');
			} else {
				if ((i-firstDay)<monthsLength[thisMonth]) dateArray[i]=document.createTextNode((i+1-firstDay).toString());
			}
		}
	
		var tbl=document.createElement('table');
			tbl.style.border='none';
			tbl.cellPadding='0px';
			tbl.cellSpacing='0px';
			tbl.style.width='100%';
			tbl.style.fontFamily='arial';
			tbl.style.fontSize='8pt';
			tbl.style.color=numColor;
			tbl.style.position='relative';
			
		var tbdy=document.createElement('tbody');
		
		var row1=document.createElement('tr');
		var c11=document.createElement('td');
			c11.align='left';
			c11.innerHTML='&laquo;';
			c11.style.paddingLeft='5px';
			c11.style.cursor='default';
			c11.style.paddingBottom='3px';
			c11.style.backgroundColor=headerColor;
			c11.style.filter='progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr="#f3f3f3",endColorStr="'+headerColor+'")';
			c11.onclick=function(e){
				var evt=window.event||e;
				if (document.all) {
					evt.cancelBubble=true;
				} else {
					evt.stopPropagation();
				}
				makeCalendar(obj,-1,objShadow,objInput)
			}
		var c12=document.createElement('td');
			var ctr=document.createTextNode(month[thisMonth] + ' ' + thisYear);
			c12.style.textAlign='center';
			c12.style.fontSize='10pt';
			c12.style.color='#000000';
			c12.style.fontWeight='bold';
			c12.colSpan=5;
			c12.appendChild(ctr);
			c12.style.backgroundColor=headerColor;
			c12.style.filter='progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr="#f3f3f3",endColorStr="'+headerColor+'")';
		var c13=document.createElement('td');
			c13.style.textAlign='right';
			c13.style.paddingRight='5px';
			c13.innerHTML='&raquo;';
			c13.style.paddingBottom='3px';
			c13.style.cursor='pointer';
			c13.style.backgroundColor=headerColor;
			c13.style.filter='progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr="#f3f3f3",endColorStr="'+headerColor+'")';
			c13.onclick=function(e){
				var evt=window.event||e;
				if (document.all) {
					evt.cancelBubble=true;
				} else {
					evt.stopPropagation();
				}
				makeCalendar(obj,1,objShadow,objInput)
			}
		row1.appendChild(c11);
		row1.appendChild(c12);
		row1.appendChild(c13);
		
		var row2=document.createElement('tr');
		var c21=document.createElement('td');
			c21.innerHTML='S';
			c21.style.textAlign='center';
			c21.style.width='16%';
			c21.style.border='1px outset';
			c21.style.backgroundColor=daysColor;
			c21.style.filter='progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr="#f3f3f3",endColorStr="'+daysColor+'")';
		var c22=document.createElement('td');
			c22.innerHTML='M';
			c22.style.textAlign='center';
			c22.style.width='14%';
			c22.style.border='1px outset';
			c22.style.backgroundColor=daysColor;
			c22.style.filter='progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr="#f3f3f3",endColorStr="'+daysColor+'")';
		var c23=document.createElement('td');
			c23.innerHTML='T';
			c23.style.textAlign='center';
			c23.style.width='14%';
			c23.style.border='1px outset';
			c23.style.backgroundColor=daysColor;
			c23.style.filter='progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr="#f3f3f3",endColorStr="'+daysColor+'")';
		var c24=document.createElement('td');
			c24.innerHTML='W';
			c24.style.textAlign='center';
			c24.style.width='14%';
			c24.style.border='1px outset';
			c24.style.backgroundColor=daysColor;
			c24.style.filter='progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr="#f3f3f3",endColorStr="'+daysColor+'")';
		var c25=document.createElement('td');
			c25.innerHTML='T';
			c25.style.textAlign='center';
			c25.style.width='14%';
			c25.style.border='1px outset';
			c25.style.backgroundColor=daysColor;
			c25.style.filter='progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr="#f3f3f3",endColorStr="'+daysColor+'")';
		var c26=document.createElement('td');
			c26.innerHTML='F';
			c26.style.textAlign='center';
			c26.style.width='14%';
			c26.style.border='1px outset';
			c26.style.backgroundColor=daysColor;
			c26.style.filter='progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr="#f3f3f3",endColorStr="'+daysColor+'")';
		var c27=document.createElement('td');
			c27.innerHTML='S';
			c27.style.textAlign='center';
			c27.style.width='14%';
			c27.style.border='1px outset';
			c27.style.backgroundColor=daysColor;
			c27.style.filter='progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr="#f3f3f3",endColorStr="'+daysColor+'")';
	
		row2.appendChild(c21);
		row2.appendChild(c22);
		row2.appendChild(c23);
		row2.appendChild(c24);
		row2.appendChild(c25);
		row2.appendChild(c26);
		row2.appendChild(c27);
			
	
		tbdy.appendChild(row1);
		tbdy.appendChild(row2);
		
		var dateRow=new Array(), cell=new Array(), dateValue=new Array();
		
		for (j=0;j<dateArray.length;j++){
			if (j/7==Math.floor(j/7)){
				dateRow[Math.floor(j/7)]=document.createElement('tr');
				tbdy.appendChild(dateRow[Math.floor(j/7)]);
			}	
			cell[j]=document.createElement('td')
			cell[j].style.textAlign='center';
			cell[j].style.cursor='default';
			cell[j].appendChild(dateArray[j]);
			if (cell[j].innerHTML==origDate.getDate()&&origDate.getMonth()==today.getMonth()&&origDate.getFullYear()==today.getFullYear()) {
				cell[j].style.backgroundColor=todayColor;
				cell[j].style.color='white';
			}
			var thisDate=new Date(today.getFullYear(),today.getMonth(),dateArray[j].data);
			if(thisDate>=cutoffDate){
				cell[j].onclick=function(){
					if (this.innerHTML!='') objInput.value=((thisMonth+1)<10?'0':'') + (thisMonth+1)+ '/' + ((parseInt(this.innerHTML))<10?'0':'') + this.innerHTML + '/' + thisYear;
					objInput.focus();
					if (document.all) EOT(objInput);  //SEND TO END OF INPUT DATA. ROUTINE EOT PART OF COMBOBOX CODE
	
				}
				cell[j].onmouseover=function(){
					this.style.backgroundColor=hiliteColor;
				}
				cell[j].onmouseout=function(){
					this.style.backgroundColor=bodyColor;
				}
			} else {
				cell[j].style.color='#d5d5d5';
			}
			dateRow[Math.floor(j/7)].appendChild(cell[j]);
		}	
	
	
		tbl.appendChild(tbdy);
		obj.appendChild(tbl);
		objShadow.style.height=parseInt(obj.offsetHeight)+'px';
		
	}

	var z=0, a, b, c;
	
	function makeDateFields(node){

		if (!window.opera){
				  
			var inputs=node.getElementsByTagName('input');
			
			for (i=0;i<inputs.length;i++){
			
				if (inputs[i].getAttribute('type')=='date'){
					z=z+1;
					var n=inputs[i];
					var n2=document.createElement('span');
					var calBox=document.createElement('div');
					var calActivate=document.createElement('div');
					var calShadow=document.createElement('div');
					
					n2.style.position='relative';
					n2.style.display='inline-block';
					n2.style.zIndex=500-z;
					n2.style.width=n.offsetWidth+'px';
					n2.style.styleFloat=n.style.styleFloat;
					n2.style.cssFloat=n.style.cssFloat;
					
					n.style.position='relative';
					n.style.margin='0px';
					n.style.cssFloat='right';
					n.style.styleFloat='right';
					n.style.width=(n.offsetWidth-25) + 'px';
					n.style.verticalAlign='top';
					n.onchange=function(){confDate(this,this.value);}
					
					calBox.style.position='absolute';
					calBox.style.right='0px';
					calBox.style.border='2px outset';
					calBox.style.backgroundColor=bodyColor;
					calBox.style.width=Math.max((parseInt(n.offsetWidth)+16),120)+'px';
					calBox.style.top=(n.offsetHeight+1)+'px';
					//calBox.style.left='0px';
					calBox.style.display='none';
					
					calShadow.style.width=Math.max((parseInt(n.offsetWidth)+18),122)+'px';
					calShadow.style.position='absolute';
					if (document.all){
						calShadow.style.top=parseInt(n.offsetHeight)+'px';
						//calShadow.style.left='0px';
						calShadow.style.right='-4px';
					} else {
						calShadow.style.top=(parseInt(n.offsetHeight)+4)+'px';
						//calShadow.style.left='5px';
						calShadow.style.right='-5px';
					}
					calShadow.style.backgroundColor='#000000';
					calShadow.style.filter='progid:DXImageTransform.Microsoft.Blur(PixelRadius="3", MakeShadow="true", ShadowOpacity="0.40")';
					calShadow.style.opacity='0.25';
					calShadow.style.display='none';
					
					calActivate.innerHTML='&#8230;';
					calActivate.style.border='1px solid #999999';
					calActivate.style.borderWidth='1px 1px 1px 0px';
					calActivate.style.width='18px';//(parseInt(n.offsetHeight))+'px';
					calActivate.style.padding='0px';
					calActivate.style.textAlign='center';
					calActivate.style.height=(parseInt(n.offsetHeight)-2)+'px';
					//calActivate.style.lineHeight=calActivate.style.fontSize;
					calActivate.style.lineHeight=calActivate.style.height;
					calActivate.style.overflow='hidden';
					calActivate.style.backgroundColor='#CCCCCC';
					//calActivate.style.position='absolute';
					//calActivate.style.top=document.all&&isLTIE8?'1px':'0px';
					calActivate.style.filter='progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr="#f3f3f3",endColorStr="#AAAAAA")';
					calActivate.style.fontFamily='arial';
					calActivate.style.fontSize='10pt';
					//calActivate.style.lineHeight='normal';
					//calActivate.style.left=parseInt(n.offsetWidth)-1+'px';
					calActivate.style.cssFloat='right';//
					calActivate.style.styleFloat='right';//
					calActivate.style.cursor='default';
					
					calActivate.onclick=function(ev){
						if (a) a.display='none';
						if (b) b.display='none';
						if (c) c.filter='progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr="#f3f3f3",endColorStr="#AAAAAA")';
						(a=this.parentNode.getElementsByTagName('div')[2].style).display='block';
						(b=this.parentNode.getElementsByTagName('div')[1].style).display='block';
						(c=this.parentNode.getElementsByTagName('div')[0].style).filter='progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr="#AAAAAA",endColorStr="#f3f3f3")';
						document.onclick=function(ev2){
							if (a) a.display='none';
							if (b) b.display='none';
							if (c) c.filter='progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr="#f3f3f3",endColorStr="#AAAAAA")';
						};
						if (document.all) {
							window.event.cancelBubble=true;
						} else {
							ev.stopPropagation();
						}
						//makeCalendar(calBox,0,calShadow,n);
						makeCalendar(
							this.parentNode.getElementsByTagName('div')[2],
							0,
							this.parentNode.getElementsByTagName('div')[1],
							this.parentNode.getElementsByTagName('input')[0]
						)
					}
					
					n.parentNode.replaceChild(n2,n)
					n2.appendChild(calActivate);
					n2.appendChild(n)
					n2.appendChild(calShadow);
					n2.appendChild(calBox)
				}
			}
	   }	
	}
	
//-----------------------------COMBO BOX SCRIPTS---------------------------------------//

var selectedItem, itemNum=0, itemCount;

function activateComboBox(){
	var inputs=document.getElementsByTagName('input');
	createComboStyle();
	for (i=0;i<inputs.length;i++){
		if (inputs[i].getAttribute('type')=='combo'){
		
			z=z+1;
			var n=inputs[i];
					
			var n2=document.createElement('span');
			n2.style.marginRight='20px';
			n2.style.position='relative';
			n2.style.verticalAlign='top';
			n2.style.lineHeight='normal';
			n2.style.zIndex=500-z;
			
			n.style.position='relative';
			n.style.verticalAlign='top';
			n.style.width=(n.offsetWidth-25)+'px';
			n.style.margin='0px';
			var nHt=parseInt(n.offsetHeight);
			n.parentNode.replaceChild(n2,n);
			
			n2.appendChild(n);

			n.onfocus=function(){initComboBox(this)};
			n.onclick=function(e){showItems(e,this); hilite(e,this)}
			n.onkeyup=function(e){hilite(e,this)}
			n.onkeydown=function(e){processKeystroke(e,this)}
			

			var comboActivate=document.createElement('span');
				comboActivate.innerHTML='&#8230;';
				comboActivate.style.border='1px solid #999999';
				comboActivate.style.lineHeight='normal';
				comboActivate.style.overflow='hidden';
				comboActivate.style.width='18px'//(parseInt(n.offsetHeight))+'px';
				comboActivate.style.textAlign='center';
				comboActivate.style.height=(nHt-2)+'px';
				comboActivate.style.backgroundColor='#CCCCCC';
				comboActivate.style.position='absolute';
				comboActivate.style.top=document.all&&isLTIE8?'0px':'0px';
				comboActivate.style.filter='progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr="#f3f3f3",endColorStr="#AAAAAA")';
				comboActivate.style.fontFamily='arial';
				comboActivate.style.fontSize='10pt';
				comboActivate.style.left=(parseInt(n2.offsetWidth)-1)+'px';
				comboActivate.style.cursor='default';
				comboActivate.onclick=function(ev){
					var event='';
					if (document.all) {
						window.event.cancelBubble=true;
					} else {
						ev.stopPropagation();
					}
					initComboBox(this.previousSibling);
					showItems(event, this.previousSibling); 
					hilite(event,this.previousSibling);
				}
			
			inputs[i].parentNode.insertBefore(comboActivate,inputs[i].nextSibling);
			
			var dropWindow=document.createElement('div');
				dropWindow.className='drop';
				dropWindow.style.height='90px';
				dropWindow.style.width=(n2.offsetWidth+17)+'px';//'100%';
				dropWindow.style.marginLeft='1px';
				dropWindow.style.position='absolute'; 
				dropWindow.style.top=(parseInt(n2.offsetHeight)+1)+'px'; 
				dropWindow.style.left='-1px'; 
				dropWindow.style.overflow='auto'; 
				dropWindow.style.border='1px solid #AAAAAA'; 
				dropWindow.style.display='none';
				dropWindow.style.fontSize='10pt';
				dropWindow.style.backgroundColor='#EEEEEE';
				dropWindow.style.color='#000000';
				dropWindow.style.zIndex='10';
			
			inputs[i].parentNode.insertBefore(dropWindow,comboActivate.nextSibling); 

			
			var comboOptions=inputs[i].getAttribute('options').split(',');
				dropWindow.style.height=Math.min(90,comboOptions.length*18)+'px';
			for (j=0;j<comboOptions.length;j++){
				var newOption=document.createElement('div');
				newOption.style.padding='0px 4px';
				newOption.style.height='18px';
				newOption.style.textTransform='capitalize';
				eval('newOption.onclick=function(){selItem(this,'+(j+1)+')}');
				//var optionText=document.createTextNode(comboOptions[j]);
				//newOption.appendChild(optionText);
				newOption.innerHTML=comboOptions[j];
				dropWindow.appendChild(newOption);
			}
		}
	}
				
	arr=document.getElementsByTagName('div');
	for (i=0;i<arr.length;i++){
		if (arr[i].parentNode.className=='drop'){
			arr[i].onmouseover=function(){this.className='over'; selectedItem=this.innerHTML};
			arr[i].onmouseout=function(){this.className='off';};

		}
	}
}

function createComboStyle(){
	var pa= document.getElementsByTagName('head')[0] ;
	var el= document.createElement('style');
	var str='.drop .off{background-color: #EEEEEE;color: #000000;}.drop .over{	background-color: #000000;	color: #FFFFFF;}';

	el.type= 'text/css';
	el.media= 'screen';
	if(el.styleSheet) el.styleSheet.cssText= str;// IE method
	else el.appendChild(document.createTextNode(str));// others
	pa.appendChild(el);
	return el;
}

function initComboBox(obj){

	itemBox=obj.parentNode.getElementsByTagName('div')[0];
	items=itemBox.getElementsByTagName('div');
	itemCount=items.length;
	comboBox=obj;
	hilite(0,obj);
				
}

function showItems(e,obj){
		if (window.event){
			var e=window.event;
			var obj=e.srcElement;
		} else {
			obj=e.target;
		}
	if (e.keyCode!=13) {
		if (e.type=='click' && itemBox.style.display=='block') {
			itemBox.style.display='none';
		} else {
			itemBox.style.display='block';
		}
	}
	document.onclick=function(){itemBox.style.display='none';}
}

function scrollItems(x){
	y=itemBox.scrollTop;
	pos=-y+x*20;
	if (pos>80){
		itemBox.scrollTop=(x-4)*18;//itemBox.scrollTop+18;
	} else if (pos<0) {
		itemBox.scrollTop=(x)*18;//itemBox.scrollTop-18;
	}
}

function hilite(e,obj){
		if (window.event){
			var e=window.event;
		}
	if (e.keyCode!=38 && e.keyCode!=40){
	clearAllSelected(obj,itemCount);
		for (var j=0;j<=itemCount-1; j++){
			if (obj.value.length>0 && obj.value.toLowerCase()==items[j].innerHTML.substring(0,obj.value.length).toLowerCase()){
				items[j].className='over';
				scrollItems(j);
				selectedItem=items[j].innerHTML;
				itemNum=j;
				break;
			}
		}
	}
}

function clearAllSelected(obj, itemCount){
			for (var j=0;j<=itemCount-1; j++) items[j].className='off'
			selectedItem='';
}

function processKeystroke(e, obj){
		if (window.event){
			var e=window.event;
			var obj=e.srcElement;
		} else {
			obj=e.target;
		}
	if (e.keyCode==38 && itemNum>0){
			if (itemBox.style.display=='block') itemNum-=1;
			showItems(e, obj);
			clearAllSelected(obj,itemCount);
			items[itemNum].className='over';
			scrollItems(itemNum);
			selectedItem=items[itemNum].innerHTML;
	}
	if (e.keyCode==40 && itemNum<itemCount-1){
			if (itemBox.style.display=='block') itemNum+=1;
			showItems(e, obj);
			clearAllSelected(obj,itemCount);
			items[itemNum].className='over';
			scrollItems(itemNum);
			selectedItem=items[itemNum].innerHTML;
	}
	showItems(e, obj);
	if (e.keyCode==13 && itemBox.style.display=='block'){
		e.returnValue=false;
		obj.value=selectedItem!=''?selectedItem:obj.value;
		clearAllSelected(obj,itemCount);
		itemBox.style.display='none';
	}
	if (e.keyCode==9 || e.keyCode==27){
		obj.value=selectedItem!=''?selectedItem:obj.value;
		clearAllSelected(obj,itemCount);
		itemBox.style.display='none';
		itemNum=0;
	}
}
function selItem(obj,num){
		comboBox.value=selectedItem;
		itemNum=num;
		comboBox.focus();
		itemBox.style.display='none';
		if (document.all) EOT(comboBox);
}

function EOT(txt) {
  var range = txt.createTextRange();
  range.move("textedit");
  range.select();
}

//----------------------------- ADMIN - VALIDATION SCRIPTS ----------------------//

function delAction(){
  if (document.recSubmit.fID.value!=0){
	if (confirm('Are you sure you want to delete this record?')){
		document.recSubmit.pass.value=3;
		document.recSubmit.submit();
	}
  }
}

function confLink(obj,str){
	if (str=='') return;
	str=str.replace(/http:\/\//g,'')
	obj.value=str;
}

function confPhone(obj,str) {
	if (str=='') return;
  	if ((str.search(/[^\d\(\)-\.\x\x20]/)!=-1||str.length<9)){
		alert('The phone number is invalid.');
		obj.focus();
		return false; ;
	}
}

function confEmail(obj,str){
	if (str=='') return;
	if (str.indexOf('@')==-1||str.indexOf('.',str.indexOf('@'))==-1){
		alert('The email address appears to be inavalid.');
		obj.focus();
		return false; ;
	}
}

function confMoney(obj,str){
	if (str=='') return;
	if (str.search(/[^\d.,$]/)!=-1){
		alert('You have not entered a valid amount.');
		obj.focus();
		return false; ;
	}
}
function confNumber(obj,num){
	if (num=='') return;
	if (isNaN(num)){
		alert('Invalid Number');
		obj.focus();
		return;
	}
}
//-------------------------------------ADMIN - GALLERY EDITOR SCRIPT@-------------------
var imgID;
function selImg(e){
	obj=window.event?event.srcElement:e.target;
	if (window.event) {
		window.event.cancelBubble=true;
	} else {
		e.stopPropagation();
	}
	
	var thmbs=document.getElementById('imgHolder').getElementsByTagName('IMG');
	for (i=0;i<thmbs.length;i++) thmbs[i].style.borderColor='black';
	obj.style.borderColor='yellow';
	document.getElementById('trash').style.left=(obj.offsetLeft+obj.offsetWidth-25)+'px';
	document.getElementById('trash').style.top=(obj.offsetTop+obj.offsetHeight-25)+'px';
	document.getElementById('trash').style.display='block';
	imgID=obj.id;
	showCap(imgID);

	document.body.onclick=function(ev){
		document.getElementById('trash').style.display='none';
		var thmbs=document.getElementById('imgHolder').getElementsByTagName('IMG');
		for (i=0;i<thmbs.length;i++) thmbs[i].style.borderColor='black';
		imgID=null;
		document.body.onclick=null;
	}
}
function delImg(){
	if (confirm('You are about to delete the highlighted image. Are you sure you want to continue?')){
		var objID=imgID;
		var sendStr='act=2&id=' + objID;
		var resp=getXML(sendStr,'_processAjax.cfm');
		var chk=resp.getElementsByTagName('success')[0].firstChild.data;
		if (chk!='true'){
		document.getElementById('response').innerHTML=resp.getElementsByTagName('message')[0].firstChild.data;
			alert("An error occurred while attempting to delete your image. Click 'OK' and try again. If this problem persists, please click 'Cancel' and contact Big Giant Media for assistance.");
		} else {
			document.getElementById(objID).parentNode.removeChild(document.getElementById(objID));
			document.getElementById('trash').style.display='none';
		}
	}
}
function showCap(id){
	var sendStr='act=3&id='+id;
	var resp=getXML(sendStr,'_processAjax.cfm');
	var chk=resp.getElementsByTagName('success')[0].firstChild.data;
	if (chk!='true'){
		document.getElementById('response').innerHTML=resp.getElementsByTagName('message')[0].firstChild.data;
		if (confirm("An error occurred while attempting to get the sort position. Click 'OK' and try again. If this problem persists, please click 'Cancel' and  contact Big Giant Media for assistance.")) obj.focus();
	} else {
		document.getElementById('caption').value=resp.getElementsByTagName('cap')[0].firstChild.data;
		document.getElementById('capID').value=id;
		document.getElementById('lrgCaption').value=resp.getElementsByTagName('lcap')[0].firstChild.data;
	}
}


//------------------------------ADMIN - CONTENT EDITOR SCRIPTS ------------------//

var viewMode=1;  // View mode default setting--------------------------------//

function setMode(viewNewMode) {
 if (viewNewMode!=viewMode) {
  if (viewNewMode) {
  	if (document.all&&!window.opera){
		 var sContents=document.getElementById('content'+activeBox).innerText
		 document.getElementById('content'+activeBox).innerHTML=sContents;
	 } else {
		 var html=document.createRange();
		 html.selectNodeContents(document.getElementById('content' + activeBox));
		 document.getElementById('content' + activeBox).innerHTML=html;
	 }
  }
  else {
	 var html=document.createTextNode(document.getElementById('content'+activeBox).innerHTML);
	 document.getElementById('content'+activeBox).innerHTML='';
	 document.getElementById('content'+activeBox).appendChild(html);
  }
  viewMode=viewNewMode
 }
}

var viewMode=true,strErr="Formatting toolbar is not accessible in Edit Source mode"

function format(what,opt,ui) {
	if (!viewMode) {
		alert(strErr);
		document.getElementById('content'+activeBox).focus();
		return;
	} 
   if (ieVer>=5) document.getElementById('content'+activeBox).focus();
   if (what=='backcolor' && isNaN(ieVer)) what='hilitecolor';
 	ui = (ui==true)
	if (what=='createlink') opt=prompt('Enter URL');
	if ((what=='createlink' && opt!='') || what!='createlink') document.execCommand(what,ui,opt)
}

function getToolbar() {

	var buttons=new Array(24,23,23,4,23,23,23,23,4,23,23,23,23,4,230,23,40,(23*imgSupport),230,4,23); //Values greater than 25 are ignored (MUST APPEND ZERO to delete and maintain proper button placement)
	
	var action=new Array("bold","italic","underline","","justifyleft","justifycenter","justifyright","justifyfull","","insertorderedlist","insertunorderedlist","outdent","indent","","createlink","createlink","","insertImage","addButton","","setMode");
	
	var tooltip=new Array("Bold Text","Italic Text","Underline Text","","Left Justify","Center Justify","Right Justify","Full Justify","","Ordered List","Unordered List","Remove Indent","Indent","","Link to Document","Link to Website","","Insert Image","Add Button Link to Other Pages","","Edit Source")
	
	var left=0,width=0, inc=0
	
	var s=""
	for (var i=0;i<buttons.length;i++) {
	 if (buttons[i]<25) {
		 s+="<DIV STYLE='position:relative;float:left;height:26px;overflow:hidden;width: " + buttons[i] + "px'>";
		 s+="<IMG BORDER=0 SRC='admin/images/htmleditortoolbar.gif' STYLE='position:absolute;top:0px;left:-" + (left) + "px'"
		 if (buttons[i]!=4) {
		   switch (action[i]) {
			 case "insertImage":
			   s+=" onmouseover='this.style.top=\"-25px\"' onmouseout='this.style.top=\"0px\"' ONCLICK=\""
			   s+="initImageEdit('insert');this.style.top=\'0px\'\" "
			   s+="TITLE=\"" + tooltip[i] + "\""
			   break;
			 case "setMode":
			   s+=" id='modeSwitch' onmouseover='if (viewMode) this.style.top=\"-25px\"; else this.style.top=\"-49px\";' onmouseout='if (viewMode) this.style.top=\"0px\"; else this.style.top=\"-73px\";' ONCLICK=\""
			   s+="if (viewMode) this.style.top=\'-49px\'; else this.style.top=\'0px\'; setMode(!viewMode)\" "
			   s+="TITLE=\"" + tooltip[i] + "\""
			   break;
			default:
			  s+=" onmouseover='this.style.top=\"-25px\"' onmouseout='this.style.top=\"0px\"' ONCLICK=\""
			  s+="format('" + action[i] + "');this.style.top=\'0px\'\" "
			  s+="TITLE=\"" + tooltip[i] + "\""
		   }
		   
		 }
		 s+="></DIV>"
	 }
	 inc=buttons[i]<25?buttons[i]:buttons[i]/10;
	 left+=inc
	}
//	return "<span ID=tb2 class=htmlEditToolbar STYLE=\"height:27px; width: " + (width+3) + "\" ONSELECTSTART=\"return false\" ONDRAGSTART=\"return false\">" + s + "</span>"
	return s;
}

function stripHTML(){
	if (confirm('Continuing will remove all HTML tags from the selected\ncontent box, including images. Paragraph structure will\nremain unchanged.\n\nAre you sure you want to continue?')){
		var html=eval('document.all.content'+activeBox).innerHTML
		html=html.replace(/<P[^>]+>/g,'{prg}');
		html=html.replace(/<BR>/g,'{brk}');
		eval('document.all.content'+activeBox).innerHTML=html;
		var html=eval('document.all.content'+activeBox).innerText;
		html=html.replace(/{prg}/g,'<P>');
		html=html.replace(/{brk}/g,'<BR>');
		eval('document.all.content'+activeBox).innerHTML=html;
	}	
}

// ------------------------- Functions for custom image insert/editing panel ----------------------------------

var imgRange;

function initImageEdit(action){
	if (!viewMode) {
	  alert(strErr);
	  document.getElementById('content'+activeBox).focus();
	  return
	}

	if (ieVer>=5) document.getElementById('content'+activeBox).focus();
	var selObj = document.selection&&!window.opera?document.selection:window.getSelection(); 
	imgRange = selObj.createRange?selObj.createRange():selObj.getRangeAt(0);

	if (typeof(imgRange.cloneContents)!='undefined' 
		 && imgRange.cloneContents().childNodes.length==1 
		 && imgRange.cloneContents().childNodes[0].tagName=='IMG'){
		
		var imgToEdit=imgRange.cloneContents().childNodes[0];
		switch (imgToEdit.style.cssFloat){
			case 'left':
				document.recSubmit.imgEditAlign[0].checked=true;
				break;
			case 'right':
				document.recSubmit.imgEditAlign[2].checked=true;
				break;
			default:
				document.recSubmit.imgEditAlign[1].checked=true;
				break;
		}
		document.getElementById('imageEditPanel').style.display='block';
		
	} else if (action=='insert' && selObj.type=='Control' && imgRange(0).tagName=='IMG') {
 
		switch (imgRange(0).style.styleFloat){
			case 'left':
				document.recSubmit.imgEditAlign[0].checked=true;
				break;
			case 'right':
				document.recSubmit.imgEditAlign[2].checked=true;
				break;
			default:
				document.recSubmit.imgEditAlign[1].checked=true;
				break;
		}
		document.getElementById('imageEditPanel').style.display='block';
	
	} else {
 
		document.getElementById('imagePanel').style.display='block';
	 
	}
}

function insertImage(doc){

	if (typeof(doc.fileName)=='undefined') return;
	
	if (ajaxRenameFile(doc.filePath)){
	
		var newImg=document.createElement('img');
		newImg.src=doc.fileName;
		if (document.recSubmit.imgAlign[0].checked){
			newImg.style.cssFloat='left';
			newImg.style.styleFloat='left';
			newImg.style.margin='10px 10px 10px 0px';
		} else if (document.recSubmit.imgAlign[1].checked) {
			newImg.style.margin='10px';
		} else if (document.recSubmit.imgAlign[2].checked) {
			newImg.style.cssFloat='right';
			newImg.style.styleFloat='right';
			newImg.style.margin='10px 0px 10px 10px';
		}

		if (typeof(imgRange.insertNode)=='function'){
			imgRange.deleteContents();
			imgRange.insertNode(newImg);
		} else {
			imgRange.pasteHTML(newImg.outerHTML);
		}
		
		//if (imgRange.select) imgRange.select();     ----moved to _inc_photoInput.cfm-----
		document.getElementById('imagePanel').style.display='none';
	
	} 
	
}

function imageEdit(){
		try {
			var imgToEdit=imgRange(0);
		} catch(err) {
			var imgSelect=imgRange.cloneContents()
			var imgToEdit=imgSelect.childNodes[0];
		}
		if (document.recSubmit.imgEditAlign[0].checked){
			imgToEdit.style.styleFloat='left';
			imgToEdit.style.cssFloat='left';
			imgToEdit.style.margin='10px 10px 10px 0px';
		} else if (document.recSubmit.imgEditAlign[1].checked) {
			imgToEdit.style.margin='10px';
			imgToEdit.style.styleFloat='none';
			imgToEdit.style.cssFloat='none';
		} else if (document.recSubmit.imgEditAlign[2].checked) {
			imgToEdit.style.cssFloat='right';
			imgToEdit.style.styleFloat='right';
			imgToEdit.style.margin='10px 0px 10px 10px';
		}
		if (typeof(imgRange.deleteContents)=='function'){
			imgRange.deleteContents();
			imgRange.insertNode(imgSelect);
		}
		document.getElementById('imageEditPanel').style.display='none';
}

function ajaxRenameFile(filePath){
	var sendStr='act=1&filePath='+filePath;
	var resp=getXML(sendStr,'_processAjax.cfm');
	//crawlXML(resp);
	var chk=resp.getElementsByTagName('success')[0].firstChild.data;
	if (chk!='true'){
		document.getElementById('response').innerHTML=resp.getElementsByTagName('message')[0].firstChild.data;
		if (confirm("An error occurred while attempting to save your data. To try again, click 'OK'. If this problem persists, please click 'Cancel' and  contact Big Giant Media for assistance."));
		return false;
	} else {
		return true;
	}
}

//---------------------------- ADMIN - CONTACT MANAGER SCRIPTS-----------------------//

	if (window.ActiveXObject) {
		var srvrConnect=new ActiveXObject('Microsoft.XMLHTTP');
	} else if (window.XMLHttpRequest) {
		var srvrConnect=new XMLHttpRequest();
	}

function indicate(obj){
	var indicators=obj.parentNode.parentNode.getElementsByTagName('span');
	var thisInd=obj.parentNode.getElementsByTagName('span')[0];
	for (x in indicators){
		if (indicators[x]!=thisInd) indicators[x].innerHTML='';
	}
	if (thisInd.innerHTML=='') thisInd.innerHTML='&darr;';
	else if (thisInd.innerHTML.charCodeAt(0)=='8595') thisInd.innerHTML='&uarr;';
	else if (thisInd.innerHTML.charCodeAt(0)=='8593') thisInd.innerHTML='&darr;';
}

function selContact(id){
		srvrConnect.open('post','admin/_processAdminAjax.cfm',0);
		srvrConnect.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		srvrConnect.send('act=1&id='+id);
		//window.top.document.getElementById('response').innerHTML=srvrConnect.responseText;
}

function selAll(){
		srvrConnect.open('post','admin/_processAdminAjax.cfm',0);
		srvrConnect.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		srvrConnect.send('act=2');
		if (isNaN(ieVer)){
			window.frames[0].location='admin/_contactList.cfm';
		}else{
			window.frames[0].location='_contactList.cfm';
		}
}
function deselAll(){
		srvrConnect.open('post','admin/_processAdminAjax.cfm',0);
		srvrConnect.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		srvrConnect.send('act=3');
		if (isNaN(ieVer)){
			window.frames[0].location='admin/_contactList.cfm';
		}else{
			window.frames[0].location='_contactList.cfm';
		}
}

function sendEmail(){
		msg=document.getElementById('content1').value;
		srvrConnect.open('post','admin/_processAdminAjax.cfm',0);
		srvrConnect.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		msg=msg.replace(/&nbsp;/g,' ');
		srvrConnect.send('act=5&msg='+msg);
		document.getElementById('response').innerHTML=srvrConnect.responseText;
		if (srvrConnect.responseText.indexOf('Send OK') != -1){
			alert('Your email was sent successfully!');
			document.getElementById('content1').innerHTML='';
		} else {
			alert('There was a problem and your email was not sent.')
		}
		
}

/* ----------------- EMAIL Obfuscator -----------------------------------*/

function stumpIt(theName,theExtras,theLink,theDomain) {
	if (theDomain==''){
		var theDomain ="michellebrogan.com";
	}
	var theEmail = theName+"@"+theDomain;
	if (theName == ""){
		theName = "ERROR";
		theLink = "ERROR";
		myEmail = theName;
		myLink = theLink;
	}else{
		if ((theExtras == "") && (theLink =="")){
			myEmail = theEmail;
			myLink = theEmail;
		}
		if ((theLink == "") && (theExtras != "")){
			myLink = theEmail;
			myEmail = theEmail+theExtras;
		}
		if 	((theLink != "") && (theExtras != "")){
			myLink = theLink;
			myEmail = theEmail+theExtras;
		}
		if 	((theLink != "") && (theExtras == "")){
			myLink = theLink;
			myEmail = theEmail;
		}
	}
	document.write('<a href=mailto:' + myEmail + '>' + myLink + '</a>');
}
