//additional properties for jQuery object
$(document).ready(function(){
   //align element in the middle of the screen
   $.fn.alignCenter = function() {
      //get margin left
      var marginLeft = Math.max(40, parseInt($(window).width()/2 - $(this).width()/2)) + 'px';
      //get margin top
      var marginTop = Math.max(40, parseInt($(window).height()/2 - $(this).height()/2)) + 'px';
      //return updated element
      return $(this).css({'margin-left':marginLeft, 'margin-top':marginTop});
   };

});

/*****************************
**     Popup message
******************************/

//close pop-up box
function closePopup()
 {
   $('#opaco').toggleClass('hidden').removeAttr('style');
   $('#popup').toggleClass('hidden');
   return false;
 }

//open pop-up
function showPopup(popup_type)
 {
   /*
   if($.browser.msie)
   {
     $('#opaco').height($(document).height()).toggleClass('hidden');
   }
   else
   //in all the rest browsers - fade slowly
   {
     $('#opaco').height($(document).height()).toggleClass('hidden').fadeTo('slow', 0.7);
   }
	*/
   $('#popup')
     .html($('#popup_' + popup_type).html())
     .alignCenter()
     .toggleClass('hidden');

   return false;
 }
 
 function showRutube(id) {
	document.getElementById('bugContent').innerHTML = '<OBJECT width="470" height="353"><PARAM name="movie" value="http://video.rutube.ru/' + id + '"></PARAM><PARAM name="wmode" value="window"></PARAM><PARAM name="allowFullScreen" value="true"></PARAM><EMBED src="http://video.rutube.ru/' + id + '" type="application/x-shockwave-flash" wmode="window" width="470" height="353" allowFullScreen="true" ></EMBED></OBJECT>';
}