// JavaScript Document

function createObject() {
var request_type;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
request_type = new ActiveXObject("Microsoft.XMLHTTP");
}else{
request_type = new XMLHttpRequest();
}
return request_type;
}

var http = createObject();

var nocache = 0;
function insert(id, rating) {

document.getElementById('rating'+id).style.color="#666666"
document.getElementById('rating'+id).innerHTML = "You Voted "+rating+"/5"
nocache = Math.random();
http.open('get', '_cast_vote.php?id='+id+'&rating=' +rating+'&nocache = '+nocache);
http.send(null);
}
function flag(id) {
document.getElementById('inappropriate'+id).innerHTML = "You have flagged this!"
nocache = Math.random();
http.open('get', '_mark_inappropriate.php?id='+id+'&nocache = '+nocache);
http.send(null);
}
function isValidEmail(str) {
   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
}
