
function writeFlash(movieLocation,width,height){
  document.write('<object id="flashmast" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+width+'" height="'+height+'"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="'+movieLocation+'" /><param name="quality" value="high" /><embed id="flashembed" src="'+movieLocation+'" quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" width="'+width+'" height="'+height+'"></embed></object>');
}

//var address = "http://localhost/viaoptima/";
var address = "http://www.viaoptima.lt/";

function echeck() {
	
	var neisvesti_duomenys = document.getElementById('no_data').value;
	var blogas_el_pastas = document.getElementById('no_email').value;

		if (document.getElementById('name').value.length == 0  || document.getElementById('email').value.length == 0 || document.getElementById('text').value.length == 0){
			alert(neisvesti_duomenys);
			return false;
		}
		
		
		if ( check_mail('email', blogas_el_pastas) )
			var form = document.getElementById('send_query');		
			form.submit();		
	
	}
	
function check_mail(email, blogas_el_pastas){
	
		str = document.getElementById(email).value;
		
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert(blogas_el_pastas)
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert(blogas_el_pastas)
		   return false
		}
		
		
		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert(blogas_el_pastas)
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert(blogas_el_pastas)
		    return false
		 }
		 
		

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert(blogas_el_pastas)
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert(blogas_el_pastas)
		    return false
		 }
		 
		
		 if (str.indexOf(" ")!=-1){
		    alert(blogas_el_pastas)
		    return false
		 }
		 
		 mas = str.split('.')		 
		 galune = mas[mas.length-1];
		 if (galune==""){
		 	 alert(blogas_el_pastas)
			 return false;
		 }
		 
		 return true;
	
}

function active_top_items(name){
	document.getElementById(name).style.backgroundImage="url('"+address+"img/"+name+"_active.gif')";
}
function not_active_top_items(name){
	document.getElementById(name).style.backgroundImage="url('"+address+"img/"+name+"_not_active.gif')";
}

function active_top_items_mail(name){
	document.getElementById(name).src=address+"img/"+name+"_active.gif";
}

function not_active_top_items_mail(name){
	document.getElementById(name).src=address+"img/"+name+"_not_active.gif";
}


function print_active(){
	document.getElementById('printas').src=address+'img/print_active.gif';
	//document.getElementById('printas_a').style.color="#9C1C19";
}

function print_not_active(){
	document.getElementById('printas').src=address+'img/print_not_active.gif';
	//document.getElementById('printas_a').style.color="#444444";
}

function active_button(id){
	if (id==1){
		document.getElementById('sbm').style.backgroundImage="url('"+address+"img/button-active.gif')";
	}
	else
		document.getElementById('res').style.backgroundImage="url('"+address+"img/button-active.gif')";

}
function not_active_button(id){
	if (id==1){
		document.getElementById('sbm').style.backgroundImage="url('"+address+"img/button-not-active.gif')";
	}
	else
		document.getElementById('res').style.backgroundImage="url('"+address+"img/button-not-active.gif')";

}

function go_banner (id, unique_id, url, clicked){
	
	//tipo paspaude
	var imgas = new Image();
	imgas.src = address+'banner.php?id='+id+'&unique_id='+unique_id+'&clicked='+clicked;
	
	window.open(url,'_blank');
}

