var siteName = 'ActionPassion.com';
var devPath = 'AP/';
var win = null;

function fixeDec(formElement)
	{
	if(formElement.value){formElement.value = parseFloat(formElement.value).toFixed(2);}
	}
			
function nonMembreMessage()
	{
	alert(unescape("Bonjour!%0a%0aDesolé! cette option est réservée à nos membres seulement.%0a%0aDeviens MEMBRE de ActionPassion.com...c%27est GRATUIT!%0a%0aTu auras alors accès à toutes les fonctionnalités de notre%0asite Web et tu recevras aussi notre Infos-Bulletin par courriel%0aqui te tiendra au courant de nos prochaines activités!%0a%0aN%27hésite pas et à bientôt!%0a%0aSI TU ES DÉJÀ MEMBRE DE ACTIONPASSION.COM%0a-------------------------------------------------------------%0a%0aN%27oublie pas qu%27il te faut entrer tes codes d%27accès (numéro%0ade membre et mot de passe) afin de te prévaloir de tes%0aoptions réservées aux membres!%0a%0a"));
	}

function openMessageWindow(mypage,myname,w,h,resize,scroll)
	{
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	if(h < 10){h = ((screen.Height) - 130);}
	settings ='height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable,toolbar=1,location=1';
	var win = window.open("",myname,settings);
	if ( null != win )
		{
		win.location = mypage;
		win.focus();
		}
	}
	
function openWindowProfilMb (v_url,v_name)
	{
	windowprops = "top=0,left=0,resizable=no,scrollbars=yes"+ ",width=650,height=" + (screen.height-80);
	var url = v_url;
	var w = window.open("","membres" + v_name ,windowprops );
	if ( null != w )
		{
		w.location = url;
		w.focus();
		}
	}
	
function openWindow (v_url,w)
	{
	if(w == ''){w = '850';}
	windowprops = "top=0,left=0,resizable=no,scrollbars=yes,width=" + w + ",height=" + (screen.height-80) + "";
	
	var url = v_url;
	var w = window.open("","activite",windowprops );
	if ( null != w )
		{
		w.location = url;
		w.focus();
		}
	}
	
function Popup(mypage,myname,w,h,scroll,fromTop,menubar,toolbar)
	{
	setResizable = 'true';
	//,toolbar='+toolbar+',locationbar='+locationbar+'    ,toolbar,locationbar
	//if(menubar = ''){menubar = 0;}else{menubar = menubar;}
	//if(statusbar = ''){statusbar = 0;}else{statusbar = statusbar;}
	//if(toolbar = ''){toolbar = 0;}else{toolbar = toolbar;}
	//if(locationbar = ''){locationbar = 0;}else{locationbar = locationbar;}

	if((w == '')||(w == null)){w = (screen.width-10);LeftPosition = 0;}else{LeftPosition = (screen.width) ? (screen.width - w)/2 : 0;}
	
	if((h == '')||(h == null)) 
		{
		h = (screen.height-165);
		TopPosition = 0 ;
		}
	else 
		{
		if((fromTop == '')||((fromTop == null)))
			{
			TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
			}
		else
			{
			TopPosition = fromTop ;
			}
		}

	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable=1,location=no';
	win = window.open(mypage,myname,settings).focus();
	}

//function Popup(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+''
//	win = window.open(mypage,myname,settings);
//	}

function resetField (v_formElement)
	{
	v_formElement.value = '';
	}

function resetCombo (v_comboElement)
	{
	v_comboElement.options[0].selected = true;
	}

function show(v_1) 
	{
	document.getElementById(v_1).style.visibility = "visible";
	}
	
function showIt(obj)
	{
	if (document.getElementById)
		{
		document.getElementById(obj).style.visibility = "visible";
		}
	else
		{
		if(document.layers)
			{
			document.layers[obj].visibility = "show";
			}
		else
			{
			document.all(obj).style.visibility = "visible";
			}
		}
	}

function hideIt(obj)
	{
	if (document.getElementById)
		{
		document.getElementById(obj).style.visibility = "hidden";
		}
	else
		{
		if (document.layers)
			{
			document.layers[obj].visibility = "hide";
			}
		else
			{
			document.all(obj).style.visibility = "hidden";
			}
		}
	}


function hide(v_2) 
	{
	document.getElementById(v_2).style.visibility = "hidden";
	}

function high(which2)
	{
	theobject=which2
	highlighting=setInterval("highlightit(theobject)",50)
	}

function low(which2)
	{
	clearInterval(highlighting)
	which2.filters.alpha.opacity=50
	}

function highlightit(cur2)
	{
	if (cur2.filters.alpha.opacity<100)
		cur2.filters.alpha.opacity+=10
	else if (window.highlighting)
	clearInterval(highlighting)
	}


var changePhotoDelay = 4000; // milliseconds (5000 = 5 secs)
photoNo = 0;
	
function nextPhoto()
	{
	if (document.photoform.photo[photoNo+1])
		{
		hidePhotoText();
   		document.images.show.src = document.photoform.photo[photoNo+1].value;
		document.photoform.photo.selectedIndex = ++photoNo;
   		showPhotoText(photoNo);
   		}
	else firstPhoto();
	}

function previousPhoto()
	{
	if (photoNo-1 >= 0)
		{
		hidePhotoText();
   		document.images.show.src = document.photoform.photo[photoNo-1].value;
		document.photoform.photo.selectedIndex = --photoNo;
   		showPhotoText(photoNo);
   		}
	else lastPhoto();
	}

function firstPhoto()
	{
	hidePhotoText();
   	photoNo = 0;
	document.images.show.src = document.photoform.photo[0].value;
	document.photoform.photo.selectedIndex = 0;
	showPhotoText(photoNo);
   	}

function lastPhoto()
	{
	hidePhotoText();
   	photoNo = document.photoform.photo.length-1;
	document.images.show.src = document.photoform.photo[photoNo].value;
	document.photoform.photo.selectedIndex = photoNo;
	showPhotoText(photoNo);
   	}

function resetButton(text)
	{
	document.photoform.photobutton.value = (text == "Arrêt") ? "Diapo" : "Arrêt";
	rotate();
	}

function changeFromMenu()
	{
	photoNo = document.photoform.photo.selectedIndex;
	document.images.show.src = document.photoform.photo[photoNo].value;
	showPhotoText(photoNo);
   	}

function rotate()
	{
	if(document.photoform.vitesse){
	changePhotoDelay = document.photoform.vitesse.value;
	}else{
	changePhotoDelay = 4000; // in milliseconds (5000 = 5 secs)
	}
	
	if (document.photoform.photobutton.value == "Arrêt")
		{
		hidePhotoText();
   		photoNo = (photoNo == document.photoform.photo.length-1) ? 0 : photoNo+1;
		document.images.show.src = document.photoform.photo[photoNo].value;
		document.photoform.photo.selectedIndex = photoNo;
		window.setTimeout("rotate()", changePhotoDelay);
		showPhotoText(photoNo);
   		}
	}

function showPhotoText(v_1) 
	{
	document.getElementById(v_1).style.visibility = "visible";
	}

function hidePhotoText() 
	{
	for( i = 0 ; i <= document.photoform.photo.length-1 ; i++ )
		{
		document.getElementById(i).style.visibility = "hidden";
		//alert(i);
		}
	}

var win = null;
function openPopupWindow(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';
		win = window.open(mypage,myname,settings).focus();
		}
	
function openFullWindow(v_url,v_name,w,h,v_top,v_left,v_scroll,v_resize)
	{
	if(w == ''){w = (screen.width-10);}
	if(h == ''){h = (screen.height-80);}
	windowprops = "top=" + v_top + ",left="+v_left+",resizable="+v_resize+",scrollbars="+v_scroll+",width=" + w + ",height=" + h + "";
	
	var url = v_url;
	var w = window.open("",v_name,windowprops );
	if ( null != w )
		{
		w.location = url;
		w.focus();
		}
	}



function showBig2(thePath){
var proto;
if(thePath.protocol == 'http:'){proto = 'http:';}else{proto = 'http:';}
	
thePath = proto + '//www.' + siteName + '/cgi-bin/showImages2.cgi?path=' + thePath;
var props = "top=10,left=10,resizable=yes,scrollbars=no,status=0,directories=no,toolbar=no,menubar=no,width=20,height=20";
//var props = "top=10,left=10,resizable=no,scrollbars=no,status=no,directories=no,toolbar=no,menubar=no,width=20,height=20";
	
var url = thePath;
var w = window.open("",'photo',props);
if ( null != w )
	{
	w.location = url;
	w.focus();
	}
return false;
}

function showBig(thePath,width,height){
var proto;
if(thePath.protocol == 'http:'){proto = 'http:';}else{proto = 'https:';}

var picNo = thePath.substring(thePath.indexOf('thumb')+5);
var picPath = thePath.substring(thePath.indexOf('images/')+7,thePath.indexOf('thumb'))+'photo' + picNo;

thePath = proto + '//www.' + siteName + '/cgi-bin/showImages.cgi?path=' + picPath + '';

var props = "top=10,left=10,resizable=yes,scrollbars=no,status=0,directories=no,toolbar=no,menubar=no,width=20,height=20";
//var props = "top=10,left=10,resizable=no,scrollbars=no,status=no,directories=no,toolbar=no,menubar=no,width=20,height=20";
	
var url = thePath;
var w = window.open("",'photo',props);
if ( null != w )
	{
	w.location = url;
	w.focus();
	}

//NewWindow(thePath,'photo',20,20); return false;
//openWindow2(thePath,'');return false;
}

function GrowFromCenter(u,n,w,h,f)
	{
	var WO=(d=document,WW=WH=100,s=window.screen,ws=s?1:0,sw=ws?s.availWidth:800,sh=ws?s.availHeight:640,x=(sw-WW)/2,y=(sh-WH)/2,l=(sw-w)/2,t=(sh-h)/2,s='width='+WW+',height='+WH+',top='+y+',screeny='+y+',left='+x+',screenx='+x,s+=(d.layers)?',resizable':'',s+=(!f||f=='')?'':','+f,W=self[n]=window.open('',n,s),(W&&!W.closed)?1:0);
	while(WW!=w||WH!=h)
		{
		if(WO&&WW<w)
			{
			W.moveTo((sw-WW)/2,(sh-WH)/2);
			W.resizeTo(WW,WH);
			WW*=1.3;
			}
		if(WO&&WW>w)
			{
			WW=w;
			W.moveTo((sw-WW)/2,(sh-WH)/2);
			W.resizeTo(WW,WH);
			}
		if(WO&&WH<h)
			{
			W.moveTo((sw-WW)/2,(sh-WH)/2);
			W.resizeTo(WW,WH);
			WH*=1.3;
			}
		if(WO&&WH>h)
			{
			WH=h;
			W.moveTo((sw-WW)/2,(sh-WH)/2);
			W.resizeTo(WW,WH)
			}
		}
	if(d.layers)
		{
		W.outerHeight=h;
		W.outerWidth=w;
		}
	W.moveTo(l,t);
	W.document.location=u;W.focus();
	}

function limitText(limitField, limitCount, limitNum) {
		if (limitField.value.length > limitNum) {
			limitField.value = limitField.value.substring(0, limitNum);
		} else {
			limitCount.value = limitNum - limitField.value.length;
		}
	}
	
 function modalWin(url,name,w,h,scroll)
 	{
 	var status = '0';
 	var edge = 'raised'; // sunken | raised 
 	var unadorned= '1'; // ( yes | no | 1 | 0 | on | off ) 
 	var help= '0'; // ( yes | no | 1 | 0 | on | off )
 	var dialogHide = '0'; // ( yes | no | 1 | 0 | on | off ) 
 	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
		
	if (window.showModalDialog)
		{
		window.showModalDialog(url,name,'dialogWidth:'+w+'px;dialogHeight:'+h+'px;dialogTop:'+TopPosition+';dialogLeft:'+LeftPosition+';status:'+status+';scroll:'+scroll+';edge:'+edge+';unadorned:'+unadorned+';help:'+help+';dialogHide:'+dialogHide+';');
		}
	else
		{
		window.open(url,name,'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',toolbar=no,directories=no,status=no,continued from previous linemenubar=no,scrollbars=no,resizable=no ,modal=yes');
		}
	}
	
function reloadSecurityCode()
	{
	var curDateTime = new Date()
  var curHour = curDateTime.getHours()
  var curMin = curDateTime.getMinutes()
  var curSec = curDateTime.getSeconds()
  var curTime = 
    ((curHour < 10) ? "0" : "") + curHour + ":" 
    + ((curMin < 10) ? "0" : "") + curMin + ":" 
    + ((curSec < 10) ? "0" : "") + curSec 
    
	if(document.getElementById)
		{
		document.getElementById('SecurityCode').src='https://www.' + siteName + '/cgi-bin/captcha/captcha.cgi?'+curTime;
		}
	}


function tCode(ev)
	{
	var code=ev.keyCode;
 	return code;
	}	