﻿function initMenu(){
        
    while(document.getElementById('smoothmenu') == undefined){
        window.setTimeout("initMenu()", 200);    
        return;
    }     
    
        ddsmoothmenu.init({
            mainmenuid: "smoothmenu", //menu DIV id
            orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v"
            classname: 'ddsmoothmenu', //class added to menu's outer DIV
            //customtheme: ["#1c5a80", "#18374a"],
            contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
        })
    
}
	
function loadSection(section){

	window.lastJs = null;
    window.lastSection = window.thatSection;
    window.thatSection = section;        
    
    while(document.getElementById('content') == undefined){
        window.setTimeout("loadSection('"+section+"')", 200);    
        return;
    }

    switch(section){

    	case "home":
    		deferredExecute('load_XML_Content.php', 'section='+section, false, true, true, 'content', false);
    		setMenu(section);        						        		
        break; 
    	case "chisiamo":
    		deferredExecute('load_XML_Content.php', 'section='+section, false, true, true, 'content', false);
    		setMenu(section);
        break;
    	case "attrezzature":
    		setAjaxEndFunction('loadIntroCatalogo()');
    	        deferredExecute('dfExecution/catalogo.php', 'section='+section, false, true, true, 'content', false); 
		//	alert('Sezione in allestimento!');
    		setMenu(section);
		break;            
    	case "dovesiamo":
    		setAjaxEndFunction('initialize_maps()');
    		deferredExecute('load_XML_Content.php', 'section='+section, false, true, true, 'content', false);
    		setMenu(section);
		break;
    	case "contatti":
    		setAjaxEndFunction('loadContatti()');
    		deferredExecute('load_XML_Content.php', 'section='+section, false, true, true, 'content', false);
    		setMenu(section);
    	break;
    	default:
    		deferredExecute('load_XML_Content.php', 'section='+section, false, true, true, 'content', false);
			setMenu(section);    		
        break;
    }
            
}

function initialize_maps() {
	
	var map = new GMap2(document.getElementById("map_canvas")); 
	var marker = new GMarker(new GLatLng(40.9629, 16.9264)); 

	var html="<div jstcache=\"0\" class=\"basics selected\" id=\"basics\"><div style=\"display: none;\" jstcache=\"28\" jsdisplay=\"(i.lba&amp;&amp;i.lba.admsg)||(i.boost&amp;&amp;i.boost.admsg)\" class=\"adsmessage\" jsvalues=\"innerHTML:(i.lba?i.lba.admsg:i.boost.admsg);dir:bidiDir((i.lba?i.lba.admsg:i.boost.admsg),true)\"></div><div class=\"maxtitle title\" jstcache=\"30\" jsdisplay=\"i.title||m.laddr\" jsvalues=\"className:(i.place_url?'maxtitle ':'')+'title'\"><span jstcache=\"36\" jsdisplay=\"i.title\"><span jstcache=\"50\" jsdisplay=\"!features.embed\"><a style=\"display: none;\" jstcache=\"62\" jsdisplay=\"i.linkback&amp;&amp;!(i.lba&amp;&amp;i.lba.cr8Line1)\" jsvalues=\"href:i.linkback;target:(i.lba ? '_blank' : '_self');innerHTML:i.title;dir:bidiDir(i.title,true)\" href=\"\"></a><span dir=\"ltr\" jstcache=\"63\" jsdisplay=\"!i.linkback||(i.lba&amp;&amp;i.lba.cr8Line1)\" jsvalues=\"innerHTML:i.title;dir:bidiDir(i.title,true)\"><b jstcache=\"0\">Progida Traversa</b> Di <b jstcache=\"0\">Traversa</b> Domenico &amp; C. Sas <br> Attrezzatura Infortunistica</span></span><span style=\"display: none;\" jstcache=\"51\" jsdisplay=\"features.embed\"><a jstcache=\"64\" jsdisplay=\"i.place_url\" jsvalues=\"href:i.place_url;innerHTML:i.title;dir:bidiDir(i.title,true)\" href=\"\" target=\"_parent\"></a><span jstcache=\"65\" jsdisplay=\"!i.place_url\" jsvalues=\"innerHTML:i.title;dir:bidiDir(i.title,true)\"></span></span></span><span style=\"display: none;\" jstcache=\"37\" jsdisplay=\"!i.title&amp;&amp;m.laddr\">Indirizzo:</span><span jstcache=\"0\" class=\"nw\"><img style=\"display: none;\" jstcache=\"52\" jsdisplay=\"i.transitSchedules&amp;&amp;i.transitSchedules.stationSchedules&amp;&amp;i.transitSchedules.stationSchedules.whlchrAccess\" jsvalues=\"src:_mStaticPath+'transit/iw/misc/wheelchair2.png'\" class=\"tsch-whlchr\" alt=\"Stazione non accessibile\" title=\"Stazione non accessibile\" width=\"14\" height=\"14\"><img src=\"http://maps.gstatic.com/intl/it_it/mapfiles/transparent.png\" class=\"noprint unstarred\" jstcache=\"53\" id=\"iwstar\" jsdisplay=\"features.si&amp;&amp;m.b_s&lt;5\" jsvalues=\"className:(i.is_s ? 'starred noprint' : 'unstarred noprint');src:_mStaticPath+'transparent.png'\" jsaction=\"si.toggleInfoWindowStarring\" log=\"si_iw\"></span><span jstcache=\"38\" jscontent=\"bidiMark()\">‎</span></div><div style=\"display: none;\" jstcache=\"31\" id=\"placestatus\" jsdisplay=\"m&amp;&amp;m.ss&amp;&amp;m.ss.status&amp;&amp; m.ss.status&gt;0\"><span jstcache=\"39\" jscontent=\"m.ss.statusmsg\" class=\"unver\"></span><span jstcache=\"40\" jsdisplay=\"(m.ss.status&gt;=1&amp;&amp;m.ss.status&lt;=5)||(m.ss.status&gt;=12&amp;&amp;m.ss.status&lt;=15)\" class=\"rev\">&nbsp;<a jstcache=\"0\" href=\"javascript:void(0)\" jsaction=\"ss.notTrueRestore\" id=\"ssnottruerestore\">Non è vero?</a></span><span jstcache=\"41\" jsdisplay=\"m.ss.status==6\" class=\"rev\">&nbsp;<a jstcache=\"54\" jsvalues=\"href:'javascript:void(0)'\" jsaction=\"ss.showEditHistory\" id=\"sshistory\">Mostra tutte le modifiche</a></span><span jstcache=\"42\" jsdisplay=\"m.ss.status&gt;=7&amp;&amp;m.ss.status&lt;=11\" class=\"rev\">&nbsp;<a jstcache=\"0\" href=\"javascript:void(0)\" jsaction=\"ss.notTrueRap\" id=\"ssnottruerap\">Non è vero?</a></span></div><div jstcache=\"0\"><span style=\"display: none;\" jstcache=\"43\" jsdisplay=\"m.b_s==4&amp;&amp;i.addressLines\" jsvalues=\"innerHTML:i.addressLines[0]+' - ';\"></span><span jstcache=\"44\" jsdisplay=\"i.reviews\" class=\"rev\"><span style=\"display: none;\" jstcache=\"55\" jsdisplay=\"i.stars_html\" jsvalues=\"innerHTML:i.stars_html\"></span>&nbsp;<a id=\"iwreviews_A\" href=\"http://maps.google.it/maps/place?cid=9179856225619447905&amp;q=progida+traversa&amp;hl=it&amp;cd=1&amp;cad=src:ppiwlink&amp;ei=i1sTTd_4I8Gj_gaf36zaDA&amp;dtab=2\" jstcache=\"56\" log=\"miwd\" jsdisplay=\"!features.embed\" jsvalues=\"href:i.place_url+'&amp;dtab=2';id:'iwreviews_'+m.id;\" jscontent=\"i.reviews==1?'1 recensione':sprintf('%1$d recensioni', i.reviews)\" jsaction=\"app.showMoreInfo\">1 recensione</a><a style=\"display: none;\" jstcache=\"57\" jsdisplay=\"features.embed\" jsvalues=\"href:i.place_url+'&amp;dtab=2';\" jscontent=\"i.reviews==1?'1 recensione':sprintf('%1$d recensioni', i.reviews)\" target=\"_parent\"></a></span><span style=\"display: none;\" jstcache=\"45\" jsdisplay=\"!i.reviews&amp;&amp;m.cid&amp;&amp;!i.dscr&amp;&amp;i.zrvOk\" class=\"rev\"><a jstcache=\"58\" log=\"miwd\" jsvalues=\"href:i.loginUrl?i.loginUrl:i.place_url+'&amp;dtab=2&amp;action=open';id:'iwwritereview_'+m.id;jsaction:i.loginUrl?'':'app.showMoreInfo'\">Scrivi una recensione</a>&nbsp;- </span><span jstcache=\"46\" jsdisplay=\"i.moreInfo&amp;&amp;i.place_url&amp;&amp;!features.embed\" class=\"rev\"><span jstcache=\"44\" jsdisplay=\"i.reviews\">&nbsp;- </span><a id=\"iwlink_A\" href=\"http://maps.google.it/maps/place?cid=9179856225619447905&amp;q=progida+traversa&amp;hl=it&amp;cd=1&amp;cad=src:ppiwlink&amp;ei=i1sTTd_4I8Gj_gaf36zaDA&amp;dtab=0\" jstcache=\"59\" log=\"miwd\" jsvalues=\"href:i.place_url+'&amp;dtab=0';id:'iwlink_'+m.id\" jsaction=\"app.showMoreInfo\" jscontent=\"i.moreInfo+'&nbsp;»'\">altre informazioni&nbsp;»</a></span><table jstcache=\"0\"><tbody jstcache=\"0\"><tr jstcache=\"0\"><td jstcache=\"0\" class=\"basicinfo\"><div class=\"addr\" jstcache=\"83\" jsvalues=\"className:(i.lba&amp;&amp;i.lba.cr8Line1?'':'addr')\"><div style=\"display: none;\" jstcache=\"84\" jsdisplay=\"m.approx&amp;&amp;!(m.service_area&amp;&amp;m.service_area.type==1)\" class=\"iscentroid\" id=\"iscentroid\">Il posizionamento sulla mappa è approssimativo</div><span jstcache=\"85\" jsdisplay=\"m.b_s!=4\" jsvalues=\"$title:i.title;$laddr:m.laddr;$addrurl:i.addressUrl;$features:features\"><div jsinstance=\"0\" jstcache=\"87\" jsselect=\"i.addressLines\" jsvalues=\"$addrline:$this;\"><span dir=\"ltr\" jstcache=\"89\" jsdisplay=\"$title||!$laddr||!$addrurl\" jsvalues=\"innerHTML:$addrline;dir:bidiDir($addrline,true)\">Km. 18, Strada Statale 100, Casamassima, BA 70010</span><a jstcache=\"90\" jsvalues=\"href:$addrurl\" jsdisplay=\"$features.embed&amp;&amp;!$title&amp;&amp;$laddr&amp;&amp;$addrurl\" href=\"\" target=\"_parent\" style=\"text-decoration: underline; display: none;\"><span jstcache=\"92\" jsvalues=\"innerHTML:$addrline;dir:bidiDir($addrline,true)\"></span></a></div><div jsinstance=\"*1\" jstcache=\"87\" jsselect=\"i.addressLines\" jsvalues=\"$addrline:$this;\"><span dir=\"ltr\" jstcache=\"89\" jsdisplay=\"$title||!$laddr||!$addrurl\" jsvalues=\"innerHTML:$addrline;dir:bidiDir($addrline,true)\">70010</span><a jstcache=\"90\" jsvalues=\"href:$addrurl\" jsdisplay=\"$features.embed&amp;&amp;!$title&amp;&amp;$laddr&amp;&amp;$addrurl\" href=\"\" target=\"_parent\" style=\"text-decoration: underline; display: none;\"><span jstcache=\"92\" jsvalues=\"innerHTML:$addrline;dir:bidiDir($addrline,true)\"></span></a></div><div style=\"display: none;\" jstcache=\"88\" jsdisplay=\"$features.embed&amp;&amp;!i.title&amp;&amp;!m.laddr&amp;&amp;i.addressLines&amp;&amp;i.place_url\"><br jstcache=\"0\"><a jstcache=\"91\" jsvalues=\"href:i.place_url\" href=\"\" target=\"_parent\">Indicazioni stradali</a></div></span><span style=\"display: none;\" jstcache=\"86\" jsdisplay=\"m.b_s==4&amp;&amp;i.realestate_data\" jsvalues=\"innerHTML:i.realestate_data.attr_html\"></span></div><div jsinstance=\"*0\" jstcache=\"93\" jsselect=\"i.phones\" jsvalues=\"$type:$this.type;$mobile:!!$features.mobile\" class=\"phone\"><span jstcache=\"94\" dir=\"ltr\" jsdisplay=\"!$mobile\" jscontent=\"$this.number\">080 4571911</span><span style=\"display: none;\" jstcache=\"95\" dir=\"ltr\" jsdisplay=\"$mobile\"><a jstcache=\"97\" href=\"\" jsvalues=\"href:'tel:'+$this.number\" jscontent=\"$this.number\"></a></span><span style=\"display: none;\" jstcache=\"96\" jsdisplay=\"$type\" jscontent=\"'&nbsp;-&nbsp;'+$type\" class=\"type\"></span></div><div id=\"iwhomepage\" jstcache=\"98\" jsvalues=\"id:'iwhomepage'\" jsdisplay=\"i.hp&amp;&amp;i.hp.url&amp;&amp;!(i.lba&amp;&amp;i.lba.cr8Line1)\"><a target=\"_blank\" class=\"a\" dir=\"ltr\" href=\"/local_url?q=http://www.progidatraversa.it/&amp;dq=progida+traversa&amp;f=q&amp;source=s_q&amp;output=js&amp;hl=it&amp;geocode=&amp;abauth=9b7ace01:pHs31PxRzYFfbL3awDtg4z0R9ZI&amp;oi=miw&amp;sa=X&amp;ct=miw_link&amp;cd=1&amp;cad=homepage,cid:9179856225619447905&amp;ei=i1sTTd_4I8Gj_gaf36zaDA&amp;s=ANYYN7mm5j3Fkcjr5Fpaj5lF8f6Vp_ttQQ\" jstcache=\"99\" jsvalues=\"href:i.lba&amp;&amp;i.linkback?i.linkback:i.hp.url;innerHTML:i.hp.domain;dir:bidiDir(i.hp.domain,true);className:'a';target:features.embed?'_parent':'_blank'\">progidatraversa.it</a><span jstcache=\"38\" jscontent=\"bidiMark()\">‎</span></div><div style=\"display: none;\" jstcache=\"74\" id=\"iwsrva\" class=\"srva\" jsdisplay=\"m.service_area&amp;&amp;m.service_area.type==1\"><div jstcache=\"0\"><span jstcache=\"0\" class=\"b\">Area interessata dal servizio:</span>&nbsp;<span jstcache=\"81\" id=\"iwsrvaname\" jscontent=\"m.service_area.name\"></span><span jstcache=\"82\" jsdisplay=\"m.service_area&amp;&amp;m.service_area.type==0&amp;&amp;m.service_area.attribution\">&nbsp;-&nbsp;</span></div><div jstcache=\"0\" id=\"iwsrvaattr\"></div></div><div style=\"display: none;\" jstcache=\"100\" jsdisplay=\"i.hc\" class=\"rescat\">Categoria: <span jstcache=\"101\" jsvalues=\"innerHTML:i.hc;dir:bidiDir(i.hc,true)\"></span></div><div style=\"display: none;\" jstcache=\"102\" jsdisplay=\"i.lba&amp;&amp;(i.lba.cr8Line1||i.lba.cr8Line2||i.lba.cr8Line3)\" class=\"creative-text\"><div jstcache=\"103\" jsdisplay=\"i.lba.cr8Line1\" jsvalues=\"className:'cr8ln1';dir:bidiDir(i.lba.cr8Line1,true);align:bidiAlign()\"><a jstcache=\"107\" jsdisplay=\"i.linkback||(i.hp&amp;&amp;i.hp.url)\" jsvalues=\"href:i.linkback?i.linkback:i.hp.url;target:(ENABLED_ad_opens_new_window ?'_blank' : '_self');innerHTML:i.lba.cr8Line1;dir:bidiDir(i.lba.cr8Line1,true);\" href=\"\"></a></div><div jstcache=\"104\" jsdisplay=\"i.lba&amp;&amp;i.lba.cr8Line2\" jsvalues=\"innerHTML:i.lba.cr8Line2;dir:bidiDir(i.lba.cr8Line2,true);align:bidiAlign()\"></div><div jstcache=\"105\" jsdisplay=\"i.lba&amp;&amp;i.lba.cr8Line3\" jsvalues=\"innerHTML:i.lba.cr8Line3;dir:bidiDir(i.lba.cr8Line3,true);align:bidiAlign()\"></div><span jstcache=\"106\" jsdisplay=\"i.lba.cr8Line1&amp;&amp;m.hp&amp;&amp;m.hp.url\" class=\"url\" jsvalues=\"innerHTML:m.hp.domain;dir:bidiDir(m.hp.domain,true)\"></span><span jstcache=\"38\" jscontent=\"bidiMark()\"></span></div><div style=\"display: none;\" jstcache=\"77\" jsdisplay=\"m.is_unverified&amp;&amp;(!m.ss||!m.ss.status||m.ss.status==0)\" class=\"unver\">Scheda non verificata</div><div style=\"display: none;\" jstcache=\"78\" jsdisplay=\"i.dscr\" jsvalues=\"innerHTML:i.dscr;dir:i.dscr_dir||bidiDir();align:bidiAlign()\"></div><div style=\"display: none;\" jstcache=\"79\" jsdisplay=\"m.description\" jsvalues=\"innerHTML:m.description;align:bidiAlign()\"></div></td><td jstcache=\"0\" style=\"vertical-align: top;\"><div jstcache=\"108\" jsdisplay=\"i.photoUrl\"><div id=\"\" jstcache=\"109\" jsvalues=\"id:(i.lba&amp;&amp;i.lba.cr8Line1?'adimg':'')\"><div style=\"display: none;\" jstcache=\"110\" jsdisplay=\"i.photoType==1\" class=\"rimg\"><a jstcache=\"113\" log=\"miwd\" jsdisplay=\"!features.embed&amp;&amp;i.photoType==1\" jsvalues=\"href:i.place_url+'&amp;dtab=5';id:'iwphoto_'+m.id\" jsaction=\"app.showMoreInfo\"><img jstcache=\"117\" jsvalues=\"src:i.photoUrl\" alt=\"Foto\" border=\"0\"></a><a jstcache=\"114\" jsdisplay=\"features.embed&amp;&amp;i.photoType==1\" jsvalues=\"href:i.place_url+'&amp;dtab=5'\" target=\"_parent\"><img jstcache=\"117\" jsvalues=\"src:i.photoUrl\" alt=\"Foto\" border=\"0\"></a></div><div jstcache=\"111\" class=\"rimg\" jsdisplay=\"i.photoType==2&amp;&amp;!(m.service_area&amp;&amp;m.service_area.type==1)&amp;&amp;(!m.cityblock_info||(m.cityblock_info&amp;&amp;m.cityblock_info.pano_present))\"><a jstcache=\"115\" jsdisplay=\"i.photoType==2\" id=\"svthumbnail\" jsaction=\"sv.showFromInfoWindow\" href=\"javascript:void(0)\"><div jstcache=\"0\" id=\"thumbnail\" style=\"width: 90px; height: 68px; background: none repeat scroll 0% 0% rgb(239, 239, 239);\"><img src=\"http://cbk0.google.com/cbk?output=thumbnail&amp;w=90&amp;h=68&amp;ll=40.962900,16.926430&amp;thumb=0\" jstcache=\"117\" jsvalues=\"src:i.photoUrl\" style=\"width: 90px; height: 68px;\" border=\"0\"></div></a></div><div style=\"display: none;\" jstcache=\"112\" class=\"gimg bdr\" jsdisplay=\"i.photoType==3\"><img jstcache=\"116\" jsvalues=\"src:i.photoUrl;width:i.photoWidth;height:i.photoHeight\" alt=\"Foto\" border=\"0\"></div><div jstcache=\"111\" jsdisplay=\"i.photoType==2&amp;&amp;!(m.service_area&amp;&amp;m.service_area.type==1)&amp;&amp;(!m.cityblock_info||(m.cityblock_info&amp;&amp;m.cityblock_info.pano_present))\" class=\"imcaption\"><a style=\"\" jstcache=\"0\" id=\"svcaption\" jsaction=\"sv.showFromInfoWindow\" href=\"javascript:void(0)\">Street View</a></div></div></div></td></tr></tbody></table></div><div style=\"display: none;\" jstcache=\"32\" jsdisplay=\"i.enh\" class=\"ela\"><span jstcache=\"0\" class=\"elabg\"><span jstcache=\"0\" class=\"elaimg\"><a jstcache=\"66\" jsvalues=\"href:i.enh.url;\" href=\"\" target=\"_blank\"><img jstcache=\"69\" jsvalues=\"src:i.enh.icon.url;\">&nbsp;</a></span><span jstcache=\"0\" class=\"elatxt\"><a jstcache=\"67\" jsvalues=\".innerHTML:i.enh.msg;href:i.enh.url;\" class=\"f\" href=\"\" target=\"_blank\"></a></span><span jstcache=\"60\" jsdisplay=\"i.enh.spnsd\" class=\"elaspo\">&nbsp;&nbsp;&nbsp;<a jstcache=\"68\" class=\"adsmessage\" target=\"_blank\" jsvalues=\".innerHTML:i.enh.spnsd;\" href=\"http://google.com/support/places/bin/answer.py?answer=183288\"></a></span></span></div></div>"; 

	map.setCenter(new GLatLng(40.9629, 16.9264), 17); 
	map.setMapType(G_HYBRID_MAP); 
	map.addOverlay(marker); 
	map.addControl(new GLargeMapControl()); 
	map.addControl(new GScaleControl()); 
	map.addControl(new GMapTypeControl()); 

	marker.openInfoWindowHtml(html); 
		    	
}

function loadContatti(){
	clearAjaxEndFunction();
	deferredExecute('load_XML_Content.php', 'section=openForm', false, true, true, 'openForm', false);
}

function loadWhereWeAre(){
	clearAjaxEndFunction();
	deferredExecute('load_XML_Content.php', 'section=whereWeAre', false, true, true, 'whereWeAre', false);
}

function loadIntroCatalogo(){
	clearAjaxEndFunction();
	setAjaxEndFunction('reloadDiv()');
	deferredExecute('load_XML_Content.php', 'section=attrezzature', false, true, true, 'introCatalogo', false);
}

function focusSelection(section){
	
	if(section == window.thatSection){
		return 0;
	}
	
	switch(section){

		case "home":
			document.getElementById('bt_home').className = 'selectedButtons_2';        						        		
	    break;         
		case "chisiamo":
			document.getElementById('bt_chisiamo').className = 'selectedButtons_2';
	    break;
		case "attrezzature":
			document.getElementById('bt_attrezzature').className = 'selectedButtons_2';
		break;            
		case "dovesiamo":
			document.getElementById('bt_dovesiamo').className = 'selectedButtons_2';
		break;
		case "contatti":
			document.getElementById('bt_contatti').className = 'selectedButtons_2';
		break;
	}

}

function blurSelection(section){
	
	if(section == window.thatSection){
		return 0;
	}
	
	switch(section){

		case "home":
			document.getElementById('bt_home').className = 'space';        						        		
	    break;         
		case "chisiamo":
			document.getElementById('bt_chisiamo').className = 'space';
	    break;
		case "attrezzature":
			document.getElementById('bt_attrezzature').className = 'space';
		break;		
		case "dovesiamo":
			document.getElementById('bt_dovesiamo').className = 'space';
		break;
		case "contatti":
			document.getElementById('bt_contatti').className = 'space';
		break;
	}

}

function setMenu(section){

	document.getElementById('bt_home').className = 'space';
	document.getElementById('bt_chisiamo').className = 'space';
	document.getElementById('bt_attrezzature').className = 'space';
	document.getElementById('bt_dovesiamo').className = 'space';
	document.getElementById('bt_contatti').className = 'space';
	
	switch(section){

    	case "home":
    		document.getElementById('bt_home').className = 'selectedButtons';        						        		
        break;         
    	case "chisiamo":
    		document.getElementById('bt_chisiamo').className = 'selectedButtons';
        break;
    	case "attrezzature":
    		document.getElementById('bt_attrezzature').className = 'selectedButtons';
		break;            
    	case "dovesiamo":
    		document.getElementById('bt_dovesiamo').className = 'selectedButtons';
		break;
    	case "contatti":
    		document.getElementById('bt_contatti').className = 'selectedButtons';
    	break;
	}    
	
	reloadDiv();	
	
}

function resetForm(){
    loadSection('contatti');
}

function submitForm(){
    
	var error_txt = "";
	if(document.tstForm.nome.value=="")
		error_txt += "Il campo 'Nome' non puo' essere vuoto\n";
	
	if(document.tstForm.cognome.value=="")
		error_txt += "Il campo 'Cognome' non puo' essere vuoto\n";
	
	if(document.tstForm.citta.value=="")
		error_txt += "Il campo 'Citta' non puo' essere vuoto\n";
	
	if(document.tstForm.telefono.value=="")
		error_txt += "Il campo 'Telefono' non puo' essere vuoto\n";
	
	if(document.tstForm.email.value=="")
		error_txt += "Il campo 'Email' non puo' essere vuoto\n";
	
	var emailPattern = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.([a-z]){2,4})$/;
	if (!emailPattern.test(document.tstForm.email.value) && document.tstForm.email.value!="")
		error_txt += "La Mail inserita sembra non essere valida\n";
	
	if(document.tstForm.richiesta.value=="")
		error_txt += "Il campo 'Richiesta' non puo' essere vuoto\n";
		
	if(error_txt != ""){
		alert("Attenzione alcuni valori inseriti sembrano non essere corretti\n"+error_txt);
		return;
	}else{
		deferredExecute('sendMail.php', document.tstForm, true, true, true, 'openForm', false);
	}	
	
}

function reloadDiv(){

	document.getElementById('logoSplash').style.display="none";
	var width = document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientWidth:document.body.clientWidth;
	var posX = 0;
	
	if(width > 970){

		posX = ((width - 970)/2)-2;
		document.getElementById('logoSplash').style.left=posX+"px";	

			
	}else{

		posX = -2;
		document.getElementById('logoSplash').style.left=posX+"px";
		
	}
	
	document.getElementById('logoSplash').style.display="block";
	
}

//window.onload  = reloadDiv; 
//window.onresize  = reloadDiv;
//window.onblur = reloadDiv;
//window.onfocus  = reloadDiv;
window.thatSection = 'home';
