var http_request=false;function makePOSTRequest(url,parameters){http_request=false;if(window.XMLHttpRequest){http_request=new XMLHttpRequest();if(http_request.overrideMimeType){http_request.overrideMimeType('text/html');}}else if(window.ActiveXObject){try{http_request=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{http_request=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}}}
if(!http_request){alert('Cannot create XMLHTTP instance');return false;}
http_request.onreadystatechange=alertContents;http_request.open('POST',url,true);http_request.setRequestHeader("Content-type","application/x-www-form-urlencoded");http_request.setRequestHeader("Content-length",parameters.length);http_request.setRequestHeader("Connection","close");http_request.send(parameters);}
function alertContents(){if(http_request.readyState==4){if(http_request.status==200){result=http_request.responseText;document.getElementById('mycommentspan').innerHTML=result;}else{document.getElementById('mycommentspan').innerHTML='There was a problem with the request. Please contact us and report this problem!';}}}
function get(obj){var poststr;if(document.getElementById("user_id").value==0)
{poststr="comment_txt="+ encodeURI(document.getElementById("comment_txt").value)+"&vid="+ encodeURI(document.getElementById("vid").value)+"&user_id="+ encodeURI(document.getElementById("user_id").value)+"&username="+ encodeURI(document.getElementById("username").value)+"&captcha="+ encodeURI(document.getElementById("captcha").value);}
else{poststr="comment_txt="+ encodeURI(document.getElementById("comment_txt").value)+"&user_id="+ encodeURI(document.getElementById("user_id").value)+"&vid="+ encodeURI(document.getElementById("vid").value);}
makePOSTRequest(''+MELODYURL+'/comment.php',poststr);}
function submitonce(theform){if(document.getElementById("user_id").value!=0)
{if(document.getElementById("comment_txt").value==''||document.getElementById("comment_txt").value=="test"){}
else{if(document.all||document.getElementById){for(i=0;i<theform.length;i++){var tempobj=theform.elements[i]
if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset")
tempobj.disabled=true;}
$(theform).slideUp('normal');}}}
else
{var alert_msg='';if(document.getElementById("comment_txt").value==''){alert_msg=alert_msg+'You need to write a comment first!\n';}
if(document.getElementById("username").value==''||document.getElementById("captcha").value==''){alert_msg=alert_msg+'Please fill in the required fields.\n';}
if(alert_msg!=''){}
else{if(document.all||document.getElementById){for(i=0;i<theform.length;i++){var tempobj=theform.elements[i]
if(tempobj.type.toLowerCase()=="submit")
tempobj.disabled=false;}
$(theform).slideUp('normal');}}}}
function validateSearch(b_on_submit){if(document.forms['search'].keywords.value==''||document.forms['search'].keywords.value=='search'){alert('You did not enter a search term. Please try again.');if(b_on_submit=='true')
return false;}
else{document.forms['search'].submit();}}
function lookup(inputString){if(inputString.length==0){$('#suggestions').hide();}else if(inputString.length>2){$.post(MELODYURL2+'/ajax_search.php',{queryString:""+inputString+""},function(data){if(data.length>0){$('#suggestions').show();$('#autoSuggestionsList').html(data);}});}}
function fill(thisValue){$('#inputString').val(thisValue);setTimeout("$('#suggestions').hide();",200);}
function catlist()
{$("#ul_categories ul").each(function(){$(this).hide().css({display:"none"});});$("#ul_categories li").hover(function(){$(this).find('ul').show().css({display:"block"});},function(){$(this).find('ul').hide().css({display:"none"});});}
