//-----------------------------------------------------------------------------//
//   -----------------------------------------------------------------------   //
//   --------------- Bibliothèque javaScript -------------------------------   //
//   -----------------------------------------------------------------------   //
//-----------------------------------------------------------------------------//

//  ---------------------------------

function OpenPop(u,n,w,h,t,l,d,s,m,sc,r){//url;name;width;height;toolbar;location;direction;status;menubar;scrollbar;resizable
  window.open(u,n,'toolbar='+t+',location='+l+',directories='+d+',status='+s+',menubar='+m+',scrollbars='+sc+',resizable='+r+',width='+w+',height='+h);
}

//  ---------------------------------

function dicoMOTCLE() {

   var objForm = document.frmMOTCLE;

   if ( (objForm.strMC.value == "") || (!isNaN(objForm.strMC.value)) )
         {alert("\n** Attention, pour la bonne procédure veuillez taper un nom d\'artiste, s'il vous plaît. **");
          objForm.strMC.focus();return false;
   }

}

//  ---------------------------------

function validIinscription() {

  var objForm = document.frmEnvoi;

  missinginfo = "";

  if (objForm.strNOM.value == ""){
  missinginfo += "\n     -  Nom";
  }
  if (objForm.strNOMART.value == ""){
  missinginfo += "\n     -  Nom d\'artiste";
  }
  if (objForm.strADRESSE.value == ""){
  missinginfo += "\n     -  Adresse";
  }
  if (objForm.strCP.value == ""){
  missinginfo += "\n     -  Code postal";
  }

  if (objForm.strVILLE.value == ""){
  missinginfo += "\n     -  Ville";
  }

  if (objForm.strTEL.value == ""){
  missinginfo += "\n     -  Téléphone";
  }
  if (objForm.strMAIL.value == ""){
  missinginfo += "\n     -  Email";
  }

  if (missinginfo != "") {
  missinginfo ="______________________________\n" + "Vous n'avez pas rempli correctement:\n" + missinginfo + "\n______________________________" +  "\nRecommencez s'il vous plait!";
  alert(missinginfo);
  return false;
}

}
//  ----------------------------------
//  ---------------------------------

function validIinscriptionVendeur() {

  var objForm = document.frmEnvoi;

  missinginfo = "";

  if (objForm.strNOM.value == ""){
  missinginfo += "\n     -  Nom";
  }
  if (objForm.strPRENOM.value == ""){
  missinginfo += "\n     -  Prénom";
  }
  if (objForm.strADRESSE.value == ""){
  missinginfo += "\n     -  Adresse";
  }
  if (objForm.strCP.value == ""){
  missinginfo += "\n     -  Code postal";
  }

  if (objForm.strVILLE.value == ""){
  missinginfo += "\n     -  Ville";
  }

  if (objForm.strTEL.value == ""){
  missinginfo += "\n     -  Téléphone";
  }

  if (missinginfo != "") {
  missinginfo ="______________________________\n" + "Vous n'avez pas rempli correctement:\n" + missinginfo + "\n______________________________" +  "\nRecommencez s'il vous plait!";
  alert(missinginfo);
  return false;
}

}
//-------------------------------------
//  ---------------------------------

function validFiche() {

  var objForm = document.frmRens;

  missinginfo = "";


  if (objForm.strNOMART.value == ""){
  missinginfo += "\n     -  Nom d\'artiste";
  }

  if (objForm.strNOM.value == ""){
  missinginfo += "\n     -  Nom";
  }

  if (objForm.strPRENOM.value == ""){
  missinginfo += "\n     -  Prénom";
  }

  if (objForm.strADRESSE.value == ""){
  missinginfo += "\n     -  Adresse";
  }

  if (objForm.strCP.value == ""){
  missinginfo += "\n     -  Code postal";
  }

  if (objForm.strVILLE.value == ""){
  missinginfo += "\n     -  Ville";
  }

  if (objForm.strPAYS.value == ""){
  missinginfo += "\n     -  Pays";
  }

  if (missinginfo != "") {
  missinginfo ="______________________________\n" + "Vous n'avez pas rempli correctement:\n" + missinginfo + "\n______________________________" +  "\nRecommencez s'il vous plait!";
  alert(missinginfo);
  return false;
}

}
/***********Gestion du parrainage***********/
//  ---------------------------------

function validFiche() {

  var objForm = document.frmRens;

  missinginfo = "";


  if (objForm.strNOMART.value == ""){
  missinginfo += "\n     -  Nom d\'artiste";
  }

  if (objForm.strNOM.value == ""){
  missinginfo += "\n     -  Nom";
  }

  if (objForm.strPRENOM.value == ""){
  missinginfo += "\n     -  Prénom";
  }

  if (objForm.strADRESSE.value == ""){
  missinginfo += "\n     -  Adresse";
  }

  if (objForm.strCP.value == ""){
  missinginfo += "\n     -  Code postal";
  }

  if (objForm.strVILLE.value == ""){
  missinginfo += "\n     -  Ville";
  }

  if (objForm.strPAYS.value == ""){
  missinginfo += "\n     -  Pays";
  }

  if (objForm.strEMAIL.value == ""){
  missinginfo += "\n     -  Email";
  }

  if (missinginfo != "") {
  missinginfo ="______________________________\n" + "Vous n'avez pas rempli correctement:\n" + missinginfo + "\n______________________________" +  "\nRecommencez s'il vous plait!";
  alert(missinginfo);
  return false;
}

}//  ---------------------------------

function fctListeParrain() {

  var objForm = document.frmParrain;

  missinginfo = "";


  if (objForm.var_nomart.value == ""){
  missinginfo += "\n     -  Nom d\'artiste";
  }

  if (objForm.var_mail.value == ""){
  missinginfo += "\n     -  Email";
  }

  if (missinginfo != "") {
  missinginfo ="______________________________\n" + "Vous n'avez pas rempli correctement:\n" + missinginfo + "\n______________________________" +  "\nRecommencez s'il vous plait!";
  alert(missinginfo);
  return false;
}

}
/******************************************/
//  ---------------------------------

function validAdhesion() {

  var obj = document.frm_adhesion;

  missinginfo = "";

  if (obj.v_nomart.value == "")     missinginfo += "\n     - Nom d\'artiste";
  if (obj.v_adresse.value == "")    missinginfo += "\n     -  Adresse";
  if (obj.v_cp.value == "")         missinginfo += "\n     -  Code postal";
  if (obj.v_ville.value == "")      missinginfo += "\n     -  Ville";
  if (obj.v_pays.value == "")       missinginfo += "\n     -  Pays";
  if (obj.v_tel.value == "")        missinginfo += "\n     -  Téléphone";
  if (obj.v_courriel.value == "")   missinginfo += "\n     -  Email";


  if (missinginfo != "") {
  missinginfo ="______________________________\n" + "Vous n'avez pas rempli correctement:\n" + missinginfo + "\n______________________________" +  "\nRecommencez s'il vous plait!";
  alert(missinginfo);
  return false;
}

}
/*******************************************/
//   ----------------------------------
// FONCTIONS DATES FR ET US
//   --------------------------------
function Jours(){
  this[0]="Dimanche"; this[1]="Lundi";
  this[2]="Mardi"; this[3]="Mercredi";
  this[4]="Jeudi"; this[5]="Vendredi";
  this[6]="Samedi";
}
//   --------------------------------
function Mois(){
  this[0]="Janvier"; this[1]="Février";
  this[2]="Mars"; this[3]="Avril";
  this[4]="Mai"; this[5]="Juin";
  this[6]="Juillet"; this[7]="Août";
  this[8]="Septembre"; this[9]="Octobre";
  this[10]="Novembre"; this[11]="Décembre";
}
//   --------------------------------
function Days(){
  this[0]="sunday"; this[1]="Monday";
  this[2]="tuesday"; this[3]="Wednesday";
  this[4]="Thursday"; this[5]="Friday";
  this[6]="Saturday";
}
//   --------------------------------
function Months() {
  this[0]="January"; this[1]="February";
  this[2]="March"; this[3]="April";
  this[4]="May"; this[5]="June";
  this[6]="July"; this[7]="August";
  this[8]="September"; this[9]="October";
  this[10]="November"; this[11]="December";
}
//   -------------------------------
function DateFr(){
  var now = new Date();
  var jour = new Jours();
  var mois=new Mois();
 // return " " + jour[now.getDay()] + " " + now.getDate() + " " + mois[now.getMonth()] + " " + now.getFullYear();
 return " " + jour[now.getDay()] + " " + now.getDate() + " " + mois[now.getMonth()]+ " " + now.getFullYear();;
}
//   -------------------------------
function DateUs(){
  var now = new Date();
  var day=new Days();
  var month=new Months();
  return " " + day[now.getDay()] + ", " + now.getDate() + " " + month[now.getMonth()] + " " + now.getFullYear();
}
//   --------------------------------
function DateNumFr(){
  var now = new Date();
  var jour = now.getDate();
  var mois = now.getMonth()+1;

  return " " + ((jour > 9) ? "" : "0") + jour + "." + ((mois > 9) ? "" : "0") + mois + "." + now.getFullYear();
}
//   ---------------------------------
function DateNumUs(){
  var now = new Date();
  var day = now.getDate();
  var month = now.getMonth()+1;
  return " " + ((month > 9) ? "" : "0") + month + "." + ((day > 9) ? "" : "0") + day + "." + now.getFullYear();
}
//   ---------------------------------
function TimeNow() {
  var now=new Date(); var hour=now.getHours(); var min=now.getMinutes(); var sec=now.getSeconds();
  return " " + ((hour > 9) ? "" : "0") + hour + ":" + ((min > 9) ? "" : "0") + min + ":" + ((sec > 9) ? "" : "0") + sec;
}
//   ---------------------------------
function FullScreen(id) {
    window.open('../../galerie/pages_galerie/PAGE_GAL_ART.phtml?id='+id,'Galerie','fullscreen,scrollbars');
}
//   ----------------------------------
function Print(){self.print();}
//   ----------------------------------
function Update_Expo() {
  alert("L'exposition est validée !");
}
//
function Update_Fiche() {
  alert("La fiche est modifiée !");
}
function Update_Cotation() {
  alert("Vos données ont bien été enregistrées. Vous pouvez le constater dans la rubrique « COTATION » sur www.drouot-cotation.org");
}
function Update_Galerie() {
  alert("La Nouvelle Galerie est en ligne !");
}

function Update_Galerie_Refuse() {
  alert("Attention, veuillez controler la taille et le poids de vos images !");
}

function Delete_Expo() {
  alert("Nous vous confirmons la suppression de votre exposition !");
}
//
//------------------------------------

function validEXPO() {

  var objForm = document.frmEXPO;

  missinginfo = "";





  if (objForm.EXPOTITRE.value == ""){
  missinginfo += "\n     -  l'Intitulé de l'exposition";
  }
  if (objForm.EXPOVILLE.value == ""){
  missinginfo += "\n     -  la ville de l'exposition";
  }
  if (missinginfo != "") {
      missinginfo ="______________________________\n" + "Vous n'avez pas rempli correctement:\n" + missinginfo + "\n______________________________" +  "\n@copyright DROUOT 2004";
      alert(missinginfo);
      return false;
  }
   if ( (objForm.RAD[4].checked) && (objForm.PAYS05.value == "157") && (objForm.DEPARTEMENT.value == "00")){
       alert("Attention, veuillez sélectionnez un département !");
       return false;
  }

}
