// Core UI for Sinister Apathy
// Scroll
$(document).ready(function () {
    $.localScroll.defaults.axis = 'y';
	$.localScroll({
		target:'#left-pane',
		hash: false,
		queue:true,
		duration:1500,
		easing: 'easeOutExpo'
	});
// Menu 
$(function() {
 $("ul#compass li a").css("opacity",".5");
   $("ul#compass li a").click(
    function() {
     $("ul#compass li a").stop().animate({ opacity: .5 }, 'slow');
     $("ul#compass li a").removeClass("activeButton");
     $(this).stop().animate({ opacity: 1 }, 'slow');
     $(this).addClass("activeButton");
    }
   );
   $("ul#compass li a").hover(
    function () { 
     $(this).stop().animate({ opacity: 1 }, 'slow');
    },
    function () {
     if(!$(this).hasClass("activeButton")){ 
      $(this).stop().animate({ opacity: .5 }, 'slow');
     }
    }
   );
  });
});	

// Lights out
$(document).ready(function(){
$("#lightsout").css("height", $(document).height());  		
   	$(".alert").click(function(){
   		$("#lightsout").fadeIn();
	return false;
		});
  		
   	$(".close").click(function(){
		$("#lightsout").fadeOut();
   			return false;
		});	
		});
		
	$(window).bind("resize", function(){
		 $("#lightsout").css("height", $(window).height());
});


// Contact Form

jQuery("form.contact").submit(function(){
	var str = jQuery("form.contact").serialize();
		   jQuery.ajax({
		   type: "POST",
		   url: "contact.php",
		   data: str,
		   success: function(msg){
	jQuery("#pigeonpost").ajaxComplete(function(event, request, settings){
	jQuery("#pigeonpost").show();
	if(msg == 'OK') // Message Sent? Show the 'Thank You' message and hide the form
	{
	result = '<span class="notification_ok">Your message has been sent. Thank you!</span>';
	jQuery(".contact").hide();
	}
	else
	{
		result = msg;	
	}

	jQuery(this).html(result);
		});
		}
				 });
		return false;

	});
// Fill the fields in with the title

$(document).ready(function() {
inputTextboxes();
inputTextarea();
});

// displays hint text on any input element with the 'title' attribute set
function inputTextboxes() {
var el = $('input[Title]');

// show the display text
el.each(function(i) {
    $(this).attr('value', $(this).attr('title'));
});

// hook up the blur & focus
el.focus(function() {
    if ($(this).attr('value') == $(this).attr('title'))
        $(this).attr('value', '');
}).blur(function() {
    if ($(this).attr('value') == '')
        $(this).attr('value', $(this).attr('title'));
});
} 
function inputTextarea() {
var ta = $('textarea[Title]');

// show the display text
ta.each(function(i) {
    $(this).attr('value', $(this).attr('title'));
});

// hook up the blur & focus
ta.focus(function() {
    if ($(this).attr('value') == $(this).attr('title'))
        $(this).attr('value', '');
}).blur(function() {
    if ($(this).attr('value') == '')
        $(this).attr('value', $(this).attr('title'));
});
} 
// Credit slider

$(function() {
 $("#credit").animate({'opacity' :0});
   $("#notice").hover(
    function () { 
     $('#credit').stop().animate({'opacity' :1});
    },
    function () {
      $('#credit').stop().animate({'opacity' :0});

    }
   );
  });

$(document).ready(function(){
	$("#dim").css("height", $(document).height());
	$(".alert").click(function(){
    $("#dim").fadeIn();
    	return false;
	 });
     $(".close").click(function(){
         $("#dim").fadeOut();
    	 return false;
 	 });
});
		
$(window).bind("resize", function(){
 	$("#dim").css("height", $(window).height());
});

