/*Fonts*/
Cufon.replace('.navigation',{hover: true});
Cufon.replace('#mission_statement, h2, h4, h5');
Cufon.replace('h1.title,a > button,.author,.overlay',{textShadow: '0 -1px 1px rgba(0, 0, 0, 0.25)'});

$(document).ready(function(){
	/*Banner Image Scroller*/
	$('#banner > ul').cycle({fx:'scrollLeft',timeout:4000,speed:600,pager:'#banner_nav',fastOnEvent:400,pause:true});
	/*Banner Navigation*/
	$('#banner > #banner_nav').css('left', 425-($('#banner > #banner_nav > a').size()*8) + 'px');
	/*Last Menu Items*/
	$('.navigation > li:last, #footer_nav > li:last').addClass('last');
	
	/*Portfolio Image Hovers*/
	$('.portfolio_img').bind('mouseover', function(){
		$(this).children('.overlay').stop();
		$(this).children('.overlay').show();
		$(this).children('.overlay').animate({opacity: .9},200);
	});
	$('.portfolio_img').bind('mouseout', function(){
		$(this).children('.overlay').stop();
		$(this).children('.overlay').hide();
		$(this).children('.overlay').animate({opacity: 0.0},200);
	});
	
	/*Portfolio Filter Controls*/
	$('#portfolio_controls').bind('click',function(){
		if($.browser.msie==true){
			if($('.drop_options').css('display')=='none'){$('.drop_options').show();}else{$('.drop_options').hide();}
		}else{
			$('.drop_options').slideToggle();
		}
		$('.dropdown_button').toggleClass('upArrow');
	});
	$('.drop_options > li').bind('click',function(){
		var xclass = $(this).html();
		if(xclass=='All'){$('.portfolio_items > a > *').show();}else{
			$('.portfolio_items > a > *').hide();
			$('.portfolio_items > a > .'+xclass.replace(/\s/g,'_')+'').show();
		}
		if(xclass.length>9){
			$('.filter_selected').html(xclass.substring(0,9)+'...');
		}else{
			$('.filter_selected').html(xclass);
		}
	});

	/*Pre/Post-Input values*/
	inputEffect('#author','Your Name...',1);
	inputEffect('#email','Your Email...',1);
	inputEffect('#optemail','Your Email...',1);
	
	function inputEffect(tar,def,init){
		if(init==1 && ($(tar).val()==def || $(tar).val()=='')){$(tar).val(def);$(tar).toggleClass('inputBlur');}
		$(tar).bind('focus', function(){
			if($(this).val()==def){
				$(this).val('');
				$(this).toggleClass('inputBlur');
			}
		});
		$(tar).bind('blur', function(){
			if($(this).val()==''){
				$(this).val(def);
				$(this).toggleClass('inputBlur');
			}
		}); 
	}
});
