//////////////////////////////////////////////////////////////////
//	SETUP EFFECTS -> JUST GETTING THE BASICS READY
//////////////////////////////////////////////////////////////////

function setupEffects(){
	
	$("#container").fadeOut(0);
	$("#footer").fadeOut(0);
	$(this).oneTime(500, function() {
		$("#container").fadeIn(750);
		$("#footer").fadeIn(750);
		$("#slideList").slideView({
			easeFunc: "easeOutQuart",
			easeTime: 750
		});
	});
	
	$('.accordion').accordion({
		active: 0,
		header: 'h2',
		animated: 'bounceslide',
		autoHeight: false,
		collapsible: true
	});
	
	$('.panel').addClass('shadow0');
}

//////////////////////////////////////////////////////////////////
//	JS MOUSEOVER EFFECTS
//////////////////////////////////////////////////////////////////

function mouseEffects(){
	$("ul.projects li").hover(
		function() { //On hover...
			var thumbOver = $(this).find("img").attr("src");
			$(this).find("a.thumb").css({'background' : 'url(' + thumbOver + ') no-repeat center bottom'});
			$(this).find("span").stop().fadeTo(750, 0 , function() {
				$(this).hide() //Hide the image after fade
			});
		},
		function() { // on rollout
			$(this).find("span").stop().fadeTo(750, 1).show();
		}
	);
	
	$("ul.listSocial li").hover(
		function() {
			$(this).stop().animate({backgroundColor: '#555555', 'margin-top': '-5px'}, 'fast');
			$(this).find('a').stop().animate({color: '#E4E4E4'}, 300);
		},
		function() {
			$(this).stop().animate({backgroundColor: '#111111', 'margin-top': '0px'}, 'fast');
			$(this).find('a').stop().animate({color: '#999999'}, 300);
		}
	);

	$(".panel").hover(
		function(){ // roll over
			$(this).switchClass('shadow0', 'shadow1', 2000);
		},
		function(){ // roll out
			$(this).switchClass('shadow1', 'shadow0', 2000);
		}
	);
	
	$("li.nudge").hover(
		function() {
			$(this).stop().animate({ paddingLeft: 20 }, 250);
			$(this).find('span').stop().animate({ color: '#EEEEEE' }, 250);
		}, 
		function() {
			$(this).stop().animate({ paddingLeft: 10 }, 250);
			$(this).find('span').stop().animate({ color: '#555555' }, 250);
		}
	);
}

//////////////////////////////////////////////////////////////////
//	CONTACT FORM AJAX SUBMISSION - PREVFNT REDIRECT FOR EMAILS
//////////////////////////////////////////////////////////////////

$(document).ready(function() {
	$("#contactForm").validate({
		submitHandler: function(form) {
			$(form).ajaxSubmit();
			$("#contactForm").hide();
			$("#contactThanks").show();
		}
	})
});

//////////////////////////////////////////////////////////////////
//	SETUP EFFECTS -> JUST GETTING THE BASICS READY	
//////////////////////////////////////////////////////////////////
var contactState = 0;


function openContact() {
	$("#contact").animate({height: 'toggle'}, 750, 'easeOutQuart');

//	if(contactState == 0){
//		$("#contact").animate({height: 'toggle'}, 1500, 'easeOutQuart');
//		contactState == 1;
//	} else if (contactState == 1){
//		$("#contact").animate({height: 'toggle'}, 500, 'easeOutQuart');
//		contactState == 0;
//	}
	//	fontReplacement();
	checkContact();
}

function contactValues(test) {
	if(test == 'cName') {
		if( $(":input[name=fName]").val() == 'Name:'){
			$(":input[name=fName]").val('');
		}
	} else if(test == 'cEmail') {
		if( $(":input[name=fEmail]").val() == 'Email:'){
			$(":input[name=fEmail]").val('');
		}
	} else if(test == 'cMessage') {
		if( $(":input[name=fMessage]").val() == 'Message:'){
			$(":input[name=fMessage]").val('');
		}
	}
}

function checkContact() {
	if($(":input[name=fName]").val() == ''){
		$(":input[name=fName]").val('Name:');
	} 
	if ($(":input[name=fEmail]").val() == ''){
		$(":input[name=fEmail]").val('Email:');
	}
	if ($(":input[name=fMessage]").val() == ''){
		$(":input[name=fMessage]").val('Message:');
	}
}

//////////////////////////////////////////////////////////////////
//	SIFR - USES FLASH AND JAVASCRIPT TO ENABLE ANY FONT ON A PAGE -> DEGRADES NICELY TOO
//////////////////////////////////////////////////////////////////

//	function fontReplacement() {
	//	var rockwell = {
	//	  src: '/assets/sifr3/demo/rockwell.swf',
	//	  selectable: false
	//	};
	//	
	//	sIFR.activate(rockwell);
	//
	//	sIFR.replace(rockwell, {
	//		selector: '.fontReplace',
	//		css: [ '.sIFR-root {color: #FFFFFF; cursor: pointer; }, a {color: #82D4F7; text-decoration: none; font-weight: bold;}, a:hover {color: #44bEF0; text-decoration: none; border: none; outline: none;}' ],
	//		wmode: 'transparent'
	//	});
	
//	}

