
/*$(document).ready(function()
{
	$("#myformDpt").change(function()
	{
	var value = $(this).val();
	if (value =='0')
		{
		$("#divdynville").hide();	
		$("#divville").show();	
		} else {
		$("#divdynville").show();	
		$("#divville").hide();	
		}
	});
});

$(document).ready(function()
{
	$("#myformDpt").init(function()
	{
	var value = $(this).val();
	if (value =='')
		{
		$("#divville").show();	
		$("#divdynville").hide();	
		}
	});
});
*/
function update_dpt(dpt) {
	document.forms['myform'].elements['dpt'].value = dpt;
	var dataString = 'id='+ dpt;
	//alert(dataString);
	$.ajax
		({
		type: "GET",
		url: "http://hamanad.net/mco/villes.php",
		data: dataString,
		cache: false,
		success: function(html)
			{

	//alert(dataString);
	//alert(html);

			$("#dynville").html(html);
			}
		});
/*function update_dpt(dpt,dynville) {
	document.forms['myform'].elements['dpt'].value = dpt;
	//document.forms['myform'].elements['dynville'].value = dynville;
	var dataString = 'id='+ dpt + '&dynville=' + dynville;
	alert(dataString);
	$.ajax
		({
		type: "GET",
		url: "http://hamanad.net/mco/villes.php",
		data: dataString,
		cache: false,
		success: function(html)
			{

	//alert(dataString);
	//alert(html);

			$("#dynville").html(html);
			}
		}); */

/*if (document.forms['myform'].elements['dpt'].value =='0')
	{
	//	alert('vide');
	$("#divdynville").hide();	
	$("#divville").show();	
	} else {
	//	alert('plein');
	$("#divdynville").show();	
	$("#divville").hide();	
	} */
}

function chirurgie() {
//	alert('ok');
if ($('#chir:checked').val() == '1') {	       
$('input[name=med]').attr('checked', false);
$('input[name=obst]').attr('checked', false);
$('input[name=conv]').attr('checked', false);
$('input[name=psy]').attr('checked', false);
$("#medecine").html('');
$('#med_spec').val() == '';  
$("#obstetrique").html('');
$('#med_obst').val() == '';  
	$.ajax
		({
		url: "http://hamanad.net/mco/chirurgie.php",
		cache: false,
		success: function(html)
			{
			$("#chirurgie").html(html);
			}
		});
} else {
			$("#chirurgie").html('');

}
}

function medecine() {
//	alert('ok');
if ($('#med:checked').val() == '1') {	   
$('input[name=chir]').attr('checked', false);
$('input[name=obst]').attr('checked', false);
$('input[name=conv]').attr('checked', false);
$('input[name=psy]').attr('checked', false);	
$("#chirurgie").html('');
$('#med_chir').val() == '';  
$("#obstetrique").html('');
$('#med_obst').val() == '';  
	$.ajax({
		url: "http://hamanad.net/mco/medecine.php",
		cache: false,
		success: function(html)
			{ $("#medecine").html(html);}
		});
	} else {$("#medecine").html('');}
}

function obstetrique() {
//	alert('ok');
if ($('#obst:checked').val() == '1') {	 
$('input[name=chir]').attr('checked', false);
$('input[name=med]').attr('checked', false);
$('input[name=conv]').attr('checked', false);
$('input[name=psy]').attr('checked', false);
$('#med_chir').val() == '';  
$("#chirurgie").html('');
$('#med_spec').val() == '';  
$("#medecine").html('');

	$.ajax({
		url: "http://hamanad.net/mco/obstetrique.php",
		cache: false,
		success: function(html)
			{ $("#obstetrique").html(html);}
		});
	} else {$("#obstetrique").html('');}
}

function convalescence() {
if ($('#conv:checked').val() == '1') {	 
$('input[name=chir]').attr('checked', false);
$('input[name=med]').attr('checked', false);
$('input[name=obst]').attr('checked', false);
$('input[name=med]').attr('checked', false);
$('input[name=psy]').attr('checked', false);
$("#medecine").html('');
$('#med_spec').val() == '';  
$("#obstetrique").html('');
$('#med_obst').val() == '';  
$('#med_chir').val() == '';  
$("#chirurgie").html('');
}
}
function psychiatrie() {
if ($('#psy:checked').val() == '1') {	 
$('input[name=chir]').attr('checked', false);
$('input[name=med]').attr('checked', false);
$('input[name=obst]').attr('checked', false);
$('input[name=med]').attr('checked', false);
$('input[name=conv]').attr('checked', false);
$("#medecine").html('');
$('#med_spec').val() == '';  
$("#obstetrique").html('');
$('#med_obst').val() == '';  
$('#med_chir').val() == '';  
$("#chirurgie").html('');
}
}
function update_liste() {
	//alert(document.forms['myform'].elements['dpt'].value);
	//document.forms['myform'].elements['dpt'].value = dpt;
	var dataString = 'id='+ document.forms['myform'].elements['dpt'].value;
	//alert(dataString);

	$.ajax
		({
		type: "GET",
		url: "villes.php",
		data: dataString,
		cache: false,
		success: function(html)
			{
	//alert(html);

			$("#dynville").html(html);
			}
		});
/*	if (document.forms['myform'].elements['dpt'].value =='0')
	{
	//	alert('vide');
	$("#divdynville").hide();	
	$("#divville").show();	
	} 
	else 
		{
	//	alert('plein');
	$("#divdynville").show();	
	$("#divville").hide();	
	} */
}
   function setupLabel() {
        if ($('.label_check input').length) {
            $('.label_check').each(function(){ 
                $(this).removeClass('c_on');
            });
            $('.label_check input:checked').each(function(){ 
                $(this).parent('label').addClass('c_on');
            });                
        };
        if ($('.label_radio input').length) {
            $('.label_radio').each(function(){ 
                $(this).removeClass('r_on');
            });
            $('.label_radio input:checked').each(function(){ 
                $(this).parent('label').addClass('r_on');
            });
        };
    };
    $(document).ready(function(){
        $('body').addClass('has-js');
        $('.label_check, .label_radio').click(function(){
            setupLabel();
        });
        setupLabel(); 
    });

$(document).ready(function()
{
			$( "#opengirette" )
			.click(function() {
				$( "#girette" ).dialog( "open" );
			});
	    });





function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toUTCString());
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}

function checkCookie()
{
lang=getCookie('lang');
}
function setfr()
{
setCookie('lang','fr',365);
}
function seten()
{
setCookie('lang','en',365);
}
function affiche_popup(nom_de_la_page, nom_interne_de_la_fenetre)
{
window.open (nom_de_la_page, nom_interne_de_la_fenetre, config='height=500, width=500, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no')
}
