/****************************************************************************************

JavaScript Button 
Author: ZengJun   2004.12
Wisesoft 

需要文件 zbutton.css   image/pixel.gif 的支持
****************************************************************************************/

function zbutton(id , caption , img)
{
	this.id=id;
	this.caption=caption;
	this.img=img;
	this.create();
}
 
zbutton.prototype.create=function()
{
	document.write("<table id="+this.id+" class='jun_button' cellpadding=0 cellspacing =0 onselectstart='event.returnValue=false;'>");
	document.write("	<tr class='jun_button_row'>");
	document.write("		<td ></td>");
	document.write("		<td  ></td>");
	document.write("		<td bgcolor=#406070  ></td>");
	document.write("		<td  ></td>");
	document.write("		<td></td>");
	document.write("	</tr>");
	document.write("	<tr class='jun_button_row'>");
	document.write("		<td class='jun_button_dot' height='1'></td>");
	document.write("		<td  bgcolor=#406070 class='jun_button_dot'><img src='image/pixel.gif'></td>");
	document.write("		<td id="+this.id+"_reserve_top_border bgcolor=#ffffff class='jun_button_vline' ></td>");
	document.write("		<td  bgcolor=#406070 class='jun_button_dot'><img src='image/pixel.gif'></td>");
	document.write("		<td ><img src='image/pixel.gif'></td>");
	document.write("	</tr>");
	document.write("	<tr>");
	document.write("		<td bgcolor=#406070 class='jun_button_vline' ><img src='image/pixel.gif'></td>");
	document.write("		<td id="+this.id+"_reserve_left_border></td>");
	document.write("		<td id="+this.id+"_reserve_body align =center bgcolor=#DCDDBF class='jun_button_normal' nowrap ");
	document.write("		 onselectstart='event.returnValue=false;' ");
	document.write("		 onmouseover='zbutton_showfocus(\""+this.id+"\");' ");
	document.write("		 onmouseout='zbutton_lostfocus(\""+this.id+"\");' ");
	document.write("         onmousedown='zbutton_showdown(\""+this.id+"\");' ");
	document.write("         onmouseup='zbutton_showup(\""+this.id+"\");'  ");
	document.write("         onclick='"+this.id+"_onclick();'  >&nbsp;");
	if ( this.img!=undefined) document.write("<img src='"+this.img+"' align='absmiddle'>");
	document.write("<a class=jun_button_caption>"+this.caption+"</a>&nbsp</td>");
	document.write("		<td id="+this.id+"_reserve_right_border bgcolor=#b6b89a></td>");
	document.write("		<td bgcolor=#406070 class='jun_button_vline'  ></td>");
	document.write("	</tr>");
	document.write("	<tr class='jun_button_row'>");
	document.write("		<td ></td>");
	document.write("		<td  bgcolor=#406070 class='jun_button_vline'></td>");
	document.write("		<td id="+this.id+"_reserve_bottom_border bgcolor=#b6b89a class='jun_button_vline' ></td>");
	document.write("		<td  bgcolor=#406070 class='jun_button_vline' ></td>");
	document.write("		<td ></td>");
	document.write("	</tr>");
	document.write("	<tr class='jun_button_row'>");
	document.write("		<td></td>");
	document.write("		<td  ></td>");
	document.write("		<td bgcolor=#406070></td>");
	document.write("		<td  ></td>");
	document.write("		<td></td>");
	document.write("	</tr>");
	document.write("</table>");

}


function zbutton_showdown(id)
{
 
  document.getElementById(id+'_reserve_left_border').style.backgroundColor='#b6b89a'; 
 document.getElementById(id+'_reserve_top_border').style.backgroundColor='#b6b89a'; 
 document.getElementById(id+'_reserve_right_border').style.backgroundColor='#ffffff'; 
 document.getElementById(id+'_reserve_bottom_border').style.backgroundColor='#ffffff'; 

 
}
	
function zbutton_showup(id)
{

 document.getElementById(id+'_reserve_left_border').style.backgroundColor='#ffffff'; 
 document.getElementById(id+'_reserve_top_border').style.backgroundColor='#ffffff'; 
 document.getElementById(id+'_reserve_right_border').style.backgroundColor='#b6b89a'; 
 document.getElementById(id+'_reserve_bottom_border').style.backgroundColor='#b6b89a'; 
 

		  
}


function zbutton_showfocus(id)
{
 document.getElementById(id+'_reserve_bottom_border').style.backgroundColor='#ff9900'; 

}

function zbutton_lostfocus(id)
{
 document.getElementById(id+'_reserve_bottom_border').style.backgroundColor='#b6b89a'; 
 zbutton_showup(id)
}

