function runajaxpost(objID, serverPage)
{
var xmlhttp = false;
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
xmlhttp = new XMLHttpRequest();
}
var obj = document.getElementById(objID);
obj.innerHTML = '<img src="ajax-loader.gif" style="padding:0px 0px 0px 10px;" />';
xmlhttp.open("POST", serverPage,true);
xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
obj.innerHTML = xmlhttp.responseText;
}
}
xmlhttp.send(serverPage);
}

function runajax(objID, serverPage)
{
//Create a boolean variable to check for a valid Internet Explorer instance.
var xmlhttp = false;
//Check if we are using IE.
try {
//If the JavaScript version is greater than 5.
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
//If not, then use the older ActiveX object.
try {
//If we are using Internet Explorer.
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
//Else we must be using a non-IE browser.
xmlhttp = false;
}
}
// If we are not using IE, create a JavaScript instance of the object.
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
xmlhttp = new XMLHttpRequest();
}
var obj = document.getElementById(objID);
obj.innerHTML = '<img src="ajax-loader.gif" style="padding:0px 0px 0px 10px;" />';
xmlhttp.open("GET", serverPage);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
obj.innerHTML = xmlhttp.responseText;
}
}
xmlhttp.send(null);
}

function submitform() {
var cuv = document.getElementById('cuv');
if (cuv.value=="") alert("Surfmedia - Completeaza campul de cautare !");
else {
	var url = 'copigoajax.php?unu=1&cuv='+encodeURIComponent(cuv.value);
	runajax('results',url);
	}
}

function verificaenter(e){
var characterCode
	 if(e && e.which){
	 e = e
	 characterCode = e.which
	 }
	 else{
	 e = event
	 characterCode = e.keyCode
	 }	 
	 if(characterCode == 13){
 	 //document.forms[0].submit()
 	 submitform();
	 }
return true
}

function fakesubmit(){
}