function pu(newLink,newName,newWidth,newHeight){ //popup script - called pu to keep the character count small in the DB
	var popString='width='+newWidth+',height='+newHeight+',resizable=yes';
	var newPopUp = window.open(newLink,newName,popString);
	newPopUp.focus();
	return false;
}

// default active layer name
var parentTabID='contentClip';
var activeTab='descrip';

// default left and top values for nested layers
topDef = 0;
leftDef = 0;

dragLDef =742;
dragTDef = 189;

// initial values and methods for scrolling		
		browserNaming();

		var upH = 12; // Height of up-arrow
		var upW = 12; // Width of up-arrow
		var downH = 12; // Height of down-arrow
		var downW = 12; // Width of down-arrow
		var dragH = 1; // Height of dragger
		var dragW = 12; // Width of dragger
		var scrollH = 15; // Height of scrollbar
		var speed = 6; // Scroll speed
		var dom = document.getElementById ? true:false;
		//alert(dom);
		var nn4 = document.layers ? true:false;
		//alert(nn4);
		var ie4 = document.all ? true:false;
		//alert(ie4);
		var mouseY; // Mouse Y position onclick
		var mouseX; // Mouse X position onclick
		var clickUp = false; // If click on up-arrow
		var clickDown = false; // If click on down-arrow
		var clickDrag = false; // If click on scrollbar
		var clickAbove = false; // If click above scrollbar
		var clickBelow = false; // If click below scrollbar
		var timer = setTimeout("",500); // Repeat variable

		var upL; // Up-arrow X
		var upT; // Up-arrow Y
		var downL; // Down-arrow X
		var downT; // Down-arrow Y
		var dragL; // Scrollbar X
		var dragT; // Scrollbar Y
		var rulerL; // Ruler X
		var rulerT; // Ruler Y
		var contentT; // Content layer Y;
		var contentH; // Content height
		var contentClipH; // Content clip height
		var scrollLength; // Number of pixels scrollbar should move
		var startY; // Keeps track of offset between mouse and span
		
		// SOME NS4 STUFF HERE

		if (nn4) {
			document.write('<style type="text/css"><!--');
			document.write('#' + parentTabID + ' { z-index: 5; }');
			document.write('--></style>');
		}
		else {
			document.write('<style type="text/css"><!--');
			document.write('#' + parentTabID + '{ z-index: 5; overflow: hidden; }');
			document.write('--></style>');
		}

/***************************************************
function to intialize Tab Drag Scroller
*****************************************************/
function initTabDragScroller(){
	//preload();	
	//on(activeTab);
	show(activeTab);
	resetLoc(activeTab,topDef,leftDef);
	//alert(activeTab);
	eventLoader();
}

/***************************************************
CHECK CLIENT BROWSER & PLATFORM
original code from http://developer.apple.com/internet/_javascript/

USAGE:		browserNaming();

NOTES:		call it from within an external JS document

RESULT:		browserNew = true/false
			browserName = IE/NS/Opera
			browserNameLong = IE5/etc
			Macintosh = true/false

WORKS:		everything
*****************************************************/
var its;
	var browserName;
	var browserNameLong;
	var browserNew;
	var preloadFlag = false;
	var Macintosh = navigator.userAgent.indexOf('Mac')>0;

	function its() {

		var n = navigator;
		var ua = ' ' + n.userAgent.toLowerCase();
		var pl = n.platform.toLowerCase();
		var an = n.appName.toLowerCase();

		// browser version
		this.version = n.appVersion;
		this.nn = ua.indexOf('mozilla') > 0;

		// 'compatible' versions of mozilla aren't navigator
		if(ua.indexOf('compatible') > 0) {
			this.nn = false;
		}
		
		this.opera = ua.indexOf('opera') > 0;
		this.ie = ua.indexOf('msie') > 0;
		this.major = parseInt( this.version );
		this.minor = parseFloat( this.version );

		// platform
		this.mac = ua.indexOf('mac') > 0;
		this.win = ua.indexOf('win') > 0;

		// workaround for IE5 which reports itself as version 4.0
		if(this.ie) {
			if(ua.indexOf("msie 5") > 1) {
			var msieIndex = navigator.appVersion.indexOf("MSIE") + 5;
			this.major = parseFloat(navigator.appVersion.substr(msieIndex,3));
			}
		}

		return this;
	}

	function browserNaming() {

		its = new its();
		
		// is it a DOM-enabled browser?
		if (!document.getElementById) {
			browserNew = false;
		}
		else {
			browserNew = true;
		}

		// need the name, too
		if (its.opera) {
			browserName = "Opera";
		}
		else if (its.ie) {
			browserName = "IE";
		}
		else {
			browserName = "NS";
		}
		// and the number
		browserNameLong = browserName + its.major;
	}

/***************************************************	
DOM get property
original code from http://www.alistapart.com/

NOTES:		given an id and a property (as strings),
			return the given property of that id.

WORKS:		ie5+, ns6+, opera5+
*****************************************************/

	function getIdProperty(id,property) {
		var styleObject = document.getElementById( id );
		if (styleObject != null) {
			styleObject = styleObject.style;
				if (styleObject[property]) {
					return styleObject[ property ];
				}
			}
		return (styleObject != null) ?
		styleObject[property] :
		null;
	}

/***************************************************
DOM set property
original code from http://www.alistapart.com/

Notes:	given an id and a property (as strings), 
		set the given property of that id to the 
		value provided.

Works:	ie5+, ns6+, opera5+
*****************************************************/

	function setIdProperty(id,property,value) {
		var styleObject = document.getElementById( id );
		if (styleObject != null) {
			styleObject = styleObject.style;
			styleObject[ property ] = value;
		}
	}



/***************************************************
Hide and show layers on the same page

Usage:	show('layername'); hide('layername');
Works:	ie4+, ns4+, opera
*****************************************************/
	function hide(browserNew) {

		if (browserNew) {
			setIdProperty(id,"visibility","hidden");
		}
		else {
			if (browserName == "NS") { document.layers[parentTabID].layers[id].visibility = "hide"; }
			else { document.all[id].style.visibility = "hidden"; }
		}
	}

 
	function show(id) {
		if (browserNew) {
			setIdProperty(id,"visibility","visible");
		} else {
			if (browserName == "NS") {
				document.layers[parentTabID].layers[id].visibility = "show";
			} else { 
				document.all[id].style.visibility = "visible";
			}
		}
	}

/*****************************************************************************
Changes the active layer. Hides the one that's visible and
shows the "new" one. Also set's the new layers top to
0 so it starts at top.
*****************************************************************************/
function changeActive(str){
  // alert("change active" + str);
  // hide active Tab layer
  hide(activeTab);

  // turn off active tab image
  off(activeTab);
 
  // change to new active tab layer
  activeTab=str;

  // show newly selected active Tab layer
  show(str);
  resetLoc(str,topDef,leftDef);
  resetBaseLoc('drag',dragTDef,dragLDef);
  resetBaseLoc('ruler',dragTDef,dragLDef);
  
  dragT = dragTDef
  dragL = dragLDef;

  rulerT = dragTDef;
  rulerL = dragLDef;
  
	eventLoader()
   // show newly selected active Tab image
  on(str);
}


/*****************************************************************************
Reset the location of the selected tab layer to it's default location
*****************************************************************************/
function resetLoc(id,top,left){

	if (browserNew) {
			setIdProperty(id,"top",top);
			setIdProperty(id,"left",left);
		}
		else {
			if (browserName == "NS") {
				document.layers[parentTabID].layers[id].left = left;
				document.layers[parentTabID].layers[id].top = top; 
			} else {
				document.all[id].style.left = left;
				document.all[id].style.top = top;
			 }
		}
	}
/*****************************************************************************
Reset the location of the a base non-nested layer
*****************************************************************************/
function resetBaseLoc(id,top,left){

	if (browserNew) {
			setIdProperty(id,"top",top);
			setIdProperty(id,"left",left);
		}
		else {
			if (browserName == "NS") {
				document.layers[id].left = left;
				document.layers[id].top = top; 
			} else {
				document.all[id].style.left = left;
				document.all[id].style.top = top;
			 }
		}
}
/***************************************************************************
New Scrolling functionality
***************************************************************************/
		function down(e){
			if((document.layers && e.which!=1) || (document.all && event.button!=1)) return true;
				
				getMouse(e);
				startY = (mouseY - dragT);
				if(mouseX >= upL && (mouseX <= (upL + upW)) && mouseY >= upT && (mouseY <= (upT + upH))){
					clickUp = true;
					return scrollUp();
				}	
				else if(mouseX >= downL && (mouseX <= (downL + downW)) && mouseY >= downT && (mouseY <= (downT + downH))){
					clickDown = true;
					return scrollDown();
				}
				else if(mouseX >= dragL && (mouseX <= (dragL + dragW)) && mouseY >= dragT && (mouseY <= (dragT + dragH))){
					clickDrag = true;
					return false;
				}
				else if(mouseX >= dragL && (mouseX <= (dragL + dragW)) && mouseY >= rulerT && (mouseY <= (rulerT + scrollH))){
					if(mouseY < dragT){
						clickAbove = true;
						clickUp = true;
						return scrollUp();
					}
					else{
						clickBelow = true;
						clickDown = true;
						return scrollDown();
					}
				}
			else{
				return true;
			}
		}
		function move(e){
			if(clickDrag && contentH > contentClipH){
				getMouse(e);
				dragT = (mouseY - startY);
				if(dragT < (rulerT))
					dragT = rulerT;		
				if(dragT > (rulerT + scrollH - dragH))
					dragT = (rulerT + scrollH - dragH);
				contentT = ((dragT - rulerT)*(1/scrollLength));
				contentT = eval('-' + contentT);
				moveTo();
				if(ie4)
					return false;
			}
		}

		function up(){
			clearTimeout(timer);
			// Resetting variables
			clickUp = false;
			clickDown = false;
			clickDrag = false;
			clickAbove = false;
			clickBelow = false;
			return true;
		}

		// Reads content layer top
		function getT(){
			if(ie4)
				contentT = document.all[activeTab].style.pixelTop;
			else if(nn4)
				contentT = document[parentTabID].document[activeTab].top;
			else if(dom)
				contentT = parseInt(document.getElementById(activeTab).style.top);
		}

		// Reads mouse X and Y coordinates
		function getMouse(e){
			if(ie4){
				mouseY = event.clientY + document.body.scrollTop;
				mouseX = event.clientX + document.body.scrollLeft;
			}
			else if(nn4 || dom){
				mouseY = e.pageY;
				mouseX = e.pageX;
			}
		}

		// Moves the layer
		function moveTo(){
			if(ie4){
				document.all[activeTab].style.top = contentT;
				document.all.ruler.style.top = dragT;
				document.all.drag.style.top = dragT;
			}
			else if(nn4){
				document[parentTabID].document[activeTab].top = contentT;
				document.ruler.top = dragT;
				document.drag.top = dragT;
			}
			else if(dom){
				document.getElementById(activeTab).style.top = contentT + "px";
				document.getElementById("drag").style.top = dragT + "px";
				document.getElementById("ruler").style.top = dragT + "px";
			}
		}

		// Scrolls up
		function scrollUp(){

			getT();
			if(clickAbove){
				if(dragT <= (mouseY-(dragH/2)))
					return up();
			}
			if(clickUp){
				if(contentT < 0){		
					dragT = dragT - (speed*scrollLength);
					if(dragT < (rulerT))
						dragT = rulerT;
					contentT = contentT + speed;
					if(contentT > 0)
						contentT = 0;
					moveTo();
					
					if (!nn4) timer = setTimeout("scrollUp()",25);
				}
			}
			return false;
		}

		// Scrolls down
		function scrollDown(){
			getT();
			if(clickBelow){
				if(dragT >= (mouseY-(dragH/2)))
					return up();
			}
			if(clickDown){
				if(contentT > -(contentH - contentClipH)){			
					dragT = dragT + (speed*scrollLength);
					if(dragT > (rulerT + scrollH - dragH))
						dragT = (rulerT + scrollH - dragH);
					contentT = contentT - speed;
					if(contentT < -(contentH - contentClipH))
						contentT = -(contentH - contentClipH);
					moveTo();
					if (!nn4) timer = setTimeout("scrollDown()",25);
				}
			}
			return false;
		}
		// reloads page to position the layers again
		function reloadPage(){
			location.reload();
		}
		// preloads the scroller stuff
		function eventLoader(){
			//alert(browserName);
			valSet();
			// Number of pixels scrollbar should move
			scrollLength = ((scrollH-dragH)/(contentH-contentClipH));
			// Initializes event capturing
			if(nn4){
				//alert("MOUSE EVENTS");
				document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP);
				window.onresize = reloadPage;
			}
			document.onmousedown = down;
			document.onmousemove = move;
			document.onmouseup = up;
		}


		function valSet(){
			if(dom){
				//alert("DOM");
				// Up-arrow X and Y variables
				upL = parseInt(document.getElementById("up").style.left);
				//alert("UP-LEFT:" + document.getElementById("up").style.left);

				upT = parseInt(document.getElementById("up").style.top);
				//alert("UP-TOP:" + document.getElementById("up").style.top);

				// Down-arrow X and Y variables
				downL = parseInt(document.getElementById("down").style.left);
				//alert("D-LEFT:" + document.getElementById("down").style.left);
				downT = parseInt(document.getElementById("down").style.top);
				//alert("D-TOP:" + document.getElementById("down").style.top);

				// Scrollbar X and Y variables
				dragL = parseInt(document.getElementById("drag").style.left);
				//alert("DRAG-LEFT:" + document.getElementById("drag").style.left);
				dragT = parseInt(document.getElementById("drag").style.top);
				//alert("DRAG-TOP:" + document.getElementById("drag").style.top);

				// Ruler Y variable
				rulerT = parseInt(document.getElementById("ruler").style.top);
				//alert("RULER-TOP" + document.getElementById("ruler").style.top);

				// Height of content layer and clip layer
				contentH = parseInt(document.getElementById(activeTab).offsetHeight);
				//alert("COMTENT-HEIGHT" + document.getElementById(activeTab).offsetHeight);
				contentClipH = parseInt(document.getElementById(parentTabID).offsetHeight);
				//alert("COMTENT-CLIP-HEIGHT" + document.getElementById(parentTabID).offsetHeight);
				document.getElementById(activeTab).style.top = 0 + "px";
			}
			else if(nn4){
				//alert("NN4+");
				// Up-arrow X and Y variables
				upL = document.up.left;
				//alert("UP-LEFT:" + upL);
				upT = document.up.top;
				//alert("UP-TOP:" + upT);
				// Down-arrow X and Y variables
				downL = document.down.left;
				//alert("DOWNL:" + downL);
				downT = document.down.top;
				//alert("DOWNT:" + downT);	
				// Scrollbar X and Y variables
				dragL = document.drag.left;
				//alert("DRAGL:" + dragL);
				dragT = document.drag.top;
				//alert("DRAGT:" + dragT);	
				// Ruler Y variable
				rulerT = document.ruler.top;
				//alert("RULERT:" + rulerT);
				// Height of content layer and clip layer
				contentH = document[parentTabID].document[activeTab].clip.bottom;
				//alert("CONTENT H: " + contentH);
				contentClipH = document[parentTabID].clip.bottom;
				//alert("CONTENT CLIP H:" + contentClipH);
			}
			else if(ie4){
				//alert("IE4+");
				// Up-arrow X and Y variables
				upL = document.all.up.style.pixelLeft;
				//alert("UP-LEFT:" + upL);
				upT = document.all.up.style.pixelTop;
				//alert("UP-TOP:" + upT);	
				// Down-arrow X and Y variables
				downL = document.all.down.style.pixelLeft;
				//alert("DOWN-ARROW-LEFT:" + downL);	
				downT = document.all.down.style.pixelTop;
				//alert("DOWN-ARROW-TOP:" + downT);
				// Scrollbar X and Y variables
				dragL = document.all.drag.style.pixelLeft;
				//alert("DRAG-LEFT:" + dragL);
				dragT = document.all.drag.style.pixelTop;
				//alert("DRAG-TOP:" + dragT);		
				// Ruler Y variable
				rulerT = document.all.ruler.style.pixelTop;
				//alert("RULER-TOP:" + rulerT);
				// Height of content layer and clip layer
				contentH = parseInt(document.all[activeTab].scrollHeight);
				//alert("CONTENTH:" + contentH);
				contentClipH = parseInt(document.all[parentTabID].style.height);
				//alert("CONTENT-CLIPH:" + contentClipH);
			}
		}