/* global 1 */
jQuery(document).ready(function(){
	jQuery(".entryinitial").hide();

	jQuery("#about .moreabout").hide();
	jQuery("#about").append("<p class=more><a href=# title='read more'>[+]</a></p>");
	
	jQuery('#about p.more a').toggle(
		function() {
			jQuery(this).text('[-]');
			jQuery(this).attr({title:'close'});
			jQuery("#about .moreabout").slideDown(300);
		},
		function() {
			jQuery(this).text('[+]');
			jQuery(this).attr({title:'read more'});
			jQuery("#about .moreabout").slideUp(300);
	});

	jQuery('#about p.more a').click(function(){
		return false;
	});

	jQuery(".photos").each(function(){
		jQuery(".photos, .photos img").css({"width" : "492px", "height":"505px"});
		var postid = jQuery(this).parents("div.post").attr("id");
		var photoid = "photo" + postid;
		var nextphoto = "nextphoto" + postid;
		var prevphoto = "prevphoto" + postid;
		var playpause = "playpause" + postid;
		jQuery(this).parents(".entry").prepend("<div class=controls> <a title=previous href=# class=prev-ex id=" + prevphoto + "><span>prev</span></a> <a title=pause/play href=# class=pause-ex id=" + playpause + "><span>pause/play</span></a> <a title=next href=# class=next-ex id=" + nextphoto + "><span>next</span></a> </div>");
		jQuery(this).attr("id", photoid);
		jQuery("#" + photoid).cycle({
			fx: "fade",
			timeout: 3000,
			next: "#" + nextphoto,
			prev: "#" + prevphoto
			});
		jQuery("#" + playpause).toggle (
		function() {
			jQuery("#" + photoid).cycle("pause");
			jQuery(this).removeClass("pause-ex");
			jQuery(this).addClass("play-ex");
		},
		function() {
			jQuery("#" + photoid).cycle("resume");
			jQuery(this).removeClass("play-ex");
			jQuery(this).addClass("pause-ex");
		});
	});
	
	jQuery(".openentry").click(function(){
		var divpostidandentry = "#"+jQuery(this).parents("div.post").attr("id")+" .entry";
		var h3posta = "#"+jQuery(this).parents("div.post").attr("id")+" .posttitle";	
		jQuery(h3posta).addClass("posttitle-alt");
		jQuery(this).parents(".img-t-link").hide(400);
		jQuery(divpostidandentry).show(400);
		return false;
	});
	
	jQuery(".entry").prepend('<div class="closeentry"><a href="#">close</a></div>');
	
	jQuery(".closeentry").click(function(){
		var divpostidandtestme = "#"+jQuery(this).parents("div.post").attr("id")+" .img-t-link";
		var h3postb = "#"+jQuery(this).parents("div.post").attr("id")+" .posttitle";	
		jQuery(h3postb).removeClass("posttitle-alt");
		jQuery(this).parents(".entry").hide(400);
		jQuery(divpostidandtestme).show(400);
		return false;
	});	
	
	var target = '.catftr';
  	var hoverClass = 'hovercatftr';

	jQuery(target).each(function() {
		jQuery(this).hover(
	      function() {
	         jQuery(this).addClass(hoverClass);
	         status=jQuery(this).find('h2 a').attr('href');
			 },
	      function () {
	         jQuery(this).removeClass(hoverClass);
	      });
	    jQuery(this).click(function() {
	       location = jQuery(this).find('a').attr('href');
	    });
	    jQuery(this).css('cursor','pointer');
	  });
	  
	jQuery(".section-cat .post:first").addClass('ntm');
	jQuery(".home #content").after('<div class=preloadhdr1></div><div class=preloadhdr2></div>');
});