

$( document ).ready( function() {

     
	//$(document).pngFix(); 
	
	
	$( "#catchup_btn" ).click( function( event ) {
			//$( "#form_sent" ).fadeIn('slow');
			infoBoxShow(1);
			
	});
	
	$( "#request_btn" ).click( function( event ) {
			//$( "#form_sent" ).fadeIn('slow');
			infoBoxShow(2);

			
	});
	
	
	$( "#request_btn_small" ).click( function( event ) {
			//$( "#form_sent" ).fadeIn('slow');
			infoBoxShow(2);

			
	});
	
	
	
	$( "#message-container a.close" ).click( function( event ) {
		event.preventDefault();
		infoBoxHide(3);
	});
	
	
	
	$( "a#login_fade_trigger" ).click( function( event ) {
		event.preventDefault();
		
		if( $( "#login_fade" ).css( 'display' ) == 'block' ) {
			$( "#login_fade" ).fadeOut();
		} else {
			$( "#login_fade" ).fadeIn();
		}
	});
	
	
	$( "#login_fade a.close" ).click( function( event ) {
		event.preventDefault();
		$( "#login_fade" ).fadeOut();
	});
	$( "#login_fade" ).hide();
	
	
	$( "object" ).click( function( event ) {
		event.preventDefault();
		
		if( $( "#login_fade" ).css( 'display' ) == 'block' ) {
			$( "#login_fade" ).fadeOut();
		} else {
			$( "#login_fade" ).fadeIn();
		}
	});
	
	
	/**
		POPUP EVENT
	*/
	$( "a.popup" ).click( function( event ) { 
		// Stop the browser from following the link
		event.preventDefault();
		
		// Grab the target of the link
		var sTarget = $( this ).attr( "href" );
		
		// Set the width and height of the popup
		var iWidth = 800;
		var iHeight = 600;
		var iScrollbars = 2;
		
		// Center the window on the clients screen
		var iLeft = (screen.width)?(screen.width-iWidth)/2:100;
		var iTop = (screen.height)?(screen.height-iHeight)/2:100;
		
		// Put the window config together
		var sSettings='width='+iWidth+',height='+iHeight+',top='+iTop+',left='+iLeft+',scrollbars='+iScrollbars+',location=yes,directories=no,status=yes,menubar=yes,toolbar=yes,resizable=yes';
		
		// Create the new window
		win=window.open( sTarget, "", sSettings );
	} );
	
	/**
		SITE MAST
	*/
	$( "#mast" ).flash({
		src: '/media/flash/PP_SteamLogo.swf',
		width: 600,
		height: 100
	});
	
	/*
		FORM ERROR HANDLING FOR MEMBERS
	*/
	$('#twitter_submit').click(function(){
		message = $('#querybox').val();
		if(message != "" && message != NULL){
			return true;	
		}
		else{
			alert('Please enter a message');
			return false;
		}
							   
	});
	
	
	//Hides the data collection form on the members home page
	
	
	$('#form_sent').hide();
	$('#loyalty-card-form').hide();
	$('#message-container').hide();



	
} );

	function infoBoxHide(value){
		if(value == 1){
			$('#form_sent').fadeOut();
		
		}
		if(value == 2){
			$('#loyalty-card-form').fadeOut();	
		}
		if(value == 3){
			$('#form_sent').fadeOut();
			$('#loyalty-card-form').fadeOut();
		}
		$('#message-container').fadeOut();
		
	}
	
	
		function infoBoxShow(value){
		if(value == 1){
			$('#loyalty-card-form').hide();
			$('#form_sent').fadeIn();
		
		}
		if(value == 2){
			$('#form_sent').hide();
			$('#loyalty-card-form').fadeIn();	
		}
		if(value == 3){
			$('#form_sent').fadeIn();
			$('#loyalty-card-form').fadeIn();
		}
		$('#message-container').fadeIn();
		
	}

