window.onload = function() 
{
	MM_preloadImages('index/butoane/11a.gif','index/butoane/12a.gif','index/butoane/13a.gif','index/butoane/14a.gif','index/butoane/15a.gif','index/butoane/16a.gif','index/butoane/17a.gif','index/butoane/18a.gif','index/butoane/19a.gif','index/butoane/21a.gif','index/butoane/22a.gif','index/butoane/23a.gif','index/butoane/24a.gif');
}

function MM_findObj(n, d) 
{ 
	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_showHideLayers() 
{
  	var i, p, v, obj, args = MM_showHideLayers.arguments;
  	for (i=0; i<(args.length-2); i+=3) 
  		if ((obj=MM_findObj(args[i]))!=null) 
		{ 
			v = args[i+2];
	    	if (obj.style) 
			{ 
				obj = obj.style; 
				v=(v=='show')?'block':(v=='hide')?'none':v; 
			}
    		obj.display = v; 
		}
}

function MM_preloadImages() 
{
  	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_swapImgRestore() 
{
	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_swapImage() 
{
  	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 getCateg(categ)
{
	var poza;
	switch (categ)
	{
		case 1:
			// aranjamente florale: buchete mireasa
			poza = "bucheteMireasa/";
			break;
		case 2:
			// aranjamente florale: buchete masa
			poza = "bucheteMasa/";
			break;
		case 3:
			// aranjamente florale: revere
			poza = "revere/";
			break;
		case 4:
			// aranjamente florale: flori sticla
			poza = "floriSticla/";
			break;
		case 5:
			// aranjamente masini
			poza = "aranjamenteMasini/";
			break;
		case 6:
			// huse scaune: huse scaune
			poza = "huseScaune/";
			break;
		case 7:
			// drapaje lumini
			poza = "drapajeLumini/";
			break;
		case 8:
			// fier forjat
			poza = "fierForjat/";
			break;
		case 9:
			// sonorizari
			break;
		case 10:
			// artificii: interior: tort
			poza = "interior/tort/";
			break;
		case 11:
			// artificii: interior: pardoseala
			poza = "interior/pardoseala/";
			break;
		case 12:
			// artifcii: exterior
			break;
		case 13:
			// baloane
			poza = "baloane/";
			break;
		case 14:
			// video
			break;
		case 15:
			// foto
			break;
		case 16:
			// staroste
			break;
		case 17:
			// accesorii: invitatii
			poza = "invitatii/";
			break;
		case 18:
			// accesorii:lumanari
			break;
		case 19:
			// accesorii: servetele
			break;
		case 20:
			// accesorii: aranjamenteVoaluri
			poza = "aranjamenteVoaluri/";
			break;
		case 21:
			// accesorii: pietriceleDecorative
			break;
		case 22:
			// accesorii: confetti
			poza = "confetti/";
			break;
		case 23:
			// accesorii: cosBani
			poza = "cosBani/";
			break;
		case 24:
			// accesorii: casaBani
			break;
		case 25:
			// accesorii: pahareSampanie
			poza = "pahareSampanie/";
			break;
		case 26:
			// accesorii:pernitaInele
			break;
		case 27:
			// accesorii: cardursiMese
			poza = "carduriMese/";
			break;
		case 28:
			// huse scaune: mese prezidiu
			poza = "mesePrezidiu/";
			break;
	}
	return poza;
}

function changeBigImg(categ, nr)
{
	var list = document.getElementById("pozeMici");
	var x = list.selectedIndex + nr;
	var poza = getCateg(categ);
	if (x < 10)
	{
		poza += "0" + x + ".gif";
	}
	else
	{
		poza += x + ".gif";
	}
	document.pozaMare.src = poza;
}

function changeLittleImg(categ, poz, transp)
{
	var list = document.getElementById("pozeMici");
	if (transp == 0)
	{	// daca nu trebuie poza transparenta
		var poza = getCateg(categ);
		var x = list.selectedIndex + poz;
		if (x < 10)
		{
			poza += "0" + x + ".gif";
		}
		else
		{
			poza += x + ".gif";
		}
		if (poz == 1)
		{	// prima poza
			document.pozaMica1.src = list.options[list.selectedIndex].value;
			MM_preloadImages(poza);
		}
		if (poz == 2)
		{	// a doua poza
			document.pozaMica2.src = list.options[list.selectedIndex + 1].value;
			MM_preloadImages(poza);
		}
		if (poz == 3)
		{	// a treia poza
			document.pozaMica3.src = list.options[list.selectedIndex + 2].value;
			MM_preloadImages(poza);
		}
	}
	if (transp == 1)
	{	// daca trebuie sa dispara vreo poza
		if (poz == 2)
		{	// trebuie sa dispara pe a doua si a treia pozitie
			MM_showHideLayers('pozaMica2', '', 'hide', 'pozaMica3', '', 'hide')
		}
		if (poz == 3)
		{	// numai a treia poza dispare
			MM_showHideLayers('pozaMica3', '', 'hide')
		}
	}
}

function scrollRight(categ)
{
	var list = document.getElementById("pozeMici");
	var x = list.selectedIndex + 3;
	if ((x + 3) <= list.options.length)
	{	// inseamna ca mai am sigur inca trei poze de afisat
		list.selectedIndex = x;
		changeLittleImg(categ, 1, 0);
		changeLittleImg(categ, 2, 0);
		changeLittleImg(categ, 3, 0);
	}
	else
	{
		if ((x + 2) <= (list.options.length))
		{	// mai pot adauga numai doua poze, a treia va fi disparea
			list.selectedIndex = x;
			changeLittleImg(categ, 1, 0);
			changeLittleImg(categ, 2, 0);
			changeLittleImg(categ, 3, 1);
		}
		else
		{
			if ((x + 1) <= (list.options.length))
			{	// numai prima mai este poza, ultimele doua dispar
				list.selectedIndex = x;
				changeLittleImg(categ, 1, 0);
				changeLittleImg(categ, 2, 1);
			}
		}
	}
	if (list.selectedIndex >= 3)
		MM_showHideLayers('btnL', '', 'show');
	if ((list.selectedIndex == list.options.length - 1) || (list.selectedIndex == list.options.length - 2) || (list.selectedIndex == list.options.length - 3))
		MM_showHideLayers('btnR', '', 'hide');
}

function scrollLefts(categ)
{
	var list = document.getElementById("pozeMici");	
	// verific daca am pozitii disparute
	if (list.selectedIndex == list.options.length - 1)
	{
		MM_showHideLayers('pozaMica2', '', 'show', 'pozaMica3', '', 'show');
	}
	else
	{
		if (list.selectedIndex == list.options.length - 2)
		{
			MM_showHideLayers('pozaMica3', '', 'show');
		}
	}
	var x = list.selectedIndex - 3;
	if (x >= 0)
	{	// inseamna ca mai am sigur inca trei poze de afisat
		list.selectedIndex = x;
		changeLittleImg(categ, 1, 0);
		changeLittleImg(categ, 2, 0);
		changeLittleImg(categ, 3, 0);
	}
	if ((list.options.length - list.selectedIndex) > 3)
		MM_showHideLayers('btnR', '', 'show');
	if ((list.selectedIndex == 0))
		MM_showHideLayers('btnL', '', 'hide');

}
