var tipTimer;
var popupHandle;

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  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=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function displayPopup(url,name,width,height,features) {
  var properties = "height=" + height + ",width=" + width + ",toolbar=no,location=no,status=yes"
  if (features.length>0) properties=properties + "," + features;
  properties = properties + ",left=" + parseInt((window.screen.availWidth-width)/2) + ",top=" + parseInt((window.screen.availHeight-height)/2);
  popupHandle = open(url,name,properties);
  popupHandle.focus();
}

function ConfirmRemove(desc) {
  var yesNo=confirm('Are you sure you wish to remove ' + desc + '?');
  if (yesNo) {
    return true;
  } else {
    return false;
  }
}

function hideTooltip(object)
{
if (document.all)
{
	MM_findObj(object).style.visibility="hidden"
	MM_findObj(object).style.left = 1;
	MM_findObj(object).style.top = 1;
return false
}
else if (document.layers)
{
	MM_findObj(object).visibility="hide"
	MM_findObj(object).left = 1;
	MM_findObj(object).top = 1;
	return false
}
else
	return true
}

function showTooltip(object,e, tipContent, backcolor, bordercolor, textcolor, displaytime)
{
	window.clearTimeout(tipTimer)
	
	if (document.all)
		{
			MM_findObj(object).style.top=document.body.scrollTop+event.clientY+20
			
			MM_findObj(object).innerHTML='<table style="font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 11px; border: '+bordercolor+'; border-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; background-color: '+backcolor+'" width="10" border="0" cellspacing="1" cellpadding="1"><tr><td nowrap><font style="font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 11px; color: '+textcolor+'">'+unescape(tipContent)+'</font></td></tr></table> '

			if ((e.x + MM_findObj(object).clientWidth) > (document.body.clientWidth + document.body.scrollLeft))
				{	
					MM_findObj(object).style.left = (document.body.clientWidth + document.body.scrollLeft) - MM_findObj(object).clientWidth-10;
				}
			else
			{
			MM_findObj(object).style.left=document.body.scrollLeft+event.clientX
			}
		MM_findObj(object).style.visibility="visible"
		tipTimer=window.setTimeout("hideTooltip('"+object+"')", displaytime);
		return true;
		}
	else if (document.layers)
		{
		MM_findObj(object).document.write('<table width="10" border="0" cellspacing="1" cellpadding="1"><tr bgcolor="'+bordercolor+'"><td><table width="10" border="0" cellspacing="0" cellpadding="2"><tr bgcolor="'+backcolor+'"><td nowrap><font style="font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 11px; color: '+textcolor+'">'+unescape(tipContent)+'</font></td></tr></table></td></tr></table>')
		MM_findObj(object).document.close()
		MM_findObj(object).top=e.y+20

		if ((e.x + MM_findObj(object).clip.width) > (window.pageXOffset + window.innerWidth))
			{
				MM_findObj(object).left = window.innerWidth - MM_findObj(object).clip.width-10;
			}
		else
			{
			MM_findObj(object).left=e.x;
			}
		MM_findObj(object).visibility="show"
		tipTimer=window.setTimeout("hideTooltip('"+object+"')", displaytime);
		return true;
	}
	else
	{
		return true;
	}
}

function openImageLibrary(editor) {
  if (window.showModalDialog)
    window.showModalDialog('image_library.aspx?m=1&e=' + escape(editor),window,'dialogWidth:450px; dialogHeight:350px; edge:Raised; center:Yes; help:No; resizable:No; scroll:No');
  else
    displayPopup('image_library.aspx?e=' + escape(editor),'ImageLibrary',450,350,'scrollbars=yes');
}

function insertImage(editor,fileName,width,height) {
  var parentWindow;
  
  if (parent.window.dialogArguments)
      parentWindow = parent.window.dialogArguments;
  else if (top.opener)
      parentWindow = top.opener;

  if (!parentWindow.document)
      return false;

  parentWindow.setSnippet(editor,'<img src="' + fileName + '" width="' + width + '" height="' + height + '" border="0">');

  if (top.opener || parent.window.dialogArguments)
	  self.close();
}

window.onload="MM_preloadImages('/images/bot-menu-02-2nd-over.gif','/images/bot-menu-01-over.gif','/images/menu-02-2nd-over.gif','/images/menu-03-2nd-over.gif','/images/menu-04-2nd-over.gif','/images/menu-05-2nd-over.gif','/images/menu-07-2nd-over.gif','/images/search-over.gif')"