
    $(document).ready(function(){	

        $("#nav li").hover(
	      function () {
		    $("ul:first",this).show();
	      }, 
	      function () {
		    $("ul",this).hide();
	      }
	    );	
    	
        $("a.popup").readyPopups();

    });


    jQuery.fn.extend({

        readyPopups: function() {
	        return this.bind('click', function(event) {
		        SysinPopup.NewPopup(this.href);
		        return false;
	        });
	        return false;
            } 
    });

    SysinPopup = {

	    // create a new popup (not back/foreward navigation within the history stack)
	    NewPopup: function(url) {
		    var ie6top = document.documentElement.scrollTop + 'px';	//for ie6 to get the height that is needed to position the poup
		    //see if the window is already present and visible
		    var popup;
		    if (document.getElementById('popupWindow') == null) {
			    popup = document.createElement('div'); 
			    popup.setAttribute('id','popupWindow'); 
			    jQuery('body').append(popup); 
		    }
		    else { jQuery('div#popupWindow').hide(); }
    		
		    //ajax get the contents and populate the popup container
		    jQuery.get(url, function(data) {
			    jQuery('div#popupWindow')
				    .html(data)
				    .css('_top', ie6top).show();
    			
		    });
    		
		    //set the dimensions of the iframe to match the window (IE6 ONLY FIX)
		    jQuery('div#popupWindow iframe')
			    .css('width',jQuery(window).width() + 'px')
			    .css('height',jQuery(window).height() + 'px');
    			
            return false;
    	
        }
    };

    function ClosePopup() { jQuery('div#popupWindow').hide(); return false; }
    	

