//var BASEPATH = "http://trip2bd.com/";
/*	document.write("<script type='text/javascript' src='js_/js_library.js'> </script>");

function waitingIndicatorText()
{
	return "<div align='center' class='waitingColor'>Wait a moment...<br /><img src='" + BASEPATH + "images/indicator.gif' alt='IMG' /></div>";
}
*/


function showSearchResult_ajax(lmt_start)
{
		clearResults();
	 $("#resultId").prepend(waitingIndicatorText()); 
	 
	 																																																																														$.post("./common/searchResult_ajax.php",{  tripGroupId:$("#tripGroupId").val(), tripTypeId:$("#tripTypeId").val(), districtId:$("#districtId").val(), thanaId:$("#thanaId").val(), locationId:$("#locationId").val(), companyId:$("#companyId").val(), searchTxt:$("#searchTxt").val(), lmt_start:lmt_start }, function(xml) 																																																																												  	{
			
		if(xml.length < 900)																											    
		{
			showOtherSourceLink(true);
			$("#resultId").html('');																		     
		}
		else
		{
			 showOtherSourceLink(false);
			$("#resultId").html(xml);
		 }
			
	});
} 




function showTripInfoByGroupId()
{
	$("#tripListId").html("<select name='tripTypeId' id='tripTypeId'  ><option value='0'>Wait...</option>");
	$.post("./common/tripTypeInfo_list.php",{  tripGroupId:$("#tripGroupId").val() }, function(xml) {
																												
		$("#companyListId").html("<select name='companyId' id='companyId' ><option value='0'>...</option>");
		$("#tripListId").html(xml);
		
	});
	
} 


function showCompanyInfo()
{
	$("#companyListId").html("<select name='companyId' id='companyId' ><option value='0'>Wait...</option>");
	$.post("common/companyInfo_list.php",{  tripTypeId:$("#tripTypeId").val() }, function(xml) {
		$("#companyListId").html(xml);
	});
	
} 

function showThanaInfoByDistrictId(url)
{
	$("#thanaInfoId").html("<select name='locationId' id='locationId'  ><option value='0'>Wait...</option>");
	$.post(url,{  districtId:$("#districtId").val() }, function(xml) {
		$("#locationInfoId").html("<select name='locationId' id='locationId' ><option value='0'>... </option></select>");
		$("#thanaInfoId").html(xml);
	});
}

function showLocationByThanaId_fresh()
{
	$("#locationInfoId").html("<select name='locationId' id='locationId' ><option value='0'>Wait... </option></select>");
		
	$.post("common/locationInfo_list_fresh.php",{  thanaId:$("#thanaId").val() }, function(xml) {
		$("#locationInfoId").html(xml);
	});
} 



function updateMsg(source) { 
   
     
	
	 $("#resultId").prepend(waitingIndicatorText()); 
     $.post(source,{ }, function(xml) { 
	   $("#resultId").html(xml); 
     }); 
     
   } 


 function sendEmail() 
  { 
  
  	$("#sendId").html("Wait ....");
  	 var message = $('textarea#emailMsg').val();
	 var sender = $("#sender").val();
	 if (sender == "")
	 {
		$("#sendId").html("Type your Name"); 
     	return false;
	 }
  	 $("#sendId").prepend(waitingIndicatorText()); 
     $.post("email/email_process.php",{ tos: $("#tos").val(), message:message, sender:sender }, function(xml)
	 { 
	   $("#sendId").html(xml); 
     }); 
     
   } 
   
   
  function getSMSId() 
  { 
  	  
     var msg = $("#message").val();
	 var from = $("#from").val();
	 
		if(msg.length > 148)
		{
			$('#smsRequestId').html("SMS length is " + msg.length + ". It should be maximum 148");
		}
		else if(from.length != 11)
		{
			$('#smsRequestId').html("Please enter valid Mobile Number");
		}
		else
		{
			$("#smsRequestId").prepend(waitingIndicatorText());
			 $.post("websms/sms_process.php", {message:msg, from:from }, function(xml)
			{			  
				$('#smsRequestId').html(xml);
			});
		}
   } 
   
   
function getSMSLength() 
{ 
	 var msg = $("#message").val();
	 var len =  msg.length;
	 
	$('#smsRequestId').empty();
	 if(len > 148)
	{
		$('#smsLengthId').html("SMS length is " + msg.length + " out of 148");
	}
	if(len == 148)
	{
			
		$('#smsLengthId').html("Valid");
	}
	else
	{
		$('#smsLengthId').html("Remaining SMS char : "+ (148 - len));
	}
}

function getMobileLength() 
{ 
	 var msg = $("#from").val();
	 var len =  msg.length;
 	$('#smsRequestId').empty();
	
	if(len < 11)
	{
	 	$('#mobileNoId').html("Remaining char : "+ (11 - len));
		
	}
	else if(len == 11) 
	{
	 	$('#mobileNoId').html("Valid");
		
	}
	if(len > 11)
	{
		$('#mobileNoId').html("Length is " + msg.length + " out of 11");
	}
	
}

function clearSMS()
{
	$('#message').empty();
	$('#from').empty();
	$('#smsLengthId').html("Type SMS Text :");
	$('#mobileNoId').html("Type Mobile No :");
	$('#smsRequestId').empty();

}
