var collapsed; var current = 0; window.onload = function(){ collapsed = true; slideComment = new fx.Height('c_container', {duration:500, onComplete: function()
{ if(collapsed){ collapsed = false;}else if(slideComment.now == 0){ collapsed = true;}
}}); scrollComment = new fx.Scroll({duration: 800}); slideComment.hide(); changenav('datablast','datablastlink'); changenav('biography','biographylink'); changenav('aboutme','aboutmelink'); changenav('datablast','datablastblink'); changenav('biography','biographyblink'); changenav('top','topblink'); changecomment();}
function noiseboxload(song_nr,track_id){ if(window.noisebox) window.document["noisebox"].SetVariable("java_song_nr", song_nr); if(document.noisebox) document.noisebox.SetVariable("java_song_nr", song_nr); x_log_stream(track_id,log_stream_cb);}
function log_stream_cb(result){ }
function showcomments(update_id){ var cc=document.getElementById('c_container'); var c=document.getElementById('comments'); var f=document.forms['add_c']; var s=document.getElementById('databiosep'); var l=document.getElementById('loading'); if(!collapsed && current == update_id){ s.style.display = "block"; slideComment.toggle();}else{ f['update_id'].value = update_id; c.innerHTML = ''; l.style.display = 'block'; x_get_comments(update_id, get_comments_cb);}
return false;}
function get_comments_cb(result){ var cc=document.getElementById('c_container'); var c=document.getElementById('comments'); var b=document.getElementById('bio'); var s=document.getElementById('databiosep'); var l=document.getElementById('loading'); eval("var customarray = "+result); if(customarray.status == 1){ l.style.display = 'none'; c.innerHTML= customarray.returnhtml;}
if(collapsed){ s.style.display = "none"; slideComment.toggle();}else if(current != customarray.update_id){ s.style.display = "none"; slideComment.resize();}else{ s.style.display = "block"; slideComment.toggle();}
scrollComment.scrollTo('comanchor'); current = customarray.update_id;}
function addcomment(){ var f=document.forms['add_c']; var post1 = new Object; for (i=0;i<f.length;i++){ post1[f[i].id] = f[i].value;}
var strPOST = JSON.stringify(post1); x_add_comment(strPOST, add_comment_cb);}
function add_comment_cb(result){ var f=document.forms['add_c']; var c=document.getElementById('comments'); var e=document.getElementById('error'); var n=document.getElementById('name'); eval("var customarray = "+result); if(customarray.status == 1){ e.innerHTML = ""; n.style.background = '#EBFFDD'; n.style.border = '1px solid #9DBC2B'; c.style.height = "auto"; if(customarray.commentcount == 0){ c.innerHTML= customarray.returnhtml;}else{ c.innerHTML= c.innerHTML+customarray.returnhtml;}
for (i=0;i<f.length;i++){ f[i].value = "";}
f['update_id'].value = customarray.update_id; slideComment.resize();}else if(customarray.status == 0){ e.innerHTML = "We need a name"; n.style.background = '#FFC4C4'; n.style.border = '1px solid #CC0000'; slideComment.resize();}else{ e.innerHTML = "Please stop flooding comments"; n.style.background = '#EBFFDD'; n.style.border = '1px solid #9DBC2B'; slideComment.resize();}
}
function closecomments(){ document.getElementById('databiosep').style.display = "block"; slideComment.toggle(); scrollComment.scrollTo('datablast');}
function changenav(navid,linkid){ document.getElementById(linkid).onclick = function(){ document.getElementById(linkid).href = "javascript:void(0)"; scrollComment.scrollTo(navid);}
}
function changecomment(){ comlinks = document.getElementsByTagName('a'); for(i=0; i<comlinks.length; i++){ cl = comlinks[i]; if (cl.href && cl.href.indexOf('/comment/') != -1) { comid = cl.href.split('/'); document.getElementById('commentlink_'+comid[4]).onclick = function(){ this.href = "javascript:void(0)"; id=this.id.split('_'); showcomments(id[1]);}
}
}
}

