function getWinSize()
   {
      var myWidth = 0, myHeight = 0;
      if( typeof( window.innerWidth ) == 'number' )
      {
         //Non-IE
         myWidth = window.innerWidth;
         myHeight = window.innerHeight;
      }
      else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))
      {
          //IE 6+ in 'standards compliant mode'
          myWidth = document.documentElement.clientWidth;
          myHeight = document.documentElement.clientHeight;
      }
      else if(document.body && (document.body.clientWidth || document.body.clientHeight))
      {
          //IE 4 compatible
          myWidth = document.body.clientWidth;
          myHeight = document.body.clientHeight;
      }
	  
      return {w:myWidth,h:myHeight}
      
   }

function aleatori(inferior,superior){ 
   	var numPosib = superior - inferior;
   	var aleat = Math.random() * numPosib; 
   	aleat = Math.round(aleat);
   	return parseInt(inferior) + aleat;
}

function finestra_tam(ruta,amplada,alcada){
    //var	amplada=350;
	//var alcada=250;
	var winSizes = getWinSize();
	var amp=winSizes.w;
	var llarg=winSizes.h;
	var pos_top=parseInt((llarg/2)-(alcada/2))+"";
	var pos_left=parseInt((amp/2)-(amplada/2))+"";
    window.open(ruta,'finestra'+aleatori(0,1000),'scrollbars=yes,width='+amplada+',height='+alcada+',top='+pos_top+',left='+pos_left);
	//alert("amplada: "+amplada+", alçada: "+alcada+"amplada navegador: "+amp+", alçada navegador: "+llarg);
	}

function adjustFlashSize(){
	
	  var id="w10";
	
      var winSizes = getWinSize();
      
      
      var flashObj = document.getElementById(id);
      
      if(winSizes.w < 950)
      {
         flashObj.style.width = "950px";
      }
      else
      {
         flashObj.style.width = "100%";
      }
      if(winSizes.h < 670)
      {
         flashObj.style.height = "670px";
      }
      else
      {
         flashObj.style.height = (winSizes.h) + "px";
      }

   }

function addEvent(obj, evType, fn){ 
 if (obj.addEventListener){ 
   obj.addEventListener(evType, fn, false); 
   return true; 
 } else if (obj.attachEvent){ 
   var r = obj.attachEvent("on"+evType, fn); 
   return r; 
 } else { 
   return false; 
 } 
}

addEvent(window,'load',adjustFlashSize);
addEvent(window,'resize',adjustFlashSize);
