/*
 *
 * XCAP blockUI popup window handlers.
 *
 * @version $Id: xcap.blockui.js,v 1.17 2008/10/27 12:55:49 jox Exp $
 *
* @depends jQuery, jQuery blockUI (http://www.malsup.com/jquery/block/)
 */
 
/* 						 
* Popup window positioning via blockUI


*/
var docheight = 33;
var windowheight =33;
var pageheight = 33;
var xcapPopupXL = {position: 'absolute', border: 0, background: 'transparent', width: '548px', margin: '0 auto', top: '0', height: docheight };
var xcapPopupMedium = {border: 0, background:'white', width: '540px'};
var xcapPopupSmall = {border: 0, background:'white', width: '540px'};


jQuery(function() 
{ 
       jQuery('.xcapPopupLink').click(function()
       {   
	       windowheight=(window.innerHeight);
	       pageheight= (document.getElementById('page').scrollHeight);

		   if(jQuery.browser.msie)
		   {
		   	docheight=pageheight;
		   }
		   else
			   {
		       if (pageheight > windowheight)
		       {
		       		docheight = pageheight;
		       }	
		       else
		       {
		       		docheight = windowheight;
		       }
	       }	       

	       var url = (this.nodeName == 'A' ? this.href : jQuery('a', this).get(1).href);

           jQuery('.xcapDropShadow .body').css("height", docheight + "px");
           
            jQuery('#xcapPopup').load(url, function(responseText, textStatus, XMLHttpRequest)
            {
                if (textStatus == 'success') 
                {
                    jQuery.blockUI({
                       message: jQuery('#xcapPopupContainer'),
                       css: {position: 'absolute', border: 0, background: 'transparent', width: '548px', margin: '0 auto', top: '0', height: docheight  + 'px'}
                    });
                }
                else
                {
                    jQuery('#xcapPopup').empty().append(responseText).show();
                }
            });
            
            return false;
            
           
       });
       
       jQuery('.xcapClose').click(function()
	   {
		  jQuery.unblockUI({fadeOut:0});
		  return false;
       });
});