function WM_netscapeCssFix() {
  if (document.WM.WM_netscapeCssFix.initWindowWidth != window.innerWidth || document.WM.WM_netscapeCssFix.initWindowHeight != window.innerHeight) {
    document.location = document.location;
  }
}

function WM_netscapeCssFixCheckIn() {
  if ((navigator.appName == 'Netscape') && (parseInt(navigator.appVersion) == 4)) {
    if (typeof document.WM == 'undefined'){
      document.WM = new Object;
    }
    if (typeof document.WM.WM_scaleFont == 'undefined') {
      document.WM.WM_netscapeCssFix = new Object;
      document.WM.WM_netscapeCssFix.initWindowWidth = window.innerWidth;
      document.WM.WM_netscapeCssFix.initWindowHeight = window.innerHeight;
    }
    window.onresize = WM_netscapeCssFix;
  }
}

WM_netscapeCssFixCheckIn()

function GoBlank(currentfield){
	var selectedField = currentfield
	selectedField.value = ""
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0

  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_swapImageDuce() { //v1.2
  var i,j=0,objStr,obj,swapArray=new Array,oldArray=document.MM_swapImgData;
  for (i=0; i < (MM_swapImageDuce.arguments.length-2); i+=3) {
    objStr = MM_swapImageDuce.arguments[(navigator.appName == 'Netscape')?i:i+1];
    if ((objStr.indexOf('document.layers[')==0 && document.layers==null) ||
        (objStr.indexOf('document.all[')   ==0 && document.all   ==null))
      objStr = 'document'+objStr.substring(objStr.lastIndexOf('.'),objStr.length);
    obj = eval(objStr);
    if (obj != null) {
      swapArray[j++] = obj;
      swapArray[j++] = (oldArray==null || oldArray[j-1]!=obj)?obj.src:oldArray[j];
      obj.src = MM_swapImageDuce.arguments[i+2];
  } }
  document.MM_swapImgData = swapArray; //used for restore
}

function GoPreload(){
	MM_preloadImages('images/menus/nowshowingR.jpg','images/menus/comingsoonR.jpg','images/menus/theatresR.jpg','images/menus/clubR.jpg','images/menus/schoolsR.jpg','images/menus/eventsR.jpg','images/menus/aboutR.jpg');
}



ypSlideOutMenu.Registry = []
ypSlideOutMenu.aniLen = 250
ypSlideOutMenu.hideDelay = 100
ypSlideOutMenu.minCPUResolution = 10

ypSlideOutMenu.styleMod = '';

function ypSlideOutMenu(id, dir, left, top, width, height, parentid, degrade, debug)
{
	this.ie = document.all ? 1 : 0
	this.ns4 = document.layers ? 1 : 0
	this.dom = document.getElementById ? 1 : 0
	if (this.ie || this.ns4 || this.dom) {
		this.degrade = degrade;
		this.debug = debug;
		this.sliding = false;
		this.id = id
		this.parentid = parentid
		this.dir = dir
		this.orientation = dir == "left" || dir == "right" ? "h" : "v"
		this.dirType = dir == "right" || dir == "down" ? "-" : "+"
		this.dim = this.orientation == "h" ? width : height
		this.hideTimer = false
		this.aniTimer = false
		this.open = false
		this.over = false
		this.startTime = 0
		this.gRef = "ypSlideOutMenu_"+id
		eval(this.gRef+"=this")
		ypSlideOutMenu.Registry[id] = this
		
		this.initleft = left
		this.inittop = top
		this.initwidth = width
		this.initheight = height
		this.showcount = 0;


// The following code originally invoked "document.write" but it caused
// a crash in IE (but not NS) when there were
// more than 31 menus total.  What crashed is that the styles that were
// declared in the css disappeared with 31 menus, where 32 menus caused
// the d.write call to fail entirely.  When I changed
// it so that the style changes were accumulated into one string
// (then at the end that string was written into the document,
// so that document.write was only called once) this solved the problem.

		ypSlideOutMenu.styleMod += '#' + this.id + 'Container { visibility:hidden; ';
		ypSlideOutMenu.styleMod += 'left:' + left + 'px; ';
		ypSlideOutMenu.styleMod += 'z-index:50; ';
		ypSlideOutMenu.styleMod += 'top:' + top + 'px; ';
		ypSlideOutMenu.styleMod += 'overflow:hidden; }';
		ypSlideOutMenu.styleMod += '#' + this.id + 'Container, #' + this.id + 'Content { position:absolute; ';
		ypSlideOutMenu.styleMod += 'height:' + height + 'px; ';
		ypSlideOutMenu.styleMod += 'width:' + width + 'px; ';
		ypSlideOutMenu.styleMod += 'z-index:50; ';
		ypSlideOutMenu.styleMod += 'clip:rect(0 ' + width + ' ' + height + ' 0); ';
		ypSlideOutMenu.styleMod += '}  ';
		this.load()
	}
}

ypSlideOutMenu.prototype.load = function() {
	var d = document
	var lyrId1 = this.id + "Container"
	var lyrId2 = this.id + "Content"
	var obj1 = this.dom ? d.getElementById(lyrId1) : this.ie ? d.all[lyrId1] : d.layers[lyrId1]
	if (obj1) var obj2 = this.ns4 ? obj1.layers[lyrId2] : this.ie ? d.all[lyrId2] : d.getElementById(lyrId2)
	if (!obj1 || !obj2) {
		window.setTimeout(this.gRef + ".load()", 1000);
	} else {
		this.container = obj1
		this.menu = obj2
		this.style = this.ns4 ? this.menu : this.menu.style
		// SEE NOTE ABOVE.  The following function call for the 31 menus bug.
		//this.setStyle()
		this.homePos = eval("0" + this.dirType + this.dim)
		this.outPos = 0
		this.accelConst = (this.outPos - this.homePos) / ypSlideOutMenu.aniLen / ypSlideOutMenu.aniLen 
		if (this.ns4) this.menu.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT);
		this.menu.onmouseover = new Function("ypSlideOutMenu.showMenu('" + this.id + "')")
		this.menu.onmouseout = new Function("ypSlideOutMenu.hideMenu('" + this.id + "')")
		this.endSlide()
	}
}

ypSlideOutMenu.showMenu = function(id, e)
{
	// hide all select boxes
	if (document.all) {
    for (formIdx=0; formIdx<document.forms.length; formIdx++) {
      var theForm = document.forms[formIdx];
      for (elementIdx=0; elementIdx<theForm.elements.length; elementIdx++) {
        //window.status += theForm[elementIdx].type;
        if(theForm[elementIdx].type == "select-one") {
          theForm[elementIdx].style.visibility = "hidden";
        }
      }
    }
  }
	var reg = ypSlideOutMenu.Registry
	var obj = ypSlideOutMenu.Registry[id]
	if (obj.container) {
//		if (obj.ie) alert('showing: ' + id);
		obj.over = true
		if (obj.hideTimer) { reg[id].hideTimer = window.clearTimeout(reg[id].hideTimer) }
		obj.showcount++;
		if (!obj.open && !obj.aniTimer) reg[id].startSlide(true)
	}
	if (obj.ns4) obj.menu.routeEvent(Event.MOUSEOVER);
}

ypSlideOutMenu.hideMenu = function(id, e)
{
	if (document.all) {
    for (formIdx=0; formIdx<document.forms.length; formIdx++) {
      var theForm = document.forms[formIdx];
        for(elementIdx=0; elementIdx<theForm.elements.length; elementIdx++) {
          if(theForm[elementIdx].type == "select-one") {
            theForm[elementIdx].style.visibility = "visible";
          }
         }
      }
  }
	var obj = ypSlideOutMenu.Registry[id]
	if (obj.container) {
//		if (obj.ie) alert('hiding: ' + id);
		if (obj.hideTimer) window.clearTimeout(obj.hideTimer)
		obj.showcount--;
		obj.hideTimer = window.setTimeout("ypSlideOutMenu.hide('" + id + "')", ypSlideOutMenu.hideDelay);
	}
	if (obj.ns4) obj.menu.routeEvent(Event.MOUSEOUT);
}

/*
ypSlideOutMenu.prototype.isOverMenu = function(evnt) {
	if (evnt) {
		return ((this.initleft < evnt.pageX && evnt.pageX < (this.initleft + this.initwidth)) && (this.inittop < evnt.pageY && evnt.pageY < (this.inittop + this.initheight)))?true:false;
	} else {
		return true;
	}
}
*/

ypSlideOutMenu.hide = function(id) {
	var obj = ypSlideOutMenu.Registry[id]
	var reg = ypSlideOutMenu.Registry
	obj.over = false
	if (obj.hideTimer) window.clearTimeout(obj.hideTimer)
	obj.hideTimer = 0
	var close = true;
	for (menu in reg) {
		// for each child, if either
		//  1. the child is open or
		//  2. the child is closing (but hasn't closed yet)
		// then we don't close this menu.
		var pid = ypSlideOutMenu.Registry[menu].parentid
		if (pid == id) {
			if (ypSlideOutMenu.Registry[menu].open) close = false;
			if (!ypSlideOutMenu.Registry[menu].open && ypSlideOutMenu.Registry[menu].sliding) close = false;
		}
	}
	if (obj.open && !obj.aniTimer && close && !obj.showcount) obj.startSlide(false);
}


ypSlideOutMenu.prototype.startSlide = function(open) {
	this.open = open
	if (open) this.setVisibility(true)
	this.startTime = (new Date()).getTime() 
	this.sliding = true;
	this.aniTimer = window.setInterval(this.gRef + ".slide()", ypSlideOutMenu.minCPUResolution)
}

ypSlideOutMenu.prototype.slide = function() {
	var elapsed = (new Date()).getTime() - this.startTime
	if (elapsed > ypSlideOutMenu.aniLen) this.endSlide()
	else {
		var d = Math.round(Math.pow(ypSlideOutMenu.aniLen-elapsed, 2) * this.accelConst)
		if (this.open && this.dirType == "-") d = -d
		else if (this.open && this.dirType == "+") d = -d
		else if (!this.open && this.dirType == "-") d = -this.dim + d
		else d = this.dim + d
		this.moveTo(d)
	}
}

ypSlideOutMenu.prototype.endSlide = function() {
	this.aniTimer = window.clearTimeout(this.aniTimer)
	this.moveTo(this.open ? this.outPos : this.homePos)
	if (!this.open) this.setVisibility(false)
	this.sliding = false;
	if (((this.open && !this.over) || (!this.open && this.over)) && (!this.parent || this.parent.open)) {
		this.startSlide(this.over)
	} else {
		var overchild = false;
		var reg = ypSlideOutMenu.Registry
		for (menu in reg) {
			var pid = ypSlideOutMenu.Registry[menu].parentid
			if (pid == this.id) overchild = ypSlideOutMenu.Registry[menu].over ? true : overchild		
		}
//		if (!overchild && this.parentid && !ypSlideOutMenu.Registry[this.parentid].over) ypSlideOutMenu.hideMenu(this.parentid);
		if (!overchild && this.parentid && !ypSlideOutMenu.Registry[this.parentid].over) ypSlideOutMenu.hide(this.parentid);
	}
}

ypSlideOutMenu.prototype.setVisibility = function(bShow) { 
	var s = this.ns4 ? this.container : this.container.style
	s.visibility = bShow ? "visible" : "hidden"
}

ypSlideOutMenu.prototype.moveTo = function(p) { 
	this.style[this.orientation == "h" ? "left" : "top"] = p
}

ypSlideOutMenu.prototype.getPos = function(c) {
	return parseInt(this.style[c])
}

/*var menus = [
	
	new ypSlideOutMenu("menu1", "down", 41, 145, 500, 26*20 + 14),
	new ypSlideOutMenu("menu2", "down", 171, 0, 180, 26*4 + 14),
	new ypSlideOutMenu("menu3", "down", 171, 21, 220, 26*4 + 14),
	new ypSlideOutMenu("menu4", "down", 171, 43, 220, 26*12 + 14),
	new ypSlideOutMenu("menu5", "down", 171, 153, 180, 26*4 + 14),
	new ypSlideOutMenu("menu6", "down", 130, 145, 200, 26*3 + 14),
	new ypSlideOutMenu("menu7", "down", 173, 145, 200, 26*7 + 14),
	new ypSlideOutMenu("menu8", "down", 246, 145, 400, 26*15 + 14),
	new ypSlideOutMenu("menu9", "down", 181, 21, 200, 26*15 + 14),
	new ypSlideOutMenu("menu10", "down", 337, 145, 319, 26*8 + 14),
	new ypSlideOutMenu("menu11", "down", 174, 66, 146, 26*3 + 14),
	new ypSlideOutMenu("menu12", "down", 451, 145, 300, 26*12 + 14),
	new ypSlideOutMenu("menu13", "down", 146, 21, 140, 26*8 + 14),
	new ypSlideOutMenu("menu14", "down", 146, 44, 140, 26*8 + 14),
	new ypSlideOutMenu("menu15", "down", 558, 145, 180, 26*10 + 14),
	new ypSlideOutMenu("menu16", "down", 663, 145, 120, 26*4 + 14),
	new ypSlideOutMenu("menu17", "down", 667, 145, 120, 26*4 + 14, null)
	
]*/
var a = new Array();
	//document.write('<style type="text/css">' + ypSlideOutMenu.styleMod + '</style>');
	/*for (var i = 0; i < menus.length; i++) {
		menus[i].onactivate = new Function("document.getElementById('act" + i + "').className='active';");
		menus[i].ondeactivate = new Function("document.getElementById('act" + i + "').className='';");
}*/

function donothing() {}	

// experimental stuff
function azControlMenu(action) {
	var switcher = document.session.switcher.value
	if (action=="click" && switcher=="0") {
		javascript:ypSlideOutMenu.showMenu('menu7')
		document.session.switcher.value="1"
	}
	if (action=="mout") {
		ypSlideOutMenu.hideMenu('menu7')
	}
}