﻿Event.observe(window, 'load', function() {

    function bookmarksite(){
        var url = 'http://www.pnhsource.eu';
        var title = 'PNHSource.eu';
        
        if (document.all)
            window.external.AddFavorite(url, title);
        else if (window.sidebar)
            window.sidebar.addPanel(title, url, "")
    }
    

      

  
    
    $$('a').each(function(bk){
        if(bk.readAttribute('rel') == 'bookmark'){  
            $(bk).observe('click',function(x){
                bookmarksite();
                Event.stop(x);
            });
        }
    });


    $$('ul').each(function(x){
        if ($(x).empty()) {    
            $(x).hide();
        }        
    });

    $$('select').each(function(element){        
        if ($(element).hasClassName('dropdown')) {
            $(element).removeClassName('dropdown');
            $(element).addClassName(foo);
        }
    });

    /* Top Nav Utility BEGIN */
   if ($('navTop')) {
        if ($('navTop').immediateDescendants().size() > 1) {
            $('navTop').immediateDescendants().last().addClassName('last');
        }
    }
    
    $$('#navTop ul li').each(function(element) {
        if ($(element).immediateDescendants().size() > 1) {
            $(element).addClassName('hasLevel3');
        }
    });

//    /* if a link has rel="external" it will open in a new window */
//    $$('a').each(function(link){
//        if((link).readAttribute('rel') == 'external'){
//            Shadowbox.init({
//                skipSetup: true,
//                players: ["iframe"]
//            });    
//            $(link).observe('click',function(x){
//                var xUrl = "/Utility/msgExit.aspx?x=" + $(link).readAttribute('href');
//                Shadowbox.open({
//                    content:    xUrl,
//                    player:     "iframe",
//                    title:      "Warning",
//                    height:     280,
//                    width:      600
//                });
//                Event.stop(x);
//            });
//        }
//    }); 
});

/* simple popup script BEGIN */
    function openpop(URL,w,h) {
        param = 'left=120,top=10,width=' + w + ',height=' + h + ',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no';
        newWindow = window.open(URL,"popup",param); 
        newWindow.focus();
    }
/* simple popup script END */

function ResetPageDefaultButton()
{
    // need to reset page default buton when there are multiple submit buttons on one page
    // call this function on client click event on each button on a page there multiple submits are expected. 
    // M.R. 11/10/08 
    __defaultFired = false;
}

 function showMe(divId) {
 if(document.getElementById(divId).style.display = "none") {
 document.getElementById(divId).style.display = "";
 }
 }
 function closeMe(divId) {
 document.getElementById(divId).style.display = "none";
 }
