function $(id){return document.getElementById(id);}

//FONCTION DE REDIMENSIONNEMENT DU POPUP A LA TAILLE DE L'IMAGE A VISUALISER
function resizepopup(sPicURL, monTitre){ 
	window.open("popup.htm?url="+sPicURL, monTitre,"width=100,height=100,top=100,left=100,menubar=no,scroll=yes,location=no,padding=0,margin=0");
}

function Openwindow(page,largeur,hauteur,options){
    var top=30;
    var left=(screen.width-largeur)/2;
      window.open(page,"ajouter","top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);
}

function RunFlNormal(src,wi,he,quality,color,wmode){
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://active.macromedia.com/flash4/cabs/swflash.cab#version=4,0,0,0" id="_011105" width="'+wi+'" height="'+he+'">'); 
	document.write('<param name="movie" value="'+src+'.swf">');
	document.write('<param name="quality" value="'+quality+'">'); 
	document.write('<param name="bgcolor" value="'+color+'">');
	document.write('<PARAM name="wmode" value="'+wmode+'">');
	document.write('<embed name="_011105" src="'+src+'.swf" quality="high" bgcolor="#FFFFFF" width="'+wi+'" height="'+he+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed>');
	document.write('</object>');
}

function init(){
  $('gtshow').innerHTML='';
}

function divenabled(DivName){
	$(DivName).className='enabled';
}
function divdisabled(DivName){
	$(DivName).className='disabled';
}	
var MenuVisible=0;
function MenuVis(DivName){
	//MenuVisible=1;
	$(DivName).MenuVisible=1;
	$(DivName).style.display='block';
}
function MenuHid(DivName, time){
	//MenuVisible=0;
	$(DivName).MenuVisible=0;
	setTimeout("MenuHid2('"+DivName+"');", time);
}
function MenuHid2(DivName){
	if($(DivName).MenuVisible==0){
		$(DivName).style.display='none';
	}
}

var d = (new Date()).getDate();
var h = (new Date()).getHours()+1;
var m = (new Date()).getMinutes()+1;
var s = (new Date()).getSeconds()+1;
var max = 1200000; // Dynamique
var nb_h = max/24;
var nb_m = nb_h/60;
var nb_s = nb_m/60;
function CountSendedMail(){
	var s = (new Date()).getSeconds()+1;
	var nb=Math.round((h*nb_h+m*nb_m+nb_s*s)+(max/(24*60*60*60)));
	if($('compteur')){
		$('compteur').innerHTML=(nb<=1)?'<font color="#8D8D8D">'+nb+'</font> email envoyé aujourd\'hui':'<font color="#8D8D8D">'+nb+'</font> emails envoyés aujourd\'hui';
		}
	setTimeout("CountSendedMail();", 1000);
}

function visibility(DivName) 
	{ $(DivName).className='disabled';} 
	
function txt2img(){
	var list = new Array('span');
	for(var x=0; x<list.length; x++){
		var Element = document.getElementsByTagName(list[x]);
		for(var i=0; i<Element.length; i++){
			var idElement = Element[i].id; // id du span
			if(idElement!='undefined' && idElement!=null){
				var reg=new RegExp("[ttoi_]","g");
				if(idElement.match(reg)){
					var temp = Element[i].innerHTML;
					var idElement = idElement.replace(reg, '');
					if(temp.length!=0){
						var tempory = '';
						for(var a=0; a<temp.length; a++){
							tempory += '<img src="http://www.goto.fr/Sarbacane/img/txt2img/'+Element[i].id.replace(reg, '')+'_';
							if(temp.charCodeAt(a)<100){tempory += '0';}
							tempory += temp.charCodeAt(a)+'.gif" border="0" align="absmiddle" style="margin-left:-2px;">';
						}
						Element[i].innerHTML = tempory;
					}
				}
			}
		}
	}
}

function Rid(id){
	return document.getElementById(id);
}
	
function TipOn(DivId){
	Rid('thumb'+DivId).className='thumbOn';
	Rid('subthumb'+DivId).className='subthumbOn';
}
	
function TipOff(DivId){
	Rid('thumb'+DivId).className='thumbOff';
	Rid('subthumb'+DivId).className='subthumbOff';
}
