// JavaScript Document
var delay = 9000;
var pic0, pic1, pic2, pic3;
var map = Array('british_columbia','alberta', 'saskatchewan',  'oklahoma');
var mapContent = Array();
mapContent[3] = '<img id="map_img" src="images/map-oklahoma.jpg" alt="oklahoma" /><div class="text dynamic"><strong>OKLAHOMA</strong><br />Enterra has substantial production and assets in the liquids-rich natural gas play in Hunton as well as medium to light sweet oil prospects in Circus.</div>';
mapContent[2] = '<img id="map_img" src="images/map-sask.jpg" alt="saskatchewan" /><div class="text dynamic"><strong>SASKATCHEWAN</strong><br />Assets in west central Saskatchewan include the Primate heavy oil field and Liebenthal as well as several minor pools in the area.</div>';
mapContent[1] = '<img id="map_img" src="images/map-alberta.jpg" alt="alberta" /><div class="text dynamic"><strong>ALBERTA</strong><br />Our properties range from deep, high rate foothills sour gas at Ricinus to mid-depth oil wells at Clair, Provost and Princess in the centre and eastern part of the province.</div>';
mapContent[0] = '<img id="map_img" src="images/map_bc.jpg" alt="british_columbia" /><div class="text dynamic"><strong>BRITISH COLUMBIA</strong><br />December 2008 production averaged 3.7 mmcf/d of natural gas and 23 bbl/d oil and NGLs. Investment plans in this remote area vary in accordance with price expectations.</div>';		
	var id = -1;
	var interval_timer;


function gototab(id) {
		//alert(this.id + " " + (id+1));
	if (this.id == id+1 || (id == 3 && this.id == -1))
		return;

	this.id = id;
	clearInterval(interval_timer);
	swap();
	interval_timer = setInterval("swap()", delay);
}


function swap() {
	for(var i =0; i < map.length; i++){
		//document.getElementById(map[i]).style.display='none';	
		document.getElementById(map[i]+'_button').style.backgroundPosition="left";
	}
	fadeOut();
	
	document.getElementById(map[id]+'_button').style.backgroundPosition="right";
	
	
	
}



var incrementId = function() {
		if (id < 3)
		id++;
	else
		id = 0;
}


function fadeOut(){
		//alert(id);
	var myAnim = new YAHOO.util.Anim('map');
myAnim.attributes.opacity = { to: 0.3 };
myAnim.duration = 0.3;
myAnim.method = YAHOO.util.Easing.easeInStrong;
myAnim.onStart.subscribe(incrementId);
myAnim.onComplete.subscribe(changeContent); 
myAnim.animate();
	
}


var changeContent = function() { 
document.getElementById('map').innerHTML=mapContent[id];
	var source = eval('pic'+id).src;
	
	
	document.getElementById('map_img').src=source;
var myAnim = new YAHOO.util.Anim('map');
var fullOpacity;
if (navigator.appVersion.match('Safari'))
	fullOpacity = 0.99;
else 
	fullOpacity = 1.0;
		  
	  myAnim.attributes.opacity = { from: 0.3, to: 0.99 };
myAnim.duration = 0.5;
myAnim.method = YAHOO.util.Easing.easeInStrong;

myAnim.animate();
	
	
	  
	} 
	
	
function preload()
{
	pic0= new Image(); 
	pic0.src="images/map_bc.jpg"; 
	
	pic1= new Image(); 
	pic1.src="images/map-alberta.jpg"; 
	
	pic2= new Image(); 
	pic2.src="images/map-sask.jpg"; 
	
	pic3= new Image(); 
	pic3.src="images/map-oklahoma.jpg"; 
	swap(0);
	interval_timer = setInterval("swap()", delay);
}






