

SlideOut.prototype.slideArray = [];
SlideOut.prototype.opacityDefult = 100;
function SlideOut(slide, showSlide, effectTime)
{
	this.slide = slide;
	this.showSlide = showSlide;
	this.effectTime = effectTime;
	this.actSlide = false;
	this.actAutohide = false;
	this.actEffect = false;
	this.timerId = 0;
	this.slideArray[slide] = this;
	
	getElementById(slide).onmouseover = new Function("SlideOut.prototype.slideOver('" + slide + "')");
	getElementById(showSlide).onmouseover = new Function("SlideOut.prototype.showSlideover('" + slide + "')");
	getElementById(slide).onmouseout = new Function("SlideOut.prototype.hideSlide('" + slide + "', 'out')");
	getElementById(showSlide).onmouseout = new Function("SlideOut.prototype.autoHide('" + slide + "', '')");
}

SlideOut.prototype.autoHide = function(id)
{
	if(this.slideArray[id].over == true) {
		this.slideArray[id].over =false;
	if(this.slideArray[id].actAutohide==false) {
		this.slideArray[id].actSlide = false;
		this.slideArray[id].actAutohide = true;
		this.slideArray[id].timerId = setTimeout("SlideOut.prototype.hideSlide('" + id + "', '')",100);
		}
	}
}

SlideOut.prototype.hideSlide = function(id, action)
{
	
	if(this.slideArray[id].actSlide==false && this.slideArray[id].actAutohide==true) {
		this.slideArray[id].actAutohide = false;
		if(!this.slideArray[id].actEffect) {
			this.slideArray[id].actEffect = true;
			this.slideArray[id].timerId = setTimeout("SlideOut.prototype.hideEffect('" + id + "')", this.slideArray[id].effectTime);
		}
	} else if(action=='out') {
		if(!this.slideArray[id].actEffect) {
			this.slideArray[id].actEffect = true;
			this.slideArray[id].timerId = setTimeout("SlideOut.prototype.hideEffect('" + id + "')", this.slideArray[id].effectTime);
		}
	}

}

SlideOut.prototype.hideEffect = function(id)
{
	SlideOut.prototype.setOpacity(id, SlideOut.prototype.getOpacity(id)-10);
	if(SlideOut.prototype.getOpacity(id)>0 && this.slideArray[id].actEffect==true) 
		this.slideArray[id].timerId = setTimeout("SlideOut.prototype.hideEffect('" + id + "')", this.slideArray[id].effectTime);
	else if(this.slideArray[id].actEffect==true) {
		clearTimeout(SlideOut.prototype.slideArray[id].timerId);	
		getElementById(id).style.visibility = 'hidden';
		getElementById(id).style.display = 'none';
		this.slideArray[id].actSlide = false;
		this.slideArray[id].actAutohide = false;
		this.slideArray[id].actEffect = false;
	} else {
		SlideOut.prototype.setOpacity(id, SlideOut.prototype.opacityDefult);
	}
}

SlideOut.prototype.slideOver = function(id)
{
	this.slideArray[id].actSlide = true;
	this.slideArray[id].actAutohide = false;
	this.slideArray[id].actEffect = false;
	SlideOut.prototype.setOpacity(id, SlideOut.prototype.opacityDefult);
}

SlideOut.prototype.showSlideover = function(id)
{
	getElementById(id).style.visibility = 'visible';
	getElementById(id).style.display = '';
	SlideOut.prototype.setOpacity(id, SlideOut.prototype.opacityDefult);
	this.slideArray[id].over = true;
	this.slideArray[id].actEffect = false;
	
}

SlideOut.prototype.getOpacity = function(id)
{
	var Element = getElementById(id);
	if(isIE())
		return Element.filters.alpha.opacity;
	else
		return Element.style.opacity*100;
}

SlideOut.prototype.setOpacity = function(id, opacity)
{
	var Element = getElementById(id);
	
	if(isIE()) {
		Element.style.filter = "alpha(opacity=" + opacity + ")";
	} else
		Element.style.opacity = opacity/100;
}

function clearSlide()
{
	for(var id in SlideOut.prototype.slideArray) {
		clearTimeout(SlideOut.prototype.slideArray[id].timerId);
		getElementById(SlideOut.prototype.slideArray[id].showSlide).onmouseover = false;
		getElementById(SlideOut.prototype.slideArray[id].showSlide).onmouseout = false;
		getElementById(id).onmouseover = false;
		getElementById(id).onmouseout = false;
	}
	
}

function createSlide(slide, showSlide, effectTime, actSlide, actAutohide, actEffect) {
    this.slide = slide;
    this.showSlide = showSlide;
    this.effectTime = effectTime;

	this.actSlide = actSlide;
    this.actAutohide = actAutohide;
    this.actEffect = actEffect;
}

function isIE()
{
	 if(navigator.appName == "Microsoft Internet Explorer") 
	 	return true 
	else 
		return false;
}

function getElementById(id)
{
	return document.getElementById(id);
}

