var plsenterakid	= "Please enter a knowledge ID";
var invalidkid		= "Please enter a valid knowledge ID";

// get the Interest, Category, Topic from Cookies
sTmpInt = "";
tmpCat	= "";
tmpTop	= "";
sSearchBy = "";
sMatchType = "";
sDesType = "";
sDocSearch = "";
icICT	= SetValue("ICT")
if (icICT != null){
	Val = new String(icICT);
	Arr = Val.split('~');
	if(Val.length > 0){
		sTmpInt	= Arr[0];
		tmpCat = Arr[1];
		tmpTop = Arr[2];
		sSearchBy = Arr[3];
		sMatchType = Arr[4];
		sDesType = Arr[5];
		sDocSearch = Arr[6];
	}					
}

//Clear cbo
function clearStatus(oList){
	for (var i = oList.options.length; i >= 0; i--){
		oList.options[i] = null;
	}
	oList.selectedIndex = -1;
}

//Populate Interest dropdown box
var oListInterest = document.MyFORM.elements["cboInt"];
PopulateDepCat(oListInterest,0,sTmpInt,sAllInterest)

// This is where the Category get positioned
PopulateDepCat(document.MyFORM.cboCat,oListInterest.options[oListInterest.selectedIndex].value,tmpCat,sAllCategory)

// This is where the Topics get positioned
PopulateDepCat(document.MyFORM.cboTop,document.MyFORM.cboCat.options[document.MyFORM.cboCat.selectedIndex].value,tmpTop,sAllTopic)

//Position the Description CheckBox
var bCheckDes	= document.getElementById("cboTop") ? true : false;;
if (bCheckDes){
	sDesType	= SetValue("DesType");
	if (sDesType != null){
		if (sDesType == "F"){
			document.MyFORM.rdoDes.checked=true;
		}
		else{
			if (sDesType == "P"){
				document.MyFORM.rdoDes.checked=false;
			}
		}
	}
}

//Position the Description CheckBox
var bCheckMatch	= document.getElementById("rdoMatch") ? true : false;;
if (bCheckMatch){
	sMatchType	= SetValue("MatchType");
	if (sMatchType != null){
		if (sMatchType == "E"){
			document.MyFORM.rdoMatch.checked=false;
		}
		else{
			if (sMatchType == "P"){
				document.MyFORM.rdoMatch.checked=false;
			}
		}
	}
	else{
		document.MyFORM.rdoMatch.checked=false;
	}
}

var bCheckSearchBy	= document.getElementById("rdoSearchBy") ? true : false;;
if (bCheckSearchBy){
	sSearchBy = SetValue("SearchBy");
	if (sSearchBy != null && sSearchBy=="I"){
		document.MyFORM.rdoSearchBy.checked=true;
	}
	else{
		document.MyFORM.rdoSearchBy.checked=false;
	}
}

//Get the keyword from Keyword cookies
sTmpKWord	= SetValue("Keyword");
if (sTmpKWord != null){
	document.MyFORM.txtKeyword.value	= sTmpKWord;
}

// Function for Help
function Help(){
	var strLoc;
	if (top.SoffrontHelp && !top.SoffrontHelp.closed){
		top.SoffrontHelp.close();
	}
 	var WindowWidth	= 600;
 	var WindowHeight= 400;
 	var WindowTop	= parseInt((screen.height-WindowHeight)/2);
 	var WindowLeft= parseInt((screen.width-WindowWidth)/2);
 	strLoc	= document.MyFORM.action;
 	strLoc	+= "TWKBHelp/Search_Knowledge_Base_page_2.htm"
	top.SoffrontHelp = window.open(strLoc,"SoffrontHelp","Height="+WindowHeight+",Width="+WindowWidth+",top="+WindowTop+",left="+WindowLeft+",titlebar=no,scrollbars=yes,resizable=yes");
	top.SoffrontHelp.focus();	
}

function onDocSearch(){
	if (document.MyFORM.rdoDoc.checked){
		document.MyFORM.rdoSearchBy.checked=false;
	}
}
function onSearchByID(){
	if (document.MyFORM.rdoSearchBy.checked){
		document.MyFORM.rdoDoc.checked=false;
	}
}

