function initMenu() {
	
	$(".whitepp a.goto2").click(
	function(){
		$(".am1 .whitepp1").hide("fast");
		$(".am1 .whitepp2").show("fast");
	});
	
	$(".whitepp a.goto1").click(
	function(){
		$(".am1 .whitepp2").hide("fast");
		$(".am1 .whitepp1").show("slow");
	});
	
	$(".am a.goto22").click(
	function(){
		$(".am .whitepp1").hide("fast");
		$(".am .whitepp2").show("fast");
	});
	
	$(".am a.goto21").click(
	function(){
		$(".am .whitepp2").hide("fast");
		$(".am .whitepp1").show("slow");
	});
	
	var initialClass=0;
	$('.menu li').hover(
	function() {
		if($(this).children(":first-child").attr("class")=="mn on"){
			initialClass=1;
		}
		$(this).children(":first-child").addClass('on');
		var coada = $(this).attr('id');
		var sub_clasa = 'sub' + coada;
		$(this).children("."+sub_clasa).fadeIn("fast");
		$(this).attr('style','z-index: 500;');
	},
	function() {
		if(initialClass==0){
			$(this).children(":first-child").removeClass('on');
		}
		var coada = $(this).attr('id');
		var sub_clasa = 'sub' + coada;
		$(this).children("."+sub_clasa).fadeOut(150);
		initialClass=0;
		$(this).attr('style','');
	});
	
	
	/*
	$('ul.selecteaza li').hover(
	function() {
		$(this).children(":first-child").addClass('dupa');
		$(this).children("ul.sub").slideDown(250);
	},
	function() {
		$(this).children(":first-child").removeClass('dupa');
		$(this).children("ul.sub").slideUp(250);
	});
	*/
	
	$('.top ul.top_links li').hover(
	function() {
		$(this).children("a.vreau").addClass('vreau_on');
		$(this).children(".vreau_wrap").show();
	},
	function() {
		$(this).children("a.vreau").removeClass('vreau_on');
		$(this).children(".vreau_wrap").hide();
	});
	
	
	lastBlock = $(".li1");
    maxWidth = 744;
    minWidth = 51;
	
	$("ul.slide li.slider").click(
		function(){
			$(lastBlock).animate({width: minWidth+"px"}, { queue:false, duration:400 });
			$(this).animate({width: maxWidth+"px"}, { queue:false, duration:400});
			lastBlock = this;
			$("li.slider a").removeClass("on");
			$(this).children(":first-child").addClass("on");
		}
    );
	
	$("ul.echipa li .echipa_content img").hover(
	function(){
		$(this).parent().parent().attr("style","z-index: 500;");
		$(this).parent().parent().css("overflow","visible");
	},
	function(){
		$(this).parent().hover(
		function(){
			if($(this).parent().attr("style") == "overflow: visible;"){
				$(this).parent().css("overflow","visible");
			}
		},
		function(){
			$(this).parent().css("overflow","hidden");
			$(this).parent().attr("style","z-index: 300;");
		});
	});
	
	$("ul.servicii li").hover(
	function(){
		$(this).attr("style","z-index: 500;");
		$(this).css("overflow","visible");
	},
	function(){
		$('ul.servicii li .echipa_content').hover(
		function(){
			if($(this).parent().attr("style") == "overflow: visible;"){
				$(this).parent().css("overflow","visible");
			}
		},
		function(){
			$(this).parent().css("overflow","hidden");
			$(this).parent().attr("style","z-index: 300;");
		});
	});
	
	
	img_a = $(".fade_car_1 .image_fade img.img1");
	contor1 = 1;
	total = $(".image_fade").children().length;
	
	$(".fade_car_1 .handles a.handle2").click(
	function(){
		$(img_a).fadeOut("slow");
		if($(img_a).hasClass("current")){
			$(img_a).removeClass("current");
		}
		if(contor1 == total){
			img_a = $(".image_fade").children(":first-child");
			contor1 = 0;
			$(img_a).addClass("current").fadeIn("slow");
		} else {
					img_a = $(img_a).next();
					$(img_a).addClass("current").fadeIn("slow");
				}
		contor1++;
	});
	
	$(".fade_car_1 .handles a.handle1").click(
	function(){
		$(img_a).fadeOut("slow");
		if($(img_a).hasClass("current")){
			$(img_a).removeClass("current");
		}
		if(contor1 == 1){
			img_a = $(".image_fade").children(":last-child");
			contor1 = total + 1;
			$(img_a).addClass("current").fadeIn("slow");
		} else {
					img_a = $(img_a).prev();
					$(img_a).addClass("current").fadeIn("slow");
				}
		contor1--;
	});
	
	/* ---------- fade 3 ---------- */
	
	img = $(".fade3_container .fade3_1");
	contor = 1;
	
	$("a.handle2_2").click(
	function(){
		$(img).fadeOut("slow");
		$(img).removeClass("acum");
		if(contor == $(".fade3_container").children().length){
			img = $(".fade3_container").children(":first-child");
			contor = 0;
			$(img).addClass("current").fadeIn("slow");
		} else {
					img = $(img).next();
					$(img).addClass("acum").fadeIn("slow");
				}
		contor++;
	});
	
	$("a.handle2_1").click(
	function(){
		$(img).fadeOut("slow");
		$(img).removeClass("acum");
		if(contor == 1){
			img = $(".fade3_container").children(":last-child");
			contor = $(".fade3_container").children().length + 1;
			$(img).addClass("acum").fadeIn("slow");
		} else {
					img = $(img).prev();
					$(img).addClass("acum").fadeIn("slow");
				}
		contor--;
	});
	
	/* ---------- end of fade 3 ---------- */
	
	/* ---------- copyrighted carusel ---------- */
	
	function abs(e){
		if(e<0){return -e;} else return e;
	}
	
	var children_no = $("ul.fade2").children().length;
	var totalW = $("ul.fade2").children().length * 315;
	$("ul.fade2").attr("style","width: "+totalW+"px;")
	var leftPx = 0;
	$(".fade_car_2 a.next").click(
	function(){
		leftPx = leftPx - 630;
		if(abs(leftPx) >= totalW){leftPx=0;}
		$("ul.fade2").animate({left: leftPx+"px"}, "slow");
	});
	
	$(".fade_car_2 a.back").click(
	function(){
		leftPx = leftPx + 630;
		if(abs(leftPx) >= totalW){leftPx=0;}
		if(leftPx==630){
			if(children_no % 2 == 0) {
				leftPx = -(totalW-630);
			} else {
					leftPx = -(totalW-315);
				}
		}
		$("ul.fade2").animate({left: leftPx+"px"}, "slow");
	});
	
	/* ---------- end of copyrighted carusel ---------- */

}

$(document).ready(function() {
	initMenu();
	jQuery('#mycarousel').jcarousel({
		scroll: 4
	});
	jQuery('#mycarousel_istorie').jcarousel({
		vertical: true,
		scroll: 1
	});
	jQuery('#mycarousel_others').jcarousel({
		scroll: 3
	});
});













/*********************
//* jQuery Multi Level CSS Menu #2- By Dynamic Drive: http://www.dynamicdrive.com/
//* Last update: Nov 7th, 08': Limit # of queued animations to minmize animation stuttering
//* Menu avaiable at DD CSS Library: http://www.dynamicdrive.com/style/
*********************/

//Specify full URL to down and right arrow images (23 is padding-right to add to top level LIs with drop downs):
var arrowimages={down:['downarrowclass', 'down.gif', 23], right:['rightarrowclass', 'right.gif']}

var jqueryslidemenu={

animateduration: {over: 250, out: 250}, //duration of slide in/ out animation, in milliseconds

buildmenu:function(menuid, arrowsvar){
	jQuery(document).ready(function($){
		var $mainmenu=$("#"+menuid+">ul")
		var $headers=$mainmenu.find("ul").parent()
		$headers.each(function(i){
			var $curobj=$(this)
			var $subul=$(this).find('ul:eq(0)')
			this._dimensions={w:this.offsetWidth, h:this.offsetHeight, subulw:$subul.outerWidth(), subulh:$subul.outerHeight()}
			this.istopheader=$curobj.parents("ul").length==1? true : false
			$subul.css({top:this.istopheader? this._dimensions.h+"px" : 0})
		/*	$curobj.children("a:eq(0)").css(this.istopheader? {paddingRight: arrowsvar.down[2]} : {}).append(
				'<img src="'+ (this.istopheader? arrowsvar.down[1] : arrowsvar.right[1])
				+'" class="' + (this.istopheader? arrowsvar.down[0] : arrowsvar.right[0])
				+ '" style="border:0;" />'
			)	*/
			$curobj.hover(
				function(e){
					var $targetul=$(this).children("ul:eq(0)")
					this._offsets={left:$(this).offset().left, top:$(this).offset().top}
					var menuleft=this.istopheader? 0 : this._dimensions.w
					menuleft=(this._offsets.left+menuleft+this._dimensions.subulw>$(window).width())? (this.istopheader? -this._dimensions.subulw+this._dimensions.w : -this._dimensions.w) : menuleft
					if ($targetul.queue().length<=1) //if 1 or less queued animations
						$targetul.css({left:menuleft+"px", width:this._dimensions.subulw+'px'}).slideDown(jqueryslidemenu.animateduration.over)
				},
				function(e){
					var $targetul=$(this).children("ul:eq(0)")
					$targetul.slideUp(jqueryslidemenu.animateduration.out)
				}
			) //end hover
		}) //end $headers.each()
		$mainmenu.find("ul").css({display:'none', visibility:'visible'})
	}) //end document.ready
}
}

//build menu with ID="myslidemenu" on page:
jqueryslidemenu.buildmenu("myslidemenu", arrowimages)