var mB=0;
var cC="";

function mouseDown(cl)
{
	mB = window.event.button;
	if (mB < 1 || mB > 2) return;

	var cl = window.event.srcElement;
	if (mB == 1)
	{
		if (cl.className == "cl1") cl.className = "cl0";
		else cl.className = "cl1";
	}
	else if (mB == 2)
	{
		if (cl.className == "cl2") cl.className = "cl0";
		else cl.className = "cl2";
	}
	cC = cl.className;
	window.event.returnValue = false;
	window.event.cancelBubble = true;
}

function mouseOver()
{
	if (cC != "")	window.event.srcElement.className = cC;
	window.event.returnValue = false;
	window.event.cancelBubble = true;
}

function mouseUp()
{
	mB = 0;
	cC = "";
	window.event.returnValue = false;
	window.event.cancelBubble = true;
}

function f1()
{
	window.event.returnValue = false;
	window.event.cancelBubble = true;
}

function clMid()
{
	for(j=0;j<net.rows.length;j++)
		for(i=0;i<net.rows[j].cells.length;i++)
			net.rows[j].cells[i].className = "cl0";
}


function MidCr1(len1,len2,openstr)
{
	tstr=openstr.value;
	document.write("<table id=net cellspacing=0 cellpadding=0 class=b4>");
	pos=0;
	for(j=0;j<len2;j++)
	{
		if (j%5 == 0 && j>0) document.write("<tr class=b4></tr>");
		document.write("<tr>");
		for(i=0;i<len1;i++)
		{ 
			rstr=tstr.substring(pos,pos+1);
			if (rstr=="0") clx="cl0";
			else {if (rstr=="1") clx="cl1"; else clx="cl2";}
			if (i%5 == 0 && i>0) document.write("<td class=b3 height=2 width=1></td>");
			document.write("<td id=a1 class="+clx+" onmouseup='mouseUp()'; onmousedown='mouseDown()'; onmouseover='mouseOver()'; oncontextmenu='f1()'; onselectstart='f1()'; height=12 width=10>X</td>");
			pos++;
		}
		document.write("</tr>");
	}
	document.write("</table>");
}
function midcrx(len1,len2,openstr)
{
	rstr="";
	document.write("<table cellPadding=0 cellSpacing=0 class=nt>");
	for(j=0;j<len2;j++)
	{
		if (j%5 == 0 && j>0) document.write("<tr class=b4></tr>");
		document.write("<tr>");
		for(i=0;i<len1;i++)
		{ 
			if (i%5 == 0 && i>0) document.write("<td height=2 width=1 class=b4></td>");
			document.write("<td class=cl0 onmouseup='mouseUp()'; onmousedown='mouseDown()'; onmouseover='mouseOver()'; oncontextmenu='f1()'; onselectstart='f1()'; height=12 width=10>X</td>");
		}
		document.write("</tr>");
	}
	document.write("</table>");
	return rstr;
}

function MidEnd()
{
	frm1.jpcr.value="";
	for(j=0;j<net.rows.length;j++)
		if((j+1)%6!=0)
			for(i=0;i<net.rows[j].cells.length;i++)
			if((i+1)%6!=0)
				if(net.rows[j].cells[i].className == "cl0") frm1.jpcr.value=frm1.jpcr.value+"0";
				else if(net.rows[j].cells[i].className == "cl1") frm1.jpcr.value=frm1.jpcr.value+"1";
				else frm1.jpcr.value=frm1.jpcr.value+"2";
}

var days=new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday')
var months=new Array('January','February','March','April','May','June','July','August','September','October','November','December')

function settimes(){
bversion=navigator.appVersion.split("[");
info=navigator.appVersion.split(";")
spc='&nbsp;&nbsp;<IMG SRC="sep.gif" WIDTH="2" HEIGHT="16" BORDER="0" ALIGN="ABSBOTTOM">&nbsp;&nbsp;'
var time= new Date();
day=days[time.getDay()];
nday=time.getDate();
month=months[time.getMonth()];
year= eval(time.getYear());
if (year<1900)
year=1900+eval(year);
if (document.all)
tim1.innerHTML='<IMG SRC="blank.gif" WIDTH="1" HEIGHT="1" BORDER="0" ALIGN="ABSBOTTOM" VSPACE="10"><IMG SRC="sep.gif" WIDTH="2" HEIGHT="16" BORDER="0" ALIGN="ABSBOTTOM">&nbsp;&nbsp;'+day+", "+nday+" "+month+" "+year+spc;
else{
document.layers['ntim1'].document.write(spc+'<Span class="time">'+day+', '+nday+' '+month+' '+year+spc+'</Span>'+spc)
document.layers['ntim1'].document.close();
}
}
