$(document).ready(function(){
	if (!window.isEditor)
	{
		pushDate();
		styleTable();
	}
});

function pushDate()
{
	var dest = document.getElementById("date-box");
	var today = new Date();
	var d = today.getDate();
	var m = parseInt(today.getMonth()) + 1;
	var y = today.getYear();
	
	d = fixDate(d);
	m = fixDate(m);
	
	if (dest != null)
		dest.innerHTML=d+"."+m+"."+y;
}

function fixDate(input)
{
	if (input < 10)
	{
		input = "0"+ input;
	}
	
	return input;
}

function styleTable()
{
	var classNames = {
		0: 'even',
		1: 'odd'
	};

	$(".design-table").each(function(){
		$(this).find("tr").each(function(){
			$(this).children().each(function(index){
				if (index < 2 )
					$(this).addClass("left-align");
				else
					$(this).addClass("right-align");
					
				$(this).addClass(classNames[index % 2]);
			});
		});
	});
}

top.window.customPostFormulier = function(form) {
	var btnSend = document.getElementById("btnsend");
	if (btnSend != null) {
		top.btnSend = btnSend;
		btnSend.disabled = true;
		
		top.window.showButtons = function() {			
			proxy.mtHide("POSTMSG");
			proxy.mtShow("POSTFORM");
			proxy.mtShow("SAVEFORM");
			proxy.mtShow("CLEARFORM");
			if (top.btnSend != null) {
				top.btnSend.disabled = false;
			}
		}
	}	
	form.submit();
	return true;
}
