//top banner rollovers
$(function() {
		   $("img.bannerLink").hover(
 function()
 {
  this.src = this.src.replace("Banner","Rollover");
 },
 function()
 {
  this.src = this.src.replace("Rollover","Banner");
 }
);
		   
		/*   $('#blurText, .loginUsername').each(function() {
    var default_value = this.value;
    $(this).css('color', '#888');
	$(this).css('font-style', 'italic');// this could be in the style sheet instead
    $(this).focus(function() {
        if(this.value == default_value) {
            this.value = '';
            $(this).css('color', '#000');
			$(this).css('font-style', 'normal');
        }
    });
    $(this).blur(function() {
        if(this.value == '') {
            $(this).css('color', '#888');
			$(this).css('font-style', 'italic');
            this.value = default_value;
        }
    });
}); */
		 
		   });


//shorten names
//$(function() {
//		   $('a[title="Cyclops Cupbear Extreeem!!!"]').text('Cyclops Cupbear');
//		  });

														   	   
//the bar notification/point system
$(function() {
$('.pointBox').hover(function()
{
  $(this).css("background-image", "url(http://thesidehatch.com/images/achievements/pointsRollover.jpg)");  
    $('.insidePointBox').css("left", "5px"); 
},
function()
{
	$(this).css("background-image", "url(http://thesidehatch.com/images/achievements/pointsBanner.jpg)");
	$('.insidePointBox').css("left", "30px");   
});
});


$(function() {
		   //change the default message if they have messages
		   if ( $("#messageImageNew").length > 0 )
		   {
			   $(".barNotifications").text("You have unread messages.");
		   }
		   
		   if ( $(".gamePage").length > 0 )
		   {

			   var pointVariable = 0;



			   $(this).everyTime("120s", "gamePointTimer", function() {
				     
			  	 $.ajax({
		   				async: true,
		   				type: "POST",
						url : "http://www.thesidehatch.com/includes/addPoint.php",
						success : function (response) {
							if(response=="tooManyPoints")
							{
								$('.pointBox').css("background-image", "url(http://thesidehatch.com/images/achievements/pointsRollover.jpg)"); 
							  	$('.insidePointBox').css("left", "5px"); 
								$("#pointsHeading").html("Max <br /> Daily Points");
								$("#pointsText").text('');
							}
							else if(response=="tooSoon")
							{
								$('.pointBox').css("background-image", "url(http://thesidehatch.com/images/achievements/pointsRollover.jpg)"); 
							  	$('.insidePointBox').css("left", "5px"); 
								$("#pointsHeading").text("Multiple Games Open");
								$("#pointsText").text('');
							}
							else
							{
	  						 pointVariable += 1;
							  $("#pointsText").text(pointVariable);
							  $("#pointsHeading").text("Points:");
							  $('.pointBox').css("background-image", "url(http://thesidehatch.com/images/achievements/pointsRollover.jpg)"); 
							  $('.insidePointBox').css("left", "5px"); 
							  $('.pointBox').oneTime("8s", "closeBox", function() {
								  	$(this).css("background-image", "url(http://thesidehatch.com/images/achievements/pointsBanner.jpg)");
									$('.insidePointBox').css("left", "30px"); 
							  	});
							}
			 	 			

							}
						}); 
			
				   }, 10);
			   
			   
		   }
		   
		   

		   
		   
});


//tool tips
$(function() {
//use livequery so i can access even when it's been changed
$('.rollover').livequery(function(){
  $(this).cluetip({tracking: true});
								  });

$('.arcsh1').livequery(function(){
  $(this).cluetip({tracking: true});
								  });

$('.rolloverMini').cluetip({tracking: true});
		  

$('.popularMini').cluetip({tracking: true});
		   });


//rating
$(function() {
if($('#demo1').length > 0)
{
$('#demo1').rater('/includes/insertrating.php', gameid, {maxvalue:10, curvalue:curRating});
}
});


//registration form validation
$(function() {
		   $("input#newusername").select().focus();
  $('.error').hide();
  $('input.text-input').css({backgroundColor:"#FFFFFF"});
  $('input.text-input').focus(function(){
    $(this).css({backgroundColor:"#FFDDAA"});
  });
  $('input.text-input').blur(function(){
    $(this).css({backgroundColor:"#FFFFFF"});
  });

  $("#register_submit").click(function() {
		// validate and process form
		// first hide any error messages
		
   $('.error').hide();
	
	var stopLoadEmail = false;
	var stopLoadUsername = false;

	  var newusername = $("input#newusername").val();
		if (newusername == "") {
      $("label#usernamename_error").show();
      $("input#username").focus();
      return false;
    }
	//make sure username isn't taken
	$.ajax({
		   async: false,
		   type: "POST",
	url : "includes/validateUsername.php",
	data: "username=" + newusername,
	success : function (data) {
	
	   if(data=="usernameError")
		  {
		     $("label#username_errorDupl").show();
			 stopLoadUsername = true;
		  }
		  else
		  {
			  stopLoadUsername = false;
		  }

	}
	}); 
	
	var newpasswordone = $("input#newpasswordone").val();
		if (newpasswordone == "") {
      $("label#passwordOne_error").show();
      $("input#newpasswordone").focus();
      return false;
    }
	
	var newpasswordtwo = $("input#newpasswordtwo").val();
		if (newpasswordtwo == "") {
      $("label#passwordTwo_error").show();
      $("input#newpasswordtwo").focus();
      return false;
    }
	//check if passwords are the same
	if (newpasswordone != newpasswordtwo) {
		$("label#passwordTwo_errorMatch").show();
		return false;
	}
	
	var firstName = $("input#firstName").val();
		if (firstName == "") {
      $("label#firstName_error").show();
      $("input#firstName").focus();
      return false;
    }
	
	var lastName = $("input#lastName").val();
		if (lastName == "") {
      $("label#lastName_error").show();
      $("input#lastName").focus();
      return false;
    }
	
	var firstStreet = $("input#firstStreet").val();
		if (firstStreet == "") {
      $("label#firstStreet_error").show();
      $("input#firstStreet").focus();
      return false;
    }
	
	var secondStreet = $("input#secondStreet").val();
		if (secondStreet == "") {
      $("label#secondStreet_error").show();
      $("input#secondStreet").focus();
      return false;
    }
	
	var city = $("input#city").val();
		if (city == "") {
      $("label#city_error").show();
      $("input#city").focus();
      return false;
    }
	
	
	var state = $("#state").val();
	if (state == "None") {
      $("label#state_error").show();
      $("input#state").focus();
      return false;
    }
	
	
	
	var zipCode = $("input#zipCode").val();
		if (zipCode == "") {
      $("label#zipCode_error").show();
      $("input#zipCode").focus();
      return false;
    }
	
	var newemailaddress = $("input#newemailaddress").val();
		if (newemailaddress == "") {
      $("label#email_error").show();
      $("input#newemailaddress").focus();
      return false;
    }
	//check if email address is valid
	if (!/.+@.+\.[a-zA-Z]{2,4}?/.test(newemailaddress)) {
	$("label#email_errorInval").show();
	$("input#newemailaddress").focus();
	return false;
									  }
	//check to see if email address is taken
	
	$.ajax({
		   async: false,
		   type: "POST",
	url : "includes/validateEmail.php",
	data: "email=" + newemailaddress,
	success : function (data) {
	
	   if(data=="emailError")
		  {
		     $("label#email_errorDupl").show();
			 stopLoadEmail = true;
			 return false;
		  }
		  else
		  {
			  stopLoadEmail = false;
		  }

	}
	}); 
	
	//variables to stop the load from the ajax calls
	if(stopLoadEmail == true) 
	{
		return false;
	}
	if(stopLoadUsername == true) 
	{
		return false;
	}

		

	});
});

//order games
$(function() {
		   //boldify the right one

		 
if(currentOrder == "gametitle ASC")
{
	$("span.#orderName").css("font-weight","bold");
}

if(currentOrder == "rating DESC")
{
	$("span.#orderRating").css("font-weight","bold");
}

if(currentOrder == "dateadded DESC")
{
	$("span.#orderDate").css("font-weight","bold");
}

if(currentOrder == "timesplayed DESC")
{
	$("span.#orderTimes").css("font-weight","bold");
}

	
		   //rating
	$("span.#orderRating").click(function() {
		$.ajax({
		   async: false,
		   type: "POST",
	url : "../../../includes/changeOrder.php",
	data: "order=rating DESC",
	success : function (data) {
	location.reload(); 

	}
	}); 
		   
	})
	//alphabetical
	$("span.#orderName").click(function() {
		$.ajax({
		   async: false,
		   type: "POST",
	url : "../../../includes/changeOrder.php",
	data: "order=gametitle ASC",
	success : function (data) {
	location.reload(); 
	}
	}); 
		   
	})
	//date added
	$("span.#orderDate").click(function() {
		$.ajax({
		   async: false,
		   type: "POST",
	url : "../../../includes/changeOrder.php",
	data: "order=dateadded DESC",
	success : function (data) {
	location.reload(); 
	}
	}); 
		})
		//times played
	$("span.#orderTimes").click(function() {
		$.ajax({
		   async: false,
		   type: "POST",
	url : "../../../includes/changeOrder.php",
	data: "order=timesplayed DESC",
	success : function (data) {
	location.reload(); 
	}
	}); 
		   
	})
});

//Ajaxify game comments
$(function() {

		   //for some reason this didn't work in css..
		   $("#commentButton").hover(function() {
			$("#commentButton").attr("src", "http://www.thesidehatch.com/images/addcomment_btn6.png");
											  });
		   
		   $("#commentButton").mouseleave(function() {
			$("#commentButton").attr("src", "http://www.thesidehatch.com/images/addcomment_btn5.png");
											  });

		   
	$("#commentButton").click(function() {
		var newcomment = $("textarea#newcomment").val();
		   var id = $("input#id").val();
		   var verifycode = $("input#verifycode").val();
			$.ajax({
		   type: "POST",
	url : "../../../includes/insertComment.php",
	data: "newcomment=" + newcomment + "&id=" + id + "&verifycode=" + verifycode,
	success : function (data) {
		if(data=="commentPoint")
		  {
			  $("#commentButton").slideUp();
		     $("#commentTest").html("You've earned 1 point for commenting!");
			 $("#commentTest").css("color","green");
		  }
		  else if(data=="verificationError")
		  {
			  $("#commentButton").slideUp();
		     $("#commentTest").html("We're sorry, but it seems the verification code was incorrect.  For security purposes you'll need to reload the page to try again.  Sorry for the inconvenience.");
			$("#commentTest").css("color","red");
		  }
		  else
		  {
			  $("#commentButton").slideUp();
			  $("#commentTest").html("Thank you for your comment");
			  $("#commentTest").css("color","blue");

		  }
			 

	}
	
	}); 
		return false;   
	})							 

		   
});
//.css("border","3px solid red");
//main page ordering
$(function() {	

		   
		   //change the ordering stuff to bold for the one that's automatically selected at the start
		   $(".orderRating").css("font-weight","bold");
		   
		   
		   //ACTION
		   var ActionGamesStart = 0;
		   //fade left arrow if can't go left
		   //if there is a row for action then..
		   if ( $("#ActionTR").length > 0 )
		   {
		   if (ActionGamesStart <= 5)
		   {
			   $("#ActionTR > .arrowLeft").fadeTo("fast", .3)
		   }		   
	$("#Action > .mainPageSorting > .orderRating").livequery('click', function(event) { 
	$("#ActionTR > .mainSmallGameText").fadeTo("normal", .01, function() {
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=2&order=rating DESC",
	success : function (data) {
		$("#ActionTR").html(data);
		if (ActionGamesStart <= 5)
		   {
			   $("#ActionTR > .arrowLeft").fadeTo("fast", .3)
		   }
		   $("#Action > .mainPageSorting > .orderRating").css("font-weight","normal");
		   $("#Action > .mainPageSorting > .orderDate").css("font-weight","normal");
		   $("#Action > .mainPageSorting > .orderTimes").css("font-weight","normal");
		   $("#Action > .mainPageSorting > .orderName").css("font-weight","normal");

		   $("#Action > .mainPageSorting > .orderRating").css("font-weight","bold");
	}
	});
	});
	}) 
	

	$("#Action > .mainPageSorting > .orderTimes").livequery('click', function(event) { 
	$("#ActionTR > .mainSmallGameText").fadeTo("normal", .01, function() {
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=2&order=timesplayed DESC",
	success : function (data) {
		$("#ActionTR").html(data);
		if (ActionGamesStart <= 5)
		   {
			   $("#ActionTR > .arrowLeft").fadeTo("fast", .3)
		   }
		   
		   $("#Action > .mainPageSorting > .orderRating").css("font-weight","normal");
		   $("#Action > .mainPageSorting > .orderDate").css("font-weight","normal");
		   $("#Action > .mainPageSorting > .orderTimes").css("font-weight","normal");
		   $("#Action > .mainPageSorting > .orderName").css("font-weight","normal");

		   $("#Action > .mainPageSorting > .orderTimes").css("font-weight","bold");
	}
	});
	});
	})
	

	$("#Action > .mainPageSorting > .orderDate").livequery('click', function(event) { 
	$("#ActionTR > .mainSmallGameText").fadeTo("normal", .01, function() {
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=2&order=dateadded DESC",
	success : function (data) {
		$("#ActionTR").html(data);
		if (ActionGamesStart <= 5)
		   {
			   $("#ActionTR > .arrowLeft").fadeTo("fast", .3)
		   }
		   
		   $("#Action > .mainPageSorting > .orderRating").css("font-weight","normal");
		   $("#Action > .mainPageSorting > .orderDate").css("font-weight","normal");
		   $("#Action > .mainPageSorting > .orderTimes").css("font-weight","normal");
		   $("#Action > .mainPageSorting > .orderName").css("font-weight","normal");

		   $("#Action > .mainPageSorting > .orderDate").css("font-weight","bold");
	}
	});
	});
	})
	

	$("#Action > .mainPageSorting > .orderName").livequery('click', function(event) { 
	$("#ActionTR > .mainSmallGameText").fadeTo("normal", .01, function() {
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=2&order=gametitle ASC",
	success : function (data) {
		$("#ActionTR").html(data);
		if (ActionGamesStart <= 5)
		   {
			   $("#ActionTR > .arrowLeft").fadeTo("fast", .3)
		   }
		   
		   $("#Action > .mainPageSorting > .orderRating").css("font-weight","normal");
		   $("#Action > .mainPageSorting > .orderDate").css("font-weight","normal");
		   $("#Action > .mainPageSorting > .orderTimes").css("font-weight","normal");
		   $("#Action > .mainPageSorting > .orderName").css("font-weight","normal");

		   $("#Action > .mainPageSorting > .orderName").css("font-weight","bold");
	}
	});
	});
	})

	
	//Arrow LEFT ACTION
	//$("#ActionTR > .arrowLeft").css("border","3px solid red");
	$("#ActionTR > .arrowLeft").livequery('click', function(event) { 
	if(ActionGamesStart >= 5)
	{
	ActionGamesStart -= 5;
	$("#ActionTR > .mainSmallGameText").fadeTo("normal", .01, function() { 
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=2&gamesStart=" + ActionGamesStart,
	success : function (data) {
		$("#ActionTR").html(data);
		if (ActionGamesStart <= 4)
		   {
			   $("#ActionTR > .arrowLeft").fadeTo("fast", .3)
		   }	
	}
	});
	});
	}
	}) 
	//Arrow RIGHT ACTION
	$("#ActionTR > .arrowRight").livequery('click', function(event) { 
	ActionGamesStart += 5;
	$("#ActionTR > .mainSmallGameText").fadeTo("normal", .01, function() {
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=2&gamesStart=" + ActionGamesStart,
	success : function (data) {
		$("#ActionTR").html(data);
	}
	});
	});
	}) 
	
	
	
	////////////////////////////////////PUZZLE////////////////////////
		   var PuzzleGamesStart = 0;
		   //fade left arrow if can't go left
		   if (PuzzleGamesStart <= 6)
		   {
			   $("#PuzzleTR > .arrowLeft").fadeTo("fast", .3)
		   }		   
	$("#Puzzle > .mainPageSorting > .orderRating").livequery('click', function(event) { 
	$("#PuzzleTR > .mainSmallGameText").fadeTo("normal", .01, function() {
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=6&order=rating DESC",
	success : function (data) {
		$("#PuzzleTR").html(data);
		if (PuzzleGamesStart <= 5)
		   {
			   $("#PuzzleTR > .arrowLeft").fadeTo("fast", .3)
		   }
		   
		   $("#Puzzle > .mainPageSorting > .orderRating").css("font-weight","normal");
		   $("#Puzzle > .mainPageSorting > .orderDate").css("font-weight","normal");
		   $("#Puzzle > .mainPageSorting > .orderTimes").css("font-weight","normal");
		   $("#Puzzle > .mainPageSorting > .orderName").css("font-weight","normal");

		   $("#Puzzle > .mainPageSorting > .orderRating").css("font-weight","bold");
	}
	});
	});
	}) 
	

	$("#Puzzle > .mainPageSorting > .orderTimes").livequery('click', function(event) { 
	$("#PuzzleTR > .mainSmallGameText").fadeTo("normal", .01, function() {
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=6&order=timesplayed DESC",
	success : function (data) {
		$("#PuzzleTR").html(data);
		if (PuzzleGamesStart <= 6)
		   {
			   $("#PuzzleTR > .arrowLeft").fadeTo("fast", .3)
		   }
		   
		   	$("#Puzzle > .mainPageSorting > .orderRating").css("font-weight","normal");
		   $("#Puzzle > .mainPageSorting > .orderDate").css("font-weight","normal");
		   $("#Puzzle > .mainPageSorting > .orderTimes").css("font-weight","normal");
		   $("#Puzzle > .mainPageSorting > .orderName").css("font-weight","normal");

		   $("#Puzzle > .mainPageSorting > .orderTimes").css("font-weight","bold");
	}
	});
	});
	})
	

	$("#Puzzle > .mainPageSorting > .orderDate").livequery('click', function(event) { 
	$("#PuzzleTR > .mainSmallGameText").fadeTo("normal", .01, function() {
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=6&order=dateadded DESC",
	success : function (data) {
		$("#PuzzleTR").html(data);
		if (PuzzleGamesStart <= 6)
		   {
			   $("#PuzzleTR > .arrowLeft").fadeTo("fast", .3)
		   }
		   
		   		   $("#Puzzle > .mainPageSorting > .orderRating").css("font-weight","normal");
		   $("#Puzzle > .mainPageSorting > .orderDate").css("font-weight","normal");
		   $("#Puzzle > .mainPageSorting > .orderTimes").css("font-weight","normal");
		   $("#Puzzle > .mainPageSorting > .orderName").css("font-weight","normal");

		   $("#Puzzle > .mainPageSorting > .orderDate").css("font-weight","bold");
	}
	});
	});
	})
	

	$("#Puzzle > .mainPageSorting > .orderName").livequery('click', function(event) { 
	$("#PuzzleTR > .mainSmallGameText").fadeTo("normal", .01, function() {
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=6&order=gametitle ASC",
	success : function (data) {
		$("#PuzzleTR").html(data);
		if (PuzzleGamesStart <= 6)
		   {
			   $("#PuzzleTR > .arrowLeft").fadeTo("fast", .3)
		   }
		   
		   		   $("#Puzzle > .mainPageSorting > .orderRating").css("font-weight","normal");
		   $("#Puzzle > .mainPageSorting > .orderDate").css("font-weight","normal");
		   $("#Puzzle > .mainPageSorting > .orderTimes").css("font-weight","normal");
		   $("#Puzzle > .mainPageSorting > .orderName").css("font-weight","normal");

		   $("#Puzzle > .mainPageSorting > .orderName").css("font-weight","bold");
	}
	});
	});
	})

	
	//Arrow LEFT Puzzle
	//$("#PuzzleTR > .arrowLeft").css("border","3px solid red");
	$("#PuzzleTR > .arrowLeft").livequery('click', function(event) { 
	if(PuzzleGamesStart >= 5)
	{
	PuzzleGamesStart -= 5;
	$("#PuzzleTR > .mainSmallGameText").fadeTo("normal", .01, function() { 
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=6&gamesStart=" + PuzzleGamesStart,
	success : function (data) {
		$("#PuzzleTR").html(data);
		if (PuzzleGamesStart <= 4)
		   {
			   $("#PuzzleTR > .arrowLeft").fadeTo("fast", .3)
		   }	
	}
	});
	});
	}
	}) 
	//Arrow RIGHT Puzzle
	$("#PuzzleTR > .arrowRight").livequery('click', function(event) { 
	PuzzleGamesStart += 5;
	$("#PuzzleTR > .mainSmallGameText").fadeTo("normal", .01, function() {
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=6&gamesStart=" + PuzzleGamesStart,
	success : function (data) {
		$("#PuzzleTR").html(data);
	}
	});
	});
	}) 
	
	////////////////////////////////////Shooter////////////////////////
		   var ShooterGamesStart = 0;
		   //fade left arrow if can't go left
		   if (ShooterGamesStart <= 6)
		   {
			   $("#ShooterTR > .arrowLeft").fadeTo("fast", .3)
		   }		   
	$("#Shooter > .mainPageSorting > .orderRating").livequery('click', function(event) { 
	$("#ShooterTR > .mainSmallGameText").fadeTo("normal", .01, function() {
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=4&order=rating DESC",
	success : function (data) {
		$("#ShooterTR").html(data);
		if (ShooterGamesStart <= 5)
		   {
			   $("#ShooterTR > .arrowLeft").fadeTo("fast", .3)
		   }
		   
		   		   $("#Shooter > .mainPageSorting > .orderRating").css("font-weight","normal");
		   $("#Shooter > .mainPageSorting > .orderDate").css("font-weight","normal");
		   $("#Shooter > .mainPageSorting > .orderTimes").css("font-weight","normal");
		   $("#Shooter > .mainPageSorting > .orderName").css("font-weight","normal");

		   $("#Shooter > .mainPageSorting > .orderRating").css("font-weight","bold");
	}
	});
	});
	}) 
	

	$("#Shooter > .mainPageSorting > .orderTimes").livequery('click', function(event) { 
	$("#ShooterTR > .mainSmallGameText").fadeTo("normal", .01, function() {
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=4&order=timesplayed DESC",
	success : function (data) {
		$("#ShooterTR").html(data);
		if (ShooterGamesStart <= 6)
		   {
			   $("#ShooterTR > .arrowLeft").fadeTo("fast", .3)
		   }
		   
		    $("#Shooter > .mainPageSorting > .orderRating").css("font-weight","normal");
		   $("#Shooter > .mainPageSorting > .orderDate").css("font-weight","normal");
		   $("#Shooter > .mainPageSorting > .orderTimes").css("font-weight","normal");
		   $("#Shooter > .mainPageSorting > .orderName").css("font-weight","normal");

		   $("#Shooter > .mainPageSorting > .orderTimes").css("font-weight","bold");
	}
	});
	});
	})
	

	$("#Shooter > .mainPageSorting > .orderDate").livequery('click', function(event) { 
	$("#ShooterTR > .mainSmallGameText").fadeTo("normal", .01, function() {
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=4&order=dateadded DESC",
	success : function (data) {
		$("#ShooterTR").html(data);
		if (ShooterGamesStart <= 6)
		   {
			   $("#ShooterTR > .arrowLeft").fadeTo("fast", .3)
		   }
		   
		    $("#Shooter > .mainPageSorting > .orderRating").css("font-weight","normal");
		   $("#Shooter > .mainPageSorting > .orderDate").css("font-weight","normal");
		   $("#Shooter > .mainPageSorting > .orderTimes").css("font-weight","normal");
		   $("#Shooter > .mainPageSorting > .orderName").css("font-weight","normal");

		   $("#Shooter > .mainPageSorting > .orderDate").css("font-weight","bold");
	}
	});
	});
	})
	

	$("#Shooter > .mainPageSorting > .orderName").livequery('click', function(event) { 
	$("#ShooterTR > .mainSmallGameText").fadeTo("normal", .01, function() {
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=4&order=gametitle ASC",
	success : function (data) {
		$("#ShooterTR").html(data);
		if (ShooterGamesStart <= 6)
		   {
			   $("#ShooterTR > .arrowLeft").fadeTo("fast", .3)
		   }
		   
		    $("#Shooter > .mainPageSorting > .orderRating").css("font-weight","normal");
		   $("#Shooter > .mainPageSorting > .orderDate").css("font-weight","normal");
		   $("#Shooter > .mainPageSorting > .orderTimes").css("font-weight","normal");
		   $("#Shooter > .mainPageSorting > .orderName").css("font-weight","normal");

		   $("#Shooter > .mainPageSorting > .orderName").css("font-weight","bold");
	}
	});
	});
	})

	
	//Arrow LEFT Shooter
	//$("#ShooterTR > .arrowLeft").css("border","3px solid red");
	$("#ShooterTR > .arrowLeft").livequery('click', function(event) { 
	if(ShooterGamesStart >= 5)
	{
	ShooterGamesStart -= 5;
	$("#ShooterTR > .mainSmallGameText").fadeTo("normal", .01, function() { 
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=4&gamesStart=" + ShooterGamesStart,
	success : function (data) {
		$("#ShooterTR").html(data);
		if (ShooterGamesStart <= 4)
		   {
			   $("#ShooterTR > .arrowLeft").fadeTo("fast", .3)
		   }	
	}
	});
	});
	}
	}) 
	//Arrow RIGHT Shooter
	$("#ShooterTR > .arrowRight").livequery('click', function(event) { 
	ShooterGamesStart += 5;
	$("#ShooterTR > .mainSmallGameText").fadeTo("normal", .01, function() {
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=4&gamesStart=" + ShooterGamesStart,
	success : function (data) {
		$("#ShooterTR").html(data);
	}
	});
	});
	}) 
	
	
	
	////////////////////////////////////Sports/Racing////////////////////////
		   var SportsGamesStart = 0;
		   //fade left arrow if can't go left
		   if (SportsGamesStart <= 6)
		   {
			   $("#SportsTR > .arrowLeft").fadeTo("fast", .3)
		   }		   
	$("#Sports > .mainPageSorting > .orderRating").livequery('click', function(event) { 
	$("#SportsTR > .mainSmallGameText").fadeTo("normal", .01, function() {
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=5&order=rating DESC",
	success : function (data) {
		$("#SportsTR").html(data);
		if (SportsGamesStart <= 5)
		   {
			   $("#SportsTR > .arrowLeft").fadeTo("fast", .3)
		   }
		   
		    $("#Sports > .mainPageSorting > .orderRating").css("font-weight","normal");
		   $("#Sports > .mainPageSorting > .orderDate").css("font-weight","normal");
		   $("#Sports > .mainPageSorting > .orderTimes").css("font-weight","normal");
		   $("#Sports > .mainPageSorting > .orderName").css("font-weight","normal");

		   $("#Sports > .mainPageSorting > .orderRating").css("font-weight","bold");
	}
	});
	});
	}) 
	

	$("#Sports > .mainPageSorting > .orderTimes").livequery('click', function(event) { 
	$("#SportsTR > .mainSmallGameText").fadeTo("normal", .01, function() {
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=5&order=timesplayed DESC",
	success : function (data) {
		$("#SportsTR").html(data);
		if (SportsGamesStart <= 6)
		   {
			   $("#SportsTR > .arrowLeft").fadeTo("fast", .3)
		   }
		   
		   $("#Sports > .mainPageSorting > .orderRating").css("font-weight","normal");
		   $("#Sports > .mainPageSorting > .orderDate").css("font-weight","normal");
		   $("#Sports > .mainPageSorting > .orderTimes").css("font-weight","normal");
		   $("#Sports > .mainPageSorting > .orderName").css("font-weight","normal");

		   $("#Sports > .mainPageSorting > .orderTimes").css("font-weight","bold");
	}
	});
	});
	})
	

	$("#Sports > .mainPageSorting > .orderDate").livequery('click', function(event) { 
	$("#SportsTR > .mainSmallGameText").fadeTo("normal", .01, function() {
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=5&order=dateadded DESC",
	success : function (data) {
		$("#SportsTR").html(data);
		if (SportsGamesStart <= 6)
		   {
			   $("#SportsTR > .arrowLeft").fadeTo("fast", .3)
		   }
		   
		   $("#Sports > .mainPageSorting > .orderRating").css("font-weight","normal");
		   $("#Sports > .mainPageSorting > .orderDate").css("font-weight","normal");
		   $("#Sports > .mainPageSorting > .orderTimes").css("font-weight","normal");
		   $("#Sports > .mainPageSorting > .orderName").css("font-weight","normal");

		   $("#Sports > .mainPageSorting > .orderDate").css("font-weight","bold");
	}
	});
	});
	})
	

	$("#Sports > .mainPageSorting > .orderName").livequery('click', function(event) { 
	$("#SportsTR > .mainSmallGameText").fadeTo("normal", .01, function() {
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=5&order=gametitle ASC",
	success : function (data) {
		$("#SportsTR").html(data);
		if (SportsGamesStart <= 6)
		   {
			   $("#SportsTR > .arrowLeft").fadeTo("fast", .3)
		   }
		   
		   $("#Sports > .mainPageSorting > .orderRating").css("font-weight","normal");
		   $("#Sports > .mainPageSorting > .orderDate").css("font-weight","normal");
		   $("#Sports > .mainPageSorting > .orderTimes").css("font-weight","normal");
		   $("#Sports > .mainPageSorting > .orderName").css("font-weight","normal");

		   $("#Sports > .mainPageSorting > .orderName").css("font-weight","bold");
	}
	});
	});
	})

	
	//Arrow LEFT Sports
	//$("#SportsTR > .arrowLeft").css("border","3px solid red");
	$("#SportsTR > .arrowLeft").livequery('click', function(event) { 
	if(SportsGamesStart >= 5)
	{
	SportsGamesStart -= 5;
	$("#SportsTR > .mainSmallGameText").fadeTo("normal", .01, function() { 
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=5&gamesStart=" + SportsGamesStart,
	success : function (data) {
		$("#SportsTR").html(data);
		if (SportsGamesStart <= 4)
		   {
			   $("#SportsTR > .arrowLeft").fadeTo("fast", .3)
		   }	
	}
	});
	});
	}
	}) 
	//Arrow RIGHT Sports
	$("#SportsTR > .arrowRight").livequery('click', function(event) { 
	SportsGamesStart += 5;
	$("#SportsTR > .mainSmallGameText").fadeTo("normal", .01, function() {
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=5&gamesStart=" + SportsGamesStart,
	success : function (data) {
		$("#SportsTR").html(data);
	}
	});
	});
	})
	
	
	////////////////////////////////////Strategy////////////////////////
		   var StrategyGamesStart = 0;
		   //fade left arrow if can't go left
		   if (StrategyGamesStart <= 6)
		   {
			   $("#StrategyTR > .arrowLeft").fadeTo("fast", .3)
		   }		   
	$("#Strategy > .mainPageSorting > .orderRating").livequery('click', function(event) { 
	$("#StrategyTR > .mainSmallGameText").fadeTo("normal", .01, function() {
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=3&order=rating DESC",
	success : function (data) {
		$("#StrategyTR").html(data);
		if (StrategyGamesStart <= 5)
		   {
			   $("#StrategyTR > .arrowLeft").fadeTo("fast", .3)
		   }
		   
		   $("#Strategy > .mainPageSorting > .orderRating").css("font-weight","normal");
		   $("#Strategy > .mainPageSorting > .orderDate").css("font-weight","normal");
		   $("#Strategy > .mainPageSorting > .orderTimes").css("font-weight","normal");
		   $("#Strategy > .mainPageSorting > .orderName").css("font-weight","normal");

		   $("#Strategy > .mainPageSorting > .orderRating").css("font-weight","bold");
	}
	});
	});
	}) 
	

	$("#Strategy > .mainPageSorting > .orderTimes").livequery('click', function(event) { 
	$("#StrategyTR > .mainSmallGameText").fadeTo("normal", .01, function() {
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=3&order=timesplayed DESC",
	success : function (data) {
		$("#StrategyTR").html(data);
		if (StrategyGamesStart <= 6)
		   {
			   $("#StrategyTR > .arrowLeft").fadeTo("fast", .3)
		   }
		   
		   $("#Strategy > .mainPageSorting > .orderRating").css("font-weight","normal");
		   $("#Strategy > .mainPageSorting > .orderDate").css("font-weight","normal");
		   $("#Strategy > .mainPageSorting > .orderTimes").css("font-weight","normal");
		   $("#Strategy > .mainPageSorting > .orderName").css("font-weight","normal");

		   $("#Strategy > .mainPageSorting > .orderTimes").css("font-weight","bold");
	}
	});
	});
	})
	

	$("#Strategy > .mainPageSorting > .orderDate").livequery('click', function(event) { 
	$("#StrategyTR > .mainSmallGameText").fadeTo("normal", .01, function() {
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=3&order=dateadded DESC",
	success : function (data) {
		$("#StrategyTR").html(data);
		if (StrategyGamesStart <= 6)
		   {
			   $("#StrategyTR > .arrowLeft").fadeTo("fast", .3)
		   }
		   
		   $("#Strategy > .mainPageSorting > .orderRating").css("font-weight","normal");
		   $("#Strategy > .mainPageSorting > .orderDate").css("font-weight","normal");
		   $("#Strategy > .mainPageSorting > .orderTimes").css("font-weight","normal");
		   $("#Strategy > .mainPageSorting > .orderName").css("font-weight","normal");

		   $("#Strategy > .mainPageSorting > .orderDate").css("font-weight","bold");
	}
	});
	});
	})
	

	$("#Strategy > .mainPageSorting > .orderName").livequery('click', function(event) { 
	$("#StrategyTR > .mainSmallGameText").fadeTo("normal", .01, function() {
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=3&order=gametitle ASC",
	success : function (data) {
		$("#StrategyTR").html(data);
		if (StrategyGamesStart <= 6)
		   {
			   $("#StrategyTR > .arrowLeft").fadeTo("fast", .3)
		   }
		   
		   $("#Strategy > .mainPageSorting > .orderRating").css("font-weight","normal");
		   $("#Strategy > .mainPageSorting > .orderDate").css("font-weight","normal");
		   $("#Strategy > .mainPageSorting > .orderTimes").css("font-weight","normal");
		   $("#Strategy > .mainPageSorting > .orderName").css("font-weight","normal");

		   $("#Strategy > .mainPageSorting > .orderName").css("font-weight","bold");
	}
	});
	});
	})

	
	//Arrow LEFT Strategy
	//$("#StrategyTR > .arrowLeft").css("border","3px solid red");
	$("#StrategyTR > .arrowLeft").livequery('click', function(event) { 
	if(StrategyGamesStart >= 5)
	{
	StrategyGamesStart -= 5;
	$("#StrategyTR > .mainSmallGameText").fadeTo("normal", .01, function() { 
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=3&gamesStart=" + StrategyGamesStart,
	success : function (data) {
		$("#StrategyTR").html(data);
		if (StrategyGamesStart <= 4)
		   {
			   $("#StrategyTR > .arrowLeft").fadeTo("fast", .3)
		   }	
	}
	});
	});
	}
	}) 
	//Arrow RIGHT Strategy
	$("#StrategyTR > .arrowRight").livequery('click', function(event) { 
	StrategyGamesStart += 5;
	$("#StrategyTR > .mainSmallGameText").fadeTo("normal", .01, function() {
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=3&gamesStart=" + StrategyGamesStart,
	success : function (data) {
		$("#StrategyTR").html(data);
	}
	});
	});
	})
	
	
	////////////////////////////////////Weird////////////////////////
		   var WeirdGamesStart = 0;
		   //fade left arrow if can't go left
		   if (WeirdGamesStart <= 6)
		   {
			   $("#WeirdTR > .arrowLeft").fadeTo("fast", .3)
		   }		   
	$("#Weird > .mainPageSorting > .orderRating").livequery('click', function(event) { 
	$("#WeirdTR > .mainSmallGameText").fadeTo("normal", .01, function() {
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=7&order=rating DESC",
	success : function (data) {
		$("#WeirdTR").html(data);
		if (WeirdGamesStart <= 5)
		   {
			   $("#WeirdTR > .arrowLeft").fadeTo("fast", .3)
		   }
		   
		   $("#Weird > .mainPageSorting > .orderRating").css("font-weight","normal");
		   $("#Weird > .mainPageSorting > .orderDate").css("font-weight","normal");
		   $("#Weird > .mainPageSorting > .orderTimes").css("font-weight","normal");
		   $("#Weird > .mainPageSorting > .orderName").css("font-weight","normal");

		   $("#Weird > .mainPageSorting > .orderRating").css("font-weight","bold");
	}
	});
	});
	}) 
	

	$("#Weird > .mainPageSorting > .orderTimes").livequery('click', function(event) { 
	$("#WeirdTR > .mainSmallGameText").fadeTo("normal", .01, function() {
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=7&order=timesplayed DESC",
	success : function (data) {
		$("#WeirdTR").html(data);
		if (WeirdGamesStart <= 6)
		   {
			   $("#WeirdTR > .arrowLeft").fadeTo("fast", .3)
		   }
		   
		   $("#Weird > .mainPageSorting > .orderRating").css("font-weight","normal");
		   $("#Weird > .mainPageSorting > .orderDate").css("font-weight","normal");
		   $("#Weird > .mainPageSorting > .orderTimes").css("font-weight","normal");
		   $("#Weird > .mainPageSorting > .orderName").css("font-weight","normal");

		   $("#Weird > .mainPageSorting > .orderTimes").css("font-weight","bold");
	}
	});
	});
	})
	

	$("#Weird > .mainPageSorting > .orderDate").livequery('click', function(event) { 
	$("#WeirdTR > .mainSmallGameText").fadeTo("normal", .01, function() {
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=7&order=dateadded DESC",
	success : function (data) {
		$("#WeirdTR").html(data);
		if (WeirdGamesStart <= 6)
		   {
			   $("#WeirdTR > .arrowLeft").fadeTo("fast", .3)
		   }
		   
		   $("#Weird > .mainPageSorting > .orderRating").css("font-weight","normal");
		   $("#Weird > .mainPageSorting > .orderDate").css("font-weight","normal");
		   $("#Weird > .mainPageSorting > .orderTimes").css("font-weight","normal");
		   $("#Weird > .mainPageSorting > .orderName").css("font-weight","normal");

		   $("#Weird > .mainPageSorting > .orderDate").css("font-weight","bold");
	}
	});
	});
	})
	

	$("#Weird > .mainPageSorting > .orderName").livequery('click', function(event) { 
	$("#WeirdTR > .mainSmallGameText").fadeTo("normal", .01, function() {
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=7&order=gametitle ASC",
	success : function (data) {
		$("#WeirdTR").html(data);
		if (WeirdGamesStart <= 6)
		   {
			   $("#WeirdTR > .arrowLeft").fadeTo("fast", .3)
		   }
		   
		   $("#Weird > .mainPageSorting > .orderRating").css("font-weight","normal");
		   $("#Weird > .mainPageSorting > .orderDate").css("font-weight","normal");
		   $("#Weird > .mainPageSorting > .orderTimes").css("font-weight","normal");
		   $("#Weird > .mainPageSorting > .orderName").css("font-weight","normal");

		   $("#Weird > .mainPageSorting > .orderName").css("font-weight","bold");
	}
	});
	});
	})

	
	//Arrow LEFT Weird
	//$("#WeirdTR > .arrowLeft").css("border","3px solid red");
	$("#WeirdTR > .arrowLeft").livequery('click', function(event) { 
	if(WeirdGamesStart >= 5)
	{
	WeirdGamesStart -= 5;
	$("#WeirdTR > .mainSmallGameText").fadeTo("normal", .01, function() { 
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=7&gamesStart=" + WeirdGamesStart,
	success : function (data) {
		$("#WeirdTR").html(data);
		if (WeirdGamesStart <= 4)
		   {
			   $("#WeirdTR > .arrowLeft").fadeTo("fast", .3)
		   }	
	}
	});
	});
	}
	}) 
	//Arrow RIGHT Weird
	$("#WeirdTR > .arrowRight").livequery('click', function(event) { 
	WeirdGamesStart += 5;
	$("#WeirdTR > .mainSmallGameText").fadeTo("normal", .01, function() {
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=7&gamesStart=" + WeirdGamesStart,
	success : function (data) {
		$("#WeirdTR").html(data);
	}
	});
	});
	})
	
	
	////////////////////////////////////Zombie////////////////////////
		   var ZombieGamesStart = 0;
		   //fade left arrow if can't go left
		   if (ZombieGamesStart <= 6)
		   {
			   $("#ZombieTR > .arrowLeft").fadeTo("fast", .3)
		   }		   
	$("#Zombie > .mainPageSorting > .orderRating").livequery('click', function(event) { 
	$("#ZombieTR > .mainSmallGameText").fadeTo("normal", .01, function() {
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=1&order=rating DESC",
	success : function (data) {
		$("#ZombieTR").html(data);
		if (ZombieGamesStart <= 5)
		   {
			   $("#ZombieTR > .arrowLeft").fadeTo("fast", .3)
		   }
		   
		   $("#Zombie > .mainPageSorting > .orderRating").css("font-weight","normal");
		   $("#Zombie > .mainPageSorting > .orderDate").css("font-weight","normal");
		   $("#Zombie > .mainPageSorting > .orderTimes").css("font-weight","normal");
		   $("#Zombie > .mainPageSorting > .orderName").css("font-weight","normal");

		   $("#Zombie > .mainPageSorting > .orderRating").css("font-weight","bold");
	}
	});
	});
	}) 
	

	$("#Zombie > .mainPageSorting > .orderTimes").livequery('click', function(event) { 
	$("#ZombieTR > .mainSmallGameText").fadeTo("normal", .01, function() {
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=1&order=timesplayed DESC",
	success : function (data) {
		$("#ZombieTR").html(data);
		if (ZombieGamesStart <= 6)
		   {
			   $("#ZombieTR > .arrowLeft").fadeTo("fast", .3)
		   }
		   
		   $("#Zombie > .mainPageSorting > .orderRating").css("font-weight","normal");
		   $("#Zombie > .mainPageSorting > .orderDate").css("font-weight","normal");
		   $("#Zombie > .mainPageSorting > .orderTimes").css("font-weight","normal");
		   $("#Zombie > .mainPageSorting > .orderName").css("font-weight","normal");

		   $("#Zombie > .mainPageSorting > .orderTimes").css("font-weight","bold");
	}
	});
	});
	})
	

	$("#Zombie > .mainPageSorting > .orderDate").livequery('click', function(event) { 
	$("#ZombieTR > .mainSmallGameText").fadeTo("normal", .01, function() {
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=1&order=dateadded DESC",
	success : function (data) {
		$("#ZombieTR").html(data);
		if (ZombieGamesStart <= 6)
		   {
			   $("#ZombieTR > .arrowLeft").fadeTo("fast", .3)
		   }
		   
		   $("#Zombie > .mainPageSorting > .orderRating").css("font-weight","normal");
		   $("#Zombie > .mainPageSorting > .orderDate").css("font-weight","normal");
		   $("#Zombie > .mainPageSorting > .orderTimes").css("font-weight","normal");
		   $("#Zombie > .mainPageSorting > .orderName").css("font-weight","normal");

		   $("#Zombie > .mainPageSorting > .orderDate").css("font-weight","bold");
	}
	});
	});
	})
	

	$("#Zombie > .mainPageSorting > .orderName").livequery('click', function(event) { 
	$("#ZombieTR > .mainSmallGameText").fadeTo("normal", .01, function() {
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=1&order=gametitle ASC",
	success : function (data) {
		$("#ZombieTR").html(data);
		if (ZombieGamesStart <= 6)
		   {
			   $("#ZombieTR > .arrowLeft").fadeTo("fast", .3)
		   }
		   
		   $("#Zombie > .mainPageSorting > .orderRating").css("font-weight","normal");
		   $("#Zombie > .mainPageSorting > .orderDate").css("font-weight","normal");
		   $("#Zombie > .mainPageSorting > .orderTimes").css("font-weight","normal");
		   $("#Zombie > .mainPageSorting > .orderName").css("font-weight","normal");

		   $("#Zombie > .mainPageSorting > .orderName").css("font-weight","bold");
	}
	});
	});
	})

	
	//Arrow LEFT Zombie
	//$("#ZombieTR > .arrowLeft").css("border","3px solid red");
	$("#ZombieTR > .arrowLeft").livequery('click', function(event) { 
	if(ZombieGamesStart >= 5)
	{
	ZombieGamesStart -= 5;
	$("#ZombieTR > .mainSmallGameText").fadeTo("normal", .01, function() { 
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=1&gamesStart=" + ZombieGamesStart,
	success : function (data) {
		$("#ZombieTR").html(data);
		if (ZombieGamesStart <= 4)
		   {
			   $("#ZombieTR > .arrowLeft").fadeTo("fast", .3)
		   }	
	}
	});
	});
	}
	}) 
	//Arrow RIGHT Zombie
	$("#ZombieTR > .arrowRight").livequery('click', function(event) { 
	ZombieGamesStart += 5;
	$("#ZombieTR > .mainSmallGameText").fadeTo("normal", .01, function() {
	$.ajax({
	type: "POST",
	url : "includes/slideGames.php",
	data: "categoryID=1&gamesStart=" + ZombieGamesStart,
	success : function (data) {
		$("#ZombieTR").html(data);
	}
	});
	});
	})
		   }
	
		
});