function clearInputs(){
	$('input:text, input:password, textarea').each(function(){
		if (this.name.indexOf("noclear") != -1){return null;}
		if (this.className.indexOf("noclear") != -1){return null;}
		if(!this.val) this.val = this.value;
		this.onfocus = function(){
			if (this.id == 'motdepasse') { showMdpHint(true); }
			if(this.value == this.val) this.value = '';
		}
		this.onblur = function(){
			if (this.id == 'motdepasse') { showMdpHint(false); }
			if (this.value == '') this.value = this.val;
		}
	});
}

function showMdpHint(onOff) {
	var infoBulle = document.getElementById('hintMdp');
	if (infoBulle == null) {
		infoBulle = document.createElement('IMG');
		infoBulle.src= '/Images/bg-post-it.png';
		infoBulle.id = 'hintMdp';
		document.body.appendChild(infoBulle);
	}
	with(infoBulle.style) {
		display = onOff ? 'block' : 'none';
		position = 'absolute';
		zIndex = 10;
		top= '60px';
		left = '790px';
	}
}

function initFavorites() {
	$("ul#photo-box-holder > li").each(function(){
		var _star = $(this).find("a.star-image");
		var _astring = "Retirer de ma sélection";
		var _vstring = "Ajouter à ma sélection";

		var _button = $(this).find("a.switcher");

		_button.click(function(){
			if($(this).hasClass("active")) {
				$(this).removeClass("active").addClass("visited").find("em").eq(0).html(_vstring);
				_star.removeClass("active");
			}
			else {
				$(this).removeClass("visited").addClass("active").find("em").eq(0).html(_astring);
				_star.addClass("active");
			}

			return false;
		});
	});
}

function initPage() {
	clearInputs();
//	initFavorites();
}

if (window.addEventListener) window.addEventListener("load", initPage, false);
else if (window.attachEvent && !window.opera) window.attachEvent("onload", initPage);

