function changeimg(img) {
	if(img.src.match("-norm")) {
		img.src = img.src.split("-norm").join("-over");
	} else {
		img.src = img.src.split("-over").join("-norm");
	}
}

function newwin(lnk) {
	window.open(lnk.href, 'newwindow'+new Date().getTime(),'toolbar=yes, location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes, resizable=yes');
	return false;
}

function areyousure(txt) {
	var q = confirm(txt);
	if (!q){ return false; }
}

function chkF(field,alerttxt,reject){
	with (field) {
		if (value==null||value==""||value==reject){
			alert(alerttxt);
			return false
		} else { return true }
	}
}

function chkE(field,alerttxt){
	with (field){
		apos=value.indexOf("@")
		dotpos=value.lastIndexOf(".")
		if (apos<1||dotpos-apos<2) 
			  {alert(alerttxt);return false}
		else {return true}
	}
}

function general_form(thisForm) {
	with (thisForm){
		if (chkF(name, "Please enter your name.", "asd")==false){
			name.focus();
			return false
		}
		
		if (chkE(email,"Sorry that isn't a valid Email Address")==false){
			email.focus();
			return false
		}

		if (chkF(message, "Please enter a Message", "asd")==false){
			message.focus();
			return false
		}
	}
}

function hover_change(img) {
	if(img.src.match("-small")) {
		img.src = img.src.split("-small").join("-fade");
	} else {
		img.src = img.src.split("-fade").join("-small");
	}
}

function big_loader(img) {
	var big_image = img.src.split("-small").join("-big");
	document.getElementById('portfolio-header').src = big_image;
}
