// browser & platform checks --
	
var its;
var browserName;
var browserNameLong;
var browserNew;
var preloadFlag = false;
var Macintosh = navigator.userAgent.indexOf('Mac')>0;

// =================================================================================

function setIdProperty(id,value)
{
	// when browser is getElementByid compatible use this
	document.getElementById(id).style.visibility = value;
}

// =================================================================================

function its() 
{
	var n = navigator;
	var ua = ' ' + n.userAgent.toLowerCase();
	var pl = n.platform.toLowerCase();
	var an = n.appName.toLowerCase();

	// browser version
	this.version = n.appVersion;
	this.nn = ua.indexOf('mozilla') > 0;

	// 'compatible' versions of mozilla aren't navigator
	if(ua.indexOf('compatible') > 0) 
	{
		this.nn = false;
	}
	
	this.opera = ua.indexOf('opera') > 0;
	this.ie = ua.indexOf('msie') > 0;
	this.major = parseInt( this.version );
	this.minor = parseFloat( this.version );

	// platform
	this.mac = ua.indexOf('mac') > 0;
	this.win = ua.indexOf('win') > 0;

	// workaround for IE5 which reports itself as version 4.0
	if(this.ie) 
	{
		if(ua.indexOf("msie 5") > 1) 
		{
			var msieIndex = navigator.appVersion.indexOf("MSIE") + 5;
			this.major = parseFloat(navigator.appVersion.substr(msieIndex,3));
		}
	}

	return this;
}

// =================================================================================


function browserNaming() 
{
	its = new its();
	
	// is it a DOM-enabled browser?
	if (!document.getElementById) 
	{
		browserNew = false;
	}
	else 
	{
		browserNew = true;
	}

	// need the name, too
	if (its.opera) 
	{
		browserName = "Opera";
	}
	else if (its.ie) 
	{
		browserName = "IE";
	}
	else 
	{
		browserName = "NS";
	}

	// and the number
	browserNameLong = browserName + its.major;

}


// single rollover --

function rollover(imageSource, whichImage, imageWidth, imageHeight ,statusText) {
if (document.images) {
	image = new Image(imageWidth,imageHeight);
	image.src = imageSource;
	
	swapImage(whichImage);
	window.status=statusText;
}
}

function unRollover(imageSource, whichImage, statusText) {
if (document.images) {
	replaceImage(imageSource, whichImage);
	returnStatus(statusText);
}
}

function swapImage(whichImage) {
document.images[whichImage].src = image.src;
}

function replaceImage(imageSource, whichImage) {
document.images[whichImage].src = imageSource;
}


function returnStatus(statusText) {
	changeStatus(statusText);
	window.defaultStatus='Supershapes - Code Decode Recode';
}

function changeStatus(statusText) {
	window.status=statusText;
}


// multirollover --

function multirollover(imageSource, whichImage, imageWidth, imageHeight , secondSource , secondImage , statusText) {
 if (document.images) {
	image = new Image(imageWidth,imageHeight);
	image.src = imageSource;
	nextImage = new Image();
	nextImage.src = secondSource;
	
	swapImage(whichImage);
	swapSecondImage(secondImage);
	
 }
 window.status=statusText;
}

function multirolloff(imageSource, whichImage , secondSource , secondImage , statusText) {
 if (document.images) {
	replaceImage(imageSource, whichImage);
	replaceSecondImage(secondSource, secondImage);
 }
 window.status=statusText;
}

function swapSecondImage(secondImage) {
 document.images[secondImage].src = nextImage.src;
}

function replaceSecondImage(secondSource, secondImage) {
 document.images[secondImage].src = secondSource;
}


// popup window function --


function popUp(desktopURL,windowName,width,height,scroll) 
{
		if (Macintosh) 
		{
			if (browserNameLong == "IE4") 
			{
				newheight = parseInt(height + 17);
			
			}
			else if (browserNameLong == "IE4.5") 
			{
				newheight = parseInt(height + 17);
			}
			else 
			{
				newheight = height;
			}
		}
		else 
		{ 
			newheight = height; 
		}
		
		if (scroll == '') 
		{ 
			scroll = 'no'; 
		}
		
		window.open(desktopURL, windowName, "toolbar=no,location=no,status=yes,menubar=no,scrollbars="+scroll+",width="+width+",height="+newheight+",resizable=yes");
}

	

// =================================================================================

// hide mail --

	function bear(agriculture,alternative,ring)
	{
		agriculture += ' ';
		var area = agriculture.length;
		var heat = 0;
		var waist = '';
	
		for(var computer = 0; computer < area; computer++)
		{
			heat = 0;
			while(agriculture.charCodeAt(computer) != 32)
			{
				heat = heat * 10;
				heat = heat + agriculture.charCodeAt(computer)-48;
				computer++;
			}
			waist += String.fromCharCode(have(heat,alternative,ring));
		}
		parent.location = 'm'+'a'+'i'+'l'+'t'+'o'+':'+waist;
	}
	
	
	
	function have(extraterrestrial,flore,people)
	{
		if (people % 2 == 0)
		{
			bow = 1;
			for(var objective = 1; objective <= people/2; objective++)
			{
				book = (extraterrestrial*extraterrestrial) % flore;
				bow = (book*bow) % flore;
			}
		}
		else
		{
			bow = extraterrestrial;
			for(var opportunity = 1; opportunity <= people/2; opportunity++)
			{
				book = (extraterrestrial*extraterrestrial) % flore;
				bow = (book*bow) % flore;
			}
		}
		return bow;
	}

// =================================================================================


