
/* ====================================================

> General Site variables script - The Clear Box Co.
>
> Created by John Mounsey, Peaknet LTD. for TCB
> john@peaknet.ltd.uk
> november © 2OO5 - please do not steal!

==================================================== */

// Site specific settings

siteUrl			= 'www.theclearbox.ch'
siteName		= 'The Clear Box Schweiz'
siteBase		= 'Schweiz'
siteLang		= 'Deutsch'
siteCurr		= 'CHF'
currencies		= 'Swiss Franc'
minCarriage		= '??'
telePhone		= '043-2684901'
cellPhone		= ''
freePhone		= '-'
fax			= '043-2684902'
Zip			= ''
vatNo			= '562709'
eMail			= 'info@theclearbox.ch'
mailTo			= '<A HREF="mailto:' + eMail + '?subject=message from ' + siteUrl + '" title="Email us ..">click here</A>'
air			= ' '
optimalRes		= '1024 x 768'

pagelink		= document.location
pageName		= document.title
defaultStatus		= siteUrl
lastPage		= document.referrer
var now			= new Date();
var thisYear		= now.getYear();
pageW			= screen.width
pageH			= screen.height
pageColours		= screen.colorDepth
ns4			= document.layers
ns6			= document.getElementById&&!document.all
ie4			= document.all



var days		= new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
var months		= new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
var monthNos		= new Array('01','02','03','04','05','06','07','08','09','10','11','12');
var date		= ((now.getDate()<10) ? "0" : "")+ now.getDate();
today			= date + '/' + monthNos[now.getMonth()] + '/' + thisYear +"<SPAN class=hidden></SPAN>";
// today		= days[now.getDay()] + ", " + date + air + monthNos[now.getMonth()] + air + thisYear +"<SPAN class=hidden></SPAN>";

// Developer details

dev			= 'Peaknet Limited'
designer		= 'John Mounsey'
devUrl			= 'http://www.peaknet.ltd.uk/'


/* ====================================================
Print the current Date
==================================================== */

function printDate()

{
document.write('<SPAN TITLE="Today\'s date .." class="date">' + today + '</SPAN>');
}


/* ====================================================
Page Greeting
==================================================== */

function greeting()

{
document.write('');
}


/* ====================================================
Hide "Loading" message
==================================================== */

function hideLoad()

{
document.getElementById('loading')
loading.style.display='none';
}


/* ====================================================
Hi-Lite <TR> areas
==================================================== */

function hi(field)	{ field.className = 'trhi' }
function lo(field)	{ field.className = 'trlo' }


/* ====================================================
Things to do when page 100% loaded or resized
==================================================== */

function loaded()

{
window.status		= 'Page Loaded.'
ToggleLanguage();
}

function diag()

{
var winW 			= document.body.clientWidth
var winH 			= document.body.clientHeight
window.status		= 'Screen across: ' + winW + ' Screen height: ' + winH
}


/* ====================================================
Show Destination of a url
==================================================== */

function preUrl(goal)	{ goal.title = 'Goes to..\n ' + goal.href; }


/* ====================================================
Bookmark / Add to Favorites script
==================================================== */

function bookmark()

{ 
if (window.external) { external.AddFavorite(pagelink,pageName) }
	
else if (navigator.appName == "Netscape") 	{ alert('press control and D now to bookmark this page') }
else if (navigator.appName == "Opera") 		{ alert('press control and T now to bookmark this page') }
}


/* ====================================================
Recommend a Friend
==================================================== */

function sendPage()
	{
	alert('This opens a blank Email for you to send to friends ..');
	window.location='mailto:?subject=I recommend this site: ' + siteUrl + ' (' + siteName + ')';
	}


/* ====================================================
Previous Pages
==================================================== */

function goBack() { history.go(-1); }
function doubleBack() { history.go(-2); }


/* ====================================================
Go to a page
==================================================== */

function go(destUrl)
{
top.location=destUrl;
}


/* ====================================================
Status Bar Captions [note! does not work on <A> tags]
==================================================== */

function cap(label)
{ 
status=label; return true;
}


/* ====================================================
Change text within an ID'd <P> or <TD> tag
==================================================== */

function change(part,msg)
{
document.getElementById(part).innerText = msg;
}


/* ====================================================
Footer Tools
==================================================== */

function footerTools()
{
document.write('<p><a title="Unser sicherer Online Shop.." href="/shop.html" accesskey="s">Shop</a> &nbsp; &nbsp; | &nbsp; &nbsp; <a href="#" onclick=\'window.open("/terms.html","terms","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,height=600,width=600");\'>AGB</a> &nbsp; &nbsp; | &nbsp; &nbsp; <A title="Zurück zur Home Page.." HREF="/" accesskey="h">Home</A> &nbsp; &nbsp; | &nbsp; &nbsp; <a href="#" onClick="Language(\'sw\');" class="pink">Deutsch</a> &nbsp; &nbsp; | &nbsp; &nbsp; <a href="#" onClick="Language(\'fr\');" class="pink">Francais</a></P>');
}

function credit()
{
document.write('<P TITLE="copyright message">' + siteName + ' ist authorisierter Händler für <A HREF="http://www.theclearbox.com/">The Clear Box Company Worldwide Limited.</A>');
document.write('<BR>Mehrwertsteuer Identnr: ' + vatNo + '.<br> Alle Fotos und Inhalte der Seiten sind urheberrechtlich geschützt. Nachdruck, Vervielfältigung, Änderung, Verbreitung und Nutzung einschliesslich Speicherung auf optischen und elektronischen Datenträgern ist nur mit ausdrücklicher Zustimmung von The Clear Box Company Worldwide Limited gestattet.');
document.write('</P>');
}

function footerToolsfr()
{
document.write('<p><a title="Unser sicherer Online Shop.." href="/shop.html" accesskey="s">Shop</a> &nbsp; &nbsp; | &nbsp; &nbsp; <a href="#" onclick=\'window.open("/terms.html","terms","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,height=600,width=600");\'>CGV</a> &nbsp; &nbsp; | &nbsp; &nbsp; <A title="Zurück zur Home Page.." HREF="/" accesskey="h">Home</A> &nbsp; &nbsp; | &nbsp; &nbsp; <a href="#" onClick="Language(\'sw\');" class="pink">Deutsch</a> &nbsp; &nbsp; | &nbsp; &nbsp; <a href="#" onClick="Language(\'fr\');" class="pink">Francais</a></P>');
}

function creditfr()
{
document.write('<P TITLE="copyright message">' + siteName + ' est le concessionnaire autorisé pour <A HREF="http://www.theclearbox.com/">The Clear Box Company Worldwide Limited.</A>');
document.write('<BR>numéro TVA: ' + vatNo + '.<br> Toutes les images, ainsi que toutes les informations contenues dans ce site sont protégées par des droits d’auteur. Toute reproduction, modification, diffusion, utilisation, même partielle, y compris la sauvegarde des données sur support optique ou électronique, n’est autorisée qu’avec l’accord explicite de The Clear Box Company Worldwide Limited.');
document.write('</P>');
}
/* ====================================================
Group menu controller
==================================================== */

function fusionGroup(targ,chosen,restore)
	{
	eval(targ+".location='"+chosen.options[chosen.selectedIndex].value+"'");
	if (restore) chosen.selectedIndex=0;
	}


/* ====================================================
Top right promotional area [default = off]
==================================================== */

function promo()

{
document.write('&nbsp;');
}


/* ====================================================
Menu rollover code
==================================================== */

function mOn(slot)

{
slot.className = 'menuitemon';
}

function mOff(slot)

{
slot.className = 'menuitem';
}

function mHi(slot)

{
slot.className = 'menuhi';
}



/* ====================================================
Generic image roller
==================================================== */

function roll(obj,src)
{
obj.src = src;
}

/* ====================================================
Email Olivia Rocca "Badge"
==================================================== */

function emailOR()
{
document.write('<a href="mailto:info@theclearbox.com?subject=message from: ')
document.write(siteUrl + ' site..')
document.write('"><img vspace="10" src="/gfx/olivia-rocca.gif" alt="Email Clearbox Schweiz" class="gfx">')
document.write('</a>')
}

/* ====================================================
Generic Pop-Up opener
==================================================== */

function MM_openBrWindow(theURL,winName,features)
{
window.open(theURL,winName,features);
}

/* ==================================================== */

/* Home Page Map Captioner */

function nuLabel(msg)
{
document.getElementById('label').innerText=msg;
}

function defLabel()
{
document.getElementById('label').innerText='select your nearest clear box distributor';
}

/* ==================================================== */

/* Right-click blocker */

function stopRightClick() {
	if (event.button==2) {
		alert('Copyright of all images and content is owned by The Clear Box Company Worldwide Limited.\n\n\Reproduction withour prior permission from The Clear Box Company is FORBIDDEN.');
	}
}
document.onmousedown=stopRightClick

/* ==================================================== */

/* remove a class from a page object */

function deClass(targCell)
{
targCell.className='';
}


strLanguage = 'sw';

/*
	Fetch language cookie
*/
strCookieLanguage = cookieGet('Language');
if(strCookieLanguage != '')
{
	strLanguage = strCookieLanguage;
}


function Language(strNewLanguage)
{
	strLanguage = strNewLanguage;
	
	/*
		Need to set cookie here
	*/
	cookieSet('Language', strNewLanguage, 672);
	
	
	ToggleLanguage();
}


function ToggleLanguage()
{
	arrDIVs = document.getElementsByTagName('div');
	arrSPAN = document.getElementsByTagName('span');
	
	DoObjects(arrDIVs);
	DoObjects(arrSPAN);
}


function DoObjects(arrObj)
{
	
	for(intLoop=0; intLoop<arrObj.length; intLoop++)
	{
		objDIV = arrObj[intLoop];
		if(objDIV.className.substring(0, 4) == 'tcb_')
		{
			if(objDIV.className.substring(4) != strLanguage)
			{
				objDIV.style.display = 'none';
			}
			else
			{
				objDIV.style.display = 'block';
			}
		}
	}
}






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);
}