// JavaScript Document

function $(elementName) {
	return document.getElementById(elementName);
}

function DisplayImage (nav) {
	if (nav == 'Writing') {
		$('arrowWriting').style.display = 'inline';
		$('arrowLocalization').style.display = 'none';
		$('arrowResources').style.display = 'none';
		$('arrowContact').style.display = 'none';
		$('arrowHome').style.display = 'none';
		$('arrowNone').style.display = 'none';
	} else if (nav == 'Localization') {
		$('arrowLocalization').style.display = 'inline';
		$('arrowWriting').style.display = 'none';
		$('arrowResources').style.display = 'none';
		$('arrowHome').style.display = 'none';
		$('arrowContact').style.display = 'none';
		$('arrowNone').style.display = 'none';
	} else if (nav == 'Resources') {
		$('arrowResources').style.display = 'inline';
		$('arrowLocalization').style.display = 'none';
		$('arrowWriting').style.display = 'none';
		$('arrowHome').style.display = 'none';
		$('arrowContact').style.display = 'none';
		$('arrowNone').style.display = 'none';
	} else if (nav == 'Contact') {
		$('arrowContact').style.display = 'inline';
		$('arrowLocalization').style.display = 'none';
		$('arrowWriting').style.display = 'none';
		$('arrowResources').style.display = 'none';
		$('arrowHome').style.display = 'none';
		$('arrowNone').style.display = 'none';
	}  else if (nav == 'Home') {
		$('arrowHome').style.display = 'inline';
		$('arrowContact').style.display = 'none';
		$('arrowLocalization').style.display = 'none';
		$('arrowWriting').style.display = 'none';
		$('arrowResources').style.display = 'none';
		$('arrowNone').style.display = 'none';
	} else {
		$('arrowLocalization').style.display = 'none';
		$('arrowWriting').style.display = 'none';
		$('arrowResources').style.display = 'none';
		$('arrowContact').style.display = 'none';
		$('arrowHome').style.display = 'none';
		$('arrowNone').style.display = 'inline';
	}
}


function DisplayImage2 (nav) {
	if (nav == 'Services') {
		$('arrowServices').style.display = 'inline';
		$('arrowClients').style.display = 'none';
		$('arrowBlog').style.display = 'none';
		$('arrowPresent').style.display = 'none';
		$('arrowScenarios').style.display = 'none';
		$('arrowPapers').style.display = 'none';
		$('arrowNone2').style.display = 'none';
	} else if (nav == 'Clients') {
		$('arrowClients').style.display = 'inline';
		$('arrowServices').style.display = 'none';
		$('arrowBlog').style.display = 'none';
		$('arrowScenarios').style.display = 'none';
		$('arrowPresent').style.display = 'none';
		$('arrowPapers').style.display = 'none';
		$('arrowNone2').style.display = 'none';
	} else if (nav == 'Blog') {
		$('arrowBlog').style.display = 'inline';
		$('arrowClients').style.display = 'none';
		$('arrowServices').style.display = 'none';
		$('arrowScenarios').style.display = 'none';
		$('arrowPresent').style.display = 'none';
		$('arrowPapers').style.display = 'none';
		$('arrowNone2').style.display = 'none';
	} else if (nav == 'Papers') {
		$('arrowPapers').style.display = 'inline';
		$('arrowPresent').style.display = 'none';
		$('arrowClients').style.display = 'none';
		$('arrowServices').style.display = 'none';
		$('arrowBlog').style.display = 'none';
		$('arrowScenarios').style.display = 'none';
		$('arrowNone2').style.display = 'none';
	} else if (nav == 'Present') {
		$('arrowPresent').style.display = 'inline';
		$('arrowClients').style.display = 'none';
		$('arrowServices').style.display = 'none';
		$('arrowBlog').style.display = 'none';
		$('arrowScenarios').style.display = 'none';
		$('arrowPapers').style.display = 'none';
		$('arrowNone2').style.display = 'none';
	}  else if (nav == 'Scenarios') {
		$('arrowScenarios').style.display = 'inline';
		$('arrowPresent').style.display = 'none';
		$('arrowClients').style.display = 'none';
		$('arrowServices').style.display = 'none';
		$('arrowBlog').style.display = 'none';
		$('arrowPapers').style.display = 'none';
		$('arrowNone2').style.display = 'none';
	} else {
		$('arrowClients').style.display = 'none';
		$('arrowServices').style.display = 'none';
		$('arrowScenarios').style.display = 'none';
		$('arrowPresent').style.display = 'none';
		$('arrowBlog').style.display = 'none';
		$('arrowPapers').style.display = 'none';
		$('arrowNone2').style.display = 'inline';
	}
}

function $(elementName) {
	return document.getElementById(elementName);
}

function ToggleFrame (frameID, frameLinkID) {
	var frame = $(frameID);
	var frameLink = $(frameLinkID);
	if (frame.className == 'companybox') {
		frame.className = 'companyboxdisplayed';
		frameLink.innerHTML = '[Close]';
	} else {
		frame.className = 'companybox';
		frameLink.innerHTML = '[Open]';
	}
}




function Banner(refreshTime/*, width, height, altText, random*/){
	this.objName = "bannerAd" + (Banner.count++);
	eval(this.objName + "=this");
	if (!refreshTime) this.refreshTime = 5000; else this.refreshTime = refreshTime*1000;
	this.ads = [];
	this.mySize = 0;

	this.Ad = function(src, width, height, altText) {
		this.ads[this.mySize] = new Object();
		var ad = this.ads[this.mySize];
		ad.src = src;
		ad.width = width;
		ad.height = height;
		ad.altText = altText;
		this.mySize++;
	}

	this.randomAd = function() {
		var n;
		do { n = Math.floor(Math.random() * (this.mySize)); } 
		while (n == this.currentAd);
		this.currentAd = n;
	}

	this.output = function() {
		var tempCode = "";
		if (this.mySize > 1) {
			if (this.currentAd == null) this.randomAd();
			if (this.currentAd >= this.mySize) this.currentAd = this.mySize - 1;
			tempCode += '<img src="' + this.ads[this.currentAd].src + '" width="' + this.ads[this.currentAd].width;
			tempCode += '" name="' + this.objName + 'Img" height="' + this.ads[this.currentAd].height + '" ';
			if (this.ads[this.currentAd].altText) tempCode += 'alt="'+this.ads[this.currentAd].altText + '" ';
			tempCode += ' />';
			document.write(tempCode);
			this.nextAd();
		} else document.write("Error: two banners must be defined for the script to work.");
	}

	this.newAd = function(){
		this.randomAd();
		this.nextAd();
	}

	this.nextAd = function(){
		document.images[this.objName+ 'Img'].src = this.ads[this.currentAd].src;
		document.images[this.objName+ 'Img'].height = this.ads[this.currentAd].height;
		document.images[this.objName+ 'Img'].width = this.ads[this.currentAd].width;
		document.images[this.objName+ 'Img'].alt = this.ads[this.currentAd].altText;
		setTimeout(this.objName+'.newAd()',this.refreshTime)
	}
}
Banner.count = 0;