// JavaScript Document
function validateForm(){
	missinginfo = "";
	cform = document.forms.cForm;
	var mobNumberPattern = /[(][0-9][0-9][0-9][)][0-9][0-9][0-9][-][0-9][0-9][0-9][0-9]/;
	
	if(cform.fname.value == "" || cform.fname.length == 0){
		missinginfo += "\n [ First Name ]";
	}
/*	if(cform.lname.value == "" || cform.lname.length == 0){
		missinginfo += "\n [ Last Name ]";
	}*/
	if(cform.email.value == "" || cform.email.length == 0){
		missinginfo += "\n [ Email Address ]";
	}
	if(cform.referrer.value == "" || cform.referrer.length == 0){
		missinginfo += "\n [ How did you hear about us? ]";
	}
	if(cform.comments.value == "" || cform.comments.length == 0){
		missinginfo += "\n [ Additional Information ]";
	}
/*	if(cform.phone_number.value == "" || cform.phone_number.length == 0){
		missinginfo += "\n [ Phone Number ]";
	}*/
/*	
	if(cform.SID_Number.value == "" || cform.SID_Number.length == 0){
		missinginfo += "\n [ SID Number ]";
	}
	
	if(cform.Device_Type.value == "" || cform.Device_Type.length == 0){
		missinginfo += "\n [ Device Type ]";
	}
	
	if(cform.FRU_Tickets_Dates.value == "" || cform.FRU_Tickets_Dates.length == 0){
		missinginfo += "\n [ FRU Tickets & Dates ]";
	}
	
	if(cform.MTN_History.value == "" || cform.MTN_History.length == 0){
		missinginfo += "\n [ MTN History ]";
	}
*/	
	if (missinginfo != "") {
        missinginfo ="Please fill in the following required fields" +
        "\n_____________________________\n" + missinginfo;
        alert(missinginfo);
        return false;
    }else {
		var agree = confirm("Please verify the information entered!" + "\n___________________________________________________________\nFirst Name: " + cform.fname.value + "\nEmail Address: " + cform.email.value + "\nHow did you hear about us?: " + cform.referrer.value + "\nAdditional Information: " + cform.comments.value);
		if(agree){
        	return true;
		}else{
			return false;
		}
		return true;
	}
}
function isValid() {
 var email=document.cForm.email.value;
 if (email.indexOf(' ')==-1
      && 0<email.indexOf('@')
      && email.indexOf('@')+1 < email.length
 ) return true;
 else alert ('You have entered an invalid email address!')
 return false;
}
function validatePhone(m){
	p=m.value
	if(p.length==3){
		pp=p;
		d4=p.indexOf('(');
		d5=p.indexOf(')');
		if(d4==-1){
			pp="("+pp;
		}
		if(d5==-1){
			pp=pp+")";
		}
		m.value="";
		m.value=pp;
	}
	if(p.length>3){
    	d1=p.indexOf('(');
        d2=p.indexOf(')');
        if (d2==-1){
        	l30=p.length;
            p30=p.substring(0,4);
            p30=p30+")"
            p31=p.substring(4,l30);
            pp=p30+p31;
            m.value="";
            m.value=pp;
        }
	}
	if(p.length>7){
		v3=p.indexOf('-');
		if(v3 == -1){
			vl=p.length;
			v30=p.substring(0,8);
			v30=v30+"-";
			v31=p.substring(8,130);
			pp=v30+v31;
			m.value="";
			m.value=pp;
		}
	}
}
