/*Javascript*/
var ajaxAvailable = false;
var xmlHttp = null;
initAjax();
var m_id=0;
function doR(id,r){ 
m_id = id;
if(ajaxAvailable){
doAjax('GET','http://www.mossaf.com/arate.php?id='+id+'&r='+r,ratingResult);
return false;
}
return true; 
} 
function ratingResult(data){ 
data=trim(data);
try{
var obj = document.getElementById('rate_'+m_id);
if(data=="0"){
obj.innerHTML="Previously Rated!";
}else if(data=="1"){
obj.innerHTML="Rating Saved!";
}else{
alert(data);
}
}catch(e){
}
}
function doAjax(type,url,action){
xmlHttp.open(type,url, true); 
xmlHttp.onreadystatechange = function() { 
if (xmlHttp.readyState == 4) { 
action(xmlHttp.responseText);
} 
}
xmlHttp.send(null); 
}
function initAjax(){
try{
xmlHttp=new XMLHttpRequest();
}catch (e){
try{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}catch (e){
try{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}catch (e){
ajaxAvailable = false;
}
}
}
ajaxAvailable = true;
}

var ratingon = "http://www.mossaf.com/images/ratingon.gif";
var ratingoff = "http://www.mossaf.com/images/ratingoff.gif";
var obj;
function ron(id,rt){
for(x=1;x<=5;x++){
obj = document.getElementById(id+'_'+x);
obj.origSRC = obj.src;
obj.src = ratingoff;
}
for(x=1;x<=rt;x++){
obj = document.getElementById(id+'_'+x);
obj.src = ratingon;
}
}
function roff(id,rt){
for(x=1;x<=5;x++){
obj = document.getElementById(id+'_'+x);
obj.src = obj.origSRC;
}
}

function trim(str){
return str.replace(/^s+|s+$/g, '');
}
