
/* PopUp Menu v1.0 */


/* Do not edit below this line unless you are sure what are you doing! */

var ppmIE=(navigator.appName == "Microsoft Internet Explorer");
var ppmNN=((navigator.appName == "Netscape")&&(document.layers));
var ppmTI=false;
var ppmSV=null;
var ppmRL=null;
var ppmXC=null;
var ppmYC=null;
var ppmNow=new Date();
var ppmER = new Array(4);
ppmER[0] = "Required DHTML functions are not supported in this browser.";
ppmER[1] = "Target form field is not assigned or not accessible.";
ppmER[2] = "Sorry, the chosen date is not acceptable. Please read instructions on the page.";
ppmER[3] = "Unknown error occured while executing this script.";

//var mymouse=Ms_initmouse(); 

if (ppmNN)
{
 window.captureEvents(Event.RESIZE);
 window.onresize = MrestoreLayers;
 document.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);
 if (document.addEventListener){
  document.addEventListener('mousedown', MrecordXY, true); 
  document.addEventListener('mouseup', MconfirmXY, true); 
 } else if (document.attachEvent){
  document.attachEvent('mousedown', MrecordXY );
  document.attachEvent('mouseup', MconfirmXY );
 }	
} 
else if (!ppmIE)
{
 if (document.addEventListener){
  document.addEventListener('mousedown', MrecordXY, true); 
  document.addEventListener('mouseup', MconfirmXY, true); 
 } else if (document.attachEvent){
  document.attachEvent('mousedown', MrecordXY );
  document.attachEvent('mouseup', MconfirmXY );
 }	
}


function MrestoreLayers(e) 
{
 if (ppmNN) 
 {
  with (window.document) 
  {
   open("text/html");
   write("<html><head><title>Restoring the layer structure...</title></head>");
   write("<body bgcolor=\"#FFFFFF\" onLoad=\"history.go(-1)\">");
   write("</body></html>");
   close();
  }
 }
}

function MrecordXY(e) 
{
 if (ppmNN) 
 {
  ppmXC = e.x;
  ppmYC = e.y;
//  document.routeEvent(e);
 }
 else if (!ppmIE) 
 {
  ppmXC = e.clientX+window.scrollX;
  ppmYC = e.clientY+window.scrollY;
//  document.routeEvent(e);
 }
}

function MconfirmXY(e) 
{
 if (ppmNN) 
 {
  ppmXC = (ppmXC == e.x) ? e.x : null;
  ppmYC = (ppmYC == e.y) ? e.y : null;
//  document.routeEvent(e);
 }
}

function showPopUpMenu(text,StyleID,Layout)
{
//  text="<html><body><table border=1 width=100% cellspacing=0 cellpadding=0><tr><td>"+text+"</td></tr></table></body></html>";
  var text2="<table width=200 height=400 border=1 cellspacing=0 cellpadding=2><tr><td valign=top class=Translucent>"+text+"</table>";
  text="<html><head>";
  if (StyleID!=null)
  {
      text+"<link rel=\"stylesheet\" href=\"style.php?Style_ID="+StyleID+"&Layout="+Layout+"\" type=\"text/css\">";
  }
  text+="</head><body style='margin:0'>"+text2+"</body></html>";
  if (ppmIE) 
  {
   var obj = document.all['PopUpMenu'];
   if (obj==null)
	alert("PopUpMenu not found.");
   if (obj.style==null)
	alert("PopUpMenu style not found.");
   var left = document.body.scrollLeft+event.clientX;
   var objwidth=0;
   if (obj.style.width) { objwidth=parseInt(obj.style.width); }
   var screenright= document.body.clientWidth+document.body.scrollLeft-objwidth;
   if (left>screenright)
   {
    left = screenright;
   }
   obj.style.left = left;
   var top  = document.body.scrollTop+event.clientY;
   var objheight=0;
   if (obj.style.height) { objheight=parseInt(obj.style.height); }
   var screenbottom= document.body.clientHeight+document.body.scrollTop-objheight;
   if (top>screenbottom)
   {
    top = screenbottom;
   }
   obj.style.top=top;

   PopUpMenuFrame.document.body.innerHTML=text2;
   for(var i=0;i<PopUpMenuFrame.document.links.length;i++)
   {
    if (PopUpMenuFrame.document.links[i].target=="") PopUpMenuFrame.document.links[i].target="_parent";
   }   
   obj.style.visibility = "visible";
//   alert (""+(document.body.scrollLeft+event.clientX)+" ? "+(window.screen.width-document.body.scrollLeft-parseInt(obj.style.width)));
  }
  else if (ppmNN) 
  {
   var obj = document.layers['PopUpMenu'];
   obj.left = ppmXC+"px";
   obj.top  = ppmYC+"px";
   obj.visibility = "show";
   obj.innerHTML=text;
  }
  else
  {
   var obj = document.getElementById("PopUpMenu");
   obj.style.left = ppmXC+"px";
   obj.style.top  = ppmYC+"px";
   obj.style.visibility = "visible";
   obj.innerHTML=text;  
  }
}



function hideMenu() 
{
 if (ppmIE) {document.all['PopUpMenu'].style.visibility = "hidden";}
 else if (ppmNN) {document.layers['PopUpMenu'].visibility = "hide";window.status = " ";}
 else 
 {
  document.getElementById('PopUpMenu').style.visibility = "hidden";
 }
 ppmTI = false;
}

function MshowError(message) {
 window.alert("[ PopUp Menu ]\n\n" + message);}
 

