// -----------------------------------------------------------------------------

function OpenWindow(mypage,myname,w,h,scroll)
{
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable=no'
	win = window.open(mypage,myname,settings)
	win.focus();
}
// -----------------------------------------------------------------------------

function OpenPop(mypage, myname, myparam)
{
	popwind = window.open(mypage, myname, myparam, true);
	popwind.focus();
}
// -----------------------------------------------------------------------------

function RedirectSondageR()
{
	iNbi = document.myForm.NbI.value;
	iQuestion = '';
	iVote = document.myForm.VoteID.value;
	myname = 'surveyR';
	
	/* Autre Boucle possible pour les CheckBox par exemple */
	for (i=0; i<iNbi; i++)
		{
			if(document.myForm.questionID[i].checked)
				{
					iQuestion = iQuestion + document.myForm.questionID[i].value;						
				}
		}
		
	settings ='height=350 ,width=550,top=0,left=0,scrollbars=no,resizable=no'
	win = Window.open('/surveyresult.php?questionID='+ iQuestion +'&VoteID='+iVote+'&Button=Vote' ,myname,settings)
}
// -----------------------------------------------------------------------------

function textCounter(field,cntfield,maxlimit)
{
if (field.value.length > maxlimit)
	field.value = field.value.substring(0, maxlimit);
else
	cntfield.value = maxlimit - field.value.length;
}

// -----------------------------------------------------------------------------

var head="display:''"	
function Expand(header, Action)
{
	var head=header.style
	
	if(Action == 1) //Action -> ça deplie le menu
	{
		if(head.display=="none")
			head.display=""
		else
			head.display="none"
	}
	else //Action -> ça replie le menu
	{
		if(head.display=="")
			head.display="none"
		else
			head.display=""
	}
}

// -----------------------------------------------------------------------------

function changerImage(Action, i) {
  	imgSource = "aChanger"+i;
    switch(Action)
    {
    	case '1':
    	document.images[imgSource].src="/_private/images/droite.gif";
    	break;
    	
    	case '2':
    	document.images[imgSource].src="/_private/images/bas.gif";
    	break;
	}
  }
// -----------------------------------------------------------------------------

function afficheImage(Action, j) {
  	imgSource2 = "aAfficher"+j;
    switch(Action)
    {
    	case '1':
    	document.images[imgSource2].src="/_private/images/droite.gif";
    	break;
    	
    	case '2':
    	document.images[imgSource2].src="/_private/images/vide.gif";
    	break;
	}
  }
  
// -----------------------------------------------------------------------------

function clearFieldEmail()
{
	document.myForm.namefrom.value = '';
	document.myForm.emailfrom.value = '';
	document.myForm.nameto.value = '';
	document.myForm.commentperso.value = '';
	document.myForm.checkCopy.checked = false
}

// -----------------------------------------------------------------------------

function OpenPopUp(varpop)
{
	if(varpop == "" )
		{
			OpenWindow('/newsletter.php','newsletters',550,450,'yes');
		}
}

// -----------------------------------------------------------------------------
							
function OnMouseOverStatus(){
	document.onmouseover=hidestatus
	document.onmouseout=hidestatus
}

// -----------------------------------------------------------------------------

function OnMouseOutStatus(){
	document.onmouseover=""
	document.onmouseout=""
	window.status=""
}

// -----------------------------------------------------------------------------

function TransformStatus(Url){
	Init=Url;
}

// -----------------------------------------------------------------------------

function hidestatus(){
	window.status=Init
	return true
}

// -----------------------------------------------------------------------------


/* Début des fonctions pour afficher/cacher les onglets */

function MM_reloadPage(init) 
{
	if(init==true) with (navigator) 
	{
		if((appName=="Netscape")&&(parseInt(appVersion)==4)) 
		{
			document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; 
		}
	}
	else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) 
		location.reload();
}
	
MM_reloadPage(true);

function MM_findObj(n, d) 
{
	var p,i,x;
	
	if(!d) 
		d = document; 
	
	if((p=n.indexOf("?"))>0&&parent.frames.length) 
	{
		d = parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
	}
	
	if(!(x = d[n])&&d.all) 
		x = d.all[n];
	
	for (i=0; !x&&i<d.forms.length; i++) 
		x=d.forms[i][n];
	
	for(i=0; !x&&d.layers&&i<d.layers.length; i++) 
		x = MM_findObj(n,d.layers[i].document);
		
	if(!x && d.getElementById) 
		x = d.getElementById(n); 
	
	return x;
}

function MM_showHideLayers()
{
	var i,p,v,obj,args=MM_showHideLayers.arguments;
	
	for(i=0; i<(args.length-1); i+=2)
	{	
		if((obj=MM_findObj(args[i])) != null)
		{
			v=args[i+1];
			if(obj.style)
			{ 				
				obj=obj.style; 
				v=(v=='show')?'visible':(v=='hide')?'hidden':v;
			}
			obj.visibility=v;
		}
	}
}

/* Fin des fonctions pour afficher/cacher les onglets */

// -----------------------------------------------------------------------------