<!--
var lastcall=0;
var currentImg=-1;
var xmlhttp,response;

(function () {
	if (window.printPage) {
		timerSwitch(1,0);
	 	setTimeout("window.print()",1000);
	} else timerSwitch(0,0);
})
();

function switchImg(img,call) {
	if (call==lastcall && galleryImg.length > 0) {
		if (!img) {
			if (currentImg<galleryImg.length-1) currentImg++;
			else currentImg=0;
			sec=5;
		} else { 
			currentImg=img-1;
			sec=30;
		}
		document.getElementById("gallery").setAttribute("src",galleryImg[currentImg]);
		for (i=1;i<=galleryImg.length;i++) {
			if (currentImg==i-1) {
				document.getElementById("gallery"+i).style.backgroundColor="#E4EEF4";
				document.getElementById("gallery"+i).style.fontWeight="bold";
			}
			else document.getElementById("gallery"+i).removeAttribute("style");
		}
		timerSwitch(0,sec);
	}
}
function timerSwitch(img,sec) {
	lastcall++;
	setTimeout("switchImg("+img+","+lastcall+")",sec * 1000);
}
function showDiv(name) {
	var datasheet=document.getElementById('datasheet');
	var comments=document.getElementById('comments');
	var messages=document.getElementById('messages');
	if (name=="datasheet") {
		datasheet.style.display = 'block';
		comments.style.display = 'none';
		messages.style.display = 'none';
		currentImg=-1;
		timerSwitch(0,0);
	} else if (name=="comments") {
		datasheet.style.display = 'none';
		comments.style.display = 'block';
		messages.style.display = 'none';
	} else if (name=="messages") {
		datasheet.style.display = 'none';
		comments.style.display = 'none';
		messages.style.display = 'block';
	} else {
		datasheet.style.display = 'block';
		comments.style.display = 'none';
		messages.style.display = 'none';
	}
	return false;
}

function jumpYard(IDyard)
{
	xmlhttp=null
	// code for Mozilla, etc.
	if (window.XMLHttpRequest) xmlhttp=new XMLHttpRequest();
	// code for IE
	else if (window.ActiveXObject) xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
 
	if (xmlhttp!=null) {
		var URL="/RPC/ships/jumpYard.php?IDyard="+IDyard;
		//var URL="/prova.xml";
		xmlhttp.onreadystatechange=catchJump;
		xmlhttp.open("GET",URL,false);
		xmlhttp.send(null);
		return response;
	} else {
		alert("Your browser does not support XMLHTTP.");
		return false; 
	}
}

function catchJump()
{
	response=false;
	// if xmlhttp shows "loaded"
	if (xmlhttp.readyState==4) {
		// if "OK"
		if (xmlhttp.status==200) {
			if (xmlhttp.responseText=="OK") response=true;
		} 
		else {
			alert("Problem retrieving XML data:" + xmlhttp.statusText);
		}
	}
}

function showPrint(shipcode,lang,units,account)
{
	if (window.opener && !window.opener.closed) print();
	else window.open("/RPC/ships/printsheet.php?shipcode="+shipcode+"&lang="+lang+"&units="+units+"&account="+account,"sheetPrint","width=605,height=700,left=0,top=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbars=0");
	
}
//-->