var current  = 0;
var interval;
var lock = 0;
var lock2 = 0;


function unlock(){
	lock = 0;
}

function slidetoleft(m){
	if(current < m){
			if(lock == 0){
				lock = 1;
				window.setTimeout("unlock()", 1000);
				new Effect.Move('imageBoxInside', {x:-149, y:0, duration:1});
				current++;
				document.getElementById('prev').disabled=false;
			}
			document.getElementById('next').style.backgroundPosition = "bottom left";
	
	}else{
			document.getElementById('next').disable = true;
	}
}

function slidetoright(m){
	if(current > 0){
			if(lock == 0){
				lock = 1;
				window.setTimeout("unlock()", 1000);
				new Effect.Move('imageBoxInside', {x:149, y:0, duration:1});
				current--;
				document.getElementById('next').disabled=false;
			}
			document.getElementById('prev').style.backgroundPosition = "bottom right";
	}else{
		document.getElementById('prev').disabled=true;
	}
}

function mouseoverprev(m){
	interval = setInterval("slidetoright(" + m + ")", 1000);
}

	
function mouseovernext(m){
	interval = setInterval("slidetoleft(" + m + ")", 1000);
}

function release1(m){
	clearInterval(interval);
	document.getElementById('prev').style.backgroundPosition = "bottom left";
}

function release2(m){
	clearInterval(interval);
	document.getElementById('next').style.backgroundPosition = "bottom right";
}
	


function makeSlide(e, obj, m){
	var x = 0;
	var offset = obj.offsetLeft;
	if(!e) e = window.event;
	
	if(typeof(e.pageX) != "undefined"){
			x = e.pageX;
	}else if(typeof(e.clientX) != "undefined"){
			x = e.clientX;
	}
	
	if(x < offset + 308){
		slidetoleft(m);
	}else{
		slidetoright(m);
	}
			
	
	document.getElementById("test").innerHTML = "X:" + x + " L: " + obj.offsetLeft; 
}

function Puff(obj){
		new Effect.Puff(obj, {duration:0.5});
		return true;
}

function pulse(obj){
		if(lock2 == 0){	
			lock2 = 1;
			window.setTimeout("clearpulse()", 500);
			new Effect.Pulsate(obj, {duration:0.5});
		}
		return;
}

function clearpulse(){
		lock2 = 0;
}


function undo_spotlight(imageobject){
	if (navigator.appName.indexOf("Netscape")!=-1&&parseInt(navigator.appVersion)>=5)
		imageobject.style.MozOpacity=1.0;
	else if (navigator.appName.indexOf("Microsoft")!=-1&&parseInt(navigator.appVersion)>=4)
		imageobject.filters.alpha.Opacity=100;

	return true;
}


function spotlight(imageobject){
	if (navigator.appName.indexOf("Netscape")!=-1&&parseInt(navigator.appVersion)>=5)
		imageobject.style.MozOpacity=0.5;
	else if (navigator.appName.indexOf("Microsoft")!=-1&&parseInt(navigator.appVersion)>=4)
		imageobject.filters.alpha.Opacity=50;
	return true;
}


function uncast(imageobject){
	if (navigator.appName.indexOf("Netscape")!=-1&&parseInt(navigator.appVersion)>=5)
		imageobject.style.MozOpacity=1.0;
	else if (navigator.appName.indexOf("Microsoft")!=-1&&parseInt(navigator.appVersion)>=4)
		imageobject.style.filter="alpha(opacity=50)";
	return true;
}


function cast(imageobject){
	if (navigator.appName.indexOf("Netscape")!=-1&&parseInt(navigator.appVersion)>=5)
		imageobject.style.MozOpacity=0.5;
	else if (navigator.appName.indexOf("Microsoft")!=-1&&parseInt(navigator.appVersion)>=4)
		imageobject.style.filter="alpha(Opacity=50)";
	return true;
}

