function _Elem(ID){
return document.getElementById(ID);
}

function displayTmpIframe(name,target,display){
	tmpFrame = '';
	tmpFrame += '<iframe id="f'+name+'" name="'+name+'" style="width:80%;height:150px;border:1px blue solid;display:'+display+';">';
	tmpFrame += '</iframe>';
	document.getElementById(target).innerHTML=tmpFrame;
}

function focus_field(field,defaultBgColor, defaultColor){
	
	var BgColor = (defaultBgColor!=null)? defaultBgColor : 'red';
	var PgColor = (defaultColor!=null)? defaultColor : 'white';
	
	_Elem(field).style.background = BgColor;
	_Elem(field).style.color = PgColor;
	_Elem(field).focus();
}

function unfocus_field(field){
	if(!_Elem(field)) alert('field : '+field);
	_Elem(field).style.color = 'black';
	_Elem(field).style.background = 'white';
}

//***********************************
// Modification d'apparence du formulaire 
function GlobalFocusOnTab(tabId,className,TabList,glob){
// liste des indices à traiter : 
// _L		-> change le sens de la fleche
// _R		-> change le sens de la fleche
// _input  -> change la couleur de fond du champ de saisie readonly
// _top 	-> Change la couleur du block
// _main 	-> display le detail du block	
// glob 	-> 0 : pas d'action 
// 			-> 1 : n'affiche qu'un seul bloc, cache les autres entetes
//			-> 2 : affiche toutes les entetes = retour à 0
//			-> 3 : affiche toutes les entetes et tous les blocs
//**********************************************

if(!glob) glob=0;

// listes des tabs 
var Tabs_ = Array();
var tabs = TabList; //Array('tab_race','tab_pet','tab_desc','tab_photos','tab_url');
	 for(var i = 0; i < tabs.length; ++i)
	 {
	 	if(tabs[i]!=tabId)  Tabs_.push(tabs[i]);
	 }
	 
	if(glob==3)
	{
		// on deplie tout
		_Elem(tabId+'_top').className="top_tab_deplie";
		_Elem(tabId+'_input').className="top_race_deplie";
		_Elem(tabId+'_L').className="down_arrow";
		_Elem(tabId+'_R').className="down_arrow";
		_Elem(tabId+'_main').style.display='block';
		_Elem(tabId+'_top').style.display='block';		
	}
	else
	{
		// Si le block est replie, on le deplie
		if(className=="top_tab_replie" && _Elem(tabId+'_top'))
		{
			_Elem(tabId+'_top').className="top_tab_deplie";
			_Elem(tabId+'_input').className="top_race_deplie";
			_Elem(tabId+'_L').className="down_arrow";
			_Elem(tabId+'_R').className="down_arrow";
			_Elem(tabId+'_main').style.display='block';
			if((glob==1 || glob==2) && _Elem(tabId+'_top').style.display=='none') _Elem(tabId+'_top').style.display='block';
		}

		// Si le block est deplie on le replie
		if(className=="top_tab_deplie" && _Elem(tabId+'_top'))
		{
			_Elem(tabId+'_top').className="top_tab_replie";
			_Elem(tabId+'_input').className="top_race_replie";
			_Elem(tabId+'_L').className="up_arrow";
			_Elem(tabId+'_R').className="up_arrow";
			_Elem(tabId+'_main').style.display='none';
			if((glob==0 || glob==2) && _Elem(tabId+'_top').style.display=='none') _Elem(tabId+'_top').style.display='block';
			if(glob==1) _Elem(tabId+'_top').style.display='none';

		}
	}
	
	// -> on replie les autres  ********
	if(className=="top_tab_replie"){
		for(i = 0; i < Tabs_.length; ++i)
		{
		GlobalFocusOnTab(Tabs_[i],"top_tab_deplie",TabList,glob);
		}		
	}
}