	function getWindowHeight() {
		var windowHeight = 0;
		if (typeof(window.innerHeight) == 'number') {
			windowHeight = window.innerHeight;
		}
		else {
			if (document.documentElement && document.documentElement.clientHeight) {
				windowHeight = document.documentElement.clientHeight;
			}
			else {
				if (document.body && document.body.clientHeight) {
					windowHeight = document.body.clientHeight;
				}
			}
		}
		return windowHeight;
	}
		
	function setMarginHeight() {
	  var windowHeight = getWindowHeight();												
		if (windowHeight > 0) {		
                var rightMarginElement = document.getElementById('rightMargin');			
				rightMarginElement.style.height = (windowHeight - 160) + 'px';;   // get footer height from ehre.. TMPEORARYY>.
         }
		
	}



		
    function showHideIns(opts, theText) {    
     var currStyle = document.getElementById(opts).style.display;        
     
     if (currStyle  == "none") {      	  
        document.getElementById(opts).style.display = "inline";      	  
        document.getElementById(theText).innerHTML = "Hide Instructions";        
      } 
      else {      
        document.getElementById('instructions').style.display = "none";      	  
        document.getElementById(theText).innerHTML = "Instructions";        
      }	    
    }

   function showHideArea(theText) {    
   
   
   if (document.getElementById(theText).innerHTML == 'Center playing area') {
       document.getElementById('header').style.visibility = "hidden";
       document.getElementById('menu').style.visibility   = "hidden";	  
       document.getElementById('rightMargin').style.visibility   = "hidden";              
       
    // document.getElementById('footer').style.visibility = "hidden";	
       document.getElementById(theText).innerHTML = "Back to Normal";
       moveDiv('center'); 
      }
   else  {
       document.getElementById('header').style.visibility = "visible";
       document.getElementById('menu').style.visibility   = "visible";	  
    // document.getElementById('footer').style.visibility = "visible";	
       document.getElementById('rightMargin').style.visibility = "visible";    
       document.getElementById(theText).innerHTML = "Center playing area";
       moveDiv('orig');        
      }
   
         

   }
   
   var origLeftValue;
   
     function moveDiv(toPosition) {
         var viewportwidth;

         // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight

         if (typeof window.innerWidth != 'undefined')
         {

              viewportwidth = window.innerWidth;
         }

        // IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

         else if (typeof document.documentElement != 'undefined'
             && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0)
         {
               viewportwidth = document.documentElement.clientWidth;
         }

         // older versions of IE
        
         else
         {
               viewportwidth = document.getElementsByTagName('body')[0].clientWidth;
         }

         if (viewportwidth  > 860) {
            var newLeft = (viewportwidth - 860) / 2;
             if (toPosition == 'center') {
                origLeftValue=document.getElementById("main").style.left;
                document.getElementById("main").style.position='absolute';
                document.getElementById("main").style.left = newLeft + 'px';
               }
             else
			    document.getElementById("main").style.left = origLeftValue;                
         }
         
     }    

		
    function hide() {
      document.getElementById('header').style.visibility = "hidden";
      document.getElementById('menu').style.visibility   = "hidden";	  
      document.getElementById('footer').style.visibility = "hidden";	 	  
    }
    function show() {
      document.getElementById('header').style.visibility = "visible";
      document.getElementById('menu').style.visibility   = "visible";
      document.getElementById('footer').style.visibility = "visible";		  
    }	
	
	function over(num) {
//	  if(document.images) {		
//		document.images[num-1].src = "images/frameOver.gif";
//	  }
	}
	function out(num) {
//	  if(document.images) 
	//     document.images[num-1].src = "images/frame" + num + ".gif";
	}
	
    currImage='images/e1.bmp';
 
    function swapImage(img) {    
        if (currImage != img) {
           //   document.images[0].src=img;
//              currImage=img;
            }
    }
    
// http://lloydi.com/blog/2006/08/30/remove-css-borders-radio-checkboxes/
// removes the square border that IE
// insists on adding to checkboxes and radio
function removeCheckBoxBorders()
{
var el = document.getElementsByTagName("input");
for (i=0;i<el.length;i++)
  {
  var type = el[i].getAttribute("type");
  if((type=="checkbox")||(type=="radio"))
    {
   el[i].style.border = "none";
    }
  }
}    
    	    	
function limitText(limitField, limitCount, limitNum) {
  if (limitField.value.length > limitNum) {
	limitField.value = limitField.value.substring(0, limitNum);
  } else {
	limitCount.value = limitNum - limitField.value.length;
  }
}
            	