function delMail(id, op){
	var i =  confirm("Do you want to Delete Message ? ");
	if (i == true)
	{		
		window.open(sRoot + "general/mailbox/includes/db_del_mail.asp?id=" + id + "&op=" + op,'windowName','top=250,left=350,width=250,height=125');
	}
}

function charLeft(x){
	x.txtCharLength.value = 2000 - x.txtComments.value.length;
}

function chkIllegalChar(x) {				
	var illegalChars = /\W/;   			
	// allow only letters, numbers, and underscores
	if (illegalChars.test(x)) {
		return false;
	}else{
		return true;
	}       			
}     		

function windowRedirect(sURL){	
	window.location.href = sRoot + sURL;
}

function browseProfile(schType){
	var rBoo = true;
	
	if (document.getElementById('chkAllAgree').checked == false){
		sMsg = "You must agree to the terms and conditions to proceed.";
		rBoo = false;	
	}
	if(rBoo == false) {
		alert(sMsg);
	}else{
		window.location.href = sRoot + 'search/listprofile.asp?brp=' + schType;
	}				
}

function browseProfile1(schType){
	var rBoo = true;
	
	if (document.getElementById('chkAgree').checked == false){
		sMsg = "You must agree to the terms and conditions to proceed.";
		rBoo = false;	
	}
	if(rBoo == false) {
		alert(sMsg);
	}else{
		window.location.href = sRoot + 'search/listprofile.asp?brp=' + schType;
	}				
}

function colbrowseProfile(schType){
	var rBoo = true;
	
	if ((schType == 'PW') && (document.getElementById('chkAgreePW').checked == false)) {	rBoo = false; } 	
	if ((schType == 'AP') && (document.getElementById('chkAgreeAP').checked == false)) {	rBoo = false; }
	
	if(rBoo == false) {
		alert("You must agree to the terms and conditions to proceed.\nPlease review terms and conditions, and then click box at bottom of column.");
	}else{
		window.location.href = sRoot + 'search/listprofile.asp?brp=' + schType;
	}				
}


function viewProfile(id){
	var strType = id.substr(0, 4);
	var rBoo = true;
	
	if ((strType == 'pwid') && (document.getElementById('chkAgreePW').checked == false)) {	rBoo = false; } 	
	if ((strType == 'apid') && (document.getElementById('chkAgreeAP').checked == false)) {	rBoo = false; }
	
	if (rBoo == true){
		window.location.href = sRoot + 'search/profile.asp?' + id;
	} else {
		alert("You must agree to the terms and conditions to proceed.\nPlease review terms and conditions, and then click box at bottom of column.");
	}
	
}

function chkClick(f){
	
	var sMsg = "";
	var rBoo = true;
	
	if (f.chkAgree.checked == false){
		sMsg += "You must agree to the terms and conditions to proceed.";
		rBoo = false;	
	}
	if(rBoo == false) {
		alert(sMsg);
		}		
	return rBoo;
}

function selectSignType(){
	var x = document.frmSchMemType;
	
	
	if (x.ddlSignType.value == 'PW'){		
		document.getElementById('schPW').style.display="";
		document.getElementById('schAP').style.display="none";				
		//divs[0].style.display="";	
		//divs[1].style.display="none";	
	} 
	if (x.ddlSignType.value == 'AP'){
		document.getElementById('schPW').style.display="none";
		document.getElementById('schAP').style.display="";				
		//divs[0].style.display="none";	
		//divs[1].style.display="";	
	}
	
}

function validate_schMailbox(x) {
		
		// here is where you may wish to include more sophisticated checking, particularly of the email address.
		var e = "";
		var r = true;		
		
		if(x.txtADOPTadMailboxNumber.value == "") {
			e += "\nPlease enter a ADOPTad Mailbox Number";
			r = false;		
			}				
		if(r == false) {
			alert("The following must be completed first:\n"+e);
		} else {
			r = chkClick(document.frmSchMemType);
		}
		return r;
}

function validate_TAF(x) {
		
		// here is where you may wish to include more sophisticated checking, particularly of the email address.
		var e = "";
		var r = true;		
		
		if(x.txtFriendName.value == "") {
			e += "\nPlease enter a FRIEND NAME";
			r = false;		
			}					
		if((x.txtFriendEmail.value == "") || (x.txtFriendEmail.value.indexOf('@', 0) == -1) || (x.txtFriendEmail.value.indexOf('.', 0) == -1)) {
			e += "\nPlease enter Friend`s valid EMAIL ID";
			r = false;		
		}
		if(x.txtYourName.value == "") {
			e += "\nPlease enter a YOUR NAME";
			r = false;		
			}								
		if((x.txtYourEmail.value == "") || (x.txtYourEmail.value.indexOf('@', 0) == -1) || (x.txtYourEmail.value.indexOf('.', 0) == -1)) {
			e += "\nPlease enter Your valid EMAIL ID";
			r = false;		
		}			
		if(r == false) {
			alert("The following must be completed first:\n"+e);
			}
		return r;
}

function validate_FBS(x) {
		
		// here is where you may wish to include more sophisticated checking, particularly of the email address.
		var e = "";
		var r = true;		
		
		if(x.txtName.value == "") {
			e += "\nPlease enter a NAME";
			r = false;		
			}					
		if(x.txtStreet.value == "") {
			e += "\nPlease enter a STREET";
			r = false;		
			}
		if(x.txtCity.value == "") {
			e += "\nPlease enter a CITY";
			r = false;		
			}
		if(x.txtState.value == "") {
			e += "\nPlease enter a STATE";
			r = false;		
			}		
		if(x.txtZip.value == "") {
			e += "\nPlease enter a ZIP";
			r = false;		
			}		
		if(x.txtCountry.value == "") {
			e += "\nPlease enter a COUNTRY";
			r = false;		
			}
		if(r == false) {
			alert("The following must be completed first:\n"+e);
			}
		return r;
}


function validate_TM(x) {
		
		// here is where you may wish to include more sophisticated checking, particularly of the email address.
		var e = "";
		var r = true;		
		
		if(x.ddlTestimonialFrom.selectedIndex != 2 && x.txtUsername.value == "") {
			e += "\nPlease enter a ADOPTads ID";
			r = false;		
			}					
		if((x.txtEmail.value == "") || (x.txtEmail.value.indexOf('@', 0) == -1) || (x.txtEmail.value.indexOf('.', 0) == -1)) {
			e += "\nPlease enter valid EMAIL ID";
			r = false;		
		}
		if(x.txtComments.value == "") {
			e += "\nPlease enter a Comments";
			r = false;		
			}										
		if(r == false) {
			alert("The following must be completed first:\n"+e);
			}
		return r;
}

function validate_CMT(x) {
		
		// here is where you may wish to include more sophisticated checking, particularly of the email address.
		var e = "";
		var r = true;		
		
		if(x.txtYourName.value == "") {
			e += "\nPlease enter a Name";
			r = false;		
			}					
		if((x.txtYourEmail.value == "") || (x.txtYourEmail.value.indexOf('@', 0) == -1) || (x.txtYourEmail.value.indexOf('.', 0) == -1)) {
			e += "\nPlease enter valid EMAIL ID";
			r = false;		
		}
		if(x.txtComments.value == "") {
			e += "\nPlease enter a Comments";
			r = false;		
			}										
		if(r == false) {
			alert("The following must be completed first:\n"+e);
			}
		return r;
}


function validate_AS(x) {
		
		// here is where you may wish to include more sophisticated checking, particularly of the email address.
		var e = "";
		var r = true;		
		
		if(x.txtAdoptiveName.value == "") {
			e += "\nPlease enter an AGENCY NAME/ATTORNEY NAME";
			r = false;		
		}					
		if(x.txtName.value == "") {
			e += "\nPlease enter CONTACT NAME";
			r = false;		
		}					
		if(x.txtPhone.value == "") {
			e += "\nPlease enter CONTACT NUMBER";
			r = false;		
		}					
		if(x.txtPWFirstName.value == "") {
			e += "\nPlease enter PREGNANT WOMAN`s FIRST NAME";
			r = false;		
		}							
		if(x.txtApproxCosts.value == "") {
			e += "\nPlease enter APPROXIMATE COSTS";
			r = false;		
		}							
		if(x.txtComments.value == "") {
			e += "\nPlease enter BRIEF DESCRIPTION";
			r = false;		
		}						
		if(x.ddlDueMonth.selectedIndex == 0) {
			e += "\nPlease select a DUE MONTH";
			r = false;		
		}
		if(x.ddlDueYear.selectedIndex == 0) {
			e += "\nPlease select a DUE YEAR";
			r = false;		
		} 										
		if(r == false) {
			alert("The following must be completed first:\n"+e);
			}
		return r;
}
		
function validate_AL(x) {
		
		// here is where you may wish to include more sophisticated checking, particularly of the email address.
		var e = "";
		var r = true;		
		
		if(x.txtName.value == "") {
			e += "\nPlease enter Your NAME";
			r = false;		
		}					
		if(x.txtAddress1.value == "") {
			e += "\nPlease enter Your ADDRESS";
			r = false;		
		}					
		if(x.txtCity.value == "") {
			e += "\nPlease enter CITY";
			r = false;		
		}					
		if(x.ddlState.selectedIndex == 0) {
			e += "\nPlease select a STATE";
			r = false;		
		}
		if(x.txtZip.value == "") {
			e += "\nPlease select ZIP CODE";
			r = false;		
		}
		if(x.txtPhone.value == "") {
			e += "\nPlease enter TELEPHONE NUMBER";
			r = false;		
		}							
		if(x.ddlLinkType.selectedIndex != 2) {		
			if(x.txtTollPhone.value == "") {
				e += "\nPlease enter BIRTHPARENT TOLL FREE NUMBER";
				r = false;		
			}		
			if(x.txtAdoptiveParentNumber.value == "") {
				e += "\nPlease enter ADOPTIVE PARENT NUMBER";
				r = false;		
			}		
		}		
		if((x.txtEmail.value == "") || (x.txtEmail.value.indexOf('@', 0) == -1) || (x.txtEmail.value.indexOf('.', 0) == -1)) {
			e += "\nPlease enter valid EMAIL ID";
			r = false;		
		}
		if(x.txtWebsite.value == "") {
			e += "\nPlease enter WEBSITE";
			r = false;		
		}													
		if(x.txtComments.value == "") {
			e += "\nPlease enter BRIEF DESCRIPTION";
			r = false;		
		}								
		if(r == false) {
			alert("The following must be completed first:\n"+e);
			}
		return r;
}
				
function validate_NE(x) {
		
		// here is where you may wish to include more sophisticated checking, particularly of the email address.
		var e = "";
		var r = true;		
		
		if(x.txtPWFirstName.value == "") {
			e += "\nPlease enter PREGNANT WOMAN`s FIRST NAME";
			r = false;		
		}					
		if(x.ddlDueMonth.selectedIndex == 0) {
			e += "\nPlease select a DUE MONTH";
			r = false;		
		}
		if(x.ddlDueYear.selectedIndex == 0) {
			e += "\nPlease select a DUE YEAR";
			r = false;		
		} 	
		if(x.ddlPWState.selectedIndex == 0) {
			e += "\nPlease enter PREGNANT WOMAN`s STATE";
			r = false;		
		}
		/*					
		if(x.txtAPName.value == "") {
			e += "\nPlease enter YOUR NAME";
			r = false;		
		}
		*/								
		if((x.txtAPEmail.value == "") || (x.txtAPEmail.value.indexOf('@', 0) == -1) || (x.txtAPEmail.value.indexOf('.', 0) == -1)) {
			e += "\nPlease enter valid YOUR EMAIL ID";
			r = false;		
		}
		if(r == false) {
			alert("The following must be completed first:\n"+e);
			}
		return r;
}
				
				
function validate_AAP(x) {
		
		// here is where you may wish to include more sophisticated checking, particularly of the email address.
		var e = "";
		var r = true;		
		
		if(x.txtName.value == "") {
			e += "\nPlease enter a YOUR NAME";
			r = false;		
			}								
		if((x.txtEmail.value == "") || (x.txtEmail.value.indexOf('@', 0) == -1) || (x.txtEmail.value.indexOf('.', 0) == -1)) {
			e += "\nPlease enter Your valid EMAIL ID";
			r = false;		
		}					
		if(x.txtPhone.value == "") {
			e += "\nPlease enter a YOUR Phone";
			r = false;		
			}		
		
		if(x.txtComments.value == "") {
			e += "\nPlease enter a YOUR QUESTION";
			r = false;		
		}		
		if(r == false) {
			alert("The following must be completed first:\n"+e);
		} else {
			r = chkClick(x)
		}
		
		return r;
}				