/**
 * PopIn object
 */
var POPIN_HTML = '<table cellpadding="0" cellspacing="0" border="0"><tr valign="top"><td class="drop a"><div>&nbsp;</div></td><td><table cellpadding="0" cellspacing="0" width="100%" border="0"><tr><td class="drop b"><div>&nbsp;</div></td><td class="drop c"><div>&nbsp;</div></td><td class="drop d"><div>&nbsp;</div></td></tr></table></td><td class="drop e"><div>&nbsp;</div></td></tr><tr valign="top"><td height="100%"><table cellpadding="0" cellspacing="0" height="100%" border="0"><tr><td class="drop p"><div>&nbsp;</div></td></tr><tr><td class="drop o"><div>&nbsp;</div></td></tr><tr><td class="drop n"><div>&nbsp;</div></td></tr></table></td><td class="contentHolder"><table cellpadding="0" cellspacing="0" border="0"><thead><tr class="pheader"><td id="popinTitle" class="ptitle">Title</td><td class="pclose"><div onclick="popIn.hide()"></div></td></tr></thead><tbody><tr><td id="popinContent" class="pcontent"></td><td>&nbsp;</td></tr></tbody></table></td><td height="100%" width="32"><table cellpadding="0" cellspacing="0" height="100%" border="0"><tr><td class="drop f"><div>&nbsp;</div></td></tr><tr><td class="drop g"><div>&nbsp;</div></td></tr><tr><td class="drop h"><div>&nbsp;</div></td></tr></table></td></tr><tr valign="top"><td class="drop m"><div>&nbsp;</div></td><td><table cellpadding="0" cellspacing="0" width="100%" border="0"><tr><td class="drop l"><div>&nbsp;</div></td><td class="drop k"><div>&nbsp;</div></td><td class="drop j"><div>&nbsp;</div></td></tr></table></td><td class="drop i"><div>&nbsp;</div></td></tr></table>';
function PopIn() {
    this.id = 'popin';

    //create popin window here
    this.wndEl = document.getElementById(this.id);
    this.wndEl.innerHTML = POPIN_HTML;
    this.titleEl = document.getElementById("popinTitle");
    this.contentEl = document.createElement("div")
    document.getElementById("popinContent").appendChild(this.contentEl);

    this.show = function (x, y) {
        if( x == null ) x = 50;
        if( y == null ) y = 50;
        this.wndEl.style.left = "" + x + "px";
        this.wndEl.style.top = "" + y + "px";

        this.wndEl.style.display = "";
    };
    this.setTitle = function (title) {
        this.titleEl.innerHTML = title;
    };
    this.setContentHtml = function (content) {
        this.contentEl.innerHTML = content;
    };
    this.setContentEl = function (el) {
        this.contentEl.innerHTML = "";
        this.contentEl.appendChild(el);
    };
    this.hide = function () {
        this.contentEl.innerHTML = "";
        this.wndEl.style.display = "none";
    };
    this.isVisible = function(){
        return this.wndEl.style.display == "";
    }
    this.toString = function() {
        return "PopIn {id=" + this.id + ", displayStyle=" + this.wndEl.style.display + "}"
    };
}


/** Show/hide problem IE controls: SELECTS, IFRAMES and TEXTAREAS  */
function showHideBadControls(bShow) {
    var newstyle = bShow ? "visible" : "hidden";
    //all the SELECTS, IFRAMES and TEXTAREAS
    var list = document.getElementsByTagName("select");
    for (i = 0; i < list.length; i++) {
        list[i].style.visibility = newstyle;
    }
    list = appWindow.getElementsByTagName("textarea");
    for (i = 0; i < list.length; i++) {
        list[i].style.visibility = newstyle;
    }
    list = appWindow.getElementsByTagName("iframe");
    for (i = 0; i < list.length; i++) {
        list[i].style.visibility = newstyle;
    }
}

