// JavaScript Document
var req;
var highlighting;
var alpha;

function loadXMLDocDron(urls) {
//	alert(urls);
	// branch for native XMLHttpRequest object
	if (window.XMLHttpRequest) {
		req = new XMLHttpRequest();
		req.onreadystatechange = processReqChangeDron;
		req.open("GET", urls, true);
		req.send(null);
	// branch for IE/Windows ActiveX version
	} else if (window.ActiveXObject) {
		req = new ActiveXObject("Microsoft.XMLHTTP");
		if (req) {
			req.onreadystatechange = processReqChangeDron;
			req.open("GET", urls, true);
			req.send();
		}
	}
}

function checkLast(input, response)
{
	if (response != ''){ 
/*		alert('ответ получен!' + response);
		// Response mode
		message   = document.getElementById('nameCheckFailed');
		if (response == '1'){
			message.className = 'error';
		}else{
			message.className = 'hidden';
		} */
		document.getElementById('sms_table').innerHTML = response;
	}else{
		//alert('отправка запроса' + input);
		// Input mode
		loadXMLDocDron('/list.php?id=' + input);
	}
}

function processReqChangeDron() 
{
	// only if req shows "complete"
	if (req.readyState == 4) {
		// only if "OK"
		if (req.status == 200) {
		// ...processing statements go here...
			
			response = req.responseXML.documentElement;
//			alert('ответ получен req.status=' + req.status);
			
			method = response.getElementsByTagName('method')[0].firstChild.data;
			last = response.getElementsByTagName('last')[0].firstChild.data;
			result = response.getElementsByTagName('result')[0].firstChild.data;
			result = decodeURIComponent(result);
			
			if(last > 0 && last != id) id = last;
			
			//document.write('ответ получен! method=' + method + ' и result=' + result + ' и last=' + last);
			//alert('ответ получен! method=' + method + ' и result=' + result + ' и last=' + last + ' и id=' + id);
			eval(method + '(\'\', result)');
			
		} else {
			alert("There was a problem retrieving the XML data:\n" + req.statusText);
		}
	}
}

function NoPrint(a, b){
//	alert('NoPrint');	
}

function PasRemember(){
	d = document.getElementById("RemeberForm");
	d.style.visibility = 'visible';
	d.style.display = 'block';
}

function high(which2){
	theobject=which2;
	highlighting=setInterval("highlightit(theobject)",20);
}

function low(which2){
	clearInterval(highlighting);
	alpha=20;
	which2.filters.alpha.opacity=20;
}

function highlightit(cur2){
	if (alpha<100){
		alpha+=5;
		cur2.filters.alpha.opacity=alpha;
	} else if (window.highlighting)
		clearInterval(highlighting);
}

