function feedback_window(artId)
{ 
	popupWin = window.open('../kb/comment.jsp?artId='+artId,'rating',' width=500,height=300,left=30,top=30')
}

function article_disp(artId)
{ 
	popupWin = window.open('../kb/onlineviewarticle.jsp?ArticleID='+artId,'view','width=800,height=550,left=30,top=30,resizable=yes,scrollbars=yes')
}

function operate_environ(lnk)
{ 
	popupWin = window.open('../kb/attributes.jsp?'+lnk,'list_attr',' width=565,height=380,left=30,top=30')
}

function openhelp(lnk)
{ 
	popupWin = window.open(lnk,'help','width=800,height=550,left=30,top=30,resizable=yes,scrollbars=yes')
}

function rateCheck(len) 
{
	for(var i=0;i<len;i++)
	{
		if(document.form1.rateId[i].checked==true)
			return true;
		else
			continue;
	}

	alert("Please select a rating");
	return false;
}


function addFeedback(artId,prevRating,len)
{
	var link="";
	link = "../kb/onlineviewarticle.jsp?ArticleID="+artId+"&prevRating="+prevRating+"&CommentText="+document.form1.CommentText.value;
	var rv="";
	for(var i=0;i<len;i++)
	{
		if(document.form1.rateId[i].checked==true)
		{	
			rv = document.form1.rateId[i].value;
			link += "&rateId="+rv+"&sub=y&#fdr";
			location.href=link;
			return true;
		}	
		else
		{	
			continue;
		}
	}
	
	alert("Please select a rating");
}


function resetForm(formname,comp)
{
	confirmReset = confirm("Do you want to set this information to original position?")
	if(confirmReset)
	{
		formname.reset();
		if((navigator.appName=='Microsoft Internet Explorer')&&(comp=='Compose'))
		{
			editor.SetHTML(plainmsg.innerHTML);
			document.Compose.CNAME_BODY.value = editor.GetHTML();
			document.Compose.CNAME_BODY_REDO.value = editor.GetHTML();
		}
	}
}

function feedback_window_close(artId)
{ 
	
	popupWin = window.open('../kb/comment.jsp?artId='+artId,'rating',' width=500,height=300,left=30,top=30')
	window.close();
}

function trimAll(str)
{
    var objRegExp =/^(\s*)$/;
    if (objRegExp.test(str))
    {
       str = str.replace(objRegExp,'');
	   if (str.length == 0)
	      return str;
	}
	objRegExp = /^(\s*)([\W\w]*)(\b\s*$)/;
	if(objRegExp.test(str))
	{
		str = str.replace(objRegExp, '$2');
	}
	return str;
}

function chkDetails(val1,val2)
{
	var v1 = eval("document."+val1+"."+val2+".value");
	v1 = trimAll(v1);
	if(v1.length == 0)
	{  
		alert("Please enter some text");
		return false;
	}
	else
	{
		if(v1.indexOf('"')>-1)
		{
			alert("Double Quotes are not allowed ");
			return false;	
		}
		firstChar = v1.charAt(0);
		if((firstChar >=0 || (firstChar =="") || ((firstChar >= "a") && (firstChar <= "z")) || ((firstChar >= "A") && (firstChar <= "Z")) || (firstChar == "(") || (firstChar == ")") || (firstChar == "[") || (firstChar == "]")))
			return true;
		else
		{
			alert("First letter should be an Alphabet!");
			return false;
		}
	}
}

function pageSubmit(val1,val2,val3)
{
	//var v1 = eval("document."+fname+".whichPage");
	document.rangeForm1.whichPage.value = val1;
	document.rangeForm1.showMin.value = val2;
	document.rangeForm1.showMax.value = val3;
	document.rangeForm1.submit();
}

function limitSubmit(val)
{
	document.buttonForm1.artLimit.value = val;
	document.buttonForm1.submit();
}

function bottomlimitSubmit(val)
{
	document.buttonForm2.artLimit.value = val;
	document.buttonForm2.submit();
}

function bottompageSubmit(val1,val2,val3)
{
	//var v1 = eval("document."+fname+".whichPage");
	document.rangeForm2.whichPage.value = val1;
	document.rangeForm2.showMin.value = val2;
	document.rangeForm2.showMax.value = val3;
	document.rangeForm2.submit();
}

function nextSubmit(val1,val2,val3,val4)
{
	document.rangeForm1.nextset.value = val1;
	document.rangeForm1.showMin.value = val2;
	document.rangeForm1.showMax.value = val3;
	document.rangeForm1.whichPage.value = val4;
	document.rangeForm1.submit();
}

function nextBottomSubmit(val1,val2,val3,val4)
{
	document.rangeForm2.nextset.value = val1;
	document.rangeForm2.showMin.value = val2;
	document.rangeForm2.showMax.value = val3;
	document.rangeForm2.whichPage.value = val4;
	document.rangeForm2.submit();
}


