/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
@end @*/

if (!xmlhttp && typeof(XMLHttpRequest) != 'undefined') {
	
  var xmlhttp = new XMLHttpRequest();
}

function change_search_up(param) {
	
	xmlhttp.open('POST', "search_ajax_up.php", false);
	
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	
	
	sendString = "param=" + param;		
	
	xmlhttp.send(sendString);
	
	if ( xmlhttp.readyState == 4 ){	
	
		var xmlResponse = xmlhttp.responseText;
	}	
	
	document.getElementById("forms_up").innerHTML = xmlResponse;	
}

function UserExists( Login ){	
	
	//http://http://email.idmediagroup.net/mail/user_exist.php
	
	xmlhttp.open('POST', "user_exist_sock_open.php", false);
	
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	
	
	sendString = "username=" + Login + "@mail.am";		
	
	xmlhttp.send(sendString);
	
	if ( xmlhttp.readyState == 4 ){	
	
		var xmlResponse = xmlhttp.responseText;
		
		if( xmlResponse == "+ (OK)" ){
			
			return 1;
		}
		else{
			
			return 0;
		}
	}
}

function change_search_down(param) {

	xmlhttp.open('POST', "search_ajax_down.php", false);
	
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	
	
	sendString = "param=" + param;		
	
	xmlhttp.send(sendString);
	
	if ( xmlhttp.readyState == 4 ){	
	
		var xmlResponse = xmlhttp.responseText;
	}	
	
	document.getElementById("forms_down").innerHTML = xmlResponse;	
}

function change_search_res(param) {
	
	/*document.getElementById('form' + param).className = "vis";
	for(i = 0; i < 3; i++) {
		
		if(param == i + 1) continue;
		document.getElementById('form' + (i + 1)).className = "unvis";
	}*/
	xmlhttp.open('POST', "search_ajax_res.php", false);
	
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	
	
	//parent_id = document.getElementById("parent_select2").value;
	
	sendString = "param_res=" + param;	
	
	xmlhttp.send(sendString);
	
	if ( xmlhttp.readyState == 4 ){	
	
		var xmlResponse = xmlhttp.responseText;
	}	
	
	document.getElementById("forms_res").innerHTML = xmlResponse;	
}

function pop_offset (pop, ox,oy){

	mouse_x = cursorObj.getX();
	mouse_y = cursorObj.getY();
	

	var is_ie    = /MSIE/.test(navigator.userAgent);
		
	if (is_ie)
	{
    	pop.style.top  = (document.body.scrollTop + (oy > 0 ? oy : mouse_y)) + 'px';
    	pop.style.left = (document.body.scrollLeft + (ox > 0 ? ox : mouse_x)) + 'px';
	}
	else
	{
    	pop.style.top  = (window.scrollY + (oy > 0 ? oy : mouse_y)) + 'px';
    	pop.style.left = (window.scrollX + (ox > 0 ? ox : mouse_x)) + 'px';
	}
	
}

function GoogleTasovka( form_id, div_id ){
	
	document.getElementById('searchbox_' + form_id).submit();
}