$app_path = 'http://migom.by/';

function uni(txt){
	if(navigator.userAgent.indexOf("Opera")==-1) 
		return txt;
	var page=848;
	var txt2="";
	for(var i=0;i<txt.length;i++)
	{
		if(((txt.charCodeAt(i)>=192)&&(txt.charCodeAt(i)<=223))||((txt.charCodeAt(i)>=224)&&(txt.charCodeAt(i)<=255)))
		{
			txt2+=String.fromCharCode(page+txt.charCodeAt(i));
		}
		else
		{
			txt2+=String.fromCharCode(txt.charCodeAt(i));
		}
	}
	return txt2;
}

function popClick($vlink)
{	
	if ($vlink.substring(0,4) == 'http')
	{
		window.document.location.href = uni($vlink);
	}else
	{
		window.document.location.href = $app_path + uni($vlink);
	}
	return true;
}

function popClick_add($pid)
	{
	    $ps_id = 3;
		oiframe = window.iftrash;		
		//href = "index.php?block=_add_trash&pid="+$pid+"&ps_id="+$ps_id;
		href = "index.php"+$pid;
		
		oDiv = window.document.getElementById("trash");		
		oiframe.location.href=href;
		oSplash = window.document.getElementById("div_splash");
		offsetHeight = document.body.scrollTop;
		oSplash.style.top = offsetHeight+100;
		oSplash.innerHTML=window.document.getElementById("start_splash").innerHTML;
		oSplash.style.display="block";
}
function splash_close()
{
	document.getElementById("div_splash").style.display="none";
	clearTimeout(tid);
}
var close_t=30;
var v_text = "окно будет закрыто через ";
	var tid = "";
function doClose()
/*****************************************************************
	close splash automatic
*****************************************************************/
{
	close_t = close_t-1;
	if (close_t <= 0)
	{
		clearTimeout(tid);
		window.document.location.href = "index.php?action=trash_edit";
		//splash_close();
	}else{
		window.document.getElementById("div_timetext").innerHTML = v_text + close_t + " секунд";
					tid=window.setTimeout("doClose()",1000);
			}

}  // doClose()
function show_1()
{
      		//oDiv = window.document.getElementById("trash");
		oDiv.innerHTML = oiframe.document.getElementById("div_data").innerHTML;
		//oSplash.style.display="none";
		oSplash.innerHTML=window.document.getElementById("end_splash").innerHTML;
		close_t=6;
		doClose();
}  // show
