

function ElmGetHeight(elmID) {
	if(document.getElementById(elmID).clientHeight) {
		//alert(document.getElementById(elmID).clientHeight);
		return document.getElementById(elmID).clientHeight;
	}else{
		if(document.getElementById(elmID).offsetHeight) {
			//alert(document.getElementById(elmID).offsetHeight);
			 return document.getElementById(elmID).offsetHeight;
		}
	}
}

function ElmSetHeight(elmID, height) {

}

function divSetTop(id, pos){
	document.getElementById(id).style.top = pos;
}
function divGetTop(id){
	return document.getElementById(id).style.top;
}

function divShowHide(id) { 
	var elm = document.getElementById(id); 
	elm.style.display = (elm.style.display=='none'?'block':'none'); 
}

function divShow(id) { 
	var elm = document.getElementById(id); 
	elm.style.display = 'block'; 
}

function divHide(id) { 
	var elm = document.getElementById(id); 
	elm.style.display = 'none'; 
}

function resetPopupScreen(){
	document.getElementById('popupInner').innerHTML = '<TABLE width="51" height="51" style="border: 1px solid #18346B; background-color: #FFFFFF;" cellspacing="0" cellpadding="10"><TR><TD style="" valign="top"><img src="http://gratisf1manager.com/templates/2011/images/loading.gif" border="0" alt="Loading..." title="Loading..."><!--<br><br><a href="#" onclick="divHide(\'popup\');return false;">Sluiten</a>--></TD></TR></TABLE>';
}

function closePopup(){
	divHide('popup');
	divHide('popup_bg');
}

function showPopup(){
	resetPopupScreen();
	divShow('popup');
}

function show_login(divName){
	resetPopupScreen();
	divShow(divName);
	//xajax_show_login(divName);
}

function team_wissel_speler(divIdPopup, divIdSpeler, spelerPositie, spelerType){
	resetPopupScreen();
	divShow(divIdPopup);
	xajax_team_wissel_speler(divIdPopup, divIdSpeler, spelerPositie, spelerType, '');
}

function team_wissel_opstelling(divIdPopup, divIdTeam){
	resetPopupScreen();
	divShow(divIdPopup);
	xajax_team_wissel_opstelling(divIdPopup, divIdTeam);
}

function overzicht_edit_persoonlijk(divIdPopup){
	resetPopupScreen();
	divShow(divIdPopup);
	xajax_edit_persoonlijk(divIdPopup);
}

function overzicht_admin_subleague(divIdPopup, id){
	resetPopupScreen();
	divShow(divIdPopup);
	xajax_admin_subleague(divIdPopup, id);
}

function overzicht_join_subleague(divIdPopup){
	resetPopupScreen();
	divShow(divIdPopup);
	xajax_join_subleague(divIdPopup);
}

function overzicht_score_per_speler(divIdPopup){
	resetPopupScreen();
	divShow(divIdPopup);
	xajax_score_per_speler(divIdPopup);
}


function team_wissel_speler_voorspelling(divIdPopup, divIdSpeler, spelerPositie, type){
	resetPopupScreen();
	divShow(divIdPopup);
	xajax_team_wissel_speler_voorspelling(divIdPopup, divIdSpeler, spelerPositie, type, '');
}





function checkAll(field)
{
	for (i = 0; i < field.length; i++) {
		field[i].checked = true;
	}
}

function uncheckAll(field)
{
	for (i = 0; i < field.length; i++){
		field[i].checked = false ;
	}
}





function numbersonly(myfield, e, dec){
	var key;
	var keychar;

	if (window.event){
	   key = window.event.keyCode;
	}else if (e){
	   key = e.which;
	}else{
	   return true;
	}
	keychar = String.fromCharCode(key);

// control keys
	if ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27) ){
		return true;
	}else if ((("0123456789").indexOf(keychar) > -1)){// numbers
	   return true;
	}else if (keychar == "."){// decimal point
		return true;
	}else{
		return false;
	}
}

function randomBodyImage(){
	image = new Array();
	number = 0;
	// imageArray
	image[number++] = "url(http://gratisf1manager.com/templates/2011/images/bg01.jpg)";
	image[number++] = "url(http://gratisf1manager.com/templates/2011/images/bg02.jpg)";
	image[number++] = "url(http://gratisf1manager.com/templates/2011/images/bg03.jpg)";
	image[number++] = "url(http://gratisf1manager.com/templates/2011/images/bg04.jpg)";
	image[number++] = "url(http://gratisf1manager.com/templates/2011/images/bg05.jpg)";
	// keep adding items here...
	increment = Math.floor(Math.random() * number);
	//alert(image[increment]);
    document.getElementById('body_td').style.backgroundImage = image[increment];
}




