function checkValues()
{
	var virhe = 0;
	if(document.forms[0].kayttoehdot.checked == false)
	{
		alert('Hyväksy käytt&ouml;ehdot');
		return false;
	}
	if(chky(document.forms[0].yrityksen_y_tunnus.value) == false)
	{
		alert('Virheellinen y-tunnus');
		return false;
	}
	for(i=0;i<document.forms[0].elements.length;i++)
	{
		if(document.forms[0].elements[i].className == 'pakollinen')
		{
			if(/\w/.test(document.forms[0].elements[i].value) == false)
			{
				if(virhe == 0)
				{
					alert('Tarkista pakolliset tiedot');
					virhe = 1;
				}
				//punaiset reunat
				kentanNimi=document.forms[0].elements[i].name;
				document.getElementById(kentanNimi).style.border = '1px solid red';
			}

		}
	}
	if(virhe == 1)
	{
		var divs = document.getElementsByTagName("DIV");
		for(k = 0; k < divs.length; k++)
		{
			if(divs[k].id == "pakollinen")
			{
				divs[k].style.display="inline";
			}
		}
		return false;
	}
	return true;
}

function chky(y)
{
	if(y.length > 9)
		return false;
	if(y.length < 8)
		return false;
	if(y.length == 8)
		var checksum = y.substr(7,1);
	else
		var checksum = y.substr(8,1);
	var mp = [ 7, 9, 10, 5, 8, 4, 2 ];
	var sum=0;
	var check=0;
	var i;
	for (i = 0; i < 7; i++)
	{
		sum += mp[i] * (y.charCodeAt(i)-48);
	}
	check = sum%11;
	if(check == 0 && checksum == 0)
		return true;
	else if(check > 1 && (11 - check) == checksum)
		return true
	return false;
}
function txt_fill(lang)
{
	//kielituki
	var teksti=new Array();
	document.getElementById('kieli').value=lang;
	if(lang == 'fin')
	{
		teksti[0]="<h1>REKISTER&Ouml;ITYMINEN DUETTO&reg;PERINT&Auml;PALVELUUN</h1>Duetto&reg;-perint&auml;palvelulla l&auml;het&auml;t toimeksiannot helposti ja nopeasti<br/>perint&auml;&auml;n. T&auml;yt&auml; lomakkeelle yrityksesi tiedot.<br/>Vapaaehtoinen perint&auml; on toimeksiantajalle maksutonta.<br/><br/>T&auml;ytt&auml;m&auml;ll&auml; lomakkeen tiedot saat k&auml;ytt&auml;j&auml;kohtaisen tunnuksen<br/>Duetto&reg;-palveluun, jonka voit tulostaa tai ottaa muuten talteen.<br/>Duetto&reg;-palvelussa saat helposti l&auml;hetetty&auml; er&auml;&auml;ntyneen laskun<br/>tiedot perint&auml;&auml;n.<br/><br>Lis&auml;tietoa perint&auml;palveluistamme <a href=\"http://www.duettogroup.fi\" target=\"_blank\" class=\"linkki\">www.duettogroup.fi</a><br><br>";
		teksti[1]="<br><h2>Yrityksen tiedot:</h2>";
		teksti[2]="Y-tunnus:<div id=\"pakollinen\" style=\"display: none;\">*</div>";
		teksti[3]="Yrityksen nimi:<div id=\"pakollinen\" style=\"display: none;\">*</div>";
		teksti[4]="Osoite:<div id=\"pakollinen\" style=\"display: none;\">*</div>";
		teksti[5]="Postinumero:<div id=\"pakollinen\" style=\"display: none;\">*</div>";
		teksti[6]="Postitoimipaikka:<div id=\"pakollinen\" style=\"display: none;\">*</div>";
		teksti[7]="Yrityksen tilinumero:";
		teksti[8]="Yrityksen toimiala:";
		teksti[9]="Yrityksen henkil&ouml;st&ouml;m&auml;&auml;r&auml;:";
		teksti[10]="<br><br>K&auml;ytt&auml;m&auml;si taloushallinnan ohjelmisto:";
		teksti[11]="<input type=\"radio\" name=\"talousohjelma\" value=\"Fivaldi ASP\" id=\"Fivaldi ASP\"><label for=\"Fivaldi ASP\">Fivaldi ASP</label>";
		teksti[12]="<input type=\"radio\" name=\"talousohjelma\" value=\"Heeros\" id=\"Heeros\"><label for=\"Heeros\">Heeros</label>";
		teksti[13]="<input type=\"radio\" name=\"talousohjelma\" value=\"Maestro\" id=\"Maestro\"><label for=\"Maestro\">Maestro</label>";
		teksti[14]="<input type=\"radio\" name=\"talousohjelma\" value=\"Netbaron\" id=\"Netbaron\"><label for=\"Netbaron\">Netbaron</label>";
		teksti[15]="<input type=\"radio\" name=\"talousohjelma\" value=\"ProCountor\" id=\"ProCountor\"><label for=\"ProCountor\">ProCountor</label>";
		teksti[16]="<input type=\"radio\" name=\"talousohjelma\" value=\"SAP\" id=\"SAP\"><label for=\"SAP\">SAP</label>";
		teksti[17]="<input type=\"radio\" name=\"talousohjelma\" value=\"Tietokari Reski\" id=\"Tietokari Reski\"><label for=\"Tietokari Reski\">Tietokari Reski</label>";
		teksti[18]="<input type=\"radio\" name=\"talousohjelma\" value=\"Visma\" id=\"Visma\"><label for=\"Visma\">Visma</label>";
		teksti[19]="<input type=\"radio\" name=\"talousohjelma\" value=\"0\" id=\"muu_tal\" checked><label for=\"muu_tal\">Muu, mik&auml;?</label>&nbsp;<input type=\"text\" name=\"muu_talousohjelma\" size=\"20\" maxlength=\"64\" style=\"width:180\">";
		teksti[20]="<br><br>Mist&auml; kuulit Duetto Groupin palveluista?";
		teksti[21]="<input type=\"radio\" name=\"referenssi\" value=\"Internet\" id=\"Internet\"><label for=\"Internet\">Internet</label>";
		teksti[22]="<input type=\"radio\" name=\"referenssi\" value=\"Email\" id=\"Email\"><label for=\"Email\">S&auml;hk&ouml;posti</label>";
		teksti[23]="<input type=\"radio\" name=\"referenssi\" value=\"Koulutus\" id=\"Koulutus\"><label for=\"Koulutus\">Koulutus</label>";
		teksti[24]="<input type=\"radio\" name=\"referenssi\" value=\"Suosittelu\" id=\"Suosittelu\"><label for=\"Suosittelu\">Suosittelu, suosittelijan<br/>&nbsp;&nbsp;&nbsp;nimi ja yritys</label>&nbsp;<input type=\"text\" name=\"suosittelija_referenssi\" size=\"20\" maxlength=\"64\" style=\"width:180\">";
		teksti[25]="<input type=\"radio\" name=\"referenssi\" value=\"Muu\" id=\"muu\" checked><label for=\"muu\">Muu, mik&auml;?</label>&nbsp;<input type=\"text\" name=\"muu_referenssi\" size=\"20\" maxlength=\"64\" style=\"width:180\">";
		teksti[26]="<br><h2>K&auml;ytt&auml;j&auml;n tiedot:";
		teksti[27]="K&auml;ytt&auml;j&auml;n nimi:<div id=\"pakollinen\" style=\"display: none;\">*</div>";
		teksti[28]="Teht&auml;v&auml;nimike:";
		teksti[29]="Puhelin:<div id=\"pakollinen\" style=\"display: none;\">*</div>";
		teksti[30]="S&auml;hk&ouml;posti:<div id=\"pakollinen\" style=\"display: none;\">*</div>";
		teksti[31]="<input class=\"pakollinen\" type=\"checkbox\" name=\"kayttoehdot\" value=\"1\" onClick=\"javascript:window.open('kayttoehdot.pdf');\">&nbsp;hyv&auml;ksyn ja olen sitoutunut k&auml;ytt&auml;m&auml;&auml;n Duetto&reg; <a href=\"kayttoehdot.pdf\" target=\"_blank\" class=\"linkki\" onClick=\"javascript:document.forms[0].kayttoehdot.checked=true\">k&auml;ytt&ouml;ehtoja.</a>";
		teksti[32]="<input type=\"Submit\"  name=\"SubmitForm\" value=\"L&auml;het&auml;\">&nbsp;<input type=\"Reset\"  name=\"reset\" value=\"Tyhjenn&auml;\">";
		teksti[33]="<div id=\"pakollinen\" style=\"display: none;\">* mandatory</div>";
	}
	if(lang == 'eng')
	{
		teksti[0]="<h1>REGISTERING FOR THE DUETTO&reg;DEBT COLLECTION SERVICE </h1>With the Duetto&reg; debt collection service, you can send commissions for collection quickly and easily. Fill out your company’s information on our form. Non-contentious debt collection is free of charge for the commissioner.<br/>Once you have filled out the form, you will receive a personal user ID for the Duetto&reg; service, which you can print out or save otherwise. The Duetto&reg; service allows you to send the information of an overdue invoice to collection easily.<br/>For more information about our debt collection services, see <a href=\"http://www.duettogroup.fi\" target=\"_blank\" class=\"linkki\">www.duettogroup.fi</a><br><br>";
		teksti[1]="<br><h2>Company info:</h2>";
		teksti[2]="Business ID:<div id=\"pakollinen\" style=\"display: none;\">*</div>";
		teksti[3]="Company name:<div id=\"pakollinen\" style=\"display: none;\">*</div>";
		teksti[4]="Address:<div id=\"pakollinen\" style=\"display: none;\">*</div>";
		teksti[5]="Zip code:<div id=\"pakollinen\" style=\"display: none;\">*</div>";
		teksti[6]="Town/City:<div id=\"pakollinen\" style=\"display: none;\">*</div>";
		teksti[7]="Company bank account number:";
		teksti[8]="Field:";
		teksti[9]="Number of personnel:";
		teksti[10]="<br><br>Financial administration program used:";
		teksti[11]="<input type=\"radio\" name=\"talousohjelma\" value=\"Fivaldi ASP\" id=\"Fivaldi ASP\"><label for=\"Fivaldi ASP\">Fivaldi ASP</label>";
		teksti[12]="<input type=\"radio\" name=\"talousohjelma\" value=\"Heeros\" id=\"Heeros\"><label for=\"Heeros\">Heeros</label>";
		teksti[13]="<input type=\"radio\" name=\"talousohjelma\" value=\"Maestro\" id=\"Maestro\"><label for=\"Maestro\">Maestro</label>";
		teksti[14]="<input type=\"radio\" name=\"talousohjelma\" value=\"Netbaron\" id=\"Netbaron\"><label for=\"Netbaron\">Netbaron</label>";
		teksti[15]="<input type=\"radio\" name=\"talousohjelma\" value=\"ProCountor\" id=\"ProCountor\"><label for=\"ProCountor\">ProCountor</label>";
		teksti[16]="<input type=\"radio\" name=\"talousohjelma\" value=\"SAP\" id=\"SAP\"><label for=\"SAP\">SAP</label>";
		teksti[17]="<input type=\"radio\" name=\"talousohjelma\" value=\"Tietokari Reski\" id=\"Tietokari Reski\"><label for=\"Tietokari Reski\">Tietokari Reski</label>";
		teksti[18]="<input type=\"radio\" name=\"talousohjelma\" value=\"Visma\" id=\"Visma\"><label for=\"Visma\">Visma</label>";
		teksti[19]="<input type=\"radio\" name=\"talousohjelma\" value=\"0\" id=\"muu_tal\" checked><label for=\"muu_tal\">Other, what?</label>&nbsp;<input type=\"text\" name=\"muu_talousohjelma\" size=\"20\" maxlength=\"64\" style=\"width:168\">";
		teksti[20]="<br><br>How did you discover Duetto Group’s services?";
		teksti[21]="<input type=\"radio\" name=\"referenssi\" value=\"Internet\" id=\"Internet\"><label for=\"Internet\">Internet</label>";
		teksti[22]="<input type=\"radio\" name=\"referenssi\" value=\"Email\" id=\"Email\"><label for=\"Email\">E-mail</label>";
		teksti[23]="<input type=\"radio\" name=\"referenssi\" value=\"Koulutus\" id=\"Koulutus\"><label for=\"Koulutus\">Training</label>";
		teksti[24]="<input type=\"radio\" name=\"referenssi\" value=\"Suosittelu\" id=\"Suosittelu\"><label for=\"Suosittelu\">Recommendation, Name and company<br/>&nbsp;&nbsp;&nbsp;of person who recommended us</label><br/><input type=\"text\" name=\"suosittelija_referenssi\" size=\"20\" maxlength=\"64\" style=\"width:265\">";
		teksti[25]="<input type=\"radio\" name=\"referenssi\" value=\"Muu\" id=\"muu\" checked><label for=\"muu\">Other, what?</label>&nbsp;<input type=\"text\" name=\"muu_referenssi\" size=\"20\" maxlength=\"64\" style=\"width:168\">";
		teksti[26]="<br><h2>User info:";
		teksti[27]="User’s name:<div id=\"pakollinen\" style=\"display: none;\">*</div>";
		teksti[28]="Job title:";
		teksti[29]="Telephone:<div id=\"pakollinen\" style=\"display: none;\">*</div>";
		teksti[30]="E-mail:<div id=\"pakollinen\" style=\"display: none;\">*</div>";
		teksti[31]="<input class=\"pakollinen\" type=\"checkbox\" name=\"kayttoehdot\" value=\"1\" onClick=\"javascript:window.open('kayttoehdot.pdf');\">&nbsp;I accept and commit to abiding by the Duetto&reg; <a href=\"kayttoehdot.pdf\" target=\"_blank\" class=\"linkki\" onClick=\"javascript:document.forms[0].kayttoehdot.checked=true\">Terms of Use.</a>";
		teksti[32]="<input type=\"Submit\"  name=\"SubmitForm\" value=\"Send\">&nbsp;<input type=\"Reset\"  name=\"reset\" value=\"Clear\">";
		teksti[33]="<div id=\"pakollinen\" style=\"display: none;\">* mandatory</div>";
	}
	for(i=0;i<teksti.length;i++)
	{
		var divName="txt_"+i;
		document.getElementById(divName).innerHTML = teksti[i];
	}
}





















