function showData(){
  var sendEmailToMom = document.getElementById('sendEmailToMom123');
  var data = document.getElementById('postcomments');
  var darkdiv =document.getElementById('darkLayer');      
  common(sendEmailToMom);
  showMonChar(data);
  showDarkDiv(darkdiv);
}


function common(obj){
		obj.style.visibility="visible";
		obj.style.display="";
	
	}

	function showMonChar(obj){
		obj.style.visibility="visible";
		obj.style.display="";
	}


	function showDarkDiv(obj){
		obj.style.visibility="visible";
		obj.style.display="";
		obj.style.width="1000px";
    	obj.style.height=findPosY(document.getElementById("footer"))+50+"px";;
    	obj.style.overflow="scroll";
	}
	
	
	function CloseOverlayWindow(){
	  
		var sendEmailToMom = document.getElementById('sendEmailToMom123');
		var showData=document.getElementById('postcomments');
		var darkdiv =document.getElementById('darkLayer'); 
		
		 hideMonChar(sendEmailToMom);
		 //hideMonChar(darkdiv);
		
	}
	
	function hideMonChar(obj){
		obj.style.visibility="hidden";
		obj.style.display="none";
	}

	function findPosY(obj)
  {
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
  }


function validateDebate123(form,desc,writeText){

//var debatetitle = document.getElementById('debatetitleId');
//var debatecategory = document.getElementById('debatecatId');

 var debatedescription = document.getElementById('debateDescriptionId123');
	
	if(removeAllSpaces(document.debateReviewForm1.name.value)==''){
		alert('Please enter name.');
		document.debateReviewForm1.name.focus();
		return false;
	}
	
	if(removeAllSpaces(document.debateReviewForm1.email.value)==''){
		alert('Please enter email.');
		document.debateReviewForm1.email.focus();
		return false;
	}
	if(notValidEmail(document.debateReviewForm1.email)){
		alert('Please enter correct email.');
		document.debateReviewForm1.email.focus();
		return false;
	}
	
	if(!document.debateReviewForm1.status[0].checked && !document.debateReviewForm1.status[1].checked){
	   alert('Please select either agree or disagree.');
		//document.debateReviewForm1.status.focus();
	    return false;
	}
	
	
	
	
	
	
	
	if(removeAllSpaces(debatedescription.value)==''){
		alert('Please enter description.');
		debatedescription.focus();
		return false;
	}
	if(debatedescription.value != ''){
	debateDisplayAbuseWord123("/debateMyPage.do?method=checkAbuse");
	}
return false;
}

function removeAllSpaces(str)
{
   str = removeLeadingSpaces(str); //Remove Leading Spaces
   str = removeTrailingSpaces(str); //Remove Trailing Spaces
   return str;
}
// This method is used to remove Leading spaces.
// It takes argument of the string which Leading Spaces has to removed.
function removeLeadingSpaces(str)
{
   var whitespace = new String(" \\t\\n\\r");
   var s = new String(str);
   if (whitespace.indexOf(s.charAt(0)) != -1)
    {
      var j=0, i = s.length;
      while (j < i && whitespace.indexOf(s.charAt(j)) != -1)  j++;
      s = s.substring(j, i);
    }
   return s;
}
//######################################################################################################
// This method is used to remove Trailing spaces.
// It takes argument of the string which Trailing Spaces has to removed.
function removeTrailingSpaces(str)
{
   var whitespace = new String(" \\t\\n\\r");
   var s = new String(str);
   if (whitespace.indexOf(s.charAt(s.length-1)) != -1)
   {
      var i = s.length - 1;       // Get length of string
      while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1) i--;
      // Get the substring from the front of the string to
      // where the last non-whitespace character is...
      s = s.substring(0, i+1);
   }
   return s;
}
function ismaxlength(obj){
		var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
		if (obj.getAttribute && obj.value.length>mlength)
		obj.value=obj.value.substring(0,mlength)
}



/// aaaaaaaaabuse


function sendRequestWithDataAbuseWordDebateLan(address, data,responseHandler) {
		//requestd = getRequestObject();
		
		//alert('Kumar');
		
		if (window.ActiveXObject) {
		requestd = (new ActiveXObject("Microsoft.XMLHTTP"));
			} else if (window.XMLHttpRequest) {
				requestd = (new XMLHttpRequest());
			} else {
		requestd = null;
		}
		requestd.onreadystatechange = responseHandler;
		requestd.open("POST", address, true);
		requestd.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	requestd.send(data);
	}

function showResponseTextAbuseWord123() {

	if ((requestd.readyState == 4) && (requestd.status == 200)) {
	// resultText is message where message display
	var messageText = requestd.responseText;
		if(messageText != "" ){
			document.getElementById("debateResultText123").innerHTML = "Abusive words " + "(" + messageText + ")" + " are not allowed. Kindly rephrase.";
			return false;
		}else{
		document.debateReviewForm1.submit();
		return true;
		}
	}
}
	
function debateDisplayAbuseWord123(address) {
//alert('kamlesh');

debateDescriptionId = document.getElementById('debateDescriptionId123').value;
	var data = "debateDescriptionId=" + escape(debateDescriptionId) + "&useHTML=true";
	sendRequestWithDataAbuseWordDebateLan(address, data, showResponseTextAbuseWord123);

}

function notValidEmail( str ){
    mailRE = new RegExp( );
    mailRE.compile( '^[\._a-z0-9-]+@[\.a-z0-9-]+[\.]{1}[a-z]{2,4}$', 'gi' );
    return !(mailRE.test( str.value ));
} 


function limitText(limitField, limitNum) {
    if (limitField.value.length > limitNum) {
        
        limitField.value = limitField.value.substring(0, limitNum);
        alert("You can't write more than "+limitNum+" character.");
       
    } 
}

function makeactive(tab) { 
//document.getElementById("tab2").className = "nw-debate-nw-popular2"; 
//document.getElementById("tab3").className = "nw-debate-nw-popular3"; 
if(tab=='2'){
document.getElementById("tab2").className = "nw-debate-nw-popular2"; 
document.getElementById("tab3").className = "nw-debate-nw-popular3";
 
}

if(tab=='3'){
document.getElementById("tab2").className = "nw-debate-nw-popular3"; 
document.getElementById("tab3").className = "nw-debate-nw-popular2";
}



//document.getElementById("tab"+tab).className = "active";

}


var nofphotostodisplay=4;
 function displayCatPhotos(idName_prefix,actualphotos){
var ph_index=actualphotos-nofphotostodisplay;
if (ph_index>0){
      for(var ph_index_1=1;ph_index_1<=ph_index;ph_index_1++){
      document.getElementById(idName_prefix+ph_index_1).style.display="none";
      document.getElementById(idName_prefix+ph_index_1).style.visibility="hidden";
      }
}
}

function printDebate(debateId){

window.open("/debate.do?choice=debatePrint&debateId="+debateId,"mywindow","menubar=0,resizable=1,width=750,location=0,height=400");

}



