// JavaScript Document

function popUp(URL){
winpops=window.open(URL,"","width=200,height=125,left=100,top=100,status=0,scrollbars=0,resizable=1,menubar=0,location=0,toolbar=0")
}


function popUp2(URL){
winpops=window.open(URL,"","width=200,height =450,left=100,top=100,status=0,scrollbars=0,resizable=1,menubar=0,location=0,toolbar=0")
}


function popUpFavorite(URL){
winpops=window.open(URL,"","width=200,height=100,left=100,top=100,status=0,scrollbars=0,resizable=1,menubar=0,location=0,toolbar=0")
}


function popComments(URL){
winpops=window.open(URL,"","width=440,height=400,left=100,top=100,status=0,scrollbars=1,resizable=1,menubar=0,location=0,toolbar=0")
}


function popRecoverPassword(URL){
winpops=window.open(URL,"","width=440,height=200,left=100,top=100,status=0,scrollbars=0,resizable=1,menubar=0,location=0,toolbar=0")
}

function popReportGame(URL){
winpops=window.open(URL,"","width=250,height=225,left=100,top=100,status=0,scrollbars=0,resizable=1,menubar=0,location=0,toolbar=0")
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}


// Nannette Thacker http://www.shiningstar.net
function confirmDeleteMessage()
{
var agree=confirm("Are you sure you wish to delete this message?");
if (agree)
	return true ;
else
	return false ;
}

// >> BEGIN AJAX Rating System by InvertedVertex << //
alreadyvoted=false;

function rategame(rating,gameid,addr) {

document.getElementById("ratetxt").innerHTML = "Skickar...";

var xmlhttp = false;

/*@cc_on @*/

/*@if (@_jscript_version >= 5)

	// JScript gives us Conditional compilation, we can cope with old IE versions.
	// and security blocked creation of the objects.

	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
	try {
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	} catch (E) {
		xmlhttp = false;
	}
}

/*@end @*/

if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	xmlhttp = new XMLHttpRequest();
}

if(!alreadyvoted){
	xmlhttp.open("GET", addr + 'includes/rategame.php?game=' + gameid + '&rating=' + rating,true);
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4) {
			var width = (parseFloat(xmlhttp.responseText)*20)+"%";
			setTimeout('document.getElementById("star-rating").innerHTML = "<li id=\'current-rating\' style=\'width:'+ width +';\'>Currently '+ xmlhttp.responseText +'/5 Stjärnor.</li>";',2000);
			setTimeout('document.getElementById("ratetxt").innerHTML = "Thanks for voting!";',2000);
			defaulttxt="<strong>"+xmlhttp.responseText+"/5 Stjärnor</strong>";
			setTimeout('document.getElementById("ratetxt").innerHTML = "<strong>'+xmlhttp.responseText+'/5 Stjärnor</strong>"',2000);
		}
	}
	xmlhttp.send(null)
}else{
	oldstr=document.getElementById("ratetxt").innerHTML;
	document.getElementById("ratetxt").innerHTML="You already voted!";
	setTimeout('document.getElementById("ratetxt").innerHTML = "'+defaulttxt+'"',1000);
}
	alreadyvoted=true;
}
// >> END AJAX Rating System by InvertedVertex << //

