function Di(t,v){if(!~~(v=t.value+1))t.value=(v=parseFloat(v))?v:''}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function changeColor(color){
  var el=event.srcElement
  if (el.tagName=="INPUT"&&el.type=="submit")
  event.srcElement.style.backgroundColor=color
}

function setBgImage(element,imageFile) {
  element.style.backgroundImage="url("+imageFile+")";
  element.style.color="#002E46";
}

function setBgImageOver(element,imageFile) {
  element.style.backgroundImage="url("+imageFile+")";
  element.style.color="#000000";
}

function displayWindow(url, width, height) {
        var Win = window.open(url,"displayWindow",'width=' + width + ',height=' + height + ',resizable=0,scrollbars=no,menubar=no' );
}

function setCheckboxes(the_form, do_check)
{

    var elts      = document.forms[the_form].elements;
    var elts_cnt  = elts.length;

	for (var i = 0; i < elts_cnt; i++) {
		if (elts[i].type=="checkbox") elts[i].checked = do_check;
    } // end for

    return true;
}

/**
 * Sets/unsets the pointer in browse mode
 *
 * @param   object   the table row
 * @param   object   the color to use for this row
 * @param   object   the background color
 *
 * @return  boolean  whether pointer is set or not
 */
function setPointer(theRow, thePointerColor, theNormalBgColor)
{
    var theCells = null;

    if (thePointerColor == '' || typeof(theRow.style) == 'undefined') return false;
    if (typeof(document.getElementsByTagName) != 'undefined') theCells = theRow.getElementsByTagName('td');
    else if (typeof(theRow.cells) != 'undefined') theCells = theRow.cells; 
    else return false;

    var rowCellsCnt  = theCells.length;
    var currentColor = null;
    var newColor     = null;
    // Opera does not return valid values with "getAttribute"
    if (typeof(window.opera) == 'undefined'
        && typeof(theCells[0].getAttribute) != 'undefined' && typeof(theCells[0].getAttribute) != 'undefined') {
        currentColor = theCells[0].getAttribute('bgcolor');
        newColor     = (currentColor.toLowerCase() == thePointerColor.toLowerCase())
                     ? theNormalBgColor
                     : thePointerColor;
        for (var c = 0; c < rowCellsCnt; c++) {
            theCells[c].setAttribute('bgcolor', newColor, 0);
        } // end for
    }
    else {
        currentColor = theCells[0].style.backgroundColor;
        newColor     = (currentColor.toLowerCase() == thePointerColor.toLowerCase())
                     ? theNormalBgColor
                     : thePointerColor;
        for (var c = 0; c < rowCellsCnt; c++) {
            theCells[c].style.backgroundColor = newColor;
        }
    }

    return true;
} // end of the 'setPointer()' function

			

function jak_w_nazwie_wlasnej(ciag)
{
var fraza=ciag;
var frazaTab=fraza.split(' ')
for(var i=0;i<frazaTab.length;i++){
	frazaTab[i]=frazaTab[i].substr(0,1).toUpperCase()+frazaTab[i].substr
(1).toLowerCase();
}
fraza=frazaTab.join(' ');
return(fraza);
}


function round (n) {
n = Math.round(n * 100) / 100;
n = (n + 0.001) + '';
return n.substring(0, n.indexOf('.') + 3);
}


function recount()
{
	doc = document;
	ie=doc.all;
	ns4=doc.layers;
	up5=doc.getElementById ? doc.getElementsByTagName('div') : 0;
	ns6=up5&&!ie;

	var df   = document.forms.frm_kalkulator;
		
	var jsT_Jezyk = 0

	var jsT_Ilosc = 0
	var jsT_Pole1=0
	var jsT_Pole2=0
	var jsT_RTlumaczenia = 0
	var jsT_Specjalistyczne = 0
	var jsT_Razem = 0

//		alert(df.jezyk.value);

	if (df.jezyk.value!="-- wybierz  --")
	jsT_Jezyk=df.jezyk.value;
	
	if(df.pole[0].checked)
	{
	jsT_Ilosc=parseInt(df.ilosc_s.value);
	df.ilosc_z.disabled=true;
	df.ilosc_s.disabled=false;
	df.ilosc_z.value=jsT_Ilosc*1500;
	}
	
	if(df.pole[1].checked)
	{
	jsT_Ilosc=Math.ceil((df.ilosc_z.value/1500));
	df.ilosc_s.disabled=true;
	df.ilosc_z.disabled=false;
	df.ilosc_s.value=Math.ceil((df.ilosc_z.value/1500));
	}	

	jsT_RTlumaczenia=parseInt(df.rodzaj_tlumaczenia.value);
	if (df.specjalistyczne.checked) jsT_Specjalistyczne=30;
//	alert(jsT_Jezyk+' '+jsT_Stron+' '+jsT_RTlumaczenia+' '+jsT_Specjalistyczne);

//	jsT_Razem = ((jsT_Jezyk*jsT_Stron)+((jsT_Jezyk*jsT_Stron)*(jsT_Specjalistyczne/100))) *((100+jsT_RTlumaczenia)/100)


	jsT_Razem = jsT_Jezyk*jsT_Ilosc;
	jsT_Razem = jsT_Razem*((100+jsT_Specjalistyczne)/100);
	jsT_Razem = jsT_Razem*parseFloat(((100+jsT_RTlumaczenia)/100));

	jsT_Razem = round(jsT_Razem,7);
	document.getElementById('koszt').innerHTML='<strong>'+jsT_Razem+'</strong>';
}


function validateemail(pole) {
if(pole.indexOf("@")==-1 || pole.indexOf(".")==-1) return false;
return true;
}

function validate_zamowienie()
{

  f = document.forms['frm_zamowienie'];

  if (f.jezyk.options[f.jezyk.selectedIndex].value == "-- wybierz  --") {
    window.alert("Wybierz język na który chcesz przetłumaczyć!");
    return false;
  }

  if (f.imie.value == "") {
    window.alert("Podaj imię!");
    return false;
  }

  if (f.nazwisko.value == "") {
    window.alert("Podaj nazwisko!");
    return false;
  }

//  if (!f.warunki.checked) {
//    window.alert("Wymagana jest zgoda dotycząca \"Ogólnych warunków świadczenia usług tłumaczeniowych\" w przypadku późniejszego złożenia zlecenia!");
//    return false;
//  }

  if (!validateemail(f.email.value)) {
    window.alert("Podaj prawidłowy email!");
    return false;
  }


  return true;
}

spml_a = "biuro";
spml_b = "%40";
spml_c = "almand.pl";


function validate_zamowienie()
{

  f = document.forms['payform'];

  if (f.desc.value == "") {
    window.alert("Podaj tytuł wpłaty!");
    return false;
  }

  if (f.amount.value == "") {
    window.alert("Podaj kwotę wpłaty!");
    return false;
  }

  if (f.first_name.value == "") {
    window.alert("Podaj imię!");
    return false;
  }

  if (f.last_name.value == "") {
    window.alert("Podaj nazwisko!");
    return false;
  }

  if (f.street.value == "") {
    window.alert("Podaj ulicę!");
    return false;
  }

  if (f.postcode.value == "") {
    window.alert("Podaj kod pocztowy!");
    return false;
  }

  if (f.city.value == "") {
    window.alert("Podaj miasto!");
    return false;
  }

  if (!validateemail(f.email.value)) {
    window.alert("Podaj prawidłowy email!");
    return false;
  }


 f.amount.value=(parseFloat(f.amount.value)*100);
//  alert(f.amount.value); 
  return true;
}
