function showImage(name, wWidth, wHeight, busName)
{
	var name = name;
	var wWidth = wWidth;
	var wHeight = wHeight;
	var busName = busName;
	var path = path;
	var dim;
	
	if(wWidth > 780) {
		wWidth = 780;
		dim = wWidth > wHeight ? " width=\"760\"" : " height=\"560\"";
	}
	
	if(wHeight > 580) {
		wHeight = 580;
		dim = wWidth > wHeight ? " width=\"760\"" : " height=\"560\"";
	}
	
	var w = window.open("","","height=" + (wHeight+10) + ",width=" + (wWidth+10) + ",scrollbars=no,resizable=no");

	w.document.write("<html><head><title>" + busName + "</title></head><body " +
	                 "style=\"margin:5px;\"><div align=\"center\"><img name=\"image\" " + 
				  "src=\"" + name + "\"" + dim + "></div></body></html>");
}

function check_mail_form() {

	var d = document.contact_us;
    var date_regex_pattern = /^(?=\d)(?:(?:(?:(?:(?:0?[13578]|1[02])(\/|-|\.)31)\1|(?:(?:0?[1,3-9]|1[0-2])(\/|-|\.)(?:29|30)\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})|(?:0?2(\/|-|\.)29\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))|(?:(?:0?[1-9])|(?:1[0-2]))(\/|-|\.)(?:0?[1-9]|1\d|2[0-8])\4(?:(?:1[6-9]|[2-9]\d)?\d{2}))($|\ (?=\d)))?(((0?[1-9]|1[012])(:[0-5]\d){0,2}(\ [AP]M))|([01]\d|2[0-3])(:[0-5]\d){1,2})?$/;
    var errorMessage = 'Please enter valid date as month, day, and four digit year.\nYou may use a slash, hyphen or period to separate the values.\nThe date must be a real date. 2-30-2000 would not be accepted.\nFormay mm/dd/yyyy.';

	if(d.name.value=="") {
		alert('You have to enter your name!');
		d.name.focus();
		return false;
	}

    if ((d.start_date.value.match(date_regex_pattern)) && (d.start_date.value!='')) {
    } else {
        alert(errorMessage);
        d.start_date.focus();
		return false;
    } 
	
    if ((d.end_date.value.match(date_regex_pattern)) && (d.end_date.value!='')) {
    } else {
        alert(errorMessage);
        d.end_date.focus();
		return false;
    } 
	
	if(!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(d.email.value)) {
		alert("Invalid email address! Please re-enter.");
		d.email.value="";
		d.email.focus();
		return false;
	}

	if(d.email.value=="") {
		alert('You have to enter your email address!');
		d.email.focus();
		return false;
	}
	
	/*if(d.tel.value=="") {
		alert('You have to enter your telephone number!');
		d.tel.focus();
		return false;
	}*/

	if(d.message.value=="") {
		alert('You have to enter message!');
		d.message.focus();
		return false;
	}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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 MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

