function validateComments(formId) {
	var errors = "";
	var commentString = new String(trim(document.getElementById('newComment').value));
	document.getElementById('newComment').value = commentString;
	if (commentString == "") {
		errors +='<li class="error">Please enter comments</li>';	
		document.getElementById('errors').innerHTML = errors;
	} else {
		document.getElementById(formId).submit();
	}
}
function trim(s) {
    while (s.substring(0,1) == ' ') {
      s = s.substring(1,s.length);
    }
    while (s.substring(s.length-1,s.length) == ' ') {
      s = s.substring(0,s.length-1);
    }	
    return s;
}
function showNextDiv(currDiv){
		var linkObj = document.getElementById("pageSize").getElementsByTagName('a')[0];
		var divObj = document.getElementById('pageDiv'+currDiv);
		var nextDiv = parseFloat(currDiv) + 1;
		var divAfterNext  = parseFloat(currDiv) + 2;
		linkObj.onclick = function() {
				showNextDiv(nextDiv+'.0');
		}
		var nextDivObj = document.getElementById('pageDiv'+nextDiv+'.0');
		nextDivObj.style.display="block";
		var divAfterNextObj = document.getElementById('pageDiv'+divAfterNext+'.0');
		if (!divAfterNextObj) {
			document.getElementById('nextLink').style.display="none";
		}
}
function submitForm(formId) {
	document.getElementById(formId).submit();
	return true;
} 
function OpenSample(url)
{
	window.location.href=url;
}
function reportAbuse(commentId){
	document.getElementById("abuseForm").commentId.value=commentId;
	document.getElementById("abuseForm").submit();
	return true;
}
function showCommentDiv(id) {
	document.getElementById(id).style.display="block";
	document.getElementById("button").style.display="none";
}
function wopenprofile(url, name, w, h) {
  wleft = (screen.width - w) / 2;
  wtop = (screen.height - h) / 2;
  if (wleft < 0) {
    w = screen.width;
    wleft = 0;
  }
  if (wtop < 0) {
    h = screen.height;
    wtop = 0;
  }
  var win = window.open(url,name,'width=' + w + ', height=' + h + ', ' +
    'left=' + wleft + ', top=' + wtop + ',location=no, menubar=no, ' +
    'status=no, toolbar=no, scrollbars=yes, resizable=no');
  win.resizeTo(w, h);
  win.moveTo(wleft, wtop);
  win.focus();
  
}
