//copyright © Keith Trotter.  All rights reserved



function hideNoteInput()
{
	document.getElementById('note_input_shade_div').style.display='none';
	document.getElementById('note_input_div').style.display='none';
	if(document.getElementById('note_input_frame')!=null) document.getElementById('note_input_frame').style.display='none';
}

function showNoteInput(to_name,to_num)
{
	document.getElementById('to_name').innerHTML=to_name;
	document.getElementById('to_num').value=to_num;
	document.getElementById('note_input_shade_div').style.display='inline';
	document.getElementById('note_input_div').style.display='inline';
	if(document.getElementById('note_input_frame')!=null) document.getElementById('note_input_frame').style.display='inline';
	document.getElementById('note_input_text').focus();
	document.getElementById('note_input_text').onkeyup=function(){checkNoteCount();}
}

function writeNoteInput(pageInput)
{
document.writeln("<!--[if IE]> <iframe src='javascript:false' id='note_input_frame' style='z-index: 2; display: none; position: absolute; width: 406px; height: 256px; top: 15%; left: 50%; margin-left: -203px;' frameborder='0'></iframe> <![endif]--><div id='note_input_div' style='z-index: 3; display: none; position: absolute; top: 15%; left: 50%; margin-left: -200px; width: 400px; height: 250px; background-color: white;'>"+unescape(pageInput)+"</div>");
}

function writeNoteInputShade()
{
document.writeln("<div id='note_input_shade_div' onclick='hideNoteInput();' style='z-index: 2; opacity: 0.2; -moz-opacity: 0.2; filter: alpha(opacity=20); display: none; position: absolute; left: 0px; top: 0px; width: 100%; height: 100%; background-color: black;'></div>");
}

function sendNoteInput()
{
	if(document.getElementById('note_page').value.length>0)
	{
		document.forms[0].action=document.forms[0].action+"&c=snd_msg&id="+document.getElementById('to_num').value+"&st="+document.getElementById('note_page').value;
	}
	else
	{
		document.forms[0].action=document.forms[0].action+"&c=snd_msg&id="+document.getElementById('to_num').value;
	}
	
	
	document.forms[0].submit();
}


function checkNoteCount()
{
	if(document.getElementById('note_input_text').value.length>150)
	{
		document.getElementById('note_input_text').value=document.getElementById('note_input_text').value.substr(0,150);
	}
	
	document.getElementById('note_input_remain').innerHTML=150-document.getElementById('note_input_text').value.length;
}