this.tooltip = function(){	
	/* CONFIG */		
		xOffset = 10;
		yOffset = 20;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	$("a.tooltip").hover(function(e){											  
		this.t = this.title;
		this.title = "";									  
		$("body").append("<p id='tooltip'>"+ this.t +"</p>");
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },
	function(){
		this.title = this.t;		
		$("#tooltip").remove();
    });	
	$("a.tooltip").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};


$(document).ready(function() {
		$(document).cheatCode({
			code : '38,38,40,40,37,39,37,39,66,65',
			unbind: 'false',
			activated : function(){
				
				$("#header-wrapper #left-column").css("visibility", "hidden");
				$("#header-wrapper #middle-column").css("visibility", "hidden");
				$("#nav").css("background-color", "#ffffff");
				$("#header-wrapper").css("height", "106px");
				
				
				$("#header-wrapper").css({'background-color' : '#ffffff',
										  'background-image' : 'url(/images/sf-classic.jpg)',
										  'background-repeat' : 'no-repeat',
										  'background-position' : '10px 10px'
										  
										 });
			}
		});
		
		
		$("#s-all").click(function() {
								 		if($(".s-s").attr("disabled") == false) {
											$(".s-s").attr("disabled", "disabled");
										} else { 
											$(".s-s").removeAttr("disabled");
										}
		});
		
		
		$(".searchlink").click(function() {
										$("#searchterms").attr("value",$(this).text());
										$("#searchform").submit();
										return false;
										});
		
		$("#onelinerhop").live('click', function() {
										 	var x = new Date();
										 	$("#onelinercontainer").load('/include/oneliner.php', {msg: $('#onelinermsg').val(), rnd: x.getTime()});
						   					$("#onelinermsg").attr('value', '');
						   });
		
		$("#rlscommenthop").live('click', function() {
										 	var x = new Date();
										 	$("#rlscommentcontainer").load('/include/rlscomments.php', {comment: $('#comment').val(), rls: $('#rlsid').val(),  rnd: x.getTime()});
						   					$("#comment").attr('value', '');
						   });
		
		$("#nfouploader").colorbox({width:"auto", inline:true, href:"#addnfo"});
		
				$("#uploadthenfo").live('click', function() {
										 	var x = new Date();
										 	//$("#rlscommentcontainer").load('/include/rlscomments.php', {comment: $('#comment').val(), rls: $('#rlsid').val(),  rnd: x.getTime()});
						   					//$("#comment").attr('value', '');
											uploader.submit();
				});


						   
tooltip();

												var button = $('#nfosubmission'),interval;
												if(button.length){
													

													var uploader = new AjaxUpload('#nfosubmission', {
													  // Location of the server-side upload script
													  // NOTE: You are not allowed to upload files to another domain
													  action: '/include/nfouploader.php',
													  // File upload name
													  name: 'userfile',
													  // Additional data to send
													  data: {
														releaseid : $("#releasenfo").val()
													  },
													  // Submit file after selection
													  autoSubmit: false,
													  // The type of data that you're expecting back from the server.
													  // HTML (text) and XML are detected automatically.
													  // Useful when you are using JSON data as a response, set to "json" in that case.
													  // Also set server response type to text/html, otherwise it will not work in IE6
													  responseType: false,
													  // Fired after the file is selected
													  // Useful when autoSubmit is disabled
													  // You can return false to cancel upload
													  // @param file basename of uploaded file
													  // @param extension of that file
													  onChange: function(file, extension){
														  $("#nfosubmission").attr('value', 'Selected File: ' + file);
														  $("#uploadthenfo").removeAttr('disabled');
														  $.fn.colorbox.resize();},
													  // Fired before the file is uploaded
													  // You can return false to cancel upload
													  // @param file basename of uploaded file
													  // @param extension of that file
													  onSubmit: function(file, extension) {
														  $("#nfosubmitpanel").html("<img src='/images/load.gif' /><br />Uploading...");
													  	  // resize dialog to show progress
														  $.fn.colorbox.resize();
													  },
													  // Fired when file upload is completed
													  // WARNING! DO NOT USE "FALSE" STRING AS A RESPONSE!
													  // @param file basename of uploaded file
													  // @param response server response
													  onComplete: function(file, response) {
														  $("#nfosubmitpanel").html(response);
														  $.fn.colorbox.resize();
														  $(this).delay(5000,function(){
																$.fn.colorbox.close();
																$("#para").html('');
																$("#nfosubmitpanel").html("You have already uploaded an NFO for this release!");
															});

														  }
													});
												}
													
});