function validRequest() {
	valid=true;
    var u = document.theForm.u.value;
	var agedeb = document.theForm.agedeb.value;
	var agefin = document.theForm.agefin.value;

	if(valid)
	if(parseInt(agedeb) > parseInt(agefin)) {
		alert('L\'age de debut ne peut etre superieur a l\'age de fin');
		document.theForm.agedeb.focus();
		valid=false;
	}


	if(valid)
	if(document.theForm.lieu.value == '') {
		alert('Veuillez selectionner le lieu de rencontre');
		document.theForm.lieu.focus();
		valid=false;
	}



	if(!document.theForm.choix.value) {
	    document.theForm.choix.value = '';
	}

	if(valid) {
		var url = '/Search/Profil/u/'+u+'/ageDebut/'+agedeb+'/ageFin/'+agefin+'/recherche/'+document.theForm.recherche.value+'/sexe/'+document.theForm.sexe.value+'/type/'+document.theForm.choix.value+'/lieu/'+document.theForm.lieu.value+'/';
		window.location=url;
	}
}

function fieldUpdate(obj) {
	var nom=obj.name;
	if(document.theForm) document.theForm.elements[nom].value=obj.value;
	if(document.theForm2) document.theForm2.elements[nom].value=obj.value;
}



function validateForm() {
	valid=true;

    //var u = document.theForm.u.value;
	var agedeb = document.theForm.agedeb.value;
	var agefin = document.theForm.agefin.value;
	var sexe = document.theForm.sexe.value;

	if(document.theForm.pseudo.value != '') {
		var uri='Pseudo/'+document.theForm.pseudo.value;
	} else {

		if(valid)
			if(agedeb > agefin) {
				alert('L\'age de debut ne peut etre superieur a l\'age de fin');
				document.theForm.agedeb.focus();
				valid=false;
			}

	    var uri=/*'u/'+u+*/'ageDebut/'+agedeb+'/ageFin/'+agefin+'/sexe/'+document.theForm.sexe.value+'/fournisseur/'+document.theForm.fournisseur.value/*+'/type/'+document.theForm.type.value+'/lieu/'+document.theForm.lieu.value*/+'/statut/'+document.theForm.statut.value;
	}

	if(valid) {
		var url = '/Admin/Search/Profil/Submit/1/'+uri;
		window.location=url;
	}
}


function clearPseudo() {
	document.theForm.pseudo.value='';
}



function getData(monChamp) {
	var valeur = monChamp.options[monChamp.selectedIndex].value;
	if(valeur != 0) {
		var texte = monChamp.options[monChamp.selectedIndex].text;
		if(monChamp.name=='lieuDrop') {
			document.theForm.lieu.value=texte;
		}
		//else if (monChamp.name=='typeDrop') {
			//document.theForm.type.value=texte;
		//}
	}
}



function initializeChamp(lieu,type) {
	for(i=0; i<document.theForm.typeDrop.length; i++) {
		if(lieu == document.theForm.typeDrop.options[i].value) {
			document.theForm.type.value=document.theForm.typeDrop.options[i].text;
		}
	}

	for(i=0; i<document.theForm.lieuDrop.length; i++) {
		if(lieu == document.theForm.lieuDrop.options[i].value) {
			document.theForm.lieu.value=document.theForm.lieuDrop.options[i].text;
		}
	}
}


function viewUrl() {
	uri = document.theForm.destination.value;
	window.open(uri);
}


function viewImage() {
	document.getElementById("imageprofil").innerHTML = '<img src="'+document.theForm.photo.value+'" height="100" widht="100">';
}


function deleteProfil() {
	if (confirm("Etes vous certain de vouloir supprimer ce profil ?")) {
		document.theForm2.submit();
	} else {
		return false
	}
}


function validSaved() {
	valid=true;

	if(valid)
	if(document.theForm.pseudo.value == '') {
		alert('Veuillez indiquer le pseudo');
		document.theForm.pseudo.focus();
		valid=false;
	}

	//if(valid)
	//if(document.theForm.lieu.value == '') {
		//alert('Veuillez selectionner le lieu de rencontre');
		//document.theForm.lieu.focus();
		//valid=false;
	//}


	//if(valid)
	//if(document.theForm.type.value == '') {
		//alert('Veuillez selectionner le type de rencontre');
		//document.theForm.type.focus();
		//valid=false;
	//}


	if(valid) {
		document.theForm.submit();
	}
}


function backUrl() {
	location.href=document.referrer;
}

function addFav()
{
if (document.all)
{
window.external.AddFavorite(location.href, document.title);
}
else
{
alert('Vous pouvez faire CTRL + D pour ajouter cette page dans vos signets, ou favoris.')
}
}