/*Verification de saisie*/
/*----------------------*/
function Verif_Site(site)
{
	var reg = /^[a-z0-9.-]{2,}[.][a-z0-9.-]{2,}[.][a-z]{2,3}[\w\S]*$/
	if((Value_Elt(site) != "") && (Value_Elt(site).search(reg) == -1))
		{
		alert("L'adresse du site n'est pas une adresse valide.");
		Elt(site).focus();
		return false;
		}
	else return true;
}
	
function Verif_Mail(mail)
{
	var reg = /^[a-z0-9._-]+@[a-z0-9.-]{2,}[.][a-z]{2,3}$/
	if((Value_Elt(mail) != "") && (Value_Elt(mail).search(reg) == -1))
	{
		alert("L'adresse mail n'est pas une adresse valide.");
		Elt(mail).focus();
		return false;
	}
	else return true;
}

function Verif_Taille(element,taille,message)
{
	if(Length_Elt(element) > taille)
	{
		alert(message + " ne doit pas dépasser " + taille + " caractères.");
		Elt(element).focus;
		return false;
	}
	else return true;
}

function Saisie_Obligatoire(element,message)
{
	if(Value_Elt(element) == "")
	{
		alert("Vous devez saisir " + message + ".");
		Elt(element).focus;
		return false;
	}
	else return true;
}

/*Controle d'ouverture des pages dans les frames*/
/*----------------------------------------------*/
function Verif_Frames(page)
{
	if (parent.frames.length < 1)
	{
		document.location.href = 'http://nives/milieu.asp?page=' + page;
	}
}

/*Valeur d'un element du document*/
/*Pour eviter de marquer à chaque fois document.getElementById('truc').value*/
function Value_Elt(element)
{
	return Elt(element).value;
}

function Elt(element)
{
	return document.getElementById(element);
}

function Length_Elt(element)
{
	return Elt(element).value.length;
}

// afficher les titres
function afftitre(tit) 
  {
	
  if (document.getElementById)
    {
    parent.frames['bandeau'].document.getElementById("titpage").innerHTML = tit;
    }
  else if (document.all) 
    {
    parent.frames['bandeau'].document.all["titpage"].innerHTML = tit;
    }
  }	
//Fenetre de telechargement de documentation
function telecharge(fichier)
{
	download= window.open(fichier,"telechargement","resizable=yes,width=660,height=500,status=no,toolbar=no,menubar=no,scrollbars=yes,left=20,top=10");
	download.focus();
}

function grandephoto(cheminOutils,image,leg,cred)
{ 
	grphoto= window.open(cheminOutils + "OuvreImage.asp?img="+image+"&legende="+leg+"&credit="+cred,"photo","width=700, height=500 ,status=no,toolbar=no,menubar=no,scrollbars=no,left=20,top=20,resizable=no"); 
	grphoto.focus();
}


function PlayerOpen(title,soundfilepath,type) {
		var width = 340;
		var height = 260;
		if(type != 'video') {
			width = 320;
			height =  50;
		}
		PlayWin = window.open('/outils/pop_media.asp?titre='+title+'&src='+soundfilepath+'&type='+type,title,'width='+width+',height='+height+',top=200,left=200,left=0,resizable=0,scrollbars=0,titlebar=0,toolbar=0,menubar=0,status=0,directories=0,personalbar=0');
		PlayWin.focus();
}

//popup d'ouverture de document
function ouvredoc(c) {
ouvre=window.open(c,"doc","width=710, height=520, resizable=yes,status=no,toolbar=no,menubar=no,scrollbars=yes,left=25,top=25");
ouvre.focus();
}

window.onload = function() {
	//objFrame = parent.document.getElementsByTagName('frameset');
	if(parent.frames.length < 1) {
		document.location.href = '/default.asp?page='+(document.location.href).replace('http://www.snbsa.fr/','');
	}
}