document.write("<script type='text/javascript' src='/js/prototype.js'></script>");
document.write("<script type='text/javascript' src='/js/scriptaculous.js'></script>");


function OpenBrWindow(theURL) { //v2.0
  window.open(theURL,'','scrollbars=yes,width=600,height=200');
}


function showBox (target, e, url, data, offsetX, offsetY,width,height )
{
if (typeof offsetX == 'undefined' ) offsetX = 10;
if (typeof offsetY == 'undefined' ) offsetY = 10;
if (typeof width == 'undefined' ) width = 300;
if (typeof height == 'undefined' ) height = 300;

  theObject = document.getElementById(target);
  theObject.style.width = width + "px";
  theObject.style.height = height + "px";

  var posx = 0;
  var posy = 0;
   if( typeof( e.pageX ) == 'number' ) {
      posx = e.pageX; posy = e.pageY;
   } else {
      if( typeof( e.clientX ) == 'number' ) {
         posx = e.clientX; posy = e.clientY;
         if( document.body && ( document.body.scrollTop || document.body.scrollLeft ) ) {
               posx += document.body.scrollLeft; posy += document.body.scrollTop;
         }  else {
            if( document.documentElement && ( document.documentElement.scrollTop || document.documentElement.scrollLeft ) ) {
               posx += document.documentElement.scrollLeft; posy += document.documentElement.scrollTop;
            }
         }
      }
   }
posx += offsetX;
posy += offsetY;

//alert ('EY:'+e.clientY +'  posx: '+posx+'  posy:'+posy);
  theObject.style.left = posx + "px";
  theObject.style.top = posy + "px";

  new Ajax.Updater ( target, url, {method:'post', parameters: data });
  theObject.style.visibility = "visible";
}

function hideBox (target) {
  theObject = document.getElementById(target);
  theObject.style.visibility = "hidden";
  //theObject.style.height = "0px";
  //theObject.style.width = "0px";
}



function  insertToTextarea(textArea, text) {
//var strText = text;
//alert("textArea: "+textArea+"  text: "+strText);
//tinyMCE.activeEditor.selection.setContent(strText,{format : 'raw'});
//tinyMCE.execCommand('mceInsertRawHTML',false,text);
if (typeof tinyMCE != "undefined") {
	tinyMCE.execCommand('mceInsertRawHTML',false,text);
}else {

  //IE
  if (document.selection) {
    textArea.focus();
    sel = document.selection.createRange();
    sel.text = text;
  }
  //FF
  else if (textArea.selectionStart || textArea.selectionStart == '0') {
    var startPos = textArea.selectionStart;
    var endPos = textArea.selectionEnd;
    textArea.value = textArea.value.substring(0, startPos)+ text+ textArea.value.substring(endPos, textArea.value.length);
  } else {
    textArea.value += text;
  } 
}


}
function basename(path) {
	return path.replace(/\\/g,'/').replace( /.*\//, '' );
}

function dirname(path) {
	return path.replace(/\\/g,'/').replace(/\/[^\/]*$/, '');;
}


