
/* ====================================================
General Site variables script
==================================================== */

pagelink		= document.location
pagename		= document.title
siteUrl			= 'www.template.com'
developer		= 'John Mounsey'
developerurl		= 'www.peaknet.ltd.uk'
defaultStatus		= siteUrl
mailTitle		= siteUrl + ' - ' + pagename + ' : ' + pagelink


/* ====================================================
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') }
}


/* Send page to friend ... */

function sendlink()
	{
	alert('This opens a new Email message for you to send to friends ...');
	window.location='mailto:?subject=' + mailTitle
	}

/* ====================================================
Previous Page
==================================================== */

function previous() { history.go(-1); }



/* ====================================================
Display Page Title
==================================================== */

function title() { document.write(document.title); }


/* ====================================================
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 today() { document.write(lmonth + " " + date); }



/* Loaded Page actions ... */

function loaded(currentPage)
{
document.alert(currentPage);
}

/* Hide "Loading" message ... */

function hideLoad()

{
document.getElementById('loading')
loading.style.display='none';
}



/* Hi-Lite FORM FIELDS ... */

function hi(field)	{ field.className = 'hilite'; }
function lo(field)	{ field.className = 'lolite'; }



function popImage(imageURL,imageTitle)
{
	if (isNN){imgWin=window.open('about:blank','',optNN);}
	if (isIE){imgWin=window.open('about:blank','',optIE);}
	
	with (imgWin.document)
	{
		writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');
		writeln('<sc'+'ript>');
		writeln('var isNN,isIE;');
		writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
		writeln('isNN=(navigator.appName=="Netscape")?1:0;');
		writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1 || navigator.appName.indexOf("Opera")!=-1 || navigator.appName.indexOf("Firefox")!=-1)?1:0;}');
		
		writeln('function reSizeToImage(){');
		writeln('if (isIE){');
		writeln('window.resizeTo(100,100);');
		writeln('width=100-(document.body.clientWidth-document.images[0].width);');
		writeln('height=100-(document.body.clientHeight-document.images[0].height);');
		writeln('window.resizeTo(width,height);}');
		writeln('if (isNN){');       
		writeln('window.innerWidth=document.images["onlyone"].width;');
		writeln('window.innerHeight=document.images["onlyone"].height;}}');
		
		writeln('function doTitle(){document.title="'+imageTitle+'";}');
		writeln('</sc'+'ript>');
		
		writeln('</head><body bgcolor=000000 scroll="no">');
		
		writeln('<img name="onlyone" src='+imageURL+' style="display:block">');
		writeln('<sc'+'ript>reSizeToImage();doTitle();self.focus();</sc'+'ript>')
		writeln('</body></html>');
		close();
	}
}



function hide(pagePart)
{
document.getElementById(pagePart).style.display='none';
}

function show(pagePart)
{
document.getElementById(pagePart).style.display='block';
}



// ----- Literature access! (November 2011) -----
// Unlocks the Literature Download links upon entering a "valid" Email address.
// Jnm 16-06-2009

function fieldCheck(addressEntered,productInQuestion)
	{
	if (addressEntered == 0 || addressEntered.search('@') == -1 || addressEntered.search('.') == -1 || addressEntered.length < 10)
		{
		alert('Please enter a valid Email address.');
		return false;
		}
		
	else
	
	alert('Thanks. Click OK to reveal the free literature download links.\n\nEmail entered: '+addressEntered);
	document.getElementById('fileLinks').className='on';
	//document.getElementById('proceed').disabled=false;
	pageTracker._trackPageview('Trackr : Literature unlocked : '+addressEntered+ ' (' +productInQuestion+ ')');	
	}
