
var tabWidget = new Array();
var fichierReadExcel = "/webarea/excel/excel.php";
var fichierXML_Search = "/webarea/OLAP/search_xml.php";
var fichierXML_Result = "/webarea/OLAP/result_xml.php";
var fichierXML_Detail = "/webarea/OLAP/detail_xml.php";
var fichierXSL_Search = "/webarea/OLAP/search.xsl";
var fichierXSL_Result = "/webarea/OLAP/result.xsl";
var fichierXSL_Detail = "/webarea/OLAP/detail.xsl";
var fichierExcel_Result = "/webarea//OLAP/result_excel.php";
var fichierExcel_Detail = "/webarea/OLAP/detail_excel.php";
var fichierRSS_XML = "/webarea/RSS/rss_xml.php";
var fichierRSS_XSL = "/webarea/RSS/rss.xsl";
var fichierSQL_XML_Search = "/webarea/SQL/search_xml.php";
var fichierSQL_XSL_Search = "/webarea/SQL/search.xsl";
var fichierSQL_XML_Result = "/webarea/SQL/result_xml.php";
var fichierSQL_XSL_Result = "/webarea/SQL/result.xsl";
var fichierExcelSQL_Result = "/webarea/SQL/result_excel.php";
var imgTabSearch = "<img src='/common/img/icones/tabSearch.gif' align='absmiddle' height='18' border='0'>&nbsp;";
var imgTabResult = "<img src='/common/img/icones/tabResult.gif' align='absmiddle' height='18' border='0'>&nbsp;";
var imgTabDetail = "<img src='/common/img/icones/tabDetail.gif' align='absmiddle' height='18' border='0'>&nbsp;";
var idDivContentFullPage = 'divContentFullPage';
var htmlPagination = "<strong>{CurrentPageReport}</strong> {PreviousPageLink} {PageLinks} {NextPageLink} {RowsPerPageDropdown}";
var dossierJSNetvibes =  "/common/javascript/";
var fichierJSNetvibes = "netvibes.js.php";
var pathJSNetvibes = dossierJSNetvibes+fichierJSNetvibes;




var optionsSkins = Array();

for(var cptSkin=0; cptSkin<tWinSkin.length; cptSkin++)
	optionsSkins[cptSkin] = [tWinSkin[cptSkin],tWinSkin[cptSkin]];


String.prototype.trim = function()
{return this.replace(/(^\s*)|(\s*$)/g, "");}








/***********************************************************************************************/
/**************************************** WIDGET DE BASE****************************************/
/***********************************************************************************************/
function widgetPersoBase(num,options)
{
	this.num = num;
	this.type = "base";
	this.chargee = false;
	this.options = options;
	this.buttonMaskHeaderH = null;
	this.buttonMaskHeaderV = null;
	
	this.tabPaddingPanel = Array();
	this.tabPaddingPanelWidth = Array();
	
	for (var cle in tabPaddingPanel) {
		this.tabPaddingPanel[cle] = tabPaddingPanel[cle];
	}
	
	for (var cle in tabPaddingPanelWidth) {
		this.tabPaddingPanelWidth[cle] = tabPaddingPanelWidth[cle];
	}
	
	
	this.maximized = false;
	this._sauvWidth = 0;
	this._sauvHeight = 0;
	this._sauvLeft = 0;
	this._sauvTop = 0;
	this.draggable = (this.options && this.options.move && this.options.move=='1')?true:false;
	this.close = (this.options && this.options.close && this.options.close=='1')?true:false;
	this.redim = (this.options && this.options.redim && this.options.redim=='1')?true:false;
	this.maxi = (this.options && this.options.maxi && this.options.maxi=='1')?true:false;
	this.modal = (this.options && this.options.modal && this.options.modal=='1')?true:false;
	this.centered = (this.options && this.options.centered && this.options.centered=='1')?true:false;
	
	
	
		
	if ((options)&&(options.Title))
		options.Title = options.Title.replace(/'/g,"&#39;");
		
		
	this.creerWindowFenetre = function()
	{	
		var divWindow = document.createElement('div');
		divWindow.id = "divWindow"+num;
		divWindow.className = this.options.skin;
		var html = '<div class="hd">'+this.options.Title+'</div>';
		html += '<div class="bd"></div>';
		html += '<div class="ft"><div class="bl"></div><span>&nbsp;</span><div class="br"></div></div>';
		
		
		divWindow.innerHTML = html;
		document.body.appendChild(divWindow);
		
		
		 var panel = new YAHOO.widget.Panel("divWindow"+num, {
                draggable: this.draggable,
                close: this.close,
                y: debutWinY,
				x: debutWinX,
				width: tailleWinX,
				height: tailleWinY,
				modal:this.modal,
				fixedcenter:this.centered,
				underlay:'none'
				/*,iframe:false*/
            });
         panel.render();
         	
        
         
         if (this.maxi) {
         	YAHOO.util.Event.addListener(panel.header, "dblclick", function(){
	     		tabWidget[num].maximize();    
	     	});
	     	
	     	var spanMaximize = document.createElement('span');
	     	spanMaximize.className='container-maximize';
	     	divWindow.appendChild(spanMaximize);
	     	
	     	YAHOO.util.Event.addListener(spanMaximize, "click", function(){
	     		tabWidget[num].maximize();    
	     	});
     	}
         
        var resize = new YAHOO.util.Resize("divWindow"+num+"_c", {
                handles: (this.redim?'all':''),
                hiddenHandles:true,
                autoRatio: false,
                minWidth: 10,
                width: tailleWinX,
                height: tailleWinY,
                minHeight: 10
           });
        resize.on('resize', function(args) {
	        try {
				if (args.height) {
					if (args.height) YAHOO.util.Dom.setStyle(this.panel.innerElement, 'height', args.height + 'px');
					var bodyHeight = (args.height - this.panel.header.offsetHeight - this.panel.footer.offsetHeight);
					var bodyContentHeight = (IE_QUIRKS) ? bodyHeight : bodyHeight - this.tabPaddingPanel[this.options.skin];
					YAHOO.util.Dom.setStyle(this.panel.body, 'height', bodyContentHeight + 'px');
				}
				if (args.width) {
					var newWidth = args.width;
					if (YAHOO.env.ua.ie>0) newWidth -= this.tabPaddingPanel[this.options.skin]
					YAHOO.util.Dom.setStyle(this.panel.innerElement, 'width', newWidth + 'px');
					if (YAHOO.env.ua.ie > 0) {
						//YAHOO.util.Dom.setStyle(this.panel.header, 'width', (newWidth+ this.panel.header.firstChild.offsetWidth) + 'px');
						YAHOO.util.Dom.setStyle(this.panel.header, 'width', (newWidth+ this.tabPaddingPanelWidth[this.options.skin]) + 'px');
						YAHOO.util.Dom.setStyle(this.panel.body, 'width', newWidth + 'px');
						YAHOO.util.Dom.setStyle(this.panel.footer, 'width', newWidth + 'px');
					}
				}
				if (IE_SYNC) {
					this.panel.sizeUnderlay();
					this.panel.syncIframe();
				}
            }
            catch(e){
	            //$('testarea').value += 'Erreur : '+e.message+'\n';
	            //alert("Erreur dans resize : "+e.message)
            }
        }, this, true);
        
        
        resize.on('beforeResize', function(args) {
	     	if (this.maximized == true) return false; 
        }, this, true);
        
        
       resize.on('click',function(args) {
	       panel.bringToTop();
       }, panel, true);
      this.panel = panel;
      this.resize = resize;
      this.panel.num = num;
      
      this.setTitle(this.options.Title);
      
		
		
		this.panel.hideEvent.subscribe(function(e){
			document.body.style.overflow='auto';
			document.getElementsByTagName('html')[0].style.overflow='auto';
			document.body.style.overflowX='hidden';
			document.getElementsByTagName('html')[0].style.overflowX='hidden';
			/*
			var tSelElements = this.element.getElementsByTagName("select");
			for (var i=0; i<tSelElements.length; i++) {
				tSelElements[i].style.display = 'none';
			}
			tSelElements = this.element.getElementsByTagName("object");
			for (var i=0; i<tSelElements.length; i++) {
				tSelElements[i].style.display = 'none';
			}
			*/
			this.body.style.display='none';
			if ($("ckAffiche_"+this.num)) {
				$("ckAffiche_"+this.num).checked = false;
			}
		});
      
      	this.panel.showEvent.subscribe(function(e){
			this.body.style.display='';
			/*
			var tSelElements = this.element.getElementsByTagName("select");
			for (var i=0; i<tSelElements.length; i++) {
				tSelElements[i].style.display = '';
			}*/
			
			if ($("ckAffiche_"+this.num)) {
				$("ckAffiche_"+this.num).checked = true;
			}
		});
      
      
      
      
	}
	
	this.maximize = function() {
		if (this.maximized==false) {
			document.body.style.overflow='hidden';
			document.getElementsByTagName('html')[0].style.overflow='hidden';
			this._sauvWidth = this.getSize().width;
			this._sauvHeight = this.getSize().height;
			
			this._sauvLeft = this.getPosition().x;
			this._sauvTop = this.getPosition().y;
			var widthBody = YAHOO.util.Dom.getClientWidth();
			var heightBody = YAHOO.util.Dom.getClientHeight();
			
			this.setSize(widthBody,heightBody);
			this.setPosition(0,0);
			window.scrollTo(0,0);
			this.maximized = true;
			this.panel.cfg.setProperty('draggable',false);
			//this.panel.cfg.setProperty('close',false);
			return;
		}
		if (this.maximized==true) {
			document.body.style.overflow='auto';
			document.getElementsByTagName('html')[0].style.overflow='auto';
			document.body.style.overflowX='hidden';
			document.getElementsByTagName('html')[0].style.overflowX='hidden';
			this.setSize(this._sauvWidth,this._sauvHeight);
			this.setPosition(this._sauvTop,this._sauvLeft);
			YAHOO.util.Dom.setXY(this.panel.element, [this._sauvLeft,this._sauvTop]);
			this.maximized = false;
			this.panel.cfg.setProperty('draggable',this.draggable);
			//this.panel.cfg.setProperty('close',this.close);
		}
	}
	
	
	
	this.isVisible = function(){
		var visibility = YAHOO.util.Dom.getStyle(this.panel.element, 'visibility');
		return (visibility=='hidden'?false:true);
	};
	
	this.masquer = function(){
		this.panel.hide();
		if ($("ckAffiche_"+this.options.num)) {
			$("ckAffiche_"+this.options.num).checked = false;
		}
	};
	
	this.afficher = function() {
		this.panel.show();
		this.panel.bringToTop();
		if ($("ckAffiche_"+this.options.num)) {
			$("ckAffiche_"+this.options.num).checked = true;
		}
		winConfigWebarea.bringToTop();
	};
	
	this.getTitle = function() {
		var tmpDiv = document.createElement('div');
		tmpDiv.innerHTML = this.panel.header.innerHTML;
		if (tmpDiv.getElementsByTagName('img').length>0)
			tmpDiv.getElementsByTagName('img')[0].parentNode.removeChild(tmpDiv.getElementsByTagName('img')[0]);
		return (tmpDiv.innerHTML.replace(/&nbsp;/,''));
	}
	
	this.getPosition = function() {
		var v_x = YAHOO.util.Dom.getStyle(this.panel.element, 'left').replace(/px/i,'');
		var v_y = YAHOO.util.Dom.getStyle(this.panel.element, 'top').replace(/px/i,'');
		return {x:v_x,y:v_y}
	}
	
	this.getSize = function() {
		var v_width = YAHOO.util.Dom.getStyle(this.panel.element.firstChild, 'width').replace(/px/i,'');
		var v_height = YAHOO.util.Dom.getStyle(this.panel.element.firstChild, 'height').replace(/px/i,'');
		return {width:v_width,height:v_height}
	}
	
	
	this.detacher = function(){}
	
	
	this.chargerContenu = function()
	{
		this.chargee = true;
	}
	
	this.setTitle = function(titre)
	{
		this.options.Title = titre
		var icone = '<div class="tl"></div><span>';
		icone += "<img src='/common/img/icones/ico_"+this.options.type+".png' class='pngHack' width='16' height='16'>&nbsp;";
		icone += titre+'</span><div class="tr"></div>';
		this.panel.setHeader(icone);
		try{$("valTitre_"+num).innerHTML = icone}catch(e){}
	}
	
	this.changeSkin = function(nom)
	{
		this.options.skin = nom
		//this.win.setTheme(nom);
	}
	
	this.setPosition = function(top,left,appliquerCoeff,effet)
	{
		try
		{
			if (this.centered) {
				this.panel.center();
				return;
			}
			//YAHOO.util.Dom.setXY(this.panel.element, [left,top]);
			//this.panel.render();
			this.panel.cfg.setProperty('y', top);
			this.panel.cfg.setProperty('x', left);
			//this.panel.show();
		}
		catch(e){alert("Erreur dans setPosition : "+e.message)};
	}
	
	this.setSize = function(width,height)
	{
		try
		{
			var divResize = this.resize.getWrapEl();
			YAHOO.util.Dom.setStyle(divResize, 'height', height + 'px');
			YAHOO.util.Dom.setStyle(divResize, 'width', width + 'px');
			this.panel.cfg.setProperty('width', width+'px');
			this.panel.cfg.setProperty('height', height+'px');
	
			
			
			
			
			YAHOO.util.Dom.setStyle(this.panel.innerElement, 'height', height + 'px');
			var bodyHeight = (height - this.panel.header.offsetHeight - this.panel.footer.offsetHeight);
			var bodyContentHeight = (IE_QUIRKS) ? bodyHeight : bodyHeight - this.tabPaddingPanel[this.options.skin];
			YAHOO.util.Dom.setStyle(this.panel.body, 'height', bodyContentHeight + 'px');
			if (YAHOO.env.ua.ie>0) width -= this.tabPaddingPanel[this.options.skin];
			YAHOO.util.Dom.setStyle(this.panel.innerElement, 'width', width + 'px');
			if (YAHOO.env.ua.ie > 0) {
				YAHOO.util.Dom.setStyle(this.panel.header, 'width', (width+ this.tabPaddingPanelWidth[this.options.skin]) + 'px');
				YAHOO.util.Dom.setStyle(this.panel.body, 'width', width + 'px');
				YAHOO.util.Dom.setStyle(this.panel.footer, 'width', width + 'px');
			}
			
			
			/*
			var panelHeight = height;
            var headerHeight = this.panel.header.offsetHeight; // Content + Padding + Border
            var footerHeight = this.panel.footer.offsetHeight; // Content + Padding + Border
            var bodyHeight = (panelHeight - headerHeight - footerHeight); 
            var bodyContentHeight = (IE_QUIRKS) ? bodyHeight : bodyHeight - tabPaddingPanel[this.options.skin];
            YAHOO.util.Dom.setStyle(this.panel.body, 'height', bodyContentHeight + 'px');

            if (YAHOO.env.ua.ie > 0) {    
	            var panelWidth = width - tabPaddingPanel[this.options.skin];
            	YAHOO.util.Dom.setStyle(this.panel.header, 'width', (panelWidth + this.panel.header.firstChild.offsetWidth) + 'px');
            	YAHOO.util.Dom.setStyle(this.panel.body, 'width', panelWidth + 'px');
            	YAHOO.util.Dom.setStyle(this.panel.footer, 'width', panelWidth + 'px');
        	}
        	*/
        	
            if (IE_SYNC) {
                this.panel.sizeUnderlay();
                this.panel.syncIframe();
            }
		}
		catch(e){
			//alert("Erreur dans le redimmensionnement de la fenetre "+this.num + " : "+e.message)
		};
	}
	
}
/***********************************************************************************************/
/***********************************************************************************************/














/***********************************************************************************************/
/****************************************** WIDGET OLAP ****************************************/
/***********************************************************************************************/
function widgetPersoOLAP(num,options)
{
	if ((options.TotauxLigne)&&(options.TotauxLigne=='1'))
		options.totaux_row = "on";
	if ((options.TotauxColonne)&&(options.TotauxColonne=='1'))	
		options.totaux_col = "on";

	if (options.MaxRowsExtract && options.TotauxColonne!='') {}
	else
		options.MaxRowsExtract = '';
	
    widgetPersoBase.call(this,num,options); //super(nom)
    this.type = "olap";
    this.tabView = null;
    this.chParam = "";
	for (i in options) {
		this.chParam += i+"="+options[i]+"&";
	}
	
	this.detacher = function()
	{
		try {
			$("ckAffiche_"+num).checked = false;
			$("ckAffiche_"+num).disabled = true;
			var ladivContain = idDivContentFullPage;
			if (this.options.containerFull && this.options.containerFull !='' && $(this.options.containerFull))
				ladivContain = this.options.containerFull;
			if (ladivContain==idDivContentFullPage) {
				$(ladivContain).appendChild(document.createElement('br'));
				$(ladivContain).appendChild(document.createElement('br'));
			}
			$(ladivContain).appendChild(this.panel.body.firstChild);
			
			this.panel.hide();
		}
		catch(e){alert(e.message)}
	}
	
	
	this.ajouterChamp = function(formulaire,nom,valeur){
		var newChamp = document.createElement('input');
		newChamp.type = "hidden";
		newChamp.name = nom;
		newChamp.value = valeur;
		formulaire.appendChild(newChamp);
	}
    
	this.creerWidget = function()
	{
		this.creerWindowFenetre();
		
		if ((this.options.onlyChart == undefined)||(this.options.onlyChart != '1')) {
			
			
			// Affichage normal : 2 ou 3 onglets
			var divWindow = document.createElement('div');
			divWindow.id = "divWindow"+num;
			divWindow.style.fontWeight = "normal";
			var frmInput = document.createElement('form');
			frmInput.id = "frmInput"+num;
			frmInput.method = "post";
			var divTabWindow = document.createElement('div');
			divTabWindow.id = "divTabWindow"+num;
			
			
			
			var divTab1 = document.createElement('div');
			var d_SearchContainer = document.createElement('div');
			d_SearchContainer.id = "d_SearchContainer"+num;
			divTab1.appendChild(d_SearchContainer);
			divTabWindow.appendChild(divTab1);
			
			
			var divTab2 = document.createElement('div');
			var d_ResultContainer = document.createElement('div');
			d_ResultContainer.id = "d_ResultContainer"+num;
			divTab2.appendChild(d_ResultContainer);
			divTabWindow.appendChild(divTab2);
			
			
			if (this.options.Extraction=='1') {
				var divTab3 = document.createElement('div');
				divTab3.className = "dhtmlgoodies_aTab";
				var d_DetailContainer = document.createElement('div');
				d_DetailContainer.id = "d_DetailContainer"+num;
				divTab3.appendChild(d_DetailContainer);
				divTabWindow.appendChild(divTab3);
			}
			
			
			frmInput.appendChild(divTabWindow);
			divWindow.appendChild(frmInput);
			$(idDivContentFullPage).appendChild(divWindow);
			
			
			var tabView = new YAHOO.widget.TabView();
			
			var disSearch = true;
			if (this.options.AllowSearch && this.options.AllowSearch=='1')
				disSearch=false;
			
		    tabView.addTab( new YAHOO.widget.Tab({
		        label: imgTabSearch + t_titreSearch,
		        contentEl: $("d_SearchContainer"+num),
		        disabled :disSearch,
		        active: false
		    }));
		    
		    
		    tabView.addTab( new YAHOO.widget.Tab({
		        label: imgTabResult + t_titreResult,
		        contentEl: $("d_ResultContainer"+num),
		        active: true
		    }));
		    if (this.options.Extraction=='1') {
			    tabView.addTab( new YAHOO.widget.Tab({
			        label: imgTabDetail + t_titreDetail,
			        contentEl: $("d_DetailContainer"+num),
			        active: false
			    }));
		    }
		    
		    this.tabView = tabView;
		    tabView.appendTo('divTabWindow'+num);
		}
		else {
			// Affichage de graph seulement
			var divWindow = document.createElement('div');
			divWindow.id = "divWindow"+num;
			
			if (this.options.TitleQuery && this.options.TitleQuery.trim()!='') {
				var divTitle = document.createElement('div');
				divTitle.className = 'fake_editable';
				divTitle.innerHTML = this.options.TitleQuery.trim()+'<br/><br/>';
				divWindow.appendChild(divTitle);
			}
			
			var divGraph = document.createElement('div');
			divGraph.id = "containsIMG"+num;
			divWindow.appendChild(divGraph)
			var frmInput = document.createElement('form');
			frmInput.id = "frmInput"+num;
			frmInput.method = "post";
			this.ajouterChamp(frmInput,'Cube',this.options.Cube);
			this.ajouterChamp(frmInput,'Serveur',this.options.Serveur);
			this.ajouterChamp(frmInput,'DataBase',this.options.DataBase);
			this.ajouterChamp(frmInput,'sizeGraph',this.options.tailleGraph);
			this.ajouterChamp(frmInput,'typeGraph',this.options.typeGraph);
			this.ajouterChamp(frmInput,'strMDX_EC',this.options.defMDX);
			
			
			divWindow.appendChild(frmInput);
			$(idDivContentFullPage).appendChild(divWindow);
			
		}
		
		this.panel.appendToBody($("divWindow"+num));
	}
	
	
	this.chargerContenu = function()
	{
		this.chargee = true;
		
		
		
		if ((this.options.onlyChart == undefined)||(this.options.onlyChart != '1')) {
			var param = encodeURI("idWebArea="+idWebArea+"&"+this.chParam);		
			trAjax('d_SearchContainer'+options.numFen,fichierXML_Search, fichierXSL_Search, "post", encodeURI("idWebArea="+idWebArea+"&"+this.chParam),true,loadingHTML);
			YAHOO.util.Event.onAvailable("divSearchCharge_"+this.num, function() {
				trAjax('d_ResultContainer'+options.numFen,fichierXML_Result, fichierXSL_Result, "post", param,true,loadingHTML);
			});
			
		}
		else {
			$('containsIMG'+num).innerHTML = "";
			var param = "";
			param += "numFen="+num;
			param += "&chMDX="+this.options.defMDX;
			param += "&Serveur="+this.options.Serveur;
			param += "&DataBase="+this.options.DataBase;
			param += "&Cube="+this.options.Cube;
			param += "&size="+this.options.tailleGraph;
			param += "&page="+1;
			genereGraphSimple(num,this.options.typeGraph,param)
		}
		
		
		if (this.options.full=='1')
			this.detacher();
		
	}
}
/***********************************************************************************************/
/***********************************************************************************************/









/***********************************************************************************************/
/*************************************** WIDGET DE WRAP ****************************************/
/***********************************************************************************************/
function widgetPersoWRAP(num,options)
{
	widgetPersoBase.call(this,num,options);
	
	this.creerWidget = function()
	{
		for (var cle in this.tabPaddingPanel) {
			this.tabPaddingPanel[cle] = 0;
		}
		for (var cle in this.tabPaddingPanelWidth) {
			this.tabPaddingPanelWidth[cle] = 0;
		}
		this.creerWindowFenetre();
		this.panel.body.style.padding='0';
		this.panel.body.style.overflow='hidden';
	}
	
	this.chargerContenu = function()
	{
		this.chargee = true;
		var idDivMenuBar = "menuBarNote_"+num;
		
		if ($(idDivMenuBar))
			$(idDivMenuBar).parentNode.removeChild($(idDivMenuBar));
		
		
		var liframe = document.createElement('iframe');
		liframe.height = "100%";
		liframe.width = "100%";
		liframe.style.width = "100%";
		liframe.style.height = "100%";
		liframe.style.border = "0px solid black";
		liframe.border='0';
		liframe.src = options.URL;
		this.panel.appendToBody(liframe);
		//liframe.parentNode.style.padding='0';
		
		if (this.options.full=='1')
			this.detacher();
	}
	
	
	this.detacher = function()
	{
		try {
			$("ckAffiche_"+num).checked = false;
			$("ckAffiche_"+num).disabled = true;
			var liframe = this.panel.body;
			liframe.height = "100%";
			liframe.width = "100%";
			liframe.style.width = "100%";
			liframe.style.height = "100%";
			var ladivContain = idDivContentFullPage;
			if (this.options.containerFull && this.options.containerFull !='' && $(this.options.containerFull))
				ladivContain = this.options.containerFull;
			$(ladivContain).appendChild(liframe);
			this.panel.hide();
		}
		catch(e){alert(e.message)}
	}
	
	
	
	
	
	
	this.setURL = function(URL)
	{
		this.options.URL = URL
		this.chargerContenu();
	}
	
}
/***********************************************************************************************/
/***********************************************************************************************/







/***********************************************************************************************/
/**************************************** WIDGET DE RSS ****************************************/
/***********************************************************************************************/
function widgetPersoRSS(num,options)
{
	if (options.NbLignes == null) options.NbLignes = "5";
	if (options.Refresh == null) options.Refresh = "5";
	if (options.DisplayDesc == null) options.DisplayDesc = "1";
	if (options.TypeLink == null) options.TypeLink = "_blank";
	if (options.DisplayTitle == null) options.DisplayTitle = "0";
	
	widgetPersoBase.call(this,num,options); 
	
	this.creerWidget = function()
	{
		this.creerWindowFenetre();
		
		var tmpHTML = '';
		if ((options.MenuBar != null)&&(options.MenuBar == '1'))
			tmpHTML += "<div id='toolbarRSS_"+options.numFen+"' class='toolbar'></div>";
		
		tmpHTML += "<div id='divRss_"+options.numFen+"'></div>";
		var divWindow = document.createElement('div');
		divWindow.innerHTML = tmpHTML;
		this.panel.appendToBody(divWindow);
		
		if ((options.MenuBar != null)&&(options.MenuBar == '1')&&($('toolbarRSS_'+options.numFen))) {
			new YAHOO.widget.Button({    
				label:setImgTagXsl(tmpIconPath+'print.png'), 
				id:"printRSS"+options.numFen,    
				container:"toolbarRSS_"+options.numFen
			}).addListener('click', function(){
				printDIV('divRss_'+options.numFen)
			});
			
			new YAHOO.widget.Button({    
				label:setImgTagXsl(tmpIconPath+'reload.png'), 
				id:"reloadRSS"+options.numFen,    
				container:"toolbarRSS_"+options.numFen
			}).addListener('click', function(){
				tabWidget[num].chargerContenu();
			});
			
		}
		
	}
	
	
	this.rechargerRSS = function()
	{
		setTimeout("tabWidget["+num+"].chargerContenu()",new Number(options.Refresh)*60*1000);
		setTimeout("tabWidget["+num+"].rechargerRSS()",new Number(options.Refresh)*60*1000);
	}
	
	this.setNbLignes = function(nb)
	{
		var verif = /^[0-9]+$/;
		if (verif.exec(nb) == null)
			alert(t_msgVerifNumber);
		else
		{
			this.options.NbLignes = nb;
			this.chargerContenu();
		}
	}
	
	this.setURL = function(url)
	{
		this.options.URL = url;
		this.chargerContenu();
	}
	
	
	this.setRefresh = function(nb)
	{
		var verif = /^[0-9]+$/;
		if (verif.exec(nb) == null)
			alert(t_msgVerifNumber);
		else
			this.options.Refresh = nb;
	}
	
	this.changeTypeLink = function(p_type)
	{
		options.TypeLink = p_type
		this.chargerContenu();
	}
	
	
	
	this.setDisplayDesc = function(champs)
	{
		if (champs.checked)
			options.DisplayDesc = "1";
		else
			options.DisplayDesc = "0";
		this.chargerContenu();
	}
	
	this.setDisplayTitle = function(champs)
	{
		if (champs.checked)
			options.DisplayTitle = "1";
		else
			options.DisplayTitle = "0";
		this.chargerContenu();
	}
	
	
	
	this.chargerContenu = function()
	{
		this.chargee = true;
		var param = "";
		param += "rssurl=";
		param += options.URL;
		param += "&rssnb=";
		param += options.NbLignes;
		param += "&rssdesc=";
		param += options.DisplayDesc;
		param += "&rsstitle=";
		param += options.DisplayTitle;
		param += "&rsstypelink=";
		param += options.TypeLink;
		param += "&numFen="+options.numFen;
		trAjax("divRss_"+options.numFen,fichierRSS_XML, fichierRSS_XSL,"get",param,true,loadingHTML);
	}
	
	
	
	
	
	
	
}
/***********************************************************************************************/
/***********************************************************************************************/








/***********************************************************************************************/
/*************************************** WIDGET DE NOTE ****************************************/
/***********************************************************************************************/

function widgetPersoNote(num,options)
{
	widgetPersoBase.call(this,num,options); 
	
	this.creerWidget = function()
	{
		this.creerWindowFenetre();
	}
	
	this.chargerContenu = function()
	{
		this.chargee = true;
		var divWindow = document.createElement('div');
		var htmlContent = "";
		if ((options.MenuBar != null)&&(options.MenuBar == '1'))
			htmlContent += '<div id="menuBarNote_'+num+'" class="toolbar"></div>';
		
		var marquee = "";
		var finmarquee = "";
		if ((options.Defil != null)&&(options.Defil == '1')) {
			var marquee = '<marquee id="marquee_'+this.num+'" onmouseover="this.stop()" onmouseout="this.start()" scrollAmount="2" direction="up" align="left"';
			if ((options.DefilHeight != null)&&(options.DefilHeight != '')) 
				marquee += ' height="'+options.DefilHeight+'"';
			marquee += '>';
			var finmarquee = '</marquee>';
		}
		
		htmlContent += marquee +'<div id="contenuNote_'+num+'">'+options.Contenu+'</div>'+finmarquee;
		divWindow.innerHTML = htmlContent;
		this.panel.appendToBody(divWindow);
		
		
		if ((options.MenuBar != null)&&(options.MenuBar == '1')) {
			new YAHOO.widget.Button({    
					label:setImgTagXsl(tmpIconPath+'print.png'), 
					id:"printNote"+options.numFen,    
					container:"menuBarNote_"+options.numFen
				}).addListener('click', function(){
					printDIV('contenuNote_'+num);
				});
		}
		
		if (this.options.full=='1')
			this.detacher();
			
		if ($('marquee_'+this.num))
			$('marquee_'+this.num).start();
	}
	
	
	this.detacher = function()
	{
		try {
			$("ckAffiche_"+num).checked = false;
			$("ckAffiche_"+num).disabled = true;
			var w_div = document.createElement('div');
			w_div.innerHTML = this.panel.body.innerHTML;
			var ladivContain = idDivContentFullPage;
			if (this.options.containerFull && this.options.containerFull !='' && $(this.options.containerFull))
				ladivContain = this.options.containerFull;
			$(ladivContain).appendChild(w_div);
			this.panel.hide();
		}
		catch(e){alert(e.message)}
	}
}

/***********************************************************************************************/
/***********************************************************************************************/






/***********************************************************************************************/
/*************************************** WIDGET DE NOTE ****************************************/
/***********************************************************************************************/
function widgetPersoNetvibes(num,options)
{
	widgetPersoBase.call(this,num,options); 
	
	this.creerWidget = function()
	{
		this.creerWindowFenetre();
	}
	
	this.chargerContenu = function()
	{
		var trouve = false;
		var sauvI = 0;
		var t_scripts = document.getElementsByTagName('head')[0].getElementsByTagName('script');
		for (var i=0; i<t_scripts.length; i++) {
			if (t_scripts[i].src.search(fichierJSNetvibes) > -1) {
				trouve = true;
				sauvI = i;
			}
		}
		if (!trouve) {
			var sc = document.createElement('script');
		    sc.type='text/javascript';
		    sc.src = pathJSNetvibes;
		    var func = new Function("e","tabWidget["+num+"].afficheContenu()");
			YAHOO.util.Event.addListener(sc, "load", func);
		    document.getElementsByTagName('head')[0].appendChild(sc);
		}
		if (trouve) {
			if ((typeof(netvibesFileLoaded) != 'undefined') && netvibesFileLoaded)
				this.afficheContenu();
			else {
				var func = new Function("e","tabWidget["+num+"].afficheContenu()");
				YAHOO.util.Event.addListener(t_scripts[sauvI], "load", func);
			}
		}
	}
	
	
	this.afficheContenu = function()
	{
		this.chargee = true;
		var divWindow = document.createElement('div');
		var htmlContent = "";
		
		htmlContent += '<div id="contenuNetvibes_'+num+'"></div>';
		divWindow.innerHTML = htmlContent;
		this.panel.appendToBody(divWindow);
		
		
		if (this.options.URL && this.options.URL !='') {
			if (typeof(UWA) != 'undefined') {
				var BW = new UWA.BlogWidget({
					//inline: true,
					container: $('contenuNetvibes_'+this.num),
					moduleUrl: this.options.URL
				});
				BW.setConfiguration({
					'title':'',
					'height':'100%',
					'borderWidth':'0', 
					'color':'#aaaaaa',
					'displayTitle':false,
					'displayFooter':false
				});
				
				var tab = this.panel.body.getElementsByTagName('*');
				for (var i=0; i<tab.length; i++) {
					tab[i].style.height = '100%';
				}
			}
			else {
				var html_error = "<div style='text-align:center'><br/><br/>";
				html_error += "<img src='/common/img/error.gif'/><br/>"
				html_error += msg_ErrorInternet
				html_error += "</div>"
				$('contenuNetvibes_'+this.num).innerHTML = html_error;
			}
		}
		
		if (this.options.full=='1')
			this.detacher();
	}
	
	
	this.detacher = function()
	{
		try {
			$("ckAffiche_"+num).checked = false;
			$("ckAffiche_"+num).disabled = true;
			var w_div = document.createElement('div');
			w_div.innerHTML = this.panel.body.innerHTML;
			var ladivContain = idDivContentFullPage;
			if (this.options.containerFull && this.options.containerFull !='' && $(this.options.containerFull))
				ladivContain = this.options.containerFull;
			$(ladivContain).appendChild(w_div);
			this.panel.hide();
		}
		catch(e){alert(e.message)}
	}
	
	
}
/***********************************************************************************************/
/***********************************************************************************************/















/***********************************************************************************************/
/************************************** WIDGET DE VIDEO ****************************************/
/***********************************************************************************************/
function widgetPersoVideo(num,options)
{
	widgetPersoBase.call(this,num,options); 
	
	this.creerWidget = function()
	{
		this.creerWindowFenetre();
	}
	
	this.chargerContenu = function()
	{
		this.chargee = true;
		
		
		
		
		var theHTML = '<div id="contenuVideo_'+num+'" style="width:100%; height:100%; border:0px solid red">';
		if (this.options.pathVideo != '') {
			
			urlVid = this.options.pathVideo;
			
			// Cas SWF normal
			if (urlVid.toLowerCase().search(".flv") == -1) {
				theHTML += "<object type=\"application/x-shockwave-flash\" data=\""+urlVid+"\" width=\"100%\" height=\"100%\" wmode=\"transparent\" startAutoPlay=\"false\">";
				theHTML += "<param name=\"movie\" value=\""+urlVid+"\"/>";
				theHTML += "<param name=\"startAutoPlay\" value=\"false\"/>";
				theHTML += "</object>";
			}
			else {
				var urlVidOptions = urlVid;
				//urlVidOptions += "&title=totooooooo";
				
				if (YAHOO.env.ua.ie>0) {
					urlVidOptions += "&width=100%";
					urlVidOptions += "&height=100%";
				}
				
				urlVidOptions += "&showstop=1";
				urlVidOptions += "&showvolume=1";
				urlVidOptions += "&showtime=1";
				urlVidOptions += "&showloading=always";
				urlVidOptions += "&showplayer=always";
				urlVidOptions += "&showfullscreen=1";
				urlVidOptions += "&autoload=1";
				urlVidOptions += "&ondoubleclick=fullscreen";
				urlVidOptions += "&showiconplay=1";
				urlVidOptions += "&bgcolor=ffffff";
				urlVidOptions += "&buttonovercolor=25ff25";
				urlVidOptions += "&sliderovercolor=25ff25";
				urlVidOptions += "&loadingcolor=25ff25";
				
				// Cas FLV
				theHTML += "<object type=\"application/x-shockwave-flash\" data=\"/webarea/videos/player.swf\" width=\"100%\" height=\"100%\">";
				theHTML += "<param name=\"movie\" value=\"/webarea/videos/player.swf\" />"
				theHTML += "<param value=\"true\" name=\"allowFullScreen\"/>";
				theHTML += "<param name=\"FlashVars\" value=\"flv="+urlVidOptions+"\" />"
				theHTML += "</object>";
			}
		}			
		
		
		// Cas YOUTUBE
		if (this.options.idVideo != '') {
			var idVid = this.options.idVideo;
			theHTML += "<object type=\"application/x-shockwave-flash\" data=\"http://www.youtube.com/v/"+idVid+"\" width=\"100%\" height=\"100%\" wmode=\"transparent\">";
			theHTML += "<param name=\"movie\" value=\"http://www.youtube.com/v/"+idVid+"\"/>";
			theHTML += "</object>";
		}
		theHTML += '</div>';
		
		var divWindow = document.createElement('div');
		divWindow.style.height='100%';
		divWindow.innerHTML = theHTML;
		this.panel.appendToBody(divWindow);
		
		
		
		
		
 		if (this.options.full=='1')
			this.detacher();
	}
	
	
	this.detacher = function()
	{
		try {
			$("ckAffiche_"+num).checked = false;
			$("ckAffiche_"+num).disabled = true;
			var w_div = document.createElement('div');
			w_div.innerHTML = this.panel.body.innerHTML;
			var ladivContain = idDivContentFullPage;
			if (this.options.containerFull && this.options.containerFull !='' && $(this.options.containerFull))
				ladivContain = this.options.containerFull;
			$(ladivContain).appendChild(w_div);
			this.panel.hide();
		}
		catch(e){alert(e.message)}
	}
	
	
}
/***********************************************************************************************/
/***********************************************************************************************/
						
		









/***********************************************************************************************/
/************************************** WIDGET DE EXCEL ****************************************/
/***********************************************************************************************/
function widgetPersoExcel(num,options)
{
	widgetPersoBase.call(this,num,options); 
	
	this.creerWidget = function()
	{
		this.creerWindowFenetre();
	}
	
	this.chargerContenu = function()
	{
		this.chargee = true;
		
		
		var theHTML = "";
		
		if ((options.MenuBar != null)&&(options.MenuBar == '1'))
			theHTML += '<div id="menuBarExcel_'+num+'" class="toolbar"></div><br/>';
		
			
			
		if ((options.MenuBar != null)&&(options.MenuBar == '1')) {
			
			
			
			if ((options.Download != null)&&(options.Download == '1')) {
				new YAHOO.widget.Button({    
					label:setImgTagXsl(tmpIconPath+'excel.png'),
					container:"menuBarExcel_"+options.numFen
				}).addListener('click', function(){
					tabWidget[num].download();
				});
			}
			
			
			new YAHOO.widget.Button({    
				label:setImgTagXsl(tmpIconPath+'print.png'),
				container:"menuBarExcel_"+options.numFen
			}).addListener('click', function(){
				printDIV('contenuExcel_'+num);
			});
			
			this.buttonMaskHeaderH = new YAHOO.widget.Button({
				id:'buttonMaskHeaderH_'+num,
				type:'checkbox',
				label:setImgTagXsl(tmpIconPath+'masque_header_h.png'),
				container:"menuBarExcel_"+options.numFen
			})
			
			
			this.buttonMaskHeaderH.addListener('click', function(){
				tabWidget[num].traiteEnteteH(this.get('checked'));
			});
			
			
			this.buttonMaskHeaderV = new YAHOO.widget.Button({
				id:'buttonMaskHeaderV_'+num,
				type:'checkbox',
				label:setImgTagXsl(tmpIconPath+'masque_header_v.png'),
				container:"menuBarExcel_"+options.numFen
			})
			
			this.buttonMaskHeaderV.addListener('click', function(){
				tabWidget[num].traiteEnteteV(this.get('checked'));
			});
		}
		
		
		theHTML += '<div id="contenuExcel_'+num+'">'+loadingHTML+'</div>';
		if (this.options.pathFile != '') {
			var sUrl = fichierReadExcel+"?numFen="+num+"&pathFile="+this.options.pathFile;
			
			var callback = {
				success: function(oResponse) {
					if ($('contenuExcel_'+num)) {
						$('contenuExcel_'+num).innerHTML = "";
						$('contenuExcel_'+num).innerHTML = oResponse.responseText;
						if ($('divTab_'+num)) {
							var tabView = new YAHOO.widget.TabView('divTab_'+num);
							
							if (options.maskHeaderH && options.maskHeaderH=='1')
								tabWidget[num].traiteEnteteH(true);
								
							if (options.maskHeaderV && options.maskHeaderV=='1')
								tabWidget[num].traiteEnteteV(true);
						}
					}
				},
				failure: function(oResponse) {
					alert("Erreur de chargement Excel");
					if ($('contenuExcel_'+num))
						$('contenuExcel_'+num).innerHTML = "";
				},
				timeout: 7000
			};
			YAHOO.util.Connect.asyncRequest('GET', sUrl, callback);
		
		}
		
		
		
		
		
		
		var divWindow = document.createElement('div');
		divWindow.style.height='100%';
		divWindow.innerHTML = theHTML;
		this.panel.appendToBody(divWindow);
		
 		if (this.options.full=='1')
			this.detacher();
	}
	
	
	this.traiteEnteteH = function(masque) {
		if ($('divTab_'+num)) {
			YAHOO.util.Dom.getElementsByClassName('rowEnteteH','tr',$('divTab_'+num),function(cell){
				cell.style.display=(masque==true?'none':'');
			});
			if ($('buttonMaskHeaderH_'+num) != null)
				this.buttonMaskHeaderH.set('checked',masque);
		}
	}
	
	this.traiteEnteteV = function(masque) {
		if ($('divTab_'+num)) {
			YAHOO.util.Dom.getElementsByClassName('enteteV','td',$('divTab_'+num),function(cell){
				cell.style.display=(masque==true?'none':'');
			});
			if ($('buttonMaskHeaderV_'+num) != null)
				this.buttonMaskHeaderV.set('checked',masque);
		}
	}
	
	
	this.download = function() {
		if (this.options.pathFile != '')
			window.open(this.options.pathFile);
	}
	
	
	this.detacher = function()
	{
		try {
			$("ckAffiche_"+num).checked = false;
			$("ckAffiche_"+num).disabled = true;
			var w_div = document.createElement('div');
			w_div.innerHTML = this.panel.body.innerHTML;
			var ladivContain = idDivContentFullPage;
			if (this.options.containerFull && this.options.containerFull !='' && $(this.options.containerFull))
				ladivContain = this.options.containerFull;
			$(ladivContain).appendChild(w_div);
			this.panel.hide();
		}
		catch(e){alert(e.message)}
	}
}
/***********************************************************************************************/
/***********************************************************************************************/
						







/***********************************************************************************************/
/*************************************** WIDGET DE SQL ****************************************/
/***********************************************************************************************/
function widgetPersoSQL(num,options)
{
	widgetPersoBase.call(this,num,options); 
	this.chParam = "";
	for (i in options) {
		this.chParam += i+"="+options[i]+"&";
	}
	
	
	this.creerWidget = function()
	{
		this.creerWindowFenetre();
		
		var divWindow = document.createElement('div');
		divWindow.id = "divWindow"+num;
		divWindow.style.fontWeight = "normal";
		var frmInput = document.createElement('form');
		frmInput.id = "frmInput"+num;
		frmInput.method = "post";
		frmInput.action = "javascript:void(0);"
		frmInput.onsubmit = function(){return false;}
		var divTabWindow = document.createElement('div');
		divTabWindow.id = "divTabWindow"+num;
		var divTab1 = document.createElement('div');
		var divTab2 = document.createElement('div');
		var d_SearchContainer = document.createElement('div');
		d_SearchContainer.style.height = "100%";
		d_SearchContainer.id = "d_SearchContainer"+num;
		
		var d_ResultContainer = document.createElement('div');
		d_ResultContainer.id = "d_ResultContainer"+num;
		
		divTab1.appendChild(d_SearchContainer);
		divTab2.appendChild(d_ResultContainer);
		divTabWindow.appendChild(divTab1);
		divTabWindow.appendChild(divTab2);
		
		frmInput.appendChild(divTabWindow);
		divWindow.appendChild(frmInput);
		$(idDivContentFullPage).appendChild(divWindow);
		
		
		var tabView = new YAHOO.widget.TabView();
	    tabView.addTab( new YAHOO.widget.Tab({
	        label: imgTabSearch + t_titreSearch,
	        contentEl: $("d_SearchContainer"+num),
	        active: false
	    }));
	    tabView.addTab( new YAHOO.widget.Tab({
	        label: imgTabResult + t_titreResult,
	        contentEl: $("d_ResultContainer"+num),
	        active: true
	    }));
	    this.tabView = tabView;
	    tabView.appendTo('divTabWindow'+num);
		this.panel.appendToBody($("divWindow"+num));
		
	}
	
	this.chargerContenu = function()
	{
		this.chargee = true;
		trAjax('d_SearchContainer'+options.numFen,fichierSQL_XML_Search, fichierSQL_XSL_Search, "post", encodeURI("idWebArea="+idWebArea+"&"+this.chParam),true);
		trAjax('d_ResultContainer'+options.numFen,fichierSQL_XML_Result, fichierSQL_XSL_Result, "post", encodeURI("rqtdef=1&idWebArea="+idWebArea+"&"+this.chParam),true);
		
		if (this.options.full=='1')
			this.detacher();
	}
	
	
	this.detacher = function()
	{
		try {
			$("ckAffiche_"+num).checked = false;
			$("ckAffiche_"+num).disabled = true;
			var ladivContain = idDivContentFullPage;
			if (this.options.containerFull && this.options.containerFull !='' && $(this.options.containerFull))
				ladivContain = this.options.containerFull;
				
			if (ladivContain==idDivContentFullPage) {
				$(ladivContain).appendChild(document.createElement('br'));
				$(ladivContain).appendChild(document.createElement('br'));
			}
			$(ladivContain).appendChild(this.panel.body.firstChild);
			
			this.panel.hide();
		}
		catch(e){"Erreur dans le détachement du widget "+num+" : "+alert(e.message)}
	}
	
	
}
/***********************************************************************************************/
/***********************************************************************************************/





/***********************************************************************************************/
/****************************************** WIDGET AJAX ****************************************/
/***********************************************************************************************/
function widgetPersoAJAX(num,options)
{
	widgetPersoBase.call(this,num,options); 
	
	this.creerWidget = function()
	{
		this.creerWindowFenetre();
	}
	
	this.chargerContenu = function()
	{
		this.chargee = true;
		var divWindow = document.createElement('div');
		var htmlContent = "";
		htmlContent += '<div id="contenuWidgetAjax_'+num+'">'+loadingHTML+'</div>';
		divWindow.innerHTML = htmlContent;
		this.panel.appendToBody(divWindow);
		
		
		if (this.options.pathFile && this.options.pathFile != '') {
			var callback = {
				success: function(oResponse) {
					if (options.typeResult && options.typeResult=='html') {
						if ($('contenuWidgetAjax_'+num))
							$('contenuWidgetAjax_'+num).innerHTML = oResponse.responseText;
					}
					if (options.typeResult && options.typeResult=='js') {
						if ($('contenuWidgetAjax_'+num))
							$('contenuWidgetAjax_'+num).innerHTML = "";
						eval(oResponse.responseText);
					}
				},
				failure: function(oResponse) {
					if ($('contenuWidgetAjax_'+num))
						$('contenuWidgetAjax_'+num).innerHTML = "Erreur de chargement du fichier AJAX";
				},
				timeout: 7000
			};
			var param = "";
			if (this.options.paramURL && this.options.paramURL!="")
				param = this.options.paramURL;
			YAHOO.util.Connect.asyncRequest('POST', this.options.pathFile, callback, param);
		}
		
		if (this.options.full=='1')
			this.detacher();
	}
	
	
	this.detacher = function()
	{
		try {
			$("ckAffiche_"+num).checked = false;
			$("ckAffiche_"+num).disabled = true;
			var w_div = document.createElement('div');
			w_div.innerHTML = this.panel.body.innerHTML;
			var ladivContain = idDivContentFullPage;
			if (this.options.containerFull && this.options.containerFull !='' && $(this.options.containerFull))
				ladivContain = this.options.containerFull;
			$(ladivContain).appendChild(w_div);
			this.panel.hide();
		}
		catch(e){alert(e.message)}
	}
	
}
/***********************************************************************************************/
/***********************************************************************************************/








/***********************************************************************************************/
/************************************* WIDGET INTERDITE ****************************************/
/***********************************************************************************************/
function widgetPersoForbidden(num,options)
{
	widgetPersoBase.call(this,num,options); 
	
	this.creerWidget = function()
	{
		this.creerWindowFenetre();
	}
	
	this.chargerContenu = function()
	{
		this.chargee = true;
		var divWindow = document.createElement('div');
		var htmlContent = "";
		htmlContent += '<div id="contenuForbidden_'+num+'" style="font-weight:bold">';
		htmlContent += '<center><br/><br/><br/>'+g_txtForbidden+'<br/><br/>';
		htmlContent += '<img src="/common/img/accessDenied.gif"/></center></div>';
		divWindow.innerHTML = htmlContent;
		this.panel.appendToBody(divWindow);
		if (this.options.full=='1')
			this.detacher();
	}
	
	
	this.detacher = function()
	{
		try {
			$("ckAffiche_"+num).checked = false;
			$("ckAffiche_"+num).disabled = true;
			var w_div = document.createElement('div');
			w_div.innerHTML = this.panel.body.innerHTML;
			var ladivContain = idDivContentFullPage;
			if (this.options.containerFull && this.options.containerFull !='' && $(this.options.containerFull))
				ladivContain = this.options.containerFull;
			$(ladivContain).appendChild(w_div);
			this.panel.hide();
		}
		catch(e){alert(e.message)}
	}
	
	this.setInvisible = function()
	{
		this.panel.hide();
		$('ckAffiche_'+this.num).parentNode.parentNode.style.display = 'none';
	}
	
	
}
/***********************************************************************************************/
/***********************************************************************************************/





function getOptionsSelect(optionDefault,tableau)
{
	var chOptions = "";
	for (var i=0; i<tableau.length; i++)
	{
		if (optionDefault!=tableau[i][0])
			chOptions += "<option value='"+tableau[i][0]+"'>"+tableau[i][1]+"</option>";
		else
			chOptions += "<option selected='selected' value='"+tableau[i][0]+"'>"+tableau[i][1]+"</option>";
	}
	return chOptions;
}








function addWidget()
{
	var v_titre = $('newWidget_title').value;
	var v_url = $('newWidget_url').value;
	var v_type = $('newWidget_type').value;
	calculPositionNewFen();
	var newIdWin = R_Login + (new Date().valueOf());

	
	
	var numFen = tabWidget.length;
	switch(v_type)
	{
		case "wrap":
			theWidget = new widgetPersoWRAP(numFen,{
				skin:skinDefault
				,type:v_type
				,edit: true
				,close: true
				,redim: true
				,move: true
				,maxi: true
				,mini: true
				,Title:v_titre
				,idWin:newIdWin
				,numFen:numFen
				,URL: v_url
				});
			break;
		case "rss":
			theWidget = new widgetPersoRSS(numFen,{
				skin:skinDefault
				,type:v_type
				,edit: true
				,close: true
				,redim: true
				,move: true
				,maxi: true
				,mini: true
				,Title:v_titre
				,idWin:newIdWin
				,numFen:numFen
				,URL: v_url
				,NbLignes:5
				,CSS:""
				,TypeLink:"_blank"
				,DisplayDesc:"1"
				,DisplayTitle:"1"
				,Refresh:"5"
				});
			break;
	}
	tabWidget[numFen] = theWidget;
	theWidget.creerWidget();
	theWidget.setSize('300','300',false,false);
	theWidget.setPosition(global_Header_height,global_left_Content,false,false);
	insererLigneParam(numFen,v_titre,newIdWin,v_type,v_url);
	affichWin(numFen);
	
	
}


function insererLigneParam(numFen,titre,newIdWin,v_type,v_url)
{
	
	// RAJOUT DE LA LIGNE DANS LE PANNEAU DE CONFIGURATION
	laTable = $('tabParam');
	
	var newRow = document.createElement('tr');
	newRow.id = "rowParam_"+numFen;
	var newLine = document.createElement('td');
	newLine.innerHTML = new Number(numFen)+1;
	newRow.appendChild(newLine);
	
	newLine = document.createElement('td');
	var newCk = document.createElement('input');
	newCk.type="checkbox";
	newCk.name = "ckAffiche_"+numFen;
	newCk.id = "ckAffiche_"+numFen;
	newCk.value = numFen;
	newCk.onclick = new Function("e","affichWin("+numFen+")");
	newLine.appendChild(newCk);
	newRow.appendChild(newLine);
	
	newLine = document.createElement('td');
	newLine.id = "valTitre_"+numFen;
	newLine.innerHTML = titre;
	newRow.appendChild(newLine);
	
	
	newLine = document.createElement('td');
	newLine.innerHTML = "<img src='/common/img/bt_del_1.gif' style='cursor:pointer' onclick='deleteWidgetPerso("+numFen+")'/>";
	newRow.appendChild(newLine);							
								
	newRow.appendChild(newLine);
	
	laTable.tBodies[0].appendChild(newRow);
	newCk.checked = true;
	
	
	// RAJOUT DES CHAMPS NECESSAIRES A L'ENREGISTREMENT
	var newInput = document.createElement('input');
	newInput.name = "IdFen_"+numFen;
	newInput.id = "IdFen_"+numFen;
	newInput.value = newIdWin;
	newInput.type = "hidden";
	$('f_sauvegarde').appendChild(newInput);
	
	var newInput = document.createElement('input');
	newInput.name = "VisibilityFen_"+numFen;
	newInput.id = "VisibilityFen_"+numFen;
	newInput.type = "hidden";
	$('f_sauvegarde').appendChild(newInput);
	
	var newInput = document.createElement('input');
	newInput.name = "xFen_"+numFen;
	newInput.id = "xFen_"+numFen;
	newInput.type = "hidden";
	$('f_sauvegarde').appendChild(newInput);
	
	var newInput = document.createElement('input');
	newInput.name = "yFen_"+numFen;
	newInput.id = "yFen_"+numFen;
	newInput.type = "hidden";
	$('f_sauvegarde').appendChild(newInput);
	
	var newInput = document.createElement('input');
	newInput.name = "wFen_"+numFen;
	newInput.id = "wFen_"+numFen;
	newInput.type = "hidden";
	$('f_sauvegarde').appendChild(newInput);
	
	var newInput = document.createElement('input');
	newInput.name = "hFen_"+numFen;
	newInput.id = "hFen_"+numFen;
	newInput.type = "hidden";
	$('f_sauvegarde').appendChild(newInput);
	
	var newInput = document.createElement('input');
	newInput.name = "TypeFen_"+numFen;
	newInput.id = "TypeFen_"+numFen;
	newInput.value = v_type;
	newInput.type = "hidden";
	$('f_sauvegarde').appendChild(newInput);
			
	var newInput = document.createElement('input');
	newInput.name = "EtatFen_"+numFen;
	newInput.id = "EtatFen_"+numFen;
	newInput.type = "hidden";
	$('f_sauvegarde').appendChild(newInput);
	
	var newInput = document.createElement('input');
	newInput.name = "SkinFen_"+numFen;
	newInput.id = "SkinFen_"+numFen;
	newInput.type = "hidden";
	$('f_sauvegarde').appendChild(newInput);
	
	var newInput = document.createElement('input');
	newInput.name = "TitreFen_"+numFen;
	newInput.id = "TitreFen_"+numFen;
	newInput.type = "hidden";
	$('f_sauvegarde').appendChild(newInput);
	
	var newInput = document.createElement('input');
	newInput.name = "OrigineFen_"+numFen;
	newInput.id = "OrigineFen_"+numFen;
	newInput.value = "perso";
	newInput.type = "hidden";
	$('f_sauvegarde').appendChild(newInput);
	
	var newInput = document.createElement('input');
	newInput.name = "URLFen_"+numFen;
	newInput.id = "URLFen_"+numFen;
	newInput.value = v_url;
	newInput.type = "hidden";
	$('f_sauvegarde').appendChild(newInput);
	
	
	$('nbFen').value = new Number($('nbFen').value)+1;
}



function deleteWidgetPerso(numFen)
{
	if (confirm(t_msgConfirmDelPerso))
	{
		tabWidget[numFen].panel.hide();
		tabWidget[numFen] = null;
		$('rowParam_'+numFen).parentNode.removeChild($('rowParam_'+numFen));
		$('IdFen_'+numFen).value = "";
	}
	
}





