//slidibg front page latest work

$(document).ready(function(){

	$("#myController").jFlow({
		slides: "#mySlides",
		controller: ".jFlowControl", // must be class, use . sign
		slideWrapper : "#jFlowSlide", // must be id, use # sign
		selectedWrapper: "jFlowSelected",  // just pure text, no sign
		width: "940px",
		height: "700px",
		duration: 200,
		prev: ".jFlowPrev", // must be class, use . sign
		next: ".jFlowNext" // must be class, use . sign
	});
});


$(function(){
				//Vertical Sliding
				$('.boxgrid.slidedown').hover(function(){
					$(".cover", this).stop().animate({top:'-200px'},{queue:false,duration:300});
				}, function() {
					$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:300});
				});
					//Full Caption Sliding (Hidden to Visible)
				$('.boxgrid.captionfull').hover(function(){
					$(".cover", this).stop().animate({top:'200px'},{queue:false,duration:160});
				}, function() {
					$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:160});
				});
				//Caption Sliding (Partially Hidden to Visible)
				$('.boxgrid.caption').hover(function(){
					$(".cover", this).stop().animate({top:'160px'},{queue:false,duration:160});
				}, function() {
					$(".cover", this).stop().animate({top:'220px'},{queue:false,duration:160});
				});
			});
			
			
			//TOGGLE OPEN COMENT BOX

$(function(){
		$("#open").click(function(){
		$("#panel").slideDown("slow");
		$("#open ").toggle("fade");
		$("a#logoutbutton  ").toggle("fade");
		return false;
	});
	
			$("a#logoutbutton").click(function(){
			$("#panel").slideUp("slow");
			$("#open ").toggle("fade");
			$("a#logoutbutton ").toggle("fade");
			return false;

	});
});



//slow scroll to link


var jump=function(e)
{
       e.preventDefault();
       var target = $(this).attr("href");
       $('html,body').animate(
       {
               scrollTop: $(target).offset().top
       },2000,function()
       {
               location.hash = target;
       });

}

$(function()
{
       $('a[href*=#]').bind("click", jump);
       return false;
});


//full click on div for archives

$(document).ready(function(){

	$(".col_main_sub").click(function(){
	  window.location=$(this).find("a").attr("href"); return false;
	});

});


//REMOVE BODY BORDER IF USER' WINDOW IS SMALLER THEN 1000PX

	$(function(){
		var $normal_width = $('body'); //Change the CSS ID selector to whatever you want to check
		noborder_class = 'no_border'; //call that hides the border 
		width_to_hide = 1000;//What size to check for. DO NOT ADD "px"
		$(window).resize(function(){//When the browser resizes
			if($(this).width() < width_to_hide){ //If the browser width is LESS THAN 1000px
				$normal_width.css('display','block').addClass(noborder_class ); //Makes the border on side disapear
				//If you want it to FADE out instead of just disappear uncomment the line below and comment the line above
				//The 500 == 0.5 seconds. Change it to whatever speed you want
				// $normal_width.fadeOut(500).addClass(noborder_class);
			}
			//If the window is equal or MORE THAN 1000px AND has a class "hidden":
			if($(this).width() >= width_to_hide && $normal_width .hasClass(noborder_class )){
				$normal_width.css('display','block').removeClass(noborder_class ); //Make it appear again.
				//$normal_width.fadeIn(500).addClass(noborder_class );//Or, fade back in. Comment line above and uncomment this one
			}
		})
	});
	$(window).load(function(){$(window).resize();}); //On a COMPLETE page load fake a resize to run above function


/*


 $(document).ready(function(){
$(".blog_excerpt:nth-child(3n)").addClass("last");
  });
*/



//back to top

$(function() {
	$('.backtotop').click(function(){
		$('html, body').animate({scrollTop:0}, 'slow');
	});
});


//validation contact form

 $(document).ready(function(){
    $("#contact_form").validate();
  });

//opacity on blog exceprt images




$(function(){
$(".blog_excerpt img").fadeTo("slow", 0.85); // This sets the opacity of the thumbs to fade down to 80% when the page loads

$(".blog_excerpt img").hover(function(){
$(this).fadeTo("slow", 1.0); // This sets the opacity to 100% on hover
},function(){
$(this).fadeTo("slow", 0.85); // This should set the opacity back to 60% on mouseout
});
});
