//General Javascript Functions
//(C) 2005 Propus Software Ltd - All Rights Reserved

function mail(sURL, sDomain)
{
	//Unencrypt the email address and open the mail client
  sURL1 = "";
  for (var i = 0; i < sURL.length; i++)
  {
    if (sURL.charCodeAt(i) > 96 && sURL.charCodeAt(i) < 123)
      { sURL1 += String.fromCharCode(((sURL.charCodeAt(i) - 97 + 1) % 26) + 97); }
    else
      { sURL1 += sURL.charAt(i); }
  }
  sURL1 += "@" + sDomain;
	document.location = "mailto:" + sURL1;
}

function showPopup(URL, description)
{
	win = window.open("", "popupURL", "width=550, height=450, toolbar=no, location=no, status=no, resizable=yes, scrollbars=yes");
	win.document.write("<HTML><HEAD><TITLE>" + description + "</TITLE>");
	win.document.write("<script type=\"text/javascript\">");
	win.document.write("function pageLoadScript()");
	win.document.write("{");
//	win.document.write("alert(\"" + URL + "\")");
	win.document.write("document.location = \"" + URL + "\"");
	win.document.write("}");
	win.document.write("<\/script>");
	win.document.write("</HEAD>");

	win.document.write("<BODY onload=\"pageLoadScript()\" STYLE=\"margin: 0px;\">");
	win.document.write("</BODY></HTML>");
  win.document.close();
  win.focus();
}

function showPopupImage(URL, description, width, height)
{
	//Show the image in a new window
	win = window.open("", "popup", "width=" + (width + 20) + ", height=" + (height + 60) + ", toolbar=no, location=no, status=no, resizable=no, scrollbars=no");
	win.document.write("<html><head><title>" + description + "</title>");
	win.document.write("<script type=\"text/javascript\">");
	win.document.write("function pageLoadScript()");
	win.document.write("{");
	win.document.write("window.resizeTo(" + (width + 20) + ", " + (height + 60) + ");");
	win.document.write("}");
	win.document.write("<\/script>");
	win.document.write("</head>");

	win.document.write("<body onload=\"pageLoadScript()\" STYLE=\"margin: 0px;\">");
	win.document.write("<img src=" + URL + ">");
	win.document.write("</body></html>");
  win.document.close();
  win.focus();
	}

function showTab(nTabIndex, nTabCount)
{
	//Highlight the selected tab
  div = document.getElementById("divTabArea" + nTabIndex);
	if (div) { div.style.display = "block"; }

  div = document.getElementById("divTab" + nTabIndex);
	if (div) { div.className = "tabSelected"; }

	for (i = 0; i < nTabCount; i++)
  {
		if (i != nTabIndex)
	  { 
      div = document.getElementById('divTabArea' + i);
			if (div) { div.style.display='none'; }
		  
			div = document.getElementById('divTab' + i)
			if (div) { div.className='tabNotSelected'; }
    }
  }
}
  

//To be sorted
  


