function init() {
	tinyMCEPopup.resizeToInnerSize();
}

function insertEquation(params) {
	//var cur_operation=params["op"];

	switch (params) {
		case "less_equal":
		var html = '<img src="'+ tinyMCE.baseURL +'/plugins/equation/images/dsp_less_equal.gif" style="position:relative; top:4px;">';
		tinyMCE.execCommand('mceInsertContent', false, html);
		break;
		case "greater_egual":
		var html = '<img src="'+ tinyMCE.baseURL +'/plugins/equation/images/dsp_greater_equal.gif" style="position:relative; top:4px;">';
		tinyMCE.execCommand('mceInsertContent', false, html);
		break;
		case "notequal":
		var html = '<img src="'+ tinyMCE.baseURL +'/plugins/equation/images/dsp_notequal.gif" style="position:relative; top:4px;">';
		tinyMCE.execCommand('mceInsertContent', false, html);
		break;
		case "mul":
		var html = ' * ';
		tinyMCE.execCommand('mceInsertContent', false, html);
		break;
		case "divide":
			var html = ' &divide; ';
			tinyMCE.execCommand('mceInsertContent', false, html);
		break;
		case "abs_value":
			tstr='<table taglabel="ABS" style="display: inline; vertical-align: middle;" border="0" cellpadding="0" cellspacing="0">';
			tstr+='<tbody>';
			tstr+=' <tr>';
			tstr+='   <td style="font-size: 16px; font-family: times new roman,times,serif;"  type="paren" autosize="absVal" noresize="1" nowrap="nowrap" valign="middle"><b>|</b></td>';
			tstr+='   <td  nowrap="nowrap" valign="bottom"><table  style="display: inline;" border="0" cellpadding="0" cellspacing="0"><tbody ><tr ><td taglabel="CONTENTS" style="vertical-align: middle; padding-top: 0px; text-align: center;" nowrap="nowrap">x</td></tr></tbody></table></td>';
			tstr+='   <td style="font-size: 16px; font-family: times new roman,times,serif;"  type="paren" autosize="absVal" noresize="1" nowrap="nowrap" valign="middle"><b>|</b></td>';
			tstr+=' </tr>';
			tstr+='</tbody></table>';
			tinyMCE.execCommand('mceInsertContent', false, tstr);
		break;
		case "parenthesis":
			tstr='<table taglabel="PARENTHESIS" style="display: inline; vertical-align: middle;" border="0" cellpadding="0" cellspacing="0">';
			tstr+='<tbody>';
			tstr+=' <tr>';
			tstr+='   <td style="font-family: times new roman,times,serif; font-size: 32px;" type="paren" autosize="paren" noresize="1" nowrap="nowrap" valign="middle">(</td>';
			tstr+='   <td nowrap="nowrap" valign="middle">x</td>';
			tstr+='   <td style="font-family: times new roman,times,serif; font-size: 32px;" type="paren" autosize="paren" noresize="1" nowrap="nowrap" valign="middle">)</td>';
			tstr+=' </tr>';
			tstr+='</tbody></table>';
			tinyMCE.execCommand('mceInsertContent', false, tstr);
		break;
		case "hor_fraction":
			tstr='<table cellpadding="3" style="width:30px;" cellspacing="0" style="float:left;" taglabel="FRACTION">';
			tstr+='<tr><td align="center" style="border-bottom:1px solid #000;" type="numerator"> x </td></tr>';
			tstr+='<tr><td align="center" type="denominator"> y </td></tr>';
			tstr+='</table>';
			tstr+='<div style="margin:15px 5px 0px 5px;float:left;"> &nbsp; &nbsp; </div>';
			tstr+='<div style="clear:both;"></div><br /><br />';
			tinyMCE.execCommand('mceInsertContent', false, tstr);
		break;
		case "diag_fraction":
			tstr='<table taglabel="ABS" style="display: inline; vertical-align: middle;" border="0" cellpadding="0" cellspacing="0">';
			tstr+='<tbody>';
			tstr+=' <tr>';
			tstr+='   <td style="font-size: 16px; font-family: times new roman,times,serif;" type="paren" autosize="diag_fraction" noresize="1" nowrap="nowrap" valign="middle">x</td>';
			tstr+='   <td nowrap="nowrap" valign="bottom"><table  style="display: inline;" border="0" cellpadding="0" cellspacing="0"><tbody ><tr ><td taglabel="CONTENTS" style="vertical-align: middle; padding-top: 0px; text-align: center; font-size: 24px; font-weight:900;" nowrap="nowrap">&nbsp;/&nbsp;</td></tr></tbody></table></td>';
			tstr+='   <td style="font-size: 16px; font-family: times new roman,times,serif;" type="paren" autosize="diag_fraction" noresize="1" nowrap="nowrap" valign="middle">y</td>';
			tstr+=' </tr>';
			tstr+='</tbody></table>';
			tinyMCE.execCommand('mceInsertContent', false, tstr);
		break;
		case "square_root":
			tstr='<table style="display: inline; vertical-align: middle;" taglabel="RADICAL" border="0" cellpadding="0" cellspacing="0">';
			tstr+='<tbody>';
			tstr+=' <tr>';
			tstr+='   <td style="padding: 0px 0px 0px 2px; font-family: times new roman,times,serif; font-size: 8pt;" align="right" nowrap="nowrap" valign="bottom">&nbsp;<br><strong style="font-weight: 900; font-family: times new roman,times,serif;">\\</strong></td>';
			tstr+='   <td style="border-top: 2px solid black; border-left: 2px solid black; padding: 2px 3px 1px 5px;" align="center" nowrap="nowrap">&nbsp;x</td>';
			tstr+=' </tr>';
			tstr+='</tbody></table><br />';
			tinyMCE.execCommand('mceInsertContent', false, tstr);
		break;
		case "root":
			tstr='<table style="display: inline; vertical-align: middle;" taglabel="RADICAL" border="0" cellpadding="0" cellspacing="0">';
			tstr+='<tbody>';
			tstr+=' <tr>';
			tstr+='   <td style="padding: 0px 0px 0px 2px; font-family: times new roman,times,serif; font-size: 8pt;" align="right" nowrap="nowrap" valign="bottom">y&nbsp;<br><strong style="font-weight: 900; font-family: times new roman,times,serif;">\\</strong></td>';
			tstr+='   <td style="border-top: 2px solid black; border-left: 2px solid black; padding: 2px 3px 1px 5px;" align="center" nowrap="nowrap">&nbsp;x</td>';
			tstr+=' </tr>';
			tstr+='</tbody></table>';
			tinyMCE.execCommand('mceInsertContent', false, tstr);
		break;
	}
};
