

// JavaScript Document
function limitText(limitField, limitCount, limitNum) {
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} else {
		limitCount.value = limitNum - limitField.value.length;
	}
}

function hotel(task)
{

var error = '';

	if(task == 'saveRecode' || task == 'editRecode')
	{
	var ht_name = document.hotelSubmitFrm.ht_name.value;
	var ht_dis = document.hotelSubmitFrm.ht_dis.value;
	//var ht_city = document.hotelSubmitFrm.ht_city.value;
	var ht_address = document.hotelSubmitFrm.ht_address.value;
	var ht_tp = document.hotelSubmitFrm.ht_tp.value;
	var ht_email = document.hotelSubmitFrm.ht_email.value;
	var ht_web = document.hotelSubmitFrm.ht_web.value;
	var ht_shortDes = document.hotelSubmitFrm.ht_shortDes.value;
	var ht_longDes = document.hotelSubmitFrm.ht_longDes.value;
	var hotelImg = document.hotelSubmitFrm.hotelImg.value;
	
		if(ht_name == '')
		{
			error +='Please Type hotel Name \n';
		}
		/*
		if(ht_city == '')
		{
			error +='Please Type Near City Name \n';
		}*/
	}


	if(error == '')
	{
		if (task != '')
			{
				
				if(task == 'editRecode')
				{
					reSend = 'editRecode';
				}
				else
				{
					reSend = 'saveRecode';
				}
			  document.hotelSubmitFrm.action = '?task='+ reSend;
			  document.hotelSubmitFrm.submit();
			
			}
	}
	else
	{
		alert(error);
	}
}

//*redirect to index page
function cancel()
{
	  location.href = 'index.php';
}

function selectCity()
{
		
	var midDiv = document.getElementById('midDivCity');
	
	var viName = document.hotelSubmitFrm.ht_city.value;
	
	
	
        
		new Ajax.Request('modules/region/region_html.php',
		{
			method:'POST',parameters: {vi_Name: viName},
			onLoading: function()
			{
                            midDiv.innerHTML = "Please wait... ";
							
							
			},
			onSuccess: function(transport)
			{
			
				var response = transport.responseText;
                               //alert(response);
				
                                   
                                    midDiv.innerHTML = "<span class=searchPHPGreen>"+ response  +"</span>";
                                    
                                   
                                  
								

			},
			
		
			onFailure: function(){ alert('Something went wrong...') }


		});
}


function setVal(vi,mapId)
{
		
	document.hotelSubmitFrm.ht_city.value = vi;
	document.hotelSubmitFrm.ht_city_id.value = mapId;
	
	
}	


