<!--

// Hide first screen here so if javascript doesnt work, the page still looks good
document.write("<style type='text/css'>#heading1 { left:-530px } #message1 { left:1000px; } #bannerimg1 { visibility:hidden; }</style>");

var banner_showing = 1;
var banner_cycling = true;
var banner_cycle_stop = false;
var banner_cycle_timeout = 7; // in seconds
var banner_intervalID;
var transitioning = false;

function start_banner_cycling() {
  showBanner(1);
  banner_intervalID = window.setInterval("rotate_banner()", banner_cycle_timeout*1000);
}

function rotate_banner() {
  // If cycling has been stopped, clear interval 
  if (banner_cycle_stop==true && banner_cycling==true) {
    window.clearInterval(banner_intervalID);
    banner_cycling = false;
  } else {
    if (banner_showing==1) {
      banner_transition(2);
    } else if (banner_showing==2) {
      banner_transition(3);
    } else {
      banner_transition(1);
    }
  } // END IF
}

function showBanner(bannerstart) {
	// Get the image
	js_image = document.getElementById('bannerimg'+bannerstart);
	// Fade the image in
	window.setTimeout("fadeIn('bannerimg"+bannerstart+"',0)", 100);
	// Move the heading in
	window.setTimeout("moveObj('heading"+bannerstart+"',-530,20,40)", 100);	
	// Wait a short time and move the text in
	window.setTimeout("moveObj('message"+bannerstart+"',1000,600,-40)", 400);
} // end showBanner


function fadeIn(objId,opacity) {
	if (document.getElementById) {
		obj = document.getElementById(objId);
		if (opacity <= 100) {
      obj.style.visibility = "visible";
			setOpacity(obj, opacity);
			opacity += 10;
			window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 100);
		} else {
      transitioning = false;
		}
	}
}
function fadeOut(objId,opacity) {
  // Set transitioning flag
  transitioning = true;  
	if (document.getElementById) {
		obj = document.getElementById(objId);
		if (opacity >= 0) {
			setOpacity(obj, opacity);
			opacity -= 10;
			window.setTimeout("fadeOut('"+objId+"',"+opacity+")", 100);
		} else
      obj.style.visibility = "hidden";
	}
}

function moveObj(objId,current_pos, end_pos, step) {
  if (document.getElementById) {
		obj = document.getElementById(objId);
    if ((step>0 && (current_pos < end_pos)) || (step<0 && (current_pos > end_pos))) {
      new_pos = current_pos + step;
      obj.style.left = new_pos + 'px';
      window.setTimeout("moveObj('"+objId+"',"+new_pos+","+end_pos+","+step+")", 10);
    }
  }
}

function setOpacity(obj, opacity) {
	//opacity = (opacity == 100)?99.999:opacity;
	// IE/Win
	obj.style.filter = "alpha(opacity:"+opacity+")";
	// Safari<1.2, Konqueror
	obj.style.KHTMLOpacity = opacity/100;
	// Older Mozilla and Firefox
	obj.style.MozOpacity = opacity/100;
	// Safari 1.2, newer Firefox and Mozilla, CSS3
	obj.style.opacity = opacity/100;
}

function banner_manual_transition(change_to) {
  banner_cycle_stop = true; // Stop random cycling
  banner_transition(change_to)
}

function banner_transition(transition_to) {
  // If a different banner has been requested
  if (transition_to != banner_showing && !transitioning) { 
    // Move heading and text (with a slight delay)
    moveObj('message'+banner_showing,600,1000,40);	
    window.setTimeout("moveObj('heading"+banner_showing+"',20,-530,-40)", 300);
    // Fade out old image
    fadeOut('bannerimg'+banner_showing, 100);
    // Moce in new heading and text (again with slight delay)
    window.setTimeout("moveObj('heading"+transition_to+"',-530,20,40)", 600);
    window.setTimeout("moveObj('message"+transition_to+"',1000,600,-40)", 900);
    // Fade in new image
    fadeIn('bannerimg'+transition_to, 0);
    // Record that banner changed
    banner_showing = transition_to;
  }
}

//var webinar_showing = 1;
//function webinar_transition() {
//  fadeOut('webinar'+webinar_showing, 100);
//  webinar_showing = (webinar_showing==1) ? 2 : 1;
//  fadeIn('webinar'+webinar_showing, 0);
//}
//window.setInterval("webinar_transition()", 7000);












function fadeTransition(img1, img2, opacity) {
	
	if (document.getElementById) {
		image1 = document.getElementById(img1);
    image2 = document.getElementById(img2);
    
    image2.style.visibility = "visible";
    
    
    
		if (opacity <= 100) {
			setOpacity(image2, opacity);
			setOpacity(image1, 100-opacity);
			opacity += 10;
			window.setTimeout("fadeTransition('"+img1+"', '"+img2+"',"+opacity+")", 100);
		}
	}
	
	
}



function initImage() {
	imageId = 'thephoto1';
	image = document.getElementById(imageId);
	setOpacity(image, 0);
	image.style.visibility = "visible";
	fadeIn(imageId,0);
	
	heading = document.getElementById('heading1');
	heading.style.visibility = "visible";
}




//window.onload = function() {initImage()}

window.onload = function() {start_banner_cycling()}


// -->