﻿//---------------- MISC

dt.flyouts();

function global()
{
    setUpcomingEventsHeight();
}

function showLinkAlert(_txt) {
    var _alert = dt.alert.show("copy and paste this link<br><textarea id=linkareacontent rows=1 style=width:95%>" + _txt + "</textarea>");
    var _textarea = document.getElementById('linkareacontent');
    _textarea.select();
}

function Left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}
function Right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}

function DeleteItem(url){
    if(confirm("Are you sure you want to delete this?")){
        window.location.href=url;
    }
}

function DeleteItemBool(url){
    return confirm("Are you sure you want to delete this?");
}

function DeleteParentItem(url){
    if(confirm("WARNING: Deleting this top level item will also delete all children below it.\n\n Are you sure you want to proceed?")){
        window.location.href=url;
    }
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function setUpcomingEventsHeight()
{
    // Make the events div shorter if there isn't much news.
    var objUpcomingEventsDiv = document.getElementById("divUpcomingEvents");
    var objNewsTable = document.getElementById("tblNews");

    if ((objUpcomingEventsDiv == null) || (objNewsTable == null))
        return;

    if (objNewsTable.offsetHeight > 500)
        objUpcomingEventsDiv.style.height = (objNewsTable.offsetHeight - 210) + "px";
    else
        objUpcomingEventsDiv.style.height = "auto";

    objUpcomingEventsDiv = null;
    objNewsTable = null;
}
