jQuery(document).ready(function($) {
						 
			//Home widget---------------------------------------->

			  $('#home_widget_btn').toggle(function() {
				  $(this).toggleClass("btn_open");
				  var $lefty = $(this).parent();
				  $lefty.animate({right:0});
				}, function() {
				  $(this).toggleClass("btn_open");
				  var $lefty = $(this).parent();
				  $lefty.animate({right:-290});
				});
			 //-------------------------------------------------<
			 
			 //Navigation Background Slider-------------->
			   $("#pauseplay").toggle(function () { 
				  $(this).addClass("pause");
				}, function () {
				  $(this).removeClass("pause");
				});
				
				$("#nextslide").click(function(){
					api.nextSlide();
				});
				$("#prevslide").click(function(){
					api.prevSlide();
				});
				$("#pauseplay").click(function(){
					api.playToggle();
				});
			  
			  
			  //Hide Button---------------------------------------->
			  var $main;
			  var window_height;
			  var $header;
			  var header_height;
			  $('#hide_btn').toggle(function() {
				  $(this).toggleClass("hb_open");
				  $main = $("#main");
				  $header = $("#header");
				  
				  window_height = $(window).height();
				  header_height = $($header).height();
				  header_height = header_height + 50;
				  $main.animate({top: window_height});
				  $header.animate({top: -header_height});
				}, function() {
				  $(this).toggleClass("hb_open");
				  $main.animate({top:0});
				  $header.animate({top:0});
				});
			//--------------------------------------------------------<
			
			
			
			//Post Image Effect---------------------------------------->
			$(".post_img").hover(function(){
				var fade = $(this).children("span");
				if (fade.is(':animated')) {
				  fade.stop().fadeTo(250, 1);
				} else {
				  fade.fadeIn(250);
				}
			}, function(){
				var fade = $(this).children("span");
				if (fade.is(':animated')) {
				  fade.stop().fadeTo(1000, 0);
				} else {
				  fade.fadeOut(1000);
				}
			});    
			//--------------------------------------------------------<
			
			//Read More Button---------------------------------------->
			var rm_links = $(".more-link")
			rm_links.each(function(index) {
				var rm_text = $(this).text();
				$(this).html("<b>"+rm_text+"</b><span></span>");
				
			  });
			rm_links.hover(function(){
				var b_slide = $(this).children("b");
				if ($(this).is(':animated')) {
				  $(this).stop().animate({width: 80});
				  b_slide.stop().animate({left: 5});
				} else {
				  $(this).animate({width: 80});
				  b_slide.animate({left: 5});
				}
			}, function(){
				var b_slide = $(this).children("b");
				if ($(this).is(':animated')) {
				  $(this).stop().animate({width: 10});
				  b_slide.stop().animate({left: -70});
				} else {
				  $(this).animate({width: 10});
				  b_slide.animate({left: -70});
				}
			});    
			//--------------------------------------------------------<
			
			
			
			/*
			//Galleria---------------------------------------->
			 $('#galleria').galleria({
					width:660,
					height:600,
					extend: function(options) {
						this.bind('image', function(e) {
							$(e.imageTarget).click(this.proxy(function() {
							   this.openLightbox();
							}));
						});
					}
				});

			//--------------------------------------------------------<
			  */
			  
			//Lightbox
			$("a[rel^='prettyPhoto']").prettyPhoto({show_title: false, theme: 'dark_square'});
			
			//Gallery
			//If link to an Image do Prettyphoto
			attach = $(".gallery dl dt a").attr('href');
			comp = /attachment_id/;
			if(!comp.test(attach)){
			$(".gallery dl dt a").prettyPhoto({show_title: false, theme: 'dark_square'});
			}
			//Add class image-frame
			$(".gallery dl dt a").each(function(index) {
													$(this).attr('rel', 'prettyPhoto[pp_gal]')
													$(this).children("img").addClass("image-frame");
												});
			
			//Tabs
			$("ul.tabs").tabs("div.panes > div");
			$(".accordion").tabs(".accordion div.pane", {tabs: 'h2', effect: 'slide', initialIndex: null});
			
			//Hide (Collapse) the toggle containers on load
			$(".toggle_container").hide(); 
		
			//Switch the "Open" and "Close" state per click then slide up/down (depending on open/close state)
			$("h3.trigger").click(function(){
				$(this).children("a").toggleClass("active").parent().next().slideToggle("slow");
				return false; //Prevent the browser jump to the link anchor
			});
			
			
			//Quick Contact Form styling
			$(".quick_contact input").click(function(){
					$(this).next().fadeOut(100);
			});
			
			
			//Sidebar Menu Function
			$('#sidebar .widget ul li ul').parent().addClass('hasChildren').children('a').append("<span />");
			var children;
			$("#sidebar .widget ul li").hoverIntent(
										  function () {
											children = $(this).children("ul");
											if($(children).length > 0){
													$(children).stop(true, true).slideDown('fast');	   
											}
										  }, 
										  function () {
											  $(this).children('ul').stop(true, true).slideUp(500);
										  }
			);
			
			//Footer Menu Function
			$('footer .widget ul li ul').parent().addClass('hasChildren').children('a').append("<span />");
			var children;
			$("footer .widget ul li").hoverIntent(
										  function () {
											children = $(this).children("ul");
											if($(children).length > 0){
													$(children).stop(true, true).slideDown('fast');	   
											}
										  }, 
										  function () {
											  $(this).children('ul').stop(true, true).slideUp(500);
										  }
			);
						
			
			
			//Make Slider Image clickeables even with Patterns on top  			
			$("#supersized").click(function(){
					var attr_href = $(this).children(".activeslide").children("a").attr("href");
					if(attr_href){
						window.location.href = attr_href;
					}
			});
			
														

});

