/************************** Call's ***************************/
jQuery(document).ready(function(){	
	
	//prettyPhoto
	jQuery("a[rel^='prettyPhoto']").prettyPhoto({
		theme: 'pp_default',
		animationSpeed: 'slow',
		deeplinking: false
	});
	
	//jQuery UI Accordion
	jQuery( "#accordion" ).accordion();
	
	//jQuery Accordion for portfolio			
	jQuery("ul.portfolio-tns").addClass('closed');
	jQuery(".portfolio-expand").show();
 
	var tnHeight = 160;
	var tnMargin = 18;
	var tnCols = 4;
	var rowDuration = 250;
	
	var moreImg = '+';
	var lessImg = '-';
 
	jQuery(".portfolio-expand a").click(function(e){
		e.preventDefault();
		
		var toggleLabel = jQuery(this).children('span');
		var list = jQuery(this).parents('.portfolio-section').children('.portfolio-tns');
		
		var tnRows = Math.ceil(list.children().length/tnCols);
		var duration = tnRows * rowDuration;
		
		if (toggleLabel.html() == moreImg) {
			var setHeight = (tnRows*(tnHeight+tnMargin))-tnMargin;
			list.animate({
				height: setHeight
				}, duration, function() {
					toggleLabel.html(lessImg).addClass('less');
			});
		} else {
			list.animate({
				height: tnHeight
				}, duration, function() {
					toggleLabel.html(moreImg).removeClass('less');
			});
		}
	});
});
