/**
 * DHTML email validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */
function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		 return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    return false
		 }

 		 return true					
	}

function ValidateForm(){
	var emailID=document.form1.txtEmail;
	var nameID = document.form1.txtFirstName;
	var lastNameID = document.form1.txtLastName;
	var phoneID = document.form1.txtPhone;
	txtError = "";
	noError = true;
	if ((emailID.value==null)||(emailID.value=="") || echeck(emailID.value)==false){
		txtError += "Your e-mail is not correctly entered. Please re-enter it as name@domain.com \n";
		emailID.focus()
		noError = false;
	}
	
	if ((nameID.value==null)||(nameID.value=="") || (lastNameID.value==null)||(lastNameID.value=="") || (phoneID.value==null)||(phoneID.value=="")){
	    txtError += "Some fields may be missing or filled out incorrectly.";
		emailID.focus()
		noError = false;
	}
	
	if (noError == false) {
	    alert (txtError);
	    return false;
	} else {
	    return true;
	}
 }
 
 function expandMyBGmyBg() {	
	    var myWidth = document.body.clientWidth ;
	    var myHeight = document.body.clientHeight ;
	    document.getElementById("wrap").style.left = (myWidth - 584) /2 ;
	    document.getElementById("legal").style.left = (myWidth - 155) - 13 ;
	    document.getElementById("legal").style.top = myHeight - 32 ;
	    document.getElementById("legal2").style.left = 0 ;
	    document.getElementById("legal2").style.top = myHeight - 20 ;
	    }
function openFull(url,name) {
		l = 0;
		if (screen.width) {
			if ((screen.width/screen.height) > 1.7) {
				// two monitors
				w = screen.width/2;
			}else if ((screen.width/screen.height) > 1.3) {
			    // widescreen monitor
			    w = screen.width * 0.76;
			    l = (screen.width * 0.24) / 2;
			} else {
				w = screen.width;
			}

			if (navigator.appName.indexOf('etscape')>0) {
				w=w-5;
			} else {
				w=w-8;
			}

			h = screen.height-50;

			if (w>800) {
				pagesize='lrg';
			} else {
				pagesize='sml';
			}
			
		} else {
			pagesize='sml';
		}

		if (navigator.appName.indexOf('etscape')>0) {
			wh = 300 - 18;
			ww = 770 - 5;
		} else {
			wh = 300 - 20;
			ww = 770 - 10;
		}

		wleft=0;
		wtop=0;
		if (screen.width) {
			if (screen.width > 800) {

				if (screen.width/screen.height>1.5) {
					sw = screen.width/4;
				} else {
					sw = screen.width/2;
				}

				wleft=(sw) - (ww/2) - 5;
				wtop=(screen.height/2) - (wh/2) - 18
				if (navigator.userAgent.indexOf('acintosh')>0) {
					wleft=wleft+4;
					ww=ww-9;
				}
			}
		}
		if (pagesize=='lrg') {
			w=w;
			h=h;
		} else {
			w=770;
			h=440;
		}
		window.open(url,name, 'width=' + w + ',height=' + h + ',left=' + l + '0,top=0,scrollbars=0,status=0,location=0,resizeable=0,toolbar=0');
	}

	
	
	function submitform()
    {
      document.form1.submit();
    }