this.focus();

function getElementPosition(elemID) {
    var offsetTrail = document.getElementById(elemID);
    var offsetLeft = 0;
    var offsetTop = 0;
    while (offsetTrail) {
        offsetLeft += offsetTrail.offsetLeft;
        offsetTop += offsetTrail.offsetTop;
        offsetTrail = offsetTrail.offsetParent;
    }
    if (navigator.userAgent.indexOf("Mac") != -1 && 
        typeof document.body.leftMargin != "undefined") {
        offsetLeft += document.body.leftMargin;
        offsetTop += document.body.topMargin;
    }
    return {left:offsetLeft, top:offsetTop};
	}

function gE(elName) {
		return document.getElementById(elName);
}

function showResult(pollID){
	gE('result'+pollID).style.display='';
	gE('poll'+pollID).style.display='none';
	gE('vote'+pollID).style.display='none';
	gE('showResults'+pollID).style.display='none';
	gE('showPolls'+pollID).style.display='';
}

function showPoll(pollID){
	gE('result'+pollID).style.display='none';
	gE('poll'+pollID).style.display='';
	gE('vote'+pollID).style.display='';
	gE('showResults'+pollID).style.display='';
	gE('showPolls'+pollID).style.display='none';
}

function checkComment(){
  var commentName = gE('commentName').value
  var commentEmail = gE('commentEmail').value
  var commentTextarea = gE('commentTextarea').value
  
  if (commentName.length>0 && commentEmail.length>0 && commentTextarea.length>0){
    gE('commentFRM').submit();
  }
  else {
    var text='Nu ati completat: \n';
    if (commentName.length<=0) text+='  - Numele\n';
    if (commentEmail.length<=0) text+='  - E-mailul\n';
    if (commentTextarea.length<=0) text+='  - Mesajul\n';
    
    alert(text);
  }
}

function checkAcreditare(lang){
	if (lang=="rom") var errorText='Nu ati completat urmatoarele campuri:\n';
	else var errorText='You must cmplete the following:\n';
	var isOk=true;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	
	var arrInputs=[];
	var arrDefaultText=[];
	
	if (lang=="rom") arrInputs["name"]='Nume';
	else arrInputs["name"]='Name';
	if (lang=="rom") arrInputs["calitate"]='Calitate';
	else arrInputs["calitate"]='Calitate';
	if (lang=="rom") arrInputs["partida"]='Partida';
	else arrInputs["partida"]='Partida';
	if (lang=="rom") arrInputs["phone"]='Numar tel';
	else arrInputs["phone"]='Phone';
	if (lang=="rom") arrInputs["email"]='E-mail';
	else arrInputs["email"]='E-mail';
		
	if (lang=="rom") arrDefaultText["name"]='Nume';
	else arrDefaultText["name"]='Name';
	if (lang=="rom") arrDefaultText["calitate"]='Calitate';
	else arrDefaultText["calitate"]='';
	if (lang=="rom") arrDefaultText["partida"]='Partida';
	else arrDefaultText["partida"]='';
	if (lang=="rom") arrDefaultText["phone"]='Numar tel';
	else arrDefaultText["phone"]='Phone';
	if (lang=="rom") arrDefaultText["email"]='E-mail';
	else arrDefaultText["email"]='E-mail';
	
	
	for (var i in arrInputs){
		if (typeof(arrInputs[i])!="function"){
			//alert(i+' = '+gE(i));
			if (gE(i).value.length==0 || gE(i).value==arrDefaultText[i]){
				isOk=false;
				errorText+='- '+arrInputs[i]+'\n';
			}
		}
	}
	
	if (!filter.test(gE('email').value) && isOk) { 
		isOk=false;
		if (lang=="rom") errorText+='- Adresa de e-mail nu este valida (ex: adresa@domeniu.ext)\n';
		else errorText+='- The e-mail address is not valid (ex: adresa@domeniu.ext)\n';
		
	}
	
	if (isOk){
		gE('acreditareFRM').submit();
		//alert('e OK');
	}
	else {
		alert(errorText);
	}
}

function clearAcreditare(inputID, defaultText){
	if (gE(inputID).value==defaultText){
		gE(inputID).value="";
	}
}


function showNextMatch__Full(){
	var startPos=getElementPosition('secondMenuBlock');
	
	//gE('shoNextMatchFrame').style.display='block';
	gE('showNextMatchBlock').style.display='block';
	
	
	var divWidth=gE('showNextMatchBlock').offsetWidth;
	var divHeight=gE('showNextMatchBlock').offsetHeight;
	//gE('showNextMatchBlock').style.display='none';
	
	/*ifrm = document.createElement("IFRAME");
  //ifrm.setAttribute("src", "javascript: false");
  ifrm.style.position = "absolute";
  ifrm.style.width = divWidth+"px";
  ifrm.style.height = divHeight+"px"; //257
  ifrm.style.backgroundColor = "#FFFFFF";
  //ifrm.style.width = "650px";
  //ifrm.style.height = "150px";
  ifrm.style.zIndex = 50;
  ifrm.style.left = ((1000-650)/2)+startPos['left'];
	ifrm.style.top = 50+startPos['top'];
	alert(ifrm.style.left+' | '+ifrm.style.top)
  document.body.appendChild(ifrm);*/
	
	//gE('showNextMatchBlock').style.zIndex = 100;
	//gE('showNextMatchBlock').style.display='block';
	
	gE('showNextMatchBlock').style.left=((1000-650)/2)+startPos['left'];
	gE('showNextMatchBlock').style.top=50+startPos['top'];
}


function showNextMatchFull(){
	var startPos=getElementPosition('secondMenuBlock');
	
	var msg=document.getElementsByName('msg');
	var flash = msg[0];
	if (flash){
		/*flash.setAttribute("wmode","transparent");
		var clone = flash.cloneNode(true);
		flash.parentNode.replaceChild(clone, flash);*/
	
		var param = document.createElement('param');
		param.name = 'wmode';
		param.value = 'transparent';
		flash.appendChild(param);
		var clone = flash.cloneNode(true);
		flash.parentNode.replaceChild(clone, flash);
	}
	
	gE('showNextMatchBlock').style.display='block';
	var divWidth=gE('showNextMatchBlock').offsetWidth;
	var divHeight=gE('showNextMatchBlock').offsetHeight;
	
	if (gE('showNextMatchFrame')){
		ifrm=gE('showNextMatchFrame');
		document.body.removeChild(ifrm);
	}
	
	ifrm = document.createElement("IFRAME");
  //ifrm.setAttribute("src", "javascript: false");
  ifrm.setAttribute("id", "showNextMatchFrame");
  ifrm.style.position = "absolute";
  ifrm.style.width = divWidth-3+"px";
  ifrm.style.height = divHeight-4+"px"; //257
  ifrm.style.backgroundColor = "#FFFFFF";
  //ifrm.style.width = "650px";
  //ifrm.style.height = "150px";
  ifrm.style.zIndex = 50;
  ifrm.style.left = ((1000-650)/2)+startPos['left'];
	ifrm.style.top = 50+startPos['top'];
  document.body.appendChild(ifrm);
	
	gE('showNextMatchBlock').style.zIndex = 100;
	gE('showNextMatchBlock').style.left=((1000-650)/2)+startPos['left'];
	gE('showNextMatchBlock').style.top=50+startPos['top'];
}

function closeNextMatchFull(){
	ifrm=gE('showNextMatchFrame');
	document.body.removeChild(ifrm);
	gE('showNextMatchBlock').style.display='none';
}


var xmlHttp

function checkMatch(idMatch) {
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null) {
 		alert ("Browser does not support HTTP Request")
 		return
 	}
 	
 	//gE('userCheckIcon'+searchType).innerHTML='<img src="images/icons/wait.png" align="absmiddle" border="0">';
 	//var user=gE(layerUser).value;
 	//gE('userCheck').value=1;
 	
	var url="index.php"
	url=url+"?act=nextMatchAjax"
	url=url+"&id="+idMatch
	url=url+"&sid="+Math.random()
	//alert(url);
	xmlHttp.onreadystatechange=stateChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null);
}

function stateChanged() { 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
		var res = new Array();
		response=xmlHttp.responseText;
		//alert(response);
		if (response.substring(0,3)=="res"){
			eval(response);
			
			if (res['competitionlogo']) gE('competitionLogoBlock').innerHTML='<img src="images/logo/'+res['competitionlogo']+'" border="0">';
			else gE('competitionLogoBlock').innerHTML='&nbsp;';
				
			if (res['homeTeam']) gE('homeTeamNameBlock').innerHTML=''+res['homeTeam']+'';
			else gE('homeTeamNameBlock').innerHTML='&nbsp;';
			
			if (res['homeTeamLogo']) gE('homeTeamLogoBlock').innerHTML='<img src="images/logo/'+res['homeTeamLogo']+'" border="0">';
			else gE('homeTeamLogoBlock').innerHTML='&nbsp;';
				
			if (res['awayTeamLogo']) gE('awayTeamLogoBlock').innerHTML='<img src="images/logo/'+res['awayTeamLogo']+'" border="0">';
			else gE('awayTeamLogoBlock').innerHTML='&nbsp;';
				
			if (res['awayTeam']) gE('awayTeamNameBlock').innerHTML=''+res['awayTeam']+'';
			else gE('awayTeamNameBlock').innerHTML='&nbsp;';
			
			if (res['obs']) gE('matchObsBlock').innerHTML=''+res['obs']+'';
			else gE('matchObsBlock').innerHTML='-';
			
			showNextMatchFull();
		}
		else {
			alert(response);
		}
	} 
} 

function GetXmlHttpObject() { 
	var objXMLHttp=null
	if (window.XMLHttpRequest) {
 		objXMLHttp=new XMLHttpRequest()
 	}
	else if (window.ActiveXObject) {
 		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
 	}
	return objXMLHttp
} 


/*
window.onload = function() {fixFlash(); }
function fixFlash() {
	objects = document.getElementsByTagName("object");
	for (var i = 0; i < objects.length; i++) {
  	objects[i].outerHTML = objects[i].outerHTML;
	}
}
*/

/*
if (navigator.appName.indexOf('Microsoft') != -1){

var supersleight	= function() {
	
	var root = false;
	var applyPositioning = true;
	
	// Path to a transparent GIF image
	var shim			= 'images/x.gif';
	
	// RegExp to match above GIF image name
	var shim_pattern	= /x\.gif$/i;
	
	
	
	var fnLoadPngs = function() { 
		if (root) {
			root = document.getElementById(root);
		}else{
			root = document;
		}
		for (var i = root.all.length - 1, obj = null; (obj = root.all[i]); i--) {
			// background pngs
			if (obj.currentStyle.backgroundImage.match(/\.png/i) !== null) {
				bg_fnFixPng(obj);
			}
			// image elements
			if (obj.tagName=='IMG' && obj.src.match(/\.png$/i) !== null){
				el_fnFixPng(obj);
			}
			// apply position to 'active' elements
			if (applyPositioning && (obj.tagName=='A' || obj.tagName=='INPUT') && obj.style.position === ''){
				obj.style.position = 'relative';
			}
		}
	};

	var bg_fnFixPng = function(obj) {
		var mode = 'scale';
		var bg	= obj.currentStyle.backgroundImage;
		var src = bg.substring(5,bg.length-2);
		if (obj.currentStyle.backgroundRepeat == 'no-repeat') {
			mode = 'crop';
		}
		obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='" + mode + "')";
		obj.style.backgroundImage = 'url('+shim+')';
	};

	var el_fnFixPng = function(img) {
		var src = img.src;
		img.style.width = img.width + "px";
		img.style.height = img.height + "px";
		img.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='scale')";
		img.src = shim;
	};
	
	var addLoadEvent = function(func) {
		var oldonload = window.onload;
		if (typeof window.onload != 'function') {
			window.onload = func;
		} else {
			window.onload = function() {
				if (oldonload) {
					oldonload();
				}
				func();
			};
		}
	};
	
	return {
		init: function() { 
			addLoadEvent(fnLoadPngs);
		},
		
		limitTo: function(el) {
			root = el;
		},
		
		run: function() {
			fnLoadPngs();
		}
	};
}();

// limit to part of the page ... pass an ID to limitTo:
 supersleight.limitTo('moonmenu');

supersleight.init();

}
*/
