

var xmlhttp;


function rateClient(score,client_id)
{

	sURL="http://www.look4jobs.info/XMLHTTPfunc.php?function=set_rate_client"+
	"&rate="+score+
	"&client_id="+client_id;

	// code for Mozilla, etc.
	if (window.XMLHttpRequest)
	{
		xmlhttp=new XMLHttpRequest()
		xmlhttp.onreadystatechange=xmlhttpChange
		xmlhttp.open("GET",sURL,true)
		xmlhttp.send(null)
	}
	// code for IE
	else if (window.ActiveXObject)
	{
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
		if (xmlhttp)
		{
			xmlhttp.onreadystatechange=xmlhttpChange
			xmlhttp.open("GET",sURL,true)
			xmlhttp.send()
		}
	}
}

function xmlhttpChange()
{
	// if xmlhttp shows "loaded"
	if (xmlhttp.readyState==4)
	{
		// if "OK"
		if (xmlhttp.status==200)
		{
			// ...some code here...
		}
		else
		{
			alert("Problem retrieving XML data")
		}
	}
}


function ShowHideConsole(id)
{
	el = document.getElementById(id);
	var display = el.style.display ? '' : 'none';
	el.style.display = display;
}


function resetRate(video_id)
{
	//('handle$id').innerHTML=''

}
function showRate(score,video_id)
{

	if (score>0)
	{
		el = document.getElementById('img1'+video_id);
		el.style.display='';
	}

	if (score>1)
	{
		el = document.getElementById('img2'+video_id);
		el.style.display='';
	}

	if (score>2)
	{
		el = document.getElementById('img3'+video_id);
		el.style.display='';
	}

	if (score>3)
	{
		el = document.getElementById('img4'+video_id);
		el.style.display='';
	}

	if (score>4)
	{
		el = document.getElementById('img5'+video_id);
		el.style.display='';
	}

}

function loadtags(video_id)
{

	sURL="http://www.d-videos.com/admin/XMLHTTPfunc.php?function=loadtags"+
	"&Video_ID="+video_id;
	if (window.XMLHttpRequest)
		  {
		  var xmlhttp=new XMLHttpRequest();
		  if (xmlhttp.overrideMimeType) {
               xmlhttp.overrideMimeType('text/xml');
		  }
                

		
		  }
		// code for IE
		else if (window.ActiveXObject)
		  {
		  var xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		  
		  }
	xmlhttp.open("POST", sURL, false);
	xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	xmlhttp.setRequestHeader('Content-Type','text/html; charset=windows-1255');
	xmlhttp.send(null);
	var RE = /^<success>/;
	if(xmlhttp.responseText.match(RE)) {
		tags=xmlhttp.responseText.replace('<success>','');
		document.getElementById('tags'+video_id).innerHTML=tags;
	}
	else {alert(xmlhttp.responseText);}
}


function addtag(video_id)
{
	var nothing='';
	el = document.getElementById('addtag'+video_id).value;
	sURL="http://www.d-videos.com/admin/XMLHTTPfunc.php?function=add_tag"+
	"&Tag="+el+
	"&Video_ID="+video_id;
	if (window.XMLHttpRequest)
		  {
		  var xmlhttp=new XMLHttpRequest();
		  if (xmlhttp.overrideMimeType) {
               xmlhttp.overrideMimeType('text/xml');
		  }
                

		
		  }
		// code for IE
		else if (window.ActiveXObject)
		  {
		  var xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		  
		  }
	xmlhttp.open("POST", sURL, false);
	xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	xmlhttp.setRequestHeader('Content-Type','text/html; charset=windows-1255');
	xmlhttp.send(null);
	var RE = /^<success>/;
	if(xmlhttp.responseText.match(RE)) {
		//alert('tag was add !');
		loadtags(video_id);
		document.getElementById('addtag'+video_id).value='';
	}
	else {alert(xmlhttp.responseText);}

}





function Validate()
{
	var x = document.details.elements
	for (var i=0;i<x.length;i++)
	{
		//				 alert(x[i].name + " = " + x[i].value);
		if (!x[i].value.length) { alert("Please Enter a Search Text.");x[i].focus();return false;}
	}
}

function getPosition(theElement) 
{ 
	var theElement=document.getElementById(theElement);
 var positionX = 0; 
 var positionY = 0; 

 while (theElement != null) 
 { 
   positionX += theElement.offsetLeft; 
   positionY += theElement.offsetTop; 
   theElement = theElement.offsetParent; 
 } 

 positionY=positionY-450;
 if (positionY<0) positionY=100;
 return positionY; 
}

function winOpen(theURL, Name, popW, popH, scroll) {
 var winleft = (screen.width - popW) / 2;
 var winUp = (screen.height - popH) / 2;
 winProp =
'width='+popW+',height='+popH+',left='+winleft+',t op='+winUp+',scrollbars='+scroll+',resizable'
 Win = window.open(theURL, Name, winProp)
 if (parseInt(navigator.appVersion) >= 4) { Win.window.focus(); }
}


