
// Utilities for PowerTicker site - Written by Colin Biggin
// www.powerticker.net

IE_EXPLORER		= false;
IE_EXPLORER_7	= false;
FIREFOX			= false;
SAFARI			= false;
OPERA			= false;
CAMINO			= false;
ICAB			= false;
KONQUEROR		= false;
BROWSER_UNKNOWN = true;

OS_WINDOWS		= false;
OS_MACINTOSH	= false;
OS_LINUX		= false;
OS_UNKNOWN		= true;

checkBROWSER();

function checkBROWSER()
{
	if (navigator.userAgent.indexOf("MSIE 7.0") != -1) IE_EXPLORER_7 = true;
	else if (navigator.userAgent.indexOf("MSIE") != -1) IE_EXPLORER = true;

	if (navigator.userAgent.indexOf("Firefox") != -1) FIREFOX = true;
 	if (navigator.userAgent.indexOf("Opera") != -1) OPERA = true;

	// mac only
	if (navigator.userAgent.indexOf("Safari") != -1) SAFARI = true;
	if (navigator.userAgent.indexOf("Camino") != -1) CAMINO = true;
	if (navigator.userAgent.indexOf("iCab") != -1) ICAB = true;
	if (SAFARI || CAMINO || ICAB) {
		BROWSER_UNKNOWN = false;
		OS_MACINTOSH = true;
	}

	// check for the platform
	if (navigator.userAgent.indexOf("Windows") != -1) OS_WINDOWS = true;
	if (navigator.userAgent.indexOf("Macintosh") != -1) OS_MACINTOSH = true;

	return;
}

function loadIMAGE(srcImage, destWidth, destHeight, hrefPage, destAlignment)
{	var theFormat, theImage;

	if (IE_EXPLORER)
		theFormat = ".gif";
	else
		theFormat = ".png";

	
	theImage = "<img src=\"" + srcImage + theFormat + "\"";
	if (destWidth != "") theImage = theImage + " width=\"" + destWidth + "\"";
	if (destHeight != "") theImage = theImage + " height=\"" + destHeight + "\"";
	if (destAlignment != "") theImage = theImage + " align=\"" + destAlignment + "\"";
	theImage = theImage + ">";

	// spew it out
	if (hrefPage != "") {
		theClickPage = "<a href=\"" + hrefPage + "\">";
		document.write(theClickPage);
		document.write(theImage);
		document.write("<\a>");
	} else {
		document.write(theImage);
	}

	return;
}

function loadPlatformIMAGE(srcImage, destWidth, destHeight, destAlignment, hrefImage, hrefTarget)
{	var theFormat, theImage;

	if (OS_WINDOWS)
		theFormat = ".gif";
	else
		theFormat = ".png";

	theImage = "<img src=\"" + srcImage + theFormat + "\"";
	if (destWidth != "") theImage = theImage + " width=\"" + destWidth + "\"";
	if (destHeight != "") theImage = theImage + " height=\"" + destHeight + "\"";
	if (destAlignment != "") theImage = theImage + " align=\"" + destAlignment + "\"";
	theImage = theImage + ">";

	// spew it out
	if (hrefImage != "") {
		theClickPage = "<a href=\"" + hrefImage + theFormat + "\"";
		if (hrefTarget != "") theClickPage = theClickPage + " target=\"" + hrefTarget + "\"";
		theClickPage = theClickPage + ">";
		document.write(theClickPage);
		document.write(theImage);
		document.write("<\a>");
	} else {
		document.write(theImage);
	}

	return;
}

function loadIE_CSS(ieCSS)
{
	if ((OS_WINDOWS) && (IE_EXPLORER)) {
		ieCSSPage = "<link rel=\"stylesheet\" href=\"" + ieCSS + "\" type=\"text/css\">";
		document.write(ieCSSPage);
	}
}