// JavaScript Document

/// Called in specials.php ///
function showclicktoprint()
{
	document.getElementById("specials_printmsg").style.visibility="visible";
	if(!document.all) document.captureEvents(Event.MOUSEMOVE);
	document.onmousemove = getMousePos;
}
function getMousePos(e)
{
	if(document.all) //IE
	{
		x = event.clientX+5;
		y = event.clientY-5;
		document.getElementById("specials_printmsg").style.left = x;
		document.getElementById("specials_printmsg").style.top = y;
	}
	else //NS
	{
		x = e.pageX+5;
		y = e.pageY-5;
		document.getElementById("specials_printmsg").style.left = x+"px";
		document.getElementById("specials_printmsg").style.top = y+"px";
	}
}

function hideclicktoprint()
{
	document.getElementById("specials_printmsg").style.visibility="hidden";	
}


// Called in estimate.php
function changefield(fld,txt)
{
	v = document.getElementById(fld).value;
	c = document.getElementById(fld).style.color;
	if(v==txt) 
	{
		document.getElementById(fld).value = "";
		document.getElementById(fld).style.color = "rgb(0,0,0)";
	}
	else if(c == "rgb(204, 204, 204)") document.getElementById(fld).style.color = "rgb(0,0,0)";
}

// Called in estimate.php
function restorefield(fld,txt)
{
	v = document.getElementById(fld).value;
	if(v=="") 
	{
		document.getElementById(fld).value = txt;
		document.getElementById(fld).style.color = "rgb(204,204,204)";
	}
	else if(v!=txt) document.getElementById(fld).style.color = "rgb(0,0,0)";
}

//Called in estimate.php
function showhide(fld,chkb)
{
	v = document.getElementById(fld).style.visibility;
	c = document.getElementById(chkb).checked;
	if(c!="") 
	{
		document.getElementById(fld).style.visibility = "visible";
		document.getElementById(fld).style.position = "";
	}
	else 
	{
		document.getElementById(fld).style.position = "absolute";
		document.getElementById(fld).style.visibility="hidden";
	}
}

function hidediv(div)
{
	document.getElementById(div).style.visibility = "visible";
}

function resetform(frm)
{
	with (frm)
	{
		for(i=0;i<elements.length-2;i++)
		{
			elements[i].style.color = "rgb(204,204,204)";
		}
	}
}
