/*Javascript*/


function hover(img_name, img_src)
{
document[img_name].src = img_src;
}


function bookmarksite(title,url){
if (window.sidebar){
	window.sidebar.addPanel(title, url, "");
}else if(window.opera && window.print){ 
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
} else if(document.all){
	window.external.AddFavorite(url, title);
}
}

if(top.location!=document.location) top.location=document.location;


var ajaxAvailable = false;
var xmlHttp = null;
initAjax();
var m_id=0;
function doR(id,r){ 
m_id = id;
if(ajaxAvailable){
doAjax('GET','http://www.holylol.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.holylol.com/images/ratingon.gif";
var ratingoff = "http://www.holylol.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<=10;x++){
obj = document.getElementById(id+'_'+x);
obj.src = obj.origSRC;
}
}

function trim(str){
return str.replace(/^s+|s+$/g, '');
}