// Superfish Menu
jQuery(document).ready(function(){
	jQuery('.menu').superfish({
            delay:      	0,                           
            animation:   {opacity:'show',height:'show'}, 
            speed:       300,                         
            autoArrows:  false,                         
            dropShadows: false                            
	 });
});

	


jQuery(document).ready(function(){
jQuery("a[href$='.jpg'], a[href$='.jpeg'], a[href$='.gif'], a[href$='.png']").prettyPhoto({theme:'light_rounded',overlay_gallery: false});
});
				

jQuery(document).ready(function(){	
	
	jQuery('.showpostload').hide();
	jQuery('.showpostpostcontent').hide();
	jQuery('.closehomeshow').hide();
	jQuery('.click').click(function() {
	var id = jQuery(this).attr("id");
	var url = "home/";
	var invariable = id.split('_');
	jQuery('html, body').animate({scrollTop:730}, 400);
	if(jQuery('.blogpost').is(":visible")){
		var oldheight = jQuery('.showpostpostcontent').height();
		jQuery('.showpostpostcontent').fadeOut(200);	
		jQuery('.showpostpostcontent').empty();
		jQuery('.closehomeshow').fadeOut(200);		
		jQuery('.showpostload').delay(200).fadeIn(200);
		if(oldheight > 500){
			var heightnew = oldheight - 500;
			jQuery('#showpost').delay(300).animate({"height": "-="+heightnew+"px"}, 500);	
		}		
		if(oldheight < 500){
			var heightnew = 500 - oldheight ;
			jQuery('#showpost').delay(300).animate({"height": "+="+heightnew +"px"}, 500);	
		}
		jQuery('.showpostpostcontent').load(url+invariable[1]+'.html'  ,function () {
		jQuery('.posttext img').imagesLoaded(function () {
			height = jQuery('.showpostpostcontent').height();
			if(height >500) {
				heightnew = height - 500;
				jQuery('#showpost').animate({"height": "+="+heightnew+"px"}, 500);
			}
			if(height < 500) {
				heightnew =  500 - height;
				jQuery('#showpost').animate({"height": "-="+heightnew+"px"}, 500);
			}

			jQuery('.showpostload').fadeOut(800);
			jQuery('.showpostpostcontent').delay(900).fadeIn(200);
			jQuery('.closehomeshow').delay(900).fadeIn(200);
			} );
		} );
	}
	else{
		var height = 0;
		jQuery('#showpost').animate({"height": "+=500px"}, 500);
		jQuery('.showpostload').fadeIn(200);
		jQuery('.catlink').delay(500).fadeOut(200);	
		jQuery('#showpost').animate({"margin-top": "-=30px"}, 500);		
		jQuery('.showpostpostcontent').load(url+invariable[1]+'.html'  ,function () {
		jQuery('.posttext img').imagesLoaded(function () {
			height = jQuery('.showpostpostcontent').height();
			if(height > 500) {
				var newheight = height - 500;
				jQuery('#showpost').animate({"height": "+="+newheight+"px"}, 500);
			}
			if(height < 500) {
				var newheight =  500 - height;
				jQuery('#showpost').animate({"height": "-="+newheight+"px"}, 500);
			}
			jQuery('.showpostload').fadeOut(800);
			jQuery('.showpostpostcontent').delay(900).fadeIn(200);
			jQuery('.closehomeshow').delay(900).fadeIn(200);			
		})
		});

	}

	});
	
	jQuery('.closehomeshow').click(function() {
		var height = jQuery('#showpost').height()
		jQuery('.showpostpostcontent').fadeOut(200);
		jQuery('.closehomeshow').fadeOut(200);	
		jQuery('#showpost').animate({"height": "-="+height+"px"}, 750);
		jQuery('#showpost').delay(0).animate({"margin-top": "+=30px"}, 500);		
		jQuery('.catlink').delay(1000).fadeIn(200);		
	});	
	


	

	
jQuery('.image').each(function(index,el){
          
       //find this link's child image element
      var img = jQuery(this).find('img');
	  var loading = jQuery(this).children('div');
      //hide the image and attach the load event handler

      jQuery(img).hide();
	  jQuery(window).load(function () {
           
            //remove the link's "loading" classname
            loading.removeClass('loading');
			
            //show the loaded image
           jQuery(img).fadeIn();
      })

	 /*if ( jQuery.browser.msie || jQuery.browser.mozilla ) {
	   jQuery(img).delay(500).fadeIn();
		loading.delay(2500).removeClass('loading')

	}*/
	//loading.delay(1500).removeClass('loading');
	//jQuery(img).delay(1550).fadeIn();
	});
});

jQuery(document).ready(function(){	
	if (jQuery('.notification').length == 0) {
		jQuery('#headerwrap').animate({"height": "-=30px"}, "fast");
		jQuery('#header').animate({"top": "-=30px"}, "fast");
	}
	

	
});
jQuery(document).ready(function(){	
	jQuery('.slider-item img').imagesLoaded(function () {
		jQuery('.slider-item .loading').removeClass('loading');
		})
});

jQuery(document).ready(function(){	
	jQuery('.blogpostcategory').each(function(index,el){
			  
		   //find this link's child image element
		  var iframe = jQuery(this).find('iframe');
		  var loading = jQuery(this).children('div');
		  //hide the image and attach the load event handler
		  jQuery(iframe).hide();
		  jQuery(window).load(function () {
			   
				//remove the link's "loading" classname
				loading.removeClass('loading');
				
				//show the loaded image
			   jQuery(iframe).fadeIn();
		  })
	});
});



			
jQuery(document).ready(function() {	

	jQuery(".toggle_container").hide(); 

	jQuery("h2.trigger").click(function(){
		jQuery(this).toggleClass("active").next().slideToggle("slow");
	});
});	

jQuery(document).ready(function(){	
	jQuery(function() {
	jQuery(".tabs").tabs(".panes > div");
	});
});

jQuery(document).ready(function(){	
	function getCookie(c_name)
	{
	var i,x,y,ARRcookies=document.cookie.split(";");
	for (i=0;i<ARRcookies.length;i++)
	{
	  x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
	  y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
	  x=x.replace(/^\s+|\s+$/g,"");
	  if (x==c_name)
		{
		return unescape(y);
		}
	  }
	}

	var notification=getCookie("pmcnotification")
	if(notification == "close"){
		jQuery('#close').attr('class','open');
		jQuery(".notification").hide();
		jQuery("#logo").animate({"top": "-=26px"}, "medium");
		jQuery(".menu-header").animate({"top": "-=26px"}, "medium");

		jQuery("#headerwrap").animate({"height": "-=26px"}, "medium");				
	}
	
	jQuery('#close').click(function() {
	jQuery(".notification").animate({height:'toggle'},250);
	if(jQuery('#close').hasClass('close')){
		jQuery('#close').slideUp(0)
		   .delay(0)
		   .queue(function(next) { jQuery(this).attr('class','open'); next(); })
		   .delay(0)
		   .slideDown(250);
			document.cookie="pmcnotification=close;path=/";
			jQuery("#logo").animate({"top": "-=26px"}, "medium");
			jQuery(".menu-header").animate({"top": "-=26px"}, "medium");


			
			jQuery("#headerwrap").animate({"height": "-=26px"}, "medium");					
	}
	else{
		jQuery('#close').fadeOut(200)
		   .delay(200)
		   .queue(function(next) { jQuery(this).attr('class','close'); next(); })
		   .delay(0)
		   .fadeIn(200); 
		   document.cookie="pmcnotification=open;path=/";
			jQuery("#logo").animate({"top": "+=26px"}, "medium");
			jQuery(".menu-header").animate({"top": "+=26px"}, "medium");


	
			jQuery("#headerwrap").animate({"height": "+=26px"}, "medium");					
	}
	});
});


jQuery(document).ready(function(){	
	jQuery('.gototop').click(function() {
		jQuery('html, body').animate({scrollTop:0}, 'medium');
	});
});

jQuery(document).ready(function(){	
	jQuery('#searchsubmit').val('');
	var screenWidth = screen.availWidth;
	document.cookie="pmcwidth="+screenWidth+";path=/";
});

jQuery(document).ready(function(){	
	jQuery('#remove h2 a:first-child').attr('class','catlink catlinkhover');
	jQuery('.catlink').click(function() {
		jQuery('#remove h2 a').attr('class','catlink');
		jQuery(this).attr('class','catlink catlinkhover');
	});	
});

jQuery(document).ready(function(){	
	jQuery('#style-switcher').hide();
	jQuery('#style-switcher-button').click(function() {
			jQuery('#style-switcher').show();
			jQuery('#style-switcher-button').hide();
	});	
	
	jQuery('#style-switcher').click(function() {
			jQuery('#style-switcher').hide();
			jQuery('#style-switcher-button').show();
	});	
});


jQuery(function(){
    jQuery("ul#ticker01").liScroll();
});

//home page


//


	
