function openurl(htmlurl,nom) {
	width = 780;
	leftf =(screen.width-width)/2;
	height = 502;
	topf  = (screen.height-height)/2;

	nom = nom.replace(/\s/g,"");
	var riwindow = window.open(htmlurl,nom,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width= '+width+',height='+height+',left='+leftf+',top='+topf);
	if (riwindow){
		riwindow.focus();
	}
}

function change_categorie(id_fam)
{
	new Ajax.Request('/ajax.php',
	{
		method: 'post',
		parameters: 'id_fam='+id_fam,
		onSuccess: function(ajax)
		{
			$('categorie').update(ajax.responseText);
		}
	});
}

function nb_employer(val)
{
	new Ajax.Request('/ajax_cont.php',
	{
		method: 'post',
		parameters: 'val='+val,
		onSuccess: function(ajax)
		{
			$('nombre_em').update(ajax.responseText);
		}
	});
}

function affCom()
{
	var com = document.getElementById('write_comment');
	if(com.style.display == "block") com.style.display = "none";
	else com.style.display = "block";
}

function change_vign_next(tab,i)
{
	var nbtab = tab.length;

	var vignette = 'vign_sup_'+tab[i];
	var obj = document.getElementById(vignette).style.display = 'block';
	
	if (i-1 == 0)
	{
		tot = nbtab-1;
	}
	//var vignette = 'vign_sup_'+tab[tot];
	
	var vignette = 'vign_sup_'+tab[i-1];
	var obj = document.getElementById(vignette).style.display = 'none';
	
	new Ajax.Request('/ajax.php',
	{
		method: 'post',
		parameters: 'val_sup='+i+'&tab='+nbtab,
		onSuccess: function(ajax)
		{
			$('btn_next').update(ajax.responseText);
		}
	});
	//alert(i);
}

function change_vign_prev(tab,i)
{
	var nbtab = tab.length;

	var vignette = 'vign_sup_'+tab[i];
	var obj = document.getElementById(vignette).style.display = 'block';
	
	if (i-1 == 0)
	{
		tot = nbtab-1;
	}
	//var vignette = 'vign_sup_'+tab[tot];
	var vignette = 'vign_sup_'+tab[i-1];
	var obj = document.getElementById(vignette).style.display = 'none';
	
	new Ajax.Request('/ajax.php',
	{
		method: 'post',
		parameters: 'val_inf='+i+'&tab='+nbtab,
		onSuccess: function(ajax)
		{
			$('btn_prev').update(ajax.responseText);
		}
	});
	//alert(i);
}
function wait_month()
{
	$('load_calendar').update("&nbsp;<div class=\"load_cal\"><img src=\"images/ajax_item.gif\" alt=\"Patientez\" /><br /><b>Chargement...</b></div>");
}

function show_month(hor, time, time2, time3, month)
{
	// setTimeout("wait_month()",1000);
	$('load_calendar').update("&nbsp;<div class=\"load_cal\"><img src=\"/images/ajax_item.gif\" alt=\"Patientez\" /><br /><b>Chargement...</b></div>");
	new Ajax.Request('/ajax_calendar.php',
	{
		method: 'post',
		parameters: 'hor='+hor+'&time='+time+'&time2='+time2+'&time3='+time3+'&month='+month,
		onSuccess: function(ajax)
		{
			$('show_calendar').update(ajax.responseText);
		}
	});
}

function seance_select(datetime)
{
	// alert(datetime);
	$('idseance').update("&nbsp;<img src=\"/images/ajax_item.gif\" alt=\"Patientez\" /> patientez");
	new Ajax.Request('/ajax_calendar.php',
	{
		method: 'post',
		parameters: 'datetime='+datetime,
		onSuccess: function(ajax)
		{
			$('idseance').update(ajax.responseText);
			$('calendar_ver').update('<input type="hidden" name="calendar_verif" id="calendar_verif" value="" />');
			$('valid_box').update('<input class="button" src="/images/btn-reserver-tkt.gif" alt="Réserver" id="valider" type="image" />');
		}
	});
}

function fermerpopupcmd()
{
	var com = document.getElementById('bloccmd');
	com.style.display = "none";
}

function myaccount()
{
	var com = document.getElementById('over_login');
	com.style.display = "block";
}
function closemyaccount()
{
	var com = document.getElementById('over_login');
	com.style.display = "none";
}

function condition_vt()
{
	var com = document.getElementById('vt');
	if (com.checked == false )
	{
		alert('Vous Devez accepter les conditions générales de vente'); 
		return false;
	}
}


function affliv()
{
	var com = document.getElementById('bloc_liv');
	if(com.style.display == "block")
	{
		com.style.display = "none";
	}
	else
	{
		com.style.display = "block";
	}
}

function paycheque()
{
	document.getElementById('pay_cheque').style.display = "block";
	// alert(document.getElementById('cheque').checked);
	pay = 'cheque';
	$('pay_cheque').update("<img src=\"images/ajax_item.gif\" alt=\"Patientez\" />");
	new Ajax.Request('/ajax.php',
	{
		method: 'post', parameters: 'pay='+pay, onSuccess: function(ajax)
		{
			$('pay_cheque').update(ajax.responseText);
			$('id_pay').update('<input class="button" onclick="form_pay.action=\'paiement.php\'" src="/images/btn-valider.gif" alt="Valider" id="valider" type="image" />');
			document.getElementById('pay_cb').style.display = "none";
		}
	});
}

function paycb()
{
	document.getElementById('pay_cb').style.display = "block";
	pay = 'cb';
	$('pay_cb').update("<img src=\"images/ajax_item.gif\" alt=\"Patientez\" />");
	new Ajax.Request('/ajax.php',
	{
		method: 'post', parameters: 'pay='+pay, onSuccess: function(ajax)
		{
			$('pay_cb').update(ajax.responseText);
			$('id_pay').update('<input class="button" onclick="form_pay.action=\'http://www.cote-scene.com/paiement/cgi-bin/call_request.php\'" src="/images/btn-valider.gif" alt="Valider" id="valider" type="image" />');
			document.getElementById('pay_cheque').style.display = "none";
		}
	});
}

function type_part(id_part)
{
		$('denom').update("<img src=\"images/ajax_item.gif\" alt=\"Patientez\" />");
		new Ajax.Request('/ajax.php',
		{
			method: 'post', parameters: 'idpart='+id_part, onSuccess: function(ajax)
			{
				$('denom').update(ajax.responseText);
			}
		});
}

function redirect_ticketnet(id, url)
{
	window.open('/ticket-on-line.php?id='+id);
}


function shine_star(id)
{
	for (i=0; i<=id; i++)
	{ 
		document.getElementById('star_'+i).src='/src/icons/silk/star.png';
	}
	for (i=id+1; i<=4; i++)
	{
		document.getElementById('star_'+i).src='http://www.cote-scene.com/images/star_grey.png';
	}
}

