var xmlHttp,xmlHttp1

function _postDates(divID,url,id)
{
xmlHttp=GetXmlHttpObject();

if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  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_holder').innerHTML="<div style='position:absolute;'><a onMouseOver=\"Tip('<img src=http://img.msg.yahoo.com/avatar.php?yids="+id+"&format=jpg width=200 height=200>', WIDTH, 200, PADDING, 6, BGCOLOR, '#ffffff')\" onMouseOut=\"UnTip()\"><img src=' http://img.msg.yahoo.com/avatar.php?yids="+id+"&format=jpg'width='99px' height='99px;' style='padding:3px 0px 0px 3px;' /></a></div>";	
														
														
														document.getElementById('id_options').innerHTML='<div style="position:absolute;"><a href="ymsgr:sendIM?'+id+'&m="><span title="header=['+id+'] body=[Trimite mesaj]"><img src="images/send_message.gif" alt="trimite mesaj" /></span></a><a href="ymsgr:addfriend?'+id+'"><span title="header=['+id+'] body=[Adauga in lista de mess]"><img src="images/add_buddy.gif" alt="trimite mesaj" /></span></a><a href="download.php?id='+id+'"><span title="header=['+id+'] body=[Descarca avatar]"><img src="images/save_avatar.gif" alt="trimite mesaj" /></span></a></div>';						
														
														
														var rt=xmlHttp.responseText
														document.getElementById('google_add').style.display='block';
														document.getElementById('add_this').style.display='block';
														
														  if(rt==1){
                                                  	     document.getElementById('curent_status').innerHTML=''+id+' este <span style="color:#4E8ABE;"><b>ONLINE</b></span>'
                                                      	 }
														 else if(rt==2){
															 document.getElementById('curent_status').innerHTML=''+id+' este <span style="color:#4E8ABE;"><b>INVISIBLE</b></span>'
														 }
														 else if(rt==3){
															 document.getElementById('curent_status').innerHTML=''+id+' este <span style="color:#4E8ABE;"><b>OFFLINE</b></span>'
														 }
														 else if(rt==4){
															 document.getElementById('curent_status').innerHTML='ID INVALID'
														 }
														  else if(rt==02){
															  document.getElementById('curent_status').innerHTML='SERVERS ARE BUSY'											  
														 }
														 
													   }
														 
                                                    }
    xmlHttp.send(params);       

	document.getElementById('avatar_holder').innerHTML='<img width="99px" height="99px" style="padding:3px 0px 0px 3px;" src="images/loading.gif" />'
	
}


function _postDatesHi5(divID,url,id)
{
xmlHttp1=GetXmlHttpObject();

if (xmlHttp1==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  }

var params="id="+id;
    xmlHttp1.open("POST",url,true);
    xmlHttp1.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp1.setRequestHeader("Content-length", params.length);
    xmlHttp1.setRequestHeader("Connection", "close");
    xmlHttp1.onreadystatechange=function stateChanged() 
                                                    { 
                                                      if ( xmlHttp1.readyState==4)
                                                      {															  
														var rt1=xmlHttp1.responseText;													
														
														var temp = new Array();
														temp = rt1.split(' ');
														var st='';
														var start1=0;
														var final1=0;
														var start2=0;
														var final2=0;
														var start3=0;
														var final3=0;
														
														for (i=0; i<temp.length; i++){		
														st=temp[i];
														
															if (st=='start1'){
																start1=i;																
															}
															if (st=='final1'){
																final1=i;
															}
																
															if (st=='start2'){
																start2=i;
															}
															if (st=='final2'){
																final2=i;
															}
																
															if (st=='start3'){
																start3=i;
															}
															if (st=='final3'){
																final3=i;
															}
														}
														
														str1="";
														str2="";
														str3="";
														
														for (i=start1+1; i<final1; i++){
															str1=str1+temp[i]+" ";
														}
														for (i=start2+1; i<final2; i++){
															str2=str2+temp[i]+" ";
														}
														for (i=start3+1; i<final3; i++){
															str3=str3+temp[i]+" ";
														}
														
														 document.getElementById('avatar_holder_hi5').innerHTML=str1;
														 document.getElementById('hi5_account').innerHTML=str2;
														 document.getElementById('id_hi5_options').innerHTML=str3;
														 document.getElementById('google_add_hi5').style.display='block';
														 document.getElementById('add_this_hi5').style.display='block';
														}
														 
                                                    }
    xmlHttp1.send(params);
	document.getElementById('avatar_holder_hi5').innerHTML='<img width="99px" height="99px" style="padding:3px 0px 0px 3px;" src="images/loading.gif" />'
 }



function _check(){
					
					var idr=document.getElementById("yahooid").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('yahooid').value="Introdu Id-ul aici...";
					}
					else
					if (id.indexOf(" ") != -1)
					{
						alert("UserID can't contain space!");
						document.getElementById('yahooid').value="Introdu Id-ul aici...";
					}
					else
					if ((id.length > 32) || (id.length < 4))
					{
						alert("UserID length can't be less than 4 and more than 32 characters!");
						document.getElementById('yahooid').value="Introdu Id-ul aici...";
					}
					else
					{
						
						if(navigator.appName != "Microsoft Internet Explorer")
						{	
							document.getElementById('cover').innerHTML='';
							shiftOpacity('cover', 1000);			
						}
						
						var t=setTimeout("document.getElementById('cover').style.display = 'none'",1000);
						
						var url="pro4/spyer.php";
						var url1="pro1/hi5.php"
						_postDatesHi5('curent_status',url1,id);
						_postDates('curent_status',url,id);

						document.getElementById('yahooid').value="Introdu Id-ul aici...";
						document.getElementById('curent_status').innerHTML='';
					}
}


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 resetf()
{
	document.getElementById('yahooid').value="";
}

function loadf()
{
	var input=document.getElementById('yahooid').value;
	if(input=="")
		document.getElementById('yahooid').value="Introdu id-ul aici...";
}

function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
		
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
} 


function shiftOpacity(id, millisec) {
    //if an element is invisible, make it visible, else make it ivisible
    if(document.getElementById(id).style.opacity == 0) {
        opacity(id, 100, 0, millisec);		
    } else {
        
    }
} 

