var popupWins = new Array();

function openWin(url, size_x, size_y, scroll, name, resizable) {
	if(name == "undefined") {
		name = "win";
	}
	if(scroll == undefined) {
		scroll = "no";
	}
	
	if(resizable == undefined) {
		resizable = "no";
	}
	
	
	if ( typeof( popupWins[name] ) == "object" ){
		if (!popupWins[name].closed) {
			popupWins[name].close();
		}
	}
	
	if(size_x==0 && size_y==0) { size_1=600, size_2=500 } else { size_1=size_x, size_2=size_y }
	LeftPosition = (screen.width) ? (screen.width-size_x)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-size_y)/2 : 0;
	
	msgWindow = window.open(url, name, "width="+size_1+",height="+size_2+", top="+TopPosition+", left="+LeftPosition+",  resizable="+resizable+", status='no', toolbar='no', menubar='no', scrollbars="+scroll+" ");
	if(window.focus) {
		msgWindow.focus();
	}
	
	popupWins[name] = msgWindow;
	return msgWindow;
}


function add_flash(url, params, vars, w, h, version, id) 
{		
	document.write('<object id="'+id+'" type="application/x-shockwave-flash" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+version+'" width="'+w+'" height="'+h+'" >\n');
	document.write('<param name="movie" value="'+url+'"/>\n');
	
	var a = new Array();
	a = params;
	var emb = "";
	for(var i = 0; i < a.length; i++) {
		document.write('<param name="'+a[i][0]+'" value="'+a[i][1]+'"/>\n');
		emb += a[i][0]+'="'+a[i][1]+'" '; 
	}
	
	document.write('<embed name="'+id+'" src="'+url+'" flashvars="'+vars+'" '+emb+' pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'"></embed>\n');
	document.write('</object>\n');	
}

function getFlashMovieObject(movieName) {
  if (window.document[movieName]) {  	
      return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1) {
    if (document.embeds && document.embeds[movieName]) {    	
      return document.embeds[movieName]; 
    }
  } else {  	
    return document.getElementById(movieName);
  }
}
