// JavaScript Document
function test()
{
	alert("##");	
}

function check_valid_f(thisform) 
{

  if(!thisform.vardas_pavarde.value)
  {
    thisform.vardas_pavarde.focus();
    alert('Prašome įvesti vardą ir pavardę.');
    return false;
  } 
  if(!thisform.el_pastas.value.match(/^(\S+)@(\S+)\.(\S+)/))
  {
    thisform.el_pastas.focus();
    alert('Prašome įvesti teisingą el. paštą.');
    return false;
  }  
  if(!thisform.regionas.value)
  {
    thisform.uzklausa.focus();
    alert('Prašome pasirinkti regioną.');
    return false;
  } 
  if(!thisform.telefonas.value)
  {
    thisform.telefonas.focus();
    alert('Prašome įvesti savo telefono numerį.');
    return false;
  } 
  if(!thisform.uzklausa.value)
  {
    thisform.uzklausa.focus();
    alert('Prašome įvesti užklausą.');
    return false;
  } 

  thisform.action='page/Mail/greita_uzklausa_mail.php';
  return true;
}

function _check_valid_f(thisform) 
{
  if(!thisform.vardas_pavarde.value)
  {
    thisform.vardas_pavarde.focus();
    alert('Prašom įvesti vardą ir pavardę.');
    return false;
  } 
  if(!thisform.el_pastas.value.match(/^(\S+)@(\S+)\.(\S+)/))
  {
    thisform.el_pastas.focus();
    alert('Prašome įvesti teisingą el. paštą.');
    return false;
  }
  if(!thisform.telefonas.value)
  {
    thisform.telefonas.focus();
    alert('Prašome įvesti savo telefono numerį.');
    return false;
  } 
  if(!thisform.uzklausa.value)
  {
    thisform.uzklausa.focus();
    alert('Prašome įvesti užklausą.');
    return false;
  } 
  thisform.action='page/Mail/greita_uzklausa_mail.php';
  return true;
}

function check_valid_f_en(thisform) 
{
  if(!thisform.vardas_pavarde.value)
  {
    thisform.vardas_pavarde.focus();
    alert('Please enter your name and lastname.');
    return false;
  } 
  if(!thisform.el_pastas.value.match(/^(\S+)@(\S+)\.(\S+)/))
  {
    thisform.el_pastas.focus();
    alert('Please enter your email.');
    return false;
  }
  if(!thisform.telefonas.value)
  {
    thisform.telefonas.focus();
    alert('Please enter your phone.');
    return false;
  } 
  if(!thisform.uzklausa.value)
  {
    thisform.uzklausa.focus();
    alert('Please enter your request.');
    return false;
  } 
  thisform.action='sport_send.php';
  return true;
}

function ch_travel_type(id){
	travel_type=document.search.travel_type.value;
	destination=document.search.destination;
	var destination_sel=(id)?id:destination.options[destination.selectedIndex].value;
	destination.options.length = 1;
	if(travel_type=='rest'){
		for(i=0;i<rest_countrys.length;i++){
			destination.options[i+1] = new Option(rest_countrys[i],rest_countrys_codes[i]);
		}
	}
	if(travel_type=='know'){
		for(i=0;i<know_countrys.length;i++){
			destination.options[i+1] = new Option(know_countrys[i],know_countrys_codes[i]);
		}
	}
	if(travel_type=='rest_know'){
		for(i=0;i<rest_know_countrys.length;i++){
			destination.options[i+1] = new Option(rest_know_countrys[i],rest_know_countrys_codes[i]);
		}
	}
	if(travel_type=='far'){
		for(i=0;i<far_countrys.length;i++){
			destination.options[i+1] = new Option(far_countrys[i],far_countrys_codes[i]);
		}
	}
	for(i=0;i<destination.options.length;i++){
		if(destination.options[i].value==destination_sel)destination.options[i].selected=true;
	}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function show(ob){
	o=document.getElementById(ob);
	o.style.display="block";
}
function hide(ob){
	o=document.getElementById(ob);
	o.style.display="none";
}

function getPage(thePage,wt,ht){ 
if(wt=="")wt=300;
if(ht=="")wt=300;
leftPos= (screen.width-wt)/2 
topPos = (screen.height-ht)/2 
newWin1 = window.open(thePage,'aWin','toolbars=no,resizable=yes,scrollbars=yes,left='+leftPos+',top='+topPos+',width='+wt+',height='+ht) 
} 

function popImg(thePage,wt,ht){ 
if(!wt)wt=300;
if(!ht)ht=300;
//leftPos= (screen.width-wt)/2 
//topPos = (screen.height-ht)/2 
leftPos=100;
topPos =100;
newWin1 = window.open("view_image.php?src="+thePage,'aWin2','toolbars=no,resizable=yes,scrollbars=yes,left='+leftPos+',top='+topPos+',width='+wt+',height='+ht) 
} 

// prevents IE from flickering background images
try {  document.execCommand('BackgroundImageCache', false, true);} catch(e) {}

function doPrint(id) {
	newwindow2=window.open('','name','height=500,width=700,resizable=yes,scrollbars=yes');
	var tmp = newwindow2.document;
	tmp.write('<html><head><title>Spausdinti</title>');
	tmp.write('<link rel="stylesheet" href="css/style.css">');
	tmp.write('</head><body onload="window.focus();window.print();window.close();">');
	tmp.write('<table bgcolor="#FFFFFF"><tr><td width="725" align="left" valign="top" class="lent_content">');
	tmp.write(document.getElementById(id).innerHTML);
	tmp.write('</td></tr></table></body></html>');
	tmp.write('<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script><script type="text/javascript">_uacct = "UA-118918-5";urchinTracker();</script>');
	tmp.write('<script type="text/javascript">var gemius_identifier = new String(\'d0zqj87QN7kp9iAQFcA40_TSP6IF3sbhDA_WKjbKZWv.47\');</script><script type="text/javascript" src="http://www.novaturas.lt/js/gemius.js"></script>');
	tmp.close();
}

function chDate(){
	date_f=document.search.date_f.value;
	date_t=document.search.date_t.value;
	if(date_t=="" || date_t.replace(/-/g, "")<date_f.replace(/-/g, "")){
		document.search.date_t.value=document.search.date_f.value;
	}
}

function valid_form(thisform) 
{
  if(!thisform.vardas.value)
  {
    thisform.vardas.focus();
    alert('Prašom įvesti vardą.');
    return false;
  } 
  if(!thisform.pavarde.value)
  {
    thisform.pavarde.focus();
    alert('Prašom įvesti pavardę.');
    return false;
  } 
  if(!thisform.telefonas.value)
  {
    thisform.telefonas.focus();
    alert('Prašome įvesti savo telefono numerį.');
    return false;
  } 
  if(!thisform.valanda.value)
  {
    thisform.valanda.focus();
    alert('Prašome pasirinkti susisiekimo laiką.');
    return false;
  }
  
  thisform.action='?cat=nuolaidos&send=true';
  return true;
}




