var loader='<div style="text-align: center;"><img src="'+siteurl+'/images/load.gif" /></div>';var bb=new Array(0,0,0,0,0);function get_position(obj){var left_pos=0;var top_pos=0;if(obj.offsetParent){do{left_pos+=obj.offsetLeft;top_pos+=obj.offsetTop;}while(obj=obj.offsetParent);}else if(obj.x){left_pos+=obj.x;top_pos+=obj.y;}var jada=new Array(left_pos,top_pos);return jada;}function get_window_dimensions(){var width=0;var height=0;if(window.innerWidth){width=window.innerWidth;height=window.innerHeight;}else if(document.documentElement.clientWidth&&document.documentElement.clientWidth!=0){width=document.documentElement.clientWidth;height=document.documentElement.clientHeight;}else{width=document.body.clientWidth;height=document.body.clientHeight;}var jada=new Array(width,height);return jada;}function addLoadEvent(func){var oldonload=window.onload;if(typeof window.onload!='function'){window.onload=func;}else{window.onload=function(){oldonload();func();}}}function doc_id(id){return document.getElementById(id);}function nl2br(string){return string.replace(/(\\r)?\\n/g,"<br />");}function nohtml(string){string=string.replace(/"/g,'&quot;');string=string.replace(/</g,'&lt;');string=string.replace(/>/g,'&gt;');return string;}
function check_all(){for(var i=0;i<document.form.elements.length;i++){var e=document.form.elements[i];if(e.name!="all"&&e.type=="checkbox")e.checked=document.form.all.checked;}}function link_out(link_id){window.open(siteurl+"/links.php?a=out&l="+link_id);return false;}function confirm_delete(){if(confirm(sure_delete))return true;else return  false;}function verify_link_add(){if(document.form.link_title.value==""||document.form.link_url.value==""||document.form.link_description.value==""||document.form.link_email.value==""){alert(all_fields_required);return false;}else return  true;}function verify_submit(){if(doc_id("title").value==""||doc_id("description").value==""||doc_id("upload_file").value==""||doc_id("upload_image").value==""){alert(all_fields_required);return false;}else return  true;}function verify_sponsor(){if(document.getElementById("os0").value==''||document.getElementById("os1").value==''||document.getElementById("os1").value=='http://')
{alert(all_fields_required);return false;}else return  true;}function score_comment_form(comment_id){doc_id("edit_comment_"+comment_id).innerHTML='<input type="text" size="20" maxlength="50" id="score_comment" /> <input type="submit" value="'+submit_button+'" onclick="edit_score_comment('+comment_id+')" />';doc_id("edit_comment_"+comment_id).firstChild.focus();}function comment_verification(){if(doc_id("comment_verification").style.display=="none"){doc_id("comment_verification").style.display="block";doc_id("c_verification_image").src=siteurl+"/includes/verification_image.php";}}function refresh_image(image_id){doc_id(image_id).src=siteurl+"/includes/verification_image.php?"+Math.random();}function tell_friend_pop(){var tell_friend=doc_id("tell_friend_popup");var file_info=doc_id("file_info");var position=get_position(file_info);tell_friend.style.display="block";if(document.getElementById("friend_verification"))refresh_image("friend_verification");left_plus=(file_info.offsetWidth-tell_friend.offsetWidth)/2;tell_friend.style.top=(position[1]+15)+"px";tell_friend.style.left=(position[0]+left_plus)+"px";}function report_broken(){var report_broken=doc_id("report_broken_popup");var file_info=doc_id("file_info");var position=get_position(file_info);report_broken.style.display="block";left_plus=(file_info.offsetWidth-report_broken.offsetWidth)/2;report_broken.style.top=(position[1]+40)+"px";report_broken.style.left=(position[0]+left_plus)+"px";}function close_popup(popup){doc_id(popup+"_popup").style.display="none";if(popup=='tell_friend'){doc_id("friend_email").value="";if(doc_id("friend_verification_code"))doc_id("friend_verification_code").value="";doc_id("tell_friend_error").innerHTML="<br />";doc_id("tell_friend_form").style.display="";}}
function emoticon(code,text_id){
var message=doc_id(text_id);
message.focus();
if(document.selection)document.selection.createRange().text=code;
else if(message.selectionStart||message.selectionStart==0)message.value=message.value.substring(0,message.selectionStart)+code+message.value.substring(message.selectionEnd,message.value.length);
else message.value+=code;
}

