// A set of functions specific to the Classic Traveller RPG
// by Chris Slee
// November 2004

// Convert date to something useful
function dayToDays(inTime) {
    return (inTime.getTime() / (1000 * 60 * 60 * 24));
} 

// Calculate Imperial (campaign) date from current date
function showImperialDate(theDate) {
    myDate = new Date(theDate);
    thatYear=myDate.getYear();
    if (thatYear<1900) { 
        thatYear+=1900; 
        myDate.setYear(thatYear);
    }
    soy=new Date(thatYear,0,1);
    document.write(Math.ceil(dayToDays(myDate)-dayToDays(soy)));
	document.write("-");
	document.write(thatYear-900);
}

function newWindow(getImage) {
  var imgThis = new Image;
  imgThis.src = getImage;
  var optThis = "width=" + imgThis.width + ",height=" + imgThis.height
  var winTrav = window.open(imgThis.src,"winTrav",optThis);
  winTrav.focus();
}

