//////////////////////////////////////////////////////////////
//Name: functions.js
//Description: Main Functions using Jquery
//Author: Travis Holliday
//Company: www.travisholliday.com
//////////////////////////////////////////////////////////////
$(document).ready(function(){

	$("a[rel='caseStudy']").click(function(){
		$("#case-study-popup").fadeIn('normal');
		$('.bgCover').css({
			display:'block',
			width: $(document).width(),
			height:$(document).height()
		});
			
		$('.bgCover').css({opacity:0}).animate({opacity:0.6, backgroundColor:'#000000'});
		
		var href = $(this).attr("href");
		$("#case-study-content").load(href + " #case-study");
			//IE uses the event object so you set that to return false
			//FF the event object does not exist so the if statement checks to make sure the event object exists
		 if("undefined" != typeof(event))event.returnValue = false; 
		 return false;
		});
	
	$("#case-study-popup").click(function(){
				$(".bgCover").fadeOut('fast');
				$(this).fadeOut('fast');						  
	});
	
	$(".bgCover").click(function(){
			$('.bgCover').fadeOut('fast');
			$("#case-study-popup").fadeOut('fast');						  
	});
	
	$("#case-studies dl").quickpaginate({ 
			perpage: 3,
			showcounter: false,
			prev: "back",
			next: "more",
			pager : $("#prev-next")
	});
	
	setTimeout(function(){$(".message").fadeOut(1000)}, 15000);
    $(".message").click(function () {
    $(".message").fadeOut("slow");
	});
	
	$("a#signupbtn").click(function() {
		$("#loginform").slideUp('fast');
		$("#signupform").slideDown('slow');
		$("#filesharesignup").fadeOut('slow');
		$('#signupform').css({opacity:0}).animate({opacity:1});
	});

	$('a.filedelete').click(function() {
		var answer = confirm('Are you SURE you want to DELETE this file? Intrinsic will no longer have access to it. This action CANNOT be undone.');
		return answer;							 
	});

	$('input#uploadsubmit').click(function(){
		$('.bgCover').css({
			display:'block',
			width: $(document).width(),
			height:$(document).height()
		});
	$('#uploadpopup').css({'display':'block', 'opacity':'1', 'z-index':'9'});
	$('.bgCover').css({opacity:0}).animate({opacity:0.8, backgroundColor:'#000000'});
	$('#left-col').css({opacity:1}).animate({opacity:0});
	});
	
});// end document ready function
