

function viewfile(afilename) {
    document.viewfileform.viewfile.value = afilename;
    document.viewfileform.submit();


}


function confirmDelete(sid,cid) {
	if (confirm('Are you sure you want to delete your comment?')) { 
	   document.actionForm.cid.value = cid;
	   document.actionForm.sheetid.value = sid;
	   document.actionForm.processed.value = '0';
	   document.actionForm.theaction.value = 'deletecomment';
	   document.actionForm.submit();
	}
}

function confirmSheetDelete(sid) {
	if (confirm('Are you sure you want to delete this entire PeepSheet\r\nincluding any comments you may have left?')) { 
	   document.actionForm.sheetid.value = sid;
	   document.actionForm.processed.value = '0';
	   document.actionForm.theaction.value = 'deletesheet';
	   document.actionForm.submit();
	}
}
function confirmCommentSpam(sid, cid) {
	if (confirm('Are you sure you want to flag this comment as spam?')) {
	   document.actionForm.cid.value = cid;
	   document.actionForm.sheetid.value = sid;
	   document.actionForm.theaction.value = 'commentspam';
	   document.actionForm.processed.value = '0';
	   document.actionForm.submit();   
		}
}	

function confirmThumbs(sid, cid, thumb) {
	   document.actionForm.cid.value = cid;
	   document.actionForm.sheetid.value = sid;
	   if (thumb == 1) {
	    document.actionForm.theaction.value = 'thumbsup';
	    }
	    else {
	    document.actionForm.theaction.value = 'thumbsdown';
	    }
	   document.actionForm.processed.value = '0';
	   document.actionForm.submit();   
}	


function confirmSheetSpam(sid) {
	if (confirm('Are you sure you want to flag this PeepSheet as spam?')) {
	   document.actionForm.cid.value = '';
	   document.actionForm.sheetid.value = sid;
	   document.actionForm.theaction.value = 'sheetspam';
	   document.actionForm.processed.value = '0';
	   document.actionForm.submit();   
		}
}	

function validateDispute() {
	if (confirm('Click OK if you are sure you want to dispute this posting.')) {
            if ( document.actionForm.sheetid.value.length > 0 &&  document.actionForm.cid.value.length > 0) { 
                   txtDisputeid = document.getElementById('txtDispute')
	                   document.actionForm.txt.value = txtDisputeid.value;
	                  document.actionForm.theaction.value = 'dispute';
	                  document.actionForm.processed.value = '0';
	                  document.actionForm.submit();	                                
		       }
				else {
		         alert ('Error opening dispute.  Please check your security settings.');
		       }
		}
	else return false;
}	




function showDisputeDiv(strAction, sid, cid, event) {
   var tempX, tempY;
   e = event || window.event;
  

    ContactDisputeDivID = document.getElementById('dispute')


   if (ContactDisputeDivID) ContactDisputeDivID.style.display='none';


   txtDisputeid = document.getElementById('txtDispute')
   if (txtDisputeid) txtDisputeid.value = '';
  
   
   document.actionForm.cid.value = cid;
   document.actionForm.sheetid.value = sid;
   thetag = document.getElementById(strAction+cid)
   thediv = document.getElementById(strAction)


   
if (typeof e.pageX == "number") {
tempX = e.pageX;
tempY = e.pageY;
} else if (typeof e.clientX == "number" &&
typeof document.body.scrollLeft == "number") {
tempX = e.clientX + document.body.scrollLeft;
tempY = e.clientY + document.body.scrollTop;
} else {
   alert('Error!  Upgrade your browser!');
return false;
}   
   thediv.style.left = tempX //event.x;
   thediv.style.top = tempY //event.y + document.body.scrollTop;
   //thediv.style.left = posX;
   //thediv.style.top = posY;
   thediv.style.display = 'inline';
}





function refreshPage() {
   document.refreshform.submit();
}

function showAllComments(sid, acid) {

   document.refreshform.sheetid.value = sid;
   document.refreshform.acid.value = acid;
   document.refreshform.submit();

}


function viewSingleComment(cid) {
   document.refreshform.cid.value = cid;
   document.refreshform.submit();
}

function viewAllComments() {
   document.refreshform.cid.value = '';
   document.refreshform.page.value = '1';  
   document.refreshform.showmine.value = '';    
   document.refreshform.submit();
}

function expandAllComments() {
   document.refreshform.expandcomments.value = '1';
   document.refreshform.page.value = '1';
   document.refreshform.submit();
}

function condenseAllComments() {
   document.refreshform.expandcomments.value = '';
   document.refreshform.submit();
}

function viewMine() {
   document.refreshform.expandcomments.value = '';
   document.refreshform.showmine.value = '1';
   document.refreshform.page.value = '1';
   document.refreshform.submit();
}

function validateForm() {
	var msg;
	msg = '';
	if (document.addform.captcha.value == '') msg = msg + 'Please enter the numbers you see in the image above the submit button'
	if (msg == '') {
	   document.addform.processed.value='0';
		document.addform.submit();
		}
	else {
		alert ('Please correct the following errors before submitting\r\n' + msg);
		return false;
	}
	
}

function editSheet(sid, isUpdate) {
if (!isUpdate) {
   document.sheetform.sheetid.value = sid;
   document.sheetform.submit();
   }
}

function watchSheet(sid) {
   document.actionForm.theaction.value = 'watch';
   document.actionForm.sheetid.value = sid;
   document.actionForm.processed.value = '0';
	document.actionForm.submit();   
}



function editComment(sid, cid) {
    document.refreshform.theaction.value = 'editcomment';
    document.refreshform.sheetid.value = sid;
    document.refreshform.cid.value = cid;
    document.refreshform.page.value = '';
    document.refreshform.CommentSearch.value = '';
    document.refreshform.submit();


}