var arrDisplay        = new Array();
arrDisplay['pound']   = '&pound;';
arrDisplay['euro']    = '&euro;';
arrDisplay['dollar']  = '$';

/* ====================================================
General Site variables script
==================================================== */

pagelink		= document.location
pagename		= document.title
sitetitle		= 'The English Shaving Company © '
siteurl			= 'http://www.theenglishshavingcompanyespanol.com'
developer		= 'Peaknet LTD'
developerurl 	= 'http://www.peaknet.co.uk'
today		   	= new Date
today_time		= today.getHours()

/* ====================================================
Detect for correct browser to determine CSS file
==================================================== */

if	     (document.layers)		               		{ browser="n4"; }
else if  (document.all)		 	                    { browser="ie"; }
else if  (!document.all && document.getElementById)	{ browser="n6"; }


/* ====================================================
HI-lite for form fields
==================================================== */

function hi(field)	{ field.className = 'formboxHI'; 	}
function lo(field)	{ field.className = 'formbox';		}

/* ====================================================
Send page to friend
==================================================== */

function sendlink() { window.location='mailto:?subject=Take a look at this!&body=' + pagename + ' : ' + pagelink }

/* ====================================================
Previous Page
==================================================== */

function previous() { history.go(-1); }

/* ====================================================
Menu
==================================================== */


function setStyleById(i, p, v)

{
var n = document.getElementById(i);
n.style[p] = v;
}

	var rangeRef, styleObj, endObj;
    
	layerSwitch="document.all";
	styleSwitch=".style";
	

new ypSlideOutMenu("001", "down", 200, 300, 250, 300);
new ypSlideOutMenu("002", "down", 200, 300, 250, 300);
new ypSlideOutMenu("003", "down", 200, 300, 250, 300);

function moveMenu(MenuName) {
var oSource = event.srcElement;
 if (oSource != '') {
var Left = getPageLeft(oSource) ;
var Top = getPageTop(oSource) ;
var MenuChild = window.document.all[(MenuName)];   
MenuChild.style.left = Left +0;
MenuChild.style.top = Top + 25;
}
}

function getPageLeft(obj) {
	
		var goUp = 0;
		var parent = obj;

		while (parent && parent.tagName != "BODY" &&
			parent.tagName != "HTML") {
				goUp += parent.offsetLeft;
				parent = parent.offsetParent;
		}

		return goUp;
	}


function getPageTop(obj) {
	
		var goUp = 0;
		var parent = obj;

		while (parent && parent.tagName != "BODY" &&
			parent.tagName != "HTML") {
				goUp += parent.offsetTop;
				parent = parent.offsetParent;
		}

		return goUp;
	}


/* ====================================================
Print Today's DATE function - Y2K + Netscape friendly
==================================================== */

var months=new Array(13);

months[1]	= "January";
months[2]	= "February";
months[3]	= "March";
months[4]	= "April";
months[5]	= "May";
months[6]	= "June";
months[7]	= "July";
months[8]	= "August";
months[9]	= "September";
months[10]	= "October";
months[11]	= "November";
months[12]	= "December";

var time=new Date();
var lmonth=months[time.getMonth() + 1];
var date=time.getDate();
var year=time.getYear();
if (year < 2000)
year = year + 1900;

function year() { document.write(year); }

defaultStatus	= sitetitle + year;

/* ====================================================
Bookmark the page
==================================================== */

function bookmark()

{
	if (window.external)
	{
	external.AddFavorite(pagelink,pagename)
	}
	
	else if(navigator.appName == "Netscape")
	{
	alert('press control and D now!')
	}

	else if(navigator.appName == "Opera")
	{
	alert('press control and T now!')
	}
}



function format2dp(value)
{
	if(value == 0)
	{
		return '0.00';
	}
	var tmpValue  = String(parseInt((value + .005) * 100));
	var intLength = tmpValue.length;
	return tmpValue.substring(0, intLength-2) + '.' + tmpValue.substr(intLength-2, 2);
}




function cookieGet(strName)
{
	//alert(document.cookie);
	var arrCookie       = document.cookie.split('; ');
	//var arrEachCookie = new Array();
	var strValue        = '';
	
	for( var intLoop = 0; intLoop < arrCookie.length; intLoop++)
	{
		var arrEachCookie = arrCookie[intLoop].split('=');
		
		if(arrEachCookie[0] == strName)
		{
			var strValue = arrEachCookie[1];
		}
	}
	
	return strValue;
}




function cookieSet(strName, strValue, intHours)
{
	var dtmToday    = new Date();
	var dtmExpiry   = new Date(dtmToday.getTime() + (intHours * 60 * 60 * 1000));
	
	document.cookie = strName + "=" + escape(strValue) + "; expires=" + dtmExpiry.toGMTString() + "; path =/";
}



function cookieDelete(strName)
{
	cookieSet(strName, null, -24);
}



function SetCurrency(strDisplay)
{
	cookieSet('Currency', strDisplay, 24);

	location.reload();
}



function DisplayPrice(floAmount, bolVAT, bolStrong)
{
	strCookie = unescape(cookieGet('Currency'));
	
	if(strCookie == '')
	{
		strCookie = 'euro';
	}
	
	var strOutput = arrDisplay[strCookie] + format2dp(floAmount * arrConvert[strCookie]);
	
	
	if(bolStrong == 0)
	{
		document.write(strOutput);
	}
	else
	{
		document.write('<strong>' + strOutput + '</strong>');
	}
	
	if(bolVAT)
	{
		document.write(' (' + arrDisplay[strCookie] + format2dp((floAmount * arrConvert[strCookie]) / 1.175) + ' ex. Tax)');
	}
}


function British()
{
	strCookie = unescape(cookieGet('Currency'));
	arrCookie = strCookie.split(',');
	
	if(strCookie == 'pound')
	{
		return true;
	}
	return false;
}

/* ======================================================
End of file
====================================================== */
