
function ricerca_click()
{  if (window.event.keyCode == 13)
    {   event.returnValue=false;
        event.cancel = true;
      if (document.getElementById('ricerca').value!='') {  document.getElementById('find_btn').click();}
    }
    
    }



function EnterKeyFilter()
{  if (window.event.keyCode == 13)
    {   event.returnValue=false;
        event.cancel = true;
    }
}
    



function getRefToDivMod( divID, oDoc ) {
	if( !oDoc ) { oDoc = document; }
	if( document.layers ) {
		if( oDoc.layers[divID] ) { return oDoc.layers[divID]; } else {
			for( var x = 0, y; !y && x < oDoc.layers.length; x++ ) {
				y = getRefToDivNest(divID,oDoc.layers[x].document); }
			return y; } }
	if( document.getElementById ) { return oDoc.getElementById(divID); }
	if( document.all ) { return oDoc.all[divID]; }
	return document[divID];
}

function popUpWindowEx(jsWindow) {
		var Width = 1024;
		var Height = 768;
		var iMyWidth;
		var iMyHeight;
			//gets top and left positions based on user's resolution so hint window is centered.
			iMyWidth = (window.screen.width) - (Width + 18); //half the screen width minus half the new window width (plus 5 pixel borders).
			iMyHeight = (window.screen.height/2) - (Height * .5 + 50); //half the screen height minus half the new window height (plus title and status bars).
			var win2 = window.open(jsWindow,"","status,height=" + Height +",width="+Width+",resizable=yes,left=0,top=0,screenX=0,screenY=0,scrollbars=no");
			win2.focus();
			
		}
	
	
	
function zoom(type,imgx,sz) {
        imgd = findDOM(imgx);
        if (type=="+" && imgd.width < 175) {
        imgd.width += 2;imgd.height += (2*sz);}
        if (type=="-" && imgd.width > 20) {
        imgd.width -= 2;imgd.height -= (2*sz);}
} 
	
	
	
function popUpFoto(jsWindow) {
		var Width = 200;
		var Height = 345;
		var iMyWidth;
		var iMyHeight;
			//gets top and left positions based on user's resolution so hint window is centered.
			iMyWidth = (window.screen.width/2) - (Width * .5 + 18); //half the screen width minus half the new window width (plus 5 pixel borders).
			iMyHeight = (window.screen.height/2) - (Height * .5 ); //half the screen height minus half the new window height (plus title and status bars).
			var win2 = window.open(jsWindow,"","status,height=" + Height +",width="+Width+",resizable=yes,left=0,top="+iMyHeight+",left="+iMyWidth+",screenX=0,screenY=0,scrollbars=no");
			win2.focus();
			
		}


function overstatus () 
{ 
window.status=''; 
} 
function outstatus () 
{ 
window.status=''; 
} 
function clickstatus () 
{ 
window.status=''; 
} 





function richiama_ricerca()
 {
	if (event.keyCode==13) 
		{
			document.getElementById('find_btn').click();
		 }
}



function printpr()
{
var OLECMDID = 7;
/* OLECMDID values:
* 6 - print
* 7 - print preview
* 1 - open window
* 4 - Save As
*/
var PROMPT = 1; // 2 DONTPROMPTUSER 
var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
document.body.insertAdjacentHTML('beforeEnd', WebBrowser); 
WebBrowser1.ExecWB(OLECMDID, PROMPT);
WebBrowser1.outerHTML = "";
}









 function utente_click()
 {
	if (event.keyCode==13) 
			{
				event.returnValue=false;              
				document.getElementById('but_login').click();
			}

}









function printSpecial()
{
	if (document.getElementById != null)
	{
		var html = '<HTML>\n<HEAD>\n';

		if (document.getElementsByTagName != null)
		{
			var headTags = document.getElementsByTagName("head");
			if (headTags.length > 0)
				html += headTags[0].innerHTML;
		}
		
		html += '\n</HE' + 'AD>\n<BODY>\n';
		
		var printReadyElem = document.getElementById("printarea");
		
		if (printReadyElem != null)
		{
				html += printReadyElem.innerHTML;
		}
		else
		{
			alert("Could not find the printReady section in the HTML");
			return;
		}
			
		html += '\n</BO' + 'DY>\n</HT' + 'ML>';
		
		var printWin = window.open("","printSpecial");
		printWin.document.open();
		printWin.document.write(html);
		printWin.document.close();
		if (gAutoPrint)
			printWin.print();
	}
	else
	{
		alert("Sorry, the print ready feature is only available in modern browsers.");
	}
}




 function utente_click()
 {
	if (event.keyCode==13) 
			{
				event.returnValue=false;              
				document.getElementById('btnSubmit').click();
			}

}



if (document.layers) { // Netscape
    document.captureEvents(Event.MOUSECLICK);
    document.onclick = captureMousePosition;
} else if (document.all) { // Internet Explorer
    document.onclick = captureMousePosition;
} else if (document.getElementById) { // Netcsape 6
    document.onclick = captureMousePosition;
}
// Global variables
xMousePos = 0; // Horizontal position of the mouse on the screen
yMousePos = 0; // Vertical position of the mouse on the screen
xMousePosMax = 0; // Width of the page
yMousePosMax = 0; // Height of the page

function captureMousePosition(e) {
    if (document.layers) {
        // When the page scrolls in Netscape, the event's mouse position
        // reflects the absolute position on the screen. innerHight/Width
        // is the position from the top/left of the screen that the user is
        // looking at. pageX/YOffset is the amount that the user has 
        // scrolled into the page. So the values will be in relation to
        // each other as the total offsets into the page, no matter if
        // the user has scrolled or not.
        xMousePos = e.pageX;
        yMousePos = e.pageY;
        xMousePosMax = window.innerWidth+window.pageXOffset;
        yMousePosMax = window.innerHeight+window.pageYOffset;
    } else if (document.all) {
        // When the page scrolls in IE, the event's mouse position 
        // reflects the position from the top/left of the screen the 
        // user is looking at. scrollLeft/Top is the amount the user
        // has scrolled into the page. clientWidth/Height is the height/
        // width of the current page the user is looking at. So, to be
        // consistent with Netscape (above), add the scroll offsets to
        // both so we end up with an absolute value on the page, no 
        // matter if the user has scrolled or not.
        xMousePos = window.event.x+document.body.scrollLeft;
        yMousePos = window.event.y+document.body.scrollTop;
        xMousePosMax = document.body.clientWidth+document.body.scrollLeft;
        yMousePosMax = document.body.clientHeight+document.body.scrollTop;
    } else if (document.getElementById) {
        // Netscape 6 behaves the same as Netscape 4 in this regard 
        xMousePos = e.pageX;
        yMousePos = e.pageY;
        xMousePosMax = window.innerWidth+window.pageXOffset;
        yMousePosMax = window.innerHeight+window.pageYOffset;
    }
}








function NumCharMask() {
  var i = window.event.keyCode;
 var bOK = false;
 if ( i == 9 ||               		// TAB key
    i == 8 ||               		// Backspace key
    i == 36 ||               		// Home key
    i == 35 ||               		// End key
    i == 39 ||               		// Right Arrow
    i == 37 ||               		// Left Arrow
    i == 46 ||               		// Delete Key
   	(i >= 48 && i <= 57) ||         // Top row 0 to 9
   	(i >= 96 && i <= 105) ||      	// Number pad 0 to 9
 	(i == 188 || i == 190) ||    	// Keyboard "." & "," & "-"
   	(i == 107 ||  i == 110))  		// Num pad "-" & "+" & "."
 {
  bOK = true;
  
 }
 if (!bOK) {
  window.event.returnValue = false;     // Cancel keystroke
 }
}



function regola_frame()
{
	var ie4 = (document.all) ? true : false;
	var ns4 = (document.layers) ? true : false;
	var ns6 = (document.getElementById && !document.all) ? true : false;
	if (ie4) {parent.document.getElementById('res').style.width=document.body.scrollWidth;}
	if (ns4) {parent.document.getElementById('res').width=document.body.scrollWidth;}
	if (ns6) {parent.document.getElementById('res').width=document.body.scrollWidth;}

}


function regola_altezza()
{
	var ie4 = (document.all) ? true : false;
	var ns4 = (document.layers) ? true : false;
	var ns6 = (document.getElementById && !document.all) ? true : false;
    
    
    if( window.innerHeight && window.scrollMaxY ) // Firefox 
    {
pageWidth = window.innerWidth + window.scrollMaxX;
pageHeight = window.innerHeight + window.scrollMaxY;
}
else if( document.body.scrollHeight > document.body.offsetHeight ) // all but Explorer Mac
{
pageWidth = document.body.scrollWidth;
pageHeight = document.body.scrollHeight;
}
else // works in Explorer 6 Strict, Mozilla (not FF) and Safari
{ pageWidth = document.body.offsetWidth + document.body.offsetLeft; pageHeight = document.body.offsetHeight + document.body.offsetTop; }
    
    //var alt=document.body.offsetHeight;
    var alt=pageHeight;
	if (ie4) {parent.document.getElementById('main_frm').style.height=alt;}
	if (ns4) {parent.document.getElementById('main_frm').height=alt;}
	if (ns6) {parent.document.getElementById('main_frm').height=alt;}
	parent.window.scrollTo(0,0);
	 

}