// JavaScript Document

<!-- window opener-->
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
<!-- jump menu-->
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

/* HIDE BROKEN IMAGES */
function hideBroken() {
        var showAlt = true;
        ai = document.getElementsByTagName("img");
        for (im=0; im < ai.length; im++) {
                try { 
                        if (ai[im].fileSize <= 0 && ai[im].src.match(".jpg$|.gif$|.png$|.bmp$")) {
                                if ( ai[im].alt != "" && showAlt ) {
                                        ax = document.createTextNode("(" + ai[im].alt + ")");
                                        ai[im].parentNode.insertBefore(ax, ai[im]);
                                }
                                ai[im].style.display = "none";
                        }
                } catch (e) {}
        }
}
/* END HIDE BROKEN IMAGES */

// email checker
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){
		   alert("Invalid E-mail Address")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail Address")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail Address")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail Address")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail Address")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail Address")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail Address")
		    return false
		 }

 		 return true					
	}

function ValidateEMail(){
	var emailID=document.form2.email
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter a valid Email Address")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	return true
 }

// validate contact form
function MM_validateForm() { 

//v4.0
  var i,p,q,nm,personal='',contact='',test,num,min,max,errors='',args=MM_validateForm.arguments;
  
  if (form2.email.value != ""){
		ValidateEMail()
        form2.email.focus();
		} 
	else{
      	form2.email.className="";
		}
if (form2.email.value == ""){
        form2.email.focus();
		contact+= 'a';
		} 
	else{
      	form2.email.className="";
		}
if (form2.Name.value == ""){
        form2.Name.focus();
 		contact += 'a';
		} 
	else{
      	form2.Name.className="";
		} 
if (contact)errors += 'Your Contact Details\n';
if (errors){
 alert('PLEASE ENTER THE MISSING FIELDS\nFROM BELOW:\n\n'+errors);
 
  }else{ submit()
 	 	}		
 document.MM_returnValue = (errors == '');
}
function MM_popupMsg(msg) { //v1.0
  alert(msg);
}
