function sendPWD(){
	var str = prompt("Insert the userID of the recording. The password will be immediatly sent to you.","");
	if(str) window.location.replace('default.asp?cmd=sendPwd&cmdString='+escape(str));
}
function checkMail(str){return str.search(/^([\w\.\-])+@(([\w\-]{2,})+\.)+([a-z0-9]{2,})+$/i)!=-1}
function checkNewsForm(frm) {
	if(frm.newsName.value == "") {
		alert("Inserire un nominativo");
		frm.newsName.focus();
		return false;
	}
	if(!checkMail(frm.newsMail.value)) {
		alert("Inserire un indirizzo e-mail valido");
		frm.newsName.focus();
		return false;
	}
	return true;
}

function openPopUp(strURL,w,h,t,l,refName,e){
	e=e||event;
	var obj = document.getElementById?document.getElementById(refName):document.layers?document.layers[refName]:document.all?document.all[refName]:null;
	if(t==null||l==null){
		if(e){
			//var l=e.clientX-150;
			//var t=e.clientY-34;
			l=e.screenX+20;
			t=e.screenY-222;
		}else if(obj){
			obj.css=document.layers?obj:obj.style;
			t=obj.css.top||obj.css.pixelTop||obj.offsetTop||100;
			l=obj.css.left||obj.css.pixelLeft||obj.offsetLeft||100;
		}else{t=100,l=100;}
	} else if(t>>0!=t&&l>>0!=l){
		l=l=="cs"?screen.width/2-w/2:100;
		t=t=="cs"?screen.height/2-h/2:100;
	}
	if(oPopUp&&!oPopUp.closed) oPopUp.close();
		//oPopUp.location.replace(strURL);
		//oPopUp.resizeTo(w,h);
		

	oPopUp = window.open(strURL,"PopUp","width="+w+",height="+h+",top="+t+",left="+l+",scrollbars=1,resizable=1");
	oPopUp.focus();
}
function expandNode(id){
	var obj = document.getElementById("lnk_"+id);
	obj.innerHTML=obj.innerHTML=="+"?"-":"+";
	obj=document.getElementById("row_"+id);
	obj.style.display=obj.style.display=="none"?"":"none";
	return false;
}
function checkOrderForm(frm){
	if(frm.courierID){
		if(frm.courierID.type=="select-one"){
			if(!(frm.courierID.options[frm.courierID.selectedIndex].value>>0)){
				alert(window.courier);
				frm.courierID.focus();
				return false;
			}
		}
		else if(frm.courierID.type=="radio"||frm.courierID.length){
			// elenco di radio
			if(frm.courierID.length){
				for(var i=0,courierChecked=false;i<frm.courierID.length;i++)
					if(frm.courierID[i].checked){
						courierChecked = true;
						break;
					}
				var radioToCheck = frm.courierID[0];
			}
			// radio singolo
			else{
				var courierChecked = frm.courierID.checked;
				var radioToCheck = frm.courierID;
			}
			if(!courierChecked){
				alert(window.courier);
				radioToCheck.focus();
				return false;
			}
		}
	}
	if(!(frm.paymentID.options[frm.paymentID.selectedIndex].value>>0)){
		alert(window.payment);
		frm.paymentID.focus();
		return false;
	}
	frm.action = "default.asp?cmd=sendOrder";
	return true;
}
function showHideCat(o){
	var list = o.parentNode.getElementsByTagName("ul");
	o.className = o.className=="open"?"folder":"open";
	for(var i=0;i<list.length;i++)
		if(o.parentNode==list[i].parentNode)
			list[i].style.display = list[i].style.display=="none"?"block":"none";
	return false;
}
function showVariant(customT1,customT2){
	customT1 = customT1>>0;
	customT2 = customT2>>0;
	var grid = document.getElementById("varaintsListBox");
	if(grid){
		var rowEls = grid.getElementsByTagName("TR");
		if(customT1) var rgx = new RegExp("_"+customT1+"_");
		else if(customT2) var rgx = new RegExp("_"+customT2+"$");
		// nascondo - mostro le righe
		for(var i=1,c=0;i<rowEls.length;i++){
			if(rgx&&rowEls[i].id.search(rgx)==-1)
				rowEls[i].style.display = "none";
			else{
				rowEls[i].style.display = "";
				rowEls[i].className = c%2==0?"bkg1":"bkg2";
				c++;
			}
		}
		// modifico l'action dei form carrello per mantenere selezionato il filtro
		var formList = grid.getElementsByTagName("FORM");
		for(var i=1;i<formList.length;i++)
			formList[i].action = (formList[i].action||"").replace(/\&filterID.*$/,"")+"&filterID="+(customT1||customT2);
	}
}
var oPopUp;
onunload = function(){if(oPopUp&&!oPopUp.closed) oPopUp.close();}

//Zoom immagini ---
	//Require jQuery
  $(document).ready(function(){
    
    $(".autoZoom").mouseover(function(event){
    	//alert($(this).attr("bsrc"))
			$(this).parent().parent().css("z-index","999");

			$(this).show();
			$(this).stop(true);
    	$(this).attr({"src" : $(this).attr("bsrc")});
			$(this).css("position","absolute");

    	$(this).animate({"width": "200px","left": "-50%","top": "-50%"}, "slow");
    }).mouseout(function(event){
			$(this).stop(true);
    	$(this).animate({"width": "100px","left": "0%","top": "0%"}, "slow",null,resetImageSrc );
    	//$(this).attr({"src" : $(this).attr("ssrc")});
    });
		var resetImageSrc = function(){
			$(this).attr({"src" : $(this).attr("ssrc")});
			$(this).css("position","relative");
		$(this).parent().parent().css("z-index","0");
		}
  });


//--- Zoom immagini

