/*
 Standard - javascript
 ------------------------------------------------------
 handles all the dirty little tricks and DHTML effects.
*/


// Browsercheck
function lib_bwchecks()
{
	var userAgent = navigator.userAgent.toLowerCase();

	this.ver=navigator.appVersion;
	this.agent=navigator.userAgent;
	this.dom=document.getElementById?1:0;
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6;
	this.ie_ver=0;
	this.mac=this.agent.indexOf("Mac")>-1;
	this.opera5=this.agent.indexOf("Opera 5")>-1;
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5);

	this.is_opera  = (userAgent.indexOf('opera') != -1);
	this.is_saf    = ((userAgent.indexOf('safari') != -1) || (navigator.vendor == "Apple Computer, Inc."));
	this.is_webtv  = (userAgent.indexOf('webtv') != -1);
	this.is_ie = ((userAgent.indexOf('msie') != -1) && (!this.is_opera) && (!this.is_saf) && (!this.is_webtv));
	if(this.is_ie)
	{
		for(var i=10; i>=1; i--)
		{
			if(userAgent.indexOf("msie " + i + ".") != -1)
			{
				this.ie_ver = i;
				break;
			}
		}
	}

	this.bw=(this.ie7 || this.ie6 || this.ie5 || this.ie4 || (this.ie_ver>=5) || this.ns4 || this.ns6 || this.opera5 || this.is_opera || this.is_saf || this.is_webtv);

	return this;
}
var bwstd=new lib_bwchecks();


// Variables
//-------------

nWorks = 0;
nSlidespeed = 5;
nNewsheight = 80;
nBetweendelay = 4500;
nFont = 'arial,helvetiva';
nFontsize = 14;
nFadespeed = 60;
nFontStyle = "font-style:oblique; font-weight:bolder; ";
nColor=new Array('#F6F5FA', '#EEEEEE','#DDDDDD','#CCCCCC','#BBBBBB','#AAAAAA','#999999','#888888','#777777','#666666','#625B58');
nNews=new Array();

nNews[0]=new Array();
nNews[0]["text"]="Leverage our custom website designs, to accelerate your business, and give you an edge with an online presence!";
nNews[0]["link"]="#";
nNews[1]=new Array();
nNews[1]["text"]="Looking to move your business towards positive growth? Our managerial consultants will help make it a reality!";
nNews[1]["link"]="#";
nNews[2]=new Array();
nNews[2]["text"]="Not sure what networking infrastructure you should employ? Let our IT experts make sense out of it all for you!";
nNews[2]["link"]="#";
nNews[3]=new Array();
nNews[3]["text"]="Need that one piece of software that does it all? Our custom application design team can make it happen!";
nNews[3]["link"]="#";

timSpeed = 50;
contHeight = 100;
var scrollTime = 1;
var active = 0;

// A unit of measure that will be added when setting the position of a layer, for the browsers that need it.
var px = bwstd.ns4||window.opera?"":"px";



//Object code...Object constructors and functions...
function makeNewsObj(obj,nest,font,size,color,news,fadespeed,betweendelay,slidespeed,works,newsheight)
{
    nest= (!nest)?"":'document.'+nest+'.';

   	this.css = bwstd.dom ? document.getElementById(obj).style : bwstd.ie4 ? document.all[obj].style : bwstd.ns4 ? eval(nest+"document.layers." +obj) : 0;
   	this.writeref=bwstd.dom? document.getElementById(obj):bwstd.ie4?document.all[obj]:bwstd.ns4?eval(nest+"document.layers." +obj+".document"):0;

	if(font)
	{
		this.color = new Array();
		this.color = eval(color);
		this.news = new Array();
		this.news = eval(news);
		this.font = font;
		this.size = size;
		this.speed = fadespeed;
		this.delay = betweendelay;
		this.newsheight = newsheight;
		this.fadeIn = b_fadeIn;
		this.fadeOut = b_fadeOut;
		this.newsWrite = b_newsWrite;
		this.y=1;
		this.slideIn = b_slideIn;
		this.moveIt = b_moveIt;
		this.slideSpeed = slidespeed;
		this.works = works;

		if(bwstd.dom || bwstd.ie4)
		{
			this.css.fontFamily = this.font;
			this.css.fontSize = this.size;
			this.css.color = this.color[0];
		}
	}
	this.obj = obj + "Object";
	eval(this.obj + "=this");
	return this;
}



function b_moveIt(x,y)
{
	this.x=x;
	this.y=y;
	this.css.left=this.x+px;
	this.css.top=this.y+px;
}

function b_newsWrite(num,i)
{
	if (bwstd.ns4){
		this.writeref.write("<a target=\"myTarget\" style=\"text-decoration:none; "+nFontStyle+" font-size:"+this.size+"px\">"
			+"<font face=\""+this.font+"\" color=\""+this.color[i]+"\">"+this.news[num]['text']+"</font></a>");
		this.writeref.close();
	}
	else
		this.writeref.innerHTML = '<a id="'+this.obj+'link' +'" target="myTarget" style=\"text-decoration:none; '
		+nFontStyle+' font-size:'+this.size+'px; color:'+this.color[i]+'" >'+this.news[num]['text']+'</a>';
}


function b_fadeOut(num,i)
{
	if (i>=0)
	{
		if (i==0 || bwstd.ns4)
			this.newsWrite(num,i);
		else
		{
			obj = bwstd.ie4 ? eval(this.obj+"link") : document.getElementById(this.obj+"link");
			obj.style.color = this.color[i];
		}
		i--;
		setTimeout(this.obj+".fadeOut("+num+","+i+")",this.speed);
	}else{
		num++;
		if(num==this.news.length)
			num=0;

		works = (!this.works) ? 0 : (this.works==1) ? 1 : Math.round( Math.random() );
		if(works==0)
			setTimeout(this.obj+".fadeIn("+num+",0)",500);
		else if (works==1)
		{
			this.y=1;
			setTimeout(this.obj+".slideIn("+num+",0)",500);
		}
	}
}


//The fade functions
function b_fadeIn(num,i)
{
	if (i<this.color.length)
	{
		if (i==0 || bwstd.ns4)
			this.newsWrite(num,i);
		else
		{
			obj = bwstd.ie4 ? eval(this.obj+"link") : document.getElementById(this.obj+"link");
			obj.style.color = this.color[i];
		}
		i++;
		setTimeout(this.obj+".fadeIn("+num+","+i+")",this.speed);
	}
	else
		setTimeout(this.obj+".fadeOut("+num+","+(this.color.length-1)+")",this.delay);
}


//Slide in
function b_slideIn(num,i)
{
	if (this.y>0)
	{
		if (i==0)
		{
			this.moveIt(0,this.newsheight);
			this.newsWrite(num,this.color.length-1);
		}
		this.moveIt(this.x,this.y-this.slideSpeed);
		i++;
		setTimeout(this.obj+".slideIn("+num+","+i+");",50);
	}
	else
		setTimeout(this.obj+".fadeOut("+num+","+(this.color.length-1)+")",this.delay);
}



//The init function.
function fadeInit()
{
	oNews = new makeNewsObj('divNews','divNewsCont',nFont,nFontsize,"nColor","nNews",nFadespeed,nBetweendelay,nSlidespeed,nWorks,nNewsheight);
	oNewsCont = new makeNewsObj('divNewsCont');
	works = (!oNews.works) ? 0 : (oNews.works==1) ? 1 : Math.round( Math.random() );

	if (works==0)
		oNews.fadeIn(0,0);
	else if (works==1)
		oNews.slideIn(0,0);

	oNewsCont.css.visibility = "visible";
}


//======================================================================================================================
//======================================================================================================================


function makeScrollObj(obj,nest)
{
	nest = (!nest) ? "":'document.'+nest+'.';
	this.el = bwstd.dom ? document.getElementById(obj) : bwstd.ie4?document.all[obj] : bwstd.ns4 ? eval(nest+'document.'+obj) : 0;
  	this.css = bwstd.dom ? document.getElementById(obj).style : bwstd.ie4 ? document.all[obj].style : bwstd.ns4 ? eval(nest+'document.'+obj) : 0;
	this.height = bwstd.ns4 ? this.css.document.height : this.el.offsetHeight;
	this.top = b_gettop;
	return this;
}


//Getting the top for the top method
function b_gettop()
{
	var gleft = (bwstd.ns4 || bwstd.ns6) ? parseInt(this.css.top) : eval(this.css.pixelTop);
	return gleft;
}


function scroll(speed)
{
	clearTimeout(scrollTime);
	way = (speed>0) ? 1 : 0;
	if ((!way && oScroll[active].top()>-oScroll[active].height+contHeight) || (oScroll[active].top()<0 && way))
	{
		oScroll[active].css.top = (oScroll[active].top()+speed)+px;
		scrollTim = setTimeout("scroll("+speed+")",timSpeed);
	}
}

//Clears the timeout so the scroll stops, this is called onmouseout.
function noScroll()
{
	clearTimeout(scrollTim);
}



function changeActive(num)
{
	var i,l=navTabs.length;

	oScroll[active].css.visibility = "hidden";
	active = num;
	oScroll[active].css.top = 0+px;
	oScroll[active].css.visibility = "visible";


	navTabs[num] = 1;
	for(i=0; i<l; i++)
	{
		if(i!=num)
			navTabs[i] = 0;
	}

}

function scrollInit()
{
	oScroll = new Array();

	oScroll[0] = new makeScrollObj('divScroll0','divCont');
	oScroll[1] = new makeScrollObj('divScroll1','divCont');
	oScroll[2] = new makeScrollObj('divScroll2','divCont');
	oScroll[3] = new makeScrollObj('divScroll3','divCont');
	oScroll[4] = new makeScrollObj('divScroll4','divCont');

	oScroll[0].css.left = 0+px;
	oScroll[0].css.top = 0+px;
	oScroll[0].css.visibility = "visible";
	oControl = new makeScrollObj('divControl');
	oControl.css.visibility = "visible";
}



function stClear()
{
	window.status='';
}





























