/* --------------------------------------------------------QualiteConstruction.com (c) 2008. Tous droits réservés.---------------------------------------------------------*/$(document).ready(function () {		// Iterates over all slide element	$(".slide").each(function () {		initSlideBox(this);	});		// Expand all link event	$("li.slideexpandall").each(function () {		$(this).bind("click", function(e) {			expandAllSlideBox(this);		});	});		// Collapse all link event	$("li.slidecollapseall").each(function () {		$(this).bind("click", function(e) {			collapseAllSlideBox(this);		});	});		// Allways expand first slide of a page	/*$(".slide:first").each(function () {		expandSlideBox(this);	});*/		// Iterates over all round element	$(".round").each(function () {		$(this).bind("mouseover", function(e) {			$(this).addClass("roundhover");		});		$(this).bind("mouseout", function(e) {			$(this).removeClass("roundhover");		});	});		// Slide for order histories	$(".com-slide-order").each(function () {		var btn = $('<div class="padding"><a href="" class="button">Voir le détail de la commande</a></div><div class="clearer">&nbsp;</div>');		var link = btn.find('a').eq(0);		var order = $(this);		order.hide();		link.bind("click", function(e) {			order.slideToggle("normal");			return false;	    });		order.before(btn);	});		// Graphic button, replace button by link	$('#content .button, #content div.buttons a').each(function(){		if (($(this).hasClass("back")) || ($(this).parent().hasClass("back"))) { button(this, true); }		else { button(this, false); }	});	$('#content .buttonwrap input').each(function(){		if ($(this).hasClass("back")) { button(this, true); }		else { button(this, false); }	});		// Mouse hover pictures	$('.mousehover').each( function() {		$(this).bind("mouseover", function(e) {			$(this).find(".hidemouse").addClass("jshide");			$(this).find(".showmouse").addClass("jsshow");		});		$(this).bind("mouseout", function(e) {			$(this).find(".hidemouse").removeClass("jshide");			$(this).find(".showmouse").removeClass("jsshow");		});	});		// Multi-column	//$('#alias-plan-du-site #t3content ul').columnize({columns: 2});		// Hover list, change bullet color	$('#content ul.summary li, #alias-fiches-pathologie dd, #alias-fiches-renovation dd').each( function() {		$(this).hover(			function () { $(this).addClass("over"); },			function () { $(this).removeClass("over"); }		);	});		// Media plugins	$('.mediaobj').media();		// Concours photos	$('#laureats area').bind("click", function(e) {	  //alert($(this).attr('class'));	  $('#laureats_links .' + $(this).attr('class')).click();	  return false;    });});// Collapse a slide boxfunction initSlideBox(box) {		// Extracted content title or resume	var slideExtractElement = $(box).find("h3.resume,h1,h2,h3,h4,h5,h6,p,li,table,th,td");		if ($(slideExtractElement).length > 0) {		$(box).prepend("<h3 class=\"resume\">"+ slideExtractElement.eq(0).html().slice(0, 60) +"</h3>");		$(slideExtractElement).eq(0).hide(); // Hide extract element in content	} else {		$(box).prepend("<h3 class=\"resume\">Contenu dépliant...</h3>");	}	collapseSlideBox(box);}// Collapse a slide boxfunction collapseSlideBox(box) {		// Remove collapse link	$(box).find(".collapse").remove();		// Hide all content by using hide() or slideUp()	if ($(box).hasClass("open")) {		//$(box).contents(".wrapper").slideUp("normal");		$(box).contents(".wrapper").slideToggle("normal");	} else {		$(box).contents(".wrapper").hide();	}		// Change title style by adding/removing class	$(box).removeClass("open");	$(box).addClass("close");		// Insert expand button	$(box).prepend("<div class=\"expand pointer\" title=\"Déplier\"><span>Dépier</span></div>");		// Add click event on expand button	$(box).find(".expand").bind("click", function(e) {	  expandSlideBox(box);    });}// Expand a slide boxfunction expandSlideBox(box) {		// Remove expand link	$(box).find(".expand").remove();		// Change title style by adding/removing class	$(box).removeClass("close")	$(box).addClass("open");		// Insert collapse button	$(box).prepend("<div class=\"collapse pointer\" title=\"Plier\"><span>Plier</span></div>");		// Display content	//$(box).find(".wrapper").slideDown("normal");	$(box).find(".wrapper").slideToggle("normal");		// Add click event on collapse button	$(box).find(".collapse").bind("click", function(e) {	  collapseSlideBox(box);    });}function collapseAllSlideBox() {	$(".slide.open").each(function () {		//if ($(this).hasClass("open")) {			collapseSlideBox(this);		//}	});}function expandAllSlideBox() {	$(".slide.close").each(function () {		//if ($(this).hasClass("close")) {			//alert('test');			expandSlideBox(this);		//}	});}// Make link and button graphicfunction button(btn, back) {	// find the DOM element we're processing	var b = $(btn);	// find the current text or value of the currently processed .btn element	var tt = b.text() || b.val();	// find the href value - only for normal buttons	var href = $(btn).attr('href') || '';	// make a note of the parent form	var parentForm = $(btn).parents('form');	// work out what type of element we're processing.	var type = $(btn).attr('type');	var name = $(btn).attr('name');	var value = $(btn).attr('value');	// Define span class, classic or back	btnClass = '';	if (back) { btnClass = ' back'; }		if (type == 'submit' || type == 'reset') {		// just hide the button, so the form still submits when enter key is pressed on a field		$(btn).hide();		// insert the replacement button after the existing hidden element		b = $('<a href="' + href + '" class="button' + btnClass + '"><span>' + tt + '</span></a>').insertAfter(btn);		h = $('<input type="hidden" name="' + name + '" value="' + value + '" />').insertAfter(btn);		// add a click listener to the button		b.click(function() {			if (type == 'submit') {				parentForm.submit();			} else if (type == 'reset') {				parentForm.reset();			}			return false;		});		// allows for the enter button to submit form contents cross-browser		/*parentForm.keyup(function(e) {			if (e.keyCode == 13) {				parentForm.submit();				return false;			}		});*/	} else {		// normal Anchor Tag, just replace the contents of the element with the button formatting		b = $(btn).html('<span>' + tt + '</span>');		if (back) { $(btn).addClass("back"); }	}}function launchDownloads() {	var j=1;	$("#alllinks .cb input:checked").each(function () {				if (navigator.userAgent.toLowerCase().indexOf('opera')>=0) {			var iframe = document.createElement('iframe');			iframe.src = 'javascript:document.location="'+(this.value)+'"';			dlframe.appendChild(iframe);		}		else {			window.setTimeout('document.location="'+this.value+'"', j*500);			j++;		}	});	return false;}function fRech(nomr) {	 	 tr = document.getElementsByName("tx_indexedsearch[sword]");	 for(i=0;i<tr.length;i++) {	 	tr[i].value = nomr;	 }	 document.tx_indexedsearch.submit();}