// JavaScript Document
document.getElementsByTagName('html')[0].className = "scriptEnabled"; 
function togSub(link) {  
var subListS = link.parentNode.getElementsByTagName('ul')[0].style;  
subListS.display = (!subListS.display )? 'block' : ''; 
}
function isNumberKey(evt)
      {
         var charCode = (evt.which) ? evt.which : event.keyCode
         if (charCode > 31 && (charCode < 48 || charCode > 57))
            return false;

         return true;

      }
	  var ajaxObj = new XMLHTTP("mybic_server.php");
	  // ajaxObj.debug=1;

function loadBox(index)
{
document.getElementById("loading").style.display= 'block';
ajaxObj.method="GET";
//ajaxObj.debug=true;
ajaxObj.call("action=ajax&make_id="+index, loadBand);
}

function changeStatus(act,condition_id,status_id)
{
ajaxObj.method="GET";
ajaxObj.call("action=ajax&condition_id="+condition_id+"&act="+act+"&status_id="+status_id, none);
}
function none(resp){

}
function loadBand(resp)
{
document.getElementById("loading").style.display= 'none';
document.getElementById('res').innerHTML = resp;
}
function confirmDeletion()
{
if (confirm("You are about going to delete these items and any references on another tables.\n\n Are you sure? "))
{
	form1.submit();
}
}
function evaluateCharity()
{
	if (document.getElementById('form1').charity_name.value == "")
	{
		alert("Charity name must be filled");
		return false;
	} 

	document.getElementById('form1').submit();
	
	
}
function evaluateMake()
{
	if (document.getElementById('form1').make_name.value == "")
	{
		alert("Make name is obligatory");
		return false;
	}
	
	document.getElementById('form1').submit();
	
}
function evaluateModel()
{
	try
	{
		document.getElementById('form1').make_id.value
			if (document.getElementById('form1').model_name.value == "")
	{
		alert("Model name is obligatory");
		return false;
	} else {
		document.getElementById('form1').submit();	
	}
	}
	catch(err)
	{
	}


}
function evaluateStatus()
{
	if (document.getElementById('form1').status_name.value == "")
	{
		alert("Status name is obligatory");
		return false;
	}
	
	document.getElementById('form1').submit();

}
function evaluateCondition()
{
	try
	{
		document.getElementById('form1').model_id.value;
		if (document.getElementById('form1').condition_year_till.value == "" || document.getElementById('form1').condition_year_from.value == "")
		{
			alert("From / To years and Status values are obligatory");
		} else {
			document.getElementById('form1').submit();	
		}
		
	}
	catch(err)
	{
		alert ("Model is obligatory");
	}


}

function myfunc(state)
{   
	try 
	{
		mywindow.focus();	
	}
	catch(err)
	{
	mywindow=window.open('showimg.php?state='+state,'','width=500,height=500,scrollbars=yes');
	if (window.focus) {mywindow.focus()}
	}
	
}
