function handhistory_player(type,id,dir,design,width,height,load,switcher,linker) {
	document.write('<div style="position: relative; display: block; width:'+width+'px; height:'+height+'px; margin: auto; padding: 0px; border: 0px;">\n');
	document.write('<div id="_handhistory_player_'
	+type+'_'+id+'" style="width:'+width+'px; height:'+height+'px; background: url(\''+dir+'img/ajax-loader-circle-big.gif\') center center no-repeat; background-color: none;"></div>\n');
	if(1) {
		var link = dir+'hand_history.php?'+(type=='hand'?'hhh':'hhs')+'_id='+id;
		document.write('<div style="position: absolute; bottom: -12px; left: 50%; width: 100px; margin-left: -50px; text-align: center;">\n');
		//document.write('<a href="'+link+'" style="float: right; margin-right: 4px; font-size: 10px; color: #000000; font-variant: small-caps; text-decoration: none;">'+dir+'</a>');
		document.write('<a href="'+link+'" style="float: right; margin-right: 4px; font-size: 10px; color: #000000; font-variant: small-caps; text-decoration: none;">HandHistory.Hu</a>');
		document.write('</div>\n');
	}
	if(switcher) {
		document.write('<div style="position: absolute; bottom: -12px; right: 0px;">\n');
		document.write('<a href="javascript:handhistory_player_load_html(\''+type+'\',\''+id+'\',\''+dir+'\',\''+design+'\','+width+','+height+')" style="float: right; margin-right: 4px; font-size: 10px; color: #000000; font-variant: small-caps; text-decoration: none;">text</a>');
		document.write('<a href="javascript:handhistory_player_load_flash(\''+type+'\',\''+id+'\',\''+dir+'\',\''+design+'\','+width+','+height+')" style="float: right; margin-right: 4px; font-size: 10px; color: #000000; font-variant: small-caps; text-decoration: none;">flash</a>');
		document.write('</div>\n');
	}
	if(linker) {
		document.write('<div style="position: absolute; bottom: -12px; left: 0px;">\n');
		document.write('<a href="javascript:handhistory_player_load_linker(\''+type+'\',\''+id+'\',\''+dir+'\',\''+design+'\','+width+','+height+')" style="float: left; margin-left: 4px; font-size: 10px; color: #000000; font-variant: small-caps; text-decoration: none;">link</a>');
		document.write('</div>\n');
	}
	document.write('</div>\n');

	//window.onload = handhistory_player_onload.bindAsEventListener(this,type,id,dir,design,width,height,load);
	handhistory_player_onload(this,type,id,dir,design,width,height,load);

}

function handhistory_player_onload(e,type,id,dir,design,width,height,load) {
	switch(load) {
		case 'flash': {
			handhistory_player_load_flash(type,id,dir,design,width,height);
			break;
		}
		case 'html': {
			handhistory_player_load_html(type,id,dir,design,width,height);
			break;
		}
	}
	document.getElementById('_handhistory_player_'+type+'_'+id).style.background = "none";
}

function handhistory_player_load_flash(type,id,dir,design,width,height) {
	document.getElementById('_handhistory_player_'+type+'_'+id).innerHTML = handhistory_player_flash_code(type,id,dir,design,width,height);
}

function handhistory_player_load_html(type,id,dir,design,width,height) {
	document.getElementById('_handhistory_player_'+type+'_'+id).innerHTML = handhistory_player_html_code(type,id,dir,design,width,height);
}

function handhistory_player_load_linker(type,id,dir,design,width,height) {
	document.getElementById('_handhistory_player_'+type+'_'+id).innerHTML = handhistory_player_linker_code(type,id,dir,design,width,height);

	var link = dir+'hand_history.php?'+(type=='hand'?'hhh':'hhs')+'_id='+id;
	var html_code = handhistory_player_insert_code(type,id,dir,design,width,height);
	var commendatory = handhistory_player_insert_commendatory(type,id,dir);

	document.getElementById('_linker_link').value = link;
	document.getElementById('_linker_html_code').value = html_code;
	if(type=='hand') {
		document.getElementById('_linker_commendatory').value = commendatory;
	}
}

function handhistory_player_flash_code(type,id,dir,design,width,height) {
	var xml = dir+'hand_history/hand_history_xml.php?'+(type=='hand'?'hhh':'hhs')+'_id='+id;
	
	var hh = '';
	hh+= '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+width+'" height="'+height+'" id="flashplayer" align="middle">\n';
	hh+= '<param name="allowScriptAccess" value="sameDomain" />\n';
	hh+= '<param name="movie" value="'+dir+'hand_history/flash_player/player.swf" />\n';
	hh+= '<param name="quality" value="high" />\n';
	hh+= '<param name="bgcolor" value="#ffffff" />\n';
	hh+= '<param name=FlashVars value="logXML='+xml+'&design='+dir+'hand_history/flash_player/'+design+'/">\n';
	hh+= '<embed src="'+dir+'hand_history/flash_player/player.swf" FlashVars="logXML='+xml+'&design='+dir+'hand_history/flash_player/'+design+'/" quality="high" bgcolor="#000000" width="'+width+'" height="'+height+'" name="flashplayer" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginsxml="http://www.macromedia.com/go/getflashplayer" />\n';
	hh+= '</object>\n';

	return hh;
}

function handhistory_player_html_code(type,id,dir,design,width,height) {
	var html = dir+'hand_history/hand_history_html.php?'+(type=='hand'?'hhh':'hhs')+'_id='+id;
	
	var hh = '';
	hh+= '<iframe src="'+html+'" frameborder="0" scrolling="auto" style="width:'+width+'px; height:'+height+'px; margin: auto; padding: 0px; border: 0px; background-color: #ffffff;""></iframe>\n';

	return hh;
}

function handhistory_player_insert_code(type,id,dir,design,width,height) {
	var html = dir+'hand_history/hand_history_html.php?'+(type=='hand'?'hhh':'hhs')+'_id='+id;
	
	var code = '';
	code+= '<script type="text/javascript" src="'+dir+'handhistory/js/handhistory_player.js"></script>';
	code+= '<script type="text/javascript">';
	code+= 'handhistory_player(\''+type+'\',\''+id+'\',\''+dir+'\',\''+design+'\','+width+','+height+',\'flash\',1,1);';
	code+= '</script>';

	return code;
}

function handhistory_player_insert_commendatory(type,id,dir) {
	var html = dir+'hand_history/hand_history_commendatory.php?w=select&p='+id;
	
	var code = '';
	code+= '<script type="text/javascript" src="'+dir+'handhistory/js/handhistory_commendatory.js"></script>';
	code+= '<script type="text/javascript">';
	code+= 'handhistory_commendatory(\'select\',\''+id+'\',\''+dir+'\',138,58);';
	code+= '</script>';

	return code;
}

function handhistory_player_linker_code(type,id,dir,design,width,height) {
	
	var linker = '';
	linker+= '<div id="_linker" style="width:'+(width-20)+'px; height:'+(height-10)+'px; margin: auto; margin-top: 0px; padding-top: 10px; font-size: 11px;">';
	linker+= "<p>\n";
	linker+= '<label for="_linker_link">insert link:</label><br />\n';
	linker+= '<input id="_linker_link" type="text" value="" style="width: 100%;" onclick="this.select()">\n';
	linker+= "</p>\n";
	linker+= "<p>\n";
	linker+= '<label for="_linker_html_code">insert HTML code [flash player]:</label><br />\n';
	linker+= '<textarea id="_linker_html_code" style="width: 100%; height: 80px;" onclick="this.select()"></textarea>\n';
	linker+= "</p>\n";
	if(type=='hand') {
		linker+= "<p>\n";
		linker+= '<label for="_linker_commendatory">insert HTML code [commendatory]:</label><br />\n';
		linker+= '<textarea id="_linker_commendatory" style="width: 100%; height: 60px;" onclick="this.select()"></textarea>\n';
		linker+= "</p>\n";
	}

	return linker;
}