var xmlHttp;
var y_checking = false;

function _postDates(divID,url,id) {
  xmlHttp=GetXmlHttpObject();
  if (xmlHttp==null) {
    alert ("Your browser does not support AJAX!");
	y_checking = false;
    return;
  }
  var params="id="+id;
  xmlHttp.open("POST",url,true);
  xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  xmlHttp.setRequestHeader("Content-length", params.length);
  xmlHttp.setRequestHeader("Connection", "close");
  xmlHttp.onreadystatechange=function stateChanged() { 
    if ( xmlHttp.readyState==4) {
      document.getElementById('avatar').innerHTML="<img  src=' http://img.msg.yahoo.com/avatar.php?yids="+id+"&format=jpg' style='border: solid 1px #dddddd;' />"
			document.getElementById('download_holder').innerHTML='<a title="Yahoo Status" id="download" href="php/download.php?id='+id+'"><span id=\"dw\"  > Download</span></a>'
			var rt=xmlHttp.responseText
			if(rt=='01') {
        document.getElementById(divID).innerHTML='<img src="imgs/online.gif" title="Yahoo Status"/>'
      } else if(rt=='02') {
        document.getElementById(divID).innerHTML='<img src="imgs/invisible_back.gif" title="Yahoo Status"/>'
			} else if(rt=='00') {
        document.getElementById(divID).innerHTML='<img src="imgs/offline.gif" title="Yahoo Status"/>'
			} else if(rt=='05') {
        document.getElementById(divID).innerHTML='<img src="imgs/invalid.gif" title="Yahoo Status"/>'
			} else {
				document.getElementById('avatar').innerHTML='<img title="Yahoo Status" src="imgs/busy.gif" />'
				document.getElementById('userId').innerHTML='';
			}												 
		}
	}
	xmlHttp.send(params);
  $("#flyDiv").animate({top:"0px",height:"0px"},400);
	// $("#flyDiv").css({width:"400px", left:$(window).width()/2-200+"px" }); 	
	$("#flyDiv").show();  
  $("#flyDiv").animate({top:"-140px",height:"170px"},1000);
  document.getElementById('download_holder').innerHTML="";
	document.getElementById('avatar').innerHTML='<img width="96px" height="80px" src="imgs/ajax-loader.gif" style="padding-left:14px; padding-top:14px;"/>'
	document.getElementById('userId').innerHTML=id;
	y_checking = false;
}

function _check() {
	if (!y_checking) { 
		var idr=document.getElementById("input").value;
		var id=idr.split("@",1).toString();
		// var id=idtmp.toString();
		if (id == "Enter yahoo ID here...") {
		alert("You must first enter yahoo ID!");
		//document.getElementById('input').value="Enter yahoo ID here...";
		} else if (id.indexOf(" ") != -1) {
			alert("UserID can't contain space!");
			//document.getElementById('input').value="Enter yahoo ID here...";
		} else if ((id.length > 32) || (id.length < 4)) {
			alert("UserID length can't be less than 4 and more than 32 characters!");
			//document.getElementById('input').value="Enter yahoo ID here...";
		} else {
			y_checking = true;
			var url="php/izee.php";
			_postDates('status',url,id);
			//document.getElementById('input').value="Enter yahoo ID here...";
			document.getElementById('status').innerHTML='';
		}
	}
	else
		alert('Please wait until you get the result !');
}

function GetXmlHttpObject() {
  var xmlHttp=null;
  try {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
  } catch (e) {
    // Internet Explorer
    try {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
  return xmlHttp;
}

function _arrangePage() {
	document.getElementById('input').value="Enter yahoo ID here...";
	var screenWidth = screen.width;
	var divWidth=document.getElementById('main_container').offsetWidth;
	var pos = (screenWidth - divWidth) / 2;
	document.getElementById('main_container').style.left = pos+"px";
	pupUpAd();
}

function resetf() {
	document.getElementById('input').value="";
}

function loadf() {
	var input=document.getElementById('input').value;
	if(input=="") {
		document.getElementById('input').value="Enter yahoo ID here...";
	}
}


			

		
function helyezMikulas() {
	var screenWidth = screen.width;
	var screenHeight = screen.height;
	if (screenWidth == 1280)
		if ((screenHeight == 1024) || (screenHeight == 960))
		{
			document.getElementById('santa').style.bottom = '0px';
			document.getElementById('santa').style.left = '1%';
			document.getElementById('szoveg').style.bottom = '30%';
			document.getElementById('szoveg').style.left = '18%';
		}
		else
			if ((screenHeight == 800) || (screenHeight == 768))
			{
				document.getElementById('santa').style.top = '380px';
				document.getElementById('santa').style.left = '1%';
				document.getElementById('szoveg').style.top = '475px';
				document.getElementById('szoveg').style.left = '18%';
			}
	if (screenWidth == 1024)
		if (screenHeight == 768)
		{
			document.getElementById('santa').style.top = '380px';
			document.getElementById('santa').style.left = '1%';
			document.getElementById('szoveg').style.top = '475px';
			document.getElementById('szoveg').style.left = '20%';
		}
		
	if (screenWidth == 1152)
		if (screenHeight == 864)
		{
			document.getElementById('santa').style.top = '380px';
			document.getElementById('santa').style.left = '1%';
			document.getElementById('szoveg').style.top = '475px';
			document.getElementById('szoveg').style.left = '20%';
		}
}