// action.js
var btnDefault;
var bFirstPass = true;
document.onmousedown=handleAction;
document.onkeydown=handleAction;
function firstPass(e)
{
	if (bFirstPass) //global
	{
		//take a nap long enough to reexecute the calling function
		setTimeout(arguments.caller.callee.toString().match(/function (\w*)/)[1]+ '("' + e.name + '")',0);
		bFirstPass=false;
		return true;
	}
	else if (e.tagName) //if it is not the firstPass and it is an object
	{
		return true;
	}
	bFirstPass=true;
	return false;
}

function submitForm(e)
{
	if (firstPass(e))
	{
		return false;
	}
	else
	{
		e = document.all[e];
	}
	if (checkform(e.form))
	{
		displayNotification();
		e.form.submit();
	}
}

function submitMyForm()
{
	submitForm(document.getElementById(btnDefault));
}

function handleAction()
{
	if (window.event != null && window.event.srcElement !=null && window.event.srcElement.tagName != null)
	{
		if ((window.event.keyCode == 13)
			&& (window.event.srcElement.tagName.toUpperCase() != "BUTTON")
			&& (window.event.srcElement.tagName.toUpperCase() != "TEXTAREA")
			&& (window.event.srcElement.tagName.toUpperCase() != "SELECT")
			&& ((document.getElementById('bodyDiv') == null)
			|| (document.getElementById('bodyDiv').style.display == "none")))
		{
			submitMyForm(); 
			return false;
		} 
	}
}

//BLINKING
function Blink(layerName)
{
 	if(i%2==0)
	{
		eval(layerRef+'["'+layerName+'"]'+
			styleSwitch+'.visibility="visible"');
	}
	else
	{
		eval(layerRef+'["'+layerName+'"]'+
			styleSwitch+'.visibility="hidden"');
	}

 	if(i<1)
 	{
 		i++;
 	} 
 	else
 	{
 		i--;
 	}
 	setTimeout("Blink('"+layerName+"')",blink_speed);
}

