function enableCommentForms() {
	uname=GetCookie('NAD_usrn');
document.writeln('<style>');
	if( uname ) {
document.writeln('.guestuser {display:none;}');
document.writeln('.adplususer {display:block;}');
	} else {
document.writeln('.guestuser {display:block;}');
document.writeln('.adplususer {display:none;}');
	}
document.writeln('</style>');
}
function writeReplyForm(formid,commentid,to_content) {
	obj=document.getElementById(formid);
	if(!obj) return;
	if(obj.innerHTML=='') {
		uname=GetCookie('NAD_usrn');
		var formhtml='';
		if(uname) {
			formhtml+='<form method="post" action="/nad/user/edit/contentcomment">';
			formhtml+='<table cellspacing="5" width="390" cellpadding="0" style="background-color:#E7E6E6;">';
			formhtml+='<tr><td><textarea name="user_comment" id="ctext'+commentid+'" style="width:375;height:100;"></textarea></td></tr>';
			formhtml+='<tr><td><span style="font-size:10;">Your comment should appear on ARTISTdirect.com within 5 minutes.</span><br /><input style="margin:0 8 0;" type="submit" name="submit" value="Submit"><input onclick="javascript:void(writeReplyForm(\'_creplyform_'+commentid+'\','+commentid+'))" type="button" value="Cancel"></td></tr>';
			formhtml+='<input type="hidden" name="redir" value="/nad/user/reviewcomments/0,,'+to_content+',00.html">';
			formhtml+='<input type="hidden" name="to_content" value="'+to_content+'">';
			formhtml+='<input type="hidden" name="to_comment" value="'+commentid+'">';
			formhtml+='</table>';
			formhtml+='</form>';
		} else {
			formhtml='<div style="margin:5;"><input type=button onclick="window.location.href=\'/nad/user/login/?redir=/nad/user/reviewcomments/0,,'+to_content+',00.html?cf='+commentid+'\';" value="Login to reply"></div>';
		}
		obj.innerHTML=formhtml;
	}
	obj.style.display=(obj.style.display=='block')?'none':'block';
}
function writeRateLinks(commentid,type,postedby) {
	rlks=document.getElementById('ratelinks'+commentid); if(!rlks) return;
	uname=GetCookie('NAD_usrn');
	var thishtml='';
	if(uname) {
		ratedcomments=GetCookie('NAD_usrrated_'+uname); if(!ratedcomments) ratedcomments='';
		if(uname!=postedby&&ratedcomments.indexOf(commentid)==-1) {
thishtml+='<div style="float:right;" class="adplususer"><a onclick="rateComment('+commentid+','+type+',1); return false;" href=#><img width="16" height="16" align="absmiddle" src="/Images/nad/gui/adplus_rate_up.gif"></a> <a href="javas'+'cript:void(rateComment('+commentid+','+type+',-1))"><img width="16" height="16" align="absmiddle" src="/Images/nad/gui/adplus_rate_down.gif"></a></div>';
		} else {
thishtml+='<div style="float:right;" class="adplusrestricted"><img width="16" height="16" align="absmiddle" src="/Images/nad/gui/adplus_rate_up.gif"> <img width="16" height="16" align="absmiddle" src="/Images/nad/gui/adplus_rate_down.gif"></div>';
		}
	} else {
thishtml+='<div style="float:right;" class="guestuser" title="login to rate"><img width="16" height="16" align="absmiddle" src="/Images/nad/gui/adplus_rate_up.gif"> <img width="16" height="16" align="absmiddle" src="/Images/nad/gui/adplus_rate_down.gif"></div>';
	}
	rlks.innerHTML=thishtml;
}

function rateComment(commentid,type,rating) {
	var rateit=document.createElement("IFRAME");
	rateit.setAttribute('width',0);
	rateit.setAttribute('height',0);
	rateit.style.width="0";
	rateit.style.height="0";
	rateit.src='/nad/user/rate/contentcomment/?cmt='+commentid+'&type='+type+'&rating='+rating;
	rateit.style.display="none";
	document.body.appendChild(rateit);

	rt=document.getElementById('rate'+commentid);
	if(rt) {var cur_rate=parseInt(rt.innerHTML); (cur_rate>=0)?rt.innerHTML='+':rt.innerHTML=''; rt.innerHTML=+(cur_rate+rating);}
	(rating>0)? showComment(commentid):hideComment(commentid);
	NAD_date = new Date( (new Date()).getTime() + duration );
	uname=GetCookie('NAD_usrn');
	ratedcomments=GetCookie('NAD_usrrated_'+uname);
	ratedarray=(ratedcomments)?ratedcomments.split(":"):new Array();
	ratedarray.push(commentid);
	if(ratedarray.length>20) {ratedarray.shift();}
	document.cookie='NAD_usrrated_'+uname+'='+ratedarray.join(":")+'; path=/nad/user/reviewcomments; domain=artistdirect.com; expires=' + new Date(2100,0,1).toGMTString();
	writeRateLinks(commentid,type,null);
}
function hideComment(commentid) {
	sl=document.getElementById('showlink'+commentid);
	if(sl) sl.innerHTML='<a href="javas'+'cript:void(showComment('+commentid+'))">Show</a>';
	cm=document.getElementById('comment'+commentid);
	if(cm) cm.style.display='none';
	rp=document.getElementById('replylink'+commentid);
	if(rp) rp.style.display='none';
}
function showComment(commentid) {
	sl=document.getElementById('showlink'+commentid);
	if(sl) sl.innerHTML='<a href="javas'+'cript:void(hideComment('+commentid+'))">Hide</a>';
	cm=document.getElementById('comment'+commentid);
	if(cm) cm.style.display='block';
	rp=document.getElementById('replylink'+commentid);
	if(rp) rp.style.display='block';
}
function focusCommentForm() {
	cf=getParam('cf');
	if(cf>0) writeReplyForm('_creplyform_'+cf,cf);
	obj=document.getElementById('ctext'+cf);
	if(obj) obj.focus();
}