
function changeMenuClass(id, newClass) {
	identity=document.getElementById(id);
	identity.className=newClass;
}

function openWindow(href) {
  var openWindow = this.open(href);
}

function openPopWinRelativeSize(href) {
  var width = parseInt(screen.availWidth * .8);
  var height = parseInt(screen.availHeight * .7);
  var x = parseInt((screen.availWidth/2) - (width/2));
  var y = parseInt((screen.availHeight/2) - (height/2));
  var windowFeatures = "width=" + width + ",height=" + height + ",left=" + x +",screenX=" + x +",top=" + y + ",screenY=" + y;
  windowFeatures += ",toolbar=no,menubar=yes,location=no,scrollbars=yes,resizable=yes";
  var openWindow = this.open(href, "", windowFeatures);
}

function openPopWinFixedSize(href) {
  var width = 610;
  var height = 560;
  var x = parseInt((screen.availWidth/2) - (width/2));
  var y = parseInt((screen.availHeight/2) - (height/2));
  var windowFeatures = "width=" + width + ",height=" + height + ",left=" + x +",screenX=" + x +",top=" + y + ",screenY=" + y;
  windowFeatures += ",toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes";
  var openPicWindow = this.open(href, "pic", windowFeatures);
  openPicWindow.focus();
}

function setEvents() {
	if(!document.getElementsByTagName) {
		return;
	}
	var anchors = document.getElementsByTagName("a");
	for (var i=anchors.length; i !=0; i--) {
		var a=anchors[i-1];
		if (a.rel.indexOf("external") != -1) {
			a.title += " (opens in new window)";
			a.onclick = function(){openWindow(this.href);return false;}
		}
		if (a.rel.indexOf("email") != -1) {
			a.title += "(email link)";
		}
	}
	var forms = document.getElementsByTagName("form");
	for (var i=forms.length; i !=0; i--) {
		var f=forms[i-1];
		if (f.id.indexOf("frmNewsletter") != -1) {
			f.target="_blank";
		}
	}
}

function validateFrmNewletter() {
	var f_ue = document.getElementById("frmNewsletterInput");
	if (!validEmail(f_ue.value)) {
		alert("Please enter a valid email address.");
		f_ue.focus();
		f_ue.select();
		return false
	}
}
function validateFrmNewletter2() {
	var f_ue = document.getElementById("frmNewsletterInput2");
	if (!validEmail(f_ue.value)) {
		alert("Please enter a valid email address.");
		f_ue.focus();
		f_ue.select();
		return false
	}
}


function validateContactForm() {
	var f = document.getElementById("username");
	if (f.value.length<2) {
		alert("Please enter your name.");
		f.focus();
		f.select();
		return false;
	}
	var f = document.getElementById("e_mail_addr");
	if (!validEmail(f.value)) {
		alert("Please enter a valid email address.");
		f.focus();
		f.select();
		return false;
	}
	var f = document.getElementById("comments");
	if (f.value.length<10) {
		alert("Please enter your comments.");
		f.focus();
		f.select();
		return false;
	}
	/*var f = document.getElementById("password");
	if (f.value.length<5) {
		alert("To prove you are a human user, please enter the letters in the image.");
		f.focus();
		f.select();
		return false;
	}*/
}

function validateResumeForm() {
	var f = document.getElementById("username");
	if (f.value.length<2) {
		alert("Please enter your name.");
		f.focus();
		f.select();
		return false;
	}
	f = document.getElementById("e_mail_addr");
	if (!validEmail(f.value)) {
		alert("Please enter a valid email address.");
		f.focus();
		f.select();
		return false;
	}
	f = document.getElementById("resume");
	if (f.value.length<10) {
		alert("Please enter your resume.");
		f.focus();
		f.select();
		return false;
	}
	f = document.getElementById("comments");
	if (f.value.length<10) {
		alert("Please enter your comments.");
		f.focus();
		f.select();
		return false;
	}
	/*f = document.getElementById("password");
	if (f.value.length<5) {
		alert("To prove you are a human user, please enter the letters in the image.");
		f.focus();
		f.select();
		return false;
	}*/
}


