// JavaScript Document

// random masthead splash generator

function randomMastheadSplash()

{
var splashMastheadImage=new Array()

// location of images in this array
splashMastheadImage[1]="Assetts/Images/masthead1.jpg";
splashMastheadImage[2]="Assetts/Images/masthead2.jpg";
splashMastheadImage[3]="Assetts/Images/masthead3.jpg";
splashMastheadImage[4]="Assetts/Images/masthead4.jpg";
splashMastheadImage[5]="Assetts/Images/masthead5.jpg";

var getRan=Math.floor(Math.random()*splashMastheadImage.length)
if (getRan==0)
getRan=1

document.write('<img src=\"'+splashMastheadImage[getRan]+'\" alt=\"Norfolk Centre Caravan Club\" title=\"Caravan Club Norfolk Centre website.\" width=\"740\" height=\"155\" \/>');
}
// end random masthead splash generator

// Iframe code starts here

function getDocHeight(doc) {
  var docHt = 0, sh, oh;
  if (doc.height) docHt = doc.height;
  else if (doc.body) {
    if (doc.body.scrollHeight) docHt = sh = doc.body.scrollHeight;
    if (doc.body.offsetHeight) docHt = oh = doc.body.offsetHeight;
    if (sh && oh) docHt = Math.max(sh, oh);
  }
  return docHt;
}

function setIframeHeight(iframeName) {
  var iframeWin = window.frames[iframeName];
  var iframeEl = document.getElementById? document.getElementById(iframeName): document.all? document.all[iframeName]: null;
  if ( iframeEl && iframeWin ) {
    iframeEl.style.height = "auto"; // helps resize (for some) if new doc shorter than previous  
    var docHt = getDocHeight(iframeWin.document);
    // need to add to height to be sure it will all show
    if (docHt) iframeEl.style.height = docHt + 0 + "px";
  }
}

function loadIframe(iframeName, url) {
  if ( window.frames[iframeName] ) {
    window.frames[iframeName].location = url;   
    return false;
  }
  else return true;
}
// Iframe code ends here

<!--
// Hide from old browsers
  // All you have to do is put another text in the variable message.
  // Don't forget to break all lines with a ^
  // When you do not place a ^ at the end of all the message, the
  // message will not repeat
  message     = " Welcome to the Norfolk Centre Caravan Club website.^" +
                "Our rallies are simply a gathering of Caravan Club members,^" +
				"for a weekend or holiday, to promote friendship and common interests,^" +
                "in a lightheated manner and having some fun along the way....^" +
				"Why not give it a try and please come and join us, .^" +
                "as we all rally for pleasure and aim to share many enjoyable rallies... ^" +
               "^"
  scrollSpeed = 25
  lineDelay   = 2500
  // Do not change the text below //
  txt         = ""
  function scrollText(pos) {
    if (message.charAt(pos) != '^') {
      txt    = txt + message.charAt(pos)
      status = txt
      pauze  = scrollSpeed
    }
    else {
      pauze = lineDelay
      txt   = ""
      if (pos == message.length-1) pos = -1
    }
    pos++
    setTimeout("scrollText('"+pos+"')",pauze)
  }
  // Unhide -->
scrollText(0)
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
// JavaScript Document
// swap photos and collapse buttons 

function swap(targetId,buttonId){
  
  if (document.getElementById)
        {
        target = document.getElementById(targetId);
        buttonName = document.getElementById(buttonId);
        
            if (target.style.display == "none")
                {
                target.style.display = "";
                } 
            
            else 
                {
                target.style.display = "none";
                }
                
            if (target.style.display == "none")
                {
                buttonName.src = "Assetts/Images/nav_open.gif";
                }
            else 
                {
                buttonName.src = "Assetts/Images/nav_close.gif";
                }
        }
}
// end of swap photos and collapse buttons 


// swap image and caption 

function swapPhoto(photoSRC,theCaption,theDate,theBy) {

	var displayedCaption = document.getElementById("caption");
	
	displayedCaption.firstChild.nodeValue = theCaption;

	var displayedDate = document.getElementById("Date");
	
	displayedDate.firstChild.nodeValue = theDate;

	var displayedCaption = document.getElementById("By");
	
	displayedCaption.firstChild.nodeValue = theBy;

document.images.imgPhoto.src = "Assetts/Images/Gallery/Large/" + photoSRC;
}

// end of swap image and caption 
