if (window!= top)top.location.href=location.href;
	//DropDown Nav
	var activeMenu;
	active = function(id) {
	var nav = document.getElementById(id);
	if (!nav){return;}
		var e = nav.getElementsByTagName("LI");
		for (var i=0; i<e.length; i++) {
			e[i].onmouseover=function() {
	    		if (activeMenu){activeMenu.onmouseout();
				}
	    		activeMenu = this;
					this.className+=" active";
				}
				e[i].onmouseout=function() {
					this.className=this.className.replace(/active/g, '');
					}
				}
			navFocus(id,true);
		navSel(id);
	}
	//DropDown-FoldOut Nav Focus
	navFocus = function(id,mouseOverMenu){
	  var subnav = document.getElementById(id);
	  if (!subnav){return;}  
	  var list = subnav.getElementsByTagName("A");
	  for (var i = 0; i < list.length; i++){
	    var e = list[i];
	    if (e.parentNode.parentNode.id == id){
	  		if (mouseOverMenu){
	    		e.onfocus = function(){this.parentNode.onmouseover();}
	  		}
	 	 	else {
	    			e.onfocus = function(){this.parentNode.onclick();
				}
	  		}
		}
	}
	//DropDown Nav LastNodefocus
		if (list.length == 0){return;}
	  	var lastSub = list[list.length-1];
	  	if (lastSub.parentNode.parentNode.id == id){return;}
	  		lastSub.onblur = function(){
	    	this.parentNode.parentNode.parentNode.onmouseout();
	  	}
	}
	//ClienSide Selector
	navSel = function(id){
	var list = document.getElementById(id).getElementsByTagName('A');
	//alert(list[2].innerHTML);
	var loc = location.href;
	  if(loc.charAt(loc.length-1) == '/'){
	    loc = loc + 'index.php';
	  }
	  for (var i = 0; i < list.length; i++){
	    if (list[i].href == loc){
		 	if (list[i].parentNode.parentNode.id == id){
				list[i].className = 'selected';
			}
			else {
				list[i].parentNode.parentNode.parentNode.getElementsByTagName('A')[0].className = 'selected';
			}
	      return;
	    }
	  }
	}
	//ZebraTables
  	var setZebra = function() {
		var tables = document.getElementsByTagName('table');	
		for(var x = 0; x != tables.length; x++){
			var table = tables[x];
			if (! table) { return; }
			if (tables[x].className=='data'){
			var tbodies = table.getElementsByTagName('tbody');
			for (var h = 0; h < tbodies.length; h++) {
				var even = true;
				var trs = tbodies[h].getElementsByTagName('tr');
				for (var i = 0; i < trs.length; i++) {
					trs[i].onmouseover=function(){
						this.className += ' ruled'; return false
					}
					trs[i].onmouseout=function(){
						this.className = this.className.replace('ruled', ''); return false
					}	
					if(even)
						trs[i].className += ' even';
					even = !even;
					}
				}
			}
		}
	}
	//FixedFooter
	function getWindowHeight() {
	var windowHeight = 0;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	}
	else {
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		}
		else {
			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
			}
		}
	}
		return windowHeight;
	}
	function setFooter() {
		if (document.getElementById) {
			var windowHeight = getWindowHeight();
			if (windowHeight > 0) {
				var contentHeight = document.getElementById('framework').offsetHeight;
				var footerElement = document.getElementById('footer');
				var footerHeight  = -64//footerElement.offsetHeight;
				if (windowHeight - (contentHeight + footerHeight) >= 0) {
					footerElement.style.position = 'relative';
					footerElement.style.top = (windowHeight - (contentHeight + footerHeight)) + 'px';
				}
				else {
					footerElement.style.position = 'static';
				}
			}
		}
	}
	//RemoveForm Buttons
	var setBorder = function(){
	var rbg = document.getElementsByTagName('input');
	for (var i = 0; i < rbg.length; i++) {
	if(rbg[i].getAttribute('type')=='radio' || rbg[i].getAttribute('type')=='checkbox'){
		rbg[i].style.border='none';
		rbg[i].style.width='auto';
		rbg[i].style.position='relative';
		rbg[i].style.top='-2px';
			}
		}
	}
	//HoverForm Buttons
	var setHover = function(){
	var hbg = document.getElementsByTagName('input');
	for (var i = 0; i < hbg.length; i++) {		
		if(hbg[i].getAttribute('type')=='submit' || hbg[i].getAttribute('type')=='reset' || hbg[i].getAttribute('type')=='button') {
			hbg[i].onmouseover=function(){
				this.className = 'buttonhover';
			}
			hbg[i].onmouseout=function(){
				this.className = 'button';
				}
			}
		}
	}
	//StyleSearchBox
	var setSearch = function(){
	var sval = document.getElementsByTagName('input');
	for (var i = 0; i < sval.length; i++) {		
		if(sval[i].className=='search') {
		var value = sval[i].value;
			sval[i].onfocus=function(){
				if(this.value==value)this.value='';this.style.color = "#00204E";
			}
			sval[i].onblur=function(){
				if(this.value=='')this.value=value;this.style.color = "#A6CDE4";
				}
			}
		}
	}
	
getEl = function(el){
  return document.getElementById(el);
}
	
function swapVisual(o,isFile){
	var pdfCheck = new Array();
	pdfCheck = o.value.split(".");
	if(pdfCheck[pdfCheck.length-1].toLowerCase()!='pdf'){
		alert('Please submit a PDF file');
	}else{
		delOldVisual(o.id);
		var displId = o.id + '_display';
		getEl(o.id + '_upload').checked = true;
		var str = isFile ? '<span class="visual">file: ' + o.value + '</span>' : '<a href=""><img class="visual" src="file://'+(o.value)+'" /></a>';
		getEl(displId).innerHTML = str + '<a class="delVis" href="javascript:delVisual(\''+ o.id +'\')">x</a><br style="clear:both;" />';
	}
}

function delVisual(o_id){
	var displId = o_id + '_display';
	getEl(o_id + '_upload').checked = false;
	getEl(displId).innerHTML = '';
}

function delOldVisual(o_id,_confirm){
  if (_confirm && !confirm('Are you sure you want tot delete this file?')){
    return false;
  }
	var displId = o_id + '_display';
	getEl(o_id + '_old_remove').checked = true;
	getEl(displId).innerHTML = '';
}

function showOldVisual(o_id,isFile){
	var displId = o_id + '_display';
  var fileName = getEl(o_id + '_old').value;
	var str = isFile ? '<a href="' + fileName + '" onclick="window.open(this.href);return false;" class="visual">file: ' + fileName + '</a>' : '<img class="visual" src="'+fileName+'" />';
	getEl(displId).innerHTML = str + '<a class="delVis" href="javascript:void(0);" onclick="javascript:delOldVisual(\''+ o_id +'\',1)">x</a><br style="clear:both;" />';		
}
	
	window.onload = function(){
	  	active('nav');
		//setFooter();
		if(document.getElementsByTagName('table'))setZebra();
		if(document.getElementsByTagName('input')){setBorder();setHover();setSearch();
		}
	}
	window.onresize = function() {
		//setFooter();
}
		
