
// roster
sent=false;
genrs=new Array();
function genrsinit(){
	for(i=0;i<document.filtre.f_genres.options.length; i++) {
		genrs[i]=document.filtre.f_genres.options[i].selected;
	}
}
function addgenrs(){
	if(document.filtre.f_genres.selectedIndex==0) genrsinit();
	else genrs[0] = false;
	if(genrs[document.filtre.f_genres.selectedIndex] && document.filtre.f_genres.selectedIndex!=0)genrs[document.filtre.f_genres.selectedIndex] = false;
	else genrs[document.filtre.f_genres.selectedIndex] = true;
	for(i=0;i<document.filtre.f_genres.options.length; i++) {
		document.filtre.f_genres.options[i].selected=genrs[i];
		//alert(a[i]);
	}
}
thems=new Array();
function themsinit(){
	for(i=0;i<document.filtre.f_themes.options.length; i++) {
		thems[i]=document.filtre.f_themes.options[i].selected;
	}
}
function addthems(){
	if(document.filtre.f_themes.selectedIndex==0) themsinit();
	else thems[0] = false;
	if(thems[document.filtre.f_themes.selectedIndex] && document.filtre.f_themes.selectedIndex!=0)thems[document.filtre.f_themes.selectedIndex] = false;
	else thems[document.filtre.f_themes.selectedIndex] = true;
	for(i=0;i<document.filtre.f_themes.options.length; i++) {
		document.filtre.f_themes.options[i].selected=thems[i];
		//alert(a[i]);
	}
}
temps=new Array();
function tempsinit(){
	for(i=0;i<document.filtre.f_tempos.options.length; i++) {
		temps[i]=document.filtre.f_tempos.options[i].selected;
	}
}
function addtemps(){
	if(document.filtre.f_tempos.selectedIndex==0) tempsinit();
	else temps[0] = false;
	if(temps[document.filtre.f_tempos.selectedIndex] && document.filtre.f_tempos.selectedIndex!=0)temps[document.filtre.f_tempos.selectedIndex] = false;
	else temps[document.filtre.f_tempos.selectedIndex] = true;
	for(i=0;i<document.filtre.f_tempos.options.length; i++) {
		document.filtre.f_tempos.options[i].selected=temps[i];
		//alert(a[i]);
	}
}
function send(){ //roster search
	if(!sent){
	sent=true;
	document.filtre.f_themes.name+="[]";
	document.filtre.f_genres.name+="[]";
	document.filtre.f_tempos.name+="[]";
	}
	//document.atts.submit();
}
//------
function az_extend(){
	az.style.height=300;	
}
function az_retract(){
	az.style.height=145;
}
function swap(){
//alert("zz");
	var _y = document.getElementById('clone');
	//var _x = window.frames[0].document.body.innerHTML;
	var _x = document.getElementById('vortex').contentWindow.document.body.innerHTML;
	_y.innerHTML = _x ;
sent=false;
}
function resizit(){ 
//find the height of the internal page
  var the_height=document.getElementById('vortex').contentWindow.document.body.height;

  document.getElementById('vortex').height=10;
alert(the_height);
  //change the height of the iframe
  document.getElementById('vortex').height=the_height;
}
function loadpage(){
	page=arguments[0];
	document.formhome.page.value=page;
	if(arguments[1] != null){
		h_id = document.createElement('input');
		h_id.setAttribute('type', 'hidden');
		h_id.setAttribute('id', arguments[1]);
		h_id.setAttribute('name', arguments[1]);
		h_id.setAttribute('value', arguments[2]);
		document.formhome.appendChild(h_id);
		//alert(document.formhome.id.value);
	}
	if(arguments[3] != null){
		h_id2 = document.createElement('input');
		h_id2.setAttribute('type', 'hidden');
		h_id2.setAttribute('id', arguments[3]);
		h_id2.setAttribute('name', arguments[3]);
		h_id2.setAttribute('value', arguments[4]);
		document.formhome.appendChild(h_id2);
		//alert(document.formhome.id.value);
	}
	document.formhome.submit();
}
function changelg(lg){
document.formhome.lg.value=lg;
	if(document.formhome.act.value=="autonew")document.formhome.page.value="blank";
document.formhome.submit();
}
	az.style.height+=0;
	
//formulaire inscription

function check(e){
	document.getElementById('t_'+e.name).style.background="";
	if(e.value==''){
	document.getElementById('t_'+e.name).style.background="#ff0000";
	return 1;
	}
	return 0;
}
function checkd(e,ee){
	document.getElementById('t_'+e.name).style.background="";
	if(e.value=='' || ee.value==''){
	document.getElementById('t_'+e.name).style.background="#ff0000";
	return 1;
	}
	return 0;
}
function checkmail(e){
	document.getElementById('t_'+e.name).style.background="";
   var reg = /^[a-z0-9._-]+@[a-z0-9.-]{2,}[.][a-z]{2,3}$/;
	if(reg.exec(e.value)==null){//@
	document.getElementById('t_'+e.name).style.background="#ff0000";
	return 1;
	}
	return 0;
}
function checkall(f){
	//mess='<? echo ($lg=='FR')?'veuillez remplir correctement les champs marqués en rouge':'please fill correctly the red stroked field'; ?>';
	err=0;
	err+=check(f.loggin);
	err+=check(f.pass);
	err+=check(f.nom);
	err+=check(f.prenom);
	err+=check(f.societe);
	err+=check(f.siret);
	err+=checkmail(f.email);
	err+=check(f.postal);
	err+=checkd(f.ville,f.codep);
	err+=check(f.pays);
	err+=check(f.tel);
	if(err>0){
		scrollTo(0,0);
		alert(f.mess.value);
		//return false;
	} else f.submit(); 
		//return false;
}