
// Routine to change session cookie PrintCSS to the value 'kindle' to indicate that the Kindle 
// version of the Print CSS file should be imported.
function setKindle () {

  if (testSessionCookie()) {
    writeSessionCookie ('printCSS', 'kindle');     
    var printType = getCookieValue('printCSS');    
    if (printType == "kindle") 
      alert ('Print CSS file now set to Kindle format')
    else
      alert ('Failed to set print CSS file to Kindle format');
  }
  else 
    alert ('Cannot change print CSS file - Session Cookies not available');
}

// Routine to change session cookie PrintCSS to the value 'A4' to indicate that the standard 
// version of the Print CSS file should be imported.
function setA4 () {

  if (testSessionCookie()) {
    writeSessionCookie ('printCSS', 'A4'); 
    if (printType == "A4") 
      alert ('Print CSS file now set to A4 format');
    else
      alert ('Failed to set print CSS file to A4 format');
  }
  else
    alert ('Cannot change Print CSS file - Session Cookies not available');
}

// Set up the print CSS file to the Kindle one if the cookie set by setprint.shtml indicates that is
// what is required.
var printType = getCookieValue('printCSS');
var a = document.getElementById("print_style_sheet").href;
if (printType == "kindle") {
  document.getElementById("print_style_sheet").href = "/chartreuse/private/kindle.css";
}

// Routine used to allow the photo.php transaction to scan through the photographs
function next () {
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]current=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    location.href = "http://www.braemoor.co.uk/chartreuse/photos.php?current=" + results[1];
}

// Disable JavaScript error reporting
window.onerror = function() {return true};
