function rate_init(strLocation, strClientID, nTypeID, strLang, strBoard)
{
	rate_getBoards(strLocation, strClientID, nTypeID, strLang, strBoard);
}

function rate_changeType(strLocation, strClientID, strLang)
{
	var objBoard = document.all[strClientID + "_slcSearchBoard"];
	while(objBoard.length > 1)
	{
		objBoard.options[objBoard.length-1] = null;
	}

	var objType = document.all[strClientID + "_slcSearchType"];
	rate_getBoards(strLocation, strClientID, objType[objType.selectedIndex].value, strLang, "");
}

function rate_getBoards(strLocation, strClientID, nTypeID, strLang, strBoard)
{
	var objBoard = document.all[strClientID + "_slcSearchBoard"];
		
	var xmlPath = new ActiveXObject("Microsoft.XMLDOM");
	xmlPath.async = false;
	xmlPath.load(strLocation + "TemplateControls/Rate/GetBoards.aspx?typeID=" + nTypeID + "&lang=" + strLang);

	var nodes = xmlPath.selectNodes("//ROWSET/ROW");
	var node;
	
	while (node = nodes.nextNode()) 
	{
		// get board id
		var id = node.getAttribute("id");
		
		// get board label	
		var children = node.selectNodes("./BOARD_NAME");
		
		var child;
		if (child = children.nextNode()) 
		{
			objBoard.options[objBoard.length] = new Option(child.text, id);
			objBoard.options[objBoard.length-1].title =child.text;
			if (strBoard == id)
			{
				objBoard.options[objBoard.length-1].selected = true;
			}
		}
	}
}

function rate_showRateExplanation(obj, strClientID, nRateID)
{
	var objOpen = document.all[strClientID + "_rate_open_" + nRateID];
	var objClose = document.all[strClientID + "_rate_close_" + nRateID];
	
	if (objOpen.style.display == "")
	{
		objOpen.style.display = "none";
		objClose.style.display = "";
	}
	else
	{
		objClose.style.display = "none";
		objOpen.style.display = "";
	}	
}

function rate_searchMouseOver(obj)
{
	obj.style.cursor = 'hand';
}

function rate_searchMouseOut(obj)
{

}

function rate_searchMousePress(obj, strLocation, strClientID, strLang, nFolderID)
{
	var arrLocation = location.href.split("?");
	var strParams = "";
	
	// get querystring parameters
	strParams += "&lang=" + strLang;
	strParams += "&folderid=" + nFolderID;
	
	// get form parameters
	var strFromDay = "";
	if (document.all[strClientID + "_CalendarFromDate_dateField"])
	{
		strFromDay = document.all[strClientID + "_CalendarFromDate_dateField"].value;
		
		if (strFromDay != "")
		{
			strParams += "&rateFromDate=" + strFromDay;
		}
	}	
	
	
	var strToDay = "";
	if (document.all[strClientID + "_CalendarToDate_dateField"])
	{
		strToDay = document.all[strClientID + "_CalendarToDate_dateField"].value;
		
		if (strToDay != "")
		{
			strParams += "&rateToDate=" + strToDay;
		}
	}	
	
	
	var strType = "";
	if (document.all[strClientID + "_slcSearchType"])
	{
		strType = document.all[strClientID + "_slcSearchType"].value;
		
		if (strType != "" && strType != "0")
		{
			strParams += "&rateType=" + strType;
		}
	}	
	
	
	var strBoard = "";
	if (document.all[strClientID + "_slcSearchBoard"])
	{
		strBoard = document.all[strClientID + "_slcSearchBoard"].value;
		
		if (strBoard != "" && strBoard != "0")
		{
			strParams += "&rateBoard=" + strBoard;
		}
	}	
	
	strParams = strParams.replace("&", "?");
	location.href = strLocation + "Templates/Rate/Rate.SearchResults.aspx" + strParams;
}

function rate_hoursTableMouseOver(obj)
{
	obj.style.cursor = 'hand';
}

function rate_hoursTableMouseOut(obj)
{

}

function rate_hoursTableMousePress(obj, strLocation, nFolderID, strLang)
{
	window.open(strLocation + "Templates/RateLobby/RateLobby.HoursTablePopup.aspx?FolderID=" + nFolderID + "&lang=" + strLang, "HoursTable", "width:100, height:100");
}

function rate_hoursTable_print(obj)
{
	window.print();
}

function rate_hoursTable_close(obj)
{
	window.close();
}


/****************/
/* POPUP		*/
/****************/
function rate_overImage(obj)
{
	obj.src = eval(obj.name + "_On.src");
	obj.style.cursor = 'hand';
}

function rate_outImage(obj)
{
	obj.src = eval(obj.name + "_Off.src");
}

function rate_popup_print_clickImage()
{
	window.print();
}

function rate_popup_close_clickImage()
{
	window.close();
}