function init() { 
if (!document.getElementsByTagName){ 
	return; 
}
var anchors = document.getElementsByTagName("a"); 
	for (i=0; i<anchors.length; i++) { 
	if (anchors[i].getAttribute("href") && anchors[i].getAttribute("rel") == "external") {
	anchors[i].target = "_blank"; 
	anchors[i].title = "This link opens in a new window."
	} 
	}
} 
window.onload = init; 


function get_random(num)
{
    var ranNum= Math.floor(Math.random()*num);
	if (ranNum==0){
		ranNum++;
	}
    return ranNum;
}
function getObj(id){
	if(document.getElementById(id)){
	return document.getElementById(id);
	}
	else if(document.all){
	return document.all[id];
	}
	else if(document.layers){
	return document.layers[id];
	}
}


function over(el){
	if(el.id=="thumb_financial_portal"){
		el.src="/images/thumb_financial_portal1.gif";
	}
	else if(el.id=="thumb_online_underwriting"){
		el.src="/images/thumb_online_underwriting1.gif";
	}
	else if(el.id=="thumb_online_usability"){
		el.src="/images/thumb_online_usability1.gif";
	}
	else if(el.id=="thumb_product_specific"){
		el.src="/images/thumb_product_specific1.gif";
	}
	else if(el.id=="portal_white"){
		el.src="/images/thumb_portal_white1.gif";
	}
	else if(el.id=="affiliate_white_labeled"){
		el.src="/images/thumb_affiliate_white1.gif";
	}
	else if(el.id=="affiliate_co"){
		el.src="/images/thumb_affiliate_co1.gif";
	}

	
}

function out(el){
	if(el.id=="thumb_financial_portal"){
		el.src="/images/thumb_financial_portal0.gif";
	}
	else if(el.id=="thumb_online_underwriting"){
		el.src="/images/thumb_online_underwriting0.gif";
	}
	else if(el.id=="thumb_online_usability"){
		el.src="/images/thumb_online_usability0.gif";
	}
	else if(el.id=="thumb_product_specific"){
		el.src="/images/thumb_product_specific0.gif";
	}
	else if(el.id=="portal_white"){
		el.src="/images/thumb_portal_white0.gif";
	}
	else if(el.id=="affiliate_white_labeled"){
		el.src="/images/thumb_affiliate_white0.gif";
	}
	else if(el.id=="affiliate_co"){
		el.src="/images/thumb_affiliate_co0.gif";
	}

}
	


var DHTML = (document.getElementById || document.all || document.layers);


/*

The following script is only called if DHTML is available to the browser.

first we instantiate starting positions then we check if DHTML available.

*/
var id=0;//start at 0 so that first image ('imageplace1') is rotated first
var nextnum=3;//we start at 3 because first three images are rendered by default .: next image will be 4
var prefix='http://www.xbridge.com';

if (DHTML){
	
var album = { 

  startup: function() { 
  pe=setInterval(album.cycle,4000);//set the interval to use 1000 = 1 second
  init();//call function to add target _blank to links with rel="external"
  }, 
  
  pause: function() {
	window.clearInterval(pe);

  },
  
  cycle: function() { 
 	id++; //increment the id and nextnum by 1
	nextnum++;
	
	//check to see if the numbers go beyond our range. If they do then reset them.
	if(id>3){
		id=1;
	}
	if(nextnum>20){
		nextnum=1;
	}

	
	getObj('top'+id).style.background='url('+getObj('imageplace'+id).src+')';//set the background image of div wrapping our current image to match the current image source. this ensures a smooth fade.
    new Effect.Fade('imageplace'+id, { 
      duration: 1, 
      fps: 50, 
      afterFinish: function() { //
				
			var next=prefix+'/images/pic'+nextnum+'.jpg';

	  		getObj('imageplace'+id).src=next;
            new Effect.Appear('imageplace'+id, {
              duration: 1,
              fps: 50,
              queue:'end'
        }) //end afterFinish
      } 
    }) 
  } 
  
} 
 
 
window.onload = album.startup


}