var isDOM = (document.getElementById ? true : false); 
var isIE4 = ((document.all && !isDOM) ? true : false);
var isNS4 = (document.layers ? true : false);
var isIE = (navigator.appName == "Microsoft Internet Explorer"?true:false);

function getRef(id) {
	if (isDOM) return document.getElementById(id);
	if (isIE4) return document.all[id];
	if (isNS4) return document.layers[id];
}

function getSty(id) {
	return (isNS4 ? getRef(id) : getRef(id).style);
} 

function printiMeil(name,domain,styleclass,text){
	imeil = name + "@" + domain;
	meil2 = "<a href=\"mai" + "lto:" + imeil + "\"";
	if(styleclass) meil2 += " class=" + styleclass;
	if(!text) text = imeil;
	meil2 += ">" + text + "</a>";
	document.write(meil2);
}

function openWindow(file, name, width, height){
	if(!name) name = "popup";
	if(!width) width = 600;
	if(!height) height = screen.height - 250;
	popUp = open(file,name,'scrollbars=yes,toolbar=no,directories=no,location=no,menubar=no,resizable=yes,header=no,status=no,width='+width+',height='+height+',top='+(screen.height-height)/2+',left='+(screen.width - width)/2);
	popUp.focus();
	return false;
}

function HighLightText(id, isOver, color, bgColor){
	parentref = getSty(id);
	overCol = "#336699";
	offCol = "#000000";
	if(color) overCol = offCol = color;
	newCol = isOver ? overCol : offCol;
	newBgCol = isOver ? bgColor : "#ffffff";
	with (parentref) {
		if (isNS4) color = newCol;
		else color = newCol;
    }
	with (parentref) {
		if (isNS4) bgColor = newBgCol;
		else backgroundColor = newBgCol;
    }
}

function changePage(url){
	document.location.href=url;
}

function checkRequired(forma){
	i = 0;
	message = "";
	while(i < forma.elements.length){
		elem = forma.elements[i];
		myRe = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/i;
		if(elem.required){
			switch(elem.type){
				case "select-one":
				case "select-multiple":
					if(!elem[elem.selectedIndex].value){
						message += "Field \"" + elem.title + "\" is required.\n\r";
					}
				break;
				default:
					if(!elem.value) message += "Field \"" + elem.title + "\" is required.\n\r";
			}
		};
		i++;
	}
	if(message){ 
		alert(message);
			return false;
		}
	return true;
}	

function Glossary(lnk){
	return openWindow(lnk.href,lnk.target, 620, 400);
}
