sfHover = function()
{
	var sfEls = document.getElementById("dMenu").getElementsByTagName("li");

	for (var i=0; i<sfEls.length; i++)
	{
		sfEls[i].onmouseover = function()
		{
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout = function()
		{
			this.className = this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}	
}

if (window.attachEvent) window.attachEvent("onload", sfHover);


function switchVisible(whichLayer)
{
	var style2 = document.getElementById(whichLayer).style;

	if (style2.display == 'none') {
	
		var browser=navigator.appName;
		if (browser=="Microsoft Internet Explorer") {
			style2.display = 'block';	
		} else {
			style2.display = 'table-row';	
		}
	} else {
		style2.display = 'none';	
	}
}


function textcounter(field, cntfield, maxlimit)
{
	cntfield.value = maxlimit - field.value.length;
}


function viewTemplates()
{
	day = new Date();
	id = day.getTime();

	eval("page" + id + " = window.open('/popup/templates.php', '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=421,height=521');");
}


function viewTemplate(template)
{
	day = new Date();
	id = day.getTime();

	eval("page" + id + " = window.open('/popup/template.php?template=" + template  + "', '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=301,height=401');");
}