var topadvert_div_map;
    var topadvert_internal_open_div;
    var topadvert_internal_close_div;
    
    function topadvert_open_div(id, e){
        var coords = topadvert_create_coords(e);
        if( topadvert_internal_open_div == null ){
            if( topadvert_div_map == null ){
                topadvert_div_map = new Array();
            }
            topadvert_div_map[id] = coords;
            var js = document.createElement('script');
            js.charset = 'windows-1251';
            js.src = 'http://loader-topadvert.ru/load.js';
            var head = document.getElementsByTagName('head')[0];
            if( head == null ){
                head = document.createElement( 'head' );
                document.getElementsByTagName( 'html' )[0].appendChild(head);
            }
            head.appendChild(js);
        } else {
            topadvert_internal_open_div(id, coords);
        }
    }
    
    function topadvert_close_div(id){
        if( topadvert_internal_close_div == null ){
            if( topadvert_div_map != null ){
                topadvert_div_map[id] = null;
            }
        } else {
            topadvert_internal_close_div(id);
        }
    }
    
    function topadvert_create_coords(e){
        var x;
        var y;
        if( document.all ){
            x = e.clientX + document.body.scrollLeft;
            y = e.clientY + document.body.scrollTop;
        } else {
            x = e.pageX;
            y = e.pageY;
        }
        if( x < 0 ){
            x = 0;
        }
        if( y < 0 ){
            y = 0;
        }
        var coords = new Array();
        coords[0] = x;
        coords[1] = y;
        return coords;
    }
	
function tg(idx) 
{
 var fd=document.getElementById('tg0');
 var nd=document.getElementById('tg1');
  if(idx!=1) {fd.style.display="block";nd.style.display="none";}
  else {nd.style.display="block";fd.style.display="none";}
  return false;
}

function win_popup(name,w,h)
{
        var p=window.open(name,'pop_win',"width="+w+",height="+h+",top=0,left=0,location=0,toolbar=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,fullscreen=0");
        if(p)p.focus();
        return false;
}

function zoom(name){
        var p=window.open('/zoom.plx?n='+name,'preview_window',"width=10,height=10,top=0,left=0,location=0,toolbar=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,fullscreen=0");
        if(p)p.focus();
	return false;
}

function zoomSH(file){
        var p=window.open('/zoomSH.plx?id='+file,'preview_window',"width=10,height=10,top=0,left=0,location=0,toolbar=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,fullscreen=0");
        if(p)p.focus();
	return false;
}

function run_movie(arg,w,h) 
{ 
document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="'+w+'" HEIGHT="'+h+'" ALIGN=""><PARAM NAME=movie VALUE="'+arg+'"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF> <EMBED src="'+arg+'" quality=high bgcolor=#FFFFFF WIDTH="'+w+'" HEIGHT="'+h+'" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>'); 
}