// JavaScript Document
var img = new Array("images/bigbanner0.jpg", "images/bigbanner1.jpg", "images/bigbanner2.jpg");
var title = new Array("Health &amp; Safety","Drilling Rigs","Expansion Plans");
var text = new Array("Setting concrete rules for the health and safety policy applied at all Challenger Limited premises and operational sites has been one of the founding bases for the company since its establishment <a href=\"hse.htm\" >more</a>","Challenger's fleet of drilling rigs has an average HP ranging from 500 to 2000 HP, with a depth capacity starting with 8,000 up to a total of 20,000 <a href=\"rigs.htm\" >more</a><br><br>", "Challenger indeed presented and still presents a lucrative investment opportunity based on a sound business model. In fact, the global credit crunch stood not as a devastating economic blow to Challenger as it did with several other companies <a href=\"expansion.htm\" >more</a>");
var m_iInterval;
var m_Height;
var d=document, imgs = new Array(), zInterval = null, current=0, pause=false;


function so_init() {
	if(!d.getElementById || !d.createElement)
		return;
	css = d.createElement("link");
	css.setAttribute("href","style2.css");
	css.setAttribute("rel","stylesheet");
	css.setAttribute("type","text/css");
	d.getElementsByTagName("head")[0].appendChild(css);

	imgs = d.getElementById("ImageContainer").getElementsByTagName("img");
	for(i=1;i<imgs.length;i++) imgs[i].xOpacity = 0;
	imgs[0].style.display = "block";
	imgs[0].xOpacity = .99;
	bannerTimeout = setTimeout(so_xfade,7000);
	//wl();
}

function so_xfade() {
	if (!pause)
	{
		cOpacity = imgs[current].xOpacity;
	nIndex = imgs[current+1]?current+1:0;

	nOpacity = imgs[nIndex].xOpacity;
	
	cOpacity-=.05; 
	nOpacity+=.05;

	imgs[nIndex].style.display = "block";
	imgs[current].xOpacity = cOpacity;
	imgs[nIndex].xOpacity = nOpacity;
	setOpacity(imgs[current]); 
	setOpacity(imgs[nIndex]);
	if(cOpacity<=0) {
		imgs[current].style.display = "none";
		current = nIndex;
		bannerTimeout = setTimeout(so_xfade,7000);
	} else {
		bannerTimeout = setTimeout(so_xfade,50);
	}}
		swapBanner(current);
}

function setOpacity(obj) {
		if(obj.xOpacity>.99) {
			obj.xOpacity = .99;
			return;
		}
		obj.style.opacity = obj.xOpacity;
		obj.style.MozOpacity = obj.xOpacity;
		obj.style.filter = "alpha(opacity=" + (obj.xOpacity*100) + ")";
	}

function swapBanner (BannerNumber)
{
var tempTitle = document.getElementById("BigTitle");
var tempText = document.getElementById("BigText");

tempTitle.innerHTML = title[BannerNumber] +"<br>";
tempText.innerHTML = text[BannerNumber];
}



function pauseAndSwap (imageNumber)
{
	if (!pause)
	{
		clearTimeout(bannerTimeout);
		pause = true;
	}

		imgs[current].style.display = "none";
		imgs[current].xOpacity = 0;
		setOpacity(imgs[current]); 
	imgs[imageNumber-1].xOpacity = .99;
	setOpacity(imgs[imageNumber-1]); 
	imgs[imageNumber-1].style.display = "block";
	current = imageNumber -1;
			swapBanner(imageNumber-1);

}

function resumeAndSwap (imageNumber)
{
		pause = false;
		bannerTimeout = setTimeout(so_xfade,7000);
}


function timedRefresh(timeoutPeriod) {
	setTimeout("location.reload(true);",timeoutPeriod);
}

function emptySearch(){
	document.getElementById('searchBox').style.color = "#000000";
	document.getElementById('searchBox').value = "";
}

function putSearch(){
	document.getElementById('searchBox').style.color = "#323232";
	document.getElementById('searchBox').value = "Search";
}

function openWindow(inLink,width,height){
	window.open(inLink, "blank","toolbar=no,width="+width+",height="+height);
}
