function pageWidth() {
	return window.innerWidth != null? window.innerWidth :
	document.documentElement && document.documentElement.clientWidth ?
	document.documentElement.clientWidth : document.body != null ?
	document.body.clientWidth : null;
}

var swap_text_boxes = [];

function init_swap_text_boxes(){
  //Store the default value for each box
  $('input[type=text][value].swaptextbox').each(function() {
	swap_text_boxes[$(this).attr('name')] = $(this).attr('value');
  });
  //Add focus and blur events to set or clear the value
  $('input[type=text][value].swaptextbox').bind('focus', function() {
	if($(this).val() == swap_text_boxes[$(this).attr('name')]) {
	  $(this).val('');
	}
  });
  $('input[type=text][value].swaptextbox').bind('blur', function() {
	if($(this).val() == '') {
	  $(this).val(swap_text_boxes[$(this).attr('name')]);
	}
  });
}
jQuery.preloadImages = function() {
  for(var i = 0; i<arguments.length; i++)
  {
    jQuery("<img>").attr("src", arguments[i]);
  }
}
//Preload menu images
$.preloadImages("images/menu_home_active.jpg", "images/menu_my_home_active.jpg", "images/menu_blog_active.jpg", "images/menu_latest_news_active.jpg", "images/menu_discussion_forums_active.jpg", "images/menu_rules_prizes_active.jpg");

function regHover(element, hoverclass)
{
	if (typeof hoverclass == "undefined" )
		hoverclass = "iehover";
	$(element).hover(function() {
		$(this).addClass(hoverclass);
	}, function() {
        	$(this).removeClass(hoverclass);
      });
}

$(document).ready(function(){ 
	init_swap_text_boxes();
	regHover("#menu li");
}); 