var clsid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000";
var rand=Math.random()*100000000;

function run_flash(holderid,name,w,h,vars,mode)
{
var wmode="window";
if(mode=="transparent"){wmode="transparent";}
document.getElementById(holderid).innerHTML='<object id='+name+' classid='+clsid+' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width='+w+' height='+h+'><param name="wmode" value="'+wmode+'"><param name="allowFullScreen" value="true"><PARAM NAME="FlashVars" VALUE="'+vars+'"><param name="allowScriptAccess" value="always"><param name="src" value="'+name+'.swf"><param name="movie" value="'+name+'.swf"/><embed src="'+name+'.swf" wmode="'+wmode+'" FlashVars="'+vars+'" allowfullscreen="true" width='+w+' height='+h+' allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"><\/embed><\/object>';
return true;
}

function show_pic(pic_url,pic_width,pic_height,alt)
{
if(pic_height==0){pic_height=pic_width/4*3;}
var w=window.open("","","toolbar=no,location=no,top=50,left=50,directories=no,menubar=no,scrollbars=no,status=no,resizable=no,width="+pic_width+",height="+pic_height+"");
w.document.write("<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'><html><head><title>Pilt<\/title><\/head><body style='margin:0px;padding:0px;background-color:#e3e8ed;'><table width='100%' height='100%' cellspacing='0' cellpadding='0' style='position:absolute;top:0px;left:0px;z-index:1;'><tr><td align='center' style='vertical-align:middle;'><img src='"+pic_url+"' alt='"+alt+"' onclick='window.close();'><\/td><\/tr><\/table><div align='center' style='width:100%;position:absolute;top:"+(pic_height/2-20)+"px;left:0px;z-index:0;'><img src='http://www.ida-virumaa.ee/pix/Bar_loading.gif' alt='' width='80'><\/div><\/body><\/html>");
}

function open_window(path,wdth,hght,title,scrolls)
{
var w=wdth,h=hght,scrlls=scrolls;if(w==undefined||w==0)
{
w=screen.availWidth;
h=screen.availHeight;
}
if(scrlls!="yes"){scrlls="no";}
window.open(path,title,"toolbar=no,location=no,top=0,left=0,directories=no,scrollbars="+scrlls+",status=no,resizable="+scrlls+",width="+w+",height="+h);
return;
}

function set_read_cookie(mode,name,val,exp)
{
// exp - seconds
if(mode=='set')
{
	var date = new Date();
	date.setTime(date.getTime()+exp*1000);
	var expires=''+date.toGMTString();
	document.cookie=''+name+'='+val+'; expires='+date.toGMTString()+'; path=/';
	return true;
}else
{
if(document.cookie.indexOf(name)==-1){return false;}else
	{
	var splitted0=document.cookie.split(name+'=');
	var splitted1=splitted0[1].split(';');
	return splitted1[0]*1;
	}
}
return;
}

function href2js(holder_id){try{document.getElementById(holder_id).href='javascript:popup_event("'+holder_id+'")';}catch(err){}}

function findPosX(objname)
{
obj=document.getElementById(objname);
var curleft=0;
if(obj.offsetParent)
while(1) 
{
curleft+=obj.offsetLeft;
if(!obj.offsetParent)break;obj=obj.offsetParent;
}else
if(obj.x)curleft+=obj.x;return curleft;
}

function findPosY(objname)
{
obj=document.getElementById(objname);
var curtop=0;
if(obj.offsetParent)
while(1) 
{
curtop+=obj.offsetTop;
if(!obj.offsetParent)break;obj=obj.offsetParent;
}else
if(obj.y)curtop+=obj.y;return curtop;
}

function clear_preloader(name)
{
if(document.getElementById(name).innerHTML==""){return;}
clearTimeout([name]);
document.getElementById(name).innerHTML="";
return;
}