function showArrow(navItem){
	var objLink = document.getElementById(navItem);
	var objArrow = document.createElement("div");
	objArrow.setAttribute("id","navArrow");
	objLink.appendChild(objArrow);
}

function removeArrow(navItem){
	var objLink = document.getElementById(navItem);
	var objArrow = document.getElementById("navArrow");
	objLink.removeChild(objArrow);
}

function plusMinus(thisId,thisNum,thisSection, showNum) {
	// section stuff
	if (thisSection == "news") {
	   boxName = "accMenu1";
	   totalNum = showNum;
	} else if (thisSection == "events") {
	   boxName = "accMenu1";
	   totalNum = showNum;
	} else if (thisSection == "eventSummary") {
	   boxName = "accMenu2";
	   totalNum = showNum;
	} else if (thisSection == "general") {
	   boxName = "accMenu1";
	   totalNum = showNum;
	}
	// turn off all elements & swap buttons
	for (p=1; p < (totalNum + 1); p++) {
	   document.getElementById(thisId+p).className = boxName+'Off';
	}
	// turn on selected element
	document.getElementById(thisId+thisNum).className = boxName+'On';
}

function showHideDiv(objid,state) {
	var obj;
	try {
		if(objid.parentNode){
			//it's an object. we needn't do anything
			obj = objid;
		} else {
			//it's not an object
			obj = document.getElementById(objid);
		}
	} catch(e) {
		//it's not an object and the browser errors on undefined properties
		obj = document.getElementById(objid);
	}
	state = (state == "hidden" || state == "hide") ? 0 : 1;
	vista = (state) ? 'block' : 'none';
	obj.style.display = vista;
	return true;
}



function toggleDoubleVideo(){
//	if(ie){
		
	var vidPlayer = document.getElementById('mainPlayer');
	var vidBox = document.getElementById('vidPlayer');
	var divStatus = vidBox.name;
	var objBody = document.getElementsByTagName("body").item(0);
	//alert(divStatus);
	if(divStatus == "big"){
		//do shrinking stuff
		vidBox.name = "small";
		vidBox.setAttribute("name","small");
		
		var ageOverlay = document.getElementById('bgOverlay');
		objBody.removeChild(ageOverlay);
		
		vidBox.style.position = "absolute";
		vidBox.className = "videoDefault";
		vidBox.style.left = "";
		vidBox.style.top = "";
		vidBox.style.position = "";
		vidBox.style.width = "320px";
		
		vidPlayer.width = "320";
		vidPlayer.height = "300";

		
	}else{
		//do enlarging stuff
		alert("You are choosing to watch the video in double size. \nTo return to CurlTV.com, click anywhere outside the video player.\nIf you experience any problems, please view the FAQ page.");
		vidBox.name = "big";
		vidBox.setAttribute("name","big");
		
		var newHeight = 484;
		var newWidth = 576;
		//var newWidth = 320;
		var mainHeight = document.getElementById('wrapper').clientHeight;
		var screenWidth = objBody.clientWidth;
		var screenHeight = objBody.clientHeight;
		var newTopPos = Math.floor((screenHeight/2)-(newHeight/2));
		var newLeftPos = Math.floor((screenWidth/2)-(newWidth/2));
		
		var objOverlay = document.createElement("div");
		//objOverlay.setAttribute('onClick','alert("what?");');
		if(ie){
			objOverlay.setAttribute('onclick',toggleDoubleVideo);
		}else{
			objOverlay.setAttribute('onclick',"toggleDoubleVideo()");
		}
		
		objOverlay.setAttribute('id','bgOverlay');
		
		objOverlay.style.height = mainHeight+"px";
		objBody.appendChild(objOverlay);
		
		vidBox.className = "videoFull";
		vidBox.style.left = newLeftPos + "px";
		vidBox.style.width = newWidth + "px";
		
		vidPlayer.height = newHeight;
		vidPlayer.width = newWidth;
		
	}
	//}else{
		//alert('We\'re sorry, this feature is only available while using Internet Explorer.');	
	//}
}


function fixVideo(){
	var em=document.embeds;
	for(var i=0;i<em.length;++i){
	
		if(em[i].SetDisplaySize&&em[i].SetAllowChangeDisplaySize&&em[i].GetImageSourceHeight){       
		
			em[i].setAttribute('AllowChangeDisplaySize','1');
			em[i].setAttribute('DisplaySize','0');
			em[i].setAttribute('ShowStatusBar','1');
			
			em[i].setAttribute('height',em[i].GetImageSourceHeight()+69);em[i].outerHTML=em[i].outerHTML
		}
	}
}

function fullScreen(playerID) {
	
	alert("You are choosing to watch the video full screen. To close the video screen press the ESC key.");
	
    var player=document.getElementById(playerID); //don't forget the var. It will come and bite you.

	if (ie) {
		player.DisplaySize = 3;
		player.fullScreen=true;
	} else {
		alert("To go full screen, double click on the playing video.");
	}
	
  

  
}

var total;

function getTotal(i){
	total = i;
	//alert(total);
}

function showHideDivEvent(result){
	//alert(total);
	for(i=0; i < total; i++){
		document.getElementById('gameResult'+i).style.display="none";
		//alert("Setting gameResult"+i);
	}
	document.getElementById(result).style.display="block";
	//alert (result);
}





function WindowSize()
{
     if( typeof( window.innerWidth ) == 'number' ) {
          //Non-IE
          wWidth = window.innerWidth;
          wHeight = window.innerHeight;
     }
     else if( document.documentElement &&
              (document.documentElement.clientWidth ||
               document.documentElement.clientHeight ) ) {
          //IE 6+ in 'standards compliant mode'
          wWidth = document.documentElement.clientWidth;
          wHeight = document.documentElement.clientHeight;
     }
     else if( document.body && 
              (document.body.clientWidth ||
                 document.body.clientHeight ) ) {
          //IE 4 compatible
          wWidth = document.body.clientWidth;
          wHeight = document.body.clientHeight;
     }
}



function fixScrollbars(){
	WindowSize();
	var pageWidth = wWidth;
	if(pageWidth < 1000){
		pageWidth = 1000;
	}
	var objBody = document.getElementsByTagName("body").item(0);
	objBody.style.width = pageWidth+"px";
	if(ie){
		objBody.setAttribute('onresize',fixScrollbars);
	}else{
		objBody.setAttribute('onresize',"fixScrollbars()");
	}
}

function expandNavWrapper(){
	var objHeight = document.getElementById("siteBody").clientHeight-129; //129 is the height of the top banner, borders, margins and things
	var objNavWrapper = document.getElementById("navWrapper"); 
	objNavWrapper.style.height = objHeight+'px';
}


