    function writeEmail( name, domain ) {
        document.write( name + '@' + domain );
    }

    function sendEmail( name, domain ) {
        location.href = 'mailto:' + name + '@' + domain;
    }

    //Input the IDs of the IFRAMES you wish to dynamically resize to match its content height:
    //Separate each ID with a comma. Examples: ["myframe1", "myframe2"] or ["myframe"] or [] for none:
    var iframeids=["ifrm"]

    function resizeCaller() {
        for (i=0; i<iframeids.length; i++)
        {
            if (document.getElementById)
                resizeIframe(iframeids[i])
        }
    }

    function resizeIframe(frameid)
    {
        var currentfr=document.getElementById(frameid)
    
        if (currentfr)
            {
            currentfr.style.display="block"
        
            if (currentfr.Document && currentfr.Document.documentElement.clientHeight && window.opera)
                currentfr.height = currentfr.Document.documentElement.clientHeight+10;
            else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
                currentfr.height = currentfr.Document.body.scrollHeight+10;
            else if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
                currentfr.height = currentfr.contentDocument.body.offsetHeight+10; 
            else if (currentfr.Document && currentfr.Document.body.innerHeight) //mozilla syntax
                currentfr.height = currentfr.Document.body.innerHeight+10;
            else if (currentfr.Document && currentfr.Document.documentElement.offsetHeight)
                currentfr.height = currentfr.Document.documentElement.offsetHeight+10;
            else if (currentfr.Document && currentfr.Document.documentElement.clientHeight)
                currentfr.height = currentfr.Document.documentElement.clientHeight+10;
                    
            if (currentfr.addEventListener)
                currentfr.addEventListener("load", readjustIframe, false)
            else if (currentfr.attachEvent)
            {
                currentfr.detachEvent("onload", readjustIframe) // Bug fix line
                currentfr.attachEvent("onload", readjustIframe)
            }
        }
    }

    function readjustIframe(loadevt) {
    var crossevt=(window.event)? event : loadevt
    var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
    if (iframeroot)
    resizeIframe(iframeroot.id);
    }

function getInternetExplorerVersion()
// Returns the version of Internet Explorer or a -1
// (indicating the use of another browser).
{
  var rv = -1; // Return value assumes failure.
  if (navigator.appName == 'Microsoft Internet Explorer')
  {
    var ua = navigator.userAgent;
    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null)
      rv = parseFloat( RegExp.$1 );
  }
  return rv;
}


    if (window.addEventListener)
        window.addEventListener("load", resizeCaller, false)
    else if (window.attachEvent)
        window.attachEvent("onload", resizeCaller)
    else
        window.onload=function() {resizeCaller()}

if (document.layers) { // Netscape
    document.captureEvents(Event.MOUSEMOVE);
    document.onmousemove = captureMousePosition;
    document.captureEvents(Event.MOUSEDOWN);
    document.onmousedown = captureMousePosition;
} else if (document.all) { // Internet Explorer
    document.onmousemove = captureMousePosition;
    document.onmousedown = captureMousePosition;
} else if (document.getElementById) { // Netcsape 6
    document.onmousemove = captureMousePosition;
    document.onmousedown = captureMousePosition;
}

// Global variables
xMousePos = 0; // Horizontal position of the mouse on the screen
yMousePos = 0; // Vertical position of the mouse on the screen
xMousePosMax = 0; // Width of the page
yMousePosMax = 0; // Height of the page
popupScrollOffset = 0; // IE Hack to scroll iframe

function captureMousePosition(e)
{
    var ver = getInternetExplorerVersion();

    if (ver > -1)
    {
        // When the page scrolls in IE, the event's mouse position
        // reflects the position from the top/left of the screen the
        // user is looking at. scrollLeft/Top is the amount the user
        // has scrolled into the page. clientWidth/Height is the height/
        // width of the current page the user is looking at. So, to be
        // consistent with Netscape (above), add the scroll offsets to
        // both so we end up with an absolute value on the page, no
        // matter if the user has scrolled or not.
        xMousePos = window.event.x+document.body.scrollLeft;
        yMousePos = window.event.y+document.body.scrollTop;
        xMousePosMax = document.body.clientWidth+document.body.scrollLeft;
        yMousePosMax = document.body.clientHeight+document.body.scrollTop;
    }
    else
    {
        // Proper browsers
        xMousePos = e.pageX;
        yMousePos = e.pageY;
        xMousePosMax = window.innerWidth+window.pageXOffset;
        yMousePosMax = window.innerHeight+window.pageYOffset;
    }
}

function loadExternalContents(url)
{
    $('#external_contents').load(url, function() {
        var extWidth = $('#external_contents table').outerWidth();
        $('#external_contents').css({ width: extWidth });
    });

        //$('#external_contents').css({ width: extWidth, position:'relative', left: (contentsWidth - extWidth)/2 });
        //var contentsWidth = $('#content').outerWidth();
}

function NewPopup(popupURL)
{
    var x = $('#external_contents table').offset().left;

    $('#result_popup').load(popupURL, function() {
        var extWidth = $('#result_popup table').outerWidth();
        $('#result_popup').css({ position:'absolute', left: x+54, top: yMousePos-5, display: 'block' });
    });
    $('#result_popup').mouseleave(hidePopup);
}

function hidePopup()
{
    $('#result_popup').css({ display: 'none' });
}

var ddmenuitem = new Array();

// open menu
function menuopen(e,id,level)
{	
    var menu_level=level-1;
    // close old menus
    menuclose(level);

    // get new layer and show it
    ddmenuitem[menu_level] = document.getElementById(id);
    ddmenuitem[menu_level].style.visibility = 'visible';

    $('#sidebar li.folder').css('position','relative');

    $('#'+id).css('position','absolute');
    $('#'+id).css('display','block');
    $('#'+id).css('z-index',20+level);
		
    if (!e) var e = window.event;
    e.cancelBubble = true;
    if (e.stopPropagation) e.stopPropagation();
}

// close menu
function menuclose(level)
{
    for (i=level-1; i<2; i++)
    {
        if(ddmenuitem[i])
        {
            ddmenuitem[i].style.display = 'none';
            ddmenuitem[i].style.visibility = 'hidden';
            ddmenuitem[i] = 0;
        }
    }
}

$(document).ready(function(){

    $('#jsinfo').css({ display: 'none' });

    $('#external_contents').click(function(e) {
        if ( $(e.target).is(":contains('-')") )
        {
	        var y = e.pageY;
            var x = $('#external_contents table').offset().left;
		    var url = $(e.target.offsetParent).attr('data-url');
            $('#result_popup').load(url, function() {
                var extWidth = $('#result_popup table').outerWidth();
                $('#result_popup').css({ position:'absolute', left: x+54, top: y-5, display: 'block' });
            });
            $('#result_popup').mouseleave(hidePopup);
        }
    });

});


