//--------------------------------------
		function OpenWindow(id){
//--------------------------------------
			window.open("ws_tuote.asp?id="+id,"","width=600,height=500,toolbar=no");
		}

//--------------------------------------
		function ViewImage(nimi,kuva){
//--------------------------------------
			var uusiIkkuna = window.open("xx_NaytaKuva.html","Preview","width=600,height=350.toolbar=no");
			
		//Määritetään isokuva
			if(kuva.length > 5){
				kuva = ("<img src='" + kuva + "' border='0'>");
			}
			else{
				kuva = ("Kuvaa ei ole.");
			}
		
		//Avataan uusi ikkuna ja näytetään tuote
			uusiIkkuna.document.open();
				with(uusiIkkuna.document){
				write ("<html><head><meta http-equiv='content-type' content='text/html;charset=iso-8859-1'></head>");
				write ("<body bgcolor='#ffffff' background='kuvat/harmaa.gif'>");
				write ("<table align='center' cellpadding='0' border='0' cellspacing='8' width='95%' bgcolor='#ffffff'>");
				write ("<tr>");
				write ("<td><div align='left'>");
				write ("<b><font face='Verdana,Arial,Helvetica' color='#000000' size='3'>" + nimi + "<br></font></b></div>");
				write ("</td>");
				write ("</tr>");
				write ("<tr>");
				write ("<td bgcolor='#d1d1d1'><img src='kuvat/1x1_trans.gif' width='1' height='1' alt='' border='0'></td>");
				write ("</tr>");
				write ("<tr>");
				write ("<td valign='top' align='left'>" + kuva + "</td>");
				write ("</tr>");
				write ("</table>");
				write ("</body>");
				write ("</html>");
				}//Lopetetaan kirjoitus
		}//Lopetetaan functio

//--------------------------------------
function order(id){
//--------------------------------------
	window.opener.location.href = "xx_ostoskori.asp?id=" + id;
//	window.close();
}

//--------------------------------------
function checkForm(objForm){
//--------------------------------------
	var strError = new String();

	//alert(replace(objForm.elements("etunimi").value," ", "").length)
	if(replace(objForm["etunimi"].value," ", "").length < 3)			strError += "Etunimi \n";

	if(replace(objForm["lahiosoite"].value," ", "").length < 5)			strError += "Lähiosoite \n";
	
	if(replace(objForm["postinumero"].value," ", "").length < 5)		strError += "Postinumero \n";

	if(replace(objForm["postitoimipaikka"].value," ", "").length < 3)	strError += "Postitoimipaikka \n";
	
	if(replace(objForm["puhelin"].value," ", "").length < 5)			strError += "Puhelin \n";

	if(replace(objForm["sahkopostiosoite"].value," ", "").length < 5)	strError += "Sähköpostiosoite \n";

	if(strError.length > 0){
		strError = "Täytä puuttuvat tiedot: \n" + strError 
		alert(strError)
	}
	else{
		objForm.submit();
	}
}

//--------------------------------------------
function replace( sString, sStr1, sStr2 ) {
//--> Tarkistaa stringin, huomioi myös välilyönnit.
//--------------------------------------------
	var arrTemp = sString.split( sStr1 );
	return arrTemp.join( sStr2 );
}


// ------------------------------------------------------------------
function showParts(obj) {
// ------------------------------------------------------------------
	//var imgName	 = new String('img' + obj.id);
	var partName = new String('sub_' + obj.id);
	var isPart	 = (document.getElementById(partName)) ? true : false;
	//var imgPlus  = new String('kuvat/plus.gif');
	//var imgMinus = new String('kuvat/miinus.gif');
	if(isPart){
		if(document.getElementById(partName).style.display == "none"){
			document.getElementById(partName).style.display = "block";
			//document.getElementById(imgName).src = imgMinus;
			//obj.src = imgMinus;
		}
		
		else {
			document.getElementById(partName).style.display = "none";
			//document.getElementById(imgName).src = imgPlus;
		}
	}
}
