function newWindows(windowsname)
{
	if(windowsname!='_blank')
	{
		var param = ""; // (0=non 1=oui) (yes=oui no=non)
		param += 'location=0,'; // barre d'adresse
		param += 'status=0,'; // barre d'�tat (FF interdit de la supprimer)
		param += 'scrollbars=1,'; // les ascenseurs
		param += 'resizable=1,'; // la case de redimensionnement
		param += 'topP,'; // marge haute
		param += 'left ,'; // marge gauche
		param += 'width=1024,'; // largeur totale
		param += 'height=670,'; // hauteur totale
		param += 'outerWidth50,'; // largeur totale (FF NC)
		param += 'outerHeight%0,'; // hauteur totale (FF NC)
		param += 'innerWidth20,'; // largeur int�rieure (FF NC)
		param += 'innerHeight"0,'; // hauteur int�rieure (FF NC)
		param += 'personalbar=0,'; // boutons persos (FF NC)
		param += 'menu=0,'; // menus actifs ou non
		param += 'menubar=0,'; // pareil
		param += 'toolbar=0,'; // barre d'outils
		param += 'directories=0,'; // boutons barre adresse (IE Win)
		param += 'channelmode=0,'; // mode th�atre (IE) (qu'est-ce?)
		param += 'fullscreen=1,'; // plein �cran (IE)
		param += 'titlebar=1,'; // barre de titre (IE)
		param += 'dependent=1,'; // auto-ferm�e si opener ferm� (FF NC)
		param += 'modal=0,'; // FF
		param += 'dialog=0'; // FF
		//setStyle('log_id').display='none';setStyle('log_info').display='none';setStyle('news_cont').top='5px';setStyle('service_cont').top='5px';
		var win = window.open('', windowsname, param);
	}else{
		var win = window.open('');
	}
	return win;
}


var BrowserDetect = {
		init: function () {
			this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
			this.version = this.searchVersion(navigator.userAgent)
				|| this.searchVersion(navigator.appVersion)
				|| "an unknown version";
		},
		searchString: function (data) {
			for (var i=0;i<data.length;i++)	{
				var dataString = data[i].string;
				var dataProp = data[i].prop;
				this.versionSearchString = data[i].versionSearch || data[i].identity;
				if (dataString) {
					if (dataString.indexOf(data[i].subString) != -1)
						return data[i].identity;
				}
				else if (dataProp)
					return data[i].identity;
			}
		},
		searchVersion: function (dataString) {
			var index = dataString.indexOf(this.versionSearchString);
			if (index == -1) return;
			return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
		},
		dataBrowser: [
			{
				string: navigator.userAgent,
				subString: "Chrome",
				identity: "Chrome"
			},
			{ 	string: navigator.userAgent,
				subString: "OmniWeb",
				versionSearch: "OmniWeb/",
				identity: "OmniWeb"
			},
			{
				string: navigator.vendor,
				subString: "Apple",
				identity: "Safari",
				versionSearch: "Version"
			},
			{
				prop: window.opera,
				identity: "Opera",
				versionSearch: "Version"
			},
			{
				string: navigator.vendor,
				subString: "iCab",
				identity: "iCab"
			},
			{
				string: navigator.vendor,
				subString: "KDE",
				identity: "Konqueror"
			},
			{
				string: navigator.userAgent,
				subString: "Firefox",
				identity: "Firefox"
			},
			{
				string: navigator.vendor,
				subString: "Camino",
				identity: "Camino"
			},
			{		// for newer Netscapes (6+)
				string: navigator.userAgent,
				subString: "Netscape",
				identity: "Netscape"
			},
			{
				string: navigator.userAgent,
				subString: "MSIE",
				identity: "Explorer",
				versionSearch: "MSIE"
			},
			{
				string: navigator.userAgent,
				subString: "Gecko",
				identity: "Mozilla",
				versionSearch: "rv"
			},
			{ 		// for older Netscapes (4-)
				string: navigator.userAgent,
				subString: "Mozilla",
				identity: "Netscape",
				versionSearch: "Mozilla"
			}
		]
	};
	
	function checkBrowserVersion()
	{
		if(navigator.userAgent && navigator.userAgent!='storefactory') // user agent de mise en prod
		{
			BrowserDetect.init();
			if((BrowserDetect.browser=='chrome' && BrowserDetect.version<14) ||
					(BrowserDetect.browser=='Chrome' && BrowserDetect.version<14)
					|| (BrowserDetect.browser=='Firefox' && BrowserDetect.version<6)
					|| (BrowserDetect.browser=='Safari' && BrowserDetect.version<5)
					|| (BrowserDetect.browser=='Explorer' && BrowserDetect.version<8) 
					|| (BrowserDetect.browser!='chrome'	&& BrowserDetect.browser!='Chrome'	&& BrowserDetect.browser!='Firefox'	&& BrowserDetect.browser!='Safari'	&& BrowserDetect.browser!='Explorer'))
			{
				setCssVisibility('popup_wrongbrowser','visible');
				return false;
			}else{return true;}
		}
	}

	function submitPageAdminSearch(loginType)
	{
		document.getElementById('pageRequest').value='login_admin';
		document.getElementById('actionSelected').value=loginType;
		document.getElementById('formulaire_login').action="#";
		document.getElementById('formulaire_login').target="";
		document.getElementById('formulaire_login').submit();
	}
	
	function initUserLogedIn(bousrId)
	{
		sfInnerHTML('formulaire_login',	'<input type="hidden" name="bousrid" value="'+bousrId+'" />'+
										'<input type="hidden" name="pageRequest" value="popup_struct" />'
										+'<input type="hidden" name="actionSelected" value="load" />');

		if(document.getElementById('formulaire_login').target!='_blank')
		{
			document.getElementById('formulaire_login').target=bousrId;
			winpop=newWindows(document.getElementById('formulaire_login').target);
		}
		
		document.getElementById('formulaire_login').action="index_popup.php";
		document.getElementById('formulaire_login').submit();
	}

	function initUserAdminLogedIn(bousrId)
	{
		if(document.getElementById('bousrid'))
		{
			document.getElementById('bousrid').value=bousrId;
			document.getElementById('pageRequest').value='popup_struct';
			document.getElementById('actionSelected').value='load';
		}else{
			id='formulaire_login_admin_search';
			document.getElementById(id).innerHTML = document.getElementById(id).innerHTML+
					'<input type="hidden" name="bousrid" id="bousrid" value="'+bousrId+'" />'
					+'<input type="hidden" name="pageRequest" id="pageRequest" value="popup_struct" />'
					+'<input type="hidden" name="actionSelected" id="actionSelected" value="load" />';
		}
		if(document.getElementById('formulaire_login_admin_search').target!='_blank')
		{
			document.getElementById('formulaire_login_admin_search').target=bousrId;
			winpop=newWindows(document.getElementById('formulaire_login_admin_search').target);
		}
		document.getElementById('formulaire_login_admin_search').action="index_popup.php";
		document.getElementById('formulaire_login_admin_search').onSubmit="";
		document.getElementById('formulaire_login_admin_search').submit();
		
		document.getElementById('bousrid').value='';
		document.getElementById('pageRequest').value='';
		document.getElementById('actionSelected').value='';
		//set target
	}

