
function adjustuserspacedivs(){pos=findpos(findObj("userspaceBoxBottom"));toppos=pos.y+34;leftpos=pos.x;findObj("yc_history").style.top=toppos+'px';findObj("yc_history").style.left=leftpos+'px';findObj("yclogin").style.top=toppos+'px';findObj("yclogin").style.left=leftpos+'px';findObj("add_comment_box").style.top=toppos+'px';findObj("add_comment_box").style.left=leftpos+'px';}
function addcomment(a,b){if(b=='guest')
{findObj('yc_history').style.display='none';findObj('yclogin').style.display='none';findObj('add_comment_box').style.display='block';findObj('userspace_comment_edit_txt').value="";createCookie("mt_guest","yes",1);}else{if(chklogin())
{findObj('yc_history').style.display='none';findObj('yclogin').style.display='none';findObj('add_comment_box').style.display='block';findObj('userspace_comment_edit_txt').value="";}
else
{findObj('yc_history').style.display='none';findObj('add_comment_box').style.display='none';findObj('yclogin').style.display='block';findObj('userspace_comment_edit_txt').value="";}}}
function closeComment(){findObj('add_comment_box').style.display='none';if(readCookie("mt_guest"))
eraseCookie("mt_guest");}
function cancleUserSpaceComment()
{findObj('userspace_comment_edit_txt').value="";}
function saveUserSpaceComment(a){if(findObj('userspace_comment_edit_txt').value.length>200)
{alert('The maximum character length is 200. Please try with less characters. Thanks.');return false;}
if(findObj('userspace_comment_edit_txt').value.length<10)
{alert('The minimum character length is 10. Please try with more characters. Thanks.');return false;}
if(!checkForPossibleAttack()){alert('Server Busy! Please try later. Thanks.');return false;}
rpc.methodName="montred.saveYC";comment=findObj('userspace_comment_edit_txt').value;page_type=findObj('yc_type').value;owner_id=findObj('yc_id').value;findObj('userspace_comment_edit_txt').value="Saving...Please wait!";if(readCookie("mt_guest")){rpc(new Array(owner_id,page_type,comment,'guest',21,findObj("whatIsThisPageURL").value),saveUserSpaceCommentCB);}else{rpc(new Array(owner_id,page_type,comment,readCookie('mt_username'),readCookie('mt_uid'),findObj("whatIsThisPageURL").value),saveUserSpaceCommentCB);}}
function saveUserSpaceCommentCB(a,b)
{if(b)
{alert(b);}
else if(a.error){alert(a.error);}
else if(a){findObj('yc_history').style.display='none';findObj('yclogin').style.display='none';findObj('add_comment_box').style.display='none';if(a.userSpaceCommentCount==0){findObj('show_current_comments').innerHTML='<span onClick="adjustuserspacedivs();addcomment();" class=blueB><u>Add a Comment</u></span>';}else if(a.userSpaceCommentCount==1){findObj('show_current_comments').innerHTML='<span onClick="adjustuserspacedivs();getHistory('+findObj('yc_id').value+',\'userspace\',1);" class=blueB><u>1 Comment</u> <img src="images/MontRED-user-space-button.gif" border=0></span>';}else{findObj('show_current_comments').innerHTML='<span onClick="adjustuserspacedivs();getHistory('+findObj('yc_id').value+',\'userspace\',1);" class=blueB><u>'+a.userSpaceCommentCount+' Comments</u> <img src="images/MontRED-user-space-button.gif" border=0></span>';}
findObj('ychistorytd').innerHTML="Loading..... Please wait.";historyUptoDate=false;getHistory(findObj('yc_id').value,'userspace',1);}
if(readCookie("mt_guest"))
eraseCookie("mt_guest");}
