Event.observe(window, 'load', function() { //window.onload var olemas = true; try{ var tt = $('spacer').style.display; }catch(E){olemas=false;} if(olemas){ var pos=findPos($('spacer')); var page_size = getPageSize(); if(pos[1] < page_size[3]-107){ $('spacer').style.height = page_size[3]-107-pos[1]+"px"; } } }); function getPageSize(){ var xScroll, yScroll; if (window.innerHeight && window.scrollMaxY) { xScroll = document.body.scrollWidth; yScroll = window.innerHeight + window.scrollMaxY; } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac xScroll = document.body.scrollWidth; yScroll = document.body.scrollHeight; } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari xScroll = document.body.offsetWidth; yScroll = document.body.offsetHeight; } var windowWidth, windowHeight; if (self.innerHeight) { // all except Explorer windowWidth = self.innerWidth; windowHeight = self.innerHeight; } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode windowWidth = document.documentElement.clientWidth; windowHeight = document.documentElement.clientHeight; } else if (document.body) { // other Explorers windowWidth = document.body.clientWidth; windowHeight = document.body.clientHeight; } // for small pages with total height less then height of the viewport if(yScroll < windowHeight){ pageHeight = windowHeight; } else { pageHeight = yScroll; } // for small pages with total width less then width of the viewport if(xScroll < windowWidth){ pageWidth = windowWidth; } else { pageWidth = xScroll; } arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) return arrayPageSize; } //LEIAB OBJEKTI ASUKOHA JA DIMENSIOONID findPos = function (obj) { var curleft = curtop = 0; var curwidth = curheight = 0; try{ if (obj.offsetParent) { curleft = obj.offsetLeft curtop = obj.offsetTop curheight = obj.offsetHeight; curwidth = obj.offsetWidth; while (obj = obj.offsetParent) { curleft += obj.offsetLeft curtop += obj.offsetTop } } }catch(E){}; return [curleft,curtop,curwidth, curheight]; } function showFlash(divId, fileName, width, height, flashvars, bgcolor, wmode) { var text; text = ""; if ((null == bgcolor)||(bgcolor == "")) { parambgcolor = ""; embedbgcolor = ""; } else { parambgcolor = ""; embedbgcolor = " bgcolor=\"" + bgcolor + "\""; } if ((null == wmode)||(wmode == "")) { paramwmode = ""; embedwmode = ""; } else { paramwmode = ""; embedwmode = " wmode=\"" + wmode + "\""; } if ((null == flashvars)||(flashvars == "")) { paramflashvars = ""; embedflashvars = ""; } else { paramflashvars = ""; embedflashvars = " flashvars=\"" + flashvars + "\""; } text +=""; text +=""; text +=""; text += parambgcolor + paramwmode + paramflashvars; text += ""; if(document.getElementById(divId)) document.getElementById(divId).innerHTML = text; } function login(){ var params = 'user='+encodeURIComponent($('login_email').value)+'&pass='+encodeURIComponent($('login_pass').value)+'&rem='+encodeURIComponent($('login_rem').value); var myAjax = new Ajax.Request( '/ajax_funcs/login.php', { method: 'post', postBody: params, onComplete: function(response){ var vastus = response.responseText.split(" "); if(vastus[0]=="Error"){ alert(response.responseText); }else{ window.location.href='/admin/'; } } } ); } function start_video_upload(sid){ if(cur_video_id){//KUI ID ON OLEMAS, SIIS PANEB UPLOADI TÖÖLE $('upload_file').style.display='none'; $('upload_wait').style.display='block'; var pb = $("progress"); new ProgressTracker(sid,{ progressBar: pb, onFailure: function(msg) { Element.hide(pb.parentNode); alert(msg); } }); document.video_upload_form.submit(); }else{ telli_id("start_video_upload('"+sid+"')"); } } function stop_video_upload(vid, fname){ var upload_id = Math.round(Math.random()*1000000); $('upload_file').innerHTML = ''; $('upload_file').style.display='block'; $('upload_wait').style.display='none'; if(vid){ cur_video_id = vid; cur_video_url = '/upload/'+fname; $("video_id").value = cur_video_id; $("video_upload_form").action="http://www.ikodu.com/cgi-bin/upload.cgi?sid="+cur_sess_id+"&target=http://tv.ikodu.com/uploader/receive.php&vid="+cur_video_id; display_video(cur_video_url, cur_pilt_url, "true"); } } function display_video_2(video_url, pilt_url, autostart, width, height){ width = 500; height = 420; showFlash('video_div', '/flash/player.swf', width, height, "video="+video_url+"&preview="+pilt_url+"&start=0",'#000000'); //showFlash('video_div', '/FlowPlayerWhite.swf', width, height, "config={showPlayList: false, showPlayListButtons: false, autoPlay: "+autostart+", autoBuffering: true,loop: false,showLoopButton: false,'videoHeight: 240, initialScale: 'fit', showMenu: false, hideControls: false, playList: [ "+playlist+" ] }",'#000000'); } function display_video(video_url, pilt_url, autostart, width, height){ if(!width) width = 320; if(!height) height = 258; if(autostart=="true")pilt_url=""; if(video_url=="/upload/")video_url=""; if(pilt_url=="/upload/")pilt_url=""; if(!video_url.length && !pilt_url.length){//pole midagi playlist = "{ url: '/images/no_video.jpg' }"; $("video_div").innerHTML="\"Video"; return; } else if(!video_url.length && pilt_url.length){ //on pilt playlist = "{ url: '"+pilt_url+"' }"; $("video_div").innerHTML="\"Pilt\""; return; } else if(video_url.length && !pilt_url.length){ //on video playlist = "{ url: '"+video_url+"' }"; } else if(video_url.length && pilt_url.length){ //mõlemad on playlist = "{ url: '"+pilt_url+"' }, { url: '"+video_url+"' }"; } showFlash('video_div', '/FlowPlayerWhite.swf', width, height, "config={showPlayList: false, showPlayListButtons: false, autoPlay: "+autostart+", autoBuffering: true,loop: false,showLoopButton: false,'videoHeight: 240, initialScale: 'fit', showMenu: false, hideControls: false, playList: [ "+playlist+" ] }",'#000000'); } function telli_id(tagasi){ var juhuslik = Math.round(Math.random()*1000000); var myAjax = new Ajax.Request( '/ajax_funcs/telli_id.php', { method: 'get', parameters: 'juhuslik='+juhuslik, onComplete: function(response) { cur_video_id = parseInt(response.responseText); if(cur_video_id){ $("video_id").value = cur_video_id; $("video_upload_form").action="http://www.ikodu.com/cgi-bin/upload.cgi?sid="+cur_sess_id+"&target=http://tv.ikodu.com/uploader/receive.php&vid="+cur_video_id; eval(tagasi); } } } ) } function salvesta_video(publish, stay){ description = encodeURIComponent(tinyMCE.getContent("description")); video_title = encodeURIComponent($('video_title').value); tags = encodeURIComponent($('tags').value); lisaks=""; if(publish)lisaks = "&publish=1" postBody = "id="+cur_video_id+"&description="+description+"&video_title="+video_title+"&tags="+tags+lisaks; var myAjax = new Ajax.Request( '/ajax_funcs/salvesta_video.php', { method: 'post', postBody: postBody, onComplete: function(response){ if(response.responseText!="ok"){ alert("Ilmnes viga!\n"+response.responseText); }else alert("Salvestatud!"); if(!stay) window.location.href='/?action=video_list'; } }); } function start_pilt_upload(){ if(cur_video_id){//KUI ID ON OLEMAS, SIIS PANEB UPLOADI TÖÖLE $('upload_pilt').style.display='none'; $('upload_pilt_wait').style.display='block'; $('pilt_id').value=cur_video_id; document.pilt_upload_form.submit(); }else{ telli_id("start_pilt_upload()"); } } function stop_pilt_upload(vid, fname){ var upload_id = Math.round(Math.random()*1000000); $('upload_pilt').innerHTML = ''; $('upload_pilt').style.display='block'; $('upload_pilt_wait').style.display='none'; if(vid){ cur_pilt_url = '/upload/'+fname; display_video(cur_video_url, cur_pilt_url, "false"); } } function video_reset(){ display_video(cur_video_url, cur_pilt_url, "false"); } function search_videolist(){ window.location.href="/index.php?action=video_list&q="+encodeURIComponent($('q').value)+"&tags="+$('tags').options[$('tags').selectedIndex].value; } function publish_video(video){ var juhuslik = Math.round(Math.random()*1000000); var myAjax = new Ajax.Request( '/ajax_funcs/publish_video.php', { method: 'get', parameters: 'juhuslik='+juhuslik+'&video='+video, onComplete: function(response) { $("video_span_"+video).innerHTML="Jah"; } } ) } function kustuta_video(video){ if(!confirm('Kas tõesti tahad kustutada? Andmeid ei saa hiljem taastada!'))return; var juhuslik = Math.round(Math.random()*1000000); var myAjax = new Ajax.Request( '/ajax_funcs/kustuta_video.php', { method: 'get', parameters: 'juhuslik='+juhuslik+'&video='+video, onComplete: function(response) { new Effect.Fade("video_tr_"+video); } } ) } Event.observe(window, 'load', function() { try{ $("kontaktikoht").innerHTML = "ikodu"; $("kontaktikoht").innerHTML = ""+"tv"+"@"+$("kontaktikoht").innerHTML+".com"+""; }catch(E){}; }); function viimased_hover(tyyp,idnum){ if(tyyp){ $('viimased_shadow_'+idnum).className="viimased_shadow"; $('viimased_td1_'+idnum).className="viimased_td1_hover"; $('viimased_td2_'+idnum).className="viimased_td2_hover"; } else{ $('viimased_shadow_'+idnum).className="viimased_noshadow"; $('viimased_td1_'+idnum).className="viimased_td1"; $('viimased_td2_'+idnum).className="viimased_td2"; } } function video_page(leht,vid,tag,q){ var juhuslik = Math.round(Math.random()*1000000); var tt=$('viimased_esilehel'); if(tt != document) tt.setStyle ({ background: "transparent url('/images/ketas333.gif') no-repeat right bottom" }); var myAjax = new Ajax.Request( '/ajax_viimased.php', { method: 'get', parameters: 'juhuslik='+juhuslik+'&leht='+encodeURIComponent(leht)+'&vid='+encodeURIComponent(vid)+'&tag='+encodeURIComponent(tag)+'&q='+encodeURIComponent(q), onComplete: function(response) { var tt=$('viimased_esilehel'); if(tt != document) { tt.hide (); tt.update (response.responseText); Effect.Appear('viimased_esilehel_list', {queue: 'end', duration: 0.8, afterFinish: function(){ var tt = $('viimased_esilehel'); if(tt != document) tt.setStyle ({ background: "transparent" }); } }); tt.show (); } } } ) } function salvesta_kkk(){ content = encodeURIComponent($('content').value); title = encodeURIComponent($('title').value); jrk = encodeURIComponent($('jrk').value); id = encodeURIComponent($('id').value); postBody = "id="+id+"&content="+content+"&title="+title+"&jrk="+jrk; var myAjax = new Ajax.Request( '/ajax_funcs/save_kkk.php', { method: 'post', postBody: postBody, onComplete: function(response){ if(response.responseText=="0"){ alert("Ilmnes viga!\n"+response.responseText); }else alert("Salvestatud!"); window.location.href='/?action=edit_kkk'; } }); } function delKKK(id){ postBody = "id="+id; var myAjax = new Ajax.Request( '/ajax_funcs/del_KKK.php', { method: 'post', postBody: postBody, onComplete: function(response){ if(response.responseText=="0"){ alert("Ilmnes viga!\n"+response.responseText); }else alert("Kustutatud!"); window.location.reload(true); } }); }