// Delete confirmation messages.
// cancelMessage example: "Not deleted." if it was being used as a delete confirmation dialogue.
function confirmIt(message, cancelMessage, acceptURL){
    var confirmed = confirm(message);
    if(!confirmed){
        alert(cancelMessage);
    } else {
        window.location = acceptURL;
    }
    return;
}


/**
* @desc select options jump down jumps
*/
function selectLand(ref, target)
    {
    lowtarget=target.toLowerCase();
    if (lowtarget=="_self") {window.location=loc;}
    else {if (lowtarget=="_top") {top.location=loc;}
    else {if (lowtarget=="_blank") {window.open(loc);}
    else {if (lowtarget=="_parent") {parent.location=loc;}
    else {parent.frames[target].location=loc;};
    }}}
}

function selectJump(menu){
    ref=menu.actions.options[menu.actions.selectedIndex].value;
    splitc=ref.lastIndexOf("*");
    target="";
    if (splitc!=-1)
    {loc=ref.substring(0,splitc);
    target=ref.substring(splitc+1,1000);}
    else {loc=ref; target="_self";};
    if (ref != "") {selectLand(loc,target);}
}

function replace(string,text,by) {
    // Replaces text with by in string
    var strLength = string.length, txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return string;

    var i = string.indexOf(text);
    if ((!i) && (text != string.substring(0,txtLength))) return string;
    if (i == -1) return string;

    var newstr = string.substring(0,i) + by;

    if (i+txtLength < strLength)
        newstr += replace(string.substring(i+txtLength,strLength),text,by);

    return newstr;
}



/**
*  AddOnload(myfunc) and AddOnloadEval(myfuncString) are used to stack up
*  onLoad events for execution.
*  AddOnload(myFunction1);
*  AddOnload(myFunction2);
*  etc.
*/
function AddOnload(myfunc){
    if(window.addEventListener)
        window.addEventListener('load', myfunc, false);
    else if(window.attachEvent)
        window.attachEvent('onload', myfunc);
}

/* Eval version so args can be passed too! */
function AddOnloadEval(myfuncString){
    myfunc = function(){
        eval(myfuncString);
    }
    AddOnload(myfunc);
}

var debOut = "";



