<?php
function Select ($name, $width, $height, $image, $type) {
	$selectl =  $name;
	$selectf = "ifram_" . $name;
	if ($type == "media") {
		$string_select = "<table width=\"100%\" border=\"0\" cellpadding=\"0%\" cellspacing=\"0\" bgcolor=\"#c0c0c0\">";
		$string_select .= "<tr><td height=21 style=\"font-size:12px;\" onMouseOver=\"parent.mouseovercolor(this,\'#000080\');parent.showimage(\'rel\');\" onMouseOut=\"parent.mouseoutcolor(this,\'#c0c0c0\');parent.hiddenimage (\'rel\');\" onClick=\"parent.hiddenselect" . $selectl  . "();parent.RealPlayer(\'RealPlayer\',\'\');\"><img src=\"images/rel.gif\" id=\"relimg\"></td></tr>";
		$string_select .= "<tr><td height=21 style=\"font-size:12px;\" onMouseOver=\"parent.mouseovercolor(this,\'#000080\');parent.showimage(\'mid\');\" onMouseOut=\"parent.mouseoutcolor(this,\'#c0c0c0\');parent.hiddenimage (\'mid\');\" onClick=\"parent.hiddenselect" . $selectl  . "();parent.MediaPlayer(\'MediaPlayer\',\'\');\"><img src=\"images/mid.gif\" id=\"midimg\"></td></tr>";
		$string_select .= "</table>";
	} else if ($type == "edit") {
		$string_select = "<table width=\"100%\" border=\"0\" cellpadding=\"0%\" cellspacing=\"0\" bgcolor=\"#c0c0c0\">";
		$string_select .= "<tr><td height=21 style=\"font-size:12px;\" onmouseover=\"parent.mouseovercolor(this,\'#000080\');parent.showimage(\'undo\')\" onmouseout=\"parent.mouseoutcolor(this,\'#c0c0c0\');parent.hiddenimage(\'undo\');\" onClick=\"parent.hiddenselect" . $selectl  . " ();parent.doFormat(\'Undo\');\"><img id=\"undoimg\" src=\"images/undo.gif\"></td></tr>";
		$string_select .= "<tr><td height=21 style=\"font-size:12px;\" onmouseover=\"parent.mouseovercolor(this,\'#000080\');parent.showimage(\'redo\')\" onMouseOut=\"parent.mouseoutcolor(this,\'#c0c0c0\');parent.hiddenimage(\'redo\');\" onClick=\"parent.hiddenselect" . $selectl  . "();parent.doFormat(\'Redo\');\"><img src=\"images/redo.gif\" id=\"redoimg\"></td></tr>";
		$string_select .= "<tr><td height=1 bgcolor=\"#999999\"><img src=\"no.gif\" width=\"1\" height=\"1\"></td></tr>";
		$string_select .= "<tr><td height=1 bgcolor=\"#ffffff\"><img src=\"no.gif\" width=\"1\" height=\"1\"></td></tr>";
		$string_select .= "<tr><td height=21 style=\"font-size:12px;\" onMouseOver=\"parent.mouseovercolor(this,\'#000080\');parent.showimage(\'cut\');\" onMouseOut=\"parent.mouseoutcolor(this,\'#c0c0c0\');parent.hiddenimage (\'cut\');\" onClick=\"parent.hiddenselect" . $selectl  . "();parent.doFormat(\'Cut\');\"><img src=\"images/cutd.gif\" id=\"cutimg\"></td></tr>";
		$string_select .= "<tr><td height=21 style=\"font-size:12px;\" onMouseOver=\"parent.mouseovercolor(this,\'#000080\');parent.showimage(\'copy\');\" onMouseOut=\"parent.mouseoutcolor(this,\'#c0c0c0\');parent.hiddenimage (\'copy\');\" onClick=\"parent.hiddenselect" . $selectl  . "();parent.doFormat(\'Copy\');\"><img src=\"images/copyd.gif\" id=\"copyimg\"></td></tr>";
		$string_select .= "<tr><td height=21 style=\"font-size:12px;\" onMouseOver=\"parent.mouseovercolor(this,\'#000080\');parent.showimage(\'paste\');\" onMouseOut=\"parent.mouseoutcolor(this,\'#c0c0c0\');parent.hiddenimage (\'paste\');\" onClick=\"parent.hiddenselect" . $selectl  . "();parent.doFormat(\'Paste\');\"><img src=\"images/paste.gif\" id=\"pasteimg\"></td></tr>";
		$string_select .= "<tr><td height=21 style=\"font-size:12px;\" onMouseOver=\"parent.mouseovercolor(this,\'#000080\');parent.showimage(\'delete\');\" onMouseOut=\"parent.mouseoutcolor(this,\'#c0c0c0\');parent.hiddenimage (\'delete\');\" onClick=\"parent.hiddenselect" . $selectl  . "();parent.doFormat(\'Delete\');\"><img src=\"images/deleted.gif\" id=\"deleteimg\"></td></tr>";
		$string_select .= "</table>";
	} else if ($type == "font") {
		$string_select = "<table width=\"100%\" border=\"0\" cellpadding=\"0%\" cellspacing=\"0\" bgcolor=\"#c0c0c0\">";
		$string_select .= "<tr><td height=21 style=\"font-size:12px;\" onmouseover=\"parent.mouseovercolor(this,\'#000080\');parent.showimage(\'bold\')\" onmouseout=\"parent.mouseoutcolor(this,\'#c0c0c0\');parent.hiddenimage(\'bold\')\" onClick=\"parent.hiddenselect" . $selectl  . " ();parent.doFormat(\'Bold\');\"><img src=\"images/boldd.gif\" id=\"boldimg\"></td></tr>";
		$string_select .= "<tr><td height=21 style=\"font-size:12px;\" onmouseover=\"parent.mouseovercolor(this,\'#000080\');parent.showimage(\'italic\')\" onMouseOut=\"parent.mouseoutcolor(this,\'#c0c0c0\');parent.hiddenimage(\'italic\');\" onclick=\"parent.hiddenselect" . $selectl  . "();parent.doFormat(\'Italic\');\"><img id=\"italicimg\" src=\"images/italicd.gif\"></td></tr>";
		$string_select .= "<tr><td height=21 style=\"font-size:12px;\" onMouseOver=\"parent.mouseovercolor(this,\'#000080\');parent.showimage(\'underline\');\" onMouseOut=\"parent.mouseoutcolor(this,\'#c0c0c0\');parent.hiddenimage (\'underline\');\" onClick=\"parent.hiddenselect" . $selectl  . "();parent.doFormat(\'Underline\');\"><img id=\"underlineimg\" src=\"images/underlined.gif\"></td></tr>";
		$string_select .= "<tr><td height=21 style=\"font-size:12px;\" onMouseOver=\"parent.mouseovercolor(this,\'#000080\');parent.showimage(\'strikethrough\');\" onMouseOut=\"parent.mouseoutcolor(this,\'#c0c0c0\');parent.hiddenimage (\'strikethrough\');\" onClick=\"parent.hiddenselect" . $selectl  . "();parent.doFormat(\'StrikeThrough\');\"><img src=\"images/deld.gif\" id=\"strikethroughimg\"></td></tr>";
		$string_select .= "<tr><td height=1 bgcolor=\"#999999\"><img src=\"no.gif\" width=\"1\" height=\"1\"></td></tr>";
		$string_select .= "<tr><td height=1 bgcolor=\"#ffffff\"><img src=\"no.gif\" width=\"1\" height=\"1\"></td></tr>";
		$string_select .= "<tr><td height=21 style=\"font-size:12px;\" onMouseOver=\"parent.mouseovercolor(this,\'#000080\');parent.showimage (\'forecolor\');\" onMouseOut=\"parent.mouseoutcolor(this,\'#c0c0c0\');parent.hiddenimage(\'forecolor\');\" onClick=\"parent.hiddenselect" . $selectl  . "();parent.callColorDlg(\'ForeColor\');\"><img src=\"images/fgcolor.gif\" id=\"forecolorimg\"></td></tr>";
		$string_select .= "<tr><td height=21 style=\"font-size:12px;\" onMouseOver=\"parent.mouseovercolor (this,\'#000080\');parent.showimage (\'backcolor\');\" onMouseOut=\"parent.mouseoutcolor(this,\'#c0c0c0\');parent.hiddenimage(\'backcolor\');\" onClick=\"parent.hiddenselect" . $selectl  . "();parent.callColorDlg(\'BackColor\');\"><img src=\"images/backcolor.gif\" id=\"backcolorimg\"></td></tr>";
		$string_select .= "<tr><td height=1 bgcolor=\"#999999\"><img src=\"no.gif\" width=\"1\" height=\"1\"></td></tr>";
		$string_select .= "<tr><td height=1 bgcolor=\"#ffffff\"><img src=\"no.gif\" width=\"1\" height=\"1\"></td></tr>";
		$string_select .= "<tr><td height=21 style=\"font-size:12px;\" onmouseover=\"parent.mouseovercolor(this,\'#000080\');parent.showimage(\'superscript\')\" onmouseout=\"parent.mouseoutcolor(this,\'#c0c0c0\');parent.hiddenimage(\'superscript\')\" onClick=\"parent.hiddenselect" . $selectl  . " ();parent.doFormat(\'superscript\');\"><img src=\"images/upd.gif\" id=\"superscriptimg\"></td></tr>";
		$string_select .= "<tr><td height=21 style=\"font-size:12px;\" onmouseover=\"parent.mouseovercolor(this,\'#000080\');parent.showimage(\'subscript\')\" onMouseOut=\"parent.mouseoutcolor(this,\'#c0c0c0\');parent.hiddenimage(\'subscript\');\" onClick=\"parent.hiddenselect" . $selectl  . "();parent.doFormat(\'Subscript\');\"><img src=\"images/downd.gif\" id=\"subscriptimg\"></td></tr>";
		$string_select .= "</table>";
	} else if ($type == "p") {
		$string_select = "<table width=\"100%\" border=\"0\" cellpadding=\"0%\" cellspacing=\"0\" bgcolor=\"#c0c0c0\">";
		$string_select .= "<tr><td height=21 style=\"font-size:12px;\" onmouseover=\"parent.mouseovercolor(this,\'#000080\');parent.showimage(\'none\')\" onmouseout=\"parent.mouseoutcolor(this,\'#c0c0c0\');parent.hiddenimage(\'none\');\" onClick=\"parent.hiddenselect" . $selectl  . " ();parent.doFormat(\'JustifyNone\');\"><img src=\"images/default.gif\" id=\"noneimg\"></td></tr>";
		$string_select .= "<tr><td height=21 style=\"font-size:12px;\" onmouseover=\"parent.mouseovercolor(this,\'#000080\');parent.showimage(\'left\')\" onMouseOut=\"parent.mouseoutcolor(this,\'#c0c0c0\');parent.hiddenimage(\'left\');\" onClick=\"parent.hiddenselect" . $selectl  . "();parent.doFormat(\'JustifyLeft\');\"><img src=\"images/jleft.gif\" id=\"leftimg\"></td></tr>";
		$string_select .= "<tr><td height=21 style=\"font-size:12px;\" onMouseOver=\"parent.mouseovercolor(this,\'#000080\');parent.showimage(\'center\');\" onMouseOut=\"parent.mouseoutcolor(this,\'#c0c0c0\');parent.hiddenimage (\'center\');\" onClick=\"parent.hiddenselect" . $selectl  . "();parent.doFormat(\'JustifyCenter\');\"><img src=\"images/jcenter.gif\" id=\"centerimg\"></td></tr>";
		$string_select .= "<tr><td height=21 style=\"font-size:12px;\" onMouseOver=\"parent.mouseovercolor(this,\'#000080\');parent.showimage(\'right\');\" onMouseOut=\"parent.mouseoutcolor(this,\'#c0c0c0\');parent.hiddenimage (\'right\');\" onClick=\"parent.hiddenselect" . $selectl  . "();parent.doFormat(\'JustifyRight\');\"><img src=\"images/jright.gif\" id=\"rightimg\"></td></tr>";
		$string_select .= "<tr><td height=1 bgcolor=\"#999999\"><img src=\"no.gif\" width=\"1\" height=\"1\"></td></tr>";
		$string_select .= "<tr><td height=1 bgcolor=\"#ffffff\"><img src=\"no.gif\" width=\"1\" height=\"1\"></td></tr>";
		$string_select .= "<tr><td height=21 style=\"font-size:12px;\" onMouseOver=\"parent.mouseovercolor(this,\'#000080\');parent.showimage(\'ol\');\" onMouseOut=\"parent.mouseoutcolor(this,\'#c0c0c0\');parent.hiddenimage (\'ol\');\" onClick=\"parent.hiddenselect" . $selectl  . "();parent.doFormat(\'FormatBlock\',\'&lt;OL&gt;\');\"><img src=\"images/ol.gif\" id=\"olimg\"></td></tr>";
		$string_select .= "<tr><td height=21 style=\"font-size:12px;\" onMouseOver=\"parent.mouseovercolor(this,\'#000080\');parent.showimage(\'ul\');\" onMouseOut=\"parent.mouseoutcolor(this,\'#c0c0c0\');parent.hiddenimage (\'ul\');\" onClick=\"parent.hiddenselect" . $selectl  . "();parent.doFormat(\'FormatBlock\',\'&lt;UL&gt;\');\"><img src=\"images/ul.gif\" id=\"ulimg\"></td></tr>";
		$string_select .= "<tr><td height=1 bgcolor=\"#999999\"><img src=\"no.gif\" width=\"1\" height=\"1\"></td></tr>";
		$string_select .= "<tr><td height=1 bgcolor=\"#ffffff\"><img src=\"no.gif\" width=\"1\" height=\"1\"></td></tr>";
		$string_select .= "<tr><td height=21 style=\"font-size:12px;\" onMouseOver=\"parent.mouseovercolor(this,\'#000080\');parent.showimage(\'outdent\');\" onMouseOut=\"parent.mouseoutcolor(this,\'#c0c0c0\');parent.hiddenimage (\'outdent\');\" onClick=\"parent.hiddenselect" . $selectl  . "();parent.doFormat(\'Outdent\');\"><img src=\"images/outdent.gif\" id=\"outdentimg\"></td></tr>";
		$string_select .= "<tr><td height=21 style=\"font-size:12px;\" onMouseOver=\"parent.mouseovercolor(this,\'#000080\');parent.showimage(\'indent\');\" onMouseOut=\"parent.mouseoutcolor(this,\'#c0c0c0\');parent.hiddenimage (\'indent\');\" onClick=\"parent.hiddenselect" . $selectl  . "();parent.doFormat(\'Indent\');\"><img src=\"images/indent.gif\" id=\"indentimg\"></td></tr>";
		$string_select .= "</table>";
	} else if ($type == "tablemenu") {
		$string_select = "<table width=\"100%\" border=\"0\" cellpadding=\"0%\" cellspacing=\"0\" bgcolor=\"#c0c0c0\">";
		$string_select .= "<tr><td height=21 style=\"font-size:12px;\" onmouseover=\"parent.mouseovercolor(this,\'#000080\');parent.showimage(\'table\')\" onmouseout=\"parent.mouseoutcolor(this,\'#c0c0c0\');parent.hiddenimage(\'table\')\" onClick=\"parent.hiddenselect" . $selectl  . " ();parent.format(\'table\',\'\');\"><img src=\"images/table.gif\" id=\"tableimg\"></td></tr>";
		$string_select .= "<tr><td height=21 style=\"font-size:12px;\" onmouseover=\"parent.mouseovercolor(this,\'#000080\');parent.showimage(\'tablep\')\" onMouseOut=\"parent.mouseoutcolor(this,\'#c0c0c0\');parent.hiddenimage(\'tablep\');\" onclick=\"parent.hiddenselect" . $selectl  . "();parent.MTable();\"><img src=\"images/tbpro.gif\" id=\"tablepimg\"></td></tr>";
		$string_select .= "<tr><td height=21 style=\"font-size:12px;\" onMouseOver=\"parent.mouseovercolor(this,\'#000080\');parent.showimage(\'cellpro\');\" onMouseOut=\"parent.mouseoutcolor(this,\'#c0c0c0\');parent.hiddenimage (\'cellpro\');\" onClick=\"parent.hiddenselect" . $selectl  . "();parent.MCell();\"><img src=\"images/cellpro.gif\" id=\"cellproimg\"></td></tr>";
		$string_select .= "<tr><td height=1 bgcolor=\"#999999\"><img src=\"no.gif\" width=\"1\" height=\"1\"></td></tr>";
		$string_select .= "<tr><td height=1 bgcolor=\"#ffffff\"><img src=\"no.gif\" width=\"1\" height=\"1\"></td></tr>";
		$string_select .= "<tr><td height=21 style=\"font-size:12px;\" onMouseOver=\"parent.mouseovercolor(this,\'#000080\');parent.showimage (\'rowabove\');\" onMouseOut=\"parent.mouseoutcolor(this,\'#c0c0c0\');parent.hiddenimage(\'rowabove\');\" onClick=\"parent.hiddenselect" . $selectl  . "();parent.insrowabove();\"><img src=\"images/rowabove.gif\" id=\"rowaboveimg\"></td></tr>";
		$string_select .= "<tr><td height=21 style=\"font-size:12px;\" onMouseOver=\"parent.mouseovercolor (this,\'#000080\');parent.showimage (\'rowbellow\');\" onMouseOut=\"parent.mouseoutcolor(this,\'#c0c0c0\');parent.hiddenimage(\'rowbellow\');\" onClick=\"parent.hiddenselect" . $selectl  . "();parent.insrowbelow();\"><img src=\"images/rowbellow.gif\" id=\"rowbellowimg\"></td></tr>";
		$string_select .= "<tr><td height=21 style=\"font-size:12px;\" onMouseOver=\"parent.mouseovercolor (this,\'#000080\');parent.showimage (\'colafter\');\" onMouseOut=\"parent.mouseoutcolor(this,\'#c0c0c0\');parent.hiddenimage (\'colafter\');\" onClick=\"parent.hiddenselect" . $selectl  . "();parent.inscolbefore();\"><img src=\"images/colafter.gif\" id=\"colafterimg\"></td></tr>";
		$string_select .= "<tr><td height=21 style=\"font-size:12px;\" onMouseOver=\"parent.mouseovercolor (this,\'#000080\');parent.showimage (\'colbefore\');\" onMouseOut=\"parent.mouseoutcolor(this,\'#c0c0c0\');parent.hiddenimage (\'colbefore\');\" onClick=\"parent.hiddenselect" . $selectl  . "();parent.inscolafter();\"><img src=\"images/colbefore.gif\" id=\"colbeforeimg\"></td></tr>";
		$string_select .= "<tr><td height=21 style=\"font-size:12px;\" onmouseover=\"parent.mouseovercolor(this,\'#000080\');parent.showimage(\'delcol\')\" onmouseout=\"parent.mouseoutcolor(this,\'#c0c0c0\');parent.hiddenimage(\'delcol\')\" onClick=\"parent.hiddenselect" . $selectl  . " ();parent.deletecol();\"><img src=\"images/delcol.gif\" id=\"delcolimg\"></td></tr>";
		$string_select .= "<tr><td height=21 style=\"font-size:12px;\" onmouseover=\"parent.mouseovercolor(this,\'#000080\');parent.showimage(\'delrow\')\" onMouseOut=\"parent.mouseoutcolor(this,\'#c0c0c0\');parent.hiddenimage(\'delrow\');\" onClick=\"parent.hiddenselect" . $selectl  . "();parent.deleterow();\"><img src=\"images/delrow.gif\" id=\"delrowimg\"></td></tr>";
		$string_select .= "<tr><td height=1 bgcolor=\"#999999\"><img src=\"no.gif\" width=\"1\" height=\"1\"></td></tr>";
		$string_select .= "<tr><td height=1 bgcolor=\"#ffffff\"><img src=\"no.gif\" width=\"1\" height=\"1\"></td></tr>";
		$string_select .= "</table>";
	}
	$string = "<script>
function showselect" . $selectl  . " () {
	if ($selectl.style.visibility == 'hidden') {
		$selectl.style.visibility = 'visible';
		$selectf.document.body.innerHTML = '$string_select';
	} else {
		$selectl.style.visibility = 'hidden';
	}
}
function hiddenselect" . $selectl  . " () {
	$selectl.style.visibility = 'hidden';
}
	</script>
	<table border=0 cellpadding=0 cellspacing=0>
					<tr>
						<td><img src=images/" . $image . " onClick=\"showselect".$selectl."();\"></td>
					</tr>
					<tr>
						<td height=1><div id=". $selectl . " style=\"position:absolute; width:" . $width . "px; height:" . $height . "px z-index:1; visibility: hidden;border-left:1 solid #ffffff;border-top:1 solid #ffffff;border-right:1 solid #cccccc;border-bottom:1 solid #cccccc;\">";
						$string .= "<table border=0 cellpadding=0 width=" . $width . " cellspacing=0 height=" . $height . "><tr><td valign=top><IFRAME name=" . $selectf. " marginHeight=0 frameBorder=0 width=\"100%\" height=".$height." scrolling=no style=\"background:#c0c0c0\">IE</IFRAME></td></tr></table>";
						$string .= "</div></td>
					</tr>
					</table>";
	return $string;
}

function SelectFont ($name, $width, $caption, $value, $str) {
	$selectl = "select_" . $name;
	$selectf = "ifram_" . $name;
	$caption = explode (",", $caption);
	$value = explode (",", $value);
	$j = count ($caption);
	$height = 15 * $j;
	if ($height > 150) {
		$height = 150;
		$scrolling = "auto";
	} else {
		$scrolling = "no";
	}
	$string_select = "<table width=\"100%\" border=\"0\" cellpadding=\"0%\" cellspacing=\"0\">";
	for ($i = 0; $i < $j; $i ++) {
		//$string_select .= "<a style=\"line-height:125%\" onmouseover=\"parent.colorover()\" onClick=\"parent.getvalue" . $selectl  . " (" . $value[$i] . ")\">" . $caption[$i] . "</a><br>";
		$string_select .= "<tr><td nowrap height=12 style=\"font-size:12px\" onmouseover=\"parent.mouseovercolor(this,\'#000080\');parent.showimage (\'font_" . $i . "\');\" onmouseout=\"parent.mouseoutcolor(this,\'#ffffff\');parent.hiddenimage(\'font_" . $i . "\');\" onClick=\"parent.getvalue" . $selectl  . " (\'" . $str . "\',\'" . $value[$i] . "\')\" bgcolor=\"#ffffff\" algin=\"center\"><img src=images/" . $i . ".gif id=\"font_" . $i . "img\"></td></tr>";
	}
	$string_select .= "</table>";
	$string = "<script>
function getvalue" . $selectl  . " (str,v) {
	$name.value = '' + v + '';
	doFormat(str,v);
	hiddenselect" . $selectl  . " ();
}
function showselect" . $selectl  . " () {
	if ($selectl.style.visibility == 'hidden') {
		$selectl.style.visibility = 'visible'
		$selectf.document.body.innerHTML = '<font style=font-size:12px>$string_select</font>';
	} else {
		$selectl.style.visibility = 'hidden';
	}
}
function hiddenselect" . $selectl  . " () {
	$selectl.style.visibility = 'hidden';
}
	</script>
	<table border=0 cellpadding=0 cellspacing=0>
					<tr>
						<td valign=bottom height=20><input name=" . $name . " type=text style=width:" . $width . ";font-size:12px;border-right:1 none value=×ÖÌå></td><td align=left width=17><table border=0 cellpadding=0 cellspacing=0 width=17 height=20><tr><td background=images/select_arrow_bg.gif><img src=images/select_arrow1.gif onClick='showselect" . $selectl  . "()' onMouseDown=\"this.className='downBorder'\" onMouseUp=\"this.className='overBorder'\"></td></tr></table></td>
					</tr>
					<tr>
					<td height=1 colspan=2><div id=". $selectl . " style=\"position:absolute; width:100px; height:" . $height . "px z-index:1; visibility: hidden;border:1 solid #000000\">";
						$string .= "<table border=0 cellpadding=0 cellspacing=0 height=100%><tr><td><IFRAME name=" . $selectf. " marginHeight=0 frameBorder=0 width=\"100%\" scrolling=" . $scrolling . " height=\"" . $height . "\">IE</IFRAME></td></tr></table>";
						$string .= "</div></td>
					</tr>
					</table>";
	return $string;
}
?>