document.writeln("<link rel='stylesheet' href='css/css.css'>")

// POPUP
	// Immagini prodotto
	function popupGallery(pid) {
		var sinistra = Math.floor((screen.width-740)/2);
		var sopra = Math.floor((screen.height-580)/2);
		window.open("popup_gallery.php?pid="+pid+"","gallery","width="+740+",height="+580+",top="+sopra+",left="+sinistra+"");
	}
	// Attributi prodotto
	function attrsPopup(pid) {
		var sinistra = Math.floor((screen.width-740)/2);
		var sopra = Math.floor((screen.height-580)/2);
		window.open("attrs_popup.php?pid="+pid+"","attrs","width="+740+",height="+580+",top="+sopra+",left="+sinistra+",resizable,scrollbars");
	}

// SWAP IN HOME PAGE
function swap(caso) {
	switch (caso) {
		case 1:
			document.img1.src = "images/finlandia_over.jpg";
			document.getElementById('link1').style.textDecoration = "underline";
			break;
		case 2:
			document.img2.src = "images/svezia_over.jpg";
			document.getElementById('link2').style.textDecoration = "underline";
			break;
		case 3:
			document.img3.src = "images/danimarca_over.jpg";
			document.getElementById('link3').style.textDecoration = "underline";
			break;
		case 4:
			document.img4.src = "images/norvegia_over.jpg";
			document.getElementById('link4').style.textDecoration = "underline";
			break;
		case 5:
			document.img5.src = "images/incucina_over.jpg";
			document.getElementById('link5').style.textDecoration = "underline";
			break;
		case 6:
			document.img6.src = "images/living_over.jpg";
			document.getElementById('link6').style.textDecoration = "underline";
			break;
		case 7:
			document.img7.src = "images/giocoso_over.jpg";
			document.getElementById('link7').style.textDecoration = "underline";
			break;
		case 8:
			document.img8.src = "images/luci_over.jpg";
			document.getElementById('link8').style.textDecoration = "underline";
			break;
	}
}
function swapBack(caso) {
	switch (caso) {
		case 1:
			document.img1.src = "images/finlandia_out.jpg";
			document.getElementById('link1').style.textDecoration = "";
			break;
		case 2:
			document.img2.src = "images/svezia_out.jpg";
			document.getElementById('link2').style.textDecoration = "";
			break;
		case 3:
			document.img3.src = "images/danimarca_out.jpg";
			document.getElementById('link3').style.textDecoration = "";
			break;
		case 4:
			document.img4.src = "images/norvegia_out.jpg";
			document.getElementById('link4').style.textDecoration = "";
			break;
		case 5:
			document.img5.src = "images/incucina_out.jpg";
			document.getElementById('link5').style.textDecoration = "";
			break;
		case 6:
			document.img6.src = "images/living_out.jpg";
			document.getElementById('link6').style.textDecoration = "";
			break;
		case 7:
			document.img7.src = "images/giocoso_out.jpg";
			document.getElementById('link7').style.textDecoration = "";
			break;
		case 8:
			document.img8.src = "images/luci_out.jpg";
			document.getElementById('link8').style.textDecoration = "";
			break;
	}
}

// TRANSIZIONE IMMAGINE
	function runFx(strImageName, strImageUrl){
		 obj = eval("document.images." + strImageName);
		 if (document.all){
			obj.style.filter="revealTrans(duration=0.3, transition=23)";
			obj.filters[0].Apply();
		 }
		 obj.src = strImageUrl;
		 if (document.all){
			obj.filters[0].Play();
		 }
	}

// SWAP IN DESIGNER (img del prod swappa con quella del designer)
function swapDesigner(img) {
	runFx('designer', img)
}
function swapBackDesigner() {
	designer.src = designerImgPath;
}

// Cookies: crea, leggi, cancella.
function createCookie(name,value,days)
{
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name)
{
	createCookie(name,"",-1);
}

// MM PRELOAD IMAGES
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];}}
}
