function show2(file)
{
	document.getElementById('main_photo').src=file;
}

function doPrint(id) {
	newwindow2=window.open('','name','height=500,width=800,resizable=yes,scrollbars=yes');
	var tmp = newwindow2.document;
	tmp.write('<html><head><title>Spausdinti</title>');
	tmp.write('<link rel="stylesheet" href="../css/pop_style.css">');
	tmp.write('</head><body onload="window.focus();window.print();window.close();">');
	tmp.write('<table bgcolor="#FFFFFF"><tr><td width="800" align="left" valign="top" class="lent_content">');
	tmp.write(document.getElementById(id).innerHTML);
	tmp.write('</td></tr></table></body></html>');
	tmp.close();
}


function show_images(action)
{
	curimage_from = document.form1.images_from.value;
	curimage_to = document.form1.images_to.value;
	image_count = document.form1.images_count.value;
	
	//alert('from='+curimage_from+', to='+curimage_to);
	
	if (action == 'next')
	{
		curimage_from = parseInt(curimage_from)+4;
		curimage_to = parseInt(curimage_to)+4;
	
		
		document.form1.arrow_top.style.display='block';
		
		if (curimage_to+1 >= image_count)
		{
			document.form1.arrow_bottom.style.display='none';
		}
		
	}
	else
	{
		curimage_from = parseInt(curimage_from)-4;
		curimage_to = parseInt(curimage_to)-4;
		
		if (curimage_from == 0)
		{
			document.form1.arrow_top.style.display='none';
		}
		if (curimage_to != image_count)
		{
			document.form1.arrow_bottom.style.display='block';
		}
		
	}
	
	
	for (i=0;i<image_count;i++)
	{
		if (i>=curimage_from && i<=curimage_to)
		{
			//alert('[0]='+i+'[1]='+curimage_from+'[2]='+curimage_to);
			document.getElementById('image_'+i).style.display='block';
		}
		else
		{
			document.getElementById('image_'+i).style.display='none';
		}
	}
	
	
	document.form1.images_from.value = curimage_from;
	document.form1.images_to.value = curimage_to;
	
	//alert('from='+curimage_from+', to='+curimage_to);
}




function valid_form(thisform) 
{	
  if(!thisform.nick.value)
  {
    thisform.nick.focus();
    alert('Prašome įvesti slapyvardį.');
    return false;
  }
  if(!thisform.email.value.match(/^(\S+)@(\S+)\.(\S+)/))
  {
    thisform.email.focus();
    alert('Prašome įvesti teisingą el. paštą.');
    return false;
  } 
  if(!thisform.pass_0.value)
  {
    thisform.pass_0.focus();
    alert('Prašome įvesti slaptažodį.');
    return false;
  }
  if(thisform.pass_0.value != thisform.pass_1.value)
  {
    thisform.pass_0.focus();
    alert('Slaptažodžiai nesutampa!');
    return false;
  }
   if(!thisform.name.value)
  {
    thisform.name.focus();
    alert('Prašome įvesti vardą.');
    return false;
  }
  if(!thisform.lastname.value)
  {
    thisform.lastname.focus();
    alert('Prašome įvesti pavardę.');
    return false;
  }

  if(thisform.accept.checked == false)
  {
    thisform.phone.focus();
    alert('Privalote sutikti su salygomis ir taisyklėmis.');
    return false;
  } 
 
 
 return true;
 
 
}



function handler_submit_button(value)
{
	if (document.getElementById("reg_form_accept").checked == true)
	{
		document.getElementById("reg_on").style.display = 'block';
		document.getElementById("reg_off").style.display = 'none';
	}
	else
	{
		document.getElementById("reg_off").style.display = 'block';
		document.getElementById("reg_on").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
rnd = Math.round(1000*Math.random());
newWin1 = window.open(thePage,'popup'+rnd,'toolbars=no,resizable=yes,scrollbars=yes,left='+leftPos+',top='+topPos+',width='+wt+',height='+ht) 
} 

function textCounter(field, maxlimit) 
{
	if (field.value.length > maxlimit) 
	{
		field.value = field.value.substring(0, maxlimit);
	}
}




