// yep - it don't do nut'n
function nada()
{
}

//----------------------------------------------------
// Create a new pop up window for a given URL and type
//----------------------------------------------------
function popUp(URL, width, height)
{

//var ROOT = "http://www.sunriserv.ca
//var ROOT = "file:///home/hank/www/Sunrise/UnderConstruction/httpdocs"

if(width === undefined)
{
	width = 800;
}

if(height === undefined)
{
	height = 640;
}

switch(URL)
{
	case "homewhere":
		URL = './where/index.html';
		var type = 'mapwindow';
		break;	    
	case "homelegal":
		URL = './legal/index.html';
		var type = 'tacwindow';
		break;	    
	case "where":
		URL = '../where/index.html';
		var type = 'mapwindow';
		break;	    
	case "legal":
		URL = '../legal/index.html';
		var type = 'tacwindow';
		break;	    
	case "catalog":
		URL = '../catalog/index.html';
		var type = 'catwindow';
		break;	    
	default:
		var type = 'defwindow';
}

//URL = ROOT + URL

   var leftPosition  = (screen.width - width - 20) / 2;
   var topPosition = (screen.height - height) / 4;

   //open centered
   eval("win = window.open(URL, '"+type+"', 'toolbar=0,scrollbars=1,location=0,status=1,resizable=1,menubar=0,width="+width+",height="+height+",left="+leftPosition+",top="+topPosition+"');");

   if (parseInt(navigator.appVersion) >= 4) 
   { 
      win.window.focus(); 
   }
 
}

//
// Display the target image for this thumbnail
//
function displayThumb(src, width, height, title)
{
   var winWidth = 650;
   var winHeight = 510;

   eval("win = window.open('','Thumb', 'toolbar=0,scrollbars=1,location=0,status=0,resizable=1,menubar=0,width="+winWidth+",height="+winHeight+"');");

   // clear the content of the document
   win.document.open();

   win.document.writeln('<html>');

   if(null != title && title != "")
   {
       win.document.writeln('<head><title>' + title + '</title></head>');
   }
   else
   {
       win.document.writeln('<head><title>Thumbnail Image</title></head>');
   }
   win.document.writeln('<body>');

   win.document.writeln('<center><table border="0">');
   if (width == 0)
   {
      win.document.writeln('<tr><td align="center"><img src="'+src+'"></td></tr>');
   }
   else if (height == 0)
   {
      win.document.writeln('<tr><td align="center"><img width="'+width+'" src="'+src+'"></td></tr>');   
   } 
   else
   {
      win.document.writeln('<tr><td align="center"><img width="'+width+'" height="'+height+'" src="'+src+'"></td></tr>');   
   } 

   if(null != title && title != "")
   {
   	win.document.writeln('<tr><td align="center"><font color="#ff3300" face="Arial, Helvetica, sans-serif">'+title+'</font></td></tr>');
   }
   
   win.document.writeln('</table></center>');

   win.document.writeln('</body></html>');
   
   win.document.close();
}

//
//Unscramble email address
//
function unScramble(eMail1,eMail2,linkText,subjectText,statusText)
{
   var a,b,c,d,e;a=eMail1;c=linkText;b=eMail2.substring(0,eMail2.length-5);
   if(subjectText!="")
   {
      d="?subject="+escape(subjectText);
   }
   else
   {
      d="";
   }
   if(statusText!="")
   {
      e=" onMouseOver=\"top.status=\'"+statusText+"\'\;return true\;\" onMouseOut=\"top.status=\'\'\;return true\;\"";
   }
   else
   {
      e="";
   }
   document.write("<A HREF=\"mai"+"lto:"+a+"@"+b+d+"\""+e+">"+c+"</A>");
}

//
//Preload and swap images for navbuttons.
//
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function window1() {
	window.open("window1.html","window1","width=300,height=200");
}


//
//Write the date-last-modified in a nice format, with or without the time.
//
function writeDateLastModified (time) {

  var days = new Array;         // Array to hold day names
  var months = new Array;       // Array to hold month names

  // Load up day names
  days[0] = "Sunday";
  days[1] = "Monday";
  days[2] = "Tuesday";
  days[3] = "Wednesday";
  days[4] = "Thursday";
  days[5] = "Friday";
  days[6] = "Saturday";

  // Load up month names
  months[0] = "January";
  months[1] = "February";
  months[2] = "March";
  months[3] = "April";
  months[4] = "May";
  months[5] = "June";
  months[6] = "July";
  months[7] = "August";
  months[8] = "September";
  months[9] = "October";
  months[10] = "November";
  months[11] = "December";

  // Assign date variables with document.lastModified
  var modDate = new Date(Date.parse(document.lastModified));

  // If we have a valid date reformat it.
  if (modDate != 0 && modDate != "Invalid Date") {

    // Set up day variable to hold the name of the day
    var day = days[modDate.getDay()];

    // ndate variable holds day of month
    var ndate = modDate.getDate();

	// add suffix to day of month - Hank J van Leuvensteijn
	var suffix;
	if(ndate==1)
	suffix="st";
	else
	if(ndate==2)
	suffix="nd";
	else
	if(ndate==3)
	suffix="rd";
	else
	suffix="th";

    // Set up month variable to hold the name of the month
    var month = months[modDate.getMonth()];

    // Get the year and if it is less than 1000 add 1900 to it.
    var year = modDate.getFullYear();
    if (year < 1000) year = year + 1900;

    // Load up the time variables if required
    if (time) {
      var hour = modDate.getHours().toString();
      if (hour.length == 1) hour = "0" + hour;
      var minute = modDate.getMinutes().toString();
      if (minute.length == 1) minute = "0" + minute;
      var second = modDate.getSeconds().toString();
      if (second.length == 1) second = "0" + second;
    }

    // Display date and time document was last updated.
    document.write(day + ", " + month + " " + ndate + suffix + ", " + year+ "  ");
    if (time) {
      document.write(hour + ":" + minute + ":" + second);
    }
  }
	else document.write("not available");
}

//
// Write current year to document
//
function writeCurrentYear () {
	var date= new Date;
	var year = date.getFullYear ();
	document.write (year);
}

//
// Write webdesign comment.
//
function writeWebDesign () {
	comment = "Webdesign: <a href=\"http://www.lionstones.net\">http://www.lionstones.net</a>"
	document.write (comment);
}
