



//end ini Page

function menuManage(objOpen){
	$(".secondFld").slideUp('normal');
	$("#"+objOpen).slideDown('normal');
}

function annuncioCheck(){
	var errore = "";
	if ($("#nome").val() == ""){
		errore = errore + "Il Nome &egrave obbligatorio<br />"
	}
	if ($("#cognome").val() == ""){
		errore = errore + "Il Cognome &egrave obbligatorio<br />"
	}
	if ($("#email").val() == ""){
		errore = errore + "I&#39; E-Mail &egrave obbligatoria<br />"
	}
	if (($("#modello").val() == "") && ($("#tipologia").val() != "varie")){
		errore = errore + "Il Modello &egrave obbligatorio<br />"
	}
	if ($("#annuncio").val() == ""){
		errore = errore + "Il testo dell&#39;annuncio &egrave obbligatorio<br />"
	}
	
	if (errore != ""){
		$("#errore").html(errore+"<br />");
	}else{
		document.annuncioFrm.submit();
	}
}

function viewAnnuncio(idAnnuncio){
	$(".annuncioDet").slideUp("fast");
	$("#"+idAnnuncio).slideDown("normal");
}

function viewImgHome(img){
	var offset = $("#"+img).offset();
	alert(offset.top);

	$("#"+img).animate({ 
        left:y,
		top:200
      }, 0 );
	  
	$("#"+img).fadeIn("fast");
	
}

function hideImgHome(img){
	$("#"+img).hide();
}


function listSort(prezzo, cantiere, tipologia){
	var parameter = "?";
	if (prezzo != 0){
		parameter = parameter + "pr="+prezzo+"&";
	}
	if (tipologia != ''){
		parameter = parameter + "tp="+tipologia+"&";
	}
	if (cantiere != ''){
		parameter = parameter + "cn="+cantiere;
	}
	document.location.href = document.location.pathname+parameter;
}

function getEvents(dataSelezionata){
	
	$.post("/core/lib.php", { dataSel: dataSelezionata, act:10 },
		function(data){
			if (data == 1){
				document.location.href = "eventi.php?idFld="+dataSelezionata;
			}
		});

}

function playVideo(video, title){
	var embed = '<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/'+video+'&hl=it_IT&fs=1&rel=0&color1=0x2b405b&color2=0x6b8ab6"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><param name="play" value="true"></param><embed src="http://www.youtube.com/v/'+video+'&hl=it_IT&fs=1&rel=0&color1=0x2b405b&color2=0x6b8ab6" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>';
	$("#player").html(embed);
	$("#videoTitle").html(title);
}
