

var myNum = 0;
//var console;

function animateIn(clipName) {
	if (clipName.overTrue == true) {
		window.clearTimeout(clipName.animateTimer);
		window.clearTimeout(clipName.dropCloseTimer);
		clipName.clipNum = String(myNum++);
		$(clipName).find('ul li.' + clipName.clipNum).css('display', 'block');
	}
};

function dropOpen() {
		//dropClose(this)
		this.overTrue = true;
		//console.log(this.overTrue);
		myNum = 0;
		this.liLength = ($(this).find('ul').children().length)+1;
		for (i=0;i<=this.liLength;i++) {
			var that = this;
			this.animateTimer = window.setTimeout(function() {
			  animateIn(that);
			}, (80 * i));
		}
};


function dropClose(myClip) {
	if (myClip.overTrue != true) {
		window.clearTimeout(myClip.animateTimer);
		window.clearTimeout(myClip.dropCloseTimer);
		$(myClip).find('ul li').css('display', 'none');
	}
};

function dropCloseTimerFunc() {
	this.overTrue = false;
	window.clearTimeout(this.animateTimer);
	window.clearTimeout(this.dropCloseTimer);
	var that = this;
	this.dropCloseTimer = window.setTimeout(function() {
			  dropClose(that);
			}, (100));
};

$(document).ready(function() {  

						   
		$('#aboutDropdown').bind('mouseenter', dropOpen);
		$('#aboutDropdown').bind('mouseleave',  dropCloseTimerFunc);
		
		$('#screensDropDown').bind('mouseenter', dropOpen);
		$('#screensDropDown').bind('mouseleave',  dropCloseTimerFunc);
		
		$('#newWorkDropdown').bind('mouseenter', dropOpen);
		$('#newWorkDropdown').bind('mouseleave',  dropCloseTimerFunc);
		
		$('#furnitureDropdown').bind('mouseenter', dropOpen);
		$('#furnitureDropdown').bind('mouseleave',  dropCloseTimerFunc);
		
		$('#sculptureDropdown').bind('mouseenter', dropOpen);
		$('#sculptureDropdown').bind('mouseleave',  dropCloseTimerFunc);
		
		$('#moreDropdown').bind('mouseenter', dropOpen);
		$('#moreDropdown').bind('mouseleave',  dropCloseTimerFunc);
		
	}
);
