// JavaScript Document

/*------------------------------ GENERAL SCRIPTS -----------------------------------------*/

function show(obj){
	var divs=obj.parentNode.getElementsByTagName('div');
	for (i=0;i<divs.length;i++){
		if (divs[i].className=='rollOver') divs[i].style.display='block';
	}
}

function hide(obj){
	var divs=obj.parentNode.getElementsByTagName('div');
	for (i=0;i<divs.length;i++){
		if (divs[i].className=='rollOver') divs[i].style.display='none';
	}
}

/*-------------------------------START IT ALL SCRIPT --------------------------------*/

var isLTIE7=false;

function setup(){
	ieVer=parseInt(navigator.appVersion.split("MSIE")[1]);
	isLTIE7=(ieVer<7);
	if (ieVer<7) replacePNG();
	//timer();
	//if (document.getElementById('content').offsetHeight<(document.body.clientHeight-280)){
	//	document.getElementById('content').style.height=(document.body.clientHeight-280)+'px';
	//}
	//setupNav(document.getElementById('nav')); 
	//setInterval('animate()',20);
	//setInterval('timer()',992);
	initAjax();
	makeCorners(document);
	makeDateFields(document);
	activateComboBox();
}

window.onload=setup;

/*------------------------------------AJAX FUNCTIONS---------------------------------------*/

if (window.ActiveXObject) {
	var dbConnect=new ActiveXObject('Microsoft.XMLHTTP');
} else if (window.XMLHttpRequest) {
	var dbConnect=new XMLHttpRequest();
}

function initAjax(){
	var inputs=document.getElementsByTagName('input');
	for (i=0;i<inputs.length;i++){
		if (inputs[i].getAttribute&&inputs[i].getAttribute('ajaxEnable')){
			inputs[i].onblur=function(){ajaxSave(this)};
		}
	}
}

function ajaxSave(obj){
		str='act=1&field=' + obj.name + '&value=' + obj.value;
		srvrConnect.open('post','_manageTempEntry.cfm',0);
		srvrConnect.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		srvrConnect.send(str);
		document.getElementById('catcher').innerHTML=srvrConnect.responseText;
}

function getXML(sendStr,template){
	srvrConnect.open('post',template,0);
	srvrConnect.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	srvrConnect.send(sendStr);
	//alert(srvrConnect.responseText);
	//document.getElementById('response').innerHTML=srvrConnect.responseText;
	var resp=srvrConnect.responseXML;
	var notWhitespace = /\S/
	var xmlData=resp.getElementsByTagName('data')[0];
	//REMOVE white spaces in XML file. Intended mainly for NS6/Mozilla
	for (i=0;i<xmlData.childNodes.length;i++){
		if ((xmlData.childNodes[i].nodeType == 3)&&(!notWhitespace.test(xmlData.childNodes[i].nodeValue))) {
			// that is, if it's a whitespace text node
			xmlData.removeChild(xmlData.childNodes[i])
			i--
		}
	}
	return xmlData;

}

			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){
	var inputs=obj.getElementsByTagName('input');
	for (i=0;i<inputs.length;i++){
	  if (inputs[i].getAttribute&&inputs[i].getAttribute('required')!=null&&(inputs[i].value==''||inputs[i].value=='Value Needed')){
		alert(inputs[i].id.replace(/_/g,' ')+': You omitted a required value. We will take you to the empty field. Please supply a response and submit again');
		inputs[i].value='Value Needed';
		inputs[i].select();
		inputs[i].focus();
		return false;
	  }
	  
	  // ------------ REQUIRES INPUT FIELD TYPE OF "EMAIL" ------------------//
	  
	  if (inputs[i].getAttribute&&inputs[i].getAttribute('type')=='email'&&inputs[i].value!=''){
	  	if (inputs[i].value.substr(0,1)=='@' || inputs[i].value.indexOf('@.')!=-1 || inputs[i].value.replace(/[^@]/g,'')!='@'){
			alert('Email address is incorrectly formatted.');
			inputs[i].select();
			inputs[i].focus();
			return false;
		} else {
			var emailStrip=inputs[i].value.replace(/\w/g,'').split('@');
			if (emailStrip[0].replace(/\./g,'').length>0 || emailStrip[1]!='.'){
				alert('Email address is incorrectly formatted.');
				inputs[i].select();
				inputs[i].focus();
				return false;
			}
		}
	  }

	  // ------------ REQUIRES INPUT FIELD NAMES OF USER_PASSWORD AND CONFIRM_PASSWORD ------------------//
	  
	  if (inputs[i].id=='User_Password' && inputs[i].value!=document.getElementById('confirm_Password').value){
	  	alert('Password entries do not match');
		inputs[i].select();
		inputs[i].focus();
		return false;
	  }
	  
	  // ------------------------END SPECIAL MOD--------------------//
	  
	}
}

/*------------------------------TRANSPARENT PNG REPLACEMENT FOR <IE7 ----------*/

function replacePNG(){
	var xPNG=document.images;
	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="image")';
		}
	}
}

/*------------------------------ZOOM OVERLAY SCRIPT -------------------------*/

var pdfAdder=0; 

function getZoom(url,action){
	pdfAdder=url.indexOf('.pdf')==-1?0:30;
	var size=openOverlay();
	var ifr=document.createElement('iframe');
	ifr.frameBorder='0';
	ifr.style.width=size[0]+'px';
	ifr.style.height=size[1]+'px';
	//if (url.indexOf('http://')==-1&&url.indexOf('_returnDetails.cfm?id=')==-1) url='http://'+url;
	ifr.src=url;
	ifr.id='newFrame';
	ifr.name='newFrame';
	document.getElementById('rolodex').insertBefore(ifr,document.getElementById('rolodex').firstChild);
	var closer=document.createElement('div');
	
	var button=document.createElement('input');
	button.type='button';
	button.value='Close';
	button.id='histCloser';
	button.onclick=function(){showLess()};

	var button2=document.createElement('input');
	button2.type='button';
	button2.value='Print';
	button2.id='histPrinter';
	button2.style.styleFloat='left';
	button2.style.cssFloat='left';
	button2.style.display='none';
	button2.onclick=function(){printHist()};

	var button3=document.createElement('input');
	button3.type='button';
	button3.value='Create PDF';
	button3.id='makePDF';
	button3.style.styleFloat='left';
	button3.style.cssFloat='left';
	button3.style.display='none';
	button3.onclick=function(){createPDF()};

	var button4=document.createElement('input');
	button4.type='button';
	button4.value='Calendar';
	button4.id='showCalendar';
	button4.style.styleFloat='left';
	button4.style.cssFloat='left';
	button4.style.display='none';
	button4.onclick=function(){
		window.top.frames[0].location.href='calendar.cfm';
		//window.top.document.getElementById('showCalendar').style.display='none';
	};

	if (url.indexOf('.pdf')==-1){
		closer.style.position='relative';
	} else {
		closer.style.position='relative';
	}
	
	closer.style.top='0px';
	closer.id='closerHolder';
	//closer.style.width='100%';
	closer.style.left='0px';
	closer.style.backgroundColor='#CCCCCC';
	closer.style.border='1px solid #000000';
	closer.style.padding='2px';
	closer.style.textAlign='right';
	
	closer.appendChild(button4);
	closer.appendChild(button3);
	closer.appendChild(button2);
	closer.appendChild(button);
	
	if (action=='makePDF'||action=='makeCalendar') button3.style.display='inline';
	if (action=='makeCalendar') button4.style.display='inline';

	document.getElementById('rolodex').insertBefore(closer,document.getElementById('rolodex').firstChild);
}

			function openOverlay(){
					if (window.pageYOffset) prevScroll=window.pageYOffset;
			
					document.documentElement.style.overflow='hidden';
					window.scrollBy(0,1);
					if (document.documentElement.scrollTop==0){
						document.body.style.overflow='hidden';
					}
			
					var w=document.documentElement.clientWidth; // MAY NEED TO BE CHANGED TO 'body" IN XML DOC FOR IE6???
					var h=document.documentElement.clientHeight;
			
					var card=document.createElement('div');
					card.id='rolodex';
					with (card.style){
						overflow='auto';
						backgroundColor='white';
						border='8px #CCCCCC solid';
						position= 'absolute';
						zIndex=1001;
						top=(window.pageYOffset ? (window.pageYOffset) : (document.documentElement.scrollTop!=0?document.documentElement.scrollTop:document.body.scrollTop))+70+'px';
						left=(w/2-(w-260)/2)+'px';
						width = (w-300) + (isLTIE7*16) + 'px';
						height=(h-200) + pdfAdder + (isLTIE7*16) + 'px';
					}
					var size=new Array()
					size[0]=w-300;
					size[1]=h-230;
					
					var screener=document.createElement('div');
					screener.id='screen2';
					with (screener.style){
						position='absolute';
						top=(window.pageYOffset ? (window.pageYOffset) : (document.documentElement.scrollTop!=0?document.documentElement.scrollTop:document.body.scrollTop))+'px'
						left='0px';
						width=w+30+'px';
						height=h+10+'px';;
						filter='alpha(opacity=60)';
						opacity='0.60';
						backgroundColor='black';
						display='block';
						zIndex=1000;
					}
					
					document.body.insertBefore(card,document.body.firstChild);
			
					document.body.insertBefore(screener,document.getElementById('rolodex'));
					document.getElementById('rolodex').style.overflow='hidden';
					setTimeout('setResize()',1000);
					return size;
			}
			
			function setResize(){
					window.onresize=function(){showLess()};	
			}
			
			function showLess(action){
					window.onresize=null;
					//document.getElementById('screen2').style.display='none';
					document.body.removeChild(document.getElementById('rolodex'));
					if (document.getElementById('screen2')) document.body.removeChild(document.getElementById('screen2'))
					
					document.documentElement.style.overflow='auto';
					window.scrollBy(0,1);
					if (document.documentElement.scrollTop==0){
						document.body.style.overflow='auto';
					}
					
					if (typeof prevScroll!='undefined' && prevScroll!=0) window.scrollTo(0,prevScroll);
					if (action=='reloadHist'){
							srvrConnect.open('post','_returnHistory.cfm',0);
							srvrConnect.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
							srvrConnect.send();
							document.getElementById('historyHolder').innerHTML=srvrConnect.responseText;
					}
			}

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=true;
var primaryVertOffset=0;
var secondaryVertOffset=0;
var horizontalOffset=1;      /* MUST BE GREATER THAN -(WIDTH OF BUTtON) FOR FIREFOX/OPERA*/
var secondaryHorizontalOffset=0;
var alpha=90;

var colors=new Array('#e1e1e1','#c2c2c2','#999999','#666666','#3e3e3e','#1f1f1f','#0b0b0b')

function setupNav(nav){
	var links=nav.getElementsByTagName('a');
	var lis=nav.getElementsByTagName('li');
	var uls=nav.getElementsByTagName('ul');
	navWidth=links[0].offsetWidth;
	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';
			uls[m].style.marginLeft=horizontalOffset+'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=(navWidth-3)+'px'
							a.style.height=(uls[m].offsetHeight-3)+'px'
							a.className='shadow';
							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=navWidth+'px';
				a.style.top=n+'px';
				a.style.left=n+'px';
				a.style.height=uls[m].offsetHeight+'px';
				a.style.position='absolute';
				a.className='navShadow';
				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};
			}	
	}
}

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]);
		flyouts[sub[0].id]=sub[0];
	}
}

function hideSub(prime){
	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){
		delete closers[j];
		var curValue=(isNaN(curValue=parseInt(flyouts[j].style.left))?0:curValue);
		if(curValue<navWidth) {
				flyouts[j].style.left=(curValue+Math.ceil((navWidth-curValue)/2))+'px';
				flyouts[j].style.clip='rect(0px 2500px 2500px ' + (navWidth-curValue-2)+ 'px)';
		} else {
				delete flyouts[j];
		}
	}
	for (k in closers){
		var curUL=document.getElementById(closers[k]);
		var curValue2=parseInt(curUL.style.left);
		if(curValue2>0) {
				curUL.style.left=(curValue2=curValue2-Math.ceil(curValue2/2))+'px';
				curUL.style.clip='rect(0px 2500px 2500px ' + (navWidth-curValue2)+ 'px)';
		} else {
			if (shadows) curUL.style.clip='rect(0px 2500px 2500px ' + (navWidth-curValue2+8)+ 'px)';
			delete closers[k];
		}
	}
}

/*-------------------------------CLOCK SCRIPT --------------------------------*/

var month=new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
var timeFlag=false;
	
function timer(){
	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 dayStr=month[now.getMonth()]+' '+now.getDate()+', '+now.getFullYear();
	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 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);
				//-------------SPECIAL MOD FOR INKSTAR-----------
				nodeTemp.style.fontFamily='arial narrow';
				nodeTemp.style.fontSize='11pt';
				//---------------END SPECIAL MOD-----------------
				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.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;

			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.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);
				
			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')
					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';
						}
					}
					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;
	}

/*--------------------------CALENDAR SCRIPT FOR DATE FIELD ---------------------------------*/

	var headerColor='#aaaaff';
	var daysColor='#aaaaaa';
	var bodyColor='#ffffdd';
	var todayColor='#000077';
	var hiliteColor='#ddddff';
	

	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(); //----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.position='relative';
			
		var tbdy=document.createElement('tbody');
		
		var row1=document.createElement('tr');
		var c11=document.createElement('td');
			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(){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='default';
			c13.style.backgroundColor=headerColor;
			c13.style.filter='progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr="#f3f3f3",endColorStr="'+headerColor+'")';
			c13.onclick=function(){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);
			
	
		tbl.appendChild(tbdy);
		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]);
		}	
	
	
		obj.appendChild(tbl);
		objShadow.style.height=parseInt(obj.offsetHeight)+'px';
		
	}

	var z=0, a, b, c;
	
	function makeDateFields(node){

		if (!window.opera){
		
		  if (node.hasChildNodes) {
				var iteration;
				for (iteration=0;iteration<node.childNodes.length;iteration++) {
					makeDateFields(node.childNodes[iteration]);
				}
		  }

		if (node.tagName=='INPUT'&&node.getAttribute&&(node.getAttribute('type')=='date')){
			z=z+1;
			var n=node;
			var n2=document.createElement('span');
			var newInput=n.cloneNode(true);
			var calBox=document.createElement('div');
			var calActivate=document.createElement('div');
			var calShadow=document.createElement('div');
			
			n2.style.marginRight='25px';
			n2.style.position='relative';
			n2.style.lineHeight='normal';
			n2.style.zIndex=500-z;
			
			newInput.style.position='relative';
			newInput.style.verticalAlign='top';
			newInput.style.width=(n.offsetWidth-20) + 'px';
			newInput.onchange=function(){confDate(this,this.value);}
			
			calBox.style.position='absolute';
			calBox.style.border='2px outset';
			calBox.style.backgroundColor=bodyColor;
			calBox.style.width=Math.max((parseInt(n.offsetWidth)),120)+'px';
			calBox.style.top=n.offsetHeight+'px';
			calBox.style.left='0px';
			calBox.style.display='none';
			
			calShadow.style.width=Math.max((parseInt(n.offsetWidth)+2),122)+'px';
			calShadow.style.position='absolute';
			if (document.all){
				calShadow.style.top=parseInt(n.offsetHeight)+'px';
				calShadow.style.left='0px';
			} else {
				calShadow.style.top=(parseInt(n.offsetHeight)+3)+'px';
				calShadow.style.left='5px';
			}
			calShadow.style.backgroundColor='#000000';
			calShadow.style.filter='progid:DXImageTransform.Microsoft.Blur(PixelRadius="3", MakeShadow="true", ShadowOpacity="0.50")';
			calShadow.style.opacity='0.25';
			calShadow.style.kthlOpacity='0.25';
			calShadow.style.display='none';
			
			calActivate.innerHTML='&#8230;';
			calActivate.style.border='1px solid #999999';
			calActivate.style.width=(parseInt(n.offsetHeight))+'px';
			calActivate.style.textAlign='center';
			calActivate.style.height=(parseInt(n.offsetHeight)-(2))+'px';
			calActivate.style.overflow='hidden';
			calActivate.style.backgroundColor='#CCCCCC';
			calActivate.style.position='absolute';
			calActivate.style.top=document.all?'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-20)+'px';
			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=calBox.style).display='block';
				(b=calShadow.style).display='block';
				(c=calActivate.style).filter='progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr="#AAAAAA",endColorStr="#f3f3f3")';
				document.onclick=function(){
					calBox.style.display='none';
					calShadow.style.display='none';
					calActivate.style.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,newInput);
			}
			
			n.parentNode.replaceChild(n2,n)
			n2.appendChild(newInput)
			n2.appendChild(calActivate);
			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.position='relative';
			n2.style.lineHeight='normal';
			n2.style.zIndex=500-z;
			n.parentNode.replaceChild(n2,n)
			n2.appendChild(n);

			inputs[i].onfocus=function(){initComboBox(this)};
			inputs[i].onclick=function(e){showItems(e,this); hilite(e,this)}
			inputs[i].onkeyup=function(e){hilite(e,this)}
			inputs[i].onkeydown=function(e){processKeystroke(e,this)}
			
			inputs[i].style.width=(inputs[i].offsetWidth-22)+'px';

			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='20px';
					comboActivate.style.width=(n2.offsetHeight)+'px'
					comboActivate.style.textAlign='center';
					comboActivate.style.height=(parseInt(inputs[i].offsetHeight)-2)+'px';
					comboActivate.style.backgroundColor='#CCCCCC';
					comboActivate.style.position='absolute';
					comboActivate.style.top=document.all?'1px':'-1px';
					comboActivate.style.filter='progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr="#f3f3f3",endColorStr="#AAAAAA")';
					comboActivate.style.fontFamily='arial';
					comboActivate.style.left=parseInt(inputs[i].offsetWidth)+'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+20)+'px';//'100%';
					dropWindow.style.marginLeft='1px';
					dropWindow.style.position='absolute'; 
					//dropWindow.style.top='21px'; 
					dropWindow.style.top=(n2.offsetHeight)+'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();
}

//---------------------------- CONTACT MANAGER -----------------------//

	if (window.ActiveXObject) {
		var srvrConnect=new ActiveXObject('Microsoft.XMLHTTP');
	} else if (window.XMLHttpRequest) {
		var srvrConnect=new XMLHttpRequest();
	}

function delContact(id){
	if (confirm('You have chosen to delete this contact. Are you sure you wish to continue?')){
		srvrConnect.open('post','admin/_delContact.cfm',0);
		srvrConnect.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		srvrConnect.send('id='+id);
		document.getElementById('contList').innerHTML=srvrConnect.responseText;
	} else {
		return;
	}
}

function selContact(id){
		srvrConnect.open('post','admin/_selContact.cfm',0);
		srvrConnect.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		srvrConnect.send('id='+id);
}

function selAll(){
		srvrConnect.open('post','admin/_selAllContacts.cfm',0);
		srvrConnect.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		srvrConnect.send();
		document.getElementById('contList').innerHTML=srvrConnect.responseText;
}
function deselAll(){
		srvrConnect.open('post','admin/_deselAllContacts.cfm',0);
		srvrConnect.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		srvrConnect.send();
		document.getElementById('contList').innerHTML=srvrConnect.responseText;
}

function sendEmail(){
		msg=document.getElementById('content1').innerHTML;
		srvrConnect.open('post','admin/_sendEmail.cfm',0);
		srvrConnect.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		srvrConnect.send('msg='+msg);
		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>');
}