<!--

/* libLayer.js: Simple Layer library with basic compatibility checking */

/* detect objects */
     (document.layers) ? layerobject=true : layerobject=false;
     (document.all) ? allobject = true: allobject = false;
     (document.getElementById) ? dom = true : dom = false;
                                                            
/* detect browsers */
     opera = navigator.userAgent.toLowerCase().indexOf('opera') != -1;

/* return the object for the passed layerName value */
     function getElement(layerName,parentLayer){
          if(layerobject){
               parentLayer = (parentLayer)? parentLayer : self;
               layerCollection = parentLayer.document.layers;
               if (layerCollection[layerName])
               return layerCollection[layerName];
     /* look through nested layers */
          for(i=0; i < layerCollection.length;)
               return(getElement(layerName, layerCollection[i++]));
          }
          if (allobject)
               return document.all[layerName];
          if (dom)
               return document.getElementById(layerName);
     }

/* hide the layer with id = layerName */
     function hide(layerName){
          var theLayer = getElement(layerName);
          if (layerobject)
                theLayer.visibility = 'hide';
          else 
               theLayer.style.visibility = 'hidden';
     }

/* show the layer with id = layerName */
     function show(layerName){
          var theLayer = getElement(layerName);
          if (layerobject)
               theLayer.visibility = 'show';
          else
               theLayer.style.visibility = 'visible';
     }

/* inherit the layer with id = layerName */
     function inherit(layerName){
          var theLayer = getElement(layerName);
          if (layerobject)
               theLayer.visibility = 'show';
          else
               theLayer.style.visibility = 'inherit';
     }

/* set the text-color of layer named layerName */
     function setTextColor( layerName , myTextColor ){
          var theLayer = getElement(layerName);
          if (layerobject)
               theLayer.color = myTextColor;
          else if (opera)
               theLayer.style.color = myTextColor;
          else
               theLayer.style.color = myTextColor;
     }

/* set the background-color of layer named layerName */
     function setBgColor( layerName , myBgColor ){
          var theLayer = getElement(layerName);
          if (layerobject)
               theLayer.backgroundColor = myBgColor;
          else if (opera)
               theLayer.style.backgroundColor = myBgColor;
          else
               theLayer.style.backgroundColor = myBgColor;
     }

/* set the background-image of layer named layerName */
     function setBgColor( layerName , myBgColor ){
          var theLayer = getElement(layerName);
          if (layerobject)
               theLayer.background = myBgColor;
          else if (opera)
               theLayer.style.background = myBgColor;
          else
               theLayer.style.background = myBgColor;
     }

/* set the x-coordinate of layer named layerName */
     function setX( layerName , x ){
          var theLayer = getElement(layerName);
          if (layerobject)
               theLayer.left=x;
          else if (opera)
               theLayer.style.pixelLeft=x;
          else
               theLayer.style.left=x+"px";
     }

/* set the y-coordinate of layer named layerName */
     function setY( layerName , y ){
          var theLayer = getElement(layerName);
          if (layerobject)
               theLayer.top=y;
          else if (opera)
               theLayer.style.pixelTop=y;
          else
               theLayer.style.top=y+"px";
     }

/* get the x-coordinate of layer named layerName */
	function getX( layerName ){
    	var theLayer = getElement(layerName);
    	if (layerobject){
    		x = theLayer.left;
    	}else if (opera){
    		x = theLayer.style.pixelLeft;
    	}else{
		    x = theLayer.style.left;
		}
		return parseInt(x);
	}

/* get the y-coordinate of layer named layerName */
	function getY( layerName ){
		var theLayer = getElement(layerName);
        if (layerobject){
        	y = theLayer.top;
        }else if (opera){
        	y = theLayer.style.pixelTop;
        }else{
        	y = theLayer.style.top;
		}
		return parseInt(y);		
	}

/* set the z-index of layer named layerName */
     function setZ(layerName, zIndex){
          var theLayer = getElement(layerName);
          if (layerobject)
               theLayer.zIndex = zIndex;
          else
               theLayer.style.zIndex = zIndex;
          }


/* set the width of layer named layerName */
     function setWidth(layerName, width){
          var theLayer = getElement(layerName);
          if (layerobject)
               theLayer.clip.width = width;
          else if (opera)
               theLayer.style.pixelWidth = width;
          else
               theLayer.style.width = width+"px";
     }

/* get layer width of the layer named layerName */
	function getWidth(layerName){
		var theLayer = getElement(layerName);
        if (layerobject){
			w = theLayer.clip.width;
        }else if (opera){
			w = theLayer.style.pixelWidth;
        }else{
			w = theLayer.style.width;
		}
		return parseInt(w);			
	}

/* set the height of layer named layerName */
     function setHeight(layerName, height){
          var theLayer = getElement(layerName);
          if (layerobject)
               theLayer.clip.height = height;
          else if (opera)
               theLayer.style.pixelHeight = height;
          else
               theLayer.style.height = height+"px";
          }

/* get layer height of the layer named layerName */
	function getHeight(layerName){
		var theLayer = getElement(layerName);	
        if (layerobject){
			h = theLayer.clip.height;
        }else if (opera){
			h = theLayer.style.pixelHeight;
        }else{
			h = theLayer.style.height;
		}
		return parseInt(h);			
	}

/* set the picture source of layer named layerName */
     function setPicture(layerName, thePictureSrc){
          var theLayer = getElement(layerName);
          if (layerobject)
               theLayer.src = thePictureSrc;
          else if (opera)
               theLayer.src = thePictureSrc;
          else
               theLayer.src = thePictureSrc;
     }

/* set the clipping rectangle on the layer named layerName defined by top, right, bottom, and left */
     function setClip(layerName, top, right, bottom, left){
          var theLayer = getElement(layerName);
          if (layerobject){
               theLayer.clip.top = top;
               theLayer.clip.right = right;
               theLayer.clip.bottom = bottom;
               theLayer.clip.left = left;
          } else
               theLayer.style.clip = "rect("+top+"px "+right+"px "+" "+bottom+"px "+left+"px )";
     }

/* set the contents of layerName to passed content*/
	function setContents(layerName, content){
		var theLayer = getElement(layerName);
		if (layerobject){
			theLayer.document.write(content);
			theLayer.document.close();
		}else if (theLayer.innerHTML){
			theLayer.innerHTML = content;
		}else if(opera){
			theLayer.style.background = content;			
		}	
     }

/* set the cursor style of the layer named layerName */
	function setCursor(layerName, myCursor){
    	var theLayer = getElement(layerName);
    	if (layerobject)
    		theLayer.cursor = myCursor;
		else if (opera)
			theLayer.style.cursor = myCursor;
		else
        	theLayer.style.cursor = myCursor;
	}

/* set all border colors style of the layer named layerName */
	function setAllBorderColors(layerName, myBorderColor){
		var theLayer = getElement(layerName);
        if (layerobject){
			theLayer.borderTopColor = myBorderColor;
			theLayer.borderRightColor = myBorderColor;
			theLayer.borderBottomColor = myBorderColor;
			theLayer.borderLeftColor = myBorderColor;				
        }else if (opera){
			theLayer.style.borderTopColor = myBorderColor;
			theLayer.style.borderRightColor = myBorderColor;
			theLayer.style.borderBottomColor = myBorderColor;
			theLayer.style.borderLeftColor = myBorderColor;				
        }else{
			theLayer.style.borderTopColor = myBorderColor;
			theLayer.style.borderRightColor = myBorderColor;
			theLayer.style.borderBottomColor = myBorderColor;
			theLayer.style.borderLeftColor = myBorderColor;				
		}	
	}
	
/* set class of the layer named layerName */
	function setClass(layerName, myClass){
		document.getElementById(layerName).className = myClass;
	}
	
/* set display of the element named layerName */
	function setDisplay(elementName, displayType){
		document.getElementById(elementName).style.display = displayType;
	}	
	
/* get window dimension */
	var winWidth = 0, winHeight = 0;
	function getWinSize(){
		if( typeof( window.innerWidth ) == 'number' ) {
			winWidth = window.innerWidth;
			winHeight = window.innerHeight;
		} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight))
		{
			//IE 6+ in 'standards compliant mode'
    		winWidth = document.documentElement.clientWidth;
			winHeight = document.documentElement.clientHeight;
		} else if( document.body && ( document.body.clientWidth || document.body.clientHeight))
		{
			//IE 4 compatible
			winWidth = document.body.clientWidth;
			winHeight = document.body.clientHeight;
		}
	}
	
/* get window upper left corner cordinates */
	var winLeft = 0, winTop = 0;
	function getWinCorner(){
		if(  typeof( screeX ) == 'number' ){
			winLeft = screenX;
			winTop  = screenY;
		} else {
			winLeft = parseInt(screenLeft);
			winTop  = parseInt(screenTop);
		}
	}

/* get mouse position on event 'e' */
	var xMousePos, yMousePos;
	function getMousePosition(e) {
	    if (document.layers) {
	        xMousePos = e.pageX;
	        yMousePos = e.pageY;
	    } else if (document.all) {
	        xMousePos = window.event.x+document.body.scrollLeft;
	        yMousePos = window.event.y+document.body.scrollTop;
	    } else if (document.getElementById) {
	        xMousePos = e.pageX;
	        yMousePos = e.pageY;
	    }
	}
	
//-->