jQuery.noConflict();


var aW = Array();
var browser;

jQuery(document).ready(function($){	

	// set the browser type
	if ($.browser.msie && $.browser.version.substr(0,1)<7) { browser = "ie6"; }
	else if ($.browser.msie && $.browser.version.substr(0,1)<8) { browser = "ie7"; } 
	
	// manage the menu
	$("#menu_main li.first").each(function(i){
		$(this).attr("id", i);
		$(this).prepend("<div class='pfeil'></div>");
		$(".temp").append("<li class='first'><p>"+$(this).children("a").attr("title")+"</p></li>");
	});
	
	
	$("#menu_main li.first").hover(
		function () { onLiOver($(this));}, 
		function () { onLiOut($(this)); }
	);
	



  function onLiOver(elt){
  	$(elt).children("a").attr("status", "over");
  	$(elt).animate({ backgroundColor: "#EDCC75", queue: true}, 300);
  	$(elt).children(".pfeil").css("margin-top", "7px");

  	if(browser == "ie6"){$(elt).children(".pfeil").css("margin-bottom", "0px");}
  	
  	$(elt).children(".pfeil").animate( { marginLeft:"20px", queue: true } , 200 );
  	$(elt).children("a:hover").css( { color:"#333333", queue: true } , 200 );
  	
  	$(elt).children("a").fadeOut(300,function () {
  		changeLinkvalue($(this));
  		$(elt).children("a").fadeIn(300);
  		if($(this).attr("status") == "over"){
  			if(browser == "ie6"){ $(elt).css("width", "110%");}
  			else if(browser == "ie7"){ $(elt).css("width", "100%");}
  			else{ 						$(elt).animate({ width: "120%"}, 300); }
  		}
  	});
  }
  
  function onLiOut(elt){
  	$(elt).children("a").attr("status", "out");
  	$(elt).animate({ backgroundColor: "#EFAA15", queue: true}, 300 );	
  	$(elt).children(".pfeil").animate( { marginLeft:"16px", queue: true } , 200 );
  	$(elt).children("a").css( { color:"#333333", queue: true } , 200 );
  	$(elt).children("a").fadeOut(300,function () {
  		changeLinkvalue($(this));
  		if($(this).attr("status") == "out"){
  			$(elt).children("a").fadeIn(300);
  			if(browser == "ie6" || browser == "ie7"){  		$(elt).animate({ width:308}, 300); }//$(elt).animate({ width:308}, 300); }
  			else{ 						$(elt).animate({ width: 308}, 300); }			
  		}
  	});
  }

  function changeLinkvalue(elt){	
  	sww0 = $(elt).html(); // html value
  	sww1 = $(elt).attr("title"); // attribute value

  	$(elt).html(sww1);
  	$(elt).attr("title", sww0);
  }
});