// JavaScript Document
function muovi() {
    if (((pos==fine)&&(delta==-1))||((pos==inizio)&&(delta==1))) delta=0;
   pos=pos+delta;
    document.getElementById('scroll').style.top=pos;
    if (delta!=0) setTimeout('muovi()',50);
  }

function tagbox( qord ) {
if (window.XMLHttpRequest) {
   xmlhttp = new XMLHttpRequest();
   //alert ('fa tutto tag');
} else if (window.ActiveXObject) { // IE
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
   //alert ('fa ms tag');
} else {
   alert('Impossibile continuare: il tuo browser non supporta XMLHttpRequest');
}

xmlhttp.open('POST',"../tags/pabloajax.php",false);
xmlhttp.setRequestHeader('Cache-Control','no-cache');
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
xmlhttp.send("call=tagbox&ord=" + qord);
document.getElementById( "tagbox").innerHTML = xmlhttp.responseText; //apri  
xmlhttp=false;

}

function tagboxhome( qord ) {
if (window.XMLHttpRequest) {
   xmlhttp = new XMLHttpRequest();
   //alert ('fa tutto tag');
} else if (window.ActiveXObject) { // IE
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
   //alert ('fa ms tag');
} else {
   alert('Impossibile continuare: il tuo browser non supporta XMLHttpRequest');
}

xmlhttp.open('POST',"tags/pabloajax.php",false);
xmlhttp.setRequestHeader('Cache-Control','no-cache');
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
xmlhttp.send("call=tagbox&ord=" + qord);
document.getElementById( "tagbox").innerHTML = xmlhttp.responseText; //apri  
xmlhttp=false;

}

function channelbox( qord ) {
if (window.XMLHttpRequest) {
   xmlhttp = new XMLHttpRequest();
   //alert ('fa tutto ch');
} else if (window.ActiveXObject) { // IE
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
   //alert ('fa ms ch');
} else {
   alert('Impossibile continuare: il tuo browser non supporta XMLHttpRequest ch');
}

xmlhttp.open('POST',"../tags/pabloajax.php",false);
xmlhttp.setRequestHeader('Cache-Control','no-cache');
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
xmlhttp.send("call=channelbox&ord=" + qord);
//alert ( xmlhttp.responseText );
document.getElementById( "channelbox").innerHTML = xmlhttp.responseText; //apri  
xmlhttp=false;

}
function channelboxhome( qord ) {
//alert('cha');
if (window.XMLHttpRequest) {
   xmlhttp = new XMLHttpRequest();
   //alert ('fa tutto ch');
} else if (window.ActiveXObject) { // IE
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
   //alert ('fa ms ch');
} else {
   alert('Impossibile continuare: il tuo browser non supporta XMLHttpRequest ch');
}

xmlhttp.open('POST',"tags/pabloajax.php",false);
xmlhttp.setRequestHeader('Cache-Control','no-cache');
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
xmlhttp.send("call=channelbox&ord=" + qord);
//alert ( xmlhttp.responseText );
document.getElementById( "channelbox").innerHTML = xmlhttp.responseText; //apri  
xmlhttp=false;

}

function banbox_home( typ ) {
if (window.XMLHttpRequest) {
   xmlhttp = new XMLHttpRequest();
   //alert ('fa tutto ch');
} else if (window.ActiveXObject) { // IE
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
   //alert ('fa ms ch');
} else {
   alert('Impossibile continuare: il tuo browser non supporta XMLHttpRequest');
}

xmlhttp.open('POST',"pabloajax.php",false);
xmlhttp.setRequestHeader('Cache-Control','no-cache');
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
xmlhttp.send("call=banbox&tipo=" + typ);
//alert ( xmlhttp.responseText );
document.getElementById( "banbox_"+ typ).innerHTML = xmlhttp.responseText; //apri  
//alert('cha');
xmlhttp=false;

}
function banbox( typ ) {
//alert ('banbox '+ typ );
if (window.XMLHttpRequest) {
   xmlhttp = new XMLHttpRequest();
   //alert ('fa tutto ch');
} else if (window.ActiveXObject) { // IE
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
   //alert ('fa ms ch');
} else {
   alert('Impossibile continuare: il tuo browser non supporta XMLHttpRequest');
}

xmlhttp.open('POST',"../pabloajax.php",false);
xmlhttp.setRequestHeader('Cache-Control','no-cache');
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
xmlhttp.send("call=banbox&tipo=" + typ);
//alert ( "call=banbox&tipo=" + typ + '<br>risp is '+ xmlhttp.responseText );
document.getElementById( "banbox_"+ typ).innerHTML = xmlhttp.responseText; //apri  
//alert('cha');
xmlhttp=false;

}

function linkbox_home( ) {
if (window.XMLHttpRequest) {
   xmlhttp = new XMLHttpRequest();
   //alert ('fa tutto ch');
} else if (window.ActiveXObject) { // IE
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
   //alert ('fa ms ch');
} else {
   alert('Impossibile continuare: il tuo browser non supporta XMLHttpRequest ch');
}

xmlhttp.open('POST',"pabloajax.php",false);
xmlhttp.setRequestHeader('Cache-Control','no-cache');
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
xmlhttp.send("call=linkbox");
//alert ( xmlhttp.responseText );
document.getElementById( "linkbox").innerHTML = xmlhttp.responseText; //apri  
//alert('cha');
xmlhttp=false;

}

function linkbox( ) {
if (window.XMLHttpRequest) {
   xmlhttp = new XMLHttpRequest();
   //alert ('fa tutto ch');
} else if (window.ActiveXObject) { // IE
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
   //alert ('fa ms ch');
} else {
   alert('Impossibile continuare: il tuo browser non supporta XMLHttpRequest ch');
}

xmlhttp.open('POST',"../pabloajax.php",false);
xmlhttp.setRequestHeader('Cache-Control','no-cache');
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
xmlhttp.send("call=linkbox");
//alert ( xmlhttp.responseText );
document.getElementById( "linkbox").innerHTML = xmlhttp.responseText; //apri  
//alert('cha');
xmlhttp=false;

}

function play( fitop ){

finestra = window.open( "" , "finestraplay","width=600, height=400, resizable =no, scrollbars=yes, toolbar=0, status=1");
             //  
//if (!finestra.closed && finestra.location)
if  (!finestra.document.getElementById('content' ))
{
//alert ('play1 '+ fitop +'ono');
//finestra.document.getElementById('content' ).innerHTML = ''; 

//alert ('playelse '+ fitop +'ono');
finestra.document.write('<html><head><title>ZooMP</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"><link rel=\"stylesheet\" type=\"text/css\" href=\"../menu.css\"></head>');
finestra.document.write('<body bgcolor=\"#ffffff\">');
finestra.document.write('<table border=\"0\" cellpadding=\"2\" cellspacing=\"1\" width=\"100%\"><tr bgcolor=\"#66ccff\">');
/*finestra.document.write('');
finestra.document.write('</td>');
finestra.document.write('<td bgcolor=\"#ccff66\" valign=\"absmiddle\" width=\"60%\"><font size=\"4\" color=\"#0033cc\" face=\"Comic Sans MS\"><div id=\"itemfrom\">loading...</div></font></td></tr>');
finestra.document.write('<tr bgcolor=\"#ccff66\" valign=\"absmiddle\"><td align=\"center\">AAA</td></tr>');
finestra.document.write('<tr bgcolor=\"#ccff66\" height=\"300\" valign=\"top\"><td align=\"center\" colspan=\"2\">');
finestra.document.write('<div id=\"content\">loading...</div>');
finestra.document.write('<br><br>');
finestra.document.write('<font size=\"3\" color=\"#0033cc\" face=\"Comic Sans MS\"><a href=\"javascript:window.close()\">chiudi</a></font>');
finestra.document.write('</td></tr></table></body></html>');
//finestra.document.getElementById('content' ).innerHTML = ''; */
finestra.document.write('<td width=\"35%\" rowspan=\"2\" bgcolor=\"#66CCFF\"><div align=\"center\"><img src=\"../images/clipsprima/pablozoo_logo.gif\" align=\"absmiddle\" height=\"60\" width=\"150\"></div></td>');    
finestra.document.write('<td bgcolor=\"#CCFF66\">');    
finestra.document.write('<div width=\"15%\" class=\"descrizione\" align=\"right\">fonte:</div></td>');
finestra.document.write('<td colspan=\"2\" width=\"50%\" bgcolor=\"#CCFF66\">');    
finestra.document.write('<div id=\"itemfrom\" align=\"center\">loading...</div></td>');
finestra.document.write('</tr>');  
finestra.document.write('<tr>');   
finestra.document.write('<td bgcolor=\"#CCFF66\">');    
finestra.document.write('<div align=\"right\" class=\"descrizione\">on air:</div></td>');
finestra.document.write('<td colspan=\"2\" bgcolor=\"#CCFF66\">');    
finestra.document.write('<div id=\"itemtitle\" align=\"center\">loading...</div></td>');
finestra.document.write('</tr>');  
finestra.document.write('<tr>');   
finestra.document.write('<td colspan=\"3\" rowspan=\"2\" width=\"60%\" height=\"280\"><div id=\"content\" align=\"center\">loading...</div></td>');    
finestra.document.write('<td width=\"40%\" height=\"150\" align=\"center\">');     
finestra.document.write('<div id=\"itemdescr\" >loading...</div>');        
finestra.document.write('</td>');      
finestra.document.write('</tr>');  
finestra.document.write('<tr >');   
finestra.document.write('<td height=\"30\">'); 
finestra.document.write('<table border=\"1\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"><tr bgcolor=\"#ccff66\"><td align=\"center\">');
finestra.document.write('<div align=\"center\">salva</div></td>');
finestra.document.write('<td bgcolor=\"#CCFF66\">');    
finestra.document.write('<div align=\"center\">commenta</div></td>');
finestra.document.write('<td bgcolor=\"#CCFF66\">');    
finestra.document.write('<div align=\"center\">down</div></td>');
finestra.document.write('</tr>'); 
finestra.document.write('</table>');
finestra.document.write('</td>');  
finestra.document.write('</tr>');  
finestra.document.write('<tr bgcolor=\"#66CCFF\">');   
finestra.document.write('<td colspan=\"4\"><div align=\"center\"><a href=\"javascript:window.close()\">chiudi</a></div></td>');    
finestra.document.write('</tr>');  
finestra.document.write('</table>');


//finestra.document.getElementById('content' ).innerHTML = xmlhttp.responseText; 

}
if (window.XMLHttpRequest) {
   xmlhttp = new XMLHttpRequest();
   //alert ('fa tutto cat');
} else if (window.ActiveXObject) { // IE
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
   //alert ('fa ms cat');
} else {
   alert('Impossibile continuare: il tuo browser non supporta XMLHttpRequest.');
}
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}

xmlhttp.open('POST',"pabloajax.php",false);
xmlhttp.setRequestHeader('Cache-Control','no-cache');
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
xmlhttp.send("call=playitem&file="+ fitop);

  try { var xmlResponse = xmlhttp.responseXML.documentElement; } catch(e) { }

if(xmlhttp.readyState == 4) {
 //var cazz = xmlResponse.getElementsByTagName('filename')[0].firstChild.data;
 var cazz = xmlhttp.responseText;
  //alert ('playelse 4 '+ cazz +' ono');

  
   //try {

		  // if(xmlResponse) 
			 // var numMsgs = xmlResponse.getElementsByTagName('numMessages')[0].firstChild.data;
			  //for(i=0; i<numMsgs; i++) {
				 var player = xmlResponse.getElementsByTagName('player')[0].firstChild.data;
				 var classid = xmlResponse.getElementsByTagName('classid')[0].firstChild.data;
				 var codebase = xmlResponse.getElementsByTagName('codebase')[0].firstChild.data;
				 var plug = xmlResponse.getElementsByTagName('plugin')[0].firstChild.data;
				 var filename = xmlResponse.getElementsByTagName('filename')[0].firstChild.data;
				 var type = xmlResponse.getElementsByTagName('mime')[0].firstChild.data;
				 var itemtitle = xmlResponse.getElementsByTagName('itemtitle')[0].firstChild.data;
				 var itemdescr = xmlResponse.getElementsByTagName('itemdescr')[0].firstChild.data;
				 var chanfrom = xmlResponse.getElementsByTagName('chanfrom')[0].firstChild.data;
				 var chanlink = xmlResponse.getElementsByTagName('chanlink')[0].firstChild.data;
				 var itemurl = xmlResponse.getElementsByTagName('itemurl')[0].firstChild.data;
				 var pubdate = xmlResponse.getElementsByTagName('pubdate')[0].firstChild.data;
  
		
	//}
	//catch(e) {
	//}
}

if( player = 'QUI') { 
toplay = '<OBJECT id = \"Player\" classid= \"'+ classid +'\" height=\"240\" width=\"320\" codebase =\"'+ codebase +'\"  >';
//toplay = toplay + '<PARAM Name = \"\" Value >';
//toplay = toplay + '<PARAM Name = \"\" Value >';
toplay = toplay + '<PARAM Name = \"pluginspage\" Value = \"'+ plug +'\">';
toplay = toplay + '<PARAM Name = \"src\" Value = \"'+ filename +'\">';
toplay = toplay + '<PARAM Name = \"type\" Value = \"video/quicktime\">';
toplay = toplay + '<PARAM Name = \"autoStart\" Value = \"true\">';
toplay = toplay + '<PARAM Name = \"uiMode\" Value = \"full\">';
toplay = toplay + '<embed  pluginspage=\"'+ plug +'\" src=\"'+ filename +'\" type=\"video/quicktime\" height=\"360\" width=\"480\"  autostart=\"True\" showcontrols=\"True\" showstatusbar=\"False\" showdisplay=\"False\" autorewind=\"True\">';
toplay = toplay + '</embed>';
toplay = toplay + '</OBJECT>';

}else { 

toplay = '<OBJECT id = \"Player\" classid= \"'+ classid +'\" type=\"application/x-oleobject\" height=\"240\" width=\"320\" codebase =\"'+ codebase +'\" standby=\"Loading Windows Media Player components...\" >';
//toplay = toplay + '<PARAM Name = \"\" Value >';
//toplay = toplay + '<PARAM Name = \"\" Value >';
toplay = toplay + '<PARAM Name = \"pluginspage\" Value = \"'+ plug +'\">';
toplay = toplay + '<PARAM Name = \"url\" Value = \"'+ filename +'\">';
toplay = toplay + '<PARAM Name = \"autoStart\" Value = \"true\">';
toplay = toplay + '<PARAM Name = \"uiMode\" Value = \"full\">';
toplay = toplay + '<embed  pluginspage=\"'+ plug +'\" src=\"'+ filename +'\" type=\"application/x-mplayer2\" height=\"360\" width=\"480\"  autostart=\"True\" showcontrols=\"True\" showstatusbar=\"False\" showdisplay=\"False\" autorewind=\"True\">';
toplay = toplay + '</embed>';
toplay = toplay + '</OBJECT>';
   }

//alert ('playelse '+ toplay +' ono');
finestra.document.getElementById('content' ).innerHTML = toplay; 
finestra.document.getElementById('itemtitle' ).innerHTML = '<a href=\"'+ itemurl +'" class=\"sottotitolo\" target=\"_blank\">'+ itemtitle +'</a>'; 
finestra.document.getElementById('itemdescr' ).innerHTML = itemdescr; 
finestra.document.getElementById('itemfrom' ).innerHTML = '<a href=\"'+ chanlink +'" target=\"_blank\" class=\"sottotitolo\">'+ chanfrom +'</a>'; 
//if (!finestrainfo) 
//	finestra.document.write("Hai scelto di eseguire <strong>" + fitop + "</strong> in ZMP.");
	//finestra.document.write("<a href=\"#\" onClick=\"javascript:window.close();\">Chiudi questa finestra</a>");
/*	finestra.document.write("<br><br>");
	finestra.document.write("</body></html>");
				//document.getElementById('crearisp').innerHTML = '&nbsp;'
  */
//if (window.focus) {
finestra.focus()
//}
return false;

}


function soundOff() {
var scadenza = new Date();
nome = "sound";
valore= "1";
scadenza.setFullYear(scadenza.getFullYear() +1); 
	  //function impostaUnCookieGenerico(nome, valore, scadenza) {
	strCookie = nome + "=" + escape(valore);
	//if (scadenza)
	
	   strCookie += "; expires=" + scadenza.toGMTString();
	   strCookie += "; path=/";
	  // strCookie += "; domain=pablozoo.com;";
	document.cookie = strCookie;
	document.getElementById('soundRule' ).innerHTML = '<a class=\"sottotitolo\" href=\"#\" onclick=\"soundOn();\"><img id=\"sound_img\" border=\"0\" src=\"../images/clips/sound-off.gif\" align=\"absmiddle\"></a>';
}


function soundOffHome() {
var scadenza = new Date();
nome = "sound";
valore= "1";
scadenza.setFullYear(scadenza.getFullYear() +1); 
	  //function impostaUnCookieGenerico(nome, valore, scadenza) {
	strCookie = nome + "=" + escape(valore);
	//if (scadenza)
	
	   strCookie += "; expires=" + scadenza.toGMTString();
	   strCookie += "; path=/";
	  // strCookie += "; domain=pablozoo.com;";
	document.cookie = strCookie;
	document.getElementById('soundRule' ).innerHTML = '<a class=\"sottotitolo\" href=\"#\" onclick=\"soundOnHome();\"><img id=\"sound_img\" border=\"0\" src=\"images/clips/sound-off.gif\" align=\"absmiddle\"></a>';
}


function soundOn() {
var scadenza = new Date();
nome = "sound";
valore= "0";
scadenza.setFullYear(scadenza.getFullYear() +1); 
	  //function impostaUnCookieGenerico(nome, valore, scadenza) {
	strCookie = nome + "=" + escape(valore);
	//if (scadenza)
	
	   strCookie += "; expires=" + scadenza.toGMTString();
	   strCookie += "; path=/";
	  // strCookie += "; domain=pablozoo.com;";
	document.cookie = strCookie;
	document.getElementById('soundRule' ).innerHTML = '<a class=\"sottotitolo\" href=\"#\" onclick=\"soundOff();\"><img id=\"sound_img\"  border=\"0\" src=\"../images/clips/sound-on.gif\" align=\"absmiddle\"></a>';
}

function soundOnHome() {
var scadenza = new Date();
nome = "sound";
valore= "0";
scadenza.setFullYear(scadenza.getFullYear() +1); 
	  //function impostaUnCookieGenerico(nome, valore, scadenza) {
	strCookie = nome + "=" + escape(valore);
	//if (scadenza)
	
	   strCookie += "; expires=" + scadenza.toGMTString();
	   strCookie += "; path=/";
	  // strCookie += "; domain=pablozoo.com;";
	document.cookie = strCookie;
	document.getElementById('soundRule' ).innerHTML = '<a class=\"sottotitolo\" href=\"#\" onclick=\"soundOffHome();\"><img id=\"sound_img\"  border=\"0\" src=\"images/clips/sound-on.gif\" align=\"absmiddle\"></a>';
}

