//my custom scripts
$(document).ready(function(){
	
	$("#mainnav ul li#blog").hover(
		function(){
		//handler in
		$('ul.subnav').slideDown('fast').show();
		}, 
		function(){
		$('ul.subnav').slideUp('slow').hide();
	}); //end navigation
	
	$("#feature-overlay p").fadeIn(3000);		
		
		
	$(".main-container img").lazyload({    
			effect : "fadeIn" 
	});//end lazy load
	$("img.showtip[title]").tooltip({
			tip:'#demotip',
			effect: 'fade',  
			fadeOutSpeed: 100, 
			predelay: 50,
			position: "top left",         
			offset: [65, 180]  		
	});//end tooltip
	$("#footer-navigation ul li a[title], ul#stayintouch li a[title]").tooltip({
			tip:'#demotip',
			effect: 'fade',  
			fadeOutSpeed: 100, 
			predelay: 5,
			position: "top left",         
			offset: [0, 130]  		
	});//end tooltip
		
		
		
	//show fade divs	
	$(".showfade_wrapper").hover(
			function(){
				//$(this).find('.showfade_text').animate({top:"-109px"}, 300);
				$(this).find('.showfade_text').animate({opacity:"1.0"}, 300);
			},
			function(){
				//$(this).find('.showfade_text').animate({top:"109px"}, 100);
				$(this).find('.showfade_text').animate({opacity:".0"}, 300);
			}
	);//end show fade divs 

	//organic tabs
	$("div#taglist").css("display", "none");
	$("#explore-nav li a").click(function() {
					var curList = $("#explore-nav li a.current").attr("rel");
					var $newList = $(this);
					var curListHeight = $("#all-list-wrap").height();
					$("#all-list-wrap").height(curListHeight);				
					$("#explore-nav li a").removeClass("current");
					$newList.addClass("current");
					var listID = $newList.attr("rel");
					if (listID != curList) {
						$("#"+curList).fadeOut(300, function() {
							$("#"+listID).fadeIn();	
							var newHeight = $("#"+listID).height();
							$("#all-list-wrap").animate({
								height: newHeight
							});		
						});		
					} 			
					return false;
	});	//end organic tabs		
	//opt in for all zip links
	$("a[href$='.zip']").click(function(){
			$("#darkbg, #lightbox-panel").fadeIn(300);			
				var thelink = $(this).attr('href');			
				//$('a#real').attr('href', thelink).html(thelink);		
				$('input#linktofile').attr('value', thelink);
				
			return false;
		})
	//disable right click
	$("a[href$='.zip']").bind("contextmenu",function(e){  
        return false;  
    });  
	$("a#close-panel").click(function(){
		$("#darkbg, #lightbox-panel").fadeOut(300);
		//$('a#real').attr('href', '').html('');	
	})

	//validate email					
	$('input.submitbutton').click(function() { 	 
		var hasError = false;
		var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/; 
		var emailaddressVal = $("input.emailaddress").val();
				
		if(emailaddressVal == '') {
			$('.errormsg').html('Email Cannot be Blank');
			hasError = true;
		}
		else if(!emailReg.test(emailaddressVal)) {
			$('.errormsg').html('Email Has to be a Valid Address');
			hasError = true;
		} 
		if(hasError == true) { 
			return false;
		}
	});		  

}); //end doc ready
 

	 
	 
	 

