// 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;
	}
}

// our 2 dollar function
function $2() {
	var elements = new Array();
	for (var i = 0; i < arguments.length; i++) {
		var element = arguments[i];
		if (typeof element == 'string')
			element = document.getElementById(element);
		if (arguments.length == 1)
			return element;
		elements.push(element);
	}
	return elements;
}
function toggle() {
	for ( var i=0; i < arguments.length; i++ ) {
		if($2(arguments[i]).style.display != 'none') {
			$2(arguments[i]).style.display = 'none';
		}
		else {
			$2(arguments[i]).style.display = '';
		}
	}
}
// Function to swap an image based on its current state
function toggleimg(toggleid,toggleimgid) {

	// This is the ID of the hidden item
	var toggleid = document.getElementById(toggleid);

	// This is the ID of the plus/minus button image
	var toggleimgid = document.getElementById(toggleimgid);
	
	if (toggleid.style.display != 'none') {
		toggleimgid.src = 'images/icons/arrow_down.gif';
		toggleimgid.title = 'Show';
	}
	else {
		toggleimgid.src = "images/icons/arrow_up.gif";
		toggleimgid.title = 'Hide';
	}
}
function rate_game(rating,gameid,addr)  {

  //var element = document.getElementById('current-rating');
  var element2 = document.getElementById('rate-stars');
  var element3 = document.getElementById('star-rating');
  //var element4 = document.getElementById('star-rating_actual');
  
  if (rating != '' && gameid != '')
  {
    AjaxRequest.get(
      {
        'url':'' + addr + 'includes/rate_game.php?game=' + gameid + '&rating=' + rating + ''
        ,'onLoading':function() {element.innerHTML='<span>Voting ...<br><br></span>';}
        ,'onSuccess':function(req){
			//element.style.width = req.responseText+'px';
			//element.innerHTML='<li id="current-rating" style="width:'+ req.responseText +'px;">Currently Rated</li>';
			element2.innerHTML='Your vote has been submitted.';
			rating_px = rating * 16;
			element3.innerHTML='<li id="current-rating" style="width:'+ req.responseText +'px;">You Rated ' + rating + '/5 Stars.</li>';
		}
      }
    );
  }
  else
  {
    element.innerHTML='';
  }
}
function checkName(name){

  var element = document.getElementById('name_check')
  
  if (name != '')
  {
    AjaxRequest.get(
      {
        'url':'includes/usercheck.php?type=name&name=' + name + ''
        ,'onLoading':function() {element.innerHTML='<span>Checking Name ...</span>';}
        ,'onSuccess':function(req){element.innerHTML=req.responseText; element.className = '';}
      }
    );
  }
  else
  {
    element.innerHTML='';
  }
}

function checkPass(pass,pass2){

  var element = document.getElementById('pass_check')
  
  if (pass != '' && pass2 != '')
  {
    AjaxRequest.get(
      {
        'url':'includes/usercheck.php?type=pass&pass='+pass+'&pass2='+pass2+''
        ,'onLoading':function() {element.innerHTML='<span>Checking Passwords...</span>';}
        ,'onSuccess':function(req){element.innerHTML=req.responseText; element.className = '';}
      }
    );
  }
  else
  {
    element.innerHTML='';
  }
}

function checkEmail(email,email2){

  var element = document.getElementById('email_check')
  
  if (email != '' && email2 != '')
  {
    AjaxRequest.get(
      {
        'url':'includes/usercheck.php?type=email&email='+email+'&email2='+email2+''
        ,'onLoading':function() {element.innerHTML='<span>Checking Email Address ...</span>';}
        ,'onSuccess':function(req){element.innerHTML=req.responseText; element.className = '';}
      }
    );
  }
  else
  {
    element.innerHTML='';
  }
}

//-->