var isPaused = true;
var OverDiv = false;

function pause(i)
{
  setTimeout("isPaused = false;", i);
  do
  {
    i=0;
  } while( isPaused )
  isPaused = true;
  return true;
}

function E_Getobj(n, d) {
  var p,i,x;
  if(!d) d=document;
  if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=E_Getobj(n,d.layers[i].document);
  return x;
}

//  if ((obj=E_Getobj(args[i]))!=null)
function E_Layers()
{
  var i,v,obj,args=E_Layers.arguments;
  for (i=0; i<(args.length-1); i+=2) 
  {
    v=args[i+1];
    v=(v=='s')?'visible':(v='h')?'hidden':v;
    if(document.layers){
      obj = document.layers[args[i]]
      obj.visibility=v;
    }
    if(document.all){
      obj = document.all[args[i]];
      obj.style.visibility=v;
    }
    if(!document.all && document.getElementById){
      obj = document.getElementById(args[i]);
      obj.style.visibility=v;
    }
  } 
}

function E_LayersAtMouse()
{
  var i,v,obj,args=E_LayersAtMouse.arguments;
  var IE = document.all?true:false
  var tempX = 0
  var tempY = 0
  if (IE) { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + document.body.scrollLeft
    tempY = event.clientY + document.body.scrollTop
  } else {  // grab the x-y pos.s if browser is NS
    document.captureEvents(Event.MOUSEMOVE)
    tempX = e.pageX
    tempY = e.pageY
  }  
  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}  
  for (i=0; i<(args.length-1); i+=2) if ((obj=E_Getobj(args[i]))!=null)
  {
    v=args[i+1];
    v=(v=='s')?'visible':(v='h')?'hidden':v;
    obj.style.visibility=v;
    obj.style.position='absolute';
    obj.style.top=tempY +2;
    obj.style.left=tempX +32;
  } 
}

function VisibleAtMouse (obj)
{
  var IE = document.all?true:false
  var tempX = 0
  var tempY = 0
  if (IE) { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + document.body.scrollLeft
    tempY = event.clientY + document.body.scrollTop
  } else {  // grab the x-y pos.s if browser is NS
    document.captureEvents(Event.MOUSEMOVE)
    tempX = e.pageX
    tempY = e.pageY
  }  
  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}  
  obj.style.visibility='visible';
  obj.style.position='absolute';
  obj.style.top=tempY-1;
  obj.style.left=tempX +10;
}

function Invisible (obj)
{
  obj.style.visibility='hidden';
}

function E_Button()
{
  var o,args=E_Button.arguments; 
  o=E_Getobj(args[0]);
  if (o.style.backgroundImage != args[1]) o.style.backgroundImage=args[1];  
}

function E_NavMenuOver(n)
{
  var divn,obstyle;
  divn="menu"+n;
  E_Layers(divn,"s");
  obstyle=document.getElementById("rootmenuitem"+n).style;
  obstyle.backgroundImage='url(http://www.carolannstudio.com/common/img/ovalgoldhover.png)';
  obstyle.zIndex="99";
}

function E_NavMenuOut(n)
{
  var divn,obstyle;
  divn="menu"+n;
  E_Layers(divn,"h");
  obstyle=document.getElementById("rootmenuitem"+n).style;
  obstyle.backgroundImage='url(http://www.carolannstudio.com/common/img/ovalgoldstatic.png)';
  obstyle.zIndex="1";
}

function E_ImagePaneIn(f,t,w,h)
{
  var divtyle, imgstyle, pstyle;
  divstyle=document.getElementById("imagepopupdiv").style;
  divstyle.zIndex="999";
  divstyle.visibility="visible";
  imgstyle=document.getElementById("imagepopupimg");
  imgstyle.src=f;
  imgstyle.alt=unescape(t);
  pstyle=document.getElementById("imagepopupp");
  pstyle.innerHTML=unescape(t);
}

function E_ImagePaneOut()
{
  var obstyle;
  obstyle=document.getElementById("imagepopupdiv").style;
  obstyle.visibility="hidden";
  obstyle.zIndex="1";
}

function E_NewWindow(windurl,windname)
{ 
 window.open(windurl,windname,'width=400,height=400,resizable=no,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,copyhistory=no'); 
} 

function E_OpenImage (FileName, Width, Height) 
{
 window.open("image.php?Fn="+FileName,"_blank","toolbar=no, location=no, directories=no, menubar=no,status=no, scrollbars=no, resizable=no, copyhistory=no, width="+Width+", height="+Height);
}