// JavaScript Document

/*
function win_popup()
{
  	window.open('http://www.ville-loos.fr/spip.php?page=sondage&var_mode=recalcul','popup','width=650, height=700, scrollbars=yes, resizable=1');
}
*/

function cache(calque)
{
  document.getElementById(calque).style.visibility='hidden';
  document.getElementById(calque).style.display='none';
}
function affich(calque)
{
  document.getElementById(calque).style.visibility='visible';
  document.getElementById(calque).style.display='block';
}

function favori(phrase,lien)
{
   if (window.sidebar)
   {
   window.sidebar.addPanel(phrase, lien,"");
   }
   else if( document.all )
   {
   window.external.AddFavorite(lien, phrase);
   }
   else
        {
   return true;
   }
}

function getOptions(el) {
    options = el.options;
    var optList = new Array();
    for (i=0; i<options.length; i++) {
        opt = options[i];
        optList[i]={key: opt.value, value: opt.text};
    }
    return optList;
}

function setOptions(el, optList, add) {
    options = el.options;
    if (!add) {
        options.length = 0;
    }
    for (i=0; i<optList.length; i++) {
        options[i] = new Option(optList[i].value, optList[i].key);
    }
            
}

function showTheme(id) {
    sourceSelect = document.getElementById('flag_' + id);
    destSelect = document.getElementById('bloc_select');
    setOptions(destSelect, getOptions(sourceSelect), false);
}

function submitform() {
    	if  (document.sub_form.email_addr.value=='')
  			alert("Cette adresse électronique n'est pas valide");
		else {
  				if ( ((document.sub_form.email_addr.value.indexOf('@',1))==-1)||(document.sub_form.email_addr.value.indexOf('.',1))==-1 )
  					alert("Cette adresse électronique n'est pas valide");

  				else {
            window.open("", "formPopup", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,height=200,width=500,toolbar=no", true); 
            document.sub_form.target='formPopup';
  					document.sub_form.submit();
                                      }
  		}
  }



  
  
  
  
  	
