function fp1i(el) { el.style.backgroundColor='#D6D6D6'; }
function fp1o(el) { el.style.backgroundColor='#E1E1E1'; }
function fp2i(el) { el.style.backgroundColor='#E2E2E2'; }
function fp2o(el) { el.style.backgroundColor='#FFFFFF'; }
function ip1i(el) { el.style.backgroundColor='#D6D6D6'; }
function ip1o(el) { el.style.backgroundColor='#E1E1E1'; }
function ip2i(el) { el.style.backgroundColor='#E2E2E2'; }
function ip2o(el) { el.style.backgroundColor='#FFFFFF'; }

function noteikumi(x)
    { window.open("noteikumi.php","info","width=760,height=740,screenX=100,screenY=100,scrollbars=yes,resizable=yes");
       }

function details(numurs)
{ var links = "details.php?point=" + numurs;
window.open(links,"detalas","width=700,height=700,scrollbars=yes,resizable=yes"); }

function atvert(url,hight)
{ var attr= "scrollbars=yes,resizable=yes,width=700,height="+hight;
window.open(url,"detalas",attr); }

function info(url)
{ window.open(url,"info","width=400,height=215,screenX=100,screenY=100"); }

function samaksa(ls, cust_no)
{
var links = "samaksa.php?atlikums_ls=" + ls + "&cust_no=" + cust_no;
 window.open(links,"info","width=500,height=284,screenX=100,screenY=100,resizable=yes");
 return 
  }

function konts(url)
{ window.open(url,"konts","width=800,height=650,scrollbars=yes,resizable=yes,screenX=30,screenY=30"); }

function valuta(url, eur_value)
{ var links = url + "?eur_value=" + eur_value;
 window.open(links,"valuta","width=200,height=300"); }

function parent_login(url)
{ opener.location.href= url; 
  window.close(); }
    
function piemers(url)
{ window.open(url,"info","width=750,height=250,screenX=100,screenY=100,resizable=yes"); }

function warten(prmSec)
  {
  prmSec *= 1000;
  var eDate = null;
  var eMsec = 0;
  var sDate = new Date();
  var sMsec = sDate.getTime();
  do {
      eDate = new Date();
      eMsec = eDate.getTime();
  } while ((eMsec-sMsec)<prmSec);
}


function ebaylogout(sec)
{ window.open("http://signin.ebay.de/ws/eBayISAPI.dll?SignIn","ebay","screenX=1,screenY=1,resizable=yes,menubar=yes,scrollbars=1"); 
warten(sec); }


	function addText(id,text) 
		{ 
//		if(document.all) 
		  	{ // Internet Explorer 4+
			// alert ("MS Explorer");
		  	document.all[id].innerHTML=text;
 			}
// 		else if(document.getElementById)
 			{ // W3C konform zB. Opera, Mozilla, Netscape 6+ 
//  			 alert ("Opera, Mozilla, Netscape 6+");
//  			var hello=document.createTextNode(text);
//  			document.getElementById(id).replaceChild(hello, document.getElementById(id).firstChild);
 			}
		}
	function decimali_2(input)
		{
		if (isNaN(input)) var input_string = input;
		    else var input_string = String(input);
		var input_num = parseFloat(input_string.replace(/,/, "."));
		var k = (Math.round(input_num * 100) / 100).toString();
		k += (k.indexOf('.') == -1)? '.00' : '00';
		var p = k.indexOf('.'), m = k.indexOf('-.');
		var f = (p == 0 || m == 0)? '0.' : '.';
 		output = k.substring(0, p) + f + k.substring(p+1, p+3);
 		return output;
		}	

   function rekinat_s(x)
	{
	if    ((document.shipp_small.mala_a.value>0)
		&& (document.shipp_small.mala_b.value>0)
		&& (document.shipp_small.mala_c.value>0))
		{
		v=document.shipp_small.mala_a.value*document.shipp_small.mala_b.value*document.shipp_small.mala_c.value;
		document.shipp_small.volume.value = v;
		price_eur = 0.0524*Math.sqrt(v);
		if (price_eur<3.12) price_eur=3.12;
		price = price_eur * document.shipp_small.eur_rate.value;
//		document.shipp_small.price_s.value = decimali_2(price);
		text3 = "<b>"+decimali_2(price)+"&nbsp;LVL</b>"; 
		addText("price_s", text3)
		}
//	else document.shipp_small.price_s.value = "";
	else addText("price_s", '');
	}

   function rekinat_b(x)
	{
	if    ((document.shipp_small.mala_a.value>0)
		&& (document.shipp_small.mala_b.value>0)
		&& (document.shipp_small.mala_c.value>0)
		&& (document.shipp_small.svars.value>40))
		{
		v=document.shipp_small.mala_a.value*document.shipp_small.mala_b.value*document.shipp_small.mala_c.value;
		document.shipp_small.volume.value = v;
		tepmoral=v*document.shipp_small.svars.value;
		price_eur = Math.sqrt(tepmoral)/80.15;
		price = price_eur * document.shipp_small.eur_rate.value;
// 		document.shipp_small.price_b.value = decimali_2(price);
		text3 = "<b>"+decimali_2(price)+"&nbsp;LVL</b>"; 
		addText("price_b", text3)
		}
//	else document.shipp_small.price_b.value = "";
	else addText("price_b", '');
	}

function rekinat(x)
	{
	if (document.shipp_small.veids[0].checked==true)
		return  rekinat_s('x');
	else  return  rekinat_b('X');
	}

   function set_svars_tr()
      {
      if (document.shipp_small.veids[0].checked == true)
		{
		document.getElementById("svars").style.display = 'none';
		document.getElementById("imanta").style.display = '';
		document.getElementById("klients").style.display = 'none';
		}
	  else
	  	{
	  	document.getElementById("svars").style.display = '';
		document.getElementById("imanta").style.display = 'none';
		document.getElementById("klients").style.display = '';
		}
	  return  rekinat('x');
	  }

function rekinat_valutu(text2_3)
	{
	if (decimali_2(document.calc.calc_value.value)>0)
		{
		document.getElementById("atstarpe").style.display = '';
		document.getElementById("rezultats1").style.display = '';
		document.getElementById("rezultats2").style.display = '';
		text1 = decimali_2(document.calc.calc_value.value)+" "+document.calc.currency.value+" = <b>";
		if (document.calc.currency.value=='EUR') ls_value = parseFloat(decimali_2(document.calc.calc_value.value))*parseFloat(document.calc.eur.value);
		if (document.calc.currency.value=='GBP') ls_value = parseFloat(decimali_2(document.calc.calc_value.value))*parseFloat(document.calc.gbp.value);
		if (document.calc.currency.value=='USD') ls_value = parseFloat(decimali_2(document.calc.calc_value.value))*parseFloat(document.calc.usd.value);
		if (document.calc.currency.value=='CAD') ls_value = parseFloat(decimali_2(document.calc.calc_value.value))*parseFloat(document.calc.cad.value);
		if (document.calc.currency.value=='AUD') ls_value = parseFloat(decimali_2(document.calc.calc_value.value))*parseFloat(document.calc.aud.value);
		text1 = text1+decimali_2(ls_value)+" LVL</b>"; 
		addText("rezultats3", text1)
		if (document.calc.currency.value=='EUR') 
			lv_procenti = 5;
		else lv_procenti = 8;

        if (ls_value<=300) ls_to_pay=ls_value*(1+lv_procenti/100);
			else ls_to_pay=300*(1+lv_procenti/100);
		if ((ls_value>300) && (document.calc.currency.value!='EUR'))
			ls_to_pay=ls_to_pay+(ls_value-300)*1.03;
		if ((ls_value>300) && (document.calc.currency.value=='EUR'))
			ls_to_pay=ls_to_pay+(ls_value-300)*1.00;

		text2 = text2_3+"&nbsp;+&nbsp;"+lv_procenti+"%&nbsp;=&nbsp;<font color=green><b>"+decimali_2(ls_to_pay)+" LVL</b></font>";
		addText("rezultats4", text2)
		}
	else
		{
		document.getElementById("atstarpe").style.display = '';
		document.getElementById("rezultats1").style.display = 'none';
		document.getElementById("rezultats2").style.display = 'none';
		document.all["rezultats3"].innerHTML="";
		document.all["rezultats4"].innerHTML="";
		}
	}

  