function montrer_cacher(mode,element)
{
	if (mode == 'hide')
	{
		new Fx.Slide(element).hide();
	}
	if (mode == 'show')
	{
		cacher_all();
		new Fx.Slide(element).show();
	}
}
function montrer_cacher_id(mode,element)
{
	if (mode == 'hide')
	{
		new Fx.Slide(element).hide();
	}
	if (mode == 'show')
	{
		new Fx.Slide(element).show();
	}
}
function cacher_test(id_class,mode)
{

    $$("."+id_class).each(function(item)
        {
            if (mode == 'hide')
            {
                new Fx.Slide(item).slideOut();
            }
            else if(mode == 'show')
            {
                new Fx.Slide(item).slideIn();
            }
            else if(mode == 'onload')
            {
                new Fx.Slide(item).hide();
            }            
            else
            {
                alert ("ERROR HORRIBLE !!! ALERTER JEROME BRUN !!");
            }        
        }
    )
}
function ouvrir_all()
{
    cacher_test('BlockCustomerInfo','show');
    cacher_test('BlockPU','show');
    cacher_test('BlockDO','show');
    cacher_test('BlockProducts','show');
    cacher_test('BlockPrice','show');
    cacher_test('BlockOptions','show');
    
    return false;
}
function cacher_all()
{
    cacher_test('BlockCustomerInfo','onload');
    cacher_test('BlockPU','onload');
    cacher_test('BlockDO','onload');
    cacher_test('BlockProducts','onload');
    cacher_test('BlockPrice','onload');
    cacher_test('BlockOptions','onload');
 
    new Fx.Slide('div_1').hide();

    return false;
}
function pop_it(the_form) {
   my_form = eval(the_form);
   window.open("disponibilite.php", "popup", "height=440,width=640,menubar=yes,toolbar=no,location=no,status=no,scrollbars=yes");
   my_form.target = "popup";
   my_form.submit();
}

var submitLock=false;
function submitForm(elem){
while (elem.parentNode && elem.parentNode.tagName != "FORM"){
elem = elem.parentNode;
}
var oForm = elem.parentNode;
oForm.submit();
}
function fctX3PALL(id,szLog,szSEL_Mode,szPage,earlybooking)
{
    if(earlybooking != 'NULL') url_ae_cpn = "&ae_cpn=" + earlybooking;
    else url_ae_cpn ='';
    if (id.value != '-1') window.location = szPage + "?szLog=" + szLog + "&lgCty_Id=" + id + "&szSel_Mode=" + szSEL_Mode + url_ae_cpn;
}
function selectother( thisSelect, otherSelect )
{
	otherSelect.selectedIndex = thisSelect.selectedIndex;
}

function PopupCentrer(page,largeur,hauteur,options)
{
  var top=(screen.height-hauteur)/2;
  var left=(screen.width-largeur)/2;
  window.open(page,"","top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);
}

function prefill(obj, str_default )
{
	if(obj.value == str_default) obj.value = '';
}

function verifform(lock)
{
	var  toto = '';
	return !lock;
}

function doSubmit( frm_name )
{
	var form = document.forms[frm_name];
	form.action = 'index.php';
	form.target = '_self';
	form.submit();
}

function popup_open(formulaire, url, width, height, scrollMode)
{
	 scrollMode = (!scrollMode ?  "no" : "yes");
	if( formulaire.tagName == 'FORM'  )
  {
    formulaire = eval(formulaire) //vérification
    window.open(url, 'popup', 'toolbar=no, status=yes, scrollbars='+scrollMode+', resizable=no, width='+width+', height='+height);
		formulaire.target = 'popup'; //on redéfinit la cible ;)
		formulaire.action = url; //on redéfinit la cible ;)
		formulaire.submit(); //on post
	}
	else
  	window.open(url, 'popup', 'toolbar=no, status=yes, scrollbars='+scrollMode+', resizable=no, width='+width+', height='+height);

	return true;
}


function chkEspaceClient( form, url,CST_ERROR )
{
	if( isValidSubmit( form,CST_ERROR ) )
		return popup_open(form, url, 800, 800, true);
	else
		return false;
}

function chkNewsletter(form, url, inputEmail)
{
	var email = form[inputEmail].value;
	if (isValidSubmit( form ) )
		if( isEmail(email) )
			return popup_open(form, url, 220,220);
		else
			return false;
	else
		return false;
}


function isEmail(email)
{

 return true;
}