// Utilitaires WebHotel
// Gestion des Opup Visite et Tarif

// Gestion des popup visite ouverts
tab_visit=new Array();
tab_visit[0]= new Array();
tab_visit[1]= new Array();

// Ouverture Popup Visite
function pop_visit(url_win,name,largeur,hauteur){

	win_param=',scrollbars,resizable,toolbar';

	// Position et Dimensions (marge 50 sans toolbar, 100 avec toolbar)
	tool_h=50;
	marge_h=50;
	if(win_param.indexOf('toolbar')>=0)		marge_h+=tool_h;

	if((window.screen.height - hauteur)<marge_h){	/* saturation + visibilite barre de tache	*/
		win_h=window.screen.height-marge_h;
		win_top=0;
	}else{
		win_h=hauteur;
		win_top=(window.screen.height - win_h)/2-tool_h;
	}

	if((window.screen.width - largeur)< 50 ){	/* saturation 	*/
		win_w=window.screen.width - 50;
	}else{
		win_w=largeur;
	}
	win_left=(window.screen.width - win_w)/2;

	win_param='width='+win_w+',height='+win_h+',top='+win_top+',left='+win_left+win_param;
	win_id=window.open(url_win,name,win_param); 

	return(win_id);
}


// Gestion des Popup Visite
function open_visit(url_cust){

	nb_visit=tab_visit[0].length;
	indice=-1;

	for(i=0;i<nb_visit;i++){
		if(url_cust.indexOf(tab_visit[0][i])>=0){
			if(tab_visit[1][i].closed == false)	tab_visit[1][i].focus();
			else{
				win_id=pop_visit(url_cust,('CORSEWEB_'+nb_visit),800,600);
				tab_visit[1][i]=win_id;
			}
			indice=i;
			break;
		}
	}

	if(indice<0){	/* Nouvelle fenetre	*/
		nb_visit++;
		win_nb='CORSEWEB_'+nb_visit;
		win_id=pop_visit(url_cust,('CORSEWEB_'+nb_visit),800,600);
		tab_visit[0][nb_visit-1]=url_cust;
		tab_visit[1][nb_visit-1]=win_id;
		indice=nb_visit-1;
	}
}


// Ouverture Popup Tarifs
function pop_tarif(url_win,name,largeur,hauteur){

	win_param=',scrollbars,resizable';
	win_top=(window.screen.height - hauteur)/2;
	win_left=(window.screen.width - largeur)/2;
	win_param='width='+largeur+',height='+hauteur+',top='+win_top+',left='+win_left+win_param;
	window.open(url_win,name,win_param); 

	
}

// Inhibition ALL Region et Accomodation Simultane
// Formulaire CHG_DATA
// Fonction utilise dans Recerche Disponibilites
function testAll(name){
	ind_reg=document.CHG_DATA.Region.selectedIndex;
	ind_acc=document.CHG_DATA.Accomodation.selectedIndex;
	if(!ind_reg && !ind_acc){
		if(name.indexOf('Region')>=0){
			document.CHG_DATA.Accomodation.selectedIndex=1;
		}else{
			document.CHG_DATA.Region.selectedIndex=1;
		}

/**
		alert("Reg="+ind_reg+" Acc="+ind_acc);
**/
	}
}


