ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false
moz = (!ns4 && !ie4)?true:false;

/* |||||||||||||||||||||||||||||||||||||||||||||||||||||
    returns the clipping values for the current layer
   |||||||||||||||||||||||||||||||||||||||||||||||||||||  */
function clipValues(obj,which) {
	if (ns4) {
		if (which=="t") return obj.clip.top
		if (which=="r") return obj.clip.right
		if (which=="b") return obj.clip.bottom
		if (which=="l") return obj.clip.left
	}
	else if (ie4 || moz) {
		var clipv = obj.clip.replace(/\,/g,'').split("rect(")[1].split(")")[0].replace(/pt/g,'px').split("px")
		if (which=="t") return Number(clipv[0])
		if (which=="r") return Number(clipv[1])
		if (which=="b") return Number(clipv[2])
		if (which=="l") return Number(clipv[3])
	}	
}

/* |||||||||||||||||||||||||||||||||||||||||||||||||||||
    changed the clipping values of the current layer
   |||||||||||||||||||||||||||||||||||||||||||||||||||||  */
function clipTo(obj,t,r,b,l) {
	if (ns4) {
		obj.clip.top = t
		obj.clip.right = r
		obj.clip.bottom = b
		obj.clip.left = l
	}
	else if (ie4) obj.clip = "rect("+t+"px "+r+"px "+b+"px "+l+"px)";
	else if (moz) obj.clip = "rect("+t+"pt, "+r+"px, "+b+"pt, "+l+"px)"
}

/* |||||||||||||||||||||||||||||||||||||||||||||||||||||
    GRADUALLY changes the clipping values of the current layer
   |||||||||||||||||||||||||||||||||||||||||||||||||||||  */
function clipBy(obj,t,r,b,l) {
	if (ns4) {
		obj.clip.top = clipValues(obj,'t') + t
		obj.clip.right = clipValues(obj,'r') + r
		obj.clip.bottom = clipValues(obj,'b') + b
		obj.clip.left = clipValues(obj,'l') + l
	}
	else if (ie4) obj.clip = "rect("+(this.clipValues(obj,'t')+t)+"px "+(this.clipValues(obj,'r')+r)+"px "+Number(this.clipValues(obj,'b')+b)+"px "+Number(this.clipValues(obj,'l')+l)+"px)";
	else if (moz) obj.clip = "rect("+(this.clipValues(obj,'t')+t)+"px "+(this.clipValues(obj,'r')+r)+"px "+Number(this.clipValues(obj,'b')+b)+"px "+Number(this.clipValues(obj,'l')+l)+"px)";
}

//declare variables
var opened, speed, botVal;
var scrolling=false;

/* |||||||||||||||||||||||||||||||||||||||||||||||||||||
    open's the layer the user has moused over
   |||||||||||||||||||||||||||||||||||||||||||||||||||||  */
function openIt(which) {

//depending on which layer is moused over, we need to change certain variables
//if the one on the left was moused over
   if(which == "one"){
   //if the block is initialized AND it is not this one that is already opened
   //close the currently opened block
    if(block && opened != which) clipTo(block,0,728,0,394);
	//reset the global block variable to this new layer
    if (ns4){ block = eval('document.' + leftDiv);}
	if (ie4){ block = eval(leftDiv + '.style');}
	if (moz){ block = eval("document.getElementById('" + leftDiv + "').style");}
	//reset the variables to this one's values
	  opened = which;
	  speed = leftSpeed;
	  botVal = leftBotVal;
   }
   
   else if(which == "two"){
   //if the block is initialized AND it is not this one that is already opened
   //close the currently opened block
    if(block && opened != which) clipTo(block,0,310,0,0);
    if (ns4){ block = eval('document.' + rightDiv);}
	if (ie4){ block = eval(rightDiv + '.style');}
	if (moz){ block = eval("document.getElementById('" + rightDiv + "').style");}
	//reset the variables to this one's values
	  opened = which;
	  speed= rightSpeed;
	  botVal = rightBotVal;
   }
   
//if the value of the bottom clip is less than the setting for botVal      
	if (clipValues(block,'b')<botVal) {
	    scrolling=true;
		clipBy(block,0,0,speed,0);
		//run openIt() again in 10 milliseconds passing it a value of 'none' so that the variables are not reset
		setTimeout("openIt('none')",10);
	}
	else
	    scrolling=false;
}

function closeIt() {
	if (clipValues(block,'b')>0) {	
	    scrolling=true;
		clipBy(block,0,0,-speed,0);
		//run closeIt() again in 10 milliseconds
		setTimeout("closeIt()",10);
	}
	else
	    scrolling=false;
}