function ShowComandaForm(Tiraj, TirajMaxim) 
{
	tirajWarningDiv = document.getElementById('Tiraj-warning');
	if(Tiraj >= TirajMaxim) tirajWarningDiv.style.display = 'block';
	else tirajWarningDiv.style.display = 'none';
	
	comandaDiv = document.getElementById('Comanda');
	comandaDiv.style.display = 'block';
 	
	tiraj = document.getElementById('Tiraj');
	tiraj.value = Tiraj;
	
	tiraj = document.getElementById('Tiraj-label');
	tiraj.innerHTML = Tiraj + ' bucati';
}
function ShowDiv(divID, toHide) 
{
	elementsToHide = document.getElementsByName(toHide);
	
	div = document.getElementById(divID);
	
	if(div.style.display == 'block') Display = 'none';
	else Display = 'block';
	
	for(i = 0; i < elementsToHide.length; i++)
		elementsToHide.item(i).style.display = 'none';
	
	div.style.display = Display;
}

//window.onload = setCorrectSize;
//window.onresize = setCorrectSize;
function open_win(file,wid,hei)
{
	window.open(file,"_blank","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=yes, width="+parseInt(wid)+", height="+parseInt(hei))
}

function getSize(coord)
{
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
 	} 
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} 
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	if(coord == 'h') return myHeight;
	if(coord == 'w') return myWidth;
}

function setCorrectSize() 
{
	windowHeight = getSize('h');
	
 	pageDiv = document.getElementById('page');
	pageHeight = pageDiv.offsetHeight;
	
	if(pageHeight + 335 < windowHeight) 
		pageDiv.style.height = windowHeight - 335 + 'px';
}

function addEvent(obj, evType, fn){ 
 if (obj.addEventListener){ 
   obj.addEventListener(evType, fn, false); 
   return true; 
 } else if (obj.attachEvent){ 
   var r = obj.attachEvent("on"+evType, fn); 
   return r; 
 } else { 
   return false; 
 } 
}
//addEvent(window, 'load', foo);
//addEvent(window, 'load', bar);
