/*************************** common functions ***************************/

// Define Style Sheet
function bwsr_css()
{

  if (document.all) {
    document.write('<LINK REL="STYLESHEET" TYPE="text/css" HREF="/script/ie.css">');
  }
  else if (document.layers) {
    document.write('<LINK REL="STYLESHEET" TYPE="text/css" HREF="/script/nn.css">');
  }
  else if (document.getElementById) {
    document.write('<LINK REL="STYLESHEET" TYPE="text/css" HREF="/script/ie.css">');
  }
  else {
    document.write('<LINK REL="STYLESHEET" TYPE="text/css" HREF="/script/nn.css">');
  }

}

var afishaWindow;
var museumWindow;

// simple browser detector
	function ie()
	{
		n = navigator;
		na = n.appName;
		return (na.indexOf('icrosoft')!=-1);
	}

// shows afisha
	function showAfisha(window0)
	{	
		return openNewWin(window0, 
		'/afisha.html',
		'afisha', 550, 550, 0, 0, 'yes', 'yes');
	}

// shows museum
	function showMuseum(window0)
	{	
		return openNewWin(window0, 
		'/museum/index.html',
		'museum', 684, 502, 70, 40, 'no', 'no');
	}
	
// open new window with some parameters (works in ?all? browsers)
	function openNewWin(window0, NewUrl, NewName, NewWidth, NewHeight, newLeft, newTop, scrolls, resizable)
	{
		var wS;
		var tW;

		if( window0==null || window0.closed )
		{
			tW=top.window;
			wS = 
				"toolbar=no,location=no,directories=no,status=no," +
				"menubar=no,scrollbars=" + scrolls + ",resizable=" + resizable+
				",width=" + NewWidth + ",height=" + NewHeight;
				if(ie)
				{
					wS += ",left=" + newLeft ;
					wS += ",top="  + newTop ;

/*					wW=tW.document.body.offsetWidth ;
					wH=tW.document.body.offsetHeight ;
					if(mac)
					{
						wS += ",left=" +  ( window.event.screenX - window.event.x + wW/2 - NewWidth/2  ) 
						wS += ",top="  +  ( window.event.screenX - window.event.x + wH/2 - NewHeight/2 )  
					}	
					else
					{
						wS += ",left=" +  ( tW.screenLeft + wW/2 - NewWidth/2 ) 
						wS += ",top="  +  ( tW.screenTop + wH/2 - NewHeight/2 )  
					}*/
				}
/*			}
			else
			{
				wS += ",left=" + (tW.screenX + (tW.innerWidth - NewWidth)/2 ) 
				wS += ",top=" + (tW.screenY + tW.outerHeight - tW.innerHeight/2 - NewHeight/2 )
			}*/
			window0 = window.open(NewUrl, NewName, wS);
		}
		else
		{
			window0.focus()
		}
		
		return window0;
	}

/************************ dynamic HTML functions ************************/

var _document,htmlWriter,layerName,spanName,dinName ;

function defineWriter()
{
  var w,l,a,b;

  w = window;
  _document = w.document;
  l = defBrows('_document.layers');   // NN up to 4.7
  a = defBrows('_document.all');      // IE up to 5.0
  b = defBrows('_document.getElementById'); // new browsers
  layerName = 'dinFormLayer';
  spanName = 'dinForm';
  dinName = '';

  if(l==true)
  {
    dinName=layerName;
    htmlWriter=new Function('html','{_document.layers[layerName].document.open();'
                                   +'_document.layers[layerName].document.write(html);'
                                   +'_document.layers[layerName].document.close();}');
  }
  if(a==true)
  {
    dinName=spanName;
    htmlWriter=new Function('html','{window.document.all(\''+spanName+'\').innerHTML=html;}');
  }
  if(b==true)
  {
    dinName=spanName;
    htmlWriter=new Function('html','{_document.getElementById(spanName).innerHTML=html;}');
  }

} // defineWriter()

function defBrows(p){return new Boolean(typeof(eval(p))!='undefined');}

