/* Force product pages into index frameset */
var path = document.location.href;
var htmPos = path.indexOf("htm");
var pathLen = path.length;
var lastSlashPos = path.lastIndexOf("/");
var page = path.substr(lastSlashPos+1,htmPos-lastSlashPos+3);
var DTitle = document.title;
var tPos1 = DTitle.lastIndexOf("-");
var ProdName = DTitle.substr(tPos1+2);
/* Set isWeb to true when posted to server: */
var isWeb = true;
var CurrI = 0;

if (isWeb && (parent==self || window.frames.name == "left"))
	{
	self.location.replace('index.html?right=' + page);
	}

/* Load main category frameset */
function loadCat(cat)
{
var catDoc = "cat_fr.html";
	/* If no frames (very unlikely , in view of above!), load index with category*/
	if (parent.window.frames.length == 0)
	{
	window.location = "index.html?right=" + catDoc + "?cat=" + cat;
	}
	else if (parent.window.frames[1].name == "right")
	/* Then must already have sidebar menu, but not a category */
	{
	window.location = catDoc + "?cat=" + cat;
	}
	else
	{
	/* Otherwise, detect category and reload main category if neccesary */
		if (parent.catName.indexOf(cat) == -1)
		{
		parent.window.location = catDoc + "?cat=" + cat;
		}
		else
		{
		alert("You are already viewing the category");
		window.status="";
		}
	}
}

/*	Create "Go to Category" link at foot of product pages
	Link will be missing for non-Javascript browsers, or if category is already loaded */
function mk_link(cat,lnkTxt,Brk)
{
if ((!parent.catName) || (parent.catName.indexOf(cat) == -1))
	{
	if (lnkTxt=="" || (!lnkTxt))
		{
		lnkTxt = "Go to Category";
		}
document.write("<a href=\"javascript:loadCat('"+cat+"');\" onmouseover=\"hideJS('"+lnkTxt+"');return true\" onmouseout=\"hideJS('');return true\" >"+lnkTxt+"</a>"); 
	if (Brk=="" || (!Brk))
		{
		document.write(" | ");
		}
	if (Brk=="BR")
		{
		document.write("<br />");
		}
	if (Brk=="N")
		{
		document.write("");
		}
	}
}

/* Various mouseOver functions */
function hideJS(statusText)
{
window.status=statusText;
}

function LoadImg(imageSource,whichImage,statusText,CaptionTxt,imageWidth,imageHeight)
{
if (document.images)
	{
	if ((imageWidth) && (imageHeight))
		{
		document.images[whichImage].width = imageWidth;
		document.images[whichImage].height = imageHeight;
		}
	document.images[whichImage].src = imageSource;
	window.status=statusText;
	if (CaptionTxt)
		{
		showCap(CaptionTxt);
		} 
	}
}

function showCap(text)
{
var Capt = document.getElementById("Caption");
Capt.innerHTML = text;
}

/* Click button to cycle through images in array */
function rotateImg(whichImage)
{
if (document.images)
	{
	CurrI++;
	if (CurrI == ImgCt)
		{
		CurrI=0;
		}
	document.images[whichImage].src = Imgs[CurrI];
	showCap(Caps[CurrI]);
	}
}

/* Page specific rollovers and image sets */
if (page=="aab.html")
{
var Imgs = new Array("images/177183.gif","images/177166.gif","images/177153.gif");
var Caps = new Array("HP Ref.177-183","Not Ref.177-166","Rough Ref.177-153");
var ImgCt = Imgs.length;
preLoad();
}
if (page=="bffp.html")
{
var Imgs = new Array("images/fpbf3.gif","images/fpbfx3.gif","images/fpbf4.gif","images/fpbfx4.gif");
var Caps = new Array("300gsm Not","300gsm Rough","425gsm Not","425gsm Rough");
var ImgCt = Imgs.length;
preLoad();
}
if (page=="jp847.html")
{
var Imgs = new Array("images/950-01.gif","images/950-06.gif","images/950-07.gif","images/950-09.gif","images/950-10.gif");
var Caps = new Array("Ref. 950-01 Red","Ref. 950-06 Green","Ref. 950-07 Blue","Ref. 950-09 Violet","Ref. 950-10 Pink");
var ImgCt = Imgs.length;
preLoad();
}
if (page=="him1.html")
{
var Imgs = new Array("images/L01.gif","images/L03.gif");
var Caps = new Array("L01","L03");
var ImgCt = Imgs.length;
preLoad();
}
if (page=="him3.html")
{
var Imgs = new Array("images/L97A.gif","images/L97B.gif","images/L97C.gif","images/L97D.gif","images/L97E.gif");
var Caps = new Array("L97A","L97B","L97C","L97D","L97E");
var ImgCt = Imgs.length;
preLoad();
}
if (page=="spe.html")
{
var Imgs = new Array("images/speSatin.gif","images/speTextured.gif","images/speVelvet.gif");
var Caps = new Array("Satin","Textured","Velvet");
var ImgCt = Imgs.length;
preLoad();
}
if (page=="wfblk.html")
{
var Imgs = new Array("images/wfblockH.gif","images/wfblockN.gif","images/wfblockR.gif");
var Caps = new Array("Hot Pressed","Not","Rough");
var ImgCt = Imgs.length;
preLoad();
}
if (page=="wffp.html")
{
var Imgs = new Array("images/fpwf3H.gif","images/fpwf3N.gif","images/fpwf3R.gif");
var Caps = new Array("Hot Pressed","Not","Rough");
var ImgCt = Imgs.length;
preLoad();
}
if (page=="hdis.html")
{
var Imgs = new Array("images/hdtr2.gif","images/hdtr3.gif");
var Caps = new Array("Bamboo/Baryta Sampler ref. 10640216 Side 1","Bamboo/Baryta Sampler ref. 10640216 Side 2");
var ImgCt = Imgs.length;
preLoad();
}

/* Called from jpp.html */
function jpreamble()
{
document.write("We have divided our range of 37 Japanese paper products into four overlapping categories that either indicate a method of manufacture or a possible end use:<BR><BR>");
}

function preLoad()
{
if (document.images)
	{
	var load = new Array;
	for (var i = 0; i < Imgs.length; i++)
		{
		load[i] = new Image();
		load[i].src = Imgs[i];
		}
	}
}

function EmailThis()
{
document.write("<a href=\"mailto:?subject=Link to "+ProdName+"&body=http://www.rkburt.com/products/"+page+"\">Email Link</a>"); 
}
