$(document).ready(function(){
	
		$('.overlay').show();

		if($.cookie("overlay") == "show"){
			$('.overlay').hide();
		}
		
		var url = _root+$('.overlay .inner img').attr('src');
		$('.overlay .inner img').attr('src',url);
		
		$.cookie("overlay", "show", { expires: 1 });
		
	
	
		
	
	$('.goto a').click(function(){
		$('.overlay').hide();
		return false;
	});
	
	$('.iground').each(function(){
		if($(this).is("a")){
			$(this).attr({'href':'http://www.igroundcontrol.com/subscribe/english/','target':'_blank'});
		}else{
			var html = '<a href="http://www.igroundcontrol.com/subscribe/english/" target="_blank">' + $(this).html() + '</a>';
			$(this).html(html);
		}	
	});
	
	/*	$('.iground').click(function(){
		$.get(_root+"pages/ajax/iground.asp", { root:_root},
			function(data){
				$('.overlay').show();
				$('.overlay').html(data);
				$('.overlay .close').click(function(){$('.overlay').hide();});
			});
		return false;		
	});

	*/
	$('.discount').click(function(){
		$.get(_root+"pages/ajax/discount.asp", { root:_root},
			function(data){
				$('.overlay').show();
				$('.overlay').html(data);
				$('.overlay .close').click(function(){$('.overlay').hide();});
			});
		return false;		
	});
	
	$('.downloads').click(function(){
		$.get(_root+"pages/ajax/downloads.asp", { root:_root},
			function(data){
				$('.overlay').show();
				$('.overlay').html(data);
				$('.overlay .close').click(function(){$('.overlay').hide();});
			});
		return false;		
	});
	
});
