//.15-04-06 : MARK_001, Externalisation forme !!!!

// JavaScript Document
function setMois()
{
document.Grille.lgDO_DDR_Mois.selectedIndex=document.Grille.lgPU_DDR_Mois.selectedIndex;
}

function setAnnee()
{
document.Grille.lgDO_DDR_Annee.selectedIndex=document.Grille.lgPU_DDR_Annee.selectedIndex;
}

function retour()
{
history.back();
}

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 Transfert01(lien)
{
document.Grille.szPU_Ville.value=lien;
}

//MARK_001 ext(para visualizar todas las ciudades de este país)
//function Transfert_Id_Pays_Main(id,szLog,szMessage)
function fctX1PALL(id,szLog,szMessage)
{
document.getElementById('INP').innerHTML='Clic <a href="index.php" class="A1" id="LNV">QUI</a> ' + szMessage;
document.getElementById("LNV").href = "index.php?szLog=" + szLog + "&lgCty_Id="+id+"&szSel_Mode=LST";
/*
document.getElementById('info_pays').innerHTML='Clic <a href="index.php" class="A1" id="lien_ville">QUI</a>' + szMessage;
document.getElementById("lien_ville").href = "index.php?szLog=" + szLog + "&lgCty_Id="+id;
*/
}

function Transfert_Id_Pays_Multi(id,szLog)
{
document.getElementById('info_pays').innerHTML='Clic <a href="index.php" class="A1" id="lien_ville">QUI</a> para visualizar todas las ciudades de este país';
document.getElementById("lien_ville").href = "index.php?szLog=" + szLog + "&lgCty_Id="+id;
}
/*
function Redirect(id) 
{
Item = Grille.lgCty_Id.selectedIndex;
if (Grille.lgCty_Id.options[Item].value != '-1')
	{
	window.location = "index.php?lgCty_Id="+id;
	}
}
*/
function fctX3PALL(id,szLog,szSEL_Mode)
{
    if (id.value != '-1') window.location = "index.php?szLog=" + szLog + "&lgCty_Id=" + id + "&szSel_Mode=" + szSEL_Mode;
}

function Transfert(lien)
{
document.Grille.szPU_Ville.value=lien;
document.forms['Grille'].submit();
}

function testerRadio(radio) {
      for (var i=0; i<radio.length;i++) {
         if (radio[i].checked) {
            alert("Système = "+radio[i].value)
         }
      }
   }

//Affichage zone pour message <Afficher tt les villes>
//function showlaptop(theMotif)
function fctX2PALL(id,theMotif)
{
    //var theITEM = document.getElementById["lgCty_Id"];  //forms["Grille"].
    //var theOption = theITEM.selectedIndex; //Item = Grille.lgCty_Id.selectedIndex;
    //if (theITEM.options[theOption].value != '-1')    //if (Grille.lgCty_Id.options[Item].value != '-1')
    var i = 0;
    var ua = window.navigator.userAgent.toLowerCase();
    if ((ua.indexOf('msie') !=-1)) szTMP = 'block';
    else szTMP = 'table-row';
  
    if (id.value != '-1')
    {
    	if (document.getElementById(theMotif).style.display == 'none') document.getElementById(theMotif).style.display = szTMP; //'table-row'; // au lieu de 'block';
    }
    else
    {
    	if (document.getElementById(theMotif).style.display == 'none') document.getElementById(theMotif).style.display = 'none';
    	else document.getElementById(theMotif).style.display = 'none';
    }
}

function verifform()
  {

   if(document.Grille.szPU_Ville.value == "")
    {
     alert("Definite la città di ritiro del veicolo");
     document.Grille.szPU_Ville.focus();
     return false;
    }

  }

function FocusText(BoxName)
{
if (BoxName.value == BoxName.defaultValue)
{
BoxName.value = '';
}
}
function BlurText(BoxName)
{
if (BoxName.value == '')
{
BoxName.value = BoxName.defaultValue;
}
}

//Fonctions images
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function agencia_checker()
{
// set var radio_choice to false
var radio_choice = false;

// Loop from zero to the one minus the number of radio button selections
for (counter = 0; counter < reserva.szAGN_Ref_Externe.length; counter++)
{
// If a radio button has been selected it will return true
// (If not it will return false)
if (reserva.szAGN_Ref_Externe[counter].checked)
radio_choice = true; 
}

if (!radio_choice)
{
// If there were no selections made display an alert box 
alert("Selezionare un'agenzia di noleggio")
return (false);
}
return (true);
}

