var eimgPrefix = "" ;
var eimgTemplate = "http://www.zaplana.net/eiTemplate.asp" ;
var sendMailURL = "/forms/SIsendmail.asp" ;

function sendMail () {
  imgWindow = window.open(sendMailURL,"sendMail","dependent,height=600,width=800,menubar=no,resizable=yes,scrollbars=yes") ;
}

function img_popup(iref) {
  imgWindow = window.open("","","dependent,height="+(4*iref.height+80)+",width="+(4*iref.width+40));
  re = /\W[tl]_/i ;
  isrc = iref.src.replace(re,"/") ;
  imgWindow.document.write ("<HEAD><TITLE>Enlarged picture</TITLE><HEAD>");
  imgWindow.document.write ("<BODY><CENTER><IMG SRC="+isrc+"><BR><BR>");
  imgWindow.document.write ("<A HREF='javascript:window.close()'>Close</A>");
  imgWindow.document.write ("</CENTER></BODY>");
}

function enlarge(imgname) {
  imgWindow = window.open("","","dependent,height=500,width=600");
  imgWindow.document.write ("<HEAD><TITLE>Enlarged picture</TITLE><HEAD>");
  imgWindow.document.write ("<BODY><CENTER><IMG SRC="+imgname+".jpg><BR><BR>");
  imgWindow.document.write ("<A HREF='javascript:window.close()'>Close</A>");
  imgWindow.document.write ("</CENTER></BODY>");
}

function ei_popup(iref) {
  re = /\W[tl]_/i ;
  window.eimgSource = iref.src.replace(re,"/"+eimgPrefix) ;
  imgWindow = window.open(window.eimgTemplate + "?rq="+escape(iref.src),"","dependent,titlebar=no,toolbar=no,"+
    "height="+(4*iref.height)+",width="+(4*iref.width));
//  if (imgWindow && imgWindow.focus) { imgWindow.focus() ; }
}

function finclude(fname,hsize,vsize) {
  t = 'src="'+fname+'" width="'+hsize+'" height="'+vsize+'"' ;
  document.write ('<iframe '+t+'><ilayer '+t+'></iframe>') ;
  t = "" ;
}

function ei_setup(iname) {
  var lname ;
  var iLink ;

  iname += "%" ;
  eimgPrefix = "M_" ;
  eimgTemplate ="/eiTemplate.asp" ;

  for (var i = 0 ; i < window.document.links.length ; i++) {
    iLink = window.document.links[i] ;
    lname = iLink.pathname + "%" ;
    if (lname.indexOf(iname) >= 0) {
      eimgTemplate = iLink.href.replace("htm","asp") ;
      return true ;
    }
  }
  return false ;
}

function wo(u,x,y) {
  window.open (u,"_blank","width="+x+",height="+y+",menubar=no,location=no,scrollbars=yes") ;
}

function wom(u,x,y) {
  y = 24 + new Number(y); 
  window.open (u,"_blank","width="+x+",height="+y+",menubar=yes,location=no,scrollbars=yes") ;
}


function woMax(u,maxx,maxy) {
  if ((maxx > screen.availWidth - 30) || (maxx == 0)) { maxx = screen.availWidth - 30; }
  if ((maxy > screen.availHeight - 30) || (maxy == 0)) { maxy = screen.availHeight - 30; }
  wo(u,maxx,maxy) ;
}

function pus(u) {
  window.open("/forms/showURL.asp?l=sl&u=" + escape(u),"_blank","width=500,height=500,location=no,scrollbars,resizable=1") ;
}

function closeRefresh() {
  if (opener) { 
    if (opener.callbackRefresh) { opener.callbackRefresh() ; } 
      else { opener.location.replace(opener.location.href); }
  }
  window.close () ;
}

function dg(st) {
  pus("http://www.google.com/search?q="+escape(st)) ;
}

function gracefulReload() {
  if (confirm("A component of current page is out of date. Shall I reload the page?")) location.reload(true); 
}

var cdbg = true;

function checkCSSrule(rxp) {

  function doCheck(r) {
    var testResult = r.selectorText.search(rxp) != -1;
    return testResult; 
  }  
  
  try { xHasStyleSheets; xTraverseDocumentStyleSheets; if (!xHasStyleSheets()) return; } catch(e) { return undefined; }
  var hasRule = xTraverseDocumentStyleSheets(doCheck);
  if (hasRule) return; 
  gracefulReload() ;
}