$(document).ready(function() {

	var objSearch = $('.searchtextbox');
	jQuery.each(objSearch, function() {
		$(this).attr('tvalue', $(this).val());
		$(this).focus(function() {
			var val = $(this).val();
			var tval = $(this).attr('tvalue');

			if (tval == val) {
				$(this).val('');
			}
		});
		$(this).blur(function() {
			var val = $(this).val();
			var tval = $(this).attr('tvalue');

			if (jQuery.trim(val) == "") {
				$(this).val(tval)
			}
		});

		if ($.browser.mozilla) {

			$(this).removeClass('searchtextbox');
			$(this).addClass('searchtextboxmozilla');
		}
		
	});



	

	//	var menu = $('.btnaccueil');
	//	menu.hover(
	//		function() {
	//			$(this).css({ backgroundImage: 'url(/sites/affichage/Images/themes/default/menu1-background.gif)', color: '#ffffff' });
	//		},
	//		function() {
	//			$(this).css({ backgroundImage: 'none', color: '#000000', textTransform: 'uppercase' });
	//		}
	//	);




	if ($.browser.msie) {
		$("#toolbox2").css("top", "-2px");
		$("#face").css("top", "-6px");
		$("#toolbox1").css("top", "-6px");
	}

	if($.browser.msie && $.browser.version=="7.0") {
		$("#toolbox2").css("top", "-2px");
		$("#toolbox2").css("left", "-315px");

		$(function() {
			var zIndexNumber = 1000;
			$('div').each(function() {
				$(this).css('zIndex', zIndexNumber);
				zIndexNumber -= 10;
			});
		}); 




	}

	jQuery.easing.def = 'easeInOutCirc';
	$("#toolbox2").hover(
		function(e) {
			e.preventDefault();
			this.blur();
			$('#toolbox2').animate({ height: 150 }, {queue: false, duration: 1000, easing: 'easeOutBounce' });
		},
		function(e) {
			e.preventDefault();
			this.blur();
			$('#toolbox2').animate({ height: 18 }, {queue: false, duration: 500, easing: 'easeInOutCirc' });
		}
	);

	$("#toolbox2").find("a").hover(
		function(e) {
			$(this).css("textDecoration","underline");
		},
		function(e) {
			$(this).css("textDecoration", "none");
		}
	);

	$('.vborder').css('opacity', '0.7');
	$('.hborder').css('opacity', '0.7');

});


function onclientitemopened(sender, args) {
	var item = args.get_item();
	var lvl = item.get_level();

	if (lvl == 0 && item.get_value() == 8) {
		sender.trackChanges();
		for (i = 0; i < item.get_items().get_count(); i++) {
			item.get_items().getItem(i).open();
		}
		sender.commitChanges();
	}
}

function onclientitemclosing(sender, args) {
	var item = args.get_item();
	var lvl = item.get_level();
	if (lvl == 1) {
		if (item.get_parent().get_value() == 8) {
			args.set_cancel(true);
		}
	}
}
