nrElem1=6;

nrElem2=6;

nrElem3=5;

loop=3000;

function test() {
	nrElem1=6;
}

function ImageLoad() {
imgList1 = new Array(nrElem1);
 imgList2 = new Array(nrElem2);
 imgList3 = new Array(nrElem3);
 for (var i=1; (i<=nrElem1); i++)
 {
 	imgList1[i] = new Image();
	imgList1[i].src = 'images/mici/jaluzele'+i+'.jpg';
	imgList1[i].name='jaluzeleo.html';
 }


 imgList2 = new Array(nrElem2);
 for (var i=1; (i<=nrElem2); i++)
 {
 	imgList2[i] = new Image();
	imgList2[i].src = 'images/mici/jaluzele_'+i+'.jpg';
 }

 imgList2[1].name='index.html';

 imgList2[2].name='romanshades.html';

 imgList2[3].name='jaluzeleo.html';

 imgList2[4].name='jaluzeleo.html';

 imgList2[5].name='romanshades.html';

 imgList2[6].name='romanshades.html';

 imgList3 = new Array(nrElem3);

 for (var i=1; (i<=nrElem3); i++)
 {
 	imgList3[i] = new Image();
	imgList3[i].src = 'images/mici/rolete'+i+'.jpg';
	imgList3[i].name='rolete.html';
 }

 Looper();

}



function Looper(){

for (var i=1; (i<=nrElem1); i++)

{	setTimeout("document.getElementById('im1').src=imgList1["+i+"].src;document.getElementById('im1').name=imgList1["+i+"].name;document.getElementById('im1_mare').src=imgList1["+i+"].src;document.getElementById('im1_mare').name=imgList1["+i+"].name;",loop*i);
		
}

for (var i=1; (i<=nrElem2); i++)

{

	setTimeout("document.getElementById('im2').src=imgList2["+i+"].src;document.getElementById('im2').name=imgList2["+i+"].name;document.getElementById('im2_mare').src=imgList2["+i+"].src;document.getElementById('im2_mare').name=imgList2["+i+"].name;",loop*i);

}

for (var i=1; (i<=nrElem3); i++)

{

	setTimeout("document.getElementById('im3').src=imgList3["+i+"].src;document.getElementById('im3').name=imgList3["+i+"].name;document.getElementById('im3_mare').src=imgList3["+i+"].src;document.getElementById('im3_mare').name=imgList3["+i+"].name;",loop*i);

}

setTimeout("Looper();",loop*nrElem1);

}



function goto(a){

window.location = a.name;

}



var newwindow = '';

function popitup(a) {

	if (!newwindow.closed && newwindow.location) {

		newwindow.location.href = a.src;

	}

	else {

		newwindow=window.open(a.scr,'mywindow','width=640,height=360');

		if (!newwindow.opener) newwindow.opener = self;

	}

	if (window.focus) {newwindow.focus()}

	return false;

}





function calculeaza(){ 

	var preturi = new Array(20);

	

	//preturi[x] = [pret material, pret mecanisme/ml, constanta, suprafata minima facturabila, latimea minima facturabila];

	preturi[1] = [28.36,0,0,0.8,0];//jaluzele verticale

	preturi[2] = [78.28,0,0,0.8,0];//jaluzele orizontale

	preturi[3] = [21.03,123.76,0,0.5,0.6];//roman shades

	preturi[4] = [24.75,30.94,19.18,0.8,0.6];//rolete

	preturi[5] = [92.82,0,0,0.8,0];//plisse

	preturi[6] = [550,0,0,0.5,0];//grilaje

	preturi[7] = [200,0,0,0.8,0];//rulouri pvc

    preturi[8] = [400,0,0,0.8,0];//rulouri aluminiu



	var lat = document.getElementById('latime').value.replace(/,/,"."); 

	var newlat = parseFloat(lat).toString();

	var lung = document.getElementById('lungime').value.replace(/,/,"."); 

	var newlung = parseFloat(lung).toString();

	var InpValid=1; 



	if (!(lat.length == newlat.length && newlat != "NaN" && lung.length == newlung.length && newlung != "NaN")) {

		alert("Va rugam introduceti numere reale valide."); 

	 	InpValid=0; 

		return;

	}

	

	var code = document.getElementById('produs').value;

	document.getElementById('pret').value = Math.ceil(Math.max(lat*lung/10000,preturi[code][3])*preturi[code][0] + Math.max(lat/100,preturi[code][4])*preturi[code][1] + preturi[code][2]); 

	//alert(preturi[document.getElementById('produs').value][1]);

}