/*================================================
-Main.js Document;
================================================*/

//----------------------------------------------- Cufon Styles	
Cufon.replace('h1, h2, h3', { hover: true, fontFamily: 'akaDylan Plain'});

	
$(document).ready(function(){	

/* Target Blank -----------------------------------------------------*/

$(function() {
	    $('a[rel*=external]').click( function() {
	        window.open(this.href);
	        return false;
	    });
	});

	
/* Nav -----------------------------------------------------*/
 $('#nav li.steam').hover(function(){
				$(this).find('em').animate({top:'0px'},{queue:false,duration:500});
			}, function(){
				$(this).find('em').animate({top:'-10px'},{queue:false,duration:500});
   });
   
 $('#nav li.mac').hover(function(){
				$(this).find('em').animate({top:'0px'},{queue:false,duration:500});
			}, function(){
				$(this).find('em').animate({top:'-10px'},{queue:false,duration:500});
   });
    $('#nav li.mac').hover(function(){
				$(this).find('span').animate({top:'76px'},{queue:false,duration:500});
			}, function(){
				$(this).find('span').animate({top:'66px'},{queue:false,duration:500});
   });
   
     $('#nav li.xbox').hover(function(){
				$(this).find('em').animate({top:'0px'},{queue:false,duration:500});
			}, function(){
				$(this).find('em').animate({top:'-10px'},{queue:false,duration:500});
   });
   
   
   
   $('#nav li.mac a').append('<span class="hover"></span>').each(function () {
	  var $span = $('> span.hover', this).css('opacity', 0);
	  $(this).hover(function () {
	    $span.stop().fadeTo(500, 1);
	  }, function () {
	    $span.stop().fadeTo(500, 0);
	  });
	});

    $('.watch-it a').append('<span class="hover"></span>').each(function () {
	  var $span = $('> span.hover', this).css('opacity', 0);
	  $(this).hover(function () {
	    $span.stop().fadeTo(500, 1);
	  }, function () {
	    $span.stop().fadeTo(500, 0);
	  });
	});
	
	 $('.eets-download a.download').append('<span class="hover"></span>').each(function () {
	  if( thisIsIe ){
			var $download = $('> span.hover', this).css('display', 'none');
				}
	  else {
		var $download = $('> span.hover', this).css('opacity', 0);
	  };
	  $(this).hover(function () {
    	if( thisIsIe ){
		$download.stop().show();
				}
	    else {
		$download.stop().fadeTo(600, 1);};
	  }, 
	  function () {
			if( thisIsIe ){
			$download.stop().hide();
			}
		else {
		$download.stop().fadeTo(600, 0);};
	  });
	});
	
	$('.gallery-col a').append('<em>&nbsp;</em><span class="inner-shadow"></span>').each(
	
	function () {
	  var $em = $('> em', this).css('opacity', 0);
	  if( thisIsIe ){
			var $inner = $('> span.inner-shadow', this).css('display', 'block');
				}
				else {
		var $inner = $('> span.inner-shadow', this).css('opacity', 1);
	  };
	  $(this).hover(function () {
	    $em.stop().fadeTo(600, 1);
			if( thisIsIe ){
			$inner.stop().hide();
				}
				else {
		
		$inner.stop().fadeTo(600, 0);};
	  }, 
	  function () {
	   $em.stop().fadeTo(600, 0);
			if( thisIsIe ){
			
			$inner.stop().show();
				}
				else {
		
		$inner.stop().fadeTo(600, 1);};
	  });
	});
   
/* Gallery -----------------------------------------------------*/ 
	//$("#nav li.steam").addClass("last-item");
	var $newUL;
	while($('.gallery-col:last').children('li').length > 4) {
		$newUL = $('<ul class="gallery-col"></ul>');
      $('.gallery-col:last').children('li').slice(4).appendTo($newUL);
       $newUL.appendTo('#gallery');
	};

});

/* Clear text -----------------------------------------------------*/

function focusText(thefield){
	if (thefield.defaultValue==thefield.value){
		thefield.value = "";
	}
}
function blurText(thefield){
	if (thefield.value == ""){
		thefield.value = thefield.defaultValue;
	}
}
