// www.merrillvalleyphotography.co.uk

//menu
// (minimal menu hardcoded for nonJScript browsers)
menuStr= '<div id="column_1"><ul><li class="subheading">NAVIGATION</li><li><a href="index.html">Home page</a></li><li><a href="sitemap.html">Site map</a></li><li class="subheading">SERVICES</li><li><a href="restoration.html">Restoration &amp; image engineering</a></li><li><a href="gallery.html">Selling gallery</a></li><li class="subheading">ORDERING</li><li><a href="quotation.html">Free quotation</a></li><li><a href="payment.html">Make a payment</a></li><li class="subheading">INFORMATION</li><li><a href="faq.html">FAQ</a></li><li><a href="about.html">About us</a></li><li><a href="contact.html">Contact us</a></li><li><a href="terms.html">Terms of use</a></li><li><a href="links.html">External links</a></li></ul><a href="http://track.webgains.com/click.html?wglinkid=5375&amp;wgcampaignid=19510" rel="external"><img src="images/affiliated-with-photobox.gif" width="88" height="31" alt="Photobox"/></a></div>'

// add stats 
menuStr+='<img src="/cgi-bin/axs/ax.pl?mode=img&ref='+escape(document.referrer)+'" height="1" width="1" style="display:none" alt=""/>'



// footer
// (hard coded)

// xhtml validation
// (hard coded)



// =======================================
// popup
// =======================================
popW =""
function pop(link,w,h,l,t){
  // eg <a href="javascript:pop('pix:pam.jpg','300','400','20','c')">Test</a>

  h = parseInt(h)+20
  w = parseInt(w)
  topPos  = parseInt(t);
  leftPos = parseInt(l); 

  // center popup window if asked for
  if (t == 'c') {
    if (screen) {topPos = (screen.height - h)/2}
    if (topPos <0) {topPos = 10}
  }
  if (l == 'c') {
    if (screen) {leftPos = (screen.width - w)/2}
    if (leftPos <0) {leftPos = 10}
  }

  if (popW && !popW.closed){
    popW.close()
  }

  evalStr = "popW = open('popup.html?close.html&"+link+"','popW','status=no,menubar=no,toolbar=no,location=no,resizable=yes,left="+leftPos+",top="+topPos+",height="+h+",width="+w+"');"
  eval(evalStr);
  popW.focus();
} 
// end of pop() function



// index.html scripts

// slideshow

myPix = new Array;
link = new Array;

myPix[0] = "images/grandmother_after.jpg";
link[0]  = "restoration06.html";

myPix[1] = "images/lady_full_after.jpg";
link[1]  = "restoration02.html";

myPix[2] = "images/grandfather_after.jpg";
link[2]  = "restoration03.html";

myPix[3] = "images/lily_after.jpg";
link[3]  = "restoration04.html";

myPix[4] = "images/martin_after.jpg";
link[4]  = "restoration05.html";


imgCt = myPix.length - 1;

var zzz = Math.random();
thisPic = Math.round( (zzz * myPix.length) + 0.5 )-1 ;

function processPrevious() {
  if (document.images) {
    thisPic--
    if (thisPic <0) {
       thisPic = imgCt
    }
    document.myPicture.src = myPix[thisPic]
  }
}

function processNext() {
  if (document.images) {
    thisPic++
    if (thisPic > imgCt) {
       thisPic = 0
    }
    document.myPicture.src = myPix[thisPic]
  }
}

function newLocation() {
  document.location.href = link[thisPic]
}

galleryStr = '<div id="sideimage"><p><a href="javascript:newLocation()"><img src="'+myPix[thisPic]+'" width="200" name="myPicture" alt="Imaging example - click for details" \/><\/A><br clear="left"><a href="javascript:processPrevious()">previous example<\/a>&nbsp;|&nbsp;<a href="javascript:processNext()">next example<\/a><\/p><\/div>'


function loadGallery() {
  if (document.images) {
    img1 = new Image ; img1.src = "images/grandmother_after.jpg";
    img2 = new Image ; img2.src = "images/lady_full_after.jpg";
    img3 = new Image ; img3.src = "images/grandfather_after.jpg";
    img4 = new Image ; img4.src = "images/martin_after.jpg";
    img5 = new Image ; img5.src = "images/lily_after.jpg";
  }
}




// =======================================
// converts all links flagged with rel="external" so they
// open in new window
// eg <a href="document.html" rel="external">external link</a>
// from http://www.sitepoint.com/article/1041
// "New-Window Links in a Standards-Compliant World"
// by Kevin Yank
// =======================================
function externalLinks() { 
 if (!document.getElementsByTagName) return; 
 var anchors = document.getElementsByTagName("a"); 
 for (var i=0; i<anchors.length; i++) { 
   var anchor = anchors[i]; 
   if (anchor.getAttribute("href") && 
       anchor.getAttribute("rel") == "external") 
     anchor.target = "_blank"; 
 } 
} 
// end of externalLinks() function



function dostuffonload() { 
   externalLinks();
   loadGallery();
} 

window.onload = dostuffonload

// end scripts.js