
var n, j	
arr0 = new Array(['All Physicians','1'],['All Dentists','2'],['Abdominal Surgery','3'],['Addiction Medicine','4'],['Adolescent Medicine','5'],['Adult Orthopedic Surgery','6'],['Aerospace Medicine','7'],['Allergy','8'],['Allergy &amp; Immunology','9'],['Anatomic Pathology','10'],['Anesthesiology','11'],['Bariatrician','12'],['Blood Banking','13'],['Cardiac Electrophysiology','14'],['Cardiovascular Disease','15'],['Cardiovascular Surgery','16'],['Chemical Pathology','17'],['Chiropractors ','18'],['Clinical Pathology','19'],['Clinical Pharmacology','20'],['Colon &amp; Rectal Surgery','21'],['Critical Care Anesthesiology','22'],['Critical Care Medicine','23'],['Critical Care Surgery','24'],['Cytopathology','25'],['Dental - Endodontics','26'],['Dental - General Practice','27'],['Dental - Oral &amp; Maxillofacial Surgery','28'],['Dental - Orthodontics','29'],['Dental - Pediatrics','30'],['Dental - Periodontics','31'],['Dental - Prosthodontics','32'],['Dermatology','33'],['Dermatopathology','34'],['Diabetes','35'],['Diagnostic Radiology','36'],['Emergency Medicine','37'],['Endocrinology','38'],['Family Practice','39'],['Flexible','40'],['Forensic Pathology','41'],['Gastroenterology','42'],['General Practice','43'],['General Preventive Medicine','44'],['General Surgery','45'],['Genetics','46'],['Geriatrics','47'],['Geriatrics Family  Practice','48'],['Gynecological Oncology','49'],['Gynecology','50'],['Hand Surgery','51'],['Head &amp; Neck Surgery','52'],['Hematology','53'],['Immunology','54'],['Immunology, Diagnostic Laboratory','55'],['Immunopathology','56'],['Infectious Diseases','57'],['Internal Medicine','58'],['Legal Medicine','59'],['Maternal &amp; Fetal Medicine','60'],['Maxillofacial Surgery','61'],['Medical Microbiology','62'],['Medical Oncology','63'],['Neonatal - Perinatal Medicine','64'],['Nephrology','65'],['Neurological Surgery','66'],['Neurological Surgery, Critical Care','67'],['Neurology','68'],['Neuropathology','69'],['Nuclear Medicine','70'],['Nuclear Radiology','71'],['Nutrition','72'],['Obstetrics','73'],['Obstetrics &amp; Gynecology','74'],['Obstetrics &amp; Gynecology/Critical Care','75'],['Occupational Medicine','76'],['Ophthalmology','77'],['Optometrists ','78'],['Orthopedic Surgery','79'],['Orthopedic Surgery, Sports Med','80'],['Orthopedic Trauma Surgery','81'],['Orthopedic, Musculoskeletal','82'],['Other Specialty','83'],['Otology','84'],['Otorhinolaryngology','85'],['Pathology','86'],['Pathology, Hematology','87'],['Pediatric Allergy','88'],['Pediatric Cardiology','89'],['Pediatric Critical Care','90'],['Pediatric Endocrinology','91'],['Pediatric Gastroenterology','92'],['Pediatric Hematology-Oncology','93'],['Pediatric Nephrology','94'],['Pediatric Neurology','95'],['Pediatric Orthopedic Surgery','96'],['Pediatric Psychiatry','97'],['Pediatric Pulmonology','98'],['Pediatric Radiology','99'],['Pediatric Surgery','100'],['Pediatrics','101'],['Perinatal Medicine','102'],['Physical Medicine/Rehabilitation','103'],['Physical Therapists','104'],['Plastic Surgery','105'],['Podiatrists','106'],['Psychiatry','107'],['Psychoanalysis','108'],['Psychologists','109'],['Psychotherapists','110'],['Public Health','111'],['Pulmonary Disease','112'],['Radiation Oncology','113'],['Radioisotopic Pathology','114'],['Radiology','115'],['Reproductive Endocrinology','116'],['Rheumatology','117'],['Thoracic Surgery','118'],['Traumatic Surgery','119'],['Urological Surgery','120'],['Vascular Surgery','121'],['Veterinarians','122']);

function showList(selInd,list){
	if (selInd==-1) selInd=0; 
	list.length = 0;	
	var arrCurrent = eval('arr'+selInd);	
	for (var i=0; i<arrCurrent.length; i++){
		list.options[i] = new Option(arrCurrent[i][0], arrCurrent[i][1]);
	}
}

function move(f, from, to){
	if(f.SelectedPhysicianList.selectedIndex == ''){
		f.SelectedPhysicianList.options[0] = null;
	}
	outer:
	for (var i = 0; i < from.length; i++) {
		if (from.options[i].selected){
			for (var j=0; j < to.length; j++)
				if (from.options[i].text == to.options[j].text) continue outer;
					
			var tempOption = new Option(from.options[i].text,from.options[i].value);
			to.options[to.length] = tempOption;			
		}				
	}
	for (var i = 0; i < from.length; i++)
		from.options[i].selected=false;
		
}
function remove(f, list){
	for (var i = 0; i < list.length; i++) {
		if (list.options[i].selected){
			list.options[i] = null;
			i--;
		}				
	}
}

function submitForm(){
	selectAll();
	
	
        if (validateContact() == true){ 
	alert("hello");
			    document.forms[0].submit();
				return true;
        }       
		else
			
			return false;
}

function selectAll(){
	var list = document.frmMain.SelectedPhysicianList;
		
	
	if (list.length >= 1){
		validateContact();
		document.frmMain.Option.value = '';
		
	 
		for (var i = 0; i < list.length; i++){ 
		if (i < list.length-1){
			document.frmMain.Option.value = document.frmMain.Option.value + list.options[i].value + '<br />'; 
		}
		else{
			document.frmMain.Option.value = document.frmMain.Option.value + list.options[i].value; 
		}	
			
	}		
		is_valid = true;
		validateContact();
		alert('* Please note that the physician lists we offer are used for direct marketing campaigns, not to find a doctor for one\'s personal care.');
		is_valid = false;
		
	}else{
		alert("You must select a type of Physician or Dentist in order to proceed.");
		is_valid = false;
	}	
	
	
			
		

	 	
}

function submitBack()
{
	history.go(-1);
}

function Trim(s) 
        {

                  
                while ((s.substring(0,1) == ' ') || (s.substring(0,1) == '\n') || (s.substring(0,1) == '\r'))
                {
                        s = s.substring(1,s.length);
                }



                while ((s.substring(s.length-1,s.length) == ' ') || (s.substring(s.length-1,s.length) == '\n') || (s.substring(s.length-1,s.length) == '\r'))
                {
                        s = s.substring(0,s.length-1);
                }
                return s;
        }

function validateContact(){

	
	var myErrorCount = 0;
	var myErrorMessage = "";
	
	for (var i=0;i<document.forms[0].elements.length;i++){
		var myMessage;
		myMessage = "Index: " + i.toString()
		myMessage = myMessage + "\r\n" + "Name: " + document.forms[0].elements[i].name;
		myMessage = myMessage + "\r\n" + "Type: " + document.forms[0].elements[i].type;
		
		var myElement = document.forms[0].elements[i];
		var regExp;
		var strName = "";

		if (myElement.type=="select-one")
		{
			if(myElement.value=="Not Selected")
			{
				switch (myElement.name) 
				{
					case "DesiredLeadCount":
						strName = "DesiredLeadCount";
						break;
					
					case "ExpectedDelivery":
					strName = "ExpectedDelivery";
					break;
				}
			}
		}
		else if (myElement.type=="textarea")
		{
			if ( myElement.value=="")
			{
				switch (myElement.name) 
				{
					case "Geography":
					strName = "Geography";
					break;
				
					case "Demographics":
					strName = "Demographics";
					break;
				}
			}
		}
		else if (myElement.type=="text")
		{
			switch (myElement.name) 
			{			
				case "Company":
				strName = "Business Name";
				regExp=/[ a-z\.'-]/i;
				break;
				
				case "fName":
				strName = "First Name";
				regExp=/[ a-z\.'-]/i;
				break;
				
				case "lName":
				strName = "Last Name";
				regExp=/[ a-z\.'-]/i;
				break;				
				
				case "Phone":
				strName = "Phone Number";
			regExp=/[ a-z\.'-]/i;
				break;
				
				case "Email":
				strName = "Email Address";
				regExp=/[a-z0-9\.-_]+@{1}[a-z0-9-_]+\.{1}[a-z]+/i;		
				
			}
			}

			if (strName!=""){
			
				if (strName == "DesiredLeadCount" || strName == "ExpectedDelivery"){
						
						switch (strName) {
		
							case "DesiredLeadCount":
							myErrorCount++;
							myErrorMessage = myErrorMessage + "Please choose: How many leads you are looking for?\r\n";
							break;

							case "ExpectedDelivery":
							myErrorCount++;
							myErrorMessage = myErrorMessage + "Please choose: How soon do you need this list?\r\n";
							break;
						}
					
				}
				else if (strName == "Geography" || strName == "Demographics"){
				
					switch (strName) {
						case "Geography":
						myErrorCount++;
						myErrorMessage = myErrorMessage + "Please enter your target geographic area.\r\n";
						break;

						case "Demographics":
						myErrorCount++;
						myErrorMessage = myErrorMessage + "Please describe your target audience.\r\n";
						break;
					}
				}
				else 
				{					
					if (myElement.value.length==0){
						myErrorMessage = myErrorMessage + "Please enter your " + strName + "\r\n";
						myErrorCount++;
					} else {
						if (myElement.value.length>50){
							myErrorMessage = myErrorMessage + "The value for " + strName + " cannot have more than 50 characters.\r\n";
							myErrorCount++;
						} else {
							if (strName!="Email Address"){
							
								if (strName=="Phone Number"){									
									if (!regExp.test(Trim(myElement.value))) {
									myErrorMessage = myErrorMessage + "Please enter a valid " + strName + "\r\n";
									myErrorCount++;
								}
								}
								else
								{
									for (var j=0;j<myElement.value.length;j++){
										if (!regExp.test(myElement.value.charAt(j))) {
											myErrorMessage = myErrorMessage + "Please enter a valid " + strName + "\r\n";
											myErrorCount++;
											j=myElement.value.length;
										}
									}
								}
								
							} else {								
								if (!regExp.test(Trim(myElement.value))) {
									myErrorMessage = myErrorMessage + "Please enter a valid " + strName + "\r\n";
									myErrorCount++;
								}
							
							}
						}
					}
				}
			}
		}
	
	if (myErrorCount > 0){
		alert(myErrorMessage);
		return false;
	} else {
		return true;
	}
}


var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

try {

var pageTracker = _gat._getTracker("UA-3481158-1");

pageTracker._trackPageview();

} catch(err) {}