var dupCounter = 1;

function DispHideHide ( disp, hide1, hide2 )
{
    if (hide1) hide1.style.display = 'none';
    if (hide2) hide2.style.display = 'none';
    if (disp) disp.style.display = 'inline';
}

function DispDispHide ( disp1, disp2, hide )
{
    if (hide) hide.style.display = 'none';
    if (disp1) disp1.style.display = 'inline';
    if (disp2) disp2.style.display = 'inline';
}

function eover(object, over) {
        object.className = over;
}

function duplicateHTML(copy,paste,baseid){
                if(document.getElementById(copy)){

                        dupCounter++;
                        var type = document.getElementById(copy).nodeName; // get the tag name of the source copy.

                        var but = document.createElement('input');
                        var br = document.createElement('br');

                        but.type = 'button';
                        but.value = 'x';
                        but.className = 'button';
                        but.onclick = function(){ this.parentNode.parentNode.removeChild(this.parentNode); };

                        var destination = document.getElementById(paste);
                        var source      = document.getElementById(copy).cloneNode(true);

                        var newentry = document.createElement(type);

                        newentry.appendChild(source);
                        newentry.value='';
                        newentry.appendChild(but);
                        newentry.appendChild(br);
                        if(baseid)
                        {
                                newid = baseid+e107_dupCounter;
                                newentry.innerHTML = newentry.innerHTML.replace(new RegExp(baseid, 'g'), newid);
                                newentry.id=newid;
                        }

                        destination.appendChild(newentry);
                }
}

var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}

