﻿function checkContactForm() {
	var firstname = document.getElementById("txtFirstname").value;
	var surname = document.getElementById("txtSurname").value;
	var company = document.getElementById("txtCompany").value;
	var email = document.getElementById("txtEmail").value;
	var comments = document.getElementById("txtComments").value;
	
	var mail_filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if( mail_filter.test(email) ){
		if ( firstname!="" && surname!="" && company!="" && comments!="" ) {
			return true;
		} else alert("All fields are mandatory and need to be filled out before proceeding.");
	} else alert("Invalid e-mail address.");
	return false;
}

function swapDivs(show, hide){
    document.getElementById(show).style.display = "block";
    document.getElementById(hide).style.display = "none";
}

function correctPNG() {
	var arVersion = navigator.appVersion.split("MSIE");
	var version = parseFloat(arVersion[1]);
	if ((version >= 5.5) && (document.body.filters)) {
		for(var i=0; i<document.images.length; i++) {
			var img = document.images[i];
			var imgName = img.src.toUpperCase();
			if (imgName.substring(imgName.length-3, imgName.length) == "PNG") {
				var imgID = (img.id) ? "id='" + img.id + "' " : "";
				var imgClass = (img.className) ? "class='" + img.className + "' " : "";
				var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
				var imgStyle = "display:inline-block;" + img.style.cssText;
				if (img.align == "left") imgStyle = "float:left;" + imgStyle;
				if (img.align == "right") imgStyle = "float:right;" + imgStyle;
				if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle;
				var strNewHTML = "<span " + imgID + imgClass + imgTitle + " style=\"margin:0 7px;" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";" + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" + "(src=\'" + img.src + "\', sizingMethod='image');\"></span>";
				img.outerHTML = strNewHTML;
				i--;
			}
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", correctPNG);