/* Version 1 */
function	autoUrl(name, dest)
{
	var loc;
	var id_list;

	id_list = document.getElementById(name);
	loc = id_list.options[id_list.selectedIndex].value;
	if (loc != 0)
		location.href = dest+loc;
	return ;
}

function	autoUrlNoList(name, dest)
{
	var loc;

	loc = document.getElementById(name).checked;
	location.href = dest + (loc == true ? 1 : 0);
	return ;
}

/*
** show or hide element e depending on condition show
*/
function toggle(e, show)
{
	e.style.display = show ? '' : 'none';
}

function toggleMultiple(tab)
{
    var len = tab.length;

    for (var i = 0; i < len; i++)
        if (tab[i].style)
            toggle(tab[i], tab[i].style.display == 'none');
}

/**
* Show dynamicaly an element by changing the sytle "display" property
* depending on the option selected in a select.
*
* @param string $select_id id of the select who controls the display
* @param string $elem_id prefix id of the elements controlled by the select
*   the real id must be : 'elem_id'+nb with nb the corresponding number in the
*   select (starting with 0).
*/
function showElemFromSelect(select_id, elem_id)
{
	var select = document.getElementById(select_id);
	for (var i = 0; i < select.length; ++i)
	{
	    var elem = document.getElementById(elem_id + select.options[i].value);
		if (elem != null)
			toggle(elem, i == select.selectedIndex);
	}
}

/**
* Get all div with specified name and for each one (by id), toggle their visibility
*/
function openCloseAllDiv(name, option)
{
	var tab = $('*[name='+name+']');
	for (var i = 0; i < tab.length; ++i)
		toggle(tab[i], option);
}

/**
* Toggle the value of the element id_button between text1 and text2
*/
function toggleElemValue(id_button, text1, text2)
{
	var obj = document.getElementById(id_button);
	if (obj)
		obj.value = ((!obj.value || obj.value == text2) ? text1 : text2);
}

function addBookmark(url, title)
{
	if (window.sidebar)
		return window.sidebar.addPanel(title, url, "");
	else if ( window.external )
		return window.external.AddFavorite( url, title);
	else if (window.opera && window.print)
		return true;
	return true;
}

function writeBookmarkLink(url, title, text, img)
{
	var insert = '';
	if (img)
		insert = writeBookmarkLinkObject(url, title, '<img src="' + img + '" alt="' + escape(text) + '" title="' + escape(text) + '" />') + '&nbsp';
	insert += writeBookmarkLinkObject(url, title, text);
	document.write(insert);
}

function writeBookmarkLinkObject(url, title, insert)
{
	if (window.sidebar || window.external)
		return ('<a href="javascript:addBookmark(\'' + escape(url) + '\', \'' + escape(title) + '\')">' + insert + '</a>');
	else if (window.opera && window.print)
		return ('<a rel="sidebar" href="' + escape(url) + '" title="' + escape(title) + '">' + insert + '</a>');
	return ('');
}

function checkCustomizations()
{
	var tmp;
	var pattern = new RegExp(' ?filled ?');
	for (var i = 0; i < customizationFields.length; i++)
		/* If the field is required and empty then we abort */
		if (parseInt(customizationFields[i][1]) == 1 && $('#' + customizationFields[i][0]).val() == '' && !pattern.test($('#' + customizationFields[i][0]).attr('class')))
			return false;
	return true;
}

function formshowhide(id) {
	if(id == "pro") {
		document.getElementById('prof').style.display = "block";
	} else {
		document.getElementById('prof').style.display = "none";
	}
}

function depl_pan(id) {			
	$(function()
	{
		// this initialises the demo scollpanes on the page.
		$('.scroll-pane2').jScrollPane({showArrows:true});
			 
	});
			
$(document).ready(function() {
    //Pour changer la direction haut/bas et gauche/droit, placez seulement 
    //le caractère "-" devant la valeur de la propriété top/left
	 
    //Coulissement vertical onglet 1
    $('#ong1').click(function() {
		  if(document.getElementById('ong1').className=="of") {
			  $(".cover1", ".detail_onglet").stop().animate({left:'0px'},{queue:false,duration:800});
			  $(".cover2", ".detail_onglet").stop().animate({left:'0px'},{queue:false,duration:800});
			  $(".cover3", ".detail_onglet").stop().animate({left:'0px'},{queue:false,duration:800});
			  $(".cover4", ".detail_onglet").stop().animate({left:'0px'},{queue:false,duration:800});
			  document.getElementById('ong1').className='on';
			  document.getElementById('ong2').className='of';
			  document.getElementById('ong3').className='of';
			  document.getElementById('ong4').className='of';
			  document.getElementById('ong5').className='of';
			  }
    }); 
	 
    //Coulissement vertical onglet 2
    $('#ong2').click(function() {
		  if(document.getElementById('ong2').className=="of") {
			  $(".cover1", ".detail_onglet").stop().animate({left:'960px'},{queue:false,duration:800});
			  $(".cover2", ".detail_onglet").stop().animate({left:'0px'},{queue:false,duration:800});
			  $(".cover3", ".detail_onglet").stop().animate({left:'0px'},{queue:false,duration:800});
			  $(".cover4", ".detail_onglet").stop().animate({left:'0px'},{queue:false,duration:800});
			  document.getElementById('ong1').className='of';
			  document.getElementById('ong2').className='on';
			  document.getElementById('ong3').className='of';
			  document.getElementById('ong4').className='of';
			  document.getElementById('ong5').className='of';
			  }
    });  
	 
    //Coulissement vertical onglet 3
    $('#ong3').click(function() {
		  if(document.getElementById('ong3').className=="of") {
			  $(".cover1", ".detail_onglet").stop().animate({left:'960px'},{queue:false,duration:800});
			  $(".cover2", ".detail_onglet").stop().animate({left:'960px'},{queue:false,duration:800});
			  $(".cover3", ".detail_onglet").stop().animate({left:'0px'},{queue:false,duration:800});
			  $(".cover4", ".detail_onglet").stop().animate({left:'0px'},{queue:false,duration:800});
			  document.getElementById('ong1').className='of';
			  document.getElementById('ong2').className='of';
			  document.getElementById('ong3').className='on';
			  document.getElementById('ong4').className='of';
			  document.getElementById('ong5').className='of';
			  }
    });  
	 
    //Coulissement vertical onglet 4
    $('#ong4').click(function() {
		  if(document.getElementById('ong4').className=="of") {
			  $(".cover1", ".detail_onglet").stop().animate({left:'960px'},{queue:false,duration:800});
			  $(".cover2", ".detail_onglet").stop().animate({left:'960px'},{queue:false,duration:800});
			  $(".cover3", ".detail_onglet").stop().animate({left:'960px'},{queue:false,duration:800});
			  $(".cover4", ".detail_onglet").stop().animate({left:'0px'},{queue:false,duration:800});
			  document.getElementById('ong1').className='of';
			  document.getElementById('ong2').className='of';
			  document.getElementById('ong3').className='of';
			  document.getElementById('ong4').className='on';
			  document.getElementById('ong5').className='of';
			  }
    });  
	 
    //Coulissement vertical onglet 5
    $('#ong5').click(function() {
		  if(document.getElementById('ong5').className=="of") {
			  $(".cover1", ".detail_onglet").stop().animate({left:'960px'},{queue:false,duration:800});
			  $(".cover2", ".detail_onglet").stop().animate({left:'960px'},{queue:false,duration:800});
			  $(".cover3", ".detail_onglet").stop().animate({left:'960px'},{queue:false,duration:800});
			  $(".cover4", ".detail_onglet").stop().animate({left:'960px'},{queue:false,duration:800});
			  document.getElementById('ong1').className='of';
			  document.getElementById('ong2').className='of';
			  document.getElementById('ong3').className='of';
			  document.getElementById('ong4').className='of';
			  document.getElementById('ong5').className='on';
			  }
    });

});
}

function depl_pan2(id) {			
	$(function()
	{
		// this initialises the demo scollpanes on the page.
		$('.scroll-pane2').jScrollPane({showArrows:true});
			 
	});
			
$(document).ready(function() {
    //Pour changer la direction haut/bas et gauche/droit, placez seulement 
    //le caractère "-" devant la valeur de la propriété top/left
	 
    //Coulissement vertical onglet 1
    $('#ong1').click(function() {
		  if(document.getElementById('ong1').className=="of") {
			  $(".cover1", ".detail_onglet").stop().animate({left:'0px'},{queue:false,duration:800});
			  $(".cover2", ".detail_onglet").stop().animate({left:'0px'},{queue:false,duration:800});
			  $(".cover3", ".detail_onglet").stop().animate({left:'0px'},{queue:false,duration:800});
			  document.getElementById('ong1').className='on';
			  document.getElementById('ong2').className='of';
			  document.getElementById('ong3').className='of';
			  document.getElementById('ong4').className='of';
			  }
    }); 
	 
    //Coulissement vertical onglet 2
    $('#ong2').click(function() {
		  if(document.getElementById('ong2').className=="of") {
			  $(".cover1", ".detail_onglet").stop().animate({left:'950px'},{queue:false,duration:800});
			  $(".cover2", ".detail_onglet").stop().animate({left:'0px'},{queue:false,duration:800});
			  $(".cover3", ".detail_onglet").stop().animate({left:'0px'},{queue:false,duration:800});
			  document.getElementById('ong1').className='of';
			  document.getElementById('ong2').className='on';
			  document.getElementById('ong3').className='of';
			  document.getElementById('ong4').className='of';
			  }
    });  
	 
    //Coulissement vertical onglet 3
    $('#ong3').click(function() {
		  if(document.getElementById('ong3').className=="of") {
			  $(".cover1", ".detail_onglet").stop().animate({left:'950px'},{queue:false,duration:800});
			  $(".cover2", ".detail_onglet").stop().animate({left:'950px'},{queue:false,duration:800});
			  $(".cover3", ".detail_onglet").stop().animate({left:'0px'},{queue:false,duration:800});
			  document.getElementById('ong1').className='of';
			  document.getElementById('ong2').className='of';
			  document.getElementById('ong3').className='on';
			  document.getElementById('ong4').className='of';
			  }
    });  
	 
    //Coulissement vertical onglet 4
    $('#ong4').click(function() {
		  if(document.getElementById('ong4').className=="of") {
			  $(".cover1", ".detail_onglet").stop().animate({left:'950px'},{queue:false,duration:800});
			  $(".cover2", ".detail_onglet").stop().animate({left:'950px'},{queue:false,duration:800});
			  $(".cover3", ".detail_onglet").stop().animate({left:'950px'},{queue:false,duration:800});
			  document.getElementById('ong1').className='of';
			  document.getElementById('ong2').className='of';
			  document.getElementById('ong3').className='of';
			  document.getElementById('ong4').className='on';
			  }
    });  

});
}


function categ(tot) { 
	$(document).ready(function(){
	
	//Larger thumbnail preview 
	var tot;
	//	alert(tot);
		var wit = $(this).find('img').attr('width');
	//	alert('1-'+wit);
	$("ul.surcat li").hover(function() {
		$(this).css({'z-index' : '10'});
		var wit = $(this).find('img').attr('width');
	//	alert('1-'+wit);
	//	if(wit==37) { var wit1b = '45'; } 1.2162 37-44,4
	//	else if(wit==41) { var wit1b = '51'; }1.2439 41-49,2
	//	else if(wit==43) { var wit1b = '53'; }1.2325 43-51,6
	//	else if(wit==46) { var wit1b = '57'; }1.2391 46-55,2
	//	else if(wit==55) { var wit1b = '68'; }1.2363 55-66
	//	alert(id);
		$(this).find('img').addClass("hover").stop()
		//$(this).find('.caption').html($(this).find('img').attr('title'));		if(a.attr('target')=='_blank')
			.animate({
				marginTop: '-30px', 
				marginLeft: '-0px', 
				top: '50%', 
				left: '50%',
			//	width: wit1b+'px',
			//	if(wit==37) {
			//	width: '45px', }
			//	else {
				width: ((wit)*1.2)+'px',
				height: '321px',
				padding: '0px' 
			}, 200);
		
		} , function() {
		$(this).css({'z-index' : '0'});
		var wit;
		var wit2 = $(this).find('img').attr('width');
	//	if(wit2==45) { var wit3 = '37' }
	//	else if(wit2==51) { var wit3 = '41'; }
	//	else if(wit2==53) { var wit3 = '43'; }
	//	else if(wit2==57) { var wit3 = '46'; }
	//	else if(wit2==68) { var wit3 = '55'; }
	//	alert('1:'+wit+' -- 2:'+wit2);
		$(this).find('img').removeClass("hover").stop()
			.animate({
				marginTop: '0', 
				marginLeft: '0',
				top: '0', 
				left: '0', 
			//	width: (((wit2)/1.2)+1)+'px',
				width: '55px', 
				height: '260px', 
				padding: '0px'
			}, 200);
	});
	
	$("ul.surcat_2 li").hover(function() {
		$(this).css({'z-index' : '10'});
		$(this).find('img').addClass("hover").stop()
			.animate({
				marginTop: '-115px', 
				marginLeft: '-115px', 
				top: '50%', 
				left: '50%', 
				width: '202px', 
				height: '202px',
				padding: '16px' 
			}, 200);
		
		} , function() {
		$(this).css({'z-index' : '0'});
		$(this).find('img').removeClass("hover").stop()
			.animate({
				marginTop: '0', 
				marginLeft: '0',
				top: '0', 
				left: '0', 
				width: '180px', 
				height: '180px', 
				padding: '0px'
			}, 400);
	});
	
	 
	});
}


function tabs_apparence(id) {
	$(function() {
		$('#tab_appar > ul').tabs();
		/*$('#container-2 > ul').tabs({ selected: 1 });
		$('#container-3 > ul').tabs({ fx: { height: 'toggle' } });
		$('#container-4 > ul').tabs({ fx: { opacity: 'toggle' } });
		$('#container-5 > ul').tabs({ fx: { height: 'toggle', opacity: 'toggle' } });
		$('#container-6 > ul').tabs({
			fx: { opacity: 'toggle', duration: 'fast' },
			select: function(ui) {
				alert('select');
			},
			show: function(ui) {
				alert('show');
			}
		});
		$('#container-7 > ul').tabs({ fx: [null, { height: 'show', opacity: 'show' }] });
		$('#container-8 > ul').tabs();
		$('#container-9 > ul').tabs({ disabled: [2] });
		$('<p><a href="#">Remove 4th tab<\/a><\/p>').prependTo('#fragment-22').find('a').click(function() {
			$('#container-9 > ul').tabs('remove', 3);
			return false;
		});
		$('<p><a href="#">Insert new tab at 2nd position<\/a><\/p>').prependTo('#fragment-22').find('a').click(function() {
			$('#container-9 > ul').tabs('add', '#inserted-tab', 'New Tab', 1);
			return false;
		});
		$('<p><a href="#">Append new tab<\/a><\/p>').prependTo('#fragment-22').find('a').click(function() {
			$('#container-9 > ul').tabs('add', '#appended-tab', 'New Tab');
			return false;
		});
		$('<p><a href="#">Disable 3rd tab<\/a><\/p>').prependTo('#fragment-22').find('a').click(function() {
			$('#container-9 > ul').tabs('disable', 2);
			return false;
		});
		$('<p><a href="#">Enable 3rd tab<\/a><\/p>').prependTo('#fragment-22').find('a').click(function() {
			$('#container-9 > ul').tabs('enable', 2);
			return false;
		});
		$('<p><a href="#">Select 3rd tab<\/a><\/p>').prependTo('#fragment-22').find('a').click(function() {
			$('#container-9 > ul').tabs('select', 2);
			return false;
		});
		$('<p><a href="#">Get selected tab<\/a><\/p>').prependTo('#fragment-22').find('a').click(function() {
			alert( $('#container-9 > ul').data('selected.tabs') );
			return false;
		});
		$('#container-10 > ul').tabs({ selected: null, unselect: true });
		$('#container-11 > ul').tabs({ event: 'mouseover' });*/
	});
}

function DispInline1(id) {
	if (navigator.appName=='Microsoft Internet Explorer') {
		eval("document.all.inline1.style.display='none'");
		eval("document.all.fd_gris.style.display='none'");
		}
	else {
		eval("document.getElementById('inline1').style.display='none'");
		eval("document.getElementById('fd_gris').style.display='none'");
		}
}
