/*	SWFObject v2.2 <http://code.google.com/p/swfobject/>
	is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
function setDivSize(w , h) {

      // CONST
      var header = 20;
      var footer = 50;
      var extraHeight = header + footer; 	// header & footer
      var menuWidth = 260; 	// menu only
      var extraWidth = 45; 	// spacing
      var spacingTop = 0.05;	// 5 percent top & bottom spacing
      var pictureAspectRation = 1.5;
	  var minWidth = 760;
	  var minHeight = 420;

	  var contentMargin = 0.03; // 3 percent left & right margin

	  // check minimum size
	  if (w < minWidth)
	  {
		w = minWidth;
	  }
	  if (h < minHeight)
	  {
		h = minHeight;
	  }

      // calculate picture only
      availablePictureWidth = w  - menuWidth - extraWidth;
      availablePictureWidthByHeight = ((h * (1 - (spacingTop * 2))) - extraHeight) * pictureAspectRation;

      // find out what to resize
		if(availablePictureWidthByHeight < availablePictureWidth)
		{
			// widescreen
			var swfWidth = availablePictureWidthByHeight + menuWidth + extraWidth;
			var swfHeight = h * (1 - (spacingTop * 2)) - extraHeight;
			var left = (w - (swfWidth)) / 2;
			$j("#contentwrapper").css({'top' : "5%"});
			$j("#contentwrapper").css({'left' : left});
		    $j("#contentwrapper").css({'width' : (swfWidth)});
			$j("#contentwrapper").css({'height' : (swfHeight + extraHeight)});

			$j("#flashcontentwrapper").css({'margin-top' : header});
		    $j("#flashcontentwrapper").css({'width' : (availablePictureWidthByHeight + menuWidth + extraWidth)});
			$j("#flashcontentwrapper").css({'height' : swfHeight});

			var contentWidth = (swfWidth - menuWidth - extraWidth) * 10 / 18;
			var blogcontentWidth = (swfWidth - menuWidth - extraWidth);
			var contentPadding = contentMargin * contentWidth;

			$j("#content").css({'width' : contentWidth - 2 * contentPadding});
			$j("#content").css({'padding-left' : contentPadding});
			$j("#content").css({'padding-right' : contentPadding});
			$j("#content").css({'height' : swfHeight});
			$j("#blogcontent").css({'width' : blogcontentWidth - 2 * contentPadding});
			$j("#blogcontent").css({'padding-left' : contentPadding});
			$j("#blogcontent").css({'padding-right' : contentPadding});
			$j("#blogcontent").css({'height' : swfHeight});
		}
		else
		{
		   // normal screen
			var swfHeight = availablePictureWidth / pictureAspectRation;
			var top = (h  - (swfHeight + extraHeight)) / 2;
			$j("#contentwrapper").css({'top' : top});
			$j("#contentwrapper").css({'left' : "0"});
			$j("#contentwrapper").css({'width' : w});
			$j("#contentwrapper").css({'height' : swfHeight + extraHeight});

			$j("#flashcontentwrapper").css({'margin-top' : header});
		    $j("#flashcontentwrapper").css({'width' : w});
			$j("#flashcontentwrapper").css({'height' : swfHeight});

			var contentWidth = (w - menuWidth - extraWidth) * 10 / 18;
			var blogcontentWidth = w - menuWidth - extraWidth;

			$j("#content").css({'width' : contentWidth * (1 - 2 * contentMargin)});
			$j("#content").css({'padding-left' : contentWidth * contentMargin});
			$j("#content").css({'padding-right' : contentWidth * contentMargin});
			$j("#content").css({'height' : swfHeight});
			$j("#blogcontent").css({'width' : blogcontentWidth * (1 - 2 * contentMargin)});
			$j("#blogcontent").css({'padding-left' : blogcontentWidth * contentMargin});
			$j("#blogcontent").css({'padding-right' : blogcontentWidth * contentMargin});
			$j("#blogcontent").css({'height' : swfHeight});
		}
	}

	function setZeroSidebarMargin() {
			$j("#sidebar").css({'margin-top' : "60px"});
	}

