// tabs
function switch_tab(selected,startno,endno) {
  for (i=startno; i <= endno; i++){
	thetab = 'tab' + i;
	thecontent = 'content' + i;
		if(!(thetab == selected)) {
	  		document.getElementById(thetab).className = "";
	  		document.getElementById(thecontent).style.display = "none";
	  	} else {
	  		document.getElementById(thetab).className = "current";
	  		document.getElementById(thecontent).style.display = "block";
	  	}
  }	  
}


// preload images
function preload0(img) {
	image0 = new Image();
	image0.src = img;
}	
function preload1(img) {
	image1 = new Image();
	image1.src = img;
}
function preload2(img) {
	image2 = new Image();
	image2.src = img;
}
function preload3(img) {
	image3 = new Image();
	image3.src = img;
}
function preload4(img) {
	image4 = new Image();
	image4.src = img;
}
function preload5(img) {
	image5 = new Image();
	image5.src = img;
}
function preload6(img) {
	image6 = new Image();
	image6.src = img;
}
function preload7(img) {
	image7 = new Image();
	image7.src = img;
}
function preload8(img) {
	image8 = new Image();
	image8.src = img;
}
function preload9(img) {
	image9 = new Image();
	image9.src = img;
}

// swap image
function swapImage(image) {
	document.getElementById("mainimage").src = image;
}

// swap image
function swapImageVideo(image) {
	document.getElementById("mainvideoimage").src = image;
}

// swap teaser text
function swapTeaser(id) {
	for (i=0; i < 9; i++){
	tes = 'teaser' + i;
		if(!(tes == id)) {
   			document.getElementById(tes).style.visibility = 'hidden';
   		}	
   		if(tes == id) {
   			document.getElementById(tes).style.visibility = 'visible';
   		}
    };
}

// swap video
function swapVideo(id) {
	for (i=0; i < 9; i++){
	tes = 'video' + i;
		if(!(tes == id)) {
   			document.getElementById(tes).style.display = 'none';
   		}	
   		if(tes == id) {
   			document.getElementById(tes).style.display = 'block';
   		}
    };
}

// send to friend popup
function openWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


// squad predictor
function updatefield(position) {
	theaction = document.forms["ultimate"][position].value
	document.forms["results"][position].value = theaction
}