/*
* JavaScripts for LG : Version 1 Build 001 2009
* Implementaion for NightLife
* :: Author :: jalil@measat.org :: JavaScripts for LG
*/

var win_browser = 'status=yes,toolbar=yes,scrollbars=yes,menubar=yes,location=yes,directories=yes,resizable=yes,copyhistory=yes';
var win_popup	= 'status=no,toolbar=no,scrollbars=1,menubar=no,location=no,directories=no,resizable=yes,copyhistory=no';


function LG_nightlife_popup_1(url)
{
var popup_1=window.open
	(
	url,
	'nightlife_popup',
	'width=370,height=1510'+win_popup
	)
resize_to_fit_Window(popup_1,370,1500); 
popup_1.focus();
void(0);
}

function LG_nightlife_popup_map(url)
{
if (typeof popup_1!='undefined') popup_1.close();
var popup_map=window.open
	(
	url,
	'map_popup',
	'width=495,height=370,status=no,toolbar=no,scrollbars=yes,menubar=no,location=no'
	)
resize_to_fit_Window(popup_map,495,370); 
popup_map.focus();
void(0);
}

function targetopener(mylink, closeme, closeonly)
{
if (! (window.focus && window.opener))return true;
window.opener.focus();
if (! closeonly)window.opener.location.href=mylink.href;
if (closeme)window.close();
return false;
}


function send_to_nightspot(nightspot_link)
{
var href;
if (typeof(nightspot_link) == 'string')
   href=nightspot_link;
else
   href=nightspot_link.href;

try
{
if (window.opener.closed) // make new window headif original opener is closed - IE handling.
	{
	make_new_head(href);
	return;
	}
}
catch(err)
{
if (window.opener==null) // make new window headif original opener is closed - FF handling.
	{
	make_new_head(href);
	return;
	}
}


window.opener.focus();
window.opener.location.href=href;
this.focus;
}

function make_new_head(url)
{
var new_head=window.open
	(
	url,
	'nightlife_newhead',
	'width=1014,height=768'+win_browser
	);
resize_to_fit_Window(new_head,1014,768); 
new_head.focus();
}

function resize_to_fit_Window(xwindow,xwidth,xheight) 
{
if (xwindow===undefined) return false;
xwindow.moveTo(0, 0);

if (top.xwindow==null) return false;

  if (document.all) 
	{
	top.xwindow.resizeTo(xwidth,xheight);
	} else if (document.layers||document.getElementById) 
{

	if (top.window.outerHeight>xheight || top.xwindow.outerWidth > xwidth) 
		{
		top.xwindow.outerHeight = xheight;
		top.xwindow.outerWidth = xwidth;
		}
  }
}

function maximizeWindow() 
{
  window.moveTo(0, 0);
  if (document.all) {
    top.window.resizeTo(screen.availWidth,screen.availHeight);
  } else if (document.layers||document.getElementById) {
    if (top.window.outerHeight < screen.availHeight || top.window.outerWidth < screen.availWidth) {
      top.window.outerHeight = screen.availHeight;
      top.window.outerWidth = screen.availWidth;
    }
  }
}

