/******************************************************
*
*	Softscroll
*
******************************************************/
jQuery(document).ready(function(){
jQuery('a[href*=#]').click(function() {
	if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
	&& location.hostname == this.hostname) {
		var $target = jQuery(this.hash);
		$target = $target.length && $target
		|| jQuery('[name=' + this.hash.slice(1) +']');
		if ($target.length) {
			var targetOffset = $target.offset().top;
			jQuery('html,body')
			.animate({scrollTop: targetOffset}, 1000);
			return false;
		}
	}
});
});




/******************************************************
*
*	Replacing rel="external" for Strict XHTML using
*
******************************************************/
jQuery(function() {
	jQuery('a[rel*=external]').click( function() {
		window.open(this.href);
		return false;
	});
});




/******************************************************
*
*	Cufon visibility in IE8
*
******************************************************/
jQuery(window).one("load", function(){
	jQuery('#logo,#bottom-logo').css({'display':'inline'});
});




/******************************************************
*
*	Rounded corner on menu and submenu in general
*
******************************************************/
jQuery(function() {
    jQuery('#bio_menu li').hover(
	function() { 
		jQuery(this).addClass('bio_hover');
	},
	function() { 
		jQuery(this).removeClass('bio_hover');
	});
});

jQuery(function() {
    jQuery('#bio_menu ul li:last-child').addClass("last");
});




/******************************************************
*
*	Get current page
*
******************************************************/
jQuery(function() {
    var pathname = window.location.pathname;
    var pagename = pathname.substring(pathname.lastIndexOf('/') + 1);
    if(pagename == "") {
    	pagename = "index.php";
    }
    jQuery('#bio_menu > li').each(function(){
        var href = jQuery(this).find('a:first').attr('href');
        if(href == pagename) {
        	jQuery(this).addClass('current_page_item');
        }
    });
    jQuery('.bio_pages a').each(function(){
        var href = jQuery(this).attr('href');
        if(href == pagename) {
        	jQuery(this).addClass('current-page');
        }
    });
});




/******************************************************
*
*	Effect on search box
*
******************************************************/
jQuery(function() {
    var searchInner = jQuery('#search_box input[type="text"]').hide();
    jQuery('#search_box').css({'background-position':'0 -38px'});
    var searchForm = jQuery('#search_box form').css({'width':'42px'});
    jQuery('#search_box')
        .mouseenter(function(){
			jQuery('#search_box').css({'background-position':'0 0'});
			jQuery('#search_box input[type="submit"]').css({'background-position':'right -38px'});
            searchForm.stop(true,false).animate({'width': '202px'},200, function() {
				searchInner.show();
			});
        })
        .mouseleave(function(){
            searchForm.stop(true,false).animate({'width': '42px'},200, function() {
				jQuery('#search_box').css({'background-position':'0 -38px'});
				jQuery('#search_box input[type="submit"]').css({'background-position':'right 0'});
			});
			searchInner.hide();
        });
});




/******************************************************
*
*	Default value on emailus
*
******************************************************/
jQuery(function() {
    jQuery('input[type=text]').addClass('onBlur');
    jQuery('textarea').addClass('onBlur');
	jQuery('input[type=text]').focus(function() {
		jQuery(this).removeClass('onBlur');
        if (this.value == this.defaultValue){
        	this.value = '';
    	}
        if(this.value != this.defaultValue){
	    	this.select();
        }
    });
    jQuery('input[type=text]').blur(function() {
        if (this.value == ''){
			jQuery(this).addClass('onBlur');
        	this.value = (this.defaultValue ? this.defaultValue : '');
    	}
    });
	jQuery('textarea').focus(function() {
		jQuery(this).removeClass('onBlur');
        if (this.value == this.defaultValue){
        	this.value = '';
    	}
        if(this.value != this.defaultValue){
	    	this.select();
        }
    });
    jQuery('textarea').blur(function() {
        if (this.value == ''){
			jQuery(this).addClass('onBlur');
        	this.value = (this.defaultValue ? this.defaultValue : '');
    	}
    });
});





/******************************************************
*
*	Colorbox
*
******************************************************/



jQuery(window).one("load", function(){
	jQuery("#slideshow a[href$='.jpg']").colorbox({maxWidth:"98%", maxHeight:"98%", onOpen: function(){jQuery('#slider').data('nivo:vars').stop = true;}, onClosed: function(){ setTimeout(function(){ jQuery('#slider').data('nivo:vars').stop = false; }, 2000) }});
	jQuery("#slideshow a[href$='.png']").colorbox({maxWidth:"98%", maxHeight:"98%", onOpen: function(){jQuery('#slider').data('nivo:vars').stop = true;}, onClosed: function(){ setTimeout(function(){ jQuery('#slider').data('nivo:vars').stop = false; }, 2000) }});
	jQuery("#slideshow a[href$='.jpg']").colorbox({maxWidth:"98%", maxHeight:"98%", onOpen: function(){jQuery('#slider').data('nivo:vars').stop = true;}, onClosed: function(){ setTimeout(function(){ jQuery('#slider').data('nivo:vars').stop = false; }, 2000) }});
	jQuery("#slideshow a.colorbox").colorbox({maxWidth:"98%", maxHeight:"98%", onOpen: function(){jQuery('#slider').data('nivo:vars').stop = true;}, onClosed: function(){ setTimeout(function(){ jQuery('#slider').data('nivo:vars').stop = false; }, 2000) }});
	jQuery("#slideshow a[href*='vimeo']").colorbox({iframe:true, innerWidth:640, innerHeight:480, onOpen: function(){jQuery('#slider').data('nivo:vars').stop = true;}, onClosed: function(){ setTimeout(function(){ jQuery('#slider').data('nivo:vars').stop = false; }, 2000) }});
	jQuery("#slideshow a[href*='youtube']").colorbox({iframe:true, innerWidth:640, innerHeight:480, onOpen: function(){jQuery('#slider').data('nivo:vars').stop = true;}, onClosed: function(){ setTimeout(function(){ jQuery('#slider').data('nivo:vars').stop = false; }, 2000) }});
	jQuery("a[href$='.jpg']").not('.noColor').colorbox({maxWidth:"98%", maxHeight:"98%"});
	jQuery("a[href$='.png']").not('.noColor').colorbox({maxWidth:"98%", maxHeight:"98%"});
	jQuery("a[href$='.jpg']").not('.noColor').colorbox({maxWidth:"98%", maxHeight:"98%"});
	jQuery("a.colorbox").colorbox({maxWidth:"98%", maxHeight:"98%"});
	jQuery("a[href*='vimeo']").not('.noColor').colorbox({iframe:true, innerWidth:640, innerHeight:480});
	jQuery("a[href*='youtube']").not('.noColor').colorbox({iframe:true, innerWidth:640, innerHeight:480});
});
    



/******************************************************
*
*	Slideshow
*
******************************************************/
jQuery(window).one("load", function(){
	jQuery('#slider').fadeIn();
	jQuery('#slider').nivoSlider({
		effect:'random',
		slices:15,
		animSpeed:1000,
		pauseTime:3500,
		directionNav:true,
		directionNavHide:false,
		controlNav:true,
		keyboardNav:true,
		beforeChange: function(){
			jQuery('#slider .bio_caption').fadeOut(800);
		},
		afterChange: function(){
			jQuery('#slider .bio_caption').fadeOut(0);
			jQuery('#slider .bio_caption').fadeIn('slow');
		}
	});
	setTimeout(function(){
		jQuery('#slider .bio_caption').fadeIn(800);
	}, 1000);
	jQuery('.nivo-directionNav a').wrapInner('<span class="nav-shadow" />');
});


/******************************************************
*
*	Links in bio_caption
*
  ******************************************************/
jQuery(document).ready(function() {
	jQuery('.bio_caption .link').mouseover(function(){
		jQuery(this).css({'text-decoration':'none'});
		jQuery(this).parent().parent().bind("click.myDisable", function() { return false; });
	})
	.mouseout(function(){
		jQuery(this).css({'text-decoration':'underline'});
		jQuery(this).parent().parent().unbind("click.myDisable");
	})
	jQuery('.bio_caption .link').each(function(){
		var href = jQuery(this).text();
		var href2 = href.substring(href.lastIndexOf('|') + 1);
		var href3 = href.substring(href.lastIndexOf('|') - 1);
		jQuery(this).click(function(){
			window.location.href = href2;
		});
		var removeHref = jQuery(this).text().replace(href3,"");
		jQuery(this).text(removeHref);
	});
});



/******************************************************
*
*	Background effect on mouse over
*
  ******************************************************/
jQuery(window).one("load", function(){
	jQuery('.nivo-prevNav')
		.css( {backgroundPosition: "8px 0"} )
		.mouseover(function(){
			jQuery(this).stop().animate({backgroundPosition:"(0 0)"}, {duration:100})
		})
		.mouseout(function(){
			jQuery(this).stop().animate({backgroundPosition:"(8px 0)"}, {duration:100, complete:function(){
				jQuery(this).css({backgroundPosition: "8px 0"})
			}})
		})
	jQuery('.nivo-nextNav')
		.css( {backgroundPosition: "-8px 0"} )
		.mouseover(function(){
			jQuery(this).stop().animate({backgroundPosition:"(0 0)"}, {duration:100})
		})
		.mouseout(function(){
			jQuery(this).stop().animate({backgroundPosition:"(-8px 0)"}, {duration:100, complete:function(){
				jQuery(this).css({backgroundPosition: "-8px 0"})
			}})
		})
});



/******************************************************
*
*	More button
*
  ******************************************************/
jQuery(document).ready(function(){
	jQuery('.morebutton').wrapInner('<span />');
	jQuery('.morebutton').mousedown(function(){
		jQuery(this).addClass('morebuttonClick');
	});
	jQuery('.morebutton').mouseup(function(){
		jQuery(this).removeClass('morebuttonClick');
	});
	jQuery('.morebutton input').parent().css('padding','0');
});



/******************************************************
*
*	Feature
*
  ******************************************************/
jQuery(document).ready(function(){
	var featMoreBut = 950-(jQuery('#feature .morebutton').width());
	var featH = jQuery('#feature').height();
	var featH3 = jQuery('#feature h3').height();
	var featP = jQuery('#feature .quote p').height();
	jQuery('#feature .quote').css({'width':featMoreBut});
	if (featP > 55) {
		var featPlus = (featP - 55)*0.5;
		var featTop = (jQuery('#feature .quote h3').height())+featPlus;
	}
	else {
		var featTop = (featP+featH3)-50;
	}
	jQuery('#feature .morebutton').css({'margin-top':featTop+2});
    
    if(jQuery('#slideshow').length == 0) {
        if(jQuery.browser.msie && jQuery.browser.version < 8) {
            jQuery('.home #feature').css({'padding':(322-(featH3+featP))*0.5+'px 0'});
        }
        else {
            jQuery('.home #feature').css({'padding':(302-(featH3+featP))*0.5+'px 0'});
        }
        jQuery('.home #feature').addClass('noSlideshow');
        jQuery('.home #top').css({'height':'600px'});
        jQuery('.home .middle:first .wall').css({'background':'none','margin-top':'-150px'});
    }
});



/******************************************************
*
*	Entry img
*
  ******************************************************/
jQuery(document).ready(function(){
	jQuery('.showcase .showcasebox').wrapInner('<div class="paddingimg" />');
	jQuery('.entry, .bio_recent_comments, #author_info, #commentlist').not(':has(.showcasebox)').find('img').not('.noBorder').wrap('<div class="paddingimg" />');
	jQuery('.entry iframe, .entry object').wrap('<div class="paddingimg" />');
	jQuery('.paddingimg').wrap('<div class="borderimg" />');
	jQuery('.entry').not(':has(.showcasebox)').find('.paddingimg').wrapInner('<div class="iconimg" />');
	jQuery('.entry img.alignleft').not('.noBorder').removeClass('alignleft').parent().parent().parent().addClass('alignleft');
	jQuery('.entry img.alignright').not('.noBorder').removeClass('alignright').parent().parent().parent().addClass('alignright');
	jQuery('.entry img.aligncenter').not('.noBorder').removeClass('aligncenter').parent().parent().parent().addClass('aligncenter');
	jQuery('.entry .aligncenter').wrap('<div class="alignleft" style="width:100%" />');
	jQuery('.entry .aligncenter').each(function() {
    	var wrapW = jQuery(this).parent('div').width();
    	var thisW = jQuery(this).width();
        jQuery(this).css('margin-left',((wrapW - (thisW + 2))*0.5) +'px'); 
    });
	jQuery('.entry img.alignnone').not('.noBorder').removeClass('alignnone').parent().parent().parent().addClass('alignnone');
	jQuery('.entry .alignnone').wrap('<div class="alignleft" style="width:100%" />');
	jQuery('.showcasebox img').before('<div class="iconimg" />');
	jQuery('.showcase .iconimg').css('opacity','0.6');
});
jQuery(window).one("load", function(){
	jQuery('.showcase .iconimg').each(function(){
    	var padH = jQuery(this).parent().height();
        jQuery(this).css('height',padH+22+'px');
    });
});



/******************************************************
*
*	Teaser link
*
  ******************************************************/
jQuery(document).ready(function(){
	jQuery('.teasers .teaser img').each(function() {
		jQuery(this).mouseup(function(){
			 jQuery(this).parent().parent().parent().parent().find('a.morebutton').click();
		});
	});
	jQuery('.teasers .teaser img').hover(function(){
		jQuery(this).stop(true,false).animate({'opacity':'0.5'},150);
	},function(){
		jQuery(this).stop(true,false).animate({'opacity':'1'},150);
	});
});



/******************************************************
*
*	Teaserrow
*
  ******************************************************/
(function($){

   $.fn.wrapChildren = function(options) {

    var options = $.extend({
                              childElem : undefined,
                              sets : 1,
                              wrapper : 'div class="teaserrow"'
                            }, options || {});
    if (options.childElem === undefined) return this;

 return this.each(function() {
  var elems = jQuery(this).children(options.childElem);
  var arr = [];

  elems.each(function(i,value) {
    arr.push(value);
    if (((i + 1) % options.sets === 0) || (i === elems.length -1))
   {
     var set = jQuery(arr);
     arr = [];
     set.wrapAll(jQuery("<" + options.wrapper + ">"));
   }
  });
    });

  }

})(jQuery);

jQuery(function() {
  jQuery('.teasers').wrapChildren({ childElem : '.teaser' , sets: 3});
  jQuery('.double .teasers').wrapChildren({ childElem : '.teaser' , sets: 2});
  jQuery('.double .teasers .teaser:odd').css({'margin-right':'0'});
  jQuery('.showcase').wrapChildren({ childElem : '.showcasebox' , sets: 3});
});



/******************************************************
*
*	Showcase effect
*
  ******************************************************/
jQuery(function() {
	jQuery('.showcase .showcasebox').hover(function(){
		jQuery(this).find('img').stop(true,false).animate({'opacity':'0'},300);
	},function(){
		jQuery(this).find('img').stop(true,false).animate({'opacity':'1'},300);
	});

	
	jQuery('.showcase .showcasebox').mouseup(function() {
		jQuery(this).find('a').click();
	});
});



/******************************************************
*
*	Hover effect in general
*
  ******************************************************/
(function($) {
	$.fn.customFadeIn = function(speed, callback) {
		jQuery(this).fadeIn(speed, function() {
			if(!$.support.opacity)
				jQuery(this).get(0).style.removeAttribute('filter');
			if(callback != undefined)
				callback();
		});
	};
	$.fn.customFadeOut = function(speed, callback) {
		jQuery(this).fadeOut(speed, function() {
			if(!$.support.opacity)
				jQuery(this).get(0).style.removeAttribute('filter');
			if(callback != undefined)
				callback();
		});
	};
	$.fn.customFadeTo = function(speed,to,callback) {
		return this.animate({opacity: to}, speed, function() {
			if (to == 1 && jQuery.browser.msie)
				this.style.removeAttribute('filter');
			if (jQuery.isFunction(callback))
				callback();
		});
	};
})(jQuery);

jQuery(function() {
    if(jQuery.browser.msie){
       jQuery('a img[src$=.jpg], a img[src$=.gif]').hover(function(){
            jQuery(this).stop(true,false).animate({'opacity':'0.7'},150);
        },function(){
            jQuery(this).stop(true,false).animate({'opacity':'1'},150);
        });
        jQuery('.iconimg img[src$=.jpg], .iconimg img[src$=.gif], .entry a img[src$=.jpg], .entry a img[src$=.gif]').hover(function(){
            jQuery(this).stop(true,false).animate({'opacity':'0.2'},150);
        },function(){
            jQuery(this).stop(true,false).animate({'opacity':'1'},150);
        });
    }
    else {
       jQuery('a img, #logo, #bottom-logo').hover(function(){
            jQuery(this).stop(true,false).animate({'opacity':'0.7'},150);
        },function(){
            jQuery(this).stop(true,false).animate({'opacity':'1'},150);
        });
        jQuery('.iconimg img, .entry a img').hover(function(){
            jQuery(this).stop(true,false).animate({'opacity':'0.2'},150);
        },function(){
            jQuery(this).stop(true,false).animate({'opacity':'1'},150);
        });
    }
});





/******************************************************
*
*	Recent posts
*
******************************************************/
jQuery(document).ready(function() {
	if (jQuery('.post_slider').length != 0) {
		jQuery('.post_slider').cycle({
		fx:'scrollLeft',
		speed:500,
		timeout:7000,
		cleartype:!$.support.opacity,
		cleartypeNoBg:true,
		prev:'.bio_recent_posts .prev', 
		next:'.bio_recent_posts .next'
		});
	}

	if (jQuery('.post_slider2').length != 0) {
		jQuery('.post_slider2').cycle({
		fx:'scrollLeft',
		speed:500,
		timeout:6000,
		cleartype:!$.support.opacity,
		cleartypeNoBg:true,
		prev:'.bio_recent_comments .prev', 
		next:'.bio_recent_comments .next'
		});
	}
});



/******************************************************
*
*	Cut bg
*
  ******************************************************/
jQuery(window).one("load", function(){
	jQuery('.cut').wrapInner('<div class="vertical_cut" />');
	jQuery('.vertical_cut').wrapInner('<div class="vertical_cut-bottom" />');
	jQuery('.vertical_cut-bottom').wrapInner('<div class="vertical_cut-top" />');
	jQuery('.cut').find('.double .post:first').css('margin-top','-20px');
	jQuery('.cut').find('.sidebar .bio_widget:first').css('margin-top','-5px');
	jQuery('.cut').find('.sidebar .bio_widget:last').css('background','none');
});



/******************************************************
*
*	Quicklinks
*
  ******************************************************/
jQuery(function() {
	var sizeSidebar = jQuery('#footer .sidebar').size();
	if (sizeSidebar == 3) {
		jQuery('#quicklinks ul.multilist').makeacolumnlists({cols:2,colWidth:0,equalHeight:false,startN:1});
        var ulMultilist = jQuery('.li_container ul.multilist').size();
        jQuery('ul.multilist').css({'width':300/ulMultilist+'px'});
        jQuery('ul.multilist li').css({'width':(300/ulMultilist)-10+'px'});
	}
	else if (sizeSidebar == 2) {
		jQuery('.footer #quicklinks .multilist li').css({'width':'142px'});
		jQuery('.footer #quicklinks .multilist ul ul').css({'width':'142px'});
		jQuery('.sidebar#quicklinks').css({'width':'650px'});
		jQuery('.sidebar#quicklinks .multilist').css({'width':'650px'});
		jQuery('#quicklinks ul.multilist').makeacolumnlists({cols:4,colWidth:162.5,equalHeight:false,startN:1});
        var ulMultilist = jQuery('.li_container ul.multilist').size();
        jQuery('ul.multilist').css({'width':650/ulMultilist+'px'});
        jQuery('ul.multilist li').css({'width':(650/ulMultilist)-10+'px'});
	}
	else if (sizeSidebar == 1) {
		jQuery('.footer #quicklinks .multilist li').css({'width':'146px'});
		jQuery('.footer #quicklinks .multilist ul ul').css({'width':'146px'});
		jQuery('.sidebar#quicklinks').css({'width':'1000px','margin':'0'});
		jQuery('.sidebar#quicklinks .multilist').css({'width':'1000px','margin':'0'});
		jQuery('#quicklinks ul.multilist').makeacolumnlists({cols:6,colWidth:166.6,equalHeight:false,startN:1});
        var ulMultilist = jQuery('.li_container ul.multilist').size();
        jQuery('ul.multilist').css({'width':1000/ulMultilist+'px'});
        jQuery('ul.multilist li').css({'width':(1000/ulMultilist)-10+'px'});
	}
});



/******************************************************
*
*	Credits vertical align
*
  ******************************************************/
jQuery(window).one("load", function(){
	var lineH = jQuery('#bottom-logo').height();
	if (lineH > 15) {
		jQuery('#credits').css({'line-height':lineH+'px'});
	}
	if (lineH > 28) {
		var marginT = (lineH - 28)*0.5;
		jQuery('#backtotop').css({'margin-top':marginT+'px'});
	}
});




/******************************************************
*
*	Scroll on Portfolio Slideshow page
*
******************************************************/
jQuery(window).one("load", function(){
	if (jQuery('body.home').length == 0 && jQuery('#slideshow').length == 1) {
		var windH = jQuery(window).height();
		var slideH = jQuery('#slideshow').height();
		var slideMarg = (windH - slideH)*0.5;
		var offset = jQuery('#slideshow').offset();
		var slidePos = (offset.top)-(slideMarg-50);
		setTimeout(function(){
			jQuery('html,body').animate({scrollTop: slidePos}, 500);
		}, 800);
	}
});



/******************************************************
*
*	HR totop
*
******************************************************/
jQuery(function() {
	jQuery('hr').wrap('<div class="hr" />');
	jQuery('hr.totop').wrap('<div class="hrtotop" />');
	jQuery('.hrtotop').after('<span class="totop" />');
	jQuery('span.totop').click(function(){
		jQuery('html,body').animate({scrollTop: 0}, 500);
	});
});



/******************************************************
*
*	Dropcap
*
******************************************************/
jQuery(document).ready(function(){
	jQuery('p.dropcap').each(function () {
		  var el = jQuery(this),
				text = el.html(),
				first = text.slice(0, 1),
				rest = text.slice(1);
		  el.html('<span class="firstletter">' + first + '</span>' + rest);
	});
});



/******************************************************
*
*	Widget list
*
******************************************************/
jQuery(document).ready(function(){
    jQuery('.sidebar ul').find('li:last').css('background','none');
    jQuery('.bio_widget li a:not(.current-page)').hover(
	function() { 
		jQuery(this).stop(true,false).animate({'padding-left': '25px'},200, function() {
			jQuery(this).addClass('hover_current');
		});
	},
	function() { 
		jQuery(this).removeClass('hover_current');
		jQuery(this).stop(true,false).animate({'padding-left': '10px'},200);
	});
});


/******************************************************
*
*	Sitemap
*
******************************************************/
jQuery(document).ready(function(){
    jQuery('.sitemap ul').find('li:last').css('background','none');
    jQuery('.sitemap li a').hover(
	function() { 
		jQuery(this).stop(true,false).animate({'padding-left': '25px'},200, function() {
			jQuery(this).addClass('hover_current');
		});
	},
	function() { 
		jQuery(this).removeClass('hover_current');
		jQuery(this).stop(true,false).animate({'padding-left': '10px'},200);
	});
});


/******************************************************
*
*	IE list bug
*
******************************************************/
jQuery(document).ready(function(){
    jQuery('.post ul, .post ol').wrap('<div class="alignleft" style="width:100%; padding:0; background:none" />');
});


/******************************************************
*
*	Calendar td
*
******************************************************/
jQuery(document).ready(function(){
    jQuery('.bio_calendar td, .bio_calendar th').css({'width':100/7+'%'});
    var tdW = (jQuery('.bio_calendar table').width()/7)-4;
    jQuery('.bio_calendar td, .bio_calendar th').css({'height':tdW+'px'});
    jQuery('.bio_calendar a').css({'line-height':tdW+'px'});
});
jQuery(function() {
    jQuery('.bio_calendar td, .bio_calendar th').hover(
	function() { 
		jQuery(this).addClass('hover');
	},
	function() { 
		jQuery(this).removeClass('hover');
	});
    jQuery('.bio_calendar td:has("a")').addClass('ahover');
});


/******************************************************
*
*	Icon classes
*
******************************************************/
jQuery(window).one("load", function(){
    jQuery(".paddingimg").parent().parent("div:has(a[href*='http'])").find('.iconimg').addClass('readMore');
    jQuery(".paddingimg").parent().parent("div:not(:has(a[href*='http']))").find('.iconimg').addClass('readMore');
    jQuery(".paddingimg").parent().parent("div:has(a[href$='.jpg'])").find('.iconimg').addClass('enlargePicture');
    jQuery(".paddingimg").parent().parent("div:has(a[href$='.gif'])").find('.iconimg').addClass('enlargePicture');
    jQuery(".paddingimg").parent().parent("div:has(a[href$='.png'])").find('.iconimg').addClass('enlargePicture');
    jQuery(".paddingimg").parent().parent("div:has(a[href*='vimeo'])").find('.iconimg').addClass('watchVideo');
    jQuery(".paddingimg").parent().parent("div:has(a[href*='youtube'])").find('.iconimg').addClass('watchVideo');

    jQuery("a[href*='http']").find('.iconimg').addClass('readMore');
    jQuery("a[href^='http']").find('.iconimg').addClass('readMore');
    jQuery("a[href$='jpg']").find('.iconimg').addClass('enlargePicture');
    jQuery("a[href$='gif']").find('.iconimg').addClass('enlargePicture');
    jQuery("a[href$='png']").find('.iconimg').addClass('enlargePicture');
    jQuery("a[href*='vimeo']").find('.iconimg').addClass('watchVideo');
    jQuery("a[href*='youtube']").find('.iconimg').addClass('watchVideo');
});


/******************************************************
*
*	Tag cloud & Postshare
*
******************************************************/
jQuery(window).one("load", function(){
	jQuery('.bio_tag_cloud a').each(function(){
    	var fSize = jQuery(this).css("font-size");
        var fSizenoPx = fSize.replace('px', '');
        jQuery(this).css({'line-height':(fSizenoPx*1.5)+'px','height':(fSizenoPx*1.5)+'px'});
        if(fSizenoPx<14) {
            jQuery(this).css({'color':'#c0c0c0'});
        }
        else if(fSizenoPx>=14 && fSizenoPx<16) {
            jQuery(this).css({'color':'#acacac'});
        }
        else if(fSizenoPx>=16 && fSizenoPx<18) {
            jQuery(this).css({'color':'#999'});
        }
        else if(fSizenoPx>=18 && fSizenoPx<20) {
            jQuery(this).css({'color':'#898989'});
        }
        else {
            jQuery(this).css({'color':'#7f7f7f'});
       }
    });
});

jQuery(window).one("load", function(){
	var tagW = jQuery('#innertags').width();
	var shareW = jQuery('#innershare').width();
	var hovertagW = jQuery('#hovertag').width();
	var hovershareW = jQuery('#hovershare').width();
    jQuery('#tags').css({'width':'0'});
    jQuery('#postshare').css({'width':'0'});
    if(tagW > (590-(hovertagW+hovershareW))) {
        jQuery('#innertags').css({'width':tagW-(hovertagW+hovershareW)+'px'});
    }
    else {
        jQuery('#innertags').css({'width':tagW+5+'px'});
    }
	var tagW2 = jQuery('#innertags').width();
	jQuery('a#hovertag, #tags').hover(function(){
		jQuery('#tags').stop(true,false).animate({'width':tagW2+'px'},300);
	},function(){
		jQuery('#tags').stop(true,false).animate({'width':'0','padding-right':0},300);
	});

    jQuery('#postshare').css({'width':'0','padding-right':0});
    if(shareW > (595-(hovertagW+hovershareW))) {
        jQuery('#innershare').css({'width':shareW-(hovertagW+hovershareW)+'px'});
    }
    else {
        jQuery('#innershare').css({'width':shareW+'px'});
    }
	var shareW2 = jQuery('#innershare').width();
	jQuery('a#hovershare, #postshare').hover(function(){
		jQuery('#postshare').stop(true,false).animate({'width':shareW2+'px','padding-right':'5px'},300);
	},function(){
		jQuery('#postshare').stop(true,false).animate({'width':'0','padding-right':0},300);
	});
});


/******************************************************
*
*	Comments
*
******************************************************/
jQuery(document).ready(function() {
	jQuery('#commentlist .moretn').click(function(){
    	if (jQuery('#commentform input[value=""]:visible').length != 0) {
            jQuery('#commentform input[value=""]:first').focus();
        }
    	else {
            jQuery('#commentform #comment').focus();
        }
    });
});

