var speed           = 1;
var increment_in    = 4;
var increment_out   = 1;

var tipWidth = 216; // width of tip box (pixels)
var tipHide  = 10; // amount of tipbox showing when hidden (in pixels)
var rt = 0; // right margin alignment

var tipType = ['','Visitor Info Tip','Traveler Tip','Gabriola Trivia'];
var tipIcon = ['','tiphappy.gif','tipsaver.gif','tipbug.gif'];
var tipFade = ['','tiptop_blu.gif','tiptop_grn.gif','tiptop_yel.gif']; 

var tipTxt1 = [
	"Locals pronounce the name of the island &quot;Gabe´-ree-oh´-la&quot;.",
	"Gabriola Island is renowned worldwide for our abundance of artisans — the <i>&quot;Isle of the Arts&quot;</i>.",
	"Discover the <a href='/content/petroglyph.shtml' style='text-decoration:underline'>ancient petroglyphs</a>; many date back 2000 years and are still visible today.",
	"Gabriola has several <a href='/content/parks_prov.shtml' style='text-decoration:underline'>provincial</a> &amp; public parks for your exploration and relaxing daytime recreation.",
	"The <i>&quot;Malaspina Galleries&quot;</i>, like a massive breaking wave turned to stone, is a natural wonder!",
	"Enjoy the warm sand, swimming and recreation area at <a href='/content/parks_prov.shtml#sands' style='text-decoration:underline'><i>Gabriola Sands Provincial Park</i></a> (aka Twin Beaches), just off Taylor Bay Rd.",
	"Pack your golf clubs — Gabriola has a classy 9-hole golf course!"
	];
var tipTxt2 = [
	"There are 16 ferry sailings daily, (for vehicles &amp; foot passengers), approximately every hour, from 5:45 am - 10:25 pm.",
	"Quick &amp easy island accessibility makes for a pleasant day-trip from Vancouver Island.",
	"Stay overnight at campgrounds, cottage resorts, or one of the island's many Bed &amp; Breakfasts — reservations recommended."
	];
var tipTxt3 = [
	"Gabriola Island is home to the world's largest recycled building: <i>&quot;Folklife Village&quot;</i> from the World Expo86 and moved here in 1993.",
	"The <i>&quot;Malaspina Galleries&quot;</i> was once considered one of the great wonders of the western world.",
	"Pioneer settlement began in the 1850's by Nanaimo coal miners searching for places to live.",
	"<i>&quot;Silva Bay&quot;</i> is named after a Portuguese family in 1883 who moved here from Mayne Island.",
	"Gabriola sandstone was quarried locally for the first Victoria Post Office and City of Vancouver buildings as early as 1887.",
	"During the 1930's Gabriola Island provided as many as 1000 of the world's millstones used for wood pulping purposes.",
	"Phone service came to Gabriola Island in 1910, using party lines with about 30 subscribers.",
	"Even for a small island we have two newspapers: <i>&quot;The Gabriola Sounder&quot;</i> &amp; <i>&quot;The Flying Shingle&quot;</i>.",
	"Spanish explorer <a href='/content/spanish.shtml' style='text-decoration:underline'>José Maria Narvaez</a> named the tip of the island <i>'Punta de Gaviola'</i> (Seagull Point), which eventually became Gabriola Island."
	];

var is_NS = navigator.appName=="Netscape";
if(is_NS) { layerVal="document.layers."; styleVal="";} 
else { layerVal="document.all."; styleVal=".style";}  

var tipID = 0; // for tipbox counter
var tipPos = tipHide-tipWidth; // slider distance

function makeTip(style,tp) {
  if(!style) {
    while(!style) { style=Math.round(Math.random()*(tipType.length-1));}
  }  
  if(style == 1) { var tipNum = Math.round(Math.random()*(tipTxt1.length-1)); var txt=tipTxt1[tipNum];}
  if(style == 2) { var tipNum = Math.round(Math.random()*(tipTxt2.length-1)); var txt=tipTxt2[tipNum];}
  if(style == 3) { var tipNum = Math.round(Math.random()*(tipTxt3.length-1)); var txt=tipTxt3[tipNum];}

  document.write('<div id="tipbox'+tipID+'" style="position:absolute;right:'+rt+'px;top:'+tp+'px;width:auto;height:auto;visibility:visible;">');
  document.write('<table border="0" cellpadding="0" cellspacing="0" width="'+tipWidth+'">');
  document.write('<tr><td><a href="javascript:nada()" onMouseover="moveOn(\'tipbox'+tipID+'\','+tipPos+','+(rt-1)+'); window.status=\'\'; return true"; style="cursor: default">');
  document.write('<img border="0" src="/images/'+tipIcon[style]+'" alt=""></a></td>');
  document.write('<td width="100%" align="center" bgcolor="#F5F5F5" background="/images/'+tipFade[style]+'"><font class="tiptitle">'+tipType[style]+' #'+(tipNum+1)+'</font></td>');
  document.write('<td bgcolor="#F5F5F5" background="/images/'+tipFade[style]+'" valign="top" align="center"><img border="0" src="/images/spacer.gif" width="42" height="13"><br>');
  document.write('<font class="small"><a href="javascript:nada()" onMouseover="window.status=\'\'; return true"; onclick="moveOff(\'tipbox'+tipID+'\','+rt+','+tipPos+'); return true">HIDE<br>INFO</a></font></td>');
  document.write('</tr><tr><td colspan="3" background="/images/tipleft.gif" bgcolor="#F5F5F5" align="right"><table border="0" cellpadding="0" cellspacing="0" width="99%" bgcolor="#F5F5F5">');
  document.write('<tr><td bgcolor="#F5F5F5" onMouseover="moveOn(\'tipbox'+tipID+'\','+tipPos+','+(rt-1)+'); window.status=\'\'; return true";><img border="0" src="/images/spacer.gif" width="12" height="100%"></td>');
  document.write('<td width="100%"><font class="tiptitle"><font class="tiptext">'+txt+'</font></td>');
  document.write('<td><img border="0" src="/images/spacer.gif" width="8" height="10"></td></tr></table></td>');
  document.write('</tr><tr><td colspan="3"><table border="0" cellpadding="0" cellspacing="0" width="100%">');
  document.write('<tr><td><img border="0" src="/images/tipcorn.gif" width="12" height="13"></td>');
  document.write('<td width="100%" bgcolor="#F5F5F5" background="/images/tipbot.gif"><img border="0" src="/images/tipbot.gif" width="2" height="13"></td>');
  document.write('</tr></table></td></tr></table></div>');

  tipID++;
}

function moveOff(divVal,itemX,OffPosX) { // only activate slider if at display position
  if(is_NS) { document.getElementById(divVal).style.visibility='hidden'; return;} // simply hide
  else if(eval(layerVal+divVal+styleVal+'.right') != itemX+"px") { return;}
  else { moveOffItem(divVal,itemX,OffPosX);}
}

function moveOffItem(divVal,itemX,OffPosX) {
  if(itemX > OffPosX) { 
    itemX = itemX - increment_out;
    if(itemX < tipPos) { itemX = tipPos;} // eliminate increment overrun
    eval(layerVal+divVal+styleVal+'.right=itemX');
    setTimeout('moveOffItem("'+divVal+'",'+itemX+','+OffPosX+')',speed);
  }
  clearTimeout('moveOffItem("'+divVal+'",'+itemX+','+OffPosX+')',speed);
}

function moveOn(divVal,itemX,OnPosX) { // only activate slider if at parked position
  if(is_NS) { document.getElementById(divVal).style.visibility='visible'; return;} // simply show
  if(eval(layerVal+divVal+styleVal+'.right') != itemX+"px") { return;}
  else { moveOnItem(divVal,itemX,OnPosX);}
}

function moveOnItem(divVal,itemX,OnPosX) {
  if(itemX < OnPosX) { 
    itemX = itemX + increment_in;
    if(itemX > rt) { itemX = rt;} // eliminate increment overrun
    eval(layerVal+divVal+styleVal+'.right=itemX');
    setTimeout('moveOnItem("'+divVal+'",'+itemX+','+OnPosX+')',speed);
  }
  clearTimeout('moveOnItem("'+divVal+'",'+itemX+','+OnPosX+')',speed);
}

function nada() {
 // do nothing
}
