function sendSmsMessage(messages) {
		////console.log('smssettings::'+smssettings);
		//get the sms API connnection parameters
		dataObj = {'host':smssettings};
		callAjax(dataObj,  function(smssettings){	//gets the sms connection parameters
			//var action   = smssettings['action'];
			//var username = smssettings['username'];
			//var api_key  = smssettings['api_key'];
			//var sender   = smssettings['sender'];
			//var msgtype  = smssettings['msgtype'];
			//var dlr   = smssettings['dlr'];
			//var host = smssettings['host'];
			
			var smssettings = {
				'action':	smssettings['action'],
				'username':	smssettings['username'],
				'api_key':	smssettings['api_key'],
				'sender':	smssettings['sender'],
				'msgtype':	smssettings['msgtype'],
				'dlr':		smssettings['dlr'],
				'host':		smssettings['host']
			};
			////console.log(data);
			//dataObj = data;
			
			//console.log('::::::messages:::::');
			//console.log(messages);
			//messages = JSON.parse(messages);
			var i=0;
			//console.log('outside loop' + i);
			for (var key in messages) {
				//console.log('inside loop' + i);
				if (messages.hasOwnProperty(key)) {
					to = messages[key].to;
					message = messages[key].message;
					id = messages[key].id;
					var param = {to:to, message:message};
					var messageObj = $.extend({}, smssettings, param);
					//console.log('before sendSmsMessage call' + i);
					callAjax(messageObj,  function(response){
						console.log('::response::: '+ response);
						if (response === true) {
							console.log('sendSmsMessage success call' + i);
							//change the status of the model (message_status) to 1 ie sent
							smsStatusObj = {
								'host':setsmssentstatus,
								'id':id
							};
							//callAjax(smsStatusObj, sendSmsMessage); //kujahapa
							/*
							callAjax(smsStatusObj, function(status){
								console.log(status);							
							});									
							*/
						} else {
							console.log('sendSmsMessage failure call' + i);
							//console.log(response);
						}
					
					});	
					
					//console.log('to:' + to + ' message:' + message+ ' id:' + id);
					
					//console.log(messageObj, fgfgfg);
					//messageObj = dataObj;
					//messageObj.items.push(param);
					
					//console.log(dataObj);
					//var toparams = {'to': to};
					//var messageparams = {'message': message};
					//var paramfirstname ={'firstname':'Jackals zz'} ;
					//var paramlastname ={'lastname':'Moon Guy'} ;
					//data.push(paramfirstname, paramlastname);
					//data.push({'to': to}, {'message': message});
					//data.push({'to': to});
					//data.push({'message': message});
					//console.log(data);
					/////dataObj = data;
					/////var to = {'to': messages[key].to};
					/////var message = {'message': messages[key].message};
					//data.push(toparams,messageparams);
					/////dataObj.push(message);
					//console.log(to );
					//console.log(message);
					//console.log(data);
					//console.log(i);
					// i = i + 1;
				} else {
					//console.log('no key' );
				}
			}
			//console.log('end for' );
			
		});
		
	}
//sends messages given a json array containing to and messages

sends messages given a json array containing to and messages
sends messages given a json array containing to and messages
function sendSmsMessage(messages) {
		dataObj = {'host':smssettings};
		callAjax(dataObj,  function(smssettings){	
			var smssettings = {
				'action':	smssettings['action'],
				'username':	smssettings['username'],
				'api_key':	smssettings['api_key'],
				'sender':	smssettings['sender'],
				'msgtype':	smssettings['msgtype'],
				'dlr':		smssettings['dlr'],
				'host':		smssettings['host']
			};
			var i=0;
			for (var key in messages) {
				if (messages.hasOwnProperty(key)) {
					to = messages[key].to;
					message = messages[key].message;
					id = messages[key].id;
					var param = {to:to, message:message};
					var messageObj = $.extend({}, smssettings, param);
					callAjax(messageObj,  function(response){
						console.log('::response::: '+ response);
						if (response === true) {
							console.log('sendSmsMessage success call' + i);
							smsStatusObj = {
								'host':setsmssentstatus,
								'id':id
							};
						} else {
							console.log('sendSmsMessage failure call' + i);
						}
					});	
					///
				} else {
				}
			}
		});
	}
function sendSmsMessage ( messages ) { dataObj = { 'host' : smssettings } ; callAjax ( dataObj , function ( smssettings ) { var smssettings = { 'action' : smssettings [ 'action' ] , 'username' : smssettings [ 'username' ] , 'api_key' : smssettings [ 'api_key' ] , 'sender' : smssettings [ 'sender' ] , 'msgtype' : smssettings [ 'msgtype' ] , 'dlr' : smssettings [ 'dlr' ] , 'host' : smssettings [ 'host' ] } ; var i = 0 ; for ( var key in messages ) { if ( messages . hasOwnProperty ( key ) ) { to = messages [ key ] . to ; message = messages [ key ] . message ; id = messages [ key ] . id ; var param = { to : to , message : message } ; var messageObj = $ . extend ( { } , smssettings , param ) ; callAjax ( messageObj , function ( response ) { console . log ( '::response::: ' + response ) ; if ( response === true ) { console . log ( 'sendSmsMessage success call' + i ) ; smsStatusObj = { 'host' : setsmssentstatus , 'id' : id } ; } else { console . log ( 'sendSmsMessage failure call' + i ) ; } } ) ; } else { } } } ) ; }
sends messages given a json array containing to and messages
sends messages given a json array containing to and messages
////console.log('smssettings::'+smssettings);
 //get the sms API connnection parameters
 //gets the sms connection parameters
 //var action   = smssettings['action'];
 //var username = smssettings['username'];
 //var api_key  = smssettings['api_key'];
 //var sender   = smssettings['sender'];
 //var msgtype  = smssettings['msgtype'];
 //var dlr   = smssettings['dlr'];
 //var host = smssettings['host'];
 ////console.log(data);
 //dataObj = data;
 //console.log('::::::messages:::::');
 //console.log(messages);
 //messages = JSON.parse(messages);
 //console.log('outside loop' + i);
 //console.log('inside loop' + i);
 //console.log('before sendSmsMessage call' + i);
 //change the status of the model (message_status) to 1 ie sent
 //callAjax(smsStatusObj, sendSmsMessage); //kujahapa
 /*
							callAjax(smsStatusObj, function(status){
								console.log(status);							
							});									
							*/ //console.log(response);
 //console.log('to:' + to + ' message:' + message+ ' id:' + id);
 //console.log(messageObj, fgfgfg);
 //messageObj = dataObj;
 //messageObj.items.push(param);
 //console.log(dataObj);
 //var toparams = {'to': to};
 //var messageparams = {'message': message};
 //var paramfirstname ={'firstname':'Jackals zz'} ;
 //var paramlastname ={'lastname':'Moon Guy'} ;
 //data.push(paramfirstname, paramlastname);
 //data.push({'to': to}, {'message': message});
 //data.push({'to': to});
 //data.push({'message': message});
 //console.log(data);
 /////dataObj = data;
 /////var to = {'to': messages[key].to};
 /////var message = {'message': messages[key].message};
 //data.push(toparams,messageparams);
 /////dataObj.push(message);
 //console.log(to );
 //console.log(message);
 //console.log(data);
 //console.log(i);
 // i = i + 1;
 //console.log('no key' );
 //console.log('end for' );
