function validate_required(field,alerttxt)
{
	with (field)
	{
		if (value==null || value=="")
		{
		  	alert(alerttxt); 
			return false;
		}
		else 
		{
			return true
		}
	}
}

function validate_form(thisform)
{
	with (thisform)
	{
		
		if (validate_required(vardas, "Įrašykite savo vardą.")==false)
  		{
		  	vardas.focus();
			return false;
		}
  
		if (validate_required(komentaras, "Įrašykite komentarą.")==false)
		{
			komentaras.focus();
			return false;
		}
		

	}
}
//--------------------------------------------------------------------------


function pav_iterpimo_tikrinimas(thisform)
{
	with(thisform)
	{
		if (validate_required(pic, "Pasirinkite failą.")==false)
  		{
		  	pic.focus();
			return false;
		}
	}
	
}
//----------------------------------------------------------------

function tikrinti_apie_mus(thisform)
{
	with (thisform)
	{
		if (validate_required(apie_mus, "Negalima palikti tuščio lauko. Įrašykite informaciją.")==false)
		{
			apie_mus.focus();
			return false;
		}
		

	}
}

//-----------------------------------------------------------------


function tikrintiForma(thisform)
{
	with(thisform)
	{
		frmCheckForm = document.komentarai;
		var chks = document.getElementsByName('checkbox[]');
		var hasChecked = false;
	
		for (var i = 0; i < chks.length; i++)
	    {
			if (chks[i].checked)
	        {
				hasChecked = true;
				break;
	        }
	    }
	    
		if (!hasChecked)
		{
			alert("Pažymėkite bent vieną komentarą.");
		    chks[0].focus();
		    return false;
		
		}
 	}    
}

//--------------------------------------------------------------
function tikrinti_pav_trynima(thisform)
{
	with(thisform)
	{
		frmCheckForm = document.galerijos_trynimas;
		var chks = document.getElementsByName('checkbox[]');
		var hasChecked = false;
	
		for (var i = 0; i < chks.length; i++)
	    {
			if (chks[i].checked)
	        {
				hasChecked = true;
				break;
	        }
	    }
	    
		if (!hasChecked)
		{
			alert("Pažymėkite bent vieną paveiksliuką, kurį norite ištrinti.");
		    chks[0].focus();
		    return false;
		
		}
 	}    
}
//-------------------------------------------------------------

function tikrinti_radio(thisform)
{
	with(thisform)
	{
		frmCheckForm = document.partneriu_forma;
		var chks = document.getElementsByName('radio');
		var hasChecked = false;
	
		for (var i = 0; i < chks.length; i++)
	    {
			if (chks[i].checked)
	        {
				hasChecked = true;
				break;
	        }
	    }
	    
		if (!hasChecked)
		{
			alert("Pažymėkite bent vieną eilutę.");
		    chks[0].focus();
		    return false;
		
		}
		
		return true;
 	}    
}

//----------------------------------------------------
function tikrinti_kainu_forma(thisform)
{
	with(thisform)
	{
		frmCheckForm = document.kainu_forma;
		var chks = document.getElementsByName('radio_kainos');
		var hasChecked = false;
	
		for (var i = 0; i < chks.length; i++)
	    {
			if (chks[i].checked)
	        {
				hasChecked = true;
				break;
	        }
	    }
	    
		if (!hasChecked)
		{
			alert("Pažymėkite bent vieną eilutę.");
		    chks[0].focus();
		    return false;
		
		}
		
		return true;
 	}    
}



