// JavaScript Document

var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);}


var win=null;
function NewWindowLink(mypage,myname,w,h,scroll,pos){
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=yes,directories=yes,status=yes,menubar=yes,toolbar=yes,resizable=yes';
win=window.open(mypage,myname,settings);}




		
		var highlightcolor="#FFFF99"
		
		var ns6=document.getElementById&&!document.all
		var previous=''
		var eventobj
		
		//Regular expression to highlight only form elements
		var intended=/INPUT|TEXTAREA|SELECT|OPTION/
		
		//Function to check whether element clicked is form element
		function checkel(which){
		if (which.style&&intended.test(which.tagName)){
		if (ns6&&eventobj.nodeType==3)
		eventobj=eventobj.parentNode.parentNode
		return true
		}
		else
		return false
		}
		
		//Function to highlight form element
		function highlight(e){
		eventobj=ns6? e.target : event.srcElement
		if (previous!=''){
		if (checkel(previous))
		previous.style.backgroundColor=''
		previous=eventobj
		if (checkel(eventobj))
		eventobj.style.backgroundColor=highlightcolor
		}
		else{
		if (checkel(eventobj))
		eventobj.style.backgroundColor=highlightcolor
		previous=eventobj
		}
		}
		
		

if (navigator.appName.indexOf("Internet Explorer") != -1)	
	document.onmousedown = noSourceExplorer;	function noSourceExplorer(){
	if (event.button == 2 | event.button == 3)	{
		alert("The context menu has been disabled!");	}}
		

        function SetValue(id)
		{
			popUp.close();
			form1.elements['txt_reload'].value = id;
			__doPostBack(id,'');
		}
		
		
		function OpenPoUp()
		{
		    LeftPosition=(screen.width)?(screen.width-750)/2:100;TopPosition=(screen.height)?(screen.height-530)/2:100;
			popUp = window.open('scegli_posto.aspx','popUp', 
				'width=750,height=530,top='+TopPosition+',left='+LeftPosition+',scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no');
		}
		
		function OpenSceltaPosto()
		{
		    LeftPosition=(screen.width)?(screen.width-900)/2:100;TopPosition=(screen.height)?(screen.height-600)/2:100;
			popUp = window.open('scegli_posto.aspx','popUpSceltaPosto', 
				'width=900,height=600,top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no');
		}
		
		function Stampa(sospeso)
		{
		    LeftPosition=(screen.width)?(screen.width-700)/2:100;TopPosition=(screen.height)?(screen.height-750)/2:100;
			popUp = window.open('./stampa.aspx?sospeso=' + sospeso ,'popUpStampa', 
				'width=700,height=750,top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,location=no,directories=no,status=no,menubar=yes,toolbar=no,resizable=no');
		}
	
		function copyText(formElement) {
          if (!document.all) return; // IE only
          r = formElement.createTextRange();
          r.select();
          r.execCommand('copy');
        }
    
        var previous = '';
        
        function SetCurrentValue(ID)
        {
	        var control = document.getElementById(ID);
	        previous = control.value;		        
        }
        
        function Confirm(ID)
        {
	        var choice = confirm("Confermi modifica biglietto?");

	        if (choice == false)
	        {// reset the selection
		        var control = document.getElementById(ID);
		        control.value = previous;
	        }

	        //return the choice value
	        return choice;
        }
        
        function ConfirmDivisa(ID)
        {
	        var choice = confirm("Confermi modifica divisa?");

	        if (choice == false)
	        {// reset the selection
		        var control = document.getElementById(ID);
		        control.value = previous;
	        }

	        //return the choice value
	        return choice;
        }
     
