var uploadsuccess=false;

function none() { }


function dish(name,lang)
{
 if(!uploadsuccess) uploader_init();
 var raspdiv = document.getElementById("rightblock");
 raspdiv.innerHTML="<div style='PADDING-LEFT: 100px;PADDING-TOP: 100px;'><img src='/images/hour_glass2.gif' width='22' height='22'></div>";
 setTimeout("uploader_go('scat=" + name + "&lang=" + lang + "');",200);
}

function rand()
{
  return(Math.floor(Math.random()*10000+1));
}

function getById(id)
{
	return document.getElementById(id);
}


function uploader_init ()
{
        if(!uploadsuccess) uploader = new clUploadData('/menu_ax.php');
}

function uploader_go (id)
{
	uploader.upload(id);
}


var uploader;


function get_by_id(id)
{
	var itm = null;
	if (document.getElementById){
		itm = document.getElementById(id);
	}
	else if (document.all){
		itm = document.all[id];
	}
	else if (document.layers){
		itm = document.layers[id];
	}
	return itm;
}


function print_to_div(id, text)
{
	var d = get_by_id(id);
	if (d) {d.innerHTML = text;}
}


function clUploadData ( thesrc ) {
	// устанавливаем адрес подгрузки
	this.src = thesrc;
	// подгружаться будет методом GET
	this.src += "?";
	//тип подгружаемого элемента - text/javascript
	this.type = "text/javascript";
	this.oldScript  = document.createElement("SCRIPT");
	this.oldScript.type = this.type;
	this.callId = rand();
	document.body.appendChild(this.oldScript);
	this.upload = function ( theparams ) {
		//Параметры передаются в виде par1=val1&par2=val2&...
		var tParams = theparams || "";
		var newScript = document.createElement("SCRIPT");
		newScript.type = this.type;
		this.callId += 1;
		newScript.src  = this.src + "callid=" + String(this.callId) + "&" + tParams;
		// alert(newScript.src);
		document.body.replaceChild(newScript,this.oldScript);
		this.oldScript = newScript;
	}
	uploadsuccess=true;
}
