var net;if(!net)net={};else if(typeof net!="object")throw new Error("net already exists and is not an object");if(!net.ckfiumi)net.ckfiumi={};else if(typeof net.ckfiumi!="object")throw new Error("net.ckfiumi already exists and is not an object");if(net.ckfiumi.Video)throw new Error("net.ckfiumi.Video already exists");net.ckfiumi.Video=Class.create();net.ckfiumi.Video.prototype={initialize:function(){this.name="Video";this.prefix=this.name;this.path='/kayak/video.phtml';this.filename=null;this.title=null;this.versione=0;this.selected=null;this.video_size=320},setSelected:function(s){this.selected=s},setVideoSize:function(s){this.video_size=s},getVideoSize:function(){return(this.video_size)},setFilename:function(n){try{this.filename=this.video_size+'_'+n}catch(e){alert("nessun filename passato!!??")}},getFilename:function(n){return(this.filename.substring(4))},setTitle:function(n){try{this.title=n}catch(e){alert("nessun title passato!!??")}},run:function(e){if(arguments.length==1){this.setFilename(e.id);this.setTitle(e.name)}switch(this.video_size){case 480:w=480;h=360;break;default:w=320;h=240}var s1=new SWFObject("/rep/mediaplayer.swf","ply","520","318","9","#FFFFFF");s1.addParam("allowfullscreen","true");s1.addParam("allowscriptaccess","always");s1.addParam("flashvars","file=/load.php/"+this.filename+".flv&autostart=false&image=/rep/video/img/"+this.filename+".jpg");s1.write("filmato");setPanelTitle();return false},getVideo:function(selectedLink){this_object=this;var url='/xml/get_video_props.php';var pars='&gruppo='+selectedLink;var myAjax=new Ajax.Request(url,{method:'get',parameters:pars,onComplete:this.manageVideo.bind(this,this_object),onLoading:this.loading.bind(this),onLoaded:this.loaded.bind(this),onInteractive:this.interactive.bind(this),onSuccess:this.success.bind(this),onFailure:this.failure.bind(this),asynchronous:1})},loading:function(){Element.show(this.prefix+'_loading')},loaded:function(){clearText($(this.prefix+'_avvisi'));$(this.prefix+'_avvisi').appendChild(document.createTextNode(" Loaded Video"))},interactive:function(){clearText($(this.prefix+'_avvisi'));$(this.prefix+'_avvisi').appendChild(document.createTextNode(" Interattivo Video"))},success:function(){Element.hide(this.prefix+'_loading');clearText($(prefix+'_avvisi'));$(this.prefix+'_avvisi').appendChild(document.createTextNode(" Success Video"))},failure:function(prefix,originalRequest){Element.hide(prefix+'_loading');clearText($(prefix+'_avvisi'));$(this.prefix+'_avvisi').appendChild(document.createTextNode(" Failure "+originalRequest.status))},manageVideo:function(obj,originalRequest){if(originalRequest.readyState==4){if(originalRequest.status==200){clearText($(obj.prefix+'_lista'));clearText($(obj.prefix+'_avvisi'));var jsonData=eval('('+originalRequest.responseText+')');rows=jsonData.main;if(rows!=null){for(i=0;i<1;i++){clearText($('autore'));$('autore').appendChild(document.createTextNode(rows[i]['VideoProps_autore'].value));clearText($('titolo'));$('titolo').appendChild(document.createTextNode(rows[i]['VideoProps_titolo'].value));clearText($('url'));$('url').appendChild(document.createTextNode(rows[i]['VideoProps_url'].value));clearText($('minuti'));$('minuti').appendChild(document.createTextNode(rows[i]['VideoProps_minuti'].value));clearText($('caricato'));$('caricato').appendChild(document.createTextNode(rows[i]['VideoProps_tstamp'].value));rows[i]['VideoProps_warning'].value=='Y'?Element.show($('warning')):Element.hide($('warning'));var new_url='http://'+location.hostname+this.path+'/size/'+video.getVideoSize()+'/'+rows[i]['VideoProps_gruppo'].value+'/'+rows[i]['VideoProps_filename'].value;$('text_url').value=new_url;$('href_mailto').href=new_url;var h=document.createElement('a');h.id=rows[i]['VideoProps_filename'].value;h.rel=this.path+'/size/'+video.getVideoSize()+'/'+rows[i]['VideoProps_gruppo'].value+'/'+rows[i]['VideoProps_filename'].value;h.href=this.path+'/size/'+video.getVideoSize()+'/'+rows[i]['VideoProps_gruppo'].value+'/'+rows[i]['VideoProps_filename'].value;h.name=rows[i]['VideoProps_titolo'].value;this.run(h);this.setFilename(h.id);this.setTitle(h.name);clearText($('Commento_form'));$('Commento_form').innerHTML='<a name="Commento" href="#Commento" onclick="commento.send(video.getFilename())"><img src="/img/nuovo_commento.gif" border="0" /></a>';var h=document.createElement('a');h.id=rows[i]['VideoProps_filename'].value;h.rel=this.path+'/size/'+video.getVideoSize()+'/'+rows[i]['VideoProps_gruppo'].value+'/'+rows[i]['VideoProps_filename'].value;h.href=this.path+'/size/'+video.getVideoSize()+'/'+rows[i]['VideoProps_gruppo'].value+'/'+rows[i]['VideoProps_filename'].value;h.name=rows[i]['VideoProps_titolo'].value;clearText($('comments'));this.run(h);clearText($('comments'));for(k=0;k<=rows['comments'].length;k++){var mdiv=document.createElement('div');mdiv.className="VideoCommento";var data=document.createElement('span');data.className="data";data.appendChild(document.createTextNode(rows['comments'][k]['VideoComments_tstamp'].value));var testo=document.createElement('p');testo.appendChild(document.createTextNode(rows['comments'][k]['VideoComments_testo'].value));var nome=document.createElement('span');nome.className="author";nome.appendChild(document.createTextNode(rows['comments'][k]['VideoComments_nome'].value));mdiv.appendChild(data);mdiv.appendChild(testo);mdiv.appendChild(nome);$('comments').appendChild(mdiv);$('comments').appendChild(document.createElement('br'))}}}else{$(obj.prefix+"_lista").appendChild(document.createTextNode("Oh! no video found!"))}clearText($(this.prefix+'_avvisi'))}else{alert("status Video: "+originalRequest.status+originalRequest.getResponseHeader())}}},test:function(){alert("ciao")}};function bind(ele){return function(){video.run(ele)}};net.ckfiumi.VideoMenu=Class.create();net.ckfiumi.VideoMenu.prototype={initialize:function(){this.name="VideoMenu";this.path='/kayak/video.phtml';this.prefix=this.name;this.versione=0},getVideoList:function(selectedLink){this_object=this;var url='/xml/get_videomenu_json.php';var pars='&gruppo='+selectedLink;var myAjax=new Ajax.Request(url,{method:'get',parameters:pars,onComplete:this.manageVideo.bind(this,this_object),onLoading:this.loading.bind(this),onLoaded:this.loaded.bind(this),onInteractive:this.interactive.bind(this),onSuccess:this.success.bind(this),onFailure:this.failure.bind(this),asynchronous:1})},loading:function(){clearText($(this.prefix+'_avvisi_A'));Element.show(this.prefix+'_loading');$('sel_video').disabled=true},loaded:function(){clearText($(this.prefix+'_avvisi_A'));$(this.prefix+'_avvisi_A').appendChild(document.createTextNode(" Loaded "));$('sel_video').disabled=false},interactive:function(){clearText($(this.prefix+'_avvisi_A'));$(this.prefix+'_avvisi_A').appendChild(document.createTextNode(" Interattivo "));$('sel_video').disabled=false},success:function(){Element.hide(this.prefix+'_loading');clearText($(this.prefix+'_avvisi_A'));$('sel_video').disabled=false},failure:function(prefix,originalRequest){Element.hide(this.prefix+'_loading');clearText($(this.prefix+'_avvisi_A'));$(this.prefix+'_avvisi_A').appendChild(document.createTextNode(" Failure "+originalRequest.status))},manageVideo:function(obj,originalRequest){if(originalRequest.readyState==4){if(originalRequest.status==200){clearText($(obj.prefix+'_lista'));clearText($(obj.prefix+'_avvisi'));var jsonData=eval('('+originalRequest.responseText+')');rows=jsonData.main;if(rows!=null){for(i=0;i<rows.length;i++){var mdiv=document.createElement('div');mdiv.className=obj.prefix+'_List';var spantitle=document.createElement('span');spantitle.appendChild(document.createTextNode(rows[i]['VideoMenu_titolo'].value));mdiv.appendChild(spantitle);mdiv.appendChild(document.createElement('br'));var h=document.createElement('a');h.id=rows[i]['VideoMenu_filename'].value;h.rel=this.path+'/'+rows[i]['VideoMenu_gruppo'].value+'/'+rows[i]['VideoMenu_filename'].value;h.href=this.path+'/'+rows[i]['VideoMenu_gruppo'].value+'/'+rows[i]['VideoMenu_filename'].value;h.name=rows[i]['VideoMenu_titolo'].value;var img=document.createElement('img');img.src='/rep/video/img/ico/'+rows[i]['VideoMenu_filename'].value+'.jpg';img.width='100';img.height='74';h.appendChild(img);mdiv.appendChild(h);mdiv.appendChild(document.createElement('br'));mdiv.appendChild(document.createTextNode("by "+rows[i]['VideoMenu_autore'].value));mdiv.appendChild(document.createElement('br'));mdiv.appendChild(document.createTextNode("durata: "+rows[i]['VideoMenu_minuti'].value));$(obj.prefix+"_lista").appendChild(mdiv)}}else{$(obj.prefix+"_lista").appendChild(document.createTextNode("Oh! no video found!"))}clearText($(this.prefix+'_avvisi'))}else{alert("status: "+originalRequest.status)}}}};
