


	function emptySearch() 
	{
		if (document.sitesearch.keyword.value == "Keyword Search"  || document.sitesearch.keyword.value == "mot(s)-clé(s) ici") 
			{
				document.sitesearch.keyword.value = "";
			}
	}

	function CheckGiftFinderInput()
	{
		if (document.giftfinder.person.value != "" && document.giftfinder.priceRange.value != "")
		{
			document.giftfinder.action = document.giftfinder.ActionString.value + "&PCName=" + document.giftfinder.person.value;
			var priceRange = document.giftfinder.priceRange.value.split("_");
			if (priceRange.length == 2)
			{
				document.giftfinder.MinPrice.value = priceRange[0];
				document.giftfinder.MaxPrice.value = priceRange[1];
			}
			document.giftfinder.submit();
									
			return true;
		}
		else
		{
			return false;
		}
	}

	function CheckInputValue()
	{
		if (noSearch())
		{	return true;	}
		else
		{	return false;	}
	}

	function noSearch()
	{
	// Return false if keyword field is blank as well as all other fields
	if (document.sitesearch.keyword.value == "" || document.sitesearch.keyword.value == "Keyword Search" || document.sitesearch.keyword.value == "mot(s)-clé(s) ici" ) 
		{
		document.sitesearch.keyword.value = "";
		alert(document.sitesearch.FillOne.value);
		document.sitesearch.keyword.focus();
		return false;
		}
	else
		{
		return true;
		}
	}




function isAllRight()
{
	//document.search.CatID.value = document.search.SubCategory.value;
	if ((noAdvancedSearch()) && (isPrice()) && (isPrice2()))
	{	return true;	}
	else
	{	return false;	}
}

function noAdvancedSearch()
{
 // Return false if keyword field is blank as well as all other fields
 if (document.search.Keyword.value == "" && document.search.Manufacturer.value == "" 
    && document.search.PartNumber.value == "" && document.search.MinPrice.value == "" 
    && document.search.MaxPrice.value == "" && document.search.FSSKU.value == "")
    {
    if (document.search.Director !=null) 
	{ 
		if (document.search.Director.value != "") 
		{
			return true;
		}
	}
    if (document.search.SongTitle !=null) 
	{ 
		if (document.search.SongTitle.value != "") 
		{
			return true;
		}
	}
	alert(document.search.FillOne.value);
	return false;
	}
 else
{
return true;
}
}
function isPrice()
 {
 var str = document.search.MinPrice.value;
 // Return false if price fields contain text
 if (str != "")
 {
 // Return false if not characters,$,comma,period
 for (var i = 0; i < str.length; i++)
{
var ch = str.substring(i, i + 1);
if ((ch < "0" || "9" < ch) && ch != '.' && ch != '$' && ch != ',' && ch != ' ')
 {
 alert(document.search.NoLetters.value);
 document.search.MinPrice.select();
 document.search.MinPrice.focus();
 return false;
 }
}
 }
 return true;
}
function isPrice2()
 {
 var str = document.search.MaxPrice.value;
 // Return false if price fields contain text
 if (str != "")
 {
 // Return false if text
 for (var i = 0; i < str.length; i++)
{
var ch = str.substring(i, i + 1);
if ((ch < "0" || "9" < ch) && ch != '.' && ch != '$' && ch != ',' && ch != ' ')
 {
 alert(document.search.NoLetters.value);
 document.search.MaxPrice.select();
 document.search.MaxPrice.focus();
 return false;
 }
}
 }
 return true;
}


function Refresh2(a)
{
	/*only pass the values that are constant for all departments becuase they are always visible and the customer can change
	/ them if they want. Don't pass dept specific fields (Director/Label, MfgPartNumber/Actor/Artist, SongTitle/Studio, 
	/ TitleExactPhrase) because when the fields aren't visible the values can't be removed and are always part of the next 
	/ search and can cause the search to find no results*/
	var index = document.search.Category.selectedIndex;
	var value = document.search.Category.options[index].value;
	var query = 'Keyword='+escape(document.search.Keyword.value)+'&Manufacturer='+escape(document.search.Manufacturer.value);
	query = query + '&MinPrice='+escape(document.search.MinPrice.value) + '&MaxPrice=' + escape(document.search.MaxPrice.value);
	query = query + '&FSSKu='+escape(document.search.FSSKU.value) + '&MatchExactPhrase=' + escape(document.search.MatchExactPhrase.value);
	query = query + '&KeywordSearchType=' + escape(document.search.KeywordSearchType.value);
	query = query+'&catid=' + escape(value);
	
	return query;

}


