var newwin;
function launchwin(winurl, winname, winfeatures)
{
	//This launches a new window and then
	//focuses it if window.focus() is supported.
	newwin = window.open(winurl, winname, winfeatures);

	//if(javascript_version > 1.0)
	//{
		//delay a bit here because IE4 encounters errors
		//when trying to focus a recently opened window
 		setTimeout('newwin.focus();',250);
	//}
}


function openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function goToURL() { //v3.0
  var i, args=goToURL.arguments; document.returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}


var calbind			//binds to the object the calendar wants to change
var cwindowsettings		//settings for the calender windows

//this function is called by the calender popup so that the date boxes can be changed to he date selected by the user
function changeItem(objstring){ //when the calender has been cklicked the date is changed to the item specified in tagname
	calbind.value = objstring
}

//Is called to produce a calendar
function makeCalendar(targetobj, oDate){ //this funtion creates the calender

  cwindowsettings = "fullscreen=no, toolbar=no, status=no, menubar=no, scrollbars=no, resizable=no, directories=no, location=no, "
  cwindowsettings = cwindowsettings + "left=" + (window.event.x+30)+ ", top=" + (window.event.y+95) + ", width=196, height=185"
  calbind = eval(targetobj) 
  window.open("objCalendar.asp", "CalendarWindow", cwindowsettings, true)
}






var da = (document.all) ? 1 : 0;
var pr = (window.print) ? 1 : 0;
var mac = (navigator.userAgent.indexOf("Mac") != -1); 

function printPage() {
  if (pr) 		// NS4, IE5
    window.print()
  else if (da && !mac) 	// IE4 (Windows)
    vbPrintPage()
  else 			// other browsers
    alert("Il vostro browser non supporta questa funzione.");
  return false;
}

if (da && !pr && !mac) with (document) {
  writeln('<OBJECT ID="WB" WIDTH="0" HEIGHT="0" CLASSID="clsid:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>');
  writeln('<' + 'SCRIPT LANGUAGE="VBScript">');
  writeln('Sub window_onunload');
  writeln('  On Error Resume Next');
  writeln('  Set WB = nothing');
  writeln('End Sub');
  writeln('Sub vbPrintPage');
  writeln('  OLECMDID_PRINT = 6');
  writeln('  OLECMDEXECOPT_DONTPROMPTUSER = 2');
  writeln('  OLECMDEXECOPT_PROMPTUSER = 1');
  writeln('  On Error Resume Next');
  writeln('  WB.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER');
  writeln('End Sub');
  writeln('<' + '/SCRIPT>');
}