function $getE(id){return document.getElementById(id);}

//FONCTION DE REDIMENSIONNEMENT DU POPUP A LA TAILLE DE L'IMAGE A VISUALISER
function resizepopup(sPicURL, monTitre){ 
	window.open("http://www.sarbacane.com/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(){
  $getE('gtshow').innerHTML='';
}

function divenabled(DivName){
	$getE(DivName).className='enabled';
}
function divdisabled(DivName){
	$getE(DivName).className='disabled';
}	
var MenuVisible=0;
function MenuVis(DivName){
	//MenuVisible=1;
	$getE(DivName).MenuVisible=1;
	$getE(DivName).style.display='block';
}
function MenuHid(DivName, time){
	//MenuVisible=0;
	$getE(DivName).MenuVisible=0;
	setTimeout("MenuHid2('"+DivName+"');", time);
}
function MenuHid2(DivName){
	if($getE(DivName).MenuVisible==0){
		$getE(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($getE('compteur')){
		$getE('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) 
	{ $getE(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.sarbacane.com/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';
}

function let_it_snow(id, width, height, quality, color, wmode, top_snow, left_snow, max_width){
	document.write('<div id="neige" style="position:absolute; overflow:hidden; top:'+top_snow+'px; left:'+left_snow+'px; width:'+max_width+'px; height:'+height+'px;">');
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="'+id+'" width="'+width+'" height="'+height+'">'); 
	document.write('<param name="movie" value="http://www.sarbacane.com/fl/'+id+'.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="'+id+'" src="http://www.sarbacane.com/fl/'+id+'.swf" quality="'+quality+'" bgcolor="'+color+'" width="'+width+'" height="'+height+'" type="application/x-shockwave-flash" wmode="'+wmode+'"></embed>');
	document.write('</object>');
	document.write('</div>');
}

function ssmenu(el){
	switch(el){
		case 'discover': $getE('ssmenu_discover').style.display='block'; break;
		case 'shop': $getE('ssmenu_shop').style.display='block'; break;
		case 'support': $getE('ssmenu_support').style.display='block'; break;
		case 'aboutus': $getE('ssmenu_aboutus').style.display='block'; break;
		case 'other': $getE('ssmenu_other').style.display='block'; break;
		case '': $getE('ssmenu').style.display='none'; break;
		default: $getE('ssmenu').style.display='none';
	}
}

function trim(str, chars) {
	return ltrim(rtrim(str, chars), chars);
}
 
function ltrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}
 
function rtrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}

