var bPageIsLoaded = false;
/***********************************************************************
*
* setCookie -	Generic Set Cookie routine
*
* Input: sName	 -	Name of cookie to create
*	 sValue	 -	Value to assign to the cookie
*	 sExpire -	Cookie expiry date/time (optional)
*
* Returns: null
*
************************************************************************/

function setCookie(sName, sValue, sExpire) 
    {
    var sCookie = sName + "=" + escape(sValue) +"; path=/";	// construct the cookie
    if (sExpire)
    	{
    	sCookie += "; expires=" + sExpire.toGMTString();	// add expiry date if present
    	}
    document.cookie = sCookie;					// store the cookie
    return null;
    }

/***********************************************************************
*
* getCookie	-	Generic Get Cookie routine
*
* Input: sName	-	Name of cookie to retrieve
*
* Returns:		Requested cookie or null if not found
*
************************************************************************/

function getCookie(sName) 
    {
    var sCookiecrumbs = document.cookie.split("; "); 	// break cookie into crumbs array
    var sNextcrumb
    for (var i=0; i < sCookiecrumbs.length; i++) 
	{
	sNextcrumb = sCookiecrumbs[i].split("=");	// break into name and value
	if (sNextcrumb[0] == sName)			// if name matches
	    {
	     return unescape(sNextcrumb[1]); 		// return value
	    }
	}
	return null;
    }

/***********************************************************************
*
* saveReferrer -	Saves the referrer to a Cookie
*
* Input: 		nothing
*
* Returns:		null
*
************************************************************************/

function saveReferrer() 
    {
    var bSetCookie = false;
    if (parent.frames.length == 0)					// No FrameSet
		{
		bSetCookie = true;
		}
    else														// FrameSet in use
		{
		var bCatalogFrameSet = false;
		for (var nFrameId = parent.frames.length; nFrameId > 0; nFrameId--)
			{
			if (parent.frames[nFrameId - 1].name == 'CatalogBody')	// Catalog FrameSet used
				{
				bCatalogFrameSet = true;
				break;
				}
			}
		if (bCatalogFrameSet)							// Catalog FrameSet
			{
			if (window.name=='CatalogBody')			// and this is the CatalogBody frame
				{
				bSetCookie = true;
				}
			}
		else													// Not Catalog FrameSet
			{
			bSetCookie = true;
			}
		}
    if (bSetCookie)
		{
		var sUrl = document.URL;
		var nHashPos = sUrl.lastIndexOf("#");		// Look for URL anchor
		if (nHashPos > 0)									// if it exists
		    {
		    sUrl = sUrl.substring(0,nHashPos);		// then remove it
		    }
		setCookie("ACTINIC_REFERRER", sUrl);		// Emulates HTTP_REFERER
		}
	    return null;
	    }
    
saveReferrer();						// For v6 only, should be in templates for v7

/***********************************************************************
*
* CreateArray	creates an array with n elements
*
* Input: n	-	number of elements
*
* Returns:		the created array
*
************************************************************************/

function CreateArray(n)
	{
	this.length = n;
	for (var i=1; i <= n; i++)							// for all ns
		{
		this[i] = new Section();						// create a section structure
		}
	return this;											// return the created array
	}

/***********************************************************************
*
* Section	-	creates the section structure for raw section lists
*
* Input: 				nothing
*
* Returns:				nothing
************************************************************************/

function Section()
	{
	this.sURL = null;
	this.sName = null;
	this.sImage = null;
	this.nImageWidth = null;
	this.nImageHeight= null;
	this.nSectionId	= null;
	this.pChild = null;
	}
	
/***********************************************************************
*
* SwapImage			-	swaps an image to the alternative
*
* Input:	sName		-	name of the image
*
*			sAltImage	-	filename of the alternative image
*
************************************************************************/

function SwapImage(sName, sAltImage)
	{
	var nCount = 0;
	document.aSource = new Array;						// array for images
	if (document[sName] != null)						// if image name exists
		{
		document.aSource[nCount++] = document[sName];	// store image
		if(null == document[sName].sOldSrc)
			{
			document[sName].sOldSrc = document[sName].src;	// store image source
			}
		document[sName].src = sAltImage;				// change image source to alternative
		}
	}

/***********************************************************************
*
* RestoreImage		-	restores an image to the original
*
* Input: 				nothing
*
* Returns:				nothing
************************************************************************/

function RestoreImage()
	{
	var nCount, aSource = document.aSource;
	if (aSource != null)									// if array of images exists
		{
		for(nCount=0; nCount < aSource.length; nCount++)	// restore all images
			{
			if ((aSource[nCount] != null) &&
				(aSource[nCount].sOldSrc != null))	// if we stored something for this image
				{
				aSource[nCount].src = aSource[nCount].sOldSrc;	// restore the original image
				}
			}
		}
	}

/***********************************************************************
*
* PreloadImages		-	restores an image to the original
*
* Input: 				nothing
*
* Returns:				nothing
*
************************************************************************/

function PreloadImages()
	{
	bPageIsLoaded = true;
	if(document.images)
		{
		if(!document.Preloaded)							// preload array defined?
			{
			document.Preloaded = new Array();		// no, define it
			}
		var nCounter , nLen = document.Preloaded.length, saArguments = PreloadImages.arguments;
		for(nCounter = 0; nCounter < saArguments.length; nCounter++)	// iterate through arguments
			{
			document.Preloaded[nLen] = new Image;
			document.Preloaded[nLen++].src = saArguments[nCounter];
			}
   	}
	}
	
/***********************************************************************
*
* ShowPopUp		-	creates pop up window
*
* Input: sUrl		-	URL o page to display
*			nWidth	-	Width of window
*			nHeight	-	Height of window
*
* Returns:				nothing
*
************************************************************************/

function ShowPopUp(sUrl, nWidth, nHeight)
  	{  
	window.open(sUrl, 'ActPopup', 'width=' + nWidth + ',height=' + nHeight + ',scrollbars, resizable');
	if (!bPageIsLoaded)
		{
		window.location.reload(true);
		}
	}

function StockLevels(pItem){
	var strIDs = 'Stock Message: '
	{
	if (pItem == 5000){
		strIDs = '<b>In Stock</b>'
		}
	else if(pItem == 1000){
		strIDs = '<b>2/3 Days</b>'
		}
	else if(pItem == 500){
		strIDs = '<b>5/7 Days</b>'
		}
	else if(pItem == 300){
		strIDs = '<font color=red><b>Back order</b></font>'
		}
	else if(pItem == 0){
		strIDs = '<font color=red><b>Out of stock</b></font>'
		}
	else if(pItem == -9999){
		strIDs = '<font color=red><b>DISCONTINUED</b></font>'
		}
	else{
		strIDs = '<font color=red><b>Out of stock</b></font>'
		}
	}
	return strIDs
}
function StockLevelsImage(pItem){
	var strIDs = 'Stock Image: '
	{
	if (pItem == 5000){
		strIDs = '<img src="icon_20_green.gif">'
		}
	else if(pItem == 1000){
		strIDs = '<img src="icon_20_yellow.gif">'
		}
	else if(pItem == 500){
		strIDs = '<img src="icon_20_yellow.gif">'
		}
	else if(pItem == 300){
		strIDs = '<img src="icon_20_yellow.gif">'
		}
	else if(pItem == 0){
		strIDs = '<img src="icon_20_red.gif">'
		}
	else if(pItem == -9999){
		strIDs = '<img src="icon_20_red.gif">'
		}
	else{
		strIDs = '<img src="icon_20_red.gif">'
		}
	}
	return strIDs
}


var sA=['<font size="2"><b>The <font color="#FF6600">Online</font> Blank Disc <font color="#FF6600">Shop</font></b></font>','<font size="2"><b>Authorised <a href="http://www.dvdshoponline.co.uk/','</a> Distributor</b></font>','<font size="2"><b>The <font color="#FF6600">Online</font> Blank Disc <font color="#FF6600">Shop</font></b></font>'];
var xb="cgi-bin/ss000001.pl?SECTIONID=",yb="%2ehtml&NOLOGIN=1";
var y="%2ehtml&NOLOGIN=1";
var z="url=http://www.dvdshoponline.co.uk/cgi-bin/ss000001.pl?SECTIONID=";
var se=" Series";
var hS="onbgcolor=#F5F5F5;offbgcolor=#F5F5F5;onborder=1px solid #317194;offborder=1px solid #317194;";
var d = [" DVD+R "," DVD+RW "," DVD-R "," DVD-RW ","Blank Media","Printable Media","Double Layer","ReWritable","Printable"];
var D =	["%5fDVD%5fR%5f","%5fDVD%5fRW%5f","%5fDVD%5f%5fR%5f","%5fDVD%5f%5f%5fRW%5f","Blank%5fMedia","Printable%5fMedia","Double%5fLayer","ReWritable","Printable"];
var h = ["\x74\x65\x78\x74=\x44\x65\x73\x6B\x4A\x65\x74\xA0","\x74\x65\x78\x74=\x49\x6E\x6B\x4A\x65\x74\xA0\x46\x61\x78\xA0","\x74\x65\x78\x74=\x4F\x66\x66\x69\x63\x65\x4A\x65\x74\xA0","\x74\x65\x78\x74=\x50\x68\x6F\x74\x6F\x73\x6D\x61\x72\x74\xA0","\x74\x65\x78\x74=\x4C\x61\x73\x65\x72\x4A\x65\x74\xA0","\x74\x65\x78\x74=\x43\x6F\x6C\x6F\x75\x72\xA0\x43\x6F\x70\x69\x65\x72\xA0","\x74\x65\x78\x74=\x50\x53\x43\xA0","\x74\x65\x78\x74=\x43\x6F\x6C\x6F\x72\xA0\x4C\x61\x73\x65\x72\x4A\x65\x74\xA0","\x74\x65\x78\x74=\x44\x65\x73\x6B\x77\x72\x69\x74\x65\x72\xA0","\x74\x65\x78\x74=\x44\x69\x67\x69\x74\x61\x6C\xA0\x43\x6F\x70\x69\x65\x72\xA0","\x74\x65\x78\x74=\x44\x65\x73\x69\x67\x6E\x4A\x65\x74\xA0","\x74\x65\x78\x74=\x4D\x6F\x70\x69\x65\x72\xA0"];
var H =	[""+z+"\x44\x65\x73\x6B\x4A\x65\x74%5f",""+z+"\x46\x61\x78%5f",""+z+"\x4F\x66\x66\x69\x63\x65\x4A\x65\x74%5f",""+z+"\x50\x68\x6F\x74\x6F\x73\x6D\x61\x72\x74%5f",""+z+"\x4C\x61\x73\x65\x72\x4A\x65\x74%5f",""+z+"\x43\x6F\x6C\x6F\x75\x72%5f\x43\x6F\x70\x69\x65\x72%5f",""+z+"\x50\x53\x43%5f",""+z+"\x43\x6F\x6C\x6F\x72%5f\x4C\x61\x73\x65\x72\x4A\x65\x74%5f",""+z+"\x44\x65\x73\x6B\x77\x72\x69\x74\x65\x72%5f",""+z+"\x44\x69\x67\x69\x74\x61\x6C%5f\x43\x6F\x70\x69\x65\x72%5f",""+z+"\x44\x65\x73\x69\x67\x6E\x4A\x65\x74%5f",""+z+"\x4D\x6F\x70\x69\x65\x72%5f"];
var e = ["\x74\x65\x78\x74=\x53\x74\x79\x6C\x75\x73\xA0","\x74\x65\x78\x74=\x53\x74\x79\x6C\x75\x73\xA0\x43\x6F\x6C\x6F\x72\xA0","\x74\x65\x78\x74=\x53\x74\x79\x6C\x75\x73\xA0\x50\x68\x6F\x74\x6F\xA0","\x74\x65\x78\x74=\x53\x74\x79\x6C\x75\x73\xA0\x43\xA0","\x74\x65\x78\x74=\x53\x74\x79\x6C\x75\x73\xA0\x43\x58\xA0","\x74\x65\x78\x74=\x53\x74\x79\x6C\x75\x73\xA0\x52\xA0","\x74\x65\x78\x74=\x53\x74\x79\x6C\x75\x73\xA0\x52\x58\xA0"];
var E = [""+z+"\x53\x74\x79\x6C\x75\x73%5f",""+z+"\x53\x74\x79\x6C\x75\x73%5f\x43\x6F\x6C\x6F\x72%5f",""+z+"\x53\x74\x79\x6C\x75\x73%5f\x50\x68\x6F\x74\x6F%5f"];
var l = ["\x74\x65\x78\x74=Lexmark F","\x74\x65\x78\x74=Lexmark P","\x74\x65\x78\x74=Lexmark X","\x74\x65\x78\x74=Lexmark Z"];
var L = [""+z+"Lexmark%5fF",""+z+"Lexmark%5fP",""+z+"Lexmark%5fX",""+z+"Lexmark%5fZ"];
var v = ["Arita","Benq","Bulkpaq","Datasafe","Datawrite","Fujifilm","HP","Hyundai","Infiniti","Lexmark","Memorex","MPO","Philips","Piodata","Ridata","RiDisc","Sony","Staedtler","Sumvision","Taiyo Yuden","TDK","Traxdata","Tuffdisc","Verbatim","Ritek","DataOn","Ricoh","Unbranded","Gigatain","Intenso","Mirror","Maxell","Epson","Canon"];
var V = [""+z+"Arita",""+z+"Benq",""+z+"Bulkpaq",""+z+"Datasafe",""+z+"Datawrite",""+z+"Fujifilm",""+z+"HP%5fMedia",""+z+"Hyundai",""+z+"Infiniti",""+z+"Lexmark",""+z+"Memorex",""+z+"MPO",""+z+"Philips",""+z+"Piodata",""+z+"Ridata",""+z+"RiDisc",""+z+"Sony",""+z+"Staedtler",""+z+"Sumvision",""+z+"Taiyo%5fYuden",""+z+"TDK",""+z+"Traxdata",""+z+"Tuffdisc",""+z+"Verbatim",""+z+"Ritek",""+z+"DataOn",""+z+"Ricoh",""+z+"Unbranded",""+z+"Gigatain",""+z+"Intenso",""+z+"Mirror",""+z+"Maxell",""+z+"Epson",""+z+"Canon"];
var mA = ["onbgcolor=#F5F5F5;offbgcolor=#F5F5F5;onborder=1px solid #317194;offborder=1px solid #317194;image=18_color.gif;overimage=18_color.gif;text=<b>","separatorsize=1;","separatorsize=2;","separatorsize=3;","</b><br>Select the printer ","onbgcolor=#FDB5A7;offbgcolor=#FDB5A7;showmenu=Ink Finder;text=&nbsp;Ink Labels Paper;","offbgcolor=#FDB5A7;onbgcolor=#FDB5A7;showmenu=Disc Finder;text=&nbsp;DVD and CD Media;"];