// JavaScript Document

//VARS

browserVersion = navigator.userAgent; //browser check
var selectedTab = ''; //selected tab users
var selectedClips = ''; //selected tab clips&games

function loadCSS(browser) {
	var headID = document.getElementsByTagName("head")[0];         
	var cssNode = document.createElement('link');
	cssNode.type = 'text/css';
	cssNode.rel = 'stylesheet';
	cssNode.href = 'css/style'+browser+'.css';
	cssNode.media = 'screen';
	headID.appendChild(cssNode);
}

//global variables that can be used by ALL the function son this page.
var imgFalse = 'img/uchk.jpg';
var imgTrue = 'img/chk.jpg';

function replaceChecks(checkboxId) {

	if(!checkboxId) return;
	
	//get all the input fields on the page
	chkbox = document.getElementById(checkboxId);
	if(!chkbox) return;

	var img = document.createElement('img');

	if(chkbox.checked) {
		img.src = imgTrue;
	} else {
		img.src = imgFalse;
	}
	
	//set image ID and onclick action
	img.id = 'checkImage'+checkboxId;
	//set image 
	img.onclick = new Function('checkChange("'+checkboxId+'")');
	//place image in front of the checkbox
	chkbox.parentNode.insertBefore(img, chkbox);
			
	//hide the checkbox
	chkbox.style.display='none';

}

//change the checkbox status and the replacement image
function checkChange(i) {

  chkbox = document.getElementById(i);
  if(chkbox) {
    if(chkbox.checked) {
  		chkbox.checked = false;
  		document.getElementById('checkImage'+i).src=imgFalse;
  	} else {
  		chkbox.checked = true;
  		document.getElementById('checkImage'+i).src=imgTrue;
  	}
  }
}
//ONLOAD FUNCTIONS
replaceChecks('loginRemember');

var innerHeight = ((browserVersion.indexOf('MSIE') > -1)?document.documentElement.clientHeight:window.innerHeight);
var footerOT = document.getElementById('footer').offsetTop;
var	footerH = document.getElementById('footer').offsetHeight;
//alert(innerHeight+'==='+footerOT+'==='+(innerHeight - 78 - footerH)+'==='+footerH);
document.getElementById('content').style.minHeight = (innerHeight - footerH - 30) + 'px';