
function createFlashcode(sourse, flashVars, version, width, hight, flash_id){
  
  var tag = new FlashTag(sourse, width, hight); // last two arguments are height and width
  tag.setId(flash_id);
  if(version && version != null){
    tag.setVersion(version);  
  }
  if(flashVars && flashVars != null){
    tag.setFlashvars(flashVars);
  }
  
  if (flashVars == 'flash_swf') {
    tag.write_div();  
  } else {
    tag.write(document);    
  }
  return;
}


var _w;
var _h;
var _id;
function fuckMe(w, h, id) {
  
  //alert(w+ ' ' +h);

  if (id) {    
    var currnet_w = parseInt(getClientWidth());
    if (parseInt(w) > currnet_w/2) {       
      h = parseInt((currnet_w/(2*w))*parseInt(h));
      w = parseInt(currnet_w/2);
    }
    /*if (parseInt(w) > 494) {   //595    
      h = parseInt((494/w)*parseInt(h)) + 36;
      w = parseInt(494) + 101;
    }*/
    w = parseInt(w) + 101;
    h = parseInt(h) + 36;
    //alert(w+ ' ' +h);
    $('#'+id).attr('width', w);
    $('#'+id).attr('height', h);
  }
  
  _w = w;
  _h = h;
  _id = id;
}

function getClientWidth()
{
  return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientWidth:document.body.clientWidth;
}


// Bind resize event to the window
//$(window).resize( fuckMe(w, h, id) );
/*window.onresize = function(){
	fuckMe(_w, _h, _id);
}*/








