function MM_jumpMenu(targ,selObj,restore){ //v3.0
	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) 
		selObj.selectedIndex=0;
}
function target_blank(x){
	document.getElementById(x).target="_blank";
}
function isEmail(str) {
	var supported = 0;
	if(window.RegExp) {
		var tempStr = "a";
		var tempReg = new RegExp(tempStr);
		if (tempReg.test(tempStr)) supported = 1;
	}
	if(!supported)
		return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);

	var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
	var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,6}|[0-9]{1,3})(\\]?)$");

	return (!r1.test(str) && r2.test(str));
}

function isDate(str) {
	var arrivoArray = str.split("/"); 
	var dataarrivo=new Date()
	dataarrivo.setFullYear(arrivoArray[2],arrivoArray[1],arrivoArray[0])
	return (dataarrivo);
}

function MyTrim(myObj){
	var i;
	var myObjTmp;
	var myObjTmp2;

	if (myObj==null){
		myObj=''; 
		return myObj;
	}

	if (myObj=='') {
		return myObj;
	}

	for (i = 0; i < myObj.length; i++) {
		if(myObj.charAt(i) == ' '){
			myObjTmp = myObj.substr(i+1)
		} else {
			if (i==0) { 
				myObjTmp = myObj;
			}
			break;
		}
	}

	myObjTmp2 = myObjTmp

	if (myObjTmp.length > 0) {
		for (i = myObjTmp.length-1; i > 0; i--) {// elimina gli spazi finali
			if (myObjTmp.charAt(i) == ' '){
				myObjTmp2 = myObjTmp.substr(0,i)
			} else {
				break;
			}
		}
	}

	myObj = myObjTmp2
	return (myObj)
}

function setta_valore (id_item, id_topocat, n_code, la) {

	$("#icon_size_"+id_item+"_"+id_topocat).show();

	$.ajax({
	  url: "/common/add-rem.php?n_code="+n_code+"&la="+la+"&id_topocat="+id_topocat+"&id_item="+id_item,
	  cache: false,
	  success: function(html){
		$("#pulsante_cont_"+id_item+"_"+id_topocat).html(html);
	  }
	});

}
function chiudo()	{
	$.ajax({
	 url: "/it/common/blank.php",
	  cache: false,
	  success: function(html){
		$("#audio_popup div.contentLogin").html(html);
	  }
	});
}
$(document).ready(function(){

	//Hide (Collapse) the toggle containers on load
	$("#cont_nav").hide(); 

	//Switch the "Open" and "Close" state per click
	$("h2.trigger").toggle(function(){
		$(this).addClass("actives");
		}, function () {
		$(this).removeClass("actives");
	});

	//Slide up and down on click
	$("h2.trigger").click(function(){
		$("#cont_nav").slideToggle("slow");
	});

});
function newsletter(x){
		document.getElementById(x).target="newsletter";
		d=window.open('', 'newsletter', "width=560,height=510,scrollbars=0,status=0,statusbar=0,toolbar=no,location=no,menubar=no,resizable=no,top=20,left=20,screenX=20,screenY=20");
		d.focus();
	}

