  
function get_szLog()
{

    var GET = location.search;

    mySplitResult = GET.split("&");
    
    for (i=0;data = mySplitResult[i];i++)
    {
        if (data.indexOf("szLog_Flux")>= 0)   //.MARK_HORREUR : conflit entre les 2 get_szLog from fonctions.js / javascript.js
        {
            mySecondSplitResult = data.split("=");
            var szLog = mySecondSplitResult[1];
            return szLog;
        }
    
    }
}

function visibility_go(id,id_div)
{

    if(document.getElementById(id).style.visibility == 'hidden')
    {
        document.getElementById(id).style.visibility = 'visible';
        document.body.style.overflow='hidden';
    }
    else
    {
        document.getElementById(id).style.visibility = 'hidden';
        document.body.style.overflow='';
    }
    
    if(document.getElementById(id_div).style.visibility == 'hidden')
    {
        document.getElementById(id_div).style.visibility = 'visible';
        document.body.style.overflow='hidden';        
    }
    else
    {
        document.getElementById(id_div).style.visibility = 'hidden';
        document.body.style.overflow=''; 
    }   
}

function unload_ajax_loader(div)
{
    document.getElementById(div).innerHTML = "";
}

function step_aff(elemCible,response,step_av)
{
//alert(msgAJAX_ERR);
	if(typeof response=='undefined'
		|| response=='ERR')
	{
		response = msgAJAX_ERR;
		unload_ajax_loader('step_'+step_av+'_loader');
	}

    $(elemCible).innerHTML = response;
}

//.step from INS_C to Booking */
function get_step_2(lgVoucher_Id,szVoucher_Nu,elemCible,szLog)
{

//alert('Booking_AJAX_A_01.php?szLog'+szLog+'&lgVoucher_Id'+lgVoucher_Id+'&szVoucher_Nu'+szVoucher_Nu);
    req = new Request({
        method: 'post',
        url: 'Booking_AJAX_A_01.php',
        data: {szLog:szLog,lgVoucher_Id:lgVoucher_Id,szVoucher_Nu:szVoucher_Nu},
        	
        onFailure: function (xhr)
          { // Réponse HTTP != 2xx
		    step_aff(elemCible,'ERR',1);
          },
        onException: function (xhr, exception)
          {
		    step_aff(elemCible,'ERR',1);
          },
        onComplete: function(response)
		  {
		    step_aff(elemCible,response,1);
          }
    }).send();

    return;
}

/* step from RFR to RGL */
function get_step_3(lgVoucher_Id,szVoucher_Nu,elemCible,szLog)
{

    req = new Request({
        method: 'post',
        url: 'Payment_AJAX_A_01.php',
        data: {szLog:szLog,lgVoucher_Id:lgVoucher_Id,szVoucher_Nu:szVoucher_Nu},

        onFailure: function (xhr)
          { // Réponse HTTP != 2xx
		    step_aff(elemCible,'ERR',2);
          },
        onException: function (xhr, exception)
          {
		    step_aff(elemCible,'ERR',2);
          },
        onComplete: function(response)
		  {
		    step_aff(elemCible,response,2);
          }
/*old=        onComplete: function(response) {
            current_elem = $(elemCible);
            current_elem.innerHTML = response;
        	}*/
    }).send();
   return;
}

/* step from RGL to DOCs */
function get_step_4(lgVoucher_Id,szVoucher_Nu,elemCible,passage,szLog)
{
alert(szLog);
    if(passage == 1)
    {
        setTimeout("get_step_4("+lgVoucher_Id+",'"+szVoucher_Nu+"','step4','0','"+szLog+"');",5000);
        return;
    }


    req = new Request({
        method: 'post',
        url: 'Document_AJAX_A_01.php',
        data: {szLog:szLog,lgVoucher_Id:lgVoucher_Id,szVoucher_Nu:szVoucher_Nu},

        onFailure: function (xhr)
          { // Réponse HTTP != 2xx
		    step_aff(elemCible,'ERR',1);
          },
        onException: function (xhr, exception)
          {
		    step_aff(elemCible,'ERR',1);
          },
        onComplete: function(response)
		  {
		    step_aff(elemCible,response,1);
          }
/*old=        onComplete: function(response) {
            current_elem = $(elemCible);
            current_elem.innerHTML = response;
        	}*/
    }).send();
   return;
}

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 montrer_cacher3(id)
{
	if(id) element = document.getElementById(id);

	if (element.style.display == 'none') element.style.display = 'block';
	else element.style.display = 'none';
}

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;
}

