
function overTR(obj)
{
	obj.className = obj.className + ' hover';
}

function outTR(obj)
{
	obj.className = obj.className.replace(' hover', '');
}


function deleteCategory(id)
{
	document.getElementById('frm').submit();

	if (confirm("Weet u zeker dat u deze category wilt verwijderen?"))
	{
		document.getElementById('myaction').value='delete';
		document.getElementById('myid').value=id;
		document.getElementById('frmke').submit();
	}
}

function CurrencyFormatted(amount)
{
	var i = parseFloat(amount);
	if(isNaN(i)) { i = 0.00; }
	var minus = '';
	if(i < 0) { minus = '-'; }
	i = Math.abs(i);
	i = parseInt((i + .005) * 100);
	i = i / 100;
	s = new String(i);
	s = s.replace(".",",");
	if(s.indexOf(',') < 0) { s += ',00'; }
	if(s.indexOf(',') == (s.length - 2)) { s += '0'; }
	s = minus + s;
	return s;
}

function SetLoginFocus()
{	
	try
	{
		document.getElementById('username').focus();
	}
	catch(e)
	{
	}
}

function setCookie(c_name,value,expiredays)
{
	var exdate=new Date()
	exdate.setDate(exdate.getDate()+expiredays)
	document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate)
}

function getCookie(c_name)
{
	if (document.cookie.length>0)
	{
		c_start=document.cookie.indexOf(c_name + "=")
		if (c_start!=-1)
		{ 
			c_start=c_start + c_name.length+1 
			c_end=document.cookie.indexOf(";",c_start)
			if (c_end==-1) c_end=document.cookie.length
			return unescape(document.cookie.substring(c_start,c_end))
		} 
	}
	return null
}

		function showSub(subID) 
		{
			var id = subID;
			subID = "smenu" + subID;
			
			try
			{
				document.getElementById('mainmenu'+id).src=document.getElementById('mainmenu_ov'+id).src;
			}
			catch(e)
			{
				//
			}
			
			var oSubMenu = document.getElementById(subID)
			if (oSubMenu)
			{
				var oMainMenu = document.getElementById(subID.replace('smenu','menu'))
				//check if the submenu has items
				if (oSubMenu.getElementsByTagName('DIV').length > 0) {
					if (oSubMenu)
						oSubMenu.style.visibility = 'visible';
				}
				
				//if (oMainMenu) {
				//	if (oMainMenu.className != 'menuItem_Selected') {
				//		oMainMenu.className = 'menuItem menuItem_Hover';
				//	}
				//}
			}
		}

		function hideSub(subID) 
		{
			var id = subID;
			subID = "smenu" + subID;
			
			try
			{
				document.getElementById('mainmenu'+id).src=document.getElementById('mainmenu_ov'+id).src.replace('_ov.png','.png');
			}
			catch(e)
			{
				//
			}
			
			var oSubMenu = document.getElementById(subID)
			var oMainMenu = document.getElementById(subID.replace('smenu','menu'))
			if (oSubMenu)
				oSubMenu.style.visibility = 'hidden';
			
			//if (oMainMenu) {
			//	if (oMainMenu.className != 'menuItem_Selected') 
			//		oMainMenu.className = 'menuItem';					
			//}
		}

	function openLink(link, navid, subnavid)
	{
		setCookie("selectedmainmenu",navid,null);
		setCookie("selectedsubmenu",subnavid,null);
		document.location.href=link;
	}
		
function switchLanguage(lang)
{
	setCookie('lang', lang, null);
	document.location.reload();
}

function subMenuMouseOut(id)
{
	try
	{
		document.getElementById('submenu'+id).src=document.getElementById('submenu_ov'+id).src.replace('_ov.png','.png');
	}
	catch(e)
	{
		//
	}
}

function subMenuMouseOver(id)
{
	try
	{
		document.getElementById('submenu'+id).src=document.getElementById('submenu_ov'+id).src;
	}
	catch(e)
	{
		//
	}
}

function focusme(field, element)
{
	if (field=='mail')
	{
		if (element.value=='e-mail')
		{
			element.value = '';
		}
	}
	else
	{
		if (element.value=='wachtwoord')
		{
			element.value = '';
		}
	}
}

function blurme(field, element)
{
	if (field=='mail')
	{
		if (element.value=='')
		{
			element.value = 'e-mail';
		}
	}
	else
	{
		if (element.value=='')
		{
			element.value = 'wachtwoord';
		}
	}
}

function toggleLabels(val)
{
	setCookie('editlabels', val, null);
	document.location.reload();
}

function inputBlur(obj, myvalue)
{
	if (obj.value=='') obj.value=myvalue;
}

function inputFocus(obj, myvalue)
{
	if (obj.value==myvalue) obj.value='';
}

function checknieuwsbriefform(formobj, naamtext, emailtext)
{
	if ($E('#nieuwsbriefnaam').value==naamtext) 
	{
		alert(getattr($E('#nieuwsbriefnaam'),'formErrormsg'));
		try
		{
			$E('#nieuwsbriefnaam').focus();
		}
		catch(e)
		{
		}
		return false;
	}
	if ($E('#nieuwsbriefemail').value==emailtext) 
	{
		alert(getattr($E('#nieuwsbriefemail'),'formErrormsg'));
		try
		{
			$E('#nieuwsbriefemail').focus();
		}
		catch(e)
		{
		}
		return false;
	}
	if (checkFrm(formobj)==false)
	{
		return false;
	}
	
	formobj.submit();
}


function getattr(objItem, strAttribName)
{
	return (objItem.getAttribute(strAttribName)) ? objItem.getAttribute(strAttribName) : '';
}
