/* 
functions for button effects
to edit the appearance of mousing over and/or clicking
edit the style file for classes

button -- normal
bdown -- when button is down
bclick -- when the button is clicked


NOTE: be sure not to change the position elements
of the style!!
*/

function mouse_over_it( it )
{
document.getElementById(it).className = "bover";
}

function mouse_out_it( it )
{
document.getElementById(it).className = "button";
}

function mouse_down_it( it )
{
document.getElementById(it).className = "bclick";
}

/* 
validate will ensure that RA in the search for is
between appropriate values
*/

function validate()
{

	str = document.submitCOORD.RA.value
	re = /-?[0-9]*/
	found = str.match(re)


	if ( (Math.abs(found)>360) || (Math.abs(found)<0) )
	{
		alert ("RA must be between 0 and 360.")
		return false
	}
		else	   
	{	   
		return true
	}		

}	


function show_column_select()
{
	var is_vis = document.getElementById("sel_cols").style.visibility;
	if ( is_vis == "visible" )
	{
		document.getElementById("sel_cols").style.visibility =	"hidden";		
	}
	else
	{
		document.getElementById("sel_cols").style.visibility = "visible";
	}
}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) {
			alert( c.substring(nameEQ.length,c.length) );
			return c.substring(nameEQ.length,c.length);
		}
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

