function openWin(url, name, w, h, perc, scroll, resize) {
	var winX = (screen.availWidth - w)*perc*.01;
	var winY = (screen.availHeight - h)*perc*.01;
	popupWin = window.open(url, name,'width=' + w + ',height=' + h + ',left=' + winX + ',top=' + winY + ',scrollbars=' + scroll + ',resizable=' + resize);
}

function openWinCentered(mypage, myname, w, h, scroll, resize) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable='+resize;
	win = window.open(mypage, myname, winprops)
}




function validate(frm) {
	
	// check name
	
	if ((frm.name.value == null)||(frm.name.value == "")) {
		alert('Please enter your name');
		frm.name.focus();
		return false;
	}
	
	// check email
	
	if (!isValidEmail(frm.email.value)) { 
		alert('Please enter a valid e-mail address.');
		frm.email.focus();
		return false;
	}
	
	// check subject
	
	if ((frm.subject.value == null)||(frm.subject.value == "")) {
		alert('Please enter a subject');
		frm.subject.focus();
		return false;
	}
	
	// check message
	
	if ((frm.message.value == null)||(frm.message.value == "")) {
		alert('Please enter a message');
		frm.message.focus();
		return false;
	}
	
	return true;
}

function isValidEmail(p_strEmail) {
	var regexp = /^\S+\@[a-zA-Z0-9\.-]+\.[a-zA-Z0-9]{2,4}$/;
	return regexp.test(p_strEmail);
}


// ====================================================================================================


function MM_preloadImages() { //v3.0
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_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 swapImages(x) {

	document.getElementById('projectphoto').src = "images/projects_lg/"+x+".jpg";

}

