
//additional properties for jQuery object
jQuery(document).ready(function(){

var banWidth=560;
var banHeight=460;

   jQuery.fn.alignCenter = function() {
   /*
	str = 'width='+jQuery("#banner1").width()+' height: '+jQuery("#banner1").height();
	str = str+"\n"+ ' css width='+jQuery("#banner1").css('width')+' css height: '+jQuery("#banner1").css('height');
	str = str+"\n"+ ' banWidth='+banWidth+' ban height: '+banHeight;
	alert(str);
	*/
	var marginLeft =  - banWidth/2 + 'px';
	var marginTop =  - banHeight/2 + 'px';
	str = 'margin-left:'+marginLeft+' margin-top: '+marginTop;
	//alert(str);
	return jQuery(this).css({'margin-left':marginLeft, 'margin-top':marginTop});
   };



   jQuery.fn.togglePopup = function(){

     if(jQuery('#popup').hasClass('hidden'))
     {

	jQuery('#opaco').height(jQuery(document).height());
	jQuery('#opaco').toggleClass('hidden');
	jQuery('#opaco').animate({
	   "opacity": 0.7
	}, 500 );
	jQuery('#opaco').click(function(){jQuery(this).togglePopup();});

       	jQuery('#popup').html(jQuery(this).html());
        jQuery('#popup').alignCenter();
        jQuery('#popup').toggleClass('hidden');
     }
     else
     {
       //visible - then hide
       jQuery('#opaco').toggleClass('hidden').unbind('click');
       jQuery('#popup').toggleClass('hidden');
     }
   };
   
   
});



