jQuery(document).ready(function(){
	
	
	//POSTING HOVER EFFECT
	$(".post-hold").each(function(){
		$(this).hover(
			function() {
				$(this).stop().animate({
					backgroundColor: "#e2eef2"
				},1000);
				$(".post-arrow",this).stop().animate({
					top: "90px"
				});
			}, function() {
				$(this).stop().animate({
					backgroundColor: "#fff"
				},500);
				$(".post-arrow",this).stop().animate({
					top: "25px"
				});				
			}	
		);
	});
	
	//COMMENT HOVER EFFECT
	//SET ORIGNAL HEIGHT
	jQuery(".commentlist .alt, .postComments").each(function(){
		var e = jQuery(this).height();
		jQuery(this).attr("value",e);
	});
	jQuery(".commentlist .alt, .postComments").each(function(){
		var oH = this.offsetHeight+'px';
		var p = jQuery(this).prev().attr("value");
		var n = jQuery(this).next().attr("value");
		var t = this.offsetTop;
		var v = jQuery(this).attr("value");
		var d = t+17;
		jQuery(this).hover(
			function() {
				jQuery(this).stop().animate({backgroundColor: "#e2eef2",height: oH},1000, function(){
					jQuery(".post-arrow-comment").stop().animate({top: t+v/2+'px'});
				});
				jQuery(this).next(function(){jQuery(this).stop().animate({backgroundColor: "#ccc"},1000);});
				jQuery(this).prev().stop().animate({backgroundColor: "#fff",height: p/3+'px'},1000);
				jQuery(this).next().stop().animate({backgroundColor: "#fff",height: n/3+'px'},500);	
			}, function() {
				
				jQuery(this).stop().animate({backgroundColor: "#fff",height: "34px"},900,function(){
					jQuery(".post-arrow-comment").stop().animate({top: d+'px'});
				});	
				jQuery(this).prev().stop().animate({backgroundColor: "#fff",height: '34px'},900);
				jQuery(this).next().stop().animate({backgroundColor: "#fff",height: '34px'},900);							
			}	
		);	
		jQuery(this).css({
			height: "34px"
		});			
	});
	
	//TUTORIALS AND OTHER LITTLE SCRIPTS
	jQuery("#simpleFormValidation").submit(function(){
	  var valid = document.getElementsByClassName("validate");
	  for(var i=0;i<valid.length;i++)
	  {
	    var element = valid[i].value;
	    var stripElement = element.replace(/ /g,"");
	    if(stripElement.length > 0){
	    } else {
	      valid[i].style.background="#FF0000";
	      alert("Sorry but there seems to be a problem with your submission, please check over the form again.");
	      return false;
	    }
	  }
	  alert("Thank You!! Message Sent!");
	  jQuery("#simpleFormValidation .validate").attr("value","");
	  return false;
	});	
	
	//JQUERY FASTER THAN EVER EXAMPLES
	jQuery("#btn").click(function(){
	    jQuery(this).animate({
	        fontSize: "25px",
			color: "#fff"
	    });
	
	    jQuery(this).css({
	        backgroundColor:"#000"
	    });
	});
	
	
	//DRAG TO SHARE ME FEATURE
	if(jQuery(".shareLink").length != 0){
		jQuery(".shareLink").hover(function(){
				var loc = jQuery(this).attr("href");
				window.location = loc;
		});	
		$("#shareThis").draggable({ revert: true, appendTo: 'body',
	        helper: 'clone', 
			start: function(event, ui) { 
				jQuery("#splashScreen").css({height:(jQuery("body").height())+"px"}).slideDown("fast");
				jQuery("#shareBlock").slideDown("fast");
			},
			stop: function(event, ui) { 
				jQuery("#splashScreen").slideUp("fast");
				jQuery("#shareBlock").fadeOut("slow");
			}
		});
	}

	
	//ROUNDED CORNERS MENU TAB EXAMPLE
	if(jQuery("#roundNavTabExample").length != 0){
		$("#navE li a").mouseover(function(){

			$("#navE li a").each(function(count){
				$(this).css({color:"#fff"});
			});

			$(this).css({color:"#000"});

			var offL =  $(this).offset().left - $("#navE").offset().left;
			var offW = $(this).width() + parseInt($(this).css("paddingLeft")) * 2;

			$("li.rounder").stop().animate({left:offL+"px",width:offW+"px"},295,function(){

				//IE6 1px Fix
				var trOff = $("#tr").offset().left + parseInt($("#tr").css("width"));
				var wrapWOff = $(".rounder").offset().left + parseInt($(".rounder").css("width"));

				var brOff = $("#br").offset().top + parseInt($("#br").css("height"));
				var wrapHOff = $(".cornersWrap").offset().top + parseInt($(".cornersWrap").css("height"));					

				if(wrapWOff > trOff){
					$("#tr,#br").attr("class","rFix");
				}	

				$(".rFix").css({right:"-1px"});

				if(wrapHOff > brOff){
					$("#br,#bl").attr("class","bFix");
				}
				$(".bFix").css({bottom:"-1px"});
			});
		});
	}
	
});
