/**
 * @author edsadr
 */
$(function(){
	$("#accordion").accordion({ header: "h3" });
	$("#countries tr:odd").addClass("rowa");
	$("#countries tr:even").addClass("rowb");
 	var theTable = $('#countries');
	
	$("#countryfilter").keyup(function() {
	    $.uiTableFilter( theTable, this.value );
	 });

	$("#accordionc").accordion({ header: "h3" });
	$("#categories tr:odd").addClass("rowa");
	$("#categories tr:even").addClass("rowb");
 	var otherTable = $('#categories');
	
	$("#catfilter").keyup(function() {
	    $.uiTableFilter( otherTable, this.value );
	 });

});

function updateDetails(detail,source){
	$.post('services/service_details.php',
		{
			details: detail,
			source: 1
		},
		function(data){
			if(data!='1'){
				alert(data);
			}
		}
	);
}

function saveDetails(){
	$.post('services/service_details.php',
		{
			save: 1
		},
		function(data){
			if(data!='1'){
				alert(data);
			}
			else{
				alert('Your order was submitted, you will receive your list soon');
				window.location.reload();
			}
		}
	);
}

function placeCall(){
	$.post('services/service_phone.php',
		{
			call: 1,
			phonen: $('#idcountry').val()+'-'+$('#phonecall').val()
		},
		function(data){
			alert(data);			
		}
	);
}

function verifyCall(){
	$.post('services/service_phone.php',
		{
			verify: 1,
			scode: $('#scode').val()
		},
		function(data){
			if(data=='1'){
				alert("Your order is verified now");
				window.location.reload();
			}
			else{
				alert(data);
			}			
		}
	);
}
