/*popup layers*/
function mm_showhidedisplay() { //v6.0
	var i,p,v,obj,args=mm_showhidedisplay.arguments;
	for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
	if (obj.style) { obj=obj.style; v=(v=='show')?'block':(v=='hide')?'none':v; }
	obj.display=v; }	
}

function positionLayer(strDiv,intTop,intLeft) {
	var objPopup = document.getElementById(strDiv)
	objPopup.style.left = intLeft + "px";
	objPopup.style.top = intTop + "px";
	objPopup.style.cursor = "default"; 
}

// Determine browser and version.
function Browser() {

  var ua, s, i;

  this.isIE = false;
  this.isNS = false;
  this.isMac = false;
  this.isOpera = false;
  this.isSafari = false;
  this.version = null;
	this.flash = true;
	this.drag = true;

ua = navigator.userAgent;
  s = "Mac";
  if ((ua.indexOf(s)) >= 0) {
    this.isMac = true;
		this.drag = false;
    return;
  }
  s = "Safari";
  if ((ua.indexOf(s)) >= 0) {
    this.isSafari = true;
		this.flash = false;
    return;
  }
  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) {
		this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
		if (this.version<5.5) this.drag = false;
		//if (this.version>6.5) this.isIE = false; this.isNS = true;
    return;
  }

  s = "Netscape";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
		if (this.version<7) this.flash = false;
    return;
  }
  s = "Opera"
   if ((i = ua.indexOf(s)) >= 0) {
	   this.isOpera = true
   }

  // Treat Opera as IE5

  /*s = "Opera";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = 5;
		this.flash = false;
		return;
  }*/

 s = "Firefox";
  if ((i = ua.indexOf(s)) >= 0) {
   this.isNS = true;
		this.version = 7.0;
   return;
  }
 s = "Firebird";
  if ((i = ua.indexOf(s)) >= 0) {
   this.isNS = true;
		this.version = 7.0;
   return;
  }
  // Treat any other "Gecko" browser as NS 6.1.
 s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
   this.isNS = true;
  this.version = 6.1;
   return;
  }
}

var browser = new Browser();

// Global object to hold drag information.

var dragObj = new Object();
dragObj.zIndex = 2000;

function dragStart(event, id) {
				
 	if (!browser.drag) {
		return false;
	}

  var el;
  var x, y;
	
  // If an element id was given, find it. Otherwise use the element being
  // clicked on.
  if (id)
    dragObj.elNode = document.getElementById(id);
	
  else {
    if (browser.isIE)
      dragObj.elNode = window.event.srcElement;
    if (browser.isNS)
      dragObj.elNode = event.target;

    // If this is a text node, use its parent element.

    if (dragObj.elNode.nodeType == 3)
      dragObj.elNode = dragObj.elNode.parentNode;
  }

  // Get cursor position with respect to the page.

  if (browser.isIE) {
    x = window.event.clientX + document.documentElement.scrollLeft
      + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop
      + document.body.scrollTop;
  }
  if (browser.isNS) {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
  }

  // Save starting positions of cursor and element.
  dragObj.cursorStartX = x;
  dragObj.cursorStartY = y;

	//use offsetLeft to get left position for ns - style.left doesn't work.  this is ok for ie too
  dragObj.elStartLeft  = parseInt(dragObj.elNode.offsetLeft, 10);
  dragObj.elStartTop   = parseInt(dragObj.elNode.style.top,  10);

  if (isNaN(dragObj.elStartLeft)) dragObj.elStartLeft = 0;
  if (isNaN(dragObj.elStartTop))  dragObj.elStartTop  = 0;

  // Update element's z-index.

 dragObj.elNode.style.zIndex = ++dragObj.zIndex;

  // Capture mousemove and mouseup events on the page.

  if (browser.isIE) {
    document.attachEvent("onmousemove", dragGo);
    document.attachEvent("onmouseup",   dragStop);
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  }
  if (browser.isNS) {
    document.addEventListener("mousemove", dragGo,   true);
    document.addEventListener("mouseup",   dragStop, true);
    event.preventDefault();
  }
}

function dragGo(event) {


  var x, y;

  // Get cursor position with respect to the page.

  if (browser.isIE) {
    x = window.event.clientX + document.documentElement.scrollLeft
      + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop
      + document.body.scrollTop;
  }
  if (browser.isNS) {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
  }

  // Move drag element by the same amount the cursor has moved.

  dragObj.elNode.style.left = (dragObj.elStartLeft + x - dragObj.cursorStartX) + "px";
  dragObj.elNode.style.top  = (dragObj.elStartTop  + y - dragObj.cursorStartY) + "px";
	DivSetVisible()

  if (browser.isIE) {
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  }
  if (browser.isNS)
    event.preventDefault();
}

function dragStop(event) {
	DivSetVisible()
  // Stop capturing mousemove and mouseup events.
  if (browser.isIE) {
    document.detachEvent("onmousemove", dragGo);
    document.detachEvent("onmouseup",   dragStop);
  }
  if (browser.isNS) {
    document.removeEventListener("mousemove", dragGo,   true);
    document.removeEventListener("mouseup",   dragStop, true);
  }
}

//this function enables the iframe shim which hides the select box for ie5.5 & ie6.	
function DivSetVisible() {
	if (browser.isIE&&browser.version>=5.5) {
		var objPopup = document.getElementById('messagePopup');
	}
 }



function ShowHideDiv(DivTag,ImgTag) {
        var fldDiv;
		var fldImg;
        fldDiv = eval(DivTag);
		fldImg = eval(ImgTag) ;
		
alert('hey');
        if (fldDiv.style.display == "none") {
                fldDiv.style.display = "block";
				fldImg.src="icon-minus-blue.gif";
				alert('baby');
        }
	else {
                fldDiv.style.display = "none";
				fldImg.src="icon-plus-blue.gif";
	}
        return false;
}

