	/*
		Spenalzo Framework 1.0 - by Depa | Maggio '08
		----------------------------------------------------
	*/
	
	//GlobalVar
	screenW = '';
	screenH = '';
	colorDepth = '';
	pixelDepth = '';
	browser = '';
	Platform = '';
	CodeName = '';
	MinorVersion = '';
	ApplicationName = '';
	ApplicationVersion = '';
	CookieEnabled = '';
	Cpu = ''; 
	UserAgente = '';
	browserLanguage = '';
	systemLanguage = '';
	userLanguage='';	
	
	emptyDock = '<div style="font-weight:bold;color:#ff0000;padding-top:20px;">nessun oggetto inserito in questo dock</div>';
	denominazione = 'Area riservata';
	alertNoCookie =	fmk$prendicontenuto('/objects/noCookie.html');

	
	
	function _InitFRAMEWORK()
	{
		BrandLabel = 'Bosello High Technology - ' + denominazione;
		window.status = BrandLabel
		document.title = BrandLabel;
		
		fmk$detectScreen();
		fmk$detectBrowserDetails();
		fmk$controlloPiattaforma();				
		setTimeout("fmk$manageCookie();",900);

	}



	function fmk$applicaClasse(elemento,classe)
	{
		document.getElementById(elemento).className = classe;
	}
	
	function fmk$resizeEvents()
	{
		fmk$detectScreen();_AdaptAltezza();
	}

	function fmk$controlloPiattaforma()
	{
		switch(Platform)
		{	
			case "BlackBerry":
				document.location.href='mobile/';
				break;
		}
	}	


	function fmk$detectBrowserDetails()
	{
		screenW = screen.width;
		screenH = screen.height;
		colorDepth = screen.colorDepth;
		pixelDepth = screen.pixelDepth;
	
		if(window.navigator.userAgent.indexOf("MSIE") > 0){browser='ie'}else{browser="ff";}	
		x = navigator;
		CodeName = x.appCodeName;
		MinorVersion = x.appMinorVersion;
		ApplicationName = x.appName;
		ApplicationVersion = x.appVersion;
		CookieEnabled = x.cookieEnabled;
		Cpu = x.cpuClass;
		Platform = x.platform;
		UserAgente = x.userAgent;
		browserLanguage = x.browserLanguage;
		systemLanguage = x.systemLanguage;
		userLanguage = x.userLanguage;	
	}

	function fmk$printSysInfo()
	{
		level = document.getElementById("sysInfoContent");
		valore = "";
		valore+= "<b>screenW:</b> " + screenW +"<br />";
		valore+= "<b>screenH:</b> " + screenH +"<br />";
		valore+= "<b>colorDepth:</b> " + colorDepth +"<br />";
		valore+= "<b>pixelDepth:</b> " + pixelDepth +"<br />";
								
		valore+= "<b>Browser:</b> " + browser+"<br />";
		valore+= "<b>CodName:</b> " + CodeName +"<br />";
		valore+= "<b>MinorVersion:</b> " + MinorVersion+"<br />";
		valore+= "<b>ApplicationName:</b> " + ApplicationName+"<br />";
		valore+= "<b>ApplicationVersion:</b> " + ApplicationVersion +"<br />";
		valore+= "<b>CookieEnabled:</b> " + CookieEnabled+"<br />";
		valore+= "<b>Cpu:</b> " + Cpu+"<br />";
		valore+= "<b>Platform:</b> " + Platform+"<br />";
		valore+= "<b>UserAgente:</b> " + UserAgente+"<br />";
		valore+= "<b>browserLanguage:</b> " + browserLanguage+"<br />";
		valore+= "<b>systemLanguage:</b> " + systemLanguage +"<br />";
		valore+= "<b>userLanguage:</b> " + userLanguage +"<br />";
		level.innerHTML += valore;

		if(browser=='ie'){
			//level.innerHTML += "<p><b>Server</b>: <br>";
			//aggiungiTesto('sysInfoContent','/objects/getCOMPLETEHEDER.php');
		}
	}

	//Detect SCREEN SIZE
	var myWidth = 0, myHeight = 0;
	function fmk$detectScreen(){
		if( typeof( window.innerWidth ) == 'number' ) {
			//Non-IE
			myWidth = window.innerWidth;
			myHeight = window.innerHeight;
		} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			//IE 6+
			myWidth = document.documentElement.clientWidth;
			myHeight = document.documentElement.clientHeight;
			} else if( 
				document.body && ( document.body.clientWidth || document.body.clientHeight ) ) 
			{
			//IE 4 
			myWidth = document.body.clientWidth;
			myHeight = document.body.clientHeight;
		}
	}
	
	
	function fmk$debug(stringa)
	{
		oggetto = document.getElementById("debuggerContentDBG");
		oldObj = oggetto.innerHTML
		oggetto.innerHTML = stringa+"<br>"+oldObj;
	}
	




	function fmk$setCookie(cookieName,cookieValue,nDays) 
	{
		var today = new Date();
		var expire = new Date();
		if (nDays==null || nDays==0) nDays=1;
		expire.setTime(today.getTime() + 3600000*24*nDays);
		document.cookie = cookieName+"="+escape(cookieValue)+ ";expires="+expire.toGMTString();
	}

	function fmk$manageCookie()
	{
		if(!CookieEnabled){
			if(fmk$checkObject("informer"))
			{
				fmk$prendicontenuto('/objects/noCookie.html');
				elemento = prendiElementoDaId("informer");
				elemento.innerHTML += alertNoCookie.replace(/#denominazione#/g,denominazione);
				fmk$ombreggiante("informer");
			}else{
				return;
			}
		}
	}

	function fmk$getCookie(Name) {
	   var search = Name + "="
	   if (document.cookie.length > 0) { // se ci sono cookie
	      offset = document.cookie.indexOf(search) 
	      if (offset != -1) { // se il cookie esiste
	         offset += search.length 
	         end = document.cookie.indexOf(";", offset) 
	
	         if (end == -1) 
	            end = document.cookie.length
	         return unescape(document.cookie.substring(offset, end))
	      } 
	   }
	}

	function fmk$checkObject(Id)
	{
	  var o = document.getElementById(Id);
	  if (o)
	  {
	      return o;
	  }
	  return null;
	}


	function fmk$opacizza(livello)
	{
		document.getElementById(livello).className = 'opaco';
	}
	
	function fmk$nitido(livello)
	{
		document.getElementById(livello).className = 'nitido';
	}
	
	function fmk$prendicontenuto(pURL)
	{
		var
			ajax = assegnaXMLHttpRequest();
		
		if(ajax) {
			ajax.open("get", pURL, false);
			ajax.setRequestHeader("connection", "close");
			ajax.send(null);
			return ajax.responseText;
		} 
			else {
				return false;
		}
	}
	
	
	function fmk$ombreggiante(livello)
	{
		pURL = "/objects/ombreggiante.htm"
		if (window.XMLHttpRequest) { // per Mozilla, Safari, etc 
			xmlhttp=new XMLHttpRequest();
			xmlhttp.onreadystatechange=function fmk$ombreggianteKernel(){
				if (xmlhttp.readyState==4) { 
					if (xmlhttp.status==200) { 
						modelloOmbra = xmlhttp.responseText;
						strutturaLivello = document.getElementById(livello).innerHTML;
						modelloOmbra = modelloOmbra.replace("#ombreggiantecontent#",strutturaLivello);
						document.getElementById(livello).innerHTML = modelloOmbra;
					}
				}
			};
			xmlhttp.open("GET", pURL, true);
			xmlhttp.send(null);
		} else if (window.ActiveXObject) { //IE 
			xmlhttp=new ActiveXObject('Microsoft.XMLHTTP'); 
			if (xmlhttp) {
				xmlhttp.onreadystatechange=function fmk$ombreggianteKernel(){
					if (xmlhttp.readyState==4) { 
						if (xmlhttp.status==200) { 
							modelloOmbra = xmlhttp.responseText;
							strutturaLivello = document.getElementById(livello).innerHTML;
							modelloOmbra = modelloOmbra.replace("#ombreggiantecontent#",strutturaLivello);
							document.getElementById(livello).innerHTML = modelloOmbra;
							
						}
					}
				};
				xmlhttp.open('GET', pURL, false);
				xmlhttp.send();
			}
		}		
	}


	function fmk$clean(livello){
		document.getElementById(livello).innerHTML = '';
	}
	
	function fmk$nascondi(livello){
		document.getElementById(livello).style.visibility = 'hidden';
		document.getElementById(livello).style.position = 'absolute';		
	}	
	
	function fmk$mostra(livello){
		document.getElementById(livello).style.visibility = 'visible';
		document.getElementById(livello).style.position = '';
	}

	function fmk$vaiA(redirto){
		document.location.href=redirto;
	}
	
	function fmk$PostCall(url,parString,callBack,content){
		if(content!='')
		{
			elemento = document.getElementById(content);
			elemento.innerHTML = "<div align='center'><img alt='-' src='/images/loading.gif' /></div>";			
		}
		
		var req = null; 
		if(window.XMLHttpRequest)
			req = new XMLHttpRequest(); 
		else if (window.ActiveXObject)
			req  = new ActiveXObject(Microsoft.XMLHTTP); 

		req.onreadystatechange = function()
		{ 
			if(req.readyState == 4)
			{
				if(req.status == 200)
				{
					if(callBack){
						elemento.innerHTML = req.responseText;
					}
				}	
				else	
				{
					alert(req.status + " " + req.statusText);
				}	
			} 
		}; 
		req.open("POST", url, true); 
		req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		req.setRequestHeader("Content-length", parString.length);
		req.setRequestHeader("Connection", "close");
		req.send(parString);  		
	}
	function fmk$window_open(filename, x, y, target)
	{
		windowops = eval("'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=" + x + ",height=" + y + "'");
		newwindow=window.open(filename, target, windowops);
		return;
	}

	function fmk$window_open_resize(filename, x, y, target)
	{
		windowops = eval("'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=" + x + ",height=" + y + "'");
		newwindow=window.open(filename, target, windowops);
		return;
	}

	function fmk$window_open_bar(filename, x, y, target)
	{
		windowops = eval("'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=" + x + ",height=" + y + "'");
		newwindow=window.open(filename, target, windowops);
		return;
	}

	function fmk$window_full(filename, target)
	{
		windowops = eval("'fullscreen=yes,titlebar=0,menubar=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,channelmode=no,status=no;'");
		newwindow=window.open(filename, target, windowops);
		return;
	}

	function fmk$window_full_bar(filename, target)
	{
		windowops = eval("'fullscreen=yes,titlebar=0,menubar=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=auto,resizable=no,copyhistory=no,channelmode=no,status=no;'");
		newwindow=window.open(filename, target, windowops);
		return;
	}
	
  function fmk$trim(str) {
    return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
  }

  function fmk$sleep(millis) {
  var 
    date = new Date(),
    curDate = null;
  
    do { curDate = new Date(); } 
    while(curDate-date < millis);
  
  }	
