	//
	// Function: doChangeView
	// 
	// Abstract: 
	//		This function show the list by distributors or 
	//		by Manufacturers and Reps
	//
	// Arguments:
	//		n/a
	//
	// Created:	 
	//		08/17/2005	by	Tessa Phan
	//
	// Modification History:
	//		mm/dd/yyyy	developer
	//			description
	//
	function doChangeView(ParentPath, URL) {
		var pgName;
		var strQueryString;
		var bolShowDist = document.frmFilter.ViewBy[document.frmFilter.ViewBy.selectedIndex].value;
		var strOldQueryString = window.location.search;
	
		if (strOldQueryString.length > 1)
			strQueryString = ParseQueryString(strOldQueryString, "viewby", bolShowDist);
		else
			strQueryString = "viewby=" + bolShowDist;
		
		if (ParentPath.length > 1) 
			pgName = ParentPath + "/Distributors.asp?"
		else
			pgName = "Distributors.asp?"
		
		if (URL.length > 1)
			document.frmFilter.action = pgName + URL + "&viewby=" + bolShowDist;
		else
			document.frmFilter.action = pgName + strQueryString;
		
		document.frmFilter.method = "post";
		document.frmFilter.target = "_self";
		document.frmFilter.submit();
	}

	//
	// Function: doChangeFilter
	// 
	// Abstract: 
	//		This function filters the list by the locations of 
	//		the distributors or the Manufacturers and Reps
	//
	// Arguments:
	//		n/a
	//
	// Created:	 
	//		08/30/2005	by	Tessa Phan
	//
	// Modification History:
	//		mm/dd/yyyy	developer
	//			description
	//
	function doChangeFilter(ParentPath, URL) {
		var intRegion = "";
		var ValidChars = "0123456789";
		var pgName = "";
		var strQueryString;
		
		var strFilterLoc = document.frmFilter.filterLoc[document.frmFilter.filterLoc.selectedIndex].value;

		document.frmFilter.hidFilterValue.value = document.frmFilter.filterLoc[document.frmFilter.filterLoc.selectedIndex].text;

		var strOldQueryString = window.location.search;

		// check if the first character of the filterloc value is a numeric
		var Char = strFilterLoc.charAt(0);
		if (ValidChars.indexOf(Char) > -1) {
			intRegion = Char;
			if (Char == 1) {
				// check if the next character of the filterloc value is a numeric
				Char = strFilterLoc.charAt(1);
				if (ValidChars.indexOf(Char) > -1) 
					intRegion = intRegion + Char;
			}
			if (strOldQueryString.length > 1) {
				strQueryString = ParseQueryString(strOldQueryString, "regid", intRegion);
			}
			else {
				strQueryString = "regid=" + intRegion;
			}
			strOldQueryString = strQueryString;
		}

		if (strOldQueryString.length > 1)
			strQueryString = ParseQueryString(strOldQueryString, "locfilter", strFilterLoc);
		else
			strQueryString = "locfilter=" + strFilterLoc;
		
		if (ParentPath.length > 1) 
			pgName = ParentPath + "/Distributors.asp?"
		else
			pgName = "Distributors.asp?"
		
		if (URL.length > 1)
			document.frmFilter.action = pgName + URL + "&locfilter=" + strFilterLoc;
		else
			document.frmFilter.action = pgName + strQueryString;
		
		document.frmFilter.method = "post";
		document.frmFilter.target = "_self";
		document.frmFilter.submit();
	}

	//
	// Function: doSort
	// 
	// Abstract: 
	//		This function sorts the distributor list .
	//
	// Arguments:
	//		pstrSort	- The sort type by.
	//
	// Created:	 
	//		08/17/2005	by	Tessa Phan
	//
	// Modification History:
	//		mm/dd/yyyy	developer
	//			description
	//
    function doSort(pstrSort, URL)
    {
		var strQueryString;
		var strSort;
		var PgName;
			
		var strOldQueryString = window.location.search;
		var strOldSort = "<%=strSortBy%>";
		
		if (pstrSort == "Dist") {
			if (strOldSort == "D")
				strSort = "E";
			else
				strSort = "D";
		}
		else if (pstrSort == "Auth") {
			strSort = "F";
		}
		else if (pstrSort == "Loc") {
			if (strOldSort == "L")
				strSort = "M";
			else
				strSort = "L";
		}
	
		if (strOldQueryString.length > 1)
			strQueryString = ParseQueryString(strOldQueryString, "sort", strSort);
		else
		{
			strQueryString = URL;
			strQueryString = strQueryString + "&sort=" + strSort;
		}
		
		pgName = "Distributors.asp?"

		document.frmFilter.action = pgName + strQueryString;
		document.frmFilter.method = "post";
		document.frmFilter.target = "_self";
		document.frmFilter.submit();
    }
    
    	//
	// Function: doSort
	// 
	// Abstract: 
	//		This function sorts the distributor list .
	//
	// Arguments:
	//		pstrSort	- The sort type by.
	//
	// Created:	 
	//		08/17/2005	by	Tessa Phan
	//
	// Modification History:
	//		mm/dd/yyyy	developer
	//			description
	//
    function doAuthSort(ParentPath, pstrSort, URL)
    {
		var strQueryString;
		var strSort;
		var PgName;
			
		var strOldQueryString = window.location.search;
		var strOldSort = "<%=strSortBy%>";
		
		if (pstrSort == "Dist") {
			if (strOldSort == "D")
				strSort = "E";
			else
				strSort = "D";
		}
		else if (pstrSort == "Auth") {
			strSort = "F";
		}
		else if (pstrSort == "Loc") {
			if (strOldSort == "L")
				strSort = "M";
			else
				strSort = "L";
		}
	
		if (strOldQueryString.length > 1)
			strQueryString = ParseQueryString(strOldQueryString, "sort", strSort);
		else
		{
			strQueryString = URL;
			strQueryString = strQueryString + "&sort=" + strSort;
		}
		
		if (ParentPath.length > 1) 
			pgName = ParentPath + "/Distributors.asp?"
		else
			pgName = "Distributors.asp?"

		document.frmFilter.action = pgName + strQueryString;
		document.frmFilter.method = "post";
		document.frmFilter.target = "_self";
		document.frmFilter.submit();
    }
	

function showHideDiv(divId)
{
	var styleobj = document.getElementById(divId).style;
			
	if (styleobj.display == "none")
		styleobj.display = "";
	else 
		styleobj.display = "none";
		
}


