	function checkemail(object_value){
		if(!(object_value.indexOf("@") > -1 && object_value.indexOf(".") > -1))
			return false;    
			return true;
	}
	
	function CheckContactForm(form){
		if (document.getElementById("vardas").value=="" ) {alert('Prašome įvesti vardą!'); document.getElementById("vardas").focus(); return false;}
			
		if(!checkemail(form.email.value))
		{
			alert("Prašome įvesti teisingą el. pašto adresą!");
			document.getElementById("email").focus();
			return false;
		}
			
		if (document.getElementById("tema").value=="0"){
			alert('Prašome pasirinkti temą!'); document.getElementById("tema").focus(); return false;
		}
			
		if (document.getElementById("publicKey").value==""){
			alert('Prašome įvesti saugos kodą!'); document.getElementById("publicKey").focus(); return false;
		}
			
			
			
		if (document.getElementById("turinys").value==""){
			alert('Prašome įrašyti klausimą.'); document.getElementById("turinys").focus(); return false;
		}
	}
		
		
	var count = 0;
	// Reload the CAPTCHA
	function reloadCaptcha2() {
		frm = document.getElementById("simple_captcha");
		opacity2("simple_captcha", 100, 0, 300);
		count++;
		frm.src = "http://www.pinigukarta.lt/wp-content/themes/pinigukarta/captcha/gdimg.php?re=" + count;
		opacity2("simple_captcha", 0, 100, 300);
		
	}
	
	// Change opacity
	function opacity2(id, opacStart, opacEnd, millisec) {
		//speed for each frame
		var speed = Math.round(millisec / 100);
		var timer = 0;
	
		//determine the direction for the blending, if start and end are the same nothing happens
		if(opacStart > opacEnd) {
			for(i = opacStart; i >= opacEnd; i--) {
				setTimeout("changeOpac2(" + i + ",'" + id + "')",(timer * speed));
				timer++;
			}
		} else if(opacStart < opacEnd) {
			for(i = opacStart; i <= opacEnd; i++)
				{
				setTimeout("changeOpac2(" + i + ",'" + id + "')",(timer * speed));
				timer++;
			}
		}
	}

	// Change the opacity for different browsers
	function changeOpac2(opacity, id) {
		var object = document.getElementById(id).style;
		object.opacity = (opacity / 100);
		object.MozOpacity = (opacity / 100);
		object.KhtmlOpacity = (opacity / 100);
		object.filter = "alpha(opacity=" + opacity + ")";
	} 
	
