﻿/* coded by M.Pisacreta - Bilogic S.r.l */

// restituisce un elemento del DOM dall'ID univoco
function elementById(elementID) {
	
	if(document.getElementById)
	{
		return document.getElementById(elementID);
	}
	else if (document.all)
	{
		return document.all[elementID];
	}
	return null;
}

// restituisce un oggetto XMLHttpRequest
function setXMLHttpRequest() {

	var __AJAX = null;
	var browserUtente = navigator.userAgent.toUpperCase();
	
	if(typeof(XMLHttpRequest) === "function" || typeof(XMLHttpRequest) === "object")
	{
		__AJAX = new XMLHttpRequest();
	}
	else if(window.ActiveXObject && browserUtente.indexOf("MSIE 4") < 0)
	{
		if(browserUtente.indexOf("MSIE 5") < 0)
		{
			__AJAX = new ActiveXObject("Msxml2.XMLHTTP");
		}
		else
		{
			__AJAX = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return __AJAX;
}

// script apertura popup
function OpenNavigator(url,width,height)
{
	window.open(url, '_blank', 'height=' + height + ',width=' + width + ',resizable=no,menubar=no,toolbar=no,status=yes');
}

// script per allargare il browser alla dimensione max dello schermo.
function setFullScreen()
{
    window.resizeTo(screen.availWidth,screen.availHeight);
    if (parseInt(navigator.appVersion) >= 4)
        window.moveTo(0,0);
}

// script che mostra il div modale
function showModalPanel(disabledPanel, modalPanel, shadowPanel)
{  
    elementById(disabledPanel).style.width = window.screen.availWidth;
    elementById(disabledPanel).style.height = window.screen.availHeight;  
    
    elementById(modalPanel).style.top = (window.screen.availHeight/2  - 100 )+ "px";  
    elementById(modalPanel).style.left = (window.screen.availWidth/2 - 150 )+ "px";      
    elementById(modalPanel).style.width = "300px";
    elementById(modalPanel).style.height = "100px"; 
    
    elementById(shadowPanel).style.top = (window.screen.availHeight/2  - 94 )+ "px";  
    elementById(shadowPanel).style.left = (window.screen.availWidth/2 - 144 )+ "px";      
    elementById(shadowPanel).style.width = "300px";
    elementById(shadowPanel).style.height = "100px"; 
   
    elementById(disabledPanel).style.display='block';
    elementById(shadowPanel).style.display='block';
    elementById(modalPanel).style.display='block';
}

// script che nasconde il div modale
function hideModalPanel(disabledPanel, modalPanel)
{
     elementById(disabledPanel).style.display='none';
    elementById(modalPanel).style.display='none';
}