//**********************
//   Images
//**********************
var imgPath = "images/"
imgAbout = new Image();
imgAbout.src = imgPath + "about.gif";
imgAboutOv = new Image();
imgAboutOv.src = imgPath + "/aboutov.gif";
imgServices = new Image();
imgServices.src = imgPath + "serv.gif";
imgServicesOv = new Image();
imgServicesOv.src = imgPath + "servov.gif";
imgContact = new Image();
imgContact.src = imgPath + "contact.gif";
imgContactOv = new Image();
imgContactOv.src = imgPath + "acontactov.gif";
imgClients = new Image();
imgClients.src = imgPath + "clients.gif";
imgClientsOv = new Image();
imgClientsOv.src = imgPath + "clientsov.gif";
imgHome = new Image();
imgHome.src = imgPath + "home.gif";
imgHomeOv = new Image();
imgHomeOv.src = imgPath + "homeov.gif";
imgPortfolio = new Image();
imgPortfolio.src = imgPath + "port.gif";
imgPortfolioOv = new Image();
imgPortfolioOv.src = imgPath + "portov.gif";

function domSwap(imageName,fName){
	theImg=document.getElementById(imageName);
	theImg.setAttribute("src",fName);
}

function domSwapBack(imageName,fName){
	theImg=document.getElementById(imageName);
	theImg.setAttribute("src",fName);
}

/*************************************************************************
  This code is from Dynamic Web Coding at http://www.dyn-web.com/
  See Terms of Use at http://www.dyn-web.com/bus/terms.html
  regarding conditions under which you may use this code.
  This notice must be retained in the code as is!
*************************************************************************/

var timer_id;
function scroll_iframe(frm,inc,dir) {
	if (timer_id) clearTimeout(timer_id);
  	if (window.frames[frm]) {
    		if (dir == "v") window.frames[frm].scrollBy(0, inc);
    		else window.frames[frm].scrollBy(inc, 0);
    		timer_id = setTimeout("scroll_iframe('" + frm + "'," + inc + ",'" + dir + "')", 20);
	}
}

function stopScroll() { if (timer_id) clearTimeout(timer_id); }

//******************************************************************
// Loading the iFrame
//******************************************************************

function loadIframe(iframeName, url) {
	if ( window.frames[iframeName] ) {
		window.frames[iframeName].location = url;   
		return false;
  	}else{
		return true;
	}
}

//Links calling this function are set up as follows:

//<a href="page.htm"
// onclick="return loadIframe('ifrm', this.href)"
// >Page 1</a>

//******************************************************************
// Portfolio pages
//******************************************************************

var portNumber = 0;
var portMax; //set the maximum number of portfolio pages and images

var arrPortPages = new Array();

arrPortPages[0]="port_jarrolds.htm"
arrPortPages[1]="port_boxsets.htm"
arrPortPages[2]="port_ogc.htm"
arrPortPages[3]="port_compton.htm"
arrPortPages[4]="port_ucles.htm"
arrPortPages[5]="port_authors.htm"
arrPortPages[6]="port_novels.htm"
arrPortPages[7]="port_odpm.htm"
arrPortPages[8]="port_kew.htm"
arrPortPages[9]="port_whitehall.htm"


portMax = arrPortPages.length-1;


function moveNextPort(iframeName, intForward){
	portNumber = portNumber + intForward;
	if (portNumber > portMax){
		//go back to 0
		portNumber = 0;
	}
	if (portNumber < 0){
		//go to max
		portNumber = portMax;
	}
	loadIframe(iframeName,arrPortPages[portNumber]);
}

function launchImage(strName,strTitle){
	//find last slash
	var slash = "\/";
	var strPath = new String( window.location);
	var strBase = new String();
	strBase = strPath.substring(0, strPath.lastIndexOf(slash,strPath.length-1));
	//window.alert(strBase);

	var newWindow
	newWindow = window.open( "","launchImage","copyhistory=no,toolbar=no,scrollbars=yes,directories=no,menubar=no,resizable=yes,width=500,height=400" );
	newWindow.location.href=strBase + "/imgtemplate.htm?" + escape(strBase + "/images/" + strName)+  "&" + escape(strTitle);
	newWindow.opener = window.parent;
	newWindow.opener.name = "opener";
	newWindow.focus();	
	return;
}