﻿// JScript File

function openDemoWindow(url){
    var win = window.open(url,'demo','width=1045, height=800, resizable=yes,scrollbars=yes');
}

function openSiteWindow(url){
    var win = window.open(url,'demo','width=1024, height=768, resizable=yes,scrollbars=yes');
}

function LoadModalWindow(url, title, w, h, onHideEvent){    
    if(!w) w = 500;
    if(!h) h = 450;
    xpos = (document.viewport.getWidth()-w) / 2;
    ypos = ((document.viewport.getHeight()-h) / 2) - 10 + document.viewport.getScrollOffsets()[1];
    if((!ypos) || ypos < 0) ypos = 10;
    YAHOO.namespace('modal.container');    
    YAHOO.modal.container.modalPanel = new YAHOO.widget.Panel("modalPanel", { width:w+"px",  x: xpos, y:ypos, zindex:4, modal:true });
    YAHOO.modal.container.modalPanel.setHeader(title);
    YAHOO.modal.container.modalPanel.setBody("<iframe src='" + url + "' width='" + (w-5) + "px' height='" + h + "px' frameborder='0'></iframe>");
    if(onHideEvent){
        YAHOO.modal.container.modalPanel.hideEvent.subscribe(onHideEvent);
    }
    else{
        YAHOO.modal.container.modalPanel.hideEvent.subscribe(HideModalWindow);
    }
    YAHOO.modal.container.modalPanel.render(document.body);    
    YAHOO.modal.container.modalPanel.show();    
}

function HideModalWindow(){
    if(YAHOO.modal.container.modalPanel){
        YAHOO.modal.container.modalPanel.setBody("");
        YAHOO.modal.container.modalPanel.render(document.body);
        YAHOO.modal.container.modalPanel.hide();        
    }
    embeds = document.getElementsByTagName('embed');
    for(i = 0; i < embeds.length; i++) {
        embeds[i].style.visibility = '';
    }
}


