function test(ads){
alert(ads);
}

function ajaxBox(txtTitle,url){
	//alert('asd');
	loading('<h1 style="color:#000;">Get data...</h1>');
	jQuery.get(url,{ }, function(html) {
		   setAjaxBox(txtTitle,html);
	});
}

function loading(txt){
	
	notif = new Boxy('<div id="load" style="text-align:center">'+txt+'</div>', {
                modal: true,unloadOnHide:true
              });
	notif.show();
}


function showPopUp(txtTitle,content,modal){
	modal = modal?true:false;
	notif = new Boxy(content, {
                title:txtTitle,modal: modal,unloadOnHide:true,closeText:'[x] Close'
              });
	notif.show();
}

function hidePopUp(){
	notif.hide();
}



function setAjaxBox(txtTitle,html){
	notif.hide();
	//jQuery('#loading_content').html("");
	showPopUp(txtTitle,html,true);
}

function submitCallTrack(url){
	jQuery("#loading").html('Submiting data...');
	
  var code_call_track = "";
  // get all the inputs into an array.
   var jQueryinputs = jQuery('#FmCalltrack select');

   // not sure if you wanted this, but I thought I'd add it.
   // get an associative array of just the values.
   var values = {};
   jQueryinputs.each(function(i, el) {
       values[el.name] = jQuery(el).val();
       code_call_track = (jQuery(el).val());
   });

	notelp = jQuery('input[name=notelp]:checked').val();
	
	jQuery.post(url,{ 
								id_callcode : code_call_track,
								notelp : notelp,
								begin_call_time : jQuery('#begin_call_time').val(),
								end_call_time : jQuery('#end_call_time').val(),
								total_call_time : jQuery('#total_call_time').val(),
								idle_call_time : jQuery('#idle_call_time').val(),
								remark : jQuery('#remark').val(),
								group_code : jQuery('#group_code').val(),
								post : true
							}, function(html) {
			   			setSubmitCallTrack(html);
		});
}

function setSubmitCallTrack(html){
	jQuery("#loading").html('Data tersimpan.');
	jQuery("#list_call_track").append(html);
}

function optionCodeCallTrack(url,opt,opt_main){
	jQuery.post(url,{ }, function(html) {
			   			setOptionCodeCallTrack(html,opt,opt_main);
		});
}

function setOptionCodeCallTrack(html,opt,opt_main){
	element = jQuery("#"+opt).html();		
	if(element==null){	
		add_element = '<span id="'+opt+'">'+html+'<option>';
		jQuery("#"+opt_main).html(add_element);
	}else{
		jQuery("#"+opt_main).html(html);
	}
	
	
	
	
}

function changeValue(namecheck,name,value,type,lastValue){
	check = jQuery('#'+namecheck).attr('checked'); 
	if(check==true){
		jQuery('input[name="'+name+'"]').val(value);
	}
	else{
		jQuery('input[name="'+name+'"]').val(lastValue);
	}
}

function submitNotelp(url){
	jQuery("#loading").html('Submiting data...');
	
 	jQuery.post(url,{ 
								remark : jQuery('#remark').val(),
								notelp : jQuery('#notelp').val(),
								post : true
							}, function(html) {
			   			setNotelp(html);
		});
}

function setNotelp(html){
	jQuery("#loading").html('Data tersimpan.');
	jQuery("#list_notelp").append(html);
}

function submitReminder(url){
	jQuery("#loading").html('Submiting data...');
	
 jQuery.post(url,{ 
								remark : jQuery('#remark').val(),
								re_date : jQuery('#re_date').val(),
								re_time : jQuery('#re_time').val(),
								post : true
							}, function(html) {
			   			setReminder(html);
		});
}

function setReminder(html){
	jQuery("#loading").html('Data tersimpan.');
	jQuery("#list_reminder").append(html);
}

function updateReminder(url){
	jQuery.post(url,{ 
										}, function(html) {
			   			setUpdateReminder(html);
		});
	setTimeout("updateReminder('"+url+"')", 3000);
}

function setUpdateReminder(html){
	if(html!=""){
		showPopUp('Reminder Alert',html,true)
	}
	return false;
}