
	var scrollSpeed = 70;
	var current = 0;
	var direction = 'h';
	var direction2 = 'v';
	function bgscroll(){
	    current -= 1;
	    $('div.clouds').css("backgroundPosition", (direction == 'h') ? current+"px 0" : "0 " + current+"px");
		//$('div.stars').css("backgroundPosition", (direction == 'v') ? current+"px 0" : "0 " + current+"px");
	}
	 setInterval("bgscroll()", scrollSpeed);

	 $(document).ready(function () {
			//logout
			$('#logout').click(function() {
				$.get("include/process.php",{"logout":"1"}, function() {window.location = document.location.href;});
				return false;
			});



		function redirectPage() {
			window.location = linkLocation;
		}
	

		$("ul.subnav").parent().append("<span></span>");
	
		$("ul.topnav li span").click(function() { 
		
			$(this).parent().find("ul.subnav").slideDown('fast').show(); 
			$(this).parent().hover(function() {
			}, function(){	
				$(this).parent().find("ul.subnav").slideUp('slow'); 
			});

			}).hover(function() { 
				$(this).addClass("subhover");
			}, function(){	
				$(this).removeClass("subhover"); 
		});

		$('a.togButton').click(function() {
			var which = $(this).attr('rel');
			if($('#'+which+'Container').is(':visible')) {
				$('#'+which+'Container').slideUp({duration:1000, easing:"easeOutCubic"});
			} else {
				$('div.togBox').fadeOut('fast');
				$('#'+which+'Container').slideDown({duration:1000, easing:"easeOutCubic"});
			}
			return false;
		});
		
		$('#togForgotPass').click(function() {
			$('.togBoxPanel').slideUp('slow').hide('slow');
			$('#lostPassContainer').show('slow');
			return false;
		});
		$('#togRememberPass').click(function() {
			$('.togBoxPanel').show('slow');
			$('#lostPassContainer').fadeOut('fast').hide('slow');
			return false;
		});

		$('#searchTR').click(function() {
			$('#search-form').submit();
		});
		$('.panelForms button').click(function() {

			var dataString = $(this).parent('form').serialize();
			var proc = $(this).parent('form').attr('id');

			$.ajax({
				type:"POST",
				url: "include/process.php",
				data: dataString,
				beforeSend: function() {

					$('.togBoxOverlay').show('slow').append('Processing Request...');
				},
				success: function(response) {
					if(response == 1) {
						$('.togBox').delay('2000').slideUp('slow', function() {window.location = document.location.href;});
					}
					else {
						alert(response);
					}
				}
			});
			return false;
		});
        $(".tweet").tweet({
            username: "TaintedReality",
            join_text: "auto",
            avatar_size: 32,
            count: 5,
            auto_join_text_default: "we said,",
            auto_join_text_ed: "we",
            auto_join_text_ing: "we were",
            auto_join_text_reply: "we replied to",
            auto_join_text_url: "we were checking out",
            loading_text: "loading tweets...",
						refresh_interval: 60,
						template: "{text} » {retweet_action}"
        }).bind("loaded",function(){$(this).find("a").attr("target","_blank");});
		$('#tweet-logo').click(function() {window.location = "http://twitter.com/#!/TaintedReality"; });

		$('#search-form').submit(function() {
			var url = 'modules/search/module.php';
			var dataString = $(this).serialize();
			$.ajax({
				type: "GET",
				url: url,
				cache: false,
				data: dataString,
				success: function(response) {
					$.colorbox({
						html:response,
						width:'960',
						onClosed:function(){ $('#search-query').val(''); }
					});
				}
			});
			return false;
		});

$('#donate').click(function() {
  $('#paypal_form').submit();
});

	});


