function redimIFrame( obj ) {
	try{	
	 	 var oFrame = window.frames[obj.name];
     	 var oFrameById = document.getElementById(obj.id);
      	var oBody  =  oFrame.document.body;
		
		//alert (	'height body'  + oBody.scrollHeight);	
		//alert (	'height frame avant ' +	oFrame.style.height);
		oFrameById.height = oBody.scrollHeight + 5 + 'px';
	
		//alert (	'height frame apres ' +	oFrame.style.height);
		//alert ( 'width frame' + oFrame.style.width);
		//alert (	'width body' + oBody.scrollWidth);
		oFrameById.width = oBody.scrollWidth + 5 + 'px';
	}
	//An error is raised if the IFrame domain != its container's domain
	catch(e)
	{
//		window.status =	'Error: ' + e.number + '; ' + e.description;
	}
	window.scrollTo(0,0);
}

//cette fonction permet de simuler le manporedir de jahia
//monURL est l'url par defaut de l iframe
function loadIframe(monURL){
	url_iframe= monURL; 
	var src = document.location.search;
	//src est l'url demandee (après le ?) 
	//si src est remplie et contient "url=" , il s'agit d'une redirection, il faut remplacer l action par defaut 
	if (src != ""){
		indexOfUrl = src.indexOf('url=');
		if (indexOfUrl != -1){
			//url est encodee
			url_iframe=unescape(src.substring(indexOfUrl+4));
		}else{
			iMonURL = monURL.indexOf('?');
			// on passe tous les parametres à l url par defaut 
			if (iMonURL != -1)
				url_iframe= monURL+"&"+src.substring(1);
			else
				url_iframe= monURL+src;
		}
	}
	//ajout du timestamp et du s
	var timestamp= new Date().getTime();
	if (url_iframe.indexOf('?')>0) 
		url_iframe+='&s=3&a='+timestamp;
	else url_iframe+='?s=3&a='+timestamp;
	frames['WEB_OFFRE_Tunisie'].location.href=unescape(url_iframe);
}

function loadFrameAction(monURL){
	url_iframe= monURL; 
	var timestamp= new Date().getTime();
	if (url_iframe.indexOf('?')>0) 
		url_iframe+='&a='+timestamp;
	else url_iframe+='&a='+timestamp;
	//alert(url_iframe);
	frames['frame_action'].location.href=unescape(url_iframe);
}


function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  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_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function load(value) {
	if(value == "#"){
	}else{
		var ranNum = Math.random();
		var textNum = "X" + ranNum;
		var winTitle = "launchWinId" + textNum.substring(4,12) + "X";
		var newWindow = window.open(value, winTitle, "width=700, height=350, resizable, menubar, scrollbars, directories=no, status=no, toolbar=yes, location=no, left=50, top=50");
	}
}



// Small description window open routine
function descWindow(url)
{
	var top = (screen.height-550)/2;
	var left = (screen.width-600)/2;
	newWin = window.open(url,"","top="+top+",left="+left+",width=600,height=550,resizable=yes,menubar=no,scrollbars,directories=no,status=no,toolbar=no,location=no");
	newWin.focus();
}




function active(imgName,imgName2) {
  if (document.images)
    document.images[imgName].src = eval(imgName + "_on.src");
    document.images[imgName2].src = eval(imgName2 + "_on.src");
}

function inactive(imgName,imgName2) {
  if (document.images)
    document.images[imgName].src = eval(imgName + "_off.src");
    document.images[imgName2].src = eval(imgName2 + "_off.src");
}





function tabbedOver(theTable, selected) {
			theTable.className = 'activeTab';
			theTable.getElementsByTagName('td')[1].className = 'activeMiddle';
			theTable.getElementsByTagName('td')[3].className = 'activeBottomCell';
			theTable.getElementsByTagName('a')[0].className= 'tabLinkActive';
}

function tabbedOut(theTable, active) {

		if(active == 0) // false
		{
			theTable.className = 'inactiveTab';
			theTable.getElementsByTagName('td')[1].className = 'inactiveMiddle';
			theTable.getElementsByTagName('td')[3].className = 'inactiveBottomCell';
			theTable.getElementsByTagName('a')[0].className= 'tabLink';
		} else {
			theTable.className = 'activeTab';
			theTable.getElementsByTagName('td')[1].className = 'activeMiddle';
			theTable.getElementsByTagName('td')[3].className = 'activeBottomCell';
			theTable.getElementsByTagName('a')[0].className= 'tabLinkActive';
		}

}


