﻿
function browserWidth() {
   if (self.innerWidth) {
	return self.innerWidth;
   } else if (document.documentElement && document.documentElement.clientWidth) {
	return document.documentElement.clientWidth;
   } else if (document.body) {
	return document.body.clientWidth;
   }
   return 630;
}

function browserHeight() {
   if (self.innerWidth) {
	return self.innerHeight;
   } else if (document.documentElement && document.documentElement.clientWidth) {
	return document.documentElement.clientHeight;
   } else if (document.body) {
	return document.body.clientHeight;
   }
   return 470;
}

function resize_unique_object() {

	if(navigator.appVersion.match(/\bMSIE\b/)) {

	  var obj = document.getElementsByTagName('object');
	} else {

		var obj = document.getElementsByTagName('embed');
	}

				var embedded = obj[0];

				var  width_bw     = ( browserWidth() / 100 ) * 90;
				var  height_bw     = ( browserHeight() / 100 ) * 90;

				if( ((  width_bw / 4 ) * 3) > height_bw ) {
            new_width =  ( height_bw / 3 ) * 4;
            new_height = height_bw;
				} else {
            new_width =  width_bw;
            new_height = ( height_bw / 4 ) * 3;
				}
				embedded.width = new_width;
				embedded.height = new_height;
}

if(window.onload == undefined) {

      window.onload = resize_unique_object;
} else {
      old_window = window.onload;
			window.onload = function() {
          old_window();
          resize_unique_object();
			}
}

if(window.onresize == undefined) {

      window.onresize = resize_unique_object;
} else {
      old_resize = window.onresize;
			window.onresize = function() {
          old_resize();
          resize_unique_object();
			}
}