/* -----------------------------DROP SHADOW CODE -----------------------------*/

	var colors=new Array('#f5f5f5','#e1e1e1','#c2c2c2','#999999','#666666','#3e3e3e','#1f1f1f','#0b0b0b')
	
	function makeShadows(node){
	
		  if (node.hasChildNodes) {
				var iteration;
				for (iteration=0;iteration<node.childNodes.length;iteration++) {
					makeShadows(node.childNodes[iteration]);
				}
		  }
		  
		  if (node.getAttribute&&(sty=node.getAttribute('dropshadow'))){

				var n=node;
				n.style.position='relative';
				
				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);
				
				}
					
				if (sty=='text'){  // INDIVIDUAL DROP SHADOWS FOR TEXT 
				
					var b2=document.createElement('div');
						b2=n.cloneNode(true);
						b2.style.position='absolute';
						b2.className='shadow';
						b2.style.width=(elWidth+50) + 'px';
						
					if (!document.all || window.opera){
					
						b2.style.top='3px';
						b2.style.left='3px';
						
					} else {
					
						b2.style.top='-2px';
						b2.style.left='-2px';
						
					}
						
					n.insertBefore(b2,n.firstChild);
					
					if (window.opera){  // OPERA FIX
					
						if (parseInt(window.opera.version())>=9) b2.style.color='#000000';
						opFix=document.createElement('span');
						opFix.style.position='relative';
						opFix.appendChild(b2.nextSibling);
						opFix.style.zIndex='10';
						n.appendChild(opFix);
						
					}
				
				} else if (sty=='box') {   // DROP SHADOWS FOR BLOCK ELEMENTS
					
					var b=document.createElement('div');
						b.style.width=elWidth+'px';
						b.style.position='relative';
					var b1=document.createElement('div');
						b1.className='dropHolder';
						b1.style.width=(elWidth+6)+'px';
						b1.style.height=(elHeight+6)+'px';
						
					n.parentNode.replaceChild(b,n);
					b.appendChild(n);
					n.style.zIndex='20';
	
					if (document.all && !window.opera){
	
							a=document.createElement('div');
							a.style.width=(elWidth-5)+'px'
							a.style.height=(elHeight-5)+'px'
							b.appendChild(a);
							a.className='shadow';
							a.style.border='1px solid  black';
							a.style.backgroundColor='black';
						
					}else{
					
						for (j=0;j<8;j++){
							a=document.createElement('div');
							a.style.width=(elWidth-8+j*2)+'px'
							a.style.height=(elHeight-8+j*2)+'px'
							a.style.top=(7-j)+'px'
							a.style.left=(7-j)+'px'							
							a.className='shadow2';
							if (window.opera &&parseInt(window.opera.version())<9) 	a.style.borderColor=colors[6-j];
							a.style['opacity']=((7-j)/10-j/100);
							a.style['-moz-opacity']=(7-j)/10-j/100;
							a.style['-khtml-opacity']=(7-j)/10-j/100;

							b.insertBefore(a,b.firstChild);
							
						}
					 }
				 }
		    }	
		}

/*-----------------------------MODULAR NAV SCRIPT------------------*/

var shadows=true;
var primaryVertOffset=10;
var secondaryVertOffset=10;
var horizontalOffset=2;      /* MUST BE GREATER THAN -(WIDTH OF BUTtON) FOR FIREFOX/OPERA*/
var secondaryHorizontalOffset=-50;
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){
		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 curValue=parseInt(curUL.style.left);
		if(curValue>0) {
				curUL.style.left=(curValue=curValue-Math.ceil(curValue/2))+'px';
				curUL.style.clip='rect(0px 2500px 2500px ' + (navWidth-curValue)+ 'px)';
		} else {
			if (shadows) curUL.style.clip='rect(0px 2500px 2500px ' + (navWidth-curValue+8)+ 'px)';
			delete closers[k];
		}
	}
}


/*-------------------------------CLOCK SCRIPT --------------------------------*/

var month=new Array('Januaru','February','March','April','May','June','July','August','September','October','November','December');
var timeFlag=false;
	
function timer(){
	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=(now.getMonth()+1)+'/'+now.getDate()+'/'+now.getFullYear();
	document.getElementById('timeHolder').innerHTML=timeStr;
	document.getElementById('dateHolder').innerHTML=dayStr;
}

function setPNG(node){
	  if (node.hasChildNodes) {
			var iteration;
			for (iteration=0;iteration<node.childNodes.length;iteration++) {
				setPNG(node.childNodes[iteration]);
			}
	  }
	  if (node.tagName=='IMG' && node.src.indexOf('.png')!=-1){
	  	var w=node.width;
		var h=node.height;
		var source=node.src;
		node.src='images/spacer.gif';
		//node.style.top='0px';
		//node.style.left='0px';
		node.width=w;
		node.height=h;
		node.style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src='+source+', sizingMethod="scale")';
		node.style.display='block';
	  }

}	
	
function setHeaders(){
	var heads=new Array();
	heads=document.getElementsByTagName('h1');
	for (i=0;i<heads.length;i++){
		heads[i].innerHTML='<span class="h1Shad">' + heads[i].innerHTML + '</span>' + heads[i].innerHTML;
	}
}

//---------------------- Large Image Display Functions------------------------

var prevScroll=0;

function setResize(){
		window.onresize=function(){showLess()};
}

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.body.clientWidth;
		var h=document.body.clientHeight;

		var dimmer=document.createElement('div');
		dimmer.id='screen';
		document.body.insertBefore(dimmer,document.body.firstChild);
		
		var card=document.createElement('div');
		card.id='rolodex';
		with (card.style){
			overflow='scroll';
			textAlign='center';
			backgroundColor='#000000';
			border='5px #eaee00 solid';
			position= 'absolute';
			zIndex=201;
			top=(window.pageYOffset ? (window.pageYOffset) : (document.documentElement.scrollTop!=0?document.documentElement.scrollTop:document.body.scrollTop))+70+'px';
			left=90+'px';
			width = (w-190) + 'px';
			height=(h-140) + 'px';
		}
		var size=new Array()
		size[0]=w-190;
		size[1]=h-140;
		document.body.insertBefore(card,document.body.firstChild);
		

		with (document.getElementById('screen').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';;
			backgroundColor='black';
			filter='alpha(opacity=50)';
			opacity='0.50';
			display='block';
			zIndex=200;
		}
		return size;
}

function reserve(url){
	var size=openOverlay();
	document.getElementById('rolodex').style.overflow='hidden';
	var ifr=document.createElement('iframe');
	ifr.style.width=size[0]+'px';
	ifr.style.height=size[1]+'px';
	ifr.src='_displayImage.cfm?src='+url;
	document.getElementById('rolodex').insertBefore(ifr,document.getElementById('rolodex').firstChild);
	var closer=document.createElement('div');
	var closerText=document.createTextNode('[ CLOSE ]');
	closer.textAlign='center';
	closer.style.position='absolute';
	closer.style.top='10px';
	closer.style.left=(size[0]-94)+'px';
	closer.style.cursor='pointer';
	closer.style.color='blue';
	closer.style.fontSize='8pt';
	closer.style.backgroundColor='#FFFFFF';
	closer.style.border='1px solid #000000';
	closer.style.padding='3px';
	closer.onclick=function(){showLess()};
	closer.appendChild(closerText);
	document.getElementById('rolodex').insertBefore(closer,document.getElementById('rolodex').firstChild);
	setTimeout('setResize()',250);
	
}

function showLess(){
		window.onresize=null;
		document.body.removeChild(document.getElementById('rolodex'));
		document.body.removeChild(document.getElementById('screen'));
		document.documentElement.style.overflow='auto';
		window.scrollBy(0,1);
		if (document.documentElement.scrollTop==0){
			document.body.style.overflow='auto';
		}
		if (prevScroll!=0) window.scrollTo(0,prevScroll);
}

/*-------------------------------START IT ALL SCRIPT --------------------------------*/

window.onload=function(){
	//timer();
	setupNav(document.getElementById('nav')); 
	setInterval('animate()',30);
	//setInterval('timer()',1000);
	//makeShadows(document);
	//makeDateFields(document);
	//setHeaders();
}


