// JavaScript Document
function preloadImages() {
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function unblur() {
	this.blur();
}

function blurLinks() {
	links = document.getElementsByTagName("a");
	for(i=0; i<links.length; i++) {
		links[i].onfocus = unblur;
	}
}

function setFocus(obj) {
	x = document.getElementById(obj);
	x.focus();
}

function flashObjects (objPath,objWidth,objHeight,objTitle,objParam,altPath,altWidth,altHeight,altTitle) {
	document.write('<object type="application/x-shockwave-flash" data="'+objPath+'"width="'+objWidth+'" height="'+objHeight+'" '+objParam+'> \
					<param name="movie" value="'+objPath+'" /> \
					<param name="quality" value="high" /> \
					<img src="'+altPath+'" width="'+altWidth+'" height="'+altHeight+'" alt="'+altTitle+'" /></object>');
}

function markSelected(el) {
	if (el.parentNode.className != 'selected') {
		el.parentNode.className = 'hover';
	}
	//return false;
}

function unmarkSelected(el) {
//	alert (el.parentNode.className);
	if (el.parentNode.className != 'selected') {
		el.parentNode.className = '';
	}
	//return false;
}

function formElementsStyle () {
	if(document.getElementsByTagName) {

		var className = 'tr_hover',
		pattern = new RegExp('(^|\\s+)' + className + '(\\s+|$)'),			
		rows = document.getElementsByTagName('tr');

		for (var i = 0, n = rows.length; i < n; ++i) {
				rows[i].onmouseover = 
					function() {
						this.className += ' ' + className;
					};
				rows[i].onmouseout = 
					function() {
						this.className = this.className.replace(pattern, ' ');
					};
		}
	}
	rows = null;	
}

function popUp(URL) {
	window.open( URL, "myWindow", "status = 1, height = 600, width = 700, resizable = 1" )
}


function fade(el) {
	el.style.opacity =  0.5; 
	el.style.MozOpacity =  0.5; 	
	el.style.KhtmlOpacity =  0.5; 
	el.style.filter = "alpha(opacity=50)";
}

function unfade(el) {
	el.style.opacity =  1; 
	el.style.MozOpacity =  1; 	
	el.style.KhtmlOpacity =  1; 
	el.style.filter = "alpha(opacity=100)";
}


function btnHover(el) {
	el.className = 'searchBtnHover';
}

function btnRestore(el) {
	el.className = 'searchBtn';
}

function emptyFormFields(el,val) {
	if (el.value == val ) {
		el.value = '';
	}	
}

function fillFormFields(el,val) {
	if (el.value == '' ) {
		el.value = val;
	}
}


//main navigation 
navHover = function() {
	var lis = document.getElementById("mainNav").getElementsByTagName("LI");
	for (var i=0; i<lis.length; i++) {
		lis[i].onmouseover=function() {
			this.className+=" iehover";
		}
		lis[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" iehover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", navHover);