// JavaScript Document
function jsOpenWindow(url,w,h) {

	var nx = (screen.Width / 2) - (w / 2);
	var ny = (screen.Height / 2) - (h / 2);

	var w = window.open(url,'win','width=' + w + ',height=' + h + ',left=' + nx + ',top=' + ny + ',resizable=yes');
}


//=======================================================================
// Preload Images and RollOver
//=======================================================================


var sActHref = window.location.href;
var sLng = sActHref.substr(sActHref.indexOf(".com/") + 5, 2);


//=======================================================================
// Preload Images and RollOver
//=======================================================================

var preloadFlag = false;


function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}


function changeImages() {
	if (document.images) {
    	for (var i=0; i<changeImages.arguments.length; i+=2) {
    		document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
    	}
    }
}


function preloadImages() {
	if (document.images) {
		btn_mainMenu_1 = newImage("/" + sLng + "/images/wi_menu_over_03.jpg");
		btn_mainMenu_2 = newImage("/" + sLng + "/images/wi_menu_over_05.jpg");
		btn_mainMenu_3 = newImage("/" + sLng + "/images/wi_menu_over_06.jpg");
		btn_mainMenu_4 = newImage("/" + sLng + "/images/wi_menu_over_07.jpg");
		btn_mainMenu_5 = newImage("/" + sLng + "/images/wi_menu_over_08.jpg");
		btn_mainMenu_6 = newImage("/" + sLng + "/images/wi_menu_over_09.jpg");
		
		btn_mainMenu_7 = newImage("/images/wi_index_02.jpg");
		btn_mainMenu_8 = newImage("/images/wi_index_03.jpg");
		btn_mainMenu_9 = newImage("/images/wi_index_04.jpg");
		btn_mainMenu_10 = newImage("/images/wi_index_05.jpg");
		btn_mainMenu_11 = newImage("/images/wi_index_06.jpg");
		btn_mainMenu_12 = newImage("/images/wi_index_07.jpg");

		preloadFlag = true;
	}
}

preloadImages();




//=======================================================================
// fonction open window
//=======================================================================


function jsOpenNewWin(url,w,h) {

	var w = window.open(url,"win","width=" + w + ",height=" + h + ",top=100,left=100,scrollbars=yes");
}

function jsOpenWindow(url,w,h) {
	var nx = (screen.Width / 2) - (w / 2);
	var ny = (screen.Height / 2) - (h / 2);

	var w = window.open(url,'win','width=' + w + ',height=' + h + ',left=' + nx + ',top=' + ny + ',resizable=yes');
}

function jsOpenWinReponseTEX(questionID) {

	var w = window.open("/extranet/sondage/resultats_reponsesTEX.asp?questionID=" + questionID  + "","win","width=300,height=400,top=100,left=100,scrollbars=yes,resizable=yes");
}

//=======================================================================
// fonction close window
//=======================================================================

function closeWindow() {
		     window.close();
    }     


//=======================================================================
//affichage de la progression de telechargement
//=======================================================================
function ShowProgress()
{
  strAppVersion = navigator.appVersion;
  if (document.frmupload.file1.value != "") {
    if (strAppVersion.indexOf('MSIE') != -1 && strAppVersion.substr(strAppVersion.indexOf('MSIE')+5,1) > 4) {
      winstyle = "dialogWidth=385px; dialogHeight:140px; center:yes";
      window.showModelessDialog('<%=barref%>&b=IE',null,winstyle);
    }
    else {
      window.open('<%=barref%>&b=NN','','width=370,height=115', true);
    }
  }
  
  return true;
}

/////////////////////////validation des champs asp grid flashHOme
function ValidateAspGrid()
{                    
                      
// validation : le champs ne dois pas etre vide
  if( document.AspGridFormSave1.FIELD2.value == "" )
  { 
    alert('The field Title fr is empty' );
    document.AspGridFormSave1.FIELD2.focus();
    return false;
  }
  // validation : le champs ne dois pas etre vide
  if( document.AspGridFormSave1.FIELD3.value == "")
  {
    alert('The field Title 2 fr is empty' );
    document.AspGridFormSave1.FIELD3.focus();
    return false;
  }
  // validation : le champs ne dois pas etre vide
  if( document.AspGridFormSave1.FIELD4.value == "" )
  {
    alert('The field Description fr is empty' );
    document.AspGridFormSave1.FIELD4.focus();
    return false;
  }
  // validation : le champs ne dois pas etre vide
  if( document.AspGridFormSave1.FIELD6.value == "" )
  {
    alert('The field Title En is empty' );
    document.AspGridFormSave1.FIELD6.focus();
    return false;
  }
   // validation : le champs ne dois pas etre vide
  if( document.AspGridFormSave1.FIELD7.value == "" )
  {
    alert('The field Title 2 En is empty' );
    document.AspGridFormSave1.FIELD7.focus();
    return false;
  }
   // validation : le champs ne dois pas etre vide
  if( document.AspGridFormSave1.FIELD8.value == "" )
  {
    alert('The field Description En is empty' );
    document.AspGridFormSave1.FIELD8.focus();
    return false;
  }
   
  
  //si description est trop longue
  if (document.AspGridFormSave1.FIELD4.value.length > 100)
  {
    alert('Description FR is too long');
    return false
  }
   if (document.AspGridFormSave1.FIELD8.value.length > 100)
  {
    alert('Description EN is too long');
    return false
  }
    // -->
    
    //si le lien est trop long
      if (document.AspGridFormSave1.FIELD10.value.length > 500)
  {
    alert('Le lien Fr  est trop long');
    return false
  }
       if (document.AspGridFormSave1.FIELD11.value.length > 500)
  {
    alert('Le lien EN  est trop long');
    return false
  }
  
  return true;
}
////////////////////////////////////////


