var isDOM=document.getElementById?1:0;
var isIE=document.all?1:0;
var isNS4=(navigator.appName=='Netscape'&&!isDOM)?1:0;
var isWin=(navigator.platform.indexOf('Win')!=-1)?1:0;
var isDyn=(isDOM||isIE||isNS4);

function popUp(URL,HEIGHT,WIDTH) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width="+WIDTH+",height="+HEIGHT+"');");
}

function popSmall(URL,HEIGHT,WIDTH) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width="+WIDTH+",height="+HEIGHT+"');");
}

function getRef(id, par)
{
par = !par ? document : (par.navigator?par.document:par);
return (isIE ? par.all[id] :
(isDOM ? (par.getElementById?par:par.ownerDocument).getElementById(id) :
par.layers[id]));
}

function getSty(id, par)
{
return (isNS4 ? getRef(id, par) : getRef(id, par).style)
}

if (!window.LayerObj) var LayerObj = new Function('id', 'par', 'this.ref=getRef(id, par); this.sty=getSty(id, par); return this');
function getLyr(id, par) { return new LayerObj(id, par) }

function LyrFn(fn, fc)
{
LayerObj.prototype[fn] = new Function('var a=arguments,p=a[0]; with (this) { '+fc+' }');
}
LyrFn('x','if (!isNaN(a[0])) sty.left=p; else return parseInt(sty.left)');
LyrFn('y','if (!isNaN(a[0])) sty.top=p; else return parseInt(sty.top)');
LyrFn('vis','sty.visibility=p');
LyrFn('write','if (isNS4) with (ref.document) {write(p);close()} else ref.innerHTML=p');
LyrFn('alpha','var f=ref.filters; if (f) {' + 'if (sty.filter.indexOf("alpha")==-1) sty.filter+="alpha()"; ' + 'if (f.length&&f.alpha) f.alpha.opacity=p } else if (isDOM) sty.MozOpacity=(p/100)');

if (!window.page) var page = { win: window, minW: 0, minH: 0, MS: isIE&&!window.opera }

page.winW=function()
{ with (this) return Math.max(minW, MS?win.document.body.clientWidth:win.innerWidth) }
page.winH=function()
{ with (this) return Math.max(minH, MS?win.document.body.clientHeight:win.innerHeight) }

page.scrollX=function()
{ with (this) return MS?win.document.body.scrollLeft:win.pageXOffset }
page.scrollY=function()
{ with (this) return MS?win.document.body.scrollTop:win.pageYOffset }

function tipTrack(evt) { with (this)
{
sX = page.scrollX();
sY = page.scrollY();
mX = (isIE ? event.clientX + sX : evt.pageX);
mY = (isIE ? event.clientY + sY : evt.pageY);

if (tipStick == 1) position();
}}

function tipPosition() { with (this)
{
if (actTip)
{
var wW = page.winW()-(isIE?0:15), wH = page.winH()-(isIE?0:15);

var t=tips[actTip], tipX=eval(t[0]), tipY=eval(t[1]), tipW=t[2], tipH=t[3], adjY = 1;

if (typeof(t[0])=='number') tipX += mX;
if (typeof(t[1])=='number') tipY += mY;

if (tipX + tipW + 5 > sX + wW) { tipX = sX + wW - tipW - 5; adjY = 2 }
if (tipY + tipH + 5 > sY + wH) tipY = sY + wH - (adjY*tipH) - 5;
if (tipX < sX+ 5) tipX = sX + 5;
if (tipY < sY + 5) tipY = sY + 5;

if (!showTip && (doFades ? !alpha : true))
{
xPos = tipX;
yPos = tipY;
}

xPos += (tipX - xPos) * tipStick;
yPos += (tipY - yPos) * tipStick;

div.x(xPos);
div.y(yPos);
}
}}

function tipShow(tipN) { with (this)
{
if (!isDyn) return;

if (!div || !div.ref) div = getLyr(myName + 'Layer');
if (!div.ref) return;

if (actTip != tipN)
{
actTip = tipN;

if (isNS4) div.ref.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT);
div.ref.onmouseover = new Function(myName + '.show("' + tipN + '")');
div.ref.onmouseout = new Function(myName + '.hide()');

position();

var str = template;
for (var i=0; i<tips[tipN].length; i++) str = str.replace('%'+i+'%', tips[tipN][i]);
div.write(str + ((document.all && !isWin) ? '<small><br></small>' : ''));
}

clearInterval(trackTimer);
if (tipStick != parseInt(tipStick)) trackTimer = setInterval(myName+'.position()', 50);

showTip = true;

clearTimeout(fadeTimer);
if (isNS4) setTimeout(myName + '.fade()', 1);
else fade();
}}

function tipHide() { with (this)
{
if (!isDyn) return;
showTip=false;fade();return;//delayhack
clearTimeout(fadeTimer);
fadeTimer = setTimeout('with (' + myName + ') { showTip=false; fade() }', 200);
}}

function tipFade() { with (this)
{
clearTimeout(fadeTimer);

if (showTip)
{
div.vis('visible');
if (doFades)
{
alpha += fadeSpeed;
if (alpha > 100) alpha = 100;
div.alpha(alpha);
if (alpha < 100) fadeTimer = setTimeout(myName + '.fade()', 50);
return;
}
}

else
{
if (doFades && alpha > 0)
{
alpha -= fadeSpeed;
if (alpha < 0) alpha = 0;
div.alpha(alpha);
fadeTimer = setTimeout(myName + '.fade()', 50);
return;
}
div.vis('hidden');
actTip = '';
clearInterval(trackTimer);
}
}}

function TipObj(myName)
{
this.myName = myName;
this.tips = new Array();
this.template = '';
this.actTip = '';
this.showTip = false;
this.tipStick = 1;
this.xPos = this.yPos = this.sX = this.sY = this.mX = this.mY = 0;

this.track = tipTrack;
this.position = tipPosition;
this.show = tipShow;
this.hide = tipHide;
this.fade = tipFade;

this.div = null;
this.trackTimer = 0;
this.fadeTimer = 0;
this.alpha = 0;
this.doFades = true;
this.fadeSpeed = 10;
}

var docTips = new TipObj('docTips');
with (docTips)
{
tips.who = new Array(5, 5, 100, 30, 'Who we are...');
tips.what = new Array(5, 5, 100, 30, 'What about our process?');
tips.why = new Array(5, 5, 100, 30, 'Why choose us?');
tips.how = new Array(5, 5, 100, 30, 'How about a free resume?');
template = '<table bgcolor="#003366" cellpadding="1" cellspacing="0" width="%2%" border="0">' +
'<tr><td><table bgcolor="#859EC6" cellpadding="2" cellspacing="0" width="100%" border="0">' +
'<tr><td height="%3%" class="tipClass" align="center">%4%</td></tr></table></td></tr></table>';

doFades = false;

}

var redTips = new TipObj('redTips');
with (redTips)
{

tips.who = new Array(5, 5, 100, 30,   'Who we are...');
tips.what = new Array(5, 5, 100, 30, 'What about our process?');
tips.why = new Array(5, 5, 100, 30, 'Why choose us?');
tips.how = new Array(5, 5, 100, 30, 'How about a free resume?');

template = '<table bgcolor="#003366" cellpadding="1" cellspacing="0" width="%2%" border="0">' +
'<tr><td><table bgcolor="#FEF3F5" cellpadding="2" cellspacing="0" width="100%" border="0">' +
'<tr><td height="%3%" class="tipClass" align="center">%4%</td></tr></table></td></tr></table>';

doFades = false;

}

var blueTips = new TipObj('blueTips');
with (blueTips)
{

tips.who = new Array(5, 5, 100, 30, 'Who we are...');
tips.what = new Array(5, 5, 100, 30, 'What about our process?');
tips.why = new Array(5, 5, 100, 30, 'Why choose us?');
tips.how = new Array(5, 5, 100, 30, 'How about a free resume?');

template = '<table bgcolor="#003366" cellpadding="1" cellspacing="0" width="%2%" border="0">' +
'<tr><td><table bgcolor="#ECF8FA" cellpadding="2" cellspacing="0" width="100%" border="0">' +
'<tr><td height="%3%" class="tipClass" align="center">%4%</td></tr></table></td></tr></table>';

doFades = false;

}

var greenTips = new TipObj('greenTips');
with (greenTips)
{

tips.who = new Array(5, 5, 100, 30, 'Who we are...');
tips.what = new Array(5, 5, 100, 30, 'What about our process?');
tips.why = new Array(5, 5, 100, 30, 'Why choose us?');
tips.how = new Array(5, 5, 100, 30, 'How about a free resume?');

template = '<table bgcolor="#003366" cellpadding="1" cellspacing="0" width="%2%" border="0">' +
'<tr><td><table bgcolor="#F2FCF9" cellpadding="2" cellspacing="0" width="100%" border="0">' +
'<tr><td height="%3%" class="tipClass" align="center">%4%</td></tr></table></td></tr></table>';

doFades = false;

}

var yellowTips = new TipObj('yellowTips');
with (yellowTips)
{

tips.who = new Array(5, 5, 100, 30, 'Who we are...');
tips.what = new Array(5, 5, 100, 30, 'What about our process?');
tips.why = new Array(5, 5, 100, 30, 'Why choose us?');
tips.how = new Array(5, 5, 100, 30, 'How about a free resume?');

template = '<table bgcolor="#003366" cellpadding="1" cellspacing="0" width="%2%" border="0">' +
'<tr><td><table bgcolor="#FDF9F0" cellpadding="2" cellspacing="0" width="100%" border="0">' +
'<tr><td height="%3%" class="tipClass" align="center">%4%</td></tr></table></td></tr></table>';

doFades = false;

}

var violetTips = new TipObj('violetTips');
with (violetTips)
{

tips.who = new Array(5, 5, 100, 30, 'Who we are...');
tips.what = new Array(5, 5, 100, 30, 'What about our process?');
tips.why = new Array(5, 5, 100, 30, 'Why choose us?');
tips.how = new Array(5, 5, 100, 30, 'How about a free resume?');

template = '<table bgcolor="#003366" cellpadding="1" cellspacing="0" width="%2%" border="0">' +
'<tr><td><table bgcolor="#F7F2FA" cellpadding="2" cellspacing="0" width="100%" border="0">' +
'<tr><td height="%3%" class="tipClass" align="center">%4%</td></tr></table></td></tr></table>';

doFades = false;

}

if (isNS4) document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = function(evt)
{
docTips.track(evt);
redTips.track(evt);
blueTips.track(evt);
greenTips.track(evt);
yellowTips.track(evt);
violetTips.track(evt);
if (isNS4) return document.routeEvent(evt);
}

var nsWinW = window.innerWidth, nsWinH = window.innerHeight;
function ns4BugCheck()
{
if (isNS4 && (nsWinW!=innerWidth || nsWinH!=innerHeight)) location.reload()
}

window.onresize = function()
{
ns4BugCheck();
}



