/**
 * OZmall Dinner Content PullDown
 *
 * @author      katsuma@team-lab.com
 * @version     2008/04/03 17:35:39
 */

var OZmallPullDown = {
	current: 0,
	openflg: 0,

	// Handling SetUp Process
	init: function(){
		var b = document.getElementsByTagName('body');
		b[0].onclick=function(){
			if(OZmallPullDown.current==0) return;
			OZmallPullDown.openflg-=1;
			if(OZmallPullDown.openflg<0) OZmallPullDown.close(OZmallPullDown.current);
		};
		var s = [
			document.getElementById('oz1-3rdFloatWindow01'),
			document.getElementById('oz1-3rdFloatWindow02'),
			document.getElementById('oz1-3rdFloatWindow03')
		];
		for(var e in s){
			if(s[e]) s[e].onclick=function(){OZmallPullDown.openflg+=1;}
		}
	},

	// Open Pulldown Menu
	open: function(n){
		if(this.current==n) return;
		if(this.current!=0) this.close(this.current);
		var e = document.getElementById('oz1-3rdFloatWindow0'+n);
		if(!e) return;
		e.style.display = 'block';
		this.openflg=1;
		this.current=n;
	},

	// Close Pulldown Menu
	close: function(n){
		if(this.current==0) return;
		var e = document.getElementById('oz1-3rdFloatWindow0'+n);
		if(!e) return;
		e.style.display = 'none';
		this.current = 0;
	}
};

// http://simonwillison.net/2004/May/26/addLoadEvent/
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			if (oldonload) oldonload();
			func();
		}
	}
}
addLoadEvent(OZmallPullDown.init);

