<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--

var f_spreadsheet;
var last;

function show_error(strMessage)
{
  alert(strMessage);
}

function onload()
{
 f_spreadsheet = parent.f_spreadsheet;
}

function set_bold(v)
{
 b_bold.style.fontWeight = v;
}

function set_italic(v)
{
 b_italic.style.fontStyle = v;
}

function set_underline(v)
{
 b_underline.style.textDecoration = v;
}

function bold_state()
{
 var obj_b = b_bold.style;
 if (obj_b.fontWeight<700) return "b";
 else return "B";
}

function italic_state()
{
 var obj_i = b_italic.style;
 if (obj_i.fontStyle=="") return "i";
 else return "I";
}

function underline_state()
{
 var obj_u = b_underline.style;
 if (obj_u.textDecoration=="") return "u";
 else return "U";
}

function bold_onclick()
{
 var obj_b = b_bold.style;

 if (obj_b.fontWeight<700) 
 {
  //obj.fontWeight = 700;
  //alert(underline_state());
  f_spreadsheet.textstyle_cells('B'+italic_state()+underline_state());
 }
 else 
 {
  //obj.fontWeight = 400;
  //alert(underline_state());
  f_spreadsheet.textstyle_cells('b'+italic_state()+underline_state());
 }
 b_bold.blur();
}

function italic_onclick()
{
 var obj_i = b_italic.style;

 if (obj_i.fontStyle=="") 
 {
  //obj.fontStyle = "italic";
  f_spreadsheet.textstyle_cells(bold_state()+'I'+underline_state());
 }
 else 
 {
  //obj.fontStyle = "";
  f_spreadsheet.textstyle_cells(bold_state()+'i'+underline_state());
 }
 b_italic.blur();
}

function underline_onclick()
{
 var obj_u = b_underline.style;

 if (obj_u.textDecoration=="")
 {
  //obj.textDecoration = "underline";
  f_spreadsheet.textstyle_cells(bold_state()+italic_state()+'U');
 }
 else
 {
  //obj.textDecoration = "";
  f_spreadsheet.textstyle_cells(bold_state()+italic_state()+'u');
 }
 b_underline.blur();
}

function button_activate(name)
{
 var b=document.all(name);
 b.style.display="inline";
}

function button_deactivate(name)
{
 //alert("button "+name);
 var b=document.all(name);
 b.style.display="none";
}

function button_on(name)
{
 var b=document.all(name);
 var fn=b.filename;
 b.src = "/co/images/buttons_on/"+fn+".gif";
}

function button_off(name)
{
 var b=document.all(name);
 var fn=b.filename;
 b.src = "/co/images/buttons_off/"+fn+".gif";
}

function update_align_buttons(alg)
{
 switch (alg) 
 {
  case "left":{ button_on("b_left"); button_off("b_center"); button_off("b_right"); break; }
  case "center":{ button_off("b_left"); button_on("b_center"); button_off("b_right"); break; }
  case "right":{ button_off("b_left"); button_off("b_center"); button_on("b_right"); break; }
  default:{ button_off("b_left"); button_off("b_center"); button_off("b_right"); break; }
 } 
}

var click_counter=0;

function scripts_clicked()
{
 var sp_id = par_id;
 var ob_type = "cell";
 var c_id = f_spreadsheet.cell2ColumnId(f_spreadsheet.active_cell)
;
 var r_id = f_spreadsheet.cell2RowId(f_spreadsheet.active_cell);

//alert(f_spreadsheet.getRowNumberByCell(f_spreadsheet.active_cell));
//alert("sp_id="+sp_id+" col_id="+c_id+" row_id="+r_id);
/*
 var ob_value = f_spreadsheet.current_cell_value();
*/
 if (f_spreadsheet.selection!=null)
 { 
  switch (f_spreadsheet.selection.area.type) {
    case "c":{ ob_type="column"; r_id = 0; break; }
    case "r":{  ob_type="row"; c_id = 0; break; }
    case "g":{  ob_type="spreadsheet";
 c_id = 0; r_id = 0; break;
 }
  }
 }

 //window.open("/co/spreadsheet/form_scripts.asp?active=&active_path=&object="+ob_type+"&s_id=" + ob_id +"&c_id="+c_id+"&r_id="+r_id+ "&" + f_spreadsheet.urlEncode("value", ob_value), "w_"+ob_type+ob_id+"_"+(click_counter++),"toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes")
window.open("/co/asp/sys/spreadsheet?showCode&active=&active_path=&object="+ob_type+"&sp_id=" + sp_id +"&c_id="+c_id+"&r_id="+r_id+ "&" );//+ f_spreadsheet.urlEncode("value", ob_value), "w_"+ob_type+ob_id+"_"+(click_counter++),"toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes")
}


//-->
</SCRIPT>
<style>
SELECT {
	background : LightGrey;
	font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
}
</style>
</HEAD>

<BODY onload="onload()" bgcolor="Black" language=JavaScript onkeyup="f_spreadsheet.body_onkeyup()" onkeydown="f_spreadsheet.body_onkeydown(event)" TOPMARGIN=0>

<TABLE width="" cellpadding="0" cellspacing="0" border="0">
<TR>

<TD width="500" align="left">
<IMG id=b_del_row_or_column filename=delete STYLE="display:none" src="/co/images/buttons_off/delete.gif" onmouseover="button_on(this.id)" onmouseout="button_off(this.id)" TITLE="usuwa zaznaczony wiersz badz kolumne" onclick="f_spreadsheet.delete_column_or_row()">
<!--
<IMG id=b_calc_exp filename=licz STYLE="display:none" src="/co/images/buttons_off/count.gif" onmouseover="button_on(this.id)" onmouseout="button_off(this.id)" title="oblicza wartosc wyrazenia aktualnej komorki" onclick="f_spreadsheet.calculate_expression()">
<IMG id=b_calc_all_exp filename=wszystko src="/co/images/buttons_off/all.gif" onmouseover="button_on(this.id)" onmouseout="button_off(this.id)" title="oblicza wszystkie wyrazenia w arkuszu" onclick="f_spreadsheet.calculate_all_expressions()">
-->
<IMG id=b_refresh filename=reload src="/co/images/buttons_off/reload.gif" onmouseover="button_on(this.id)" onmouseout="button_off(this.id)" title="kontaktuje sie z serwerem i czyta ostatnie zmiany w tabeli" onclick="f_spreadsheet.refresh_sp()">
<IMG id=b_devmode filename=user src="/co/images/buttons_off/user.gif" onmouseover="button_on(this.id)" onmouseout="button_off(this.id)"  title='nazwa trybu pracy' onclick="f_spreadsheet.devmode()">
<IMG id=b_copy filename=copy src="/co/images/buttons_off/copy.gif" onmouseover="button_on(this.id)" onmouseout="button_off(this.id)" title='kopiuj' onclick="f_spreadsheet.sel_copy()">
<IMG id=b_paste filename=paste src="/co/images/buttons_off/paste.gif" onmouseover="button_on(this.id)" onmouseout="button_off(this.id)" title='wklej' onclick="f_spreadsheet.sel_paste()">

<IMG id=b_auto filename=auto src="/co/images/buttons_off/auto.gif" onmouseover="button_on(this.id)" onmouseout="button_off(this.id)" title='automatyczne kopiowanie formu' onclick="f_spreadsheet.sel_auto()">


<!--
<TD width="" align="left">
<IMG id=b_del_row_or_column filename=delete STYLE="display:none" src="/co/images/buttons_off/delete.gif" onmouseover="button_on(this.id)" onmouseout="button_off(this.id)" TITLE="usuwa zaznaczony wiersz badz kolumne" onclick="f_spreadsheet.delete_column_or_row()">
<IMG id=b_calc_exp filename=count STYLE="display:none" src="/co/images/buttons_off/count.gif" onmouseover="button_on(this.id)" onmouseout="button_off(this.id)" title="oblicza wartosc wyrazenia aktualnej komorki" onclick="f_spreadsheet.calculate_expression()">
</TD>
-->

<TD width="110" align="center">
<IMG id=b_scripts filename=scripts src="/co/images/buttons_off/scripts.gif" onmouseover="button_on(this.id)" onmouseout="button_off(this.id)" title='skrypty obiektu' onclick="scripts_clicked()">
</TD>
<TD width="148" align="right">
<IMG id=b_addRow filename=row_add src="/co/images/buttons_off/row_add.gif" onmouseover="button_on(this.id)" onmouseout="button_off(this.id)" onclick="f_spreadsheet.add_row()" TITLE="dodaj wiersz">
<IMG id=b_addColumn filename=col_add src="/co/images/buttons_off/col_add.gif" onmouseover="button_on(this.id)" onmouseout="button_off(this.id)" onclick="f_spreadsheet.add_column()" TITLE="dodaj kolumne">
</TD>
</TR>
</TABLE>

<TABLE>
	<TR>
		<TD width="755" height="2" bgcolor="999966"></TD>
	</TR>
</TABLE>

<TABLE cellpadding="0" cellspacing="0" border="0">
<TR bgcolor=003300>
<TD align="center" width="90">
<SELECT id=Sfont_size onchange="f_spreadsheet.fontsize_cells(this.value)">
<OPTION value="7px">7</OPTION>
<OPTION value="8px">8</OPTION>
<OPTION value="9px">9</OPTION>
<OPTION value="10px">10</OPTION>
<OPTION value="11px">11</OPTION>
<OPTION value="12px">12</OPTION>
<OPTION value="14px">14</OPTION>
<OPTION value="16px">16</OPTION>
<OPTION value="18px">18</OPTION>
<OPTION value="20px">20</OPTION>
<OPTION value="22px">22</OPTION>
<OPTION value="24px">24</OPTION>
<OPTION value="26px">26</OPTION>
<OPTION value="28px">28</OPTION>
<OPTION value="36px">36</OPTION>
<OPTION value="48px">48</OPTION>
<OPTION value="72px">72</OPTION>
<OPTION value="120px">120</OPTION>
<OPTION value="240px">240</OPTION>
<OPTION value="1200px">1200</OPTION>
</SELECT>
</TD>

<TD align="center" width="180">
<SELECT id=Sfont_family onchange="f_spreadsheet.fontfamily_cells(this.value)">
<OPTION value="">Font</OPTION>
<OPTION value="">-----------------</OPTION>
<OPTION value="Arial">Arial</OPTION>
<OPTION value="Verdana">Verdana</OPTION>
<OPTION value="Times New Roman Ce">Times New Roman</OPTION>
<OPTION value="serif">serif</OPTION>
<OPTION value="sans-serif">sans-serif</OPTION>
<OPTION value="cursive">cursive</OPTION>
<OPTION value="monospace">monospace</OPTION>
</SELECT>
</TD>

<TD align="center" width="130">
<SELECT id=Stext_color onchange="f_spreadsheet.textcolor_cells(this.value)">
<OPTION value="black">Kolor</OPTION>
<OPTION value="black">----------</OPTION>
<OPTION value="black">Czarny</OPTION>
<OPTION value="red" style="color:red">Czerwony</OPTION>
<OPTION value="navy" style="color:navy">Niebieski</OPTION>
<OPTION value="Green" style="color:green">Zielony</OPTION>
<OPTION value="Orange" style="color:orange">Pomaranczowy</OPTION>
<OPTION value="yellow" style="color:yellow">Zolty</OPTION>
<OPTION value="gray" style="color:Gray">Szary</OPTION>
<OPTION value="Olive" style="color:Olive">Oliwkowy</OPTION>
</SELECT>
</TD>

<TD align="center" width="120">
<INPUT type=BUTTON id=b_bold value="B" onclick="bold_onclick()">&nbsp;
<INPUT type=BUTTON id=b_italic value="I" onclick="italic_onclick()">&nbsp;
<INPUT type=BUTTON id=b_underline value="U" onclick="underline_onclick()">&nbsp;
</TD>

<TD align="center" width="239">
<IMG id=b_left filename=left src="/co/images/buttons_off/left.gif" onclick="f_spreadsheet.align_cells('left')">
<IMG id=b_center filename=center src="/co/images/buttons_off/center.gif" onclick="f_spreadsheet.align_cells('center')">
<IMG id=b_right filename=right src="/co/images/buttons_off/right.gif" onclick="f_spreadsheet.align_cells('right')">
</TD>

</TR>
</TABLE>

<TABLE>
	<TR>
		<TD width="755" height="2" bgcolor="999966"></TD>
	</TR>
</TABLE>
<TABLE>
	<TR>
		<TD>
			<FORM id="form1" method="POST" name="form1" onkeyup="f_spreadsheet.form1_onkeyup()" onsubmit="return false">
			
<NOBR>
			<INPUT TYPE=TEXT MAXLENGTH=128 READONLY size=6 id="cell_display">
<SPAN style="background: black; color: white; font-size:16;">=</SPAN>
			<INPUT TYPE=TEXT MAXLENGTH=1024 size=111 id=wartosc LANGUAGE=javascript onfocus="f_spreadsheet.wartosc_onfocus()" onblur="f_spreadsheet.wartosc_onblur()">
			</NOBR>
			</FORM>
		</TD>
	</TR>
</TABLE>

</OBJECT>
</BODY>