// Misc functions
// created: Mar 5/05
// rev: Aug 5/09

// Global vars

// Used to determine what is marked as a recently updated page.
// Don't forget to change RecentPeriod in quicknav.js as well.
  var rcpRecentPeriod = 3;

// Encoded email addresses
  var aerial
  p1='ai'; p2='r2yo' ; p3='u@rc' ; p4='p.ca'
  aerial = p1+p2+p3+p4

  var contactme
  p1='r'; p2='o' ; p3='b@rc' ; p4='p.ca'
  contactme = p1+p2+p3+p4

  var callme
  p1='(807'; p2=') 62' ; p3='1-6' ; p4='384'
  callme = p1+p2+p3+p4

  var feedback
  p1='r'; p2='o' ; p3='b@rc' ; p4='p.ca'
  feedback = p1+p2+p3+p4

  var rcpEvents
  p1='ev'; p2='ents' ; p3='@rcp' ; p4='.ca'
  rcpEvents = p1+p2+p3+p4

  var Webster
  p1='web'; p2='_ster' ; p3='@rcp' ; p4='.ca'
  Webster = p1+p2+p3+p4

  var WebSales
  p1='web'; p2='_sales' ; p3='@rcp' ; p4='.ca'
  WebSales = p1+p2+p3+p4

// RootOffset
// Needed to determine relative location of files (ex: showfaq, etc) that are called from RCP root directory and
//   subdirectories (ex. webgalleries).
// Replace "../../.." with "+RootOffset+"
// The old way of loading from 2 locations worked but the missing one generated excessive "404" errors.
  var srcfile = document.URL;
  var gallery = "webgall";
  srcval = srcfile.indexOf(gallery)
  var RootOffset = "";
  if (srcval>='0') {
    RootOffset = "../../../../";
  }

// Display a message if they're using a mac with internet explorer 
function CheckBrowser() {
  var browserName=navigator.appName.toLowerCase();
  var browserOS=navigator.userAgent.toLowerCase();
  if (browserName == "microsoft internet explorer" && browserOS.indexOf("mac")!=-1) {
    document.write("<P Class='SmallText' Align=Center>");
    document.write("You appear to be using a Mac with Internet Explorer. Some features of this site may not work correctly<br>because Microsoft is no longer updating the Mac version of Explorer and it has become outdated.<br>Please consider updating to a newer browser such as Mozilla or Safari. Thank you.<br><br>");
  }
}


function CheckScreenSize() {
  var GoodWidth=1024;
  var GoodHeight=768;
  if (screen.width<GoodWidth || screen.height<GoodHeight) {
    document.write("<P Class='RegText' Align=Center><Span><font color='red'>Note:</font> ");
    document.write("These webpages are best viewed at "+GoodWidth+"x"+GoodHeight+" or higher. Your current display settings are "+screen.width+"x"+screen.height+".</span><br>");
  }
}

function CheckScreenColours () {
  var GoodBitDepth=16;
  var BitDepth = screen.pixelDepth;
  if (BitDepth<GoodBitDepth) {
    document.write("<P Class='SmallText' Align=Center>");
    document.write("The photo's will look better with a higher number of screen colours. Current colour setting is "+BitDepth+"bit.<br>");
  }
}

// Close pic sub-window when closing any htm page
function CleanUp() {
  if (picwin) {
    picwin.close();
//  paypalw.close();
  }
}

// Are cookies enabled?
// Create a cookie
document.cookie = 'temp' + escape('nothing')
// then check to see if any cookies exist - called from index.htm
function CookieCheck() {
  if (document.cookie == "") {
    alert("We use temporary cookies to assist in site\n navigation, please enable this option in your browser.\n\n If cookies are enabled and you are seeing this message\n please let us know about the problem as soon as possible.");
  }
}


var cardwin = null;
function ShowCard(CardName) {
  var CardWide = 525
  var CardWinWide = CardWide + 100;
  var CardTall = 300
  var CardWinTall = CardTall + 200;
// if window doesn't exist, create it
  if (!cardwin || cardwin.closed)  {
cardwin=window.open("","BusCardWindow","menubar=yes,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,hotkeys=no,top=1,left=1,width="+CardWinWide+",height="+CardWinTall+"");
  }
//output HTML to remote window
  cardwin.document.open()
  cardwin.document.write("<!doctype html public '-//W3C//DTD HTML 4.0 Transitional//EN'>")
  cardwin.document.write("<html><head>")
  cardwin.document.write("<title>Right click on image to save this card to your computer.</title>")
  cardwin.document.write("</Head>")
  cardwin.document.write("<Body bgcolor='black'>")
  cardwin.document.write("<\script language='JavaScript' type='text/javascript'>")
  cardwin.document.write("resizeTo("+CardWinWide+","+CardWinTall+");")
  cardwin.document.write("<\/script>")
  cardwin.document.write("<br>")
  cardwin.document.write("<table border=5 align=center spacing=6 padding=3>")
  cardwin.document.write("<tr><td>")
  cardwin.document.write("<Img src='"+CardName+"' width='"+CardWide+"' height='"+CardTall+"' Border=0 Title='Right click here to save this card' Alt='Right click here to save this card'>")
  cardwin.document.write("</a></td></tr></table>")
  cardwin.document.write("<Br>");
  cardwin.document.write("</Body></Html>")
  cardwin.document.close()
// make it the active window
  cardwin.focus()
}


var faqwin = null;
function ShowFaq() {
// if window doesn't exist, create it
  if (!faqwin || faqwin.closed)  {
faqwin=window.open("","FaqWindow","menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,hotkeys=no,top=1,left=1,width=590,height=600");
  }
//  point it to showfaq.htm - has to include full url to work from skiing webgallery
  faqwin.location.href=RootOffset+"showfaq.htm";
  faqwin.focus()
}


var fdbkwin = null;
function ShowFeedBack() {
// if window doesn't exist, create it
  if (!fdbkwin || fdbkwin.closed)  {
fdbkwin=window.open("","FdBkWindow","menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,hotkeys=no,top=1,left=1,width=540,height=580");
  }
//  point it to feedback.htm - has to include full url to work from skiing webgallery
  fdbkwin.location.href=RootOffset+"feedback.htm";
  fdbkwin.focus()
}


var portwin = null;
function ShowPort() {
// if window doesn't exist, create it
  if (!portwin || portwin.closed)  {
portwin=window.open("","PortWindow","menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,hotkeys=no,top=1,left=1,width=540,height=600");
  }
//  point it to showport.htm
  portwin.location.href="showport.htm";
  portwin.focus()
}


var prcwin = null;
function ShowPrices() {
// if window doesn't exist, create it
  if (!prcwin || prcwin.closed)  {
prcwin=window.open("","PrcWindow","menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,hotkeys=no,top=1,left=1,width=520,height=600");
  }
//  point it to showprc.htm
  prcwin.location.href="showprc.htm";
  prcwin.focus()
}

// Layout paypal window - just in case - not used anywhere, but might be needed someday
function DefinePayPal() {
// if window doesn't exist, create it
  if (!paypalw || paypalw.closed)  {
  paypalw=window.open("","paypal","menubar=no,toolbar=yes,location=yes,directories=yes,status=yes,scrollbars=yes,resizable=yes,hotkeys=yes,top=1,left=1,width=450,height=300")
  paypalw.document.open()
  paypalw.document.write("<html><head><title>'PayPal/RCP'</title></head>")
  paypalw.document.write("<body onload='window.blur()' bgcolor='#dbdbdb' text='black'>")
  paypalw.document.write("<basefont='3'>")
  paypalw.document.write("<center><br><br>This window has been created for PayPal usage.")
  paypalw.document.write("</body></html>")
  paypalw.document.close()
  }
  paypalw.focus()
}


<!-- Pixastic / Desaturate -->

    function Desat() {
	  Pixastic.process(document.getElementById("img1"), "desaturate");
    }
// caution - reset display photo at actual size, ignores display width & height values - use page reload!!
    function resetDesat() {
//      window.location.reload();
      var old = document.getElementById("img1");
      var img = new Image();
      img.src = old.src||old.imgsrc;
      img.id = "img1";
      img.setAttribute("style", old.getAttribute("style"));
      old.parentNode.replaceChild(img, old);
    }

