function valPrflFrm() {
var emptyString = /^\s*$/;
missinginfo = "";

if ( ( (document.srch_prfls.player_name.value == "")  || (emptyString.test(document.srch_prfls.player_name.value)) || (document.srch_prfls.player_name.value == "Player Name") ) &&
	  (document.srch_prfls.player_state[document.srch_prfls.player_state.selectedIndex].value == "#") &&
      ( (document.srch_prfls.player_school.value == "")  || (emptyString.test(document.srch_prfls.player_school.value)) || (document.srch_prfls.player_school.value == "High School") ) &&
	  (document.srch_prfls.player_class[document.srch_prfls.player_class.selectedIndex].value == "#") &&
	  (document.srch_prfls.player_position[document.srch_prfls.player_position.selectedIndex].value == "#") )
{
missinginfo += "\n     -  Please Enter a Search Criteria";
}

if (missinginfo != "") {
missinginfo ="_____________________________\n" +
"You failed to correctly fill in your:\n" +
missinginfo + "\n_____________________________" +
"\nPlease re-enter and submit again!";
alert(missinginfo);
return false;
}
else return true;
}

function checkFieldsContact() {
var emptyString = /^\s*$/;
missinginfo = "";

if ( (document.frm_contact.name.value == "")  || (emptyString.test(document.frm_contact.name.value))  ) {
missinginfo += "\n     -  Name";
}

if ( (document.frm_contact.phone.value == "")  || (emptyString.test(document.frm_contact.phone.value))  ) {
missinginfo += "\n     -  Phone Number";
}

if ((document.frm_contact.email.value == "") || 
(document.frm_contact.email.value.indexOf('@') == -1) || 
(document.frm_contact.email.value.indexOf('.') == -1) ||
(emptyString.test(document.frm_contact.email.value)) ) {
missinginfo += "\n     -  Email Address";
}

if(  (document.frm_contact.phrase.value == "") || (emptyString.test(document.frm_contact.phrase.value))  ) {
missinginfo += "\n     -  Authentication Phrase";
}

if (missinginfo != "") {
missinginfo ="_____________________________\n" +
"You failed to correctly fill in your:\n" +
missinginfo + "\n_____________________________" +
"\nPlease re-enter and submit again!";
alert(missinginfo);
return false;
}
else return true;
}

/********************* Ajax Function ****************************************/

function getXMLHTTP() { //fuction to return the xml http object
		var xmlhttp=false;	
		try{
			xmlhttp=new XMLHttpRequest();
		}
		catch(e)	{		
			try{			
				xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				try{
				xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch(e1){
					xmlhttp=false;
				}
			}
		}
		 	
		return xmlhttp;
    }
	
	function getNews(state, limit) {
		var strURL="/myincludes/filter_News.php?st=" + state + "&limit=" + limit;
		var req = getXMLHTTP();
		
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {						
						document.getElementById('headlines_content').innerHTML=req.responseText;
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}				
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}		
	}
	
	function getEvents(state) {
		var strURL="/myincludes/filter_Events.php?st=" + state;
		var req = getXMLHTTP();
		
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {						
						document.getElementById('events_content').innerHTML=req.responseText;
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}				
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}		
	}
	
	function getRankingByUrl(pclass, url, lim, site) {
		var strURL="/myincludes/filter_Ranking.php?pclass=" + pclass + "&url=" + url + "&lim=" + lim + "&site=" + site ;
		var req = getXMLHTTP();
		
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {						
						document.getElementById('ranking_container').innerHTML=req.responseText;
						//$j('#ranking_class').customStyle();
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}				
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}		
	}
	
	function getHomeRanking(pclass, hm, lim, site) {
		var strURL="/myincludes/filter_Ranking.php?pclass=" + pclass + "&hm=" + hm + "&lim=" + lim + "&site=" + site ;
		var req = getXMLHTTP();
		
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {						
						document.getElementById('rankings').innerHTML=req.responseText;
						$j('#ranking_class').customStyle();
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}				
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}		
	}
	
	function getNativeRanking(pclass, rk, lim, site) {
		var strURL="/myincludes/filter_Ranking.php?pclass=" + pclass + "&rk=" + rk + "&lim=" + lim + "&site=" + site ;
		var req = getXMLHTTP();
		
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {						
						document.getElementById('ranking_container').innerHTML=req.responseText;
						$j('#ranking_class').customStyle();
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}				
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}		
	}
	
	function getRankingBySite(pclass, lim, site) {
		var strURL="/myincludes/filter_Ranking.php?pclass=" + pclass + "&lim=" + lim + "&site=" + site ;
		var req = getXMLHTTP();
		
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {						
						document.getElementById('ranking_container').innerHTML=req.responseText;
						$j('#ranking_class').customStyle();
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}				
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}		
	}
	
	function getCommitments(state, lim, pclass, commit_page) {
		var strURL="/myincludes/filter_Commitments.php?site=" + state + "&lim=" + lim + "&pclass=" + pclass + "&pg=" + commit_page;
		var req = getXMLHTTP();
		
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {						
						document.getElementById('commitment_container').innerHTML=req.responseText;
						$j('#ranking_class').customStyle();
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}				
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}		
	}
