function tabIt(from,to)
{
	if (from.getAttribute&&from.value.length==from.getAttribute("maxlength"))
	to.focus()
}

function HideHomeDiv(id, testlink)
{
	var displayed = document.getElementById(id).style;
	if (displayed.display == 'block') displayed.display = 'none';
	else displayed.display = 'block';
	
	var temp = document.getElementById("Hide" + testlink).style;
	temp.display = 'none';
	
	temp = document.getElementById("Show" + testlink).style;
	temp.display = 'block';
}

function ShowHomeDiv(id, testlink)
{
	var displayed = document.getElementById(id).style;
	if (displayed.display == 'block') displayed.display = 'none';
	else displayed.display = 'block';
	
	var temp = document.getElementById("Show" + testlink).style;
	temp.display = 'none';
	
	temp = document.getElementById("Hide" + testlink).style;
	temp.display = 'block';
}

function ShowDiv(id)
{	
	var displayed = document.getElementById(id).style;
	if (displayed.display == '') displayed.display = 'none';
	else if (displayed.display == 'block') displayed.display = 'none';
	else displayed.display = 'block';
}

// Pop up a new window
function popup(url,width,height,scrollbars) 
{
	var popwidth = width;
	var popheight = height;
	var leftoffset = (screen.width - popwidth - 10)/2;
	var topoffset = (screen.height - popheight - 40)/2;
	window.open(url,'_blank','titlebar=no,resizable=no,scrollbars=' + scrollbars + ',width=' + popwidth + ',height=' + popheight + ',left=' + leftoffset + ',top=' + topoffset);
}


// Flash detection
var MM_contentVersion = 6;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if (plugin) 
{
	var words = navigator.plugins["Shockwave Flash"].description.split(" ");
	for (var i = 0; i < words.length; ++i)
	{
  if (isNaN(parseInt(words[i]))) continue;
  var MM_PluginVersion = words[i]; 
	}
	var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.appVersion.indexOf("Win") != -1)) 
{
	document.write('<scr' + 'ipt language=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
	document.write('on error resume next \n');
	document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
	document.write('</scr' + 'ipt\> \n');
}











// Quotes Admin
charLimit = 165;
bname = navigator.appName;
bver = parseInt(navigator.appVersion);
blegal = ((bname == "Netscape" && bver >= 3) || (bname == "Microsoft Internet Explorer" && bver >= 4));

function checkMessageLength (form) {						
	var count = countChars(form);
	var rc = true;
	form.CharCount.value = count;
	if( count < 0 ) 
	{
		alert("The total length of the Quote textbox and the Author textbox can only be 165 characters");
		form.Quote.focus();
		form.AddSaveButton.disabled = "disabled";
		rc = false;
	} 
	else
	{
		form.AddSaveButton.disabled = "";
	}
	return rc;
}					
function countChars (form){
	if (blegal) 
	{
		var lenQuote = form.Quote.value.length 
		var lenAuthor = form.Author.value.length 
		var count = lenQuote + lenAuthor 								
		return charLimit - count;
	} 
	else  return 0;
}
