function ong()
{
	switch($('editoContent').style.height)
	{
		case "75px":
			$('editoContent').style.height = "315px";
			$('edito_btn').innerHTML = "Cacher";
			$('edito_extrait').className = "" ;
			break;
		
		case "315px":
			$('editoContent').style.height = "75px";
			$('edito_btn').innerHTML = "Lire la suite";
			$('edito_extrait').className = "short" ;
			break;
	}
	
	if(!$('editoContent').style.height)
	{
		$('editoContent').style.height = "315px";
		$('edito_btn').innerHTML = "Cacher";
		$('edito_extrait').className = "" ;
	}

	/*if(div=="edito") 
	{
		$('edito_ong').className = "actif";
		$('prem_ong').className = "";
		
		$('editoContent').style.display = "block";
		$('premContent').style.display = "none";
		
	}
	else
	{
		$('edito_ong').className = "";
		$('prem_ong').className = "actif";
		
		$('editoContent').style.display = "none";
		$('premContent').style.display = "block";
		//$('premContent').style.height = "360px";
		
	}*/
}


// JavaScript Document
var isIE6 = false, isIE7 = false,
 isFIREFOX2 = false, isFIREFOX = false,
 isNETSCAPE7 = false, isNETSCAPE = false,
 isOPERA9 = false, isOPERA = false,
 isUNKNOWN = false; 

var strChUserAgent = navigator.userAgent;
 var intSplitStart = strChUserAgent.indexOf("(",0);
 var intSplitEnd = strChUserAgent.indexOf(")",0);
 var strChStart = strChUserAgent.substring(0,intSplitStart);
 var strChMid = strChUserAgent.substring(intSplitStart, intSplitEnd);
 var strChEnd = strChUserAgent.substring(strChEnd);

 if(strChMid.indexOf("MSIE 7") != -1)
 isIE7 = true;
 else if(strChMid.indexOf("MSIE 6") != -1)
 isIE6 = true;
 else if(strChEnd.indexOf("Firefox/2") != -1)
 isFIREFOX2 = true;
 else if(strChEnd.indexOf("Firefox") != -1)
 isFIREFOX = true;
 else if(strChEnd.indexOf("Netscape/7") != -1)
 isNETSCAPE7 = true;
 else if(strChEnd.indexOf("Netscape") != -1)
 isNETSCAPE = true;
 else if(strChStart.indexOf("Opera/9") != -1)
 isOPERA9 = true;
 else if(strChStart.indexOf("Opera") != -1)
 isOPERA = true;
 else
 isUNKNOWN = true;





Event.observe(window, 'load', function () {  
										
										
	/***********************Taille des blocs pour la page index******************/
	if($('blocPlansJS').offsetHeight > $('blocConseilsJS').offsetHeight && $('blocPlansJS').offsetHeight> $('blocCodesPromosJS').offsetHeight)
	{
		$('blocCodesPromosJS').style.height = $('blocPlansJS').offsetHeight+"px";
		$('blocConseilsJS').style.height = $('blocPlansJS').offsetHeight+"px";
	}
	else if($('blocConseilsJS').offsetHeight > $('blocPlansJS').offsetHeight && $('blocConseilsJS').offsetHeight> $('blocCodesPromosJS').offsetHeight)
	{
		$('blocCodesPromosJS').style.height = $('blocConseilsJS').offsetHeight+"px";
		$('blocPlansJS').style.height = $('blocConseilsJS').offsetHeight+"px";
	}
	else
	{
		$('blocPlansJS').style.height = $('blocCodesPromosJS').offsetHeight+"px";
		$('blocConseilsJS').style.height = $('blocCodesPromosJS').offsetHeight+"px";
	}
	
	if($('blocPromosJS').offsetHeight > $('blocPostsJS').offsetHeight && $('blocPromosJS').offsetHeight > $('blocNewsJS').offsetHeight)
	{
		$('blocPostsJS').style.height = $('blocPromosJS').offsetHeight+"px";
		$('blocNewsJS').style.height = $('blocPromosJS').offsetHeight+"px";
		
	}
	if($('blocPostsJS').offsetHeight > $('blocPromosJS').offsetHeight && $('blocPostsJS').offsetHeight > $('blocNewsJS').offsetHeight)
	{
		$('blocPromosJS').style.height = $('blocPostsJS').offsetHeight+"px";
		$('blocNewsJS').style.height = $('blocPostsJS').offsetHeight+"px";
	}
	else
	{
		$('blocPostsJS').style.height = $('blocNewsJS').offsetHeight+"px";
		$('blocPromosJS').style.height = $('blocNewsJS').offsetHeight+"px";
	}
		
  c_name = "Propos_Inscription";
  c_start=document.cookie.indexOf(c_name + "=");
	
 // if (c_start==-1)
 if (false)
    { 
	
	
		$('shadow').style.width=screen.width+"px";
		$('shadow').style.height=(screen.height+600)+"px";
		//$('shadow').style.opacity = 1 ;
		$('encart_inscription').style.display = "block" ;
		$('encart_inscription').setOpacity(1) ;
		$('shadow').appear({from:0, to: 0.6 });
		//$('encart_inscription').appear({from:0, to: 1 });
			
		if (isIE6) {
			$('shadow').style.height = (parseInt(document.body.clientHeight) + 30) + "px";
			//$('whereSearch').style.display = "none";
			
			window.scrollTo(0,0)


/*			
			var f    = document.createElement("iframe");
			var d    = document.getElementById("encart_inscription");
		
			with(f.style){
				position	= "absolute";
				width    	= "180px";
				height		= "25px";
				top			= "211px";
				left		= ((parseInt(document.body.clientWidth) / 2) - 65) + "px";
				zIndex		= "15";
				border		= "0px" ;
			}
	
		
			f.setAttribute("border","0") ;
			f.setAttribute("frameborder","no") ;
			f.setAttribute("scrolling","no") ;
			f.id = "bugIe6" ;
						
			document.body.appendChild(f);
			*/
			
			
		}

	}
});



function close_encart_inscription () 
{
	//if (isIE6) $('whereSearch').style.display = "inline";
	$('encart_inscription').style.display = "none";
	$('shadow').hide();
	var today = new Date(), expires = new Date();
    expires.setTime(today.getTime() + (15*24*60*60*1000));
	
	document.cookie = "Propos_Inscription=ok;expires="+expires.toGMTString();
	
}

function verifOverlay () 
{
	
	if($('email').value=="")
	{
		$('erreur').innerHTML = "Tu n\'as pas saisi ton email";
		$('erreur').style.visibility = "visible";
		Effect.Shake('erreur');
	}
/*	
	else if(!preg_match('`^[[:alnum:]]([-_.]?[[:alnum:]])*@[[:alnum:]]([-_.]?[[:alnum:]])*\.([a-z]{2,4})$`',$('email')))
	{
		$('erreur').innerHTML = "Ton email semble incorrect";
		$('erreur').style.visibility = "visible";
		Effect.Shake('erreur');
	}
*/
	else if(!checkEmail(document.formulaireOverlay.email.value))
	{
		$('erreur').innerHTML = "Ton email semble incorrect";
		$('erreur').style.visibility = "visible";
		Effect.Shake('erreur');
	}
	else
	{
		document.formulaireOverlay.submit();	
		var today = new Date(), expires = new Date();
    expires.setTime(today.getTime() + (15*24*60*60*1000));
	
	document.cookie = "Propos_Inscription=ok;expires="+expires.toGMTString();
	}

	
}


function checkEmail(email) {
  var proto  = "(mailto:)?";
  var usr    = "([a-zA-Z0-9][a-zA-Z0-9_.-]*|\"([^\\\\\x80-\xff\015\012\"]|\\\\[^\x80-\xff])+\")";
  var domain = "([a-zA-Z0-9][a-zA-Z0-9._-]*\\.)*[a-zA-Z0-9][a-zA-Z0-9._-]*\\.[a-zA-Z]{2,5}";
  var regex  = "^" + proto + "?" + usr + "\@" + domain + "$";

  var rgx    = new RegExp(regex);
  return rgx.exec(email) ? true : false;
}

