function check_rating_form() {
	var msg="";

	if ( isEmpty(document.getElementById('nickname') ) )
		msg += "- Please fill out your nickname.\n";
		
	if ( isEmpty(document.getElementById('city') ) )
		msg += "- Please fill out the city.\n";
		
	if ( isEmpty(document.getElementById('state') ) )
		msg += "- Please fill out the state.\n";
		
	if ( isEmpty(document.getElementById('comments') ) )
		msg += "- Please leave us your comments.\n";

	if ( msg.length > 1 ) {
		alert ( msg );	return false;
	}
	
	var sendstr = "1";
	
	sendstr += "&nickname="+htmlspecialchars(document.getElementById('nickname').value);
	sendstr += "&city="+htmlspecialchars(document.getElementById('city').value);
	sendstr += "&state="+htmlspecialchars(document.getElementById('state').value);
	sendstr += "&comments="+htmlspecialchars(document.getElementById('comments').value);
	sendstr += "&r1="+document.getElementById('rate1v').value;
	sendstr += "&r2="+document.getElementById('rate2v').value;
	sendstr += "&r3="+document.getElementById('rate3v').value;
	sendstr += "&r4="+document.getElementById('rate4v').value;
	sendstr += "&pid="+document.getElementById('pid').value;
	
	ratingRequest(sendstr);
	
	return true;
}

function hidediv(d) {
	document.getElementById(d).style.display = "none";
}

function showdiv(d) {
	document.getElementById(d).style.display = "block";
}

function isEmail ( emailField ) {
 emailpat = /^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9])+(\.[a-zA-Z0-9_-]+)+$/;
 if( !emailpat.test( emailField.value ) ) {
  return false;
 }
 return true;
}

function isEmpty(aTextField) {
	if ( (aTextField.value.length==0 ) || (aTextField.value==null) ) 
		return true;
	else
		return false;
}

function htmlspecialchars(p_string) {
	p_string = p_string.replace(/&/g, '[my_and]');
	p_string = p_string.replace(/</g, '[my_lt]');
	p_string = p_string.replace(/>/g, '[my_gt]');
	p_string = p_string.replace(/"/g, '[my_dq]');
	return p_string;
};
