function validateFunc(frm){
	
	if(frm.txtTitle.value == '' ){
		alert('Please enter title for review.');
		frm.txtTitle.focus();
		return false;
	}
	if(frm.taReviewText.value == '' ){
		alert('Please enter text for review.');
		frm.taReviewText.focus();
		return false;
	}
	
	return true;
	
}// end func
function commentBox(ctr1,ctr2){
	if(typeof ctr2 != "undefined"){
		document.getElementById(ctr1).style.display = 'none';
		document.getElementById(ctr2).style.display = '';
	}else{
		if(document.getElementById(ctr1).style.display == 'none')
			document.getElementById(ctr1).style.display = '';
		else
			document.getElementById(ctr1).style.display = 'none';
	}// end if
}// end func

function submitComment(frmHndl){
	frm = document.forms[frmHndl];
	if(frm.elements["commenttext"].value == ''){
		alert("Please provide some comments.");
		frm.elements["commenttext"].focus();
		return false;
	}
	frm.submit();
}

function submitRev(frm,ratingField){
	
	if(ratingField.value == '0'){
		alert("Please enter rating for review.");		
		return false;
	}
	
	if(frm.elements["txtTitle"].value == ''){
		alert("Please enter title for review.");
		frm.elements["txtTitle"].focus();
		return false;
	}
	
	if(frm.elements["taReviewText"].value == ''){
		alert("Please enter some text for review.");
		frm.elements["taReviewText"].focus();
		return false;
	}
	
	frm.submit();
}

function help_yes(revid,frm,type){
	myfrm = document.forms[frm];
	myfrm.reviewID.value = revid ;
	myfrm.hdType.value = type ;
	myfrm.submit();
}// end func

function deleteRev(revID,lblRev,frm){
	
	if(confirm('Are you sure you want to delete this ' + lblRev )){
		myfrm = document.forms[frm];
		myfrm.reviewID.value = revID;
		myfrm.submit();
	}// end if

}// end Del Rev

function deleteCom(comID,lblCom,frm){
	
	if(confirm('Are you sure you want to delete this ' + lblCom )){
		myfrm = document.forms[frm];
		myfrm.commentID.value = comID;
		myfrm.submit();
	}// end if
	
}// end Del com




function getParentComment(ctrl,pCommentId,modulepath,cId){
	
	parentnode = ctrl.parentNode.parentNode;
	popupdiv = parentnode.getElementsByTagName("div")[0];
	popupdiv.className = "parent_comment_displayed";
	popupdiv_id = "div_reply_of_" + cId;
	popupdiv.id = popupdiv_id;
	
	//alert(document.getElementById(popupdiv_id));
	
	//parentCommentHandler(ctrl, popupdiv_id);
	parentCommentHandler(popupdiv, popupdiv_id);
	
	hXmlHttp1 = getXMLHttpHandler();
	hXmlHttp1.onreadystatechange = function(){
		if(hXmlHttp1.readyState == 4){
			if(hXmlHttp1.status == 200){
				resText = hXmlHttp1.responseText;
				popupdiv.innerHTML = resText;
			}// end 200
		}// end 4
	}// end func
	
	url = modulepath + "/rev_common_scripts.cfm?key=1&ParentCommentId=" + pCommentId;

	hXmlHttp1.open("POST", url);
	hXmlHttp1.send(null);

	
}
var temp_popup = new Object();
function parentCommentHandler(ctrl, popupHndl){
	
	ctrl.onmouseout = function anon(){
		startTimeout(popupHndl);
	};
	ctrl.onmouseover = function anon(){
		if(temp_popup.t){
			if(temp_popup.id != popupHndl)
				closePopup(temp_popup.id);
				
			clearTimeout(temp_popup.t);
		}
		//clearTimeout(temp_popup.t);
	};
	
}
function startTimeout(popupHndl){
	temp_popup.t = setTimeout("closePopup('"+popupHndl+"')",1000);
	temp_popup.id = popupHndl;
	//alert(1)
}
function closePopup(popupHndl){
	//alert(popupHndl)
	document.getElementById(popupHndl).className = "parent_comment_hidden";
	document.getElementById(popupHndl).innerHTML = "";
}



