function initMenus() {
	$('ul.xoxo ul').hide();
	$.each($('ul.xoxo'), function(){
		$('#' + this.id + '.expandfirst ul:first').show();
	});
	$('ul.xoxo li a').click(
		function() {
			var checkElement = $(this).next();
			var parent = this.parentNode.parentNode.id;

			if($('#' + parent).hasClass('noaccordion')) {
				$(this).next().slideToggle('normal');
				return false;
			}
			if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
				if($('#' + parent).hasClass('collapsible')) {
					$('#' + parent + ' ul:visible').slideUp('normal');
				}
				return false;
			}
			if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
				$('#' + parent + ' ul:visible').slideUp('normal');
				checkElement.slideDown('normal');
				return false;
			}
		}
	);
}
$(document).ready(function() {initMenus();});

$(document).ready(function() {
	$('ul.catmenu li a').mouseover(
		function() {
			var this_id = $(this).attr("id");
		//alert(this_id)
		$('ul.catmenu li a#'+this_id+' img').css('opacity', '1');
		$('ul.catmenu li a#'+this_id+' strong').css('display', 'block');
		if ($(this).attr("class") == "selected")
			{
			$('ul.catmenu li a.selected strong').css('display', 'block');
			}
			else
			{
			$('ul.catmenu li a.selected strong').css('display', 'none');
			}
		});
		$('ul.catmenu li a').mouseout(
		function() {
			var this_id = $(this).attr("id");
		//var post_id = $(this).attr("rel");
		$('ul.catmenu li a#'+this_id+' img').css('opacity', '0.6');
		$('ul.catmenu li a#'+this_id+' strong').css('display', 'none');
		$('ul.catmenu li a.selected strong').css('display', 'block');
		$('ul.catmenu li a.selected img').css('opacity', '1');



		});
});


$(document).ready(function() {

	//Set Default State of each portfolio piece
	$(".slideNav").show();
	$(".slideNav a:first").addClass("active");
		
	//Get size of images, how many there are, then determin the size of the image reel.
	var imageWidth = $(".event-slideshow").width();
	var imageSum = $(".ec3_slide img").size();
	var imageReelWidth = imageWidth * imageSum;
	
	//Adjust the image reel to its new size
	$(".ec3_slide").css({'width' : imageReelWidth});
	
	//slideNav + Slider Function
	rotate = function(){	
		var triggerID = $active.attr("rel") - 1; //Get number of times to slide
		var image_reelPosition = triggerID * imageWidth; //Determines the distance the image reel needs to slide

		$(".slideNav a").removeClass('active'); //Remove all active class
		$active.addClass('active'); //Add active class (the $active is declared in the rotateSwitch function)
		
		//Slider Animation
		$(".ec3_slide").animate({ 
			left: -image_reelPosition
		}, 500 );
		
	}; 
	
	//Rotation + Timing Event
	rotateSwitch = function(){		
		play = setInterval(function(){ //Set timer - this will repeat itself every 3 seconds
			$active = $('.slideNav a.active').next();
			if ( $active.length === 0) { //If slideNav reaches the end...
				$active = $('.slideNav a:first'); //go back to first
			}
			rotate(); //Trigger the slideNav and slider function
		}, 7000); //Timer speed in milliseconds (3 seconds)
	};
	
	rotateSwitch(); //Run function on launch
	
	//On Hover
	$(".image_reel a").hover(function() {
		clearInterval(play); //Stop the rotation
	}, function() {
		rotateSwitch(); //Resume rotation
	});	
	
	//On Click
	$(".slideNav a").click(function() {	
		$active = $(this); //Activate the clicked slideNav
		//Reset Timer
		clearInterval(play); //Stop the rotation
		rotate(); //Trigger rotation immediately
		rotateSwitch(); // Resume rotation
		return false; //Prevent browser jump to link anchor
	});	
	
});


		var RIGHTPAD = 10;
		var TOPPAD = 10;
		var LEFTPAD = 10;
		var BOTPAD = 10;
		var BOXW = 222;
		var BOXH = 258;
		var ENDPAD = 10;
		var FULLSIZE = 454;
		var pageW = 980;
		var cols = 0;
		var maxcols = 4;
		var sizeMsg = false;
		

	$(document).ready(function(){
	$("ul#columns li a, ul.ec3_slide#c li a").click(function(){
			$("#columns").children("li").height('258px');
			$("#columns").children("li").width('222px');
			$("#columns li img").height('135px');
			$("#columns li img").width('222px');
			$("#columns li h2").css("display","block");
		$("#your_post_here").remove();		
		var this_id = $(this).attr("id");		
		var cct =  parseInt(this_id);
		shiftPosition(cct,'open','description');
	});
});	
$(document).ready(function(){
	$("div.close a").click(function(){
			$("#columns").children("li").height('258px');
			$("#columns").children("li").width('222px');
			$("#columns li img").height('135px');
			$("#columns li img").width('222px');
		$("#your_post_here").remove();		
		
	});
	
});

	
	function openThisPr(pid, isopen) {

	
$(document).ready(function(){
	
		$.ajaxSetup({cache:false});
		var pst_id = $("a#"+pid).attr("rel");	
		$("li#item_"+pid).append('<div id="your_post_here"></div>');
				$('html, body').animate({scrollTop: $("#your_post_here").offset().top-280},'fast');	

		$("li#item_"+pid+" img").height('235px');
		$("li#item_"+pid+" img").width('454px');
		$("li#item_"+pid+" h2").css("display","none");
		$("#your_post_here").html("loading...");
		$("#your_post_here").load("http://www.fabricadepensule.ro/triqui-ajax/",{id:pst_id});
	
		
		return false;
		
	});
}	
$.ajaxSetup({cache:false});
	$(document).ready(function(){
	$("ul#lines li a, ul.ec3_slide#h li a").click(function(){
			$("ul#lines").children("li").removeAttr('id');
			$("#lines").children("li").height('68px');			
		$("#your_post_here").remove();		
		var this_id = $(this).attr("id");
		var post_id = $(this).attr("rel");
		var thisindex = parseInt(this_id)-1;
		$("ul#lines li:eq("+thisindex+")").height(320);
		$("ul#lines li:eq("+thisindex+")").attr('id', 'curent_open');				
		$("ul#lines li:eq("+thisindex+")").append('<div id="your_post_here"></div>');	
		$("#your_post_here").html("loading...");
		$("#your_post_here").load("http://www.fabricadepensule.ro/triqui-ajax/",{id:post_id});
		$('html, body').animate({scrollTop: $("#your_post_here").offset().top-280},'slow');	
	});
});	


