/*************************************

	   Slider Bar 1.0
 Programmed by Mark of ShameDesigns
              in 2002
              
    http://www.shamedesigns.com/

*************************************/

var actState 	= 0;
var min		= 16;
var max		= 400;
var minCut	= 0;
var cut		= 0;
var move	= min;
var divide	= 1.2;
var abort	= true;
var delay	= 30;
var loopMe	= "";

function lib_bwcheck(){
	this.ver	= navigator.appVersion;
	this.agent	= navigator.userAgent;
	this.dom	= document.getElementById?1:0;
	this.opera5	= (navigator.userAgent.indexOf("Opera")>-1 && document.getElementById)?1:0;
	this.ie5	= (this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6	= (this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4	= (document.all && !this.dom && !this.opera5)?1:0;
	this.ie		= this.ie4||this.ie5||this.ie6;
	this.mac	= this.agent.indexOf("Mac")>-1;
	this.ns6	= (this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4	= (document.layers && !this.dom)?1:0;
	this.bw		= (this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5);
	return this;
}
var bw = lib_bwcheck();

function prodClick() {
	if (  abort != false ) {
		abort = false;
		if ( actState == 0 ) {
			move = 16;
			cut = max;
			objP.css.visibility = "visible";
		}
		else {
			move = 16;
			cut = 1;
		}
		animate();
	}
}

function animate() {
	if ( !abort ) {
		if ( actState == 1 ) {
			cut = cut * divide;
			move = min - cut;			
			if ( cut >= max ) {
				move = minCut;
				cut = max;
				abort = true;
				objP.css.visibility = "hidden";
			}
		}
		if ( actState == 0 ) {
			cut = cut / divide;
			move = min - cut;
			if ( cut <= 1 ) {
				move = 16;
				cut = 0;
				abort = true;
			}
		}		
		
		objP.css.top = move + "px";
		
		if(bw.ns4) {
			objP.css.clip.top = cut; 
			objP.css.clip.right = 226;
			objP.css.clip.bottom = 400; 
			objP.css.clip.left = 0;
		}
		else 
			objP.css.clip = "rect(" + cut + "px 226px 400px 0px)";
			
	   	loopMe = setTimeout( 'animate();', delay );
	}
	else {
		clearTimeout('loopMe');
		if ( actState == 1 ) {
			actState = 0;
		}	
		else {
			actState = 1;
		}
	}
}

function constructObject( obj, nest ) { 
    	nest 		= ( !nest ) ? '' : 'document.' + nest + '.' ;
    	this.el 	= bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0; 
    	this.css 	= bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.layers'+obj):0; 
	this.ref	= bw.dom || bw.ie4? document:bw.ns4?eval(nest+"document.layers." +obj+".document"):0;		    	
	this.x		= (bw.ns4 || bw.ns5)? this.css.left:this.css.offsetLeft;	
	this.y		= (bw.ns4 || bw.ns5)? this.css.top:this.css.offsetTop;			
    	this.obj 	= obj + "Object";
    	eval(this.obj + "=this");
    	return this;
}

function initSlide( inState ) {
 	actState = inState;
 	if ( actState == 0 ) {
		if(bw.ns4) {
			objP.css.clip.top = max; 
			objP.css.clip.right = 226;
			objP.css.clip.bottom = 400; 
			objP.css.clip.left = 0;
		}
		else 
			objP.css.clip = "rect(" + max + "px 226px " + max + "px 0px)";  	
 	}
 	else {
		if(bw.ns4) {
			objP.css.clip.top = 0; 
			objP.css.clip.right = 226;
			objP.css.clip.bottom = max; 
			objP.css.clip.left = 0;
		}
		else 
			objP.css.clip = "rect(0px 226px 400px 0px)"; 	
 	}
}

