
// JavaScript Document

var totalXbar
var prevID = ""

function placeSearchBar(){
	
	var xBar = document.getElementById("contAllInt").offsetLeft
	totalXbar = xBar
	
	//var x2Bar = document.getElementById("contAllInt").offsetRight
	//alert(xBar)
	document.getElementById("searchBar").style.left = xBar+"px"
	
	document.getElementById("searchBar").style.top = 67+"px"
	//document.getElementById("glossCont").style.left = (xBar)+"px"
	
	document.getElementById("searchBar").style.visibility="visible"
	document.getElementById("searchCont").style.visibility="visible"
	
	
}

function registratiGC(){
	
	deviLog()	
	
	
}


function voids(){}


function copiaApp(){
	
	ZeroClipboard.setMoviePath('http://www.garda-casa.com/vari/ZeroClipboard.swf');

	var clip = new ZeroClipboard.Client();
	
	clip.addEventListener('mousedown',function() {
		clip.setText(document.getElementById('copiami').value);
		alert(document.getElementById('copiami').value)
	});
	
	clip.addEventListener('complete',function(client,text) {
	alert('copiato:\n\n' + text);
	});
	
	// attivo la funzione al click sul bottone con ID "copiatesto"
	clip.glue('copiatesto');

	
}



function ricercaCode(str){
	
	if(str=='true'){
		
		
		document.getElementById('innerPopup').innerHTML = '<div align="center" ><h2 style="font-family:Arial, Helvetica, sans-serif;font-size:12px;color:#203494;">Prego inserire il codice o il riferimento incarico relativo all\'immobile che state cercando :</h2><br><input type="text" id="immoCode" style="width:120px;height:25px;margin-bottom:5px;"/><br><br><img onclick="ricercaCodeGoIndex()" style="cursor:pointer;" src="INCLUDE/img/STRUTTURA/indexBtnCerca2.jpg"/></div>'	
		
	
	}else{
		
		document.getElementById('innerPopup').innerHTML = '<div align="center" ><h2 style="font-family:Arial, Helvetica, sans-serif;font-size:12px;color:#203494;">Prego inserire il codice o il riferimento incarico relativo all\'immobile che state cercando :</h2><br><input type="text" id="immoCode" style="width:120px;height:25px;margin-bottom:5px;"/><br><br><img onclick="ricercaCodeGo()" style="cursor:pointer;" src="INCLUDE/img/STRUTTURA/indexBtnCerca2.jpg"/></div>'		
	
		
	}

	
	
		posizionaPopup("warningPopup")
	
}




function ricercaCodeGo(){
	
	closeWindow('warningPopup')
	
	str = document.getElementById('immoCode').value
	
	invioAjax('include/asp/codeSearch.asp',str)	
	
}


function ricercaCodeGoIndex(){
	
	str = document.getElementById('immoCode').value
	
	window.location.href='ricerca.asp?code='+str	
	
}




function showSub(id){
	
	if(document.getElementById(id).style.visibility=="visible"){
		
		document.getElementById(id).style.height="0px";
		document.getElementById(id).style.visibility="hidden";
		document.getElementById("img"+id).src='INCLUDE/img/triangolo.jpg'
		
	}else{
		
		document.getElementById(id).style.height="auto";
		document.getElementById(id).style.visibility="visible";
		document.getElementById("img"+id).src='INCLUDE/img/triangolo2.jpg'
		
	}
	
	
	//document.getElementById("img"+id).onclick = "showSubBack('"+id+"')";
	//alert(document.getElementById("img"+id).onclick)
	//document.getElementById(id).setAttribute("onclick", "showSubBack('"+id+"')");
}

function showSubBack(id){
	
	
	document.getElementById("img"+id).onclick = "showSub('"+id+"')";
}



function makeFav(immID){
	
	if(usrLgnName_ != ""){
		//alert(immID)
		invioAjax('include/asp/makeFav.asp',immID)
		

	}else{
		//alert(document.getElementById('innerPopup').innerHTML)
		document.getElementById('innerPopup').innerHTML = ""
		document.getElementById('innerPopup').innerHTML = '<h2 style="font-size:13px;color:red">ATTENZIONE</h2>'	
		document.getElementById('innerPopup').innerHTML += "<h2 style='font-size:12px;color:#333333;'>Siamo spiacenti, ma per accedere alle funzionalit&aacute; complete del sito &eacute; necessario registrarsi :<br/></h2>"
		document.getElementById('innerPopup').innerHTML +="<h2 style='font-size:13px;text-transform:uppercase;color:#b2df14;'>Iscriviti subito, non costa nulla.<br/></h2>"
		document.getElementById('innerPopup').innerHTML +="<h2 style='font-size:12px;color:#333333;'> ma ti permetter&aacute; di sfruttare al 100% il potenziale di questo sito internet, per trovare la tua casa in maniera semplice e veloce.</h2>"
		document.getElementById('innerPopup').innerHTML += '<a href="javascript:posizionaPopup(\'popupLogin\')"><h2 style="font-size:11px;color:red">REGISTRATI QUI<br></h2></a>'	
		posizionaPopup("warningPopup")	
		
	}
	
}


function removeFav(immID){
	
	if(usrLgnName_ != ""){
	
		invioAjax('include/asp/removeFav.asp',immID)
		document.getElementById("immoRO").style.visibility="hidden"

	}else{alert("non sei loggato!")}
	
}


function rilievo(id){

	
	if(document.getElementById('immoRO').style.display="none"){document.getElementById('immoRO').style.display="block";}
	
		
	if(storeIdMail ==""){storeIdMail = id}
	
	var tempCont = document.getElementById(id).innerHTML
	var xBar2 = document.getElementById(id).offsetLeft
	var yBar2 = document.getElementById(id).offsetTop	

	document.getElementById("immoRO").style.left = (xBar2-4)+"px"
	document.getElementById("immoRO").style.top = (yBar2-4)+"px"
	
	
	document.getElementById("immoRO").innerHTML = tempCont
	
	var checkPlace = document.getElementById("immoRO").getElementsByTagName('div')
	
	if(document.getElementById('favedPan'+id)){
		
		if(checkPlace[8].id && checkPlace[7].id.indexOf("IMRO")<0 && checkPlace[8].id.indexOf("IMRO")<0 ){
			checkPlace[0].id = "IMRO"+checkPlace[0].id
			checkPlace[1].id = "IMRO"+checkPlace[1].id
			checkPlace[7].id = "IMRO"+checkPlace[7].id
			checkPlace[8].id = "IMRO"+checkPlace[8].id
			
			//alert(checkPlace[0].id+"_"+checkPlace[1].id+"_"+checkPlace[7].id+"_"+checkPlace[8].id)
			//checkPlace[7].style.background = "red"
		}
		
	
	}else{
		
		if(checkPlace[7].id && checkPlace[6].id.indexOf("IMRO")<0 && checkPlace[7].id.indexOf("IMRO")<0 ){
			checkPlace[0].id = "IMRO"+checkPlace[0].id
			checkPlace[6].id = "IMRO"+checkPlace[6].id
			checkPlace[7].id = "IMRO"+checkPlace[7].id
			//checkPlace[7].style.background = "red"
		}
		
	}
	
	/*var storImg = document.getElementById("immoRO").getElementsByTagName('img')
	
	for(i=0;i<storImg.length;i++){
	
		if(storImg[i].id.indexOf("img"+id+"-")>0){
		
			storImg[i].id = storImg[i].id+"RO"	
			
		}	
		
	}*/
	

	
	
		var checkPlace2 = document.getElementById("immoRO").getElementsByTagName('div')
	
/*	for(i=0;i<checkPlace2.length;i++){
		
		if(checkPlace2[i].id){
		alert(checkPlace2[i].id)
		}
		
	}
	*/
	
	document.getElementById("immoRO").style.visibility="visible"
	//document.getElementById("favBTN"+id).style.visibility = "visible"
	
}


function smallPicPrev(src,id,idPic){
	//alert(idPic+"_"+id)
	idPic = parseInt(idPic.replace("img"+id+"-",""))
	document.getElementById("immoRO").getElementsByTagName("img")[idPic+1].style.border ="2px #b2df14 solid";
	//document.getElementById(idPic+)
	
	//document.getElementById('firstNasc'+id).style.filter = "alpha(opacity=80)"; 
	//document.getElementById('firstNasc'+id).style.opacity="0.8"
	//document.getElementById('firstNasc'+id).style.display="block";
	
	//alert(document.getElementById(idPic).style.border)
	//document.getElementById('big'+id).src = ""	
	src = src.replace("include_app/administrator/thumsnavi_libro_MINI.asp?namefile=","include_app/administrator/thumsnavi_libro_MEDIUM.asp?namefile=")
	document.getElementById("immoRO").getElementsByTagName("img")[0].src = src
	
	
	
	for(i=2;i<12;i++){
		
		if(i!=idPic+1){
			//
			//document.getElementById("img"+id+"-"+i)
			document.getElementById("immoRO").getElementsByTagName("img")[i].style.border = "1px #cfcfcf solid";	
			
		}	
		
	}
	
	
}


function openPop(id,str){
	
	if(document.getElementById(id).style.height== "auto"){
		
		document.getElementById(id+'img').src="INCLUDE/img/triangolo.jpg"
		document.getElementById(id).style.height=25+"px"
		document.getElementById(id).style.overflow="hidden"
	}else{
		document.getElementById(id+'img').src="INCLUDE/img/triangolo2.jpg"
		//document.getElementById(id+'img').onclick= function(){openPop2(id);}
		//document.getElementById(id2).onclick= function(){openPop2(id,id2);}
		
		str = str.split(",")
		
		for(i=0;i<str.length;i++){
			
			openPop2(str[i]);
			
		}
	
		document.getElementById(id).style.height="auto"
		document.getElementById(id).style.overflow="visible"
	}
	
	
	
	
	
}

function openPop2(id){

	document.getElementById(id+'img').src="INCLUDE/img/triangolo.jpg"
	//document.getElementById(id+'img').onclick= function(){openPop(id);}
	//document.getElementById(id2).onclick= function(){openPop(id,id2);}

	document.getElementById(id).style.height=25+"px"
	document.getElementById(id).style.overflow="hidden"
	
	
}


function gallery(src,id){
	
	
	document.getElementById("galleryPicsCent").innerHTML = ""
	posizionaPopup('gallery')
	document.getElementById("galleryTarget").src = ""
	document.getElementById("nasc2").style.visibility ="visible"
	//alert(document.getElementById("nasc2").style.visiblity)
	
	for(i=2;i<=11;i++){
	
		var tempImg = document.getElementById(id).getElementsByTagName("img")[i]
		var tempImgClone = tempImg.cloneNode(true)
		tempImgClone.id="miniGall"+i
		//alert(tempImgClone.id)
		tempImgClone.onmouseover= function(){switchImgGallery(this.id);}
		tempImgClone.style.width = "40px"
		tempImgClone.style.height = "40px"
		tempImgClone.style.border="1px #666666 solid"
		//alert(tempImgClone.style.width)
		if(i==2){tempImgClone.style.border="3px #b2df14 solid"}
			//alert(tempImgClone.innerHTML)
		var tttsrc = tempImgClone.src
		tttsrc = tttsrc.replace('include_app/administrator/thumsnavi_libro_MEDIUM.asp?namefile=','include_app/administrator/thumsnavi_libro_GALLERY.asp?namefile=')
		tttsrc = tttsrc.replace('include_app/administrator/thumsnavi_libro_MINI.asp?namefile=','include_app/administrator/thumsnavi_libro_GALLERY.asp?namefile=')
		tempImgClone.src = ""
	
		document.getElementById("galleryPicsCent").appendChild(tempImgClone)

		tempImgClone.src = tttsrc
		
		//alert(tempImgClone.id)
		
		//}
	}
	var tsrc = document.getElementById(id).getElementsByTagName("img")[0].src
	tsrc = tsrc.replace('include_app/administrator/thumsnavi_libro_MEDIUM.asp?namefile=','include_app/administrator/thumsnavi_libro_BIG.asp?namefile=')
	document.getElementById("galleryTarget").src = tsrc;

	

}


function switchImgGallery(idTarg){
	//alert(idTarg)
	var tempSrcGall = document.getElementById(idTarg).src	
	
	tempSrcGall = tempSrcGall.replace('include_app/administrator/thumsnavi_libro_GALLERY.asp?namefile=','include_app/administrator/thumsnavi_libro_BIG.asp?namefile=')

	document.getElementById("galleryTarget").src = tempSrcGall;
	document.getElementById(idTarg).style.border ="3px  #b2df14 solid";
	
	idTarg = idTarg.replace("miniGall","")
	
	
	
	for(i=2;i<12;i++){
	
		if(i!=idTarg){
		
			document.getElementById("miniGall"+i).style.border = "1px #666666 solid";	
			
		}	
		
	}
	
	
}


function sottoTipo(id1,id2){
	
	//document.getElementById(id1).style.display="none"
	document.getElementById(id2).style.display="block"
	document.getElementById('hide4').style.height="auto"

}

function sottoTipo2(id){
	
	document.getElementById(id).style.display="none"
	document.getElementById('hide4').style.height="auto"

}

function fillChecks(str){
	
	var targetDiv = document.getElementById(str).getElementsByTagName("input")
	
	for(i=0;i<targetDiv.length;i++){
		
		if(targetDiv[i].id == "tip1"){
			
			targetDiv[i].checked = true				
			
		}	
		
	}	
	
	

}



function deFillChecks(str){
	
	var targetDiv = document.getElementById(str).getElementsByTagName("input")
	
	for(i=0;i<targetDiv.length;i++){
		
		if(targetDiv[i].id == "tip1"){
			
			targetDiv[i].checked = false				
			
		}	
		
	}	
	
	

}

function sendMap(str){
	
	//alert(str)
	document.getElementById("searchCont").innerHTML = '<div class="coverLoad" id="coverLoad"></div>'
		
	invioAjax('include/asp/fullSearch.asp','18;25;26;30;48;28;87;34;40;33;41;42;82/2.000/'+str+'/')	
		
	
	
}




function openp(){
	
	document.getElementById('chiudi').style.display="block"
	document.getElementById('tt2').style.display="block"
	document.getElementById('apri').style.display="none"
	document.getElementById('tt1').style.display="none"
	
}


function closep(){
	
	document.getElementById('apri').style.display="block"
	document.getElementById('tt1').style.display="block"
	document.getElementById('chiudi').style.display="none"
	document.getElementById('tt2').style.display="none"
	
}


function getAll(){
	
	
	document.getElementById("searchCont").innerHTML = '<div class="coverLoad" id="coverLoad"></div>'
	
	var totStringSearch = ""
	var tip1 = ""
	var tip2 = ""
	var tip3 = ""
	var tip4 = ""
	
	for(i=0;i<36;i++){
		var tempAll = document.getElementsByTagName("input")[i]
		if(tempAll.id.indexOf('tip')>-1 && (tempAll.checked == "true" || tempAll.checked == true )){
		
			if(tempAll.id.toLowerCase() == "tip1"){tip1+=tempAll.value+";";}
			
			if(tempAll.id.toLowerCase() == "tip3"){tip3+=tempAll.value+";";}
			
			
		}		
	}	
	
	tip2 = document.getElementById("tip2").value
	tip4 = document.getElementById("FStextArea").value
	//alert(tip2)
	
	
	
	var tip1LIO = tip1.lastIndexOf(";")
	//var tip2LIO = tip2.lastIndexOf(";")
	var tip3LIO = tip3.lastIndexOf(";")
	
	tip1 = tip1.substr(0,tip1LIO)
	//tip2 = tip2.substr(0,tip2LIO)
	tip3 = tip3.substr(0,tip3LIO)
	
	totStringSearch += tip1+"/"+tip2+"/"+tip3+"/"+tip4
	if(tip1 != "" && tip2 != "" && tip3 != "" &&  !(isNaN(tip2))){
		invioAjax('include/asp/fullSearch.asp',totStringSearch)
	}else{	
		//alert(tip3)
		document.getElementById('searchCont').innerHTML = "<h6>Siamo spiacenti, ma la ricerca non ha prodotto alcun risultato.</h6>"
	}
	

}





function getAllSRic(){
	
	document.getElementById("searchCont").innerHTML = '<div class="coverLoad" id="coverLoad"></div>'
	
	var sim1 = ""
	var sim2 = ""
	var sim3 = ""
	var sim4 = ""
	var sim5 = ""
	var sim6 = ""
	var sim7 = ""
	var sim8 = ""
	var sim9 = ""
	var sim10 = ""
	var sim11 = ""
	
	var totStringSearch = ""
	
	if(document.getElementById('sim1').checked){
		sim1 = document.getElementById('sim1').value+";";
	}
	
	if(document.getElementById('sim2').checked){
		sim2 = document.getElementById('sim2').value+";";
	}
	
	if(document.getElementById('sim3').checked){
		sim3 = document.getElementById('sim3').value+";";
	}
	
	if(document.getElementById('sim4').checked){
		sim4 = document.getElementById('sim4').value;
	}
	
	if(document.getElementById('sim5').checked){
		sim5 = document.getElementById('sim5').value;
	}
	
	if(document.getElementById('sim6').checked){
		sim6 = document.getElementById('sim6').value+";";
	}
	
	if(document.getElementById('sim7').checked){
		sim7 = document.getElementById('sim7').value+";";
	}
	
	if(document.getElementById('sim8').checked){
		sim8 = document.getElementById('sim8').value+";";
	}
	
	if(document.getElementById('sim9').checked){
		sim9 = document.getElementById('sim9').value+";";
	}
	
	if(document.getElementById('sim10').checked){
		sim10 = document.getElementById('sim10').value+";";
	}
	
	if(document.getElementById('sim11').checked){
		sim11 = document.getElementById('sim11').value+";";
	}
	
	
	
	var tip1 = sim1+sim2+sim3+sim4+sim5
	var tip3 = sim6+sim7+sim8+sim9+sim10+sim11
	
	
	
	var tip1LIO = tip1.lastIndexOf(";")
	//var tip2LIO = tip2.lastIndexOf(";")
	var tip3LIO = tip3.lastIndexOf(";")
	
	tip1 = tip1.substr(0,tip1LIO)
	//tip2 = tip2.substr(0,tip2LIO)
	tip3 = tip3.substr(0,tip3LIO)


	
	
	totStringSearch += tip1+"/2.000/"+tip3+"/"
	//alert(totStringSearch)
	//
	if(tip1 != "" && tip3 != ""){
		invioAjax('include/asp/fullSearch.asp',totStringSearch)
		//alert(totStringSearch)
	}else{	
		document.getElementById('searchCont').innerHTML = "<h6>Siamo spiacenti, ma la ricerca non ha prodotto alcun risultato.</h6>"
	}
	

}








function myFilterSearch(string){
	
	if(usrLgnName_ != ""){
		if(string!="///" && string!="/0//"){
			document.getElementById("searchCont").innerHTML = '<div class="coverLoad" id="coverLoad"></div>'
			invioAjax('include/asp/fullSearch.asp',string)
		}
	}else{
		deviLog()
	}
	//invioAjax('include/asp/fullSearch.asp',string)
	//invioAjax('include/asp/isLoggedIn.asp','filter')
	
}

function myFavsearch(string){
	
	
	
		if(usrLgnName_ != ""){
			if(string == ""){document.getElementById("searchCont").innerHTML ="<h6>Siamo spiacenti ma non hai nessun immobile tra i tuoi preferiti.</h6>"}else{
				document.getElementById("searchCont").innerHTML = '<div class="coverLoad" id="coverLoad"></div>'
			}
			invioAjax('include/asp/favSearch.asp',string)
		}else{
			deviLog()
		}
	
	
	
	
	
}






var mx
var my
var avviaDeD = false
document.onmouseup = function(){avviaDeD = false;setForm()}
document.onmousemove = function(e) {


    e = e || event; // l'oggetto event. cross-browser (event è per ie)


     mx = e.clientX
	 my = e.clientY;
	 
	 //alert(mx)
	 
	 if(avviaDeD){
		//alert(mx)
		if(mx>=538 && mx<=659){
	 		
	 		document.getElementById("dEdCursor").style.left = (mx-539)+"px"
			document.getElementById("priceTag").style.left = (mx-562)+"px"
			//document.getElementById("comic").style.left = (mx-12)+"px"
			
			var mx2 = mx-539
			
			if( mx2<=5){document.getElementById("res").innerHTML="0";/*document.getElementById("dEdCursor").style.left =0+"px";*/}
			if( mx2>=10 && mx2<=23){document.getElementById("res").innerHTML=">10000";/*document.getElementById("dEdCursor").style.left =16+"px";*/}
			if( mx2>=24 && mx2<=44){document.getElementById("res").innerHTML=">30000";/*document.getElementById("dEdCursor").style.left =32+"px";*/}
			if( mx2>=45 && mx2<=67){document.getElementById("res").innerHTML=">60000";/*document.getElementById("dEdCursor").style.left =50+"px";*/}
			if( mx2>=63 && mx2<=79){document.getElementById("res").innerHTML=">120000";/*document.getElementById("dEdCursor").style.left =71+"px";*/}
			if( mx2>=80 && mx2<=95){document.getElementById("res").innerHTML=">200000";/*document.getElementById("dEdCursor").style.left =87+"px";*/}
			if( mx2>=95 && mx2<=118){document.getElementById("res").innerHTML=">500000";/*document.getElementById("dEdCursor").style.left =112+"px";*/}
			if( mx2>=119){document.getElementById("res").innerHTML='<p id="infinito">illimitato</p>';/*document.getElementById("dEdCursor").style.right =0+"px";*/}
			
		}
	 }


}



function moveIt(){
	avviaDeD = true
	
}


function setForm(){
	
/*	var pre = document.getElementById("res").innerHTML
	
	pre = pre.replace(">","")
	pre = pre.replace("&gt;","")
	//alert(pre)
	if(pre.indexOf('illi')>0){
	
		pre = "10000000"
		
	}
	
	document.getElementById("tip2").value = parseInt(pre)
	//alert(document.getElementById("tip2").value)*/
	
}




var storeIdMail = ""

function immoFull(id){
	
	storeIdMail = id

	document.getElementById("descPicsCent").innerHTML = ""
	document.getElementById('descRight').innerHTML = ""
	document.getElementById('descRightTop').innerHTML = ""
	
	posizionaPopup('intDescPopup')	
	
	id = id.replace("_","")
	
	var fullTitle = String(document.getElementById(id).getElementsByTagName("span")[0].innerHTML)
	var tempDesc = document.getElementById(id).getElementsByTagName("span")[1].innerHTML
	
	document.getElementById('copiamitot').value = document.getElementById('copiami'+id).value 
	
	var tempTab = document.getElementById('hidedescdati'+id).title
	tempTab = tempTab.toUpperCase()
	tempTab = tempTab.split(",")
	
	if(tempTab[0] == '2 Locali'){tempTab[0] = "Bilocale"}
	if(tempTab[0] == '3 Locali'){tempTab[0] = "Trilocale"}
	
	document.getElementById('hdd1').innerHTML = '<strong style="font-weight:bold;color:#333;">TIPOLOGIA :</strong> '+tempTab[0]
	document.getElementById('hdd2').innerHTML = '<strong style="font-weight:bold;color:#333;">SUP. COMMERCIALE :</strong> ca. '+tempTab[1]+' mq'
	document.getElementById('hdd3').innerHTML = '<strong style="font-weight:bold;color:#333;">ESPOSIZIONE :</strong> '+tempTab[2]
	document.getElementById('hdd4').innerHTML = '<strong style="font-weight:bold;color:#333;">ANNO COSTR./RISTR. :</strong> '+tempTab[3]
	document.getElementById('hdd5').innerHTML = '<strong style="font-weight:bold;color:#333;">RIF.INCARICO :</strong> '+tempTab[4]
	document.getElementById('hdd6').innerHTML = '<strong style="font-weight:bold;color:#333;">CAMERE DA LETTO :</strong> '+tempTab[5]
	document.getElementById('hdd7').innerHTML = '<strong style="font-weight:bold;color:#333;">BAGNI :</strong> '+tempTab[6]
	document.getElementById('hdd8').innerHTML = '<strong style="font-weight:bold;color:#333;">PIANO :</strong> '+tempTab[7]
	document.getElementById('hdd9').innerHTML = '<strong style="font-weight:bold;color:#333;">PIANI EDIFICIO :</strong> '+tempTab[8]
	document.getElementById('hdd10').innerHTML = '<strong style="font-weight:bold;color:#333;">STATO IMM. :</strong> '+tempTab[9]
	document.getElementById('hdd11').innerHTML = '<strong style="font-weight:bold;color:#333;">APPARTAMENTI EDIFICIO :</strong> '+tempTab[10]

/*	document.getElementById('hdd1').innerHTML = '<strong style="font-weight:bold;color:#333;">TIPOLOGIA ABITATIVA :</strong> '+tempTab[0]
*/	
	
	var hdn = document.getElementById('hidedenote'+id).title
	document.getElementById('descPicsCent2').innerHTML = '<strong style="font-size:12px;color:#333333;text-align:left;margin-bottom:0px;line-height:20px;">NOTE :<br></strong>'+hdn
	
	fullTitle=fullTitle.split("__")
	
		var fddf = fullTitle[0]
	fddf = fddf.toLowerCase()
	
	if(fddf.indexOf("arco")>=0 || fddf.indexOf("dro")>=0){
	
		document.getElementById('detArco').style.display = "block";	
		document.getElementById('detRiva').style.display = "none";	
		
	}else{
		//alert(typeof(fddf))
		//alert(fddf)
		document.getElementById('detRiva').style.display = "block";	
		document.getElementById('detArco').style.display = "none";	
			
	}
	
	var fotoBig = document.getElementById(id).getElementsByTagName("img")[0].src
	var onclikTemp = document.getElementById(id).getElementsByTagName("img")[0].onclick
	
	for(i=2;i<=11;i++){
	
	
	
		var tempImg2 = document.getElementById(id).getElementsByTagName("img")[i]
		
		var tempImgClone2 = tempImg2.cloneNode(true)
		if(i==2){tempImgClone2.style.marginLeft="13px";tempImgClone2.style.border="2px solid #b2df14";}else{tempImgClone2.style.marginLeft="4px";}
		tempImgClone2.id="miniGall"+i
		//alert(tempImgClone.id)
		tempImgClone2.onmouseover= function(){swapPicDesc(this);}

		document.getElementById("descPicsCent").appendChild(tempImgClone2)
		//document.getElementById("descPicsCent").style.marginLeft="10px";

	}
	
	fotoBig = fotoBig.replace('include_app/administrator/thumsnavi_libro_MEDIUM.asp?namefile=','include_app/administrator/thumsnavi_libro_BIG.asp?namefile=')
	document.getElementById('nasc').style.display="block";
	document.getElementById("descTarget").src = fotoBig;
	document.getElementById("descTarget").onclick = onclikTemp;
	document.getElementById("openGallins").onclick = onclikTemp;
	
	document.getElementById("immoLess").style.visibility= "visible";
	document.getElementById("openGallins").style.visibility= "visible";
	document.getElementById('fb2').style.visibility= "visible";
	var f = document.getElementById('ahr').href
	f = f.replace('share=','share='+id)
	document.getElementById('ahr').href = f
	document.getElementById('mail2').style.visibility= "visible";
	document.getElementById('print2').style.visibility= "visible";
	document.getElementById('descRight').innerHTML = tempDesc
	document.getElementById('upBar').innerHTML = '<div class="closePopup" style="margin-top:-20px;" onclick="closeWindow(\'intDescPopup\')"></div>'
	document.getElementById('upBar').innerHTML += '<div id="c1" style="position:absolute;left:40px;top:12px;font-size:13px;font-weight:bold;">'+fullTitle[0]+' </div><div id="c2" style="position:absolute;width:100%;text-align:center;left:0px;top:12px;font-size:13px;font-weight:bold;text-transform:uppercase;"> '+fullTitle[1]+'</div><div id="c3" style="position:absolute;right:65px;top:12px;font-size:13px;z-index:100;width:100px;height:20px;font-weight:bold;text-transform:uppercase;">'+fullTitle[2]+'</div>'
	//alert(document.getElementById('upBar').innerHTML)
	
}

function immoFullG(){
	
		
	immoFull(storeIdMail)
	
}


function changeImg2(){

	try
	  {
	  document.getElementById('src1').style.display='none';
	document.getElementById('src2').style.display='block';
	  }
	catch(err)
	  {
	  //Handle errors here
	  }


	
	
}


function sendImm(id){
	
	id = id.replace("mail","")
	
	document.getElementById('rifincMail').value = id
		
	posizionaPopup('invioMailPopup')
		
}



function sendImmImmofull(){
	
	id = storeIdMail.replace("_","")
	
	document.getElementById('rifincMail').value = id
		
	posizionaPopup('invioMailPopup')
		
}





function immoSendGo(){
	
	var mailind = document.getElementById("mailName").value
	var testoind = document.getElementById("mailText").value
	var rifinc = document.getElementById("rifincMail").value
	
	if(mailind != "" ){
		
		
		var paramsSend = mailind+"$"+testoind+"$"+rifinc
		
		invioAjax('include/asp/mailImmo.asp',paramsSend)
	
	}else{
		
		document.getElementById("sendGoRes").innerHTML = '<h2 style="color:red;">&Eacute; necessario inserire un\'indirizzo email.</h2>'	
		
	}
	
}



function swapPicDesc(obj){
/*	document.getElementById('nasc').style.display="block";
	document.getElementById('nasc').style.filter = "alpha(opacity=80)"; 
	document.getElementById('nasc').style.opacity="0.8"
	document.getElementById('nasc').style.display="block";*/
	
	//alert(document.getElementById("descPicsCent").innerHTML)
	
	var idPic = parseInt(obj.id.replace("miniGall",""))
	document.getElementById("intDescPopup").getElementsByTagName("img")[idPic].style.border ="2px #b2df14 solid";
	
	//alert(idPic)
	
	var ttsrc = obj.src;

	ttsrc = ttsrc.replace('include_app/administrator/thumsnavi_libro_MINI.asp?namefile=','include_app/administrator/thumsnavi_libro_BIG.asp?namefile=')
	
	
	document.getElementById("descTarget").src = ttsrc
	
	
		for(i=2;i<12;i++){
		
		if(i!=idPic){
			//
			//document.getElementById("img"+id+"-"+i)
			document.getElementById("intDescPopup").getElementsByTagName("img")[i].style.border = "1px #cfcfcf solid";	
			
		}	
		
	}
	
	
	
}



function arrowSwap(n){
	//alert(n)
	var tempCont = document.getElementById("galleryPics").getElementsByTagName("img")
	
	var control = true
	
	for(i=0;i<tempCont.length;i++){
		//alert(tempCont[i].style.border)
		var xSt = String(tempCont[i].style.border)
		//alert(xSt)
		if(xSt.indexOf("223")>=0){
			//alert('si')
			var tempId = tempCont[i].id.replace("miniGall","")
			//alert(tempId)
			if(tempId>=2 && tempId<=11 && control){
				//alert(tempId)
				if(n=='1' && tempId<11){
					//alert(tempId)
					var tc = tempCont[i+1].src;
					//alert(tc)
					tc = tc.replace('include_app/administrator/thumsnavi_libro_GALLERY.asp?namefile=','include_app/administrator/thumsnavi_libro_BIG.asp?namefile=')
					//alert(tc)
					tempCont[i].style.border = "1px #cfcfcf solid";	
					tempCont[i+1].style.border ="3px #b2df14 solid";
					
					document.getElementById("galleryTarget").src = tc;
					
					control = false
					
				}else if(n=='2' && tempId>2){
					
					var tc = tempCont[i-1].src;

					tc = tc.replace('include_app/administrator/thumsnavi_libro_GALLERY.asp?namefile=','include_app/administrator/thumsnavi_libro_BIG.asp?namefile=')		
					
					tempCont[i].style.border = "1px #cfcfcf solid";	
					tempCont[i-1].style.border ="3px #b2df14 solid";
					
					document.getElementById("galleryTarget").src = tc;
					
					control = false
					
				}
				
				
				
			}
			
			
			
		}
			
		
	}
	
	
}



function fillBox(){
	
	if(queryRicercaGeo != ""){
		
		var TOTckcbx = document.getElementsByTagName("input")
	
		for(i=0;i<TOTckcbx.length;i++){
			
			var ckcbx = document.getElementsByTagName("input")[i]
			//alert(ckcbx.id)
			if(ckcbx.id == "tip3" || ckcbx.type == "checkbox"){
				//alert(ckcbx.value)
				if(ckcbx.value.indexOf(queryRicercaGeo)>-1){
					document.getElementsByTagName("input")[i].checked = true;
					openPop('hide3','hideCmd3Div');
				}	
				
			}	
		}
		
	}
	
	
	
}



function checkTip1(){
	
	var ttemp = document.getElementsByTagName("input")
	var gfgf = []
	var gfgf2 = []
	
	for(i=0;i<ttemp.length;i++){
		
		if(ttemp[i].id=="tip1"){
		
			gfgf.push(ttemp[i])
			
		}	
		
	}
	
	for(j=0;j<ttemp.length;j++){
			
		if(ttemp[j].id=="tip0"){
		
			gfgf2.push(ttemp[j])
			
		}	
		
	}
	
		
	if(!gfgf[0].checked && !gfgf[1].checked && !gfgf[2].checked){
		//alert(gfgf[0].checked)
		 gfgf2[0].checked= false;
		
	}
	
	if(gfgf[0].checked && gfgf[1].checked && gfgf[2].checked){
		//alert(gfgf[0].checked)
		 gfgf2[0].checked= true;
		
	}
	
	if(gfgf[0].checked || gfgf[1].checked || gfgf[2].checked){
		//alert(gfgf[0].checked)
		 gfgf2[0].checked= true;
		
	}
	
}



function checkTip2(){
	
	var ttemp3 = document.getElementsByTagName("input")
	var gfgf3 = []
	var gfgf4 = []
	
	for(i=0;i<ttemp3.length;i++){
		
		if(ttemp3[i].id=="tip1"){
		
			gfgf3.push(ttemp3[i])
			
		}	
		
	}
	
	for(j=0;j<ttemp3.length;j++){
			
		if(ttemp3[j].id=="tip0"){
		
			gfgf4.push(ttemp3[j])
			
		}	
		
	}
	
	if(!gfgf3[3].checked && !gfgf3[4].checked && !gfgf3[5].checked && !gfgf3[6].checked && !gfgf3[7].checked){
		
		 gfgf4[1].checked= false;
		
	}
	
	if(gfgf3[3].checked && gfgf3[4].checked && gfgf3[5].checked && gfgf3[6].checked && gfgf3[7].checked ){
		//alert(gfgf[0].checked)
		 gfgf4[1].checked= true;
		
	}
	
	if(gfgf3[3].checked || gfgf3[4].checked || gfgf3[5].checked || gfgf3[6].checked || gfgf3[7].checked ){
		//alert(gfgf[0].checked)
		 gfgf4[1].checked= true;
		
	}
	
}


function checkTip3(){
	
	var ttemp3 = document.getElementsByTagName("input")
	var gfgf3 = []
	var gfgf4 = []
	
	for(i=0;i<ttemp3.length;i++){
		
		if(ttemp3[i].id=="tip1"){
		
			gfgf3.push(ttemp3[i])
			
		}	
		
	}
	
	for(j=0;j<ttemp3.length;j++){
			
		if(ttemp3[j].id=="tip0"){
		
			gfgf4.push(ttemp3[j])
			
		}	
		
	}
	
	if(!gfgf3[8].checked && !gfgf3[9].checked && !gfgf3[10].checked && !gfgf3[11].checked && !gfgf3[12].checked){
		
		 gfgf4[2].checked= false;
		
	}
	
	if(gfgf3[8].checked && gfgf3[9].checked && gfgf3[10].checked && gfgf3[11].checked && gfgf3[12].checked ){
		//alert(gfgf[0].checked)
		 gfgf4[2].checked= true;
		
	}
	
	if(gfgf3[8].checked || gfgf3[9].checked || gfgf3[10].checked || gfgf3[11].checked || gfgf3[12].checked ){
		//alert(gfgf[0].checked)
		 gfgf4[2].checked= true;
		
	}
	
}
