Cufon.replace('h1,h2,h3,h4,h5,h6,label, span.title, p.cufon, #content blockquote p, .button-normal-top, .button-normal, .button-large, .button, #top-bar ul li a, #top-bar ul.sub li a', { fontFamily: 'Museo500', hover: true });
Cufon.replace('#content h1, .step-describer ul li div small', { fontFamily: 'Museo700', hover: true });
Cufon.replace('.step-describer ul li div big', { fontFamily: 'Museo700', hover: true, textShadow: '-1px -1px 1px #e4e4e4' });

jQuery(document).ready(function () {
/* some extra selectors passed by jquery due to IE "cant handle the reality" problems & other */
jQuery("#top-bar ul li:last-child").addClass("last-child");
jQuery(".list-item ul li:nth-child(3n+1), .list-item ul li:first-child").addClass("shade-left");
jQuery(".list-item ul li:nth-child(3n)").addClass("shade-right");
jQuery(".sub-menu.blog ul li:last-child").addClass("last-child");
jQuery("#blog-posts ul li:odd").addClass("selected curved");

/* applying shadows */
jQuery(".apply-shadows-normal, .apply-shadows-large, .apply-shadows-small").append("<span class='shadow-left'></span><span class='shadow-right'></span>");
jQuery(".apply-fake-curves").append("<span class='rounded tl'></span><span class='rounded tr'></span><span class='rounded bl'></span><span class='rounded br'></span>");


/* top menu */
jQuery("#top-bar > ul > li").mouseover(function(){
	jQuery(this).addClass("current-dynamic");
	jQuery(this).find(".sub").animate({
							   height: "show"
							   }, 200)
	
}).mouseleave(function(){
	jQuery(this).removeClass("current-dynamic");
	jQuery(this).find(".sub").animate({
							   height: "hide"
							   }, 100)
Cufon.replace('#top-bar ul li a', { fontFamily: 'Museo500', hover: true });
});
// end



/* testimonials module */
jQuery("#testimonials .list li a").click(function() {
	var curList = jQuery("#testimonials .list li a.current").attr("rel");
	var curListHeight = jQuery("#testimonials .full-list").height();
	jQuery("#testimonials li a").removeClass("current");
	jQuery(this).addClass("current");
	var listID = jQuery(this).attr("rel");
	if (listID != curList) {
		jQuery("#"+curList).fadeOut(0, function() {
			jQuery("#"+listID).fadeIn();
			var newHeight = jQuery("#"+listID).height();
		});
	}        
	return false;
});
//end 


/* portfolio filtering & pagination usage, pagination plugin is also in js/jquery.paginate.js */
var activeFiltersList = jQuery("#filters ul li a").text();
var filterDefault = document.location.hash.replace("#","");

// checking each element in filters list, and if they match then add class current so they can be highlighted on page load
if (filterDefault) {
	jQuery("#filters ul li a").each(function() {
		if(jQuery(this).attr("rel") == filterDefault) {
						 jQuery(this).addClass("current");
		}
	});
}

// checking each element in project list, and if they match with the filter, if yes then show them
if (filterDefault) {
jQuery(".project-list .list-contents li").each(function() {
	if(!jQuery(this).hasClass(filterDefault)) {
		jQuery(this).hide();
	}
	else {
		jQuery(this).show();
	}
});
}
else {
	var filterDefault = "all";
}


// filter choosen elements
jQuery("#filters ul li a").click(function() {

	jQuery("#filters ul li a.current").removeClass("current");
	Cufon.replace('.button-normal', { fontFamily: 'Museo500', hover: true });	
	jQuery(this).addClass("current");
	
	var filterBy = jQuery(this).attr("href").replace("#","");

	
	jQuery(".project-list").hide().fadeIn(400);
	jQuery(".project-list li").each(function() {
		if(!jQuery(this).hasClass(filterBy)) {
			jQuery(this).hide();
		}
		else {
			jQuery(this).fadeIn(400);
		}
		
	});
	jQuery('.project-list').pajinate({items_per_page : external_pajinate_items_number});

});

// project list v4 data hovering
jQuery(".project-list.photo-only li").mouseenter(function() {
	
	jQuery(this).find(".data").fadeIn(200);
}).mouseleave(function() {
	jQuery(this).find(".data").fadeOut(100);
	});



/* autoclear function for inputs */
jQuery('.autoclear').click(function() {
if (this.value == this.defaultValue) {
this.value = '';
}
});
jQuery('.autoclear').blur(function() {
if (this.value == '') {
this.value = this.defaultValue;
}
});

jQuery('#gotop').click(function(){
	jQuery('html, body').animate({scrollTop:0}, 'slow');
	return false;
});

jQuery(function() {
	jQuery('ul.nav a').bind('click',function(event){
		var jQueryanchor = jQuery(this);                   

		jQuery('html, body').stop().animate({
			scrollTop: jQuery(jQueryanchor.attr('href')).offset().top
			}, 1000);
		
		event.preventDefault();
	});
});

jQuery(function() {
	jQuery('a.button-normal-top').bind('click',function(event){
		var jQueryanchor = jQuery(this);                   

		jQuery('html, body').stop().animate({
			scrollTop: jQuery(jQueryanchor.attr('href')).offset().top
			}, 1000);
		
		event.preventDefault();
	});
});

});


