function RESIZE_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '';
  if (isIE && isWin && !isOpera){
    str += '<object ';
    for (var i in objAttrs){
      str += i + '="' + objAttrs[i] + '" ';
    }
    str += '>';
    for (var i in params){
      str += '<param name="' + i + '" value="' + params[i] + '" /> ';
    }
    str += '</object>';
  }
  else{
    str += '<embed ';
    for (var i in embedAttrs){
      str += i + '="' + embedAttrs[i] + '" ';
    }
    str += '> </embed>';
  }
  return(str);
}

function RESIZE_FL_RunContent(){
  var ret = AC_GetArgs(  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000", "application/x-shockwave-flash");
  return(RESIZE_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs));
}

var previous_width = 0;
var previous_height = 0;

var showResizedFlash=function() {
	var current_width;
	var current_height;
	var content;
	current_width = $(window).getWidth();
	current_height = $(window).getHeight();		
	if(current_height < 680 && (previous_height >= 680 || previous_height == 0) ){
		content=RESIZE_FL_RunContent(
						'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
						'width', small_width,
						'height', small_height,
						'src', swf_small_src,
						'quality', 'high',
						'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
						'align', 'middle',
						'play', 'true',
						'loop', 'true',
						'scale', 'showall',
						'wmode', 'opaque',
						'devicefont', 'false',
						'bgcolor', '#000000',
						'name', 'main',
						'menu', 'true',
						'allowFullScreen', 'false',
						'allowScriptAccess','sameDomain',
						'movie', 'flash/' + swf_small_src,
						'salign', '',
						'FlashVars', 'xmlPath='+ xml_src + '_small.xml'
						);
		$('flash').set('html', content);
	}
	else if(current_height >= 680 && (previous_height <= 680 || previous_height == 0)){
		content=RESIZE_FL_RunContent(
						'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
						'width', large_width,
						'height', large_height,
						'src', swf_large_src,
						'quality', 'high',
						'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
						'align', 'middle',
						'play', 'true',
						'loop', 'true',
						'scale', 'showall',
						'wmode', 'opaque',
						'devicefont', 'false',
						'bgcolor', '#000000',
						'name', 'main',
						'menu', 'true',
						'allowFullScreen', 'false',
						'allowScriptAccess','sameDomain',
						'movie', 'flash/' + swf_large_src,
						'salign', '',
						'FlashVars', 'xmlPath='+ xml_src + '_big.xml'
						);
		$('flash').set('html', content);
	}
	previous_width = current_width;
	previous_height = current_height;
};

window.addEvent('domready', function(){window.addEvent('resize', function(){showResizedFlash();});showResizedFlash();});

