// JavaScript Document
SiteAjaxFolder   = "ajax/";
function GetRestaurantName(strText,strLayer,strTextFieldName){
		var Keyword = trim(strText.value);
		if(Keyword.length>=3){
			var AjaxFilename = SiteAjaxFolder+'restaurant.php';
			var success 	 = function(t){GetRestaurantNameComplete(t,strLayer,strTextFieldName);}
			var failure 	 = function(t){ShowOnFailure(t);}
			var url 		 = AjaxFilename;
			var pars 		 = 'page=getRestaurantByKeyword&Keyword='+Keyword+"&type=resname";	
			var myAjax 		 = new Ajax.Request(url, {method:'post',postBody:pars, onSuccess:success, onFailure:failure});
		}
}

function GetRestaurantNameComplete(t,strLayerName,strTextFieldName){
		if(t.responseText != '')	{
				$(strLayerName).innerHTML     	= t.responseText;
				$("LayerID").value				= strLayerName;
				$("TextFieldValue").value		= strTextFieldName;
				setLayerDivIds('dhtmlgoodies_scrolldiv_resname','scrolldiv_parentContainer_resname','scrolldiv_theScroll_resname','scrolldiv_scrollbar_resname','scrolldiv_slider_resname','scrolldiv_content_resname','scrolldiv_scrollUp_resname','scrolldiv_scrollDown_resname');
				Slide($(strLayerName)).slideDown("slow");	
				scrolldiv_setColor('#FFFFFF');	// Setting border color of the scrolling content
				//setSliderBgColor('#E2EBED');	// Setting color of the slider div
				setContentBgColor('#FFFFFF');	// Setting color of the scrolling content
				setScrollButtonSpeed(1);	// Setting speed of scrolling when someone clicks on the arrow or the slider
				setScrollTimer(5);	// speed of 1 and timer of 5 is the same as speed of 2 and timer on 10 - what's the difference? 1 and 5 will make the scroll move a little smoother.
				scrolldiv_setWidth(300);	// Setting total width of scrolling div
				scrolldiv_setHeight(130);	// Setting total height of scrolling div
				scrolldiv_initScroll();	// Initialize javascript functions
		}
}
function setRestaurantName(strValue)	{
	ChangeRestaurantDisplay('Close');
	$('frm_only_restaurant_name').value = stripslashes(strValue);
	if(document.getElementById("SelectedResID"))
		document.getElementById("SelectedResID").value = strID
}

function ChangeRestaurantDisplay(DisplayOnly){
	if(DisplayOnly == "Close"){
		$('RestaurantAddress').style.display = "none";
		Slide($('RestaurantAddress')).slideUp("slow");
	}
}

function GetRestaurantCityState(strText,strLayer,strTextFieldName){
		var Keyword = trim(strText.value);
		if(Keyword.length>=3){
			var AjaxFilename = SiteAjaxFolder+'keyword.php';
			var success 	 = function(t){GetRestaurantCityStateComplete(t,strLayer,strTextFieldName);}
			var failure 	 = function(t){ShowOnFailure(t);}
			var url 		 = AjaxFilename;
			var pars 		 = 'op=getcitystate&Keyword='+Keyword+"&type=resstate";	
			var myAjax 		 = new Ajax.Request(url, {method:'post',postBody:pars, onSuccess:success, onFailure:failure});
		}
}

function GetRestaurantCityStateComplete(t,strLayerName,strTextFieldName){
		if(t.responseText != '')	{
			$(strLayerName).innerHTML     	= t.responseText;	
			$("LayerID").value				= strLayerName;
			$("TextFieldValue").value		= strTextFieldName;
			setLayerDivIds('dhtmlgoodies_scrolldiv_rescity','scrolldiv_parentContainer_rescity','scrolldiv_theScroll_rescity','scrolldiv_scrollbar_rescity','scrolldiv_slider_rescity','scrolldiv_content_rescity','scrolldiv_scrollUp_rescity','scrolldiv_scrollDown_rescity');

			Slide($(strLayerName)).slideDown("slow");	
		
			scrolldiv_setColor('#FFFFFF');	// Setting border color of the scrolling content
			setContentBgColor('#FFFFFF');	// Setting color of the scrolling content
			setScrollButtonSpeed(1);	// Setting speed of scrolling when someone clicks on the arrow or the slider
			setScrollTimer(5);	// speed of 1 and timer of 5 is the same as speed of 2 and timer on 10 - what's the difference? 1 and 5 will make the scroll move a little smoother.
			scrolldiv_setWidth(300);	// Setting total width of scrolling div
			scrolldiv_setHeight(130);	// Setting total height of scrolling div
			scrolldiv_initScroll();	// Initialize javascript functions
		}
}


function setCityStateValue(strValue)	{
	ChangeStateCityDisplay('Close');
	$('frm_only_restaurant_state_city').value = stripslashes(strValue);
	if(document.getElementById("SelectedResID"))
		document.getElementById("SelectedResID").value = strID
	
}
function ChangeStateCityDisplay(DisplayOnly){
	if(DisplayOnly == "Close"){
		$('ResAddress').style.display = "none";
		Slide($('ResAddress')).slideUp("slow");
	} 
}

function GetRestaurantNameAlso(strText,strLayer,strTextFieldName){
		var Keyword = trim(strText.value);
		if(Keyword.length>=3){
			var AjaxFilename = SiteAjaxFolder+'restaurant.php';
			var success 	 = function(t){GetRestaurantNameAlsoComplete(t,strLayer,strTextFieldName);}
			var failure 	 = function(t){ShowOnFailure(t);}
			var url 		 = AjaxFilename;
			var pars 		 = 'page=getRestaurantByKeyword&Keyword='+Keyword+"&type=resnameonly";	
			var myAjax 		 = new Ajax.Request(url, {method:'post',postBody:pars, onSuccess:success, onFailure:failure});
		}
}

function GetRestaurantNameAlsoComplete(t,strLayerName,strTextFieldName){
		if(t.responseText != '')	{
				$(strLayerName).innerHTML     	= t.responseText;
				$("LayerID").value				= strLayerName;
				$("TextFieldValue").value		= strTextFieldName;
				setLayerDivIds('dhtmlgoodies_scrolldiv_resname_also','scrolldiv_parentContainer_resname_also','scrolldiv_theScroll_resname_also','scrolldiv_scrollbar_resname_also','scrolldiv_slider_resname_also','scrolldiv_content_resname_also','scrolldiv_scrollUp_resname_also','scrolldiv_scrollDown_resname_also');
				Slide($(strLayerName)).slideDown("slow");	
				scrolldiv_setColor('#FFFFFF');	// Setting border color of the scrolling content
				//setSliderBgColor('#E2EBED');	// Setting color of the slider div
				setContentBgColor('#FFFFFF');	// Setting color of the scrolling content
				setScrollButtonSpeed(1);	// Setting speed of scrolling when someone clicks on the arrow or the slider
				setScrollTimer(5);	// speed of 1 and timer of 5 is the same as speed of 2 and timer on 10 - what's the difference? 1 and 5 will make the scroll move a little smoother.
				scrolldiv_setWidth(300);	// Setting total width of scrolling div
				scrolldiv_setHeight(130);	// Setting total height of scrolling div
				scrolldiv_initScroll();	// Initialize javascript functions
		}
}
function setRestaurantNameAlso(strValue)	{
	ChangeRestaurantDisplayAlso('Close');
	$('frm_restaurant_name').value = stripslashes(strValue);
	if(document.getElementById("SelectedResID"))
		document.getElementById("SelectedResID").value = strID
}

function ChangeRestaurantDisplayAlso(DisplayOnly){
	if(DisplayOnly == "Close"){
		$('ResNameAlso').style.display = "none";
		Slide($('ResNameAlso')).slideUp("slow");
	}
}

function GetRestaurantCityStateAlso(strText,strLayer,strTextFieldName){
		var Keyword = trim(strText.value);
		if(Keyword.length>=3){
			var AjaxFilename = SiteAjaxFolder+'keyword.php';
			var success 	 = function(t){GetRestaurantCityStateAlsoComplete(t,strLayer,strTextFieldName);}
			var failure 	 = function(t){ShowOnFailure(t);}
			var url 		 = AjaxFilename;
			var pars 		 = 'op=getcitystate&Keyword='+Keyword+"&type=resstatealso";	
			var myAjax 		 = new Ajax.Request(url, {method:'post',postBody:pars, onSuccess:success, onFailure:failure});
		}
}

function GetRestaurantCityStateAlsoComplete(t,strLayerName,strTextFieldName){
		if(t.responseText != '')	{
			$(strLayerName).innerHTML     	= t.responseText;	
			$("LayerID").value				= strLayerName;
			$("TextFieldValue").value		= strTextFieldName;
			setLayerDivIds('dhtmlgoodies_scrolldiv_rescity_also','scrolldiv_parentContainer_rescity_also','scrolldiv_theScroll_rescity_also','scrolldiv_scrollbar_rescity_also','scrolldiv_slider_rescity_also','scrolldiv_content_rescity_also','scrolldiv_scrollUp_rescity_also','scrolldiv_scrollDown_rescity_also');

			Slide($(strLayerName)).slideDown("slow");	
		
			scrolldiv_setColor('#FFFFFF');	// Setting border color of the scrolling content
			setContentBgColor('#FFFFFF');	// Setting color of the scrolling content
			setScrollButtonSpeed(1);	// Setting speed of scrolling when someone clicks on the arrow or the slider
			setScrollTimer(5);	// speed of 1 and timer of 5 is the same as speed of 2 and timer on 10 - what's the difference? 1 and 5 will make the scroll move a little smoother.
			scrolldiv_setWidth(300);	// Setting total width of scrolling div
			scrolldiv_setHeight(130);	// Setting total height of scrolling div
			scrolldiv_initScroll();	// Initialize javascript functions
		}
}


function setCityStateValueAlso(strValue)	{
	ChangeStateCityDisplayAlso('Close');
	$('frm_restaurant_state_city').value = stripslashes(strValue);
	if(document.getElementById("SelectedResID"))
		document.getElementById("SelectedResID").value = strID
	
}
function ChangeStateCityDisplayAlso(DisplayOnly){
	if(DisplayOnly == "Close"){
		$('ResAddressAlso').style.display = "none";
		Slide($('ResAddressAlso')).slideUp("slow");
	} 
}

function ShowOnFailure(t)	{
	alert(t.responseText);	
}
