// variable for fading buttons
var TimeToFade = 1500.0;

//function for the fading method for arrows
function fade(eid)
{
	//please specify the div layer in the onmouseover event
  var element = document.getElementById(eid);
  if(element == null)
    return;
    
  if(element.FadeState == null)
  {
    if(element.style.opacity == null
        || element.style.opacity == ''
        || element.style.opacity == '0.8')
    {
      element.FadeState = -2;
    }
    else
    {
      element.FadeState = 2;
    }
  }
   
  if(element.FadeState == 1 || element.FadeState == -1)
  {
    element.FadeState = element.FadeState == 1 ? -1 : 1;
    element.FadeTimeLeft = TimeToFade - element.FadeTimeLeft;
  }
  else
  {
    element.FadeState = element.FadeState == 2 ? -1 : 1;
    element.FadeTimeLeft = TimeToFade;
    element.style.visibility = element.FadeState == 2 
        ? 'hidden' : 'visible';
    element.style.display = element.FadeState == 2 
        ? 'none' : 'block';
    setTimeout("animateFade(" + new Date().getTime()
        + ",'" + eid + "')", 33);
  } 
}

//make the fade happen code
function animateFade(lastTick, eid)
{ 
  var curTick = new Date().getTime();
  var elapsedTicks = curTick - lastTick;
 
  var element = document.getElementById(eid);
 
  if(element.FadeTimeLeft <= elapsedTicks)
  {
    element.style.visibility = element.FadeState == 1 
        ? 'visible' : 'hidden';
    element.style.display = element.FadeState == 1 
        ? 'block' : 'none';
    element.style.opacity = element.FadeState == 1 
        ? '1' : '0';
    element.style.filter = 'alpha(opacity = '
        + (element.FadeState == 1 ? '100' : '0') + ')';
    element.FadeState = element.FadeState == 1 ? 2 : -2;
    return;
  }
 
  element.FadeTimeLeft -= elapsedTicks;
  var newOpVal = element.FadeTimeLeft/TimeToFade;
  if(element.FadeState == 1)
    newOpVal = 1 - newOpVal;

  newOpVal = newOpVal*1;
  element.style.opacity = newOpVal;
  element.style.filter =
      'alpha(opacity = ' + (newOpVal*100) + ')';
 
  setTimeout("animateFade(" + curTick
      + ",'" + eid + "')", 33);
}

//code to make the arraows appear and dissappear - not use at the moment

function hideDiv(id) { 
if (document.getElementById) { // This is for DOM3 = IE5, NS6 
document.getElementById(id).style.display = 'none'; 
} 
}

function showDiv(id) { 
if (document.getElementById) { // This is for DOM3 = IE5, NS6 
document.getElementById(id).style.display = 'inherit'; 
} 
} 

//Scrolling function for info in the div layer
//need to specify the direction, speed and loop (true to start) in link.

function verScroll(dir, spd, id, idtest, loop) {
loop = true;
direction = "up";
divlayer = id
idmain = idtest
speed = 10;
scrolltimer = null;
if (document.getElementById) {
var page= document.getElementById(id).style;
}
direction = dir;
speed = parseInt(spd);
var y_pos = parseInt(page.top);
var b_pos = parseInt(page.scrollTop);
var bo_pos = document.getElementById(id).scrollHeight;
var boh_pos = document.getElementById(idtest).style.height;
boh_pos = boh_pos.replace("px", "");
bo_pos = bo_pos * -1;
bo_pos = bo_pos + parseInt(boh_pos);
if (loop == true) {
if (direction == "dn" && y_pos > bo_pos) {
page.top = (y_pos - (speed));
//alert(bo_pos)
} else {
if (direction == "up" && y_pos < 1) {
page.top = (y_pos + (speed));
} 
}
scrolltimer = setTimeout("verScroll(direction,speed,divlayer,idmain)", 1);
   }
}
function stopScroll() {
loop = false;
clearTimeout(scrolltimer);
}

// Footer Scroll Code
var scrollTime = null;
//var Timer = 50;
//var Direction = "left";

//function beginLoop(action){
//	if (action == 'break'){clearTimeout(scrollTime);}
//	else {scrollTime = setTimeout("scroll()",Timer);}
//}

//function scroll(){
//var footer = document.all.myDiv.style;
//var left = parseInt(footer.left);
//var width = (24 * 100)+(24*2); // Use VB.NET to calculate here! (NumofItems * ItemWdith) + (NumofItems * CellSpacing)

//if (Direction == "left"){

//if(parseInt(footer.left) == -(width)){footer.left = 0;}
//else{footer.left = (left - 1);}

//}
//else {

//if(parseInt(footer.left) == 0){footer.left = -(width);}
//else{footer.left = (left + 1);}
	
//}

//beginLoop('go');
//}
// End Footer Scroll Code

// Nav Transition
function nav(frombar, tobar){

fade(frombar);
TimeToFade = 1000.00;
fade(tobar);
TimeToFade = 1000.00;

}
// End Nav Transition

//Flash Banner
var ShockMode = 0;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ?
	navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
var isNet6 = navigator.userAgent && (navigator.userAgent.indexOf("Netscape6")>=0);
var isJavaE = navigator.javaEnabled()==true;


function showFlashBanner( FlashSource, ImageSource, CorporateName, Width, Height ){

if (plugin) {
	var isIEMac = navigator.userAgent && (navigator.userAgent.indexOf("MSIE")>=0) && (navigator.userAgent.indexOf("Mac")>=0);
	if (!isIEMac && !isNet6) {
		ShockMode = 1;
	}
}
else if (!isNet6 && navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && 
    (navigator.userAgent.indexOf("Windows 95")>=0 || navigator.userAgent.indexOf("Windows 98")>=0 || navigator.userAgent.indexOf("Windows NT")>=0)
   ) {
  var end="RIPT";
  document.write('<SC'+end+' LANGUAGE=VBScript\> \n');
  document.write('on error resume next \n');
  document.write('ShockMode = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4")))\n');
  document.write('Sub ' + CorporateName + '_FSCommand(ByVal command, ByVal args)\n');
  document.write('    call ' + CorporateName + '_DoFSCommand(command, args)\n');
  document.write('end sub\n');
  document.write('</SC'+end+'\> \n');
}

if ( ShockMode ) {
  document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
  document.write(' codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0"');
  document.write('  ID=' + CorporateName + ' WIDTH=' + Width + ' HEIGHT=' + Height + '>');
  document.write('  <PARAM NAME=movie VALUE="' + FlashSource + '"> ');
  document.write('  <PARAM NAME=quality VALUE=autohigh> ');
  document.write('  <PARAM NAME=bgcolor VALUE=#FFFFFF> ');
  document.write('<EMBED SRC="' + FlashSource + '" NAME=' + CorporateName );
  document.write(' swLiveConnect=TRUE WIDTH=' + Width + ' HEIGHT=' + Height + '');
  document.write(' bgcolor=#ffffff QUALITY=autohigh');
  document.write(' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">');
  document.write('</EMBED>');
  document.write('</OBJECT>');
} else {
  document.write('<IMG SRC="' + ImageSource + '" WIDTH=' + Width + ' HEIGHT=' + Height + ' BORDER=0 alt="' + CorporateName + '">');
}}



