function createObject() {
		var xmlhttp;
		  try {
		  	 xmlhttp = new ActiveXObject('Msxml2.XMLHTTP.3.0'); 
		  } catch (e) {
		    try {
		      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		    } catch (E) {
			    try {
			      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			    } catch (EE) {
			      xmlhttp = false;
			    }
		    }
		  }
		  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		    xmlhttp = new XMLHttpRequest();
		  }
		  return xmlhttp;
}

var ajax_obj = createObject();
var global_div = 'div_v_page';

function ajaxState() {
	if(ajax_obj.readyState == 4){
		var response = ajax_obj.responseText;
		document.getElementById('div_info').innerHTML = response;
	}
}

function sendVoice(formName){
/*var fr = document.forms[formName];
var el1 = fr.elements["cardid"].value;
var el2 = fr.elements["phonenumber"].value;
var el3 = fr.elements["time"].value;
var el4 = fr.elements["year"].value;
var el5 = fr.elements["month"].value;
var el6 = fr.elements["day"].value;
var el7 = fr.elements["hour"].value;
var el8 = fr.elements["minute"].value;
var el9 = fr.elements["alert"].value;
var el10 = "cardsend.php?card_id="+el1+"&number="+el2+"&time="+el3+"&year="+el4+"&month="+el5+"&day="+el6+"&hour="+el7+"&minute="+el8+"&alert="+el9;
	ajax_obj.open('get', el10);
	ajax_obj.onreadystatechange =  ajaxState;
	ajax_obj.send(null);*/
	
	var data= window.document.forms[formName];
	var payFrm = [];
	var ii = 0;
	for (ii=0; ii<data.elements.length; ii++){
        payFrm.push(data.elements[ii].name + "=" + data.elements[ii].value);
    }

	document.getElementById('div_info').innerHTML = '<div style="text-align:center;"><img style="margin:10px;" src="images/ajax-loader.gif"><p>Загрузка</p></div>';
    
   	ajax_obj.open('POST', 'cardsend.php');	
	ajax_obj.onreadystatechange =  ajaxState;   
	ajax_obj.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	ajax_obj.send(payFrm.join('&'));
	
}	


function doItemOver(obj){
	obj.style.backgroundColor ="#F5F5F5";
}

function doItemOut(obj){
	obj.style.backgroundColor ="#FFFFFF";
}

function doDropOver(obj){
	obj.src ="images/drop_up.png";
}

function doDropOut(obj){
	obj.src ="images/drop_down.png";
}

function UpdateText(obj){
	var elem = document.getElementById('counterid');
	if (obj=='1'){
		elem.innerHTML = 'ID#704D';
	}
	else{
		elem.innerHTML = 'ID#097F';	
	}
	return true;
}
	
function PageUpdate(obj){
	var id = setTimeout('UpdateText('+obj+')', 8000); 
	return true;
}

function addBookmark(url, title) 
{ 
if (!url) url = location.href; 
if (!title) title = document.title; 
if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function")) window.sidebar.addPanel (title, url, ""); 
else if (typeof window.external == "object") window.external.AddFavorite(url, title); 
else if (window.opera && document.createElement) 
{ 
var a = document.createElement('A'); 
if (!a) return false;
a.setAttribute('rel','sidebar'); 
a.setAttribute('href',url); 
a.setAttribute('title',title); 
a.click(); 
} 
else return false; 
return true; 
}

//**************
function doDropClick(obj){
	var n_elem = document.getElementById('dropmenu');
	var d_button = document.getElementById('DropButton');
	
	if (n_elem.style.display == 'none'){
		n_elem.style.display = 'block';
		d_button.src = "images/drop_up.png";
	}
	else{
		n_elem.style.display = 'none';
		d_button.src = "images/drop_down.png";
	}
}

function doSelectItem(obj, txt){
	window.document.forms["payForm"].elements["type_curr"].value = obj.id;
	window.document.forms["payForm"].elements["currencytext"].value = txt;	
	document.getElementById('dropmenu').style.display = 'none';
	document.getElementById('DropButton').src = "images/drop_down.png";
}
//**************

function GetPay(obj){
	window.document.forms["payForm"].elements["id_goods"].value = obj;
	window.document.forms["payForm"].submit();
}

function getGame(FileId){
	document.forms["GameForm"].action = "gamesfile.php?game="+FileId;
	document.forms["GameForm"].submit();
}

function CheckClick(obj){
	document.forms["VoiceForm"].elements["time"].value = obj;
	var n_elem = document.getElementById('div_time');
	
	if (obj=="0"){
		n_elem.style.display = 'none';
	}
	else{
		n_elem.style.display = 'block';
	}
}

