
function popCond(){

	window.open('http://media.purflirt.com/conditions-purflirt.txt');

}	



function telePur_OLD(){

	 var url = 'http://download.purflirt.com/44435/purflirt_purflirt/PurFlirt.exe';

	 

	 if(confirm('Voulez-vous télécharger PurFlirt?')){

		top.location = url;

		return false;

	 }

}



var regionTypeChanged = false;



function cngRegion(type,value){

	if(typeof type == 'undefined' || typeof value == 'undefined') return false;

	if(!type || !value) return false;

	

	//hide selects recursively

	if(type == 'country'){

		Element.hide('new_departement_row');

		Element.hide('new_region_row');

		Element.hide('new_villes_row');

	}

	else if(type == 'departement'){

		Element.hide('new_region_row');

		Element.hide('new_villes_row');

	}

	else if(type == 'region'){

		Element.hide('new_villes_row');

	}

	

	regionTypeChanged = type;

	

	//call Ajax

	var url = "";

	var params = "action=cngRegion&type="+type+"&value="+escape(value);

	var myAjax = new Ajax.Request(

			url,

			{

				method :"get",

				parameters : params,

				onComplete: cngRegion_showResponse

			}

		);

}





function cngRegion_showResponse(request){

	var items = Array();

	eval("var items = " + request.responseText);

	

	//build the type's select

	if(regionTypeChanged){

		var theSelect = null;

		//select from type

		if(regionTypeChanged == 'country'){

			theSelect = document.getElementById('new_departement');

			theRow = document.getElementById('new_departement_row');

		}

		else if(regionTypeChanged == 'departement'){

			theSelect = document.getElementById('new_region');

			theRow = document.getElementById('new_region_row');

		}

		else if(regionTypeChanged == 'region'){

			theSelect = document.getElementById('new_villes');

			theRow = document.getElementById('new_villes_row');

		}

		else{

			return false;

		}

		

		//build options

		try{

		theSelect.options.length = 1;

		for(var i=0; i < items.length; i++){

			theSelect.options[theSelect.options.length] = new Option(items[i].name,items[i].key);

		}

		}catch(e){

			//alert('error: ' + e);

		}

		

		//show the select if it has some items in it

		if(theSelect.options.length > 1){

			theRow.style.visibility = 'visible';

			Element.show(theRow.id);

		}

		

	}

	

}







//init

Element.hide('new_departement_row');

Element.hide('new_region_row');

Element.hide('new_villes_row');


function rechercher_effect(){
	try{
		new Effect.DropOut(document.getElementById('anim1'), {duration:0.4});
	}catch(e){
		document.getElementById('anim1').style.display='none';
	};
	try{
		new Effect.SlideDown(document.getElementById('anim2'), {duration:0.3});
	}catch(e){};
	try{
		new Effect.Fade(document.getElementById('anim2'), {duration:2});
	}catch(e){
		window.setTimeout("document.getElementById('anim2').style.display='none'",2000);
	};
	window.setTimeout("tryEffectAppear()",2000);
}

function tryEffectAppear(){
	try{
		//Effect.Appear('anim3');
		document.getElementById('anim3').style.display='block';
		make_effect('anim3',0,'show');
	}catch(e){};
}


function make_effect(obj_id,opacity,action){
	setOpacity(obj_id,opacity);
	if(action == 'show') opacity++;
	else opacity--;//hide
	if(opacity > 0 && opacity <= 10){
		setTimeout('make_effect("'+obj_id+'",'+opacity+',"'+action+'")',100);
	}
	else if(action == 'hide'){
		Element.removeClassName(obj_id, 'yellow_row');
		make_effect(obj_id,0,'show');
	}
}

function setOpacity(obj_id,value) {
	obj = document.getElementById(obj_id);
	obj.style.opacity = value/10;
	obj.style.filter = 'alpha(opacity=' + value*10 + ')';
}	
