//globalize is not good but keep in mind that variable name is unique ^_^
var nefi_out = 1; var nefi_opacity = 0.2;var nefi_speed = 1000;
//below is time between fading for featured slider
var nefi_tt_interval = 8000;  
//below is time between fading for recent blog post fader
var nefi_rt_interval = 5000; 
//below is time between fading for square thumbnail fade slider
var nefi_mt_interval = 4000;
//below for Easing value, default is 1.70158
var nefi_easing = 1;
function onBefore(curr, next, opts, fwd) {
	jQuery(curr).find('div.post').stop(true,true).hide();
} 
function onAfter(curr, next, opts, fwd) {
	jQuery(next).find('div.post').delay(1500).fadeIn(1000);
}
function prepare_structure(loadingElement){
	var v_width = loadingElement.outerWidth();
	var v_height = loadingElement.outerHeight(true);
	var cssA = {display:"block",width: v_width, height: v_height};
		loadingElement.wrap(function(){
			return jQuery("<span></span>").css(cssA);});
		loadingElement.parent().append(function(){
				return jQuery('<span class="oli"></span>').css(cssA);});
	if(jQuery.browser.msie && jQuery.browser.version < 7) loadingElement.addClass('ie6-v');
}
function hover_mainthumb(loadingElement){
	loadingElement.parents('.frame-container,.trigger-home,.frame-home').hover(
		function(){loadingElement.stop(true).fadeTo(nefi_speed, nefi_opacity);}, 
		function(){loadingElement.stop(true).fadeTo(nefi_speed, nefi_out);});
}
function pulse(MyPicLink,o){
	if(active){MyPicLink.contents("img")
	.fadeTo(nefi_speed, o, function(){
		pulse(MyPicLink,o==nefi_out?nefi_opacity:nefi_out);});
	}
}
//fetch image only for frontpage slide image
function init_preload(){
	if(jQuery('#start-now').length > 0){
		var sum = jQuery('div.slide-container').length;
		preload_slide(1,sum);
	} else if(jQuery('#start-now-blog').length > 0){
		var sum = jQuery('div.feat-slider-tab').length;
		if(!sum){ sum = 1;}
		preload_ticker(1,sum);
	}
}
function preload_slide(count,sum){
	if(count <= sum){
		if(jQuery('#start-now').hasClass('start-it')){
		var start_soon = true;}
		var slide_load = jQuery('#slide-img-'+count);
		var slide_target = new Image();
		jQuery('#lo-t').replaceWith('<span id="lo-t">Loading image '+count+' of '+sum+'...</span>');
		slide_target_src = slide_load.attr('title');
			jQuery(slide_target).bind('error load',function(){
				jQuery(this).addClass('slide-img').prependTo(slide_load)
				.clone().removeAttr('class').insertAfter('#fc-'+count);
				if(count == 1){
					jQuery(this).css('opacity','0');
				  if(start_soon == true){
					startSlide();
					jQuery('#lo-t').replaceWith('<span id="lo-t2">Starting...</span>');
					jQuery('#slide-img-1 .slide-img').animate({opacity: 1.0}, 1000, function(){jQuery('#slide-img-loading').remove()});
				  }
				//begin to start slide after the last framed image complete load
				//if you want start it after the first image finished load, change var sum below to 2
				} else if(count == sum && start_soon != true){
					startSlide();
					jQuery('#slide-img-1 .slide-img').animate({opacity: 1.0}, 1000,function(){jQuery('#slide-img-loading').remove()});
				}
				preload_slide(count+1,sum);					
			}).attr({src:slide_target_src});
	}
}
function preload_ticker(count,sum){
	if(sum == 1){var start_soon = true}
	if(count <= sum){
		var slide_load = jQuery('#t-'+count);
		var slide_target = new Image();
		slide_target_src = slide_load.attr('title');
		  if(slide_target_src != ''){ 
			jQuery(slide_target).bind('error load',function(){
				jQuery(this).addClass('feat-image').appendTo('#t-'+count);
				slide_load.removeAttr('title');
				if(count == 1){
					slide_load.css('opacity','0');
					jQuery('#lo-s').replaceWith('<span id="lo-s">Starting...</span>');
					if(start_soon){
						slide_load.css('display','block');
						jQuery('#slide-img-loading-blog').fadeOut('slow').remove();
						jQuery('#t-1').animate({opacity: 1.0}, 2000, function(){jQuery('#feat-img').css('background-image','none');});
						tab_ticker();
					}
				//begin to start slide after the second framed image complete load
				} else if(count == 2){
					jQuery('#slide-img-loading-blog').fadeOut('slow').remove();
					tab_ticker();
					jQuery('#t-1').animate({opacity: 1.0}, 2000, function(){jQuery('#feat-img').css('background-image','none');});
					
				}
				preload_ticker(count+1,sum);					
			}).attr({src:slide_target_src});
		  } else {
			jQuery('<span class="no-thumbnail-found"> Image not found<br/>Please enter image url on Thumbnail image post meta </span>').appendTo('#t-'+count);
				if(count == 1){
					slide_load.css('opacity','0');
					jQuery('#lo-s').replaceWith('<span id="lo-s">Starting...</span>');
					if(start_soon){
						slide_load.css('display','block');
						jQuery('#slide-img-loading-blog').fadeOut('slow').remove();
						jQuery('#t-1').animate({opacity: 1.0}, 2000, function(){jQuery('#feat-img').css('background-image','none');});
						tab_ticker();
					}
				//begin to start slide after the second framed image complete load
				} else if(count == 2){
					jQuery('#slide-img-loading-blog').fadeOut('slow').remove();
					tab_ticker();
					jQuery('#t-1').animate({opacity: 1.0}, 2000, function(){jQuery('#feat-img').css('background-image','none');});
					
				}
			preload_ticker(count+1,sum);
		  }
	}
}
function preload_image(obj,i,event,test_src){
	var loadingElement = jQuery(obj);
		loadingElement.ctype = loadingElement.attr('class');
	//hidden all element first
	loadingElement.css({opacity:0, visibility:'hidden'});
  switch(loadingElement.ctype){
	case 'portfolio-image':
		//--ie use png fix for image-- for performance reason preload disable for ie 6
		if(jQuery.browser.msie && jQuery.browser.version < 7){
			loadingElement.css({opacity:1, visibility:'visible',border:'none'})
			.parent().css('background-image','none');
		} else if(event.complete == true){
			loadingElement.css({opacity:1, visibility:'visible'})
			.parent().css('background-image','none');
		} else {
			loadingElement.bind('error load',function(){ 
				loadingElement.css({visibility:'visible'})
				.animate({opacity:0.5}, 500).animate({opacity:1},1000)
				.parent().css('background-image','none');
			});
		}
	break;
	case 'IMG-thumbs':
		//get prepare
		prepare_structure(loadingElement);
		var vClass; var vIcon;
		var p_loadingElement = loadingElement.parent();
		var match_src = loadingElement.attr('src');
		//bind event first for target parent
		hover_mainthumb(loadingElement,p_loadingElement);
		//append class
		if(loadingElement.parents('a').attr('href').match(/(youtube|vimeo|wmv|swf|mov)/i)){ 
			vClass = 'spanwrap vVideo pngfix'; vIcon = 'vVideo'; 
			p_loadingElement.append("<span class='icon-"+vIcon+" pngfix'></span>");
		} 
		else { 
			vClass = 'spanwrap vGoto pngfix'
		}
		// update structure if image loaded & disable preloading for ie-6
		if(jQuery.browser.msie && jQuery.browser.version < 7){
			loadingElement.css({opacity:1, visibility:'visible', border:'none'});
			p_loadingElement.addClass(vClass).find('.oli').remove();
			if(test_src == match_src){init_preload();meta_tab();}
		} else if(event.complete == true){
			loadingElement.css({opacity:1, visibility:'visible'});
			p_loadingElement.addClass(vClass).find('.oli').remove();
			if(test_src == match_src){init_preload();meta_tab();}
		} else {
			loadingElement.bind('error load',function(){
			setTimeout( function(){
				loadingElement.css({visibility:'visible'}).animate({opacity:1}, 1000);
				p_loadingElement.addClass(vClass).find('.oli').remove();
				if(test_src == match_src){init_preload();meta_tab();}
				},1000);
			});
		}
	break;
	default:
		if(jQuery.browser.msie && jQuery.browser.version < 7){
			loadingElement.css({opacity:1, visibility:'visible','background-image':'none'});
		} else if(event.complete){
			loadingElement.css({opacity:1, visibility:'visible','background-image':'none'});
		} else {
			loadingElement.bind('error load',function(){
				loadingElement.css({visibility:'visible','background-image':'none'})
				.animate({opacity:0.5}, 500).animate({opacity:1},1000);
			});
		} 
	break;
  }
}
function tab_ticker(){
	jQuery('#start-scroll')
	.tabs('#feat-img > div.feat-image-container',{
		effect:'fade',current:'active',fadeInSpeed:800,fadeOutSpeed:1200,rotate:true
		}).slideshow({clickable:false, autoplay:true, interval:nefi_tt_interval});
}
function meta_tab(){
	jQuery('div.blog-meta-tabs')
	.tabs('div.panes > img.blog-meta-image',{
		effect:'fade',current:'bmt-active',fadeInSpeed:800,fadeOutSpeed:1200,rotate:true
		}).slideshow({autoplay:true, interval:nefi_mt_interval});
}
function recent_ticker(){
	jQuery('#tab-recents')
	.tabs('#tab-recent > div.tab-part-recent',{
		effect:'fade',current:'tr-active',fadeInSpeed:800,fadeOutSpeed:1200,rotate:true
		}).slideshow({clickable:false, autoplay:true, interval:nefi_rt_interval});
}
function scroll_ticker(){
	jQuery('#feat-slider').scrollable({
		items:'#start-scroll', vertical:true,size:4,next:'#slider-down',prev:'#slider-up',speed:500,easing:'easeInExpo'
	}).mousewheel(500);
}
/**
* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
*/
(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev]);}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev]);};var handleHover=function(e){var p=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(p&&p!=this){try{p=p.parentNode;}catch(e){p=this;}}if(p==this){return false;}var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);}if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob);},cfg.timeout);}}};return this.mouseover(handleHover).mouseout(handleHover);};})(jQuery);
/*
 * Superfish v1.4.8 - jQuery menu widget
 * Copyright (c) 2008 Joel Birch
 * Dual licensed under the MIT and GPL licenses:
 */
;(function($){
	$.fn.superfish = function(op){
	var sf = $.fn.superfish,c = sf.c,
	$arrow = $(['<span class="',c.arrowClass,'"> &#187;</span>'].join('')),
	over = function(){var $$ = $(this), menu = getMenu($$);clearTimeout(menu.sfTimer);$$.showSuperfishUl().siblings().hideSuperfishUl();},
	out = function(){var $$ = $(this), menu = getMenu($$), o = sf.op;clearTimeout(menu.sfTimer);menu.sfTimer=setTimeout(function(){o.retainPath=($.inArray($$[0],o.$path)>-1);$$.hideSuperfishUl();
	if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);}},o.delay);},
	getMenu = function($menu){var menu = $menu.parents(['ul.',c.menuClass,':first'].join(''))[0];sf.op = sf.o[menu.serial];return menu;},
	addArrow = function($a){ $a.addClass(c.anchorClass).append($arrow.clone()); };
	return this.each(function() {var s = this.serial = sf.o.length;var o = $.extend({},sf.defaults,op);o.$path = $('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){$(this).addClass([o.hoverClass,c.bcClass].join(' ')).filter('li:has(ul)').removeClass(o.pathClass);});
	sf.o[s] = sf.op = o;
	$('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() {if (o.autoArrows) addArrow( $('>a:first-child',this) );}).not('.'+c.bcClass).hideSuperfishUl();
	var $a = $('a',this);$a.each(function(i){var $li = $a.eq(i).parents('li');$a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);});});
	o.onInit.call(this);}).each(function() {var menuClasses = [c.menuClass];if (sf.op.dropShadows  && !($.browser.msie && $.browser.version < 7)) menuClasses.push(c.shadowClass);$(this).addClass(menuClasses.join(' '));});
};
var sf = $.fn.superfish;sf.o = [];sf.op = {};sf.IE7fix = function(){
var o = sf.op;if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity!=undefined)this.toggleClass(sf.c.shadowClass+'-off');};
sf.c = {bcClass     : 'sf-breadcrumb',menuClass   : 'sf-js-enabled',anchorClass : 'sf-with-ul',arrowClass  : 'sf-sub-indicator',shadowClass : 'sf-shadow'};
sf.defaults = {
hoverClass	: 'sfHover',
pathClass	: 'overideThisToUse',
pathLevels	: 1,
delay		: 800,
animation	: {opacity:'show'},
speed		: 'normal',
autoArrows	: true,
dropShadows : true,
disableHI	: false,		// true disables hoverIntent detection
onInit		: function(){}, // callback functions
onBeforeShow: function(){},
onShow		: function(){},
onHide		: function(){}
	};
$.fn.extend({
hideSuperfishUl : function(){var o = sf.op,not = (o.retainPath===true) ? o.$path : '';o.retainPath = false;var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass).find('>ul').hide().css('visibility','hidden');o.onHide.call($ul);return this;},
showSuperfishUl : function(){var o = sf.op,sh = sf.c.shadowClass+'-off',$ul = this.addClass(o.hoverClass).find('>ul:hidden').css('visibility','visible');sf.IE7fix.call($ul);o.onBeforeShow.call($ul);$ul.animate(o.animation,o.speed,o.easing,o.duration,function(){ sf.IE7fix.call($ul); o.onShow.call($ul); });
return this;}
});

})(jQuery);
/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
 * Open source under the BSD License.  
 * EASING EQUATIONS
 * Copyright © 2001 Robert Penner
 * All rights reserved.
 * jQuery Easing
 * Copyright © 2008 George McGinley Smith
 * All rights reserved.
 *
*/
// t: current time, b: begInnIng value, c: change In value, d: duration
jQuery.easing['jswing'] = jQuery.easing['swing'];

jQuery.extend( jQuery.easing,
{
	def: 'easeOutQuad',
	swing: function (x, t, b, c, d) {
		//alert(jQuery.easing.default);
		return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
	},
	easeInQuad: function (x, t, b, c, d) {
		return c*(t/=d)*t + b;
	},
	easeOutQuad: function (x, t, b, c, d) {
		return -c *(t/=d)*(t-2) + b;
	},
	easeInOutQuad: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t + b;
		return -c/2 * ((--t)*(t-2) - 1) + b;
	},
	easeInCubic: function (x, t, b, c, d) {
		return c*(t/=d)*t*t + b;
	},
	easeOutCubic: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t + 1) + b;
	},
	easeInOutCubic: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t + b;
		return c/2*((t-=2)*t*t + 2) + b;
	},
	easeInQuart: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t + b;
	},
	easeOutQuart: function (x, t, b, c, d) {
		return -c * ((t=t/d-1)*t*t*t - 1) + b;
	},
	easeInOutQuart: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
		return -c/2 * ((t-=2)*t*t*t - 2) + b;
	},
	easeInQuint: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t*t + b;
	},
	easeOutQuint: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t*t*t + 1) + b;
	},
	easeInOutQuint: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
		return c/2*((t-=2)*t*t*t*t + 2) + b;
	},
	easeInSine: function (x, t, b, c, d) {
		return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
	},
	easeOutSine: function (x, t, b, c, d) {
		return c * Math.sin(t/d * (Math.PI/2)) + b;
	},
	easeInOutSine: function (x, t, b, c, d) {
		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
	},
	easeInExpo: function (x, t, b, c, d) {
		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
	},
	easeOutExpo: function (x, t, b, c, d) {
		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
	},
	easeInOutExpo: function (x, t, b, c, d) {
		if (t==0) return b;
		if (t==d) return b+c;
		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
	},
	easeInCirc: function (x, t, b, c, d) {
		return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
	},
	easeOutCirc: function (x, t, b, c, d) {
		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
	},
	easeInOutCirc: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
		return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
	},
	easeInElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
	},
	easeOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
	},
	easeInOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
	},
	easeInBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		s = nefi_easing;
		return c*(t/=d)*t*((s+1)*t - s) + b;
	},
	easeOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
	},
	easeInOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		s = nefi_easing;
		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
	},
	easeInBounce: function (x, t, b, c, d) {
		return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
	},
	easeOutBounce: function (x, t, b, c, d) {
		if ((t/=d) < (1/2.75)) {
			return c*(7.5625*t*t) + b;
		} else if (t < (2/2.75)) {
			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
		} else if (t < (2.5/2.75)) {
			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
		} else {
			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
		}
	},
	easeInOutBounce: function (x, t, b, c, d) {
		if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
		return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
	}
});
//initialized
jQuery(document).ready(function(){
//preload image and lightbox
var test_src = jQuery('#main-wrapper .IMG-thumbs').last().attr('src');
jQuery('img.recent-img, img.IMG-thumbs,img.recent-thumbs, .entry img, .lightbox_li img, img.popular-image, #contact-map')
	.each(function(i,event){
		preload_image(this,i,event,test_src);
	});
jQuery("#content a[rel^='lightbox']").not('.frame-container,.IMG-thumbs-hold').each(function()
{	var vClass;
	var MyPicLink = jQuery(this);
	var img_hover = MyPicLink.contents("img");
	var c_img = new Image();
	c_img.src = img_hover.attr('src');
	//append class
	if(MyPicLink.attr('href').match(/(jpg|gif|jpeg|png|tif)/i)){
		vClass = 'vPhoto'
	} else if(MyPicLink.attr('href').match(/(youtube|vimeo|mov|swf|wmv)/i)){
		vClass = 'vVideo'
	} else { vClass = 'vGoto'};
	if(jQuery.browser.msie && jQuery.browser.version < 7) MyPicLink.addClass('ie6-v');
	//specify block size
	var v_width = img_hover.width()+10; var v_height = img_hover.height()+10;
	if(MyPicLink.hasClass('thumb')) {
		v_width = v_width-2; v_height = v_height+8;}
	//specify float and its margin value
	var v_float; var v_margin; var v_class = img_hover.attr('class');
	if(v_class.match(/alignleft/i)){
		v_float = "left"; v_margin = '10px 10px 10px 0';
	} else if (v_class.match(/alignright/i)){
		v_float = "right"; v_margin = '10px 0 10px 10px';
	} else if(MyPicLink.parents().hasClass('wp-caption')){
		v_float = "none";v_margin = '0'
	} else if(!MyPicLink.hasClass('thumb')){
		v_float = "none";v_margin = '10px auto'}
	//get all css value
	var cssA = "display: block; width:"+v_width+"px; height: "+v_height+"px";
	var cssB = {position:"relative",display:"block",width: v_width, height: v_height,margin: v_margin,'float': v_float}
	//append only if all element loaded or image in browser cache
	if(c_img.complete == true){
		img_hover.css('margin',0);
		MyPicLink.css(cssB)
			.append("<span class='"+vClass+" pngfix' style='"+cssA+"'></span><span class='icon-"+vClass+" pngfix'></span>");
		//specify hover element
		if(MyPicLink.hasClass('thumb')) {
			MyPicLink.find('.frame-portfolio').hover(
			function(){
				active = true;pulse(MyPicLink,nefi_opacity);}, 
			function(){
				active = false;img_hover.stop(true).fadeTo(nefi_speed, nefi_out);}
			);
		} else {
			img_hover.hover(
			function(){
				active = true;pulse(MyPicLink,nefi_opacity);}, 
			function(){
				active = false;img_hover.stop(true).fadeTo(nefi_speed, nefi_out);}
			);
		}
	} else {
	img_hover.bind('load',function(){
		img_hover.css('margin',0);
		MyPicLink.css(cssB)
			.append("<span class='"+vClass+" pngfix' style='"+cssA+"'></span><span class='icon-"+vClass+" pngfix'></span>");
		//specify hover element
		if(MyPicLink.hasClass('thumb')) {
			MyPicLink.find('.frame-portfolio').hover(
			function(){
				active = true;pulse(MyPicLink,nefi_opacity);}, 
			function(){
				active = false;img_hover.stop(true).fadeTo(nefi_speed, nefi_out);}
			);
		} else {
			img_hover.hover(
			function(){
				active = true;pulse(MyPicLink,nefi_opacity);}, 
			function(){
				active = false;img_hover.stop(true).fadeTo(nefi_speed, nefi_out);}
			);
		}
	});
	}
});
//hiding description on frontpage slide image
jQuery('div.slide-container').each(function()
{
	var slide_content = jQuery(this).find('.post');slide_content.hide();
	jQuery(this).hover(
		function(){slide_content.stop(true,true).fadeIn('normal');},
		function(){slide_content.stop(true,true).fadeOut('normal');}
	);
});
//just simple value for search form
var search_box_text = jQuery('.search-field-wrapper #s').attr('title');
if(!jQuery('#searchForm .search-field').val()){
	jQuery('#searchForm .search-field')
		.val(search_box_text)
		.focus(function(){
			if(jQuery(this).val() == search_box_text){
				jQuery(this).val('');}
		})
		.blur(function(){
			if(jQuery(this).val() == ''){
				jQuery(this).val(search_box_text);}
		});
	}
//show helper for mouse wheel active area
jQuery('#mouse-scroll').css({opacity:0, visibility:'visible'});
if(jQuery('div.feat-slider-tab').length > 4){
	jQuery('#feat-slider').hover(
		function(){jQuery('#mouse-scroll').stop(true,true).animate({opacity: 1.0},500);},
		function(){jQuery('#mouse-scroll').stop(true,true).animate({opacity: 0}, 500);}
	);
}
//start slide for homepage and loading image for non-blog page or post if no thumbs appear
if(jQuery('img.IMG-thumbs').length == 0 ){
	init_preload();
	//thumbnail square fader start
	if(jQuery('img.blog-meta-image').length > 0){
		meta_tab();
	}
}
//start scroll portfolio if in portfolio page
if(jQuery('#scroll-portfolio').length > 0){
var s_api = jQuery('#scroll-portfolio').scrollable({
	api:true, clickable:false, items:'#start-scroll-portfolio', size:1, next:'.next-scroll',prev:'.prev-scroll',speed:1500, easing:'easeInOutBack'
});
//scroll pagination
jQuery('span.sp').each(function(){
	var p_index = jQuery(this).attr('title');
	jQuery(this).bind('click',function(){
		s_api.setPage(p_index);
	});
});
jQuery('div.s-pagination').clone(true)
	.removeClass('ps-top').addClass('ps-bottom')
	.appendTo('#scroll-portfolio');
//update index for portfolio
jQuery('span.index-scroll').each(function(){
	jQuery(this).replaceWith(function(){
		var p_index = s_api.getIndex();s_index = p_index+1;
		if(jQuery(this).hasClass('ps-top')){
			return '<span class="index-scroll ps-top"><i>'+s_index+'</i> / <b>'+s_api.getSize()+'</b></span>'
		} else {
			return '<span class="index-scroll ps-bottom"><i>'+s_index+'</i> / <b>'+s_api.getSize()+'</b></span>'
		}
	});
});
s_api.onBeforeSeek(function(){
	var p_index = s_api.getIndex();
	jQuery('span.sp-'+p_index).removeClass('sp-active');
});
s_api.onSeek(function(){
	var p_index = s_api.getIndex();s_index = p_index+1;
	jQuery('span.index-scroll').each(function(){
		jQuery(this).replaceWith(function(){
		if(jQuery(this).hasClass('ps-top')){
				return '<span class="index-scroll ps-top"><i>'+s_index+'</i> / <b>'+s_api.getSize()+'</b></span>'
			} else {
				return '<span class="index-scroll ps-bottom"><i>'+s_index+'</i> / <b>'+s_api.getSize()+'</b></span>'
			}
		});
	});
	jQuery('span.sp-'+p_index).addClass('sp-active');
});}//end of portfolio scroll
//below for wordpress tag wrapper
jQuery('div.widget-home-1 a[class^=tag],div.widget-home-2 a[class^=tag]').addClass('wptaglink');
jQuery('div.widget-home-1 .wptaglink,div.widget-home-2 .wptaglink').wrapAll('<div class="wptaglink-wrapper"/>');
//centering with javascript
jQuery('#centering-footer-span').css('width',jQuery('#list-footer').width());
recent_ticker();
//start scroll ticker after preload image
//i put it in the end because IE 6
scroll_ticker();
});	//done ^_^