// preload images
function preload(id,img) {
	image0 = new Image();
	image0.src = img;
}

// swap image
function swapImage(image) {
	document.getElementById("mainimage").src = image;
}

// swap teaser text
function swapTeaser(id) {
	for (i=0; i < 5; i++){
	tes = 'teaser' + i;
		if(!(tes == id)) {
   			document.getElementById(tes).style.visibility = 'hidden';
   		}	
   		if(tes == id) {
   			document.getElementById(tes).style.visibility = 'visible';
   		}
    };
}

// open popup window
function openWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


// Dez's Javascript

$(document).ready(function() {
   // do stuff when DOM is ready
   var headers = [$("#teaser0 h1").text(),$("#teaser1 h1").text(),$("#teaser2 h1").text(),$("#teaser3 h1").text()];
   var content = [$("#teaser0 p").text(),$("#teaser1 p").text(),$("#teaser2 p").text(),$("#teaser3 p").text()];	   
   $("#t1").click(function(){ update(1); });
   $("#t2").click(function(){ update(2); });
   $("#t3").click(function(){ update(3); });
   $("#t4").click(function(){ update(4); });
   
   function update(num) {
	 $("#ph").text(headers[(num-1)]);
	 $("#pc").text(content[(num-1)]);
    }
		
});
