var dCol="#bed43b";
var winBgndColor='ffffff';
var winBorderColor='000000';
var imgFolderPath="images/";

if (document.images) {
button01off = new Image(169,20); button01off.src="images/buttons/btn_home_0.gif";
button01on = new Image(169,20); button01on.src="images/buttons/btn_home_1.gif";
button02off = new Image(169,20); button02off.src="images/buttons/btn_about_0.gif";
button02on = new Image(169,20); button02on.src="images/buttons/btn_about_1.gif";
button03off = new Image(169,20); button03off.src="images/buttons/btn_tourinfo_0.gif";
button03on = new Image(169,20); button03on.src="images/buttons/btn_tourinfo_1.gif";
button04off = new Image(169,20); button04off.src="images/buttons/btn_tour1_0.gif";
button04on = new Image(169,20); button04on.src="images/buttons/btn_tour1_1.gif";
button05off = new Image(169,20); button05off.src="images/buttons/btn_tour2_0.gif";
button05on = new Image(169,20); button05on.src="images/buttons/btn_tour2_1.gif";
button06off = new Image(169,20); button06off.src="images/buttons/btn_tour3_0.gif";
button06on = new Image(169,20); button06on.src="images/buttons/btn_tour3_1.gif";
button07off = new Image(169,20); button07off.src="images/buttons/btn_gallery_0.gif";
button07on = new Image(169,20); button07on.src="images/buttons/btn_gallery_1.gif";
button08off = new Image(169,20); button08off.src="images/buttons/btn_book_0.gif";
button08on = new Image(169,20); button08on.src="images/buttons/btn_book_1.gif";
button09off = new Image(169,20); button09off.src="images/buttons/btn_contact_0.gif";
button09on = new Image(169,20); button09on.src="images/buttons/btn_contact_1.gif";
}

var wotPlatForm="Unknown";
var wotBrowser="Unknown";
var bSetup="Unknown";

if (navigator.appVersion.indexOf("Mac") !== -1){wotPlatForm="Mac";}
else {wotPlatForm="Win";}

if (navigator.userAgent.indexOf("Safari") !== -1){wotBrowser="Safari";}
if (navigator.userAgent.indexOf("Firefox") !== -1){wotBrowser="Firefox";}
if (navigator.appVersion.indexOf("MSIE") !== -1){wotBrowser="MSIE";}
if (navigator.userAgent.indexOf("Netscape") !== -1){wotBrowser="Netscape";}
if (navigator.userAgent.indexOf("Opera") !== -1){wotBrowser="Opera";}

if ((wotBrowser=="Firefox")&&(wotPlatForm=="Mac")){bSetup="Mac_Firefox";}
if ((wotBrowser=="Firefox")&&(wotPlatForm=="Win")){bSetup="Win_Firefox";}

if ((wotBrowser=="Safari")&&(wotPlatForm=="Mac")){bSetup="Mac_Safari";}
if ((wotBrowser=="Safari")&&(wotPlatForm=="Win")){bSetup="Win_Safari";}

if ((wotBrowser=="MSIE")&&(wotPlatForm=="Mac")){bSetup="Mac_MSIE";}
if ((wotBrowser=="MSIE")&&(wotPlatForm=="Win")){bSetup="Win_MSIE";}

if ((wotBrowser=="Netscape")&&(wotPlatForm=="Mac")){bSetup="Mac_Netscape";}
if ((wotBrowser=="Netscape")&&(wotPlatForm=="Win")){bSetup="Win_Netscape";}


function myUnescape(theWord){
  var x=0;
  var outStr ="";
  var ch="";
  for (x=0; x<theWord.length; x++)
  {
  ch = theWord.substr(x,1);
  if (ch=='+') {ch=" "};
  outStr+=ch;
  }
  return outStr;
}

function putdate(){
 var thisDate=new Date();
 var thismonth=thisDate.getMonth()+1;
 if (thismonth=="1") {monthname="January"}
 if (thismonth=="2") {monthname="February"}
 if (thismonth=="3") {monthname="March"}
 if (thismonth=="4") {monthname="April"}
 if (thismonth=="5") {monthname="May"}
 if (thismonth=="6") {monthname="June"}
 if (thismonth=="7") {monthname="July"}
 if (thismonth=="8") {monthname="August"}
 if (thismonth=="9") {monthname="September"}
 if (thismonth=="10") {monthname="October"}
 if (thismonth=="11") {monthname="November"}
 if (thismonth=="12") {monthname="December"}
 var year=thisDate.getYear();
 if (navigator.appVersion.lastIndexOf('Mac') != -1) 
  if (navigator.appName == ('Microsoft Internet Explorer')) 
  var year = (thisDate.getYear());
  else var year = (thisDate.getYear()+1900);
 if ((navigator.appName=="Netscape") && (navigator.appVersion.indexOf("Win") != -1))
      var year = (thisDate.getYear()+1900);
 currentDate=monthname+' '+thisDate.getDate()+', '+year+'';
 document.write(currentDate);
}

theButtonsURLs1=new Array("index","about","tours","andeantrekker","andeanclimber","galapagosplus","gallery","booking","contact");
theButtonsImages1=new Array("btn_home","btn_about","btn_tourinfo","btn_tour1","btn_tour2","btn_tour3","btn_gallery","btn_book","btn_contact");
var topSuffix="1";
var thePage=wotPage;
var buttonNum;
if (thePage=="index") {var buttonNum="1"};
if (thePage=="about") {var buttonNum="2"};
if (thePage=="tours") {var buttonNum="3"};
if (thePage=="andeantrekker") {var buttonNum="4"};
if (thePage=="andeanclimber") {var buttonNum="5"};
if (thePage=="galapagosplus") {var buttonNum="6"};
if (thePage=="gallery") {var buttonNum="7"};
if (thePage=="booking") {var buttonNum="8"};
if (thePage=="contact") {var buttonNum="9"};

function writeTop(clr,isSub,wotSub,subH,pix,pixH_t,pic1,pic1W_t,pic1W,pic1H,pic1Cap,pic2,pic2W_t,pic2W,pic2H,pic2Cap,pic3,pic3W_t,pic3W,pic3H,pic3Cap,pic4,pic4W_t,pic4W,pic4H,pic4Cap){
var wTop='<div id="fullPageBox">';
wTop+='<div id="headerBox">';
wTop+='<div id="head0"><img src="images/spacer.gif" width="800" height="20" border="0"></div>';
wTop+='<div id="head1">';
wTop+='<img src="images/headings/moe_head_logo.gif" width="274" height="59" border="0" class="floatLeft">';
wTop+='<img src="images/headings/moe_head_tel.gif" width="178" height="59" border="0" class="floatRight">';
wTop+='</div>';
wTop+='<div id="head2"><img src="images/headings/moehead_div.gif" width="800" height="6" border="0"></div>';
wTop+='<div id="head3"><img src="images/headings/moeheadstrip.gif" width="800" height="54" border="0"></div>';
wTop+='</div>';
wTop+='<div id="head4">';
//wTop+='<script language="JavaScript" type="text/javascript">doMail("info","mountainsofecuador",0,"","Email Us","")</script></div>';
wTop+='<a href="mailto:info@macdigital-uk.com">info@macdigital-uk.com</a>';
wTop+='</div>';


wTop+='<div id="pageContent">';
wTop+='<div id="navSect">';
wTop+='<table border="0" cellspacing="0" cellpadding="0" width="169">';

var theButtonsURLs=eval("theButtonsURLs"+topSuffix);
var theButtonsImages=eval("theButtonsImages"+topSuffix);
for (var loop=0;loop<theButtonsURLs.length;loop++){
if (buttonNum!=(loop+1)){
wTop+='<tr><td><a href="'+myUnescape(theButtonsURLs[loop])+'.htm" onmouseover="glow(\'button0'+eval(loop+1)+'\')" onmouseout="fade(\'button0'+eval(loop+1)+'\')">';
wTop+='<img name="button0'+eval(loop+1)+'" src="images/buttons/'+myUnescape(theButtonsImages[loop])+'_0.gif" alt="" width="169" height="20" hspace="0" vspace="0" border="0"><'+'/a><'+'/td><'+'/tr>';
}
else{
wTop+='<tr><td><a href="'+myUnescape(theButtonsURLs[loop])+'.htm">';
wTop+='<img name="button0'+myUnescape(theButtonsImages[loop])+'" src="images/buttons/'+myUnescape(theButtonsImages[loop])+'_2.gif" alt="" width="169" height="20" hspace="0" vspace="0" border="0"><'+'/a><'+'/td><'+'/tr>';
}
}
wTop+='</table>';
wTop+='</div>';
wTop+='<div id="textSect">';

var xTra=": Click to see a larger version in a new window";

if (pix>0){
wTop+='<div id="pageID">';
wTop+='<table border="0" cellspacing="0" cellpadding="0" width="495">';
wTop+='<tr>';
wTop+='<td bgcolor="'+dCol+'"><img src="images/spacer.gif" width="18" height="'+pixH_t+'" border="0" hspace="0"><'+'/td>';
wTop+='<td><a href="javascr'+'ipt:launchFullPic(\''+pic1+'\','+pic1W+','+pic1H+',\'images/page_ids/\',\''+pic1Cap+'\',2,\''+pic1Cap+'\',\'\',0,\'\',\''+pic1+'Win\',0)">';
wTop+='<img src="images/page_ids/'+pic1+'_t.jpg" width="'+pic1W_t+'" height="'+pixH_t+'" border="0" hspace="0" title="'+pic1Cap+xTra+'"><'+'/a><'+'/td>';
if (pix>1){
wTop+='<td><a href="javascr'+'ipt:launchFullPic(\''+pic2+'\','+pic2W+','+pic2H+',\'images/page_ids/\',\''+pic2Cap+'\',2,\''+pic2Cap+'\',\'\',0,\'\',\''+pic2+'Win\',0)">';
wTop+='<img src="images/page_ids/'+pic2+'_t.jpg" width="'+pic2W_t+'" height="'+pixH_t+'" border="0" hspace="0" title="'+pic2Cap+xTra+'"><'+'/a><'+'/td>';
}
if (pix>2){
wTop+='<td><a href="javascr'+'ipt:launchFullPic(\''+pic3+'\','+pic3W+','+pic3H+',\'images/page_ids/\',\''+pic3Cap+'\',2,\''+pic3Cap+'\',\'\',0,\'\',\''+pic3+'Win\',0)">';
wTop+='<img src="images/page_ids/'+pic3+'_t.jpg" width="'+pic3W_t+'" height="'+pixH_t+'" border="0" hspace="0" title="'+pic3Cap+xTra+'"><'+'/a><'+'/td>';
}
if (pix>3){
wTop+='<td><a href="javascr'+'ipt:launchFullPic(\''+pic4+'\','+pic4W+','+pic4H+',\'images/page_ids/\',\''+pic4Cap+'\',2,\''+pic4Cap+'\',\'\',0,\'\',\''+pic4+'Win\',0)">';
wTop+='<img src="images/page_ids/'+pic4+'_t.jpg" width="'+pic4W_t+'" height="'+pixH_t+'" border="0" hspace="0" title="'+pic4Cap+xTra+'"><'+'/a><'+'/td>';
}
wTop+='<td width=100%" bgcolor="'+dCol+'"><img src="images/spacer.gif" width="10" height="'+pixH_t+'" border="0" hspace="0"><'+'/td>';
wTop+='<'+'/tr>';
wTop+='</table>';
wTop+='</div>';
}
if (isSub>0){
wTop+='<div id="pageCaptionIntro"><img src="images/subheads/'+wotSub+'.gif" width="489" height="'+subH+'" border="0"></div>';
}
wTop+='<div id="pageText">';
document.write(wTop);
}

function writeBase(){
var wBase='</div></div></div>';
wBase+='<div id="baseLine1"><img src="images/spacer.gif" width="10" height="3" border="0" hspace="0"></div>';
wBase+='<div id="baseLine2"><img src="images/spacer.gif" width="10" height="1 " border="0" hspace="0"></div>';
wBase+='<div id="creditFooter">';
wBase+='site by <a class="creditFooter" href="http://www.macdigital-uk.com/" ';
wBase+='target="_blank" title="Click to visit macDigital">macdigital<'+'/a>';
wBase+='</div>';
wBase+='</div>';
document.write(wBase);
}

function glow(imgName) {
  if (document.images) {
    document[imgName].src = eval(imgName + "on.src");
  }
}

function fade(imgName) {
  if (document.images) {
    document[imgName].src = eval(imgName + "off.src");
  }
}


/* Email Writer */

var tld_=new Array()
tld_[0]="com";
tld_[1]="org";
tld_[2]="net";
tld_[3]="ws";
tld_[4]="info";
tld_[5]="edu";
tld_[10]="co.uk";
tld_[11]="org.uk";
tld_[12]="gov.uk";
tld_[13]="ac.uk";
var topDom_=13;
var m_="mailto:";
var a_="@";
var d_=".";

function mail(name,dom,tl,theSubj){
var s=e(name,dom,tl);
document.write('<a href="'+m_+s+theSubj+'">'+s+'</a>');
}

function doMail(name,dom,tl,theSubj,theLinkTxt,theStyle){
document.write('<a href="'+m_+e(name,dom,tl)+theSubj+'" class="'+theStyle+'">'+theLinkTxt+'</a>');
}

function e(name,dom,tl){
var s=name+a_;
if (tl!=-2){
s+= dom;
if (tl>=0)
 s+= d_+tld_[tl];
}
else
s+=swapper(dom);
return s;
}

function swapper(d){
var s="";
for (var i=0; i<d.length; i+=2)
  if (i+1==d.length)
  s+=d.charAt(i)
  else
  s+=d.charAt(i+1)+d.charAt(i);
  return s.replace(/\?/g,'.');
}

