

$(document).ready(function() {
	$('.psend').click(function(){
		var data = $('.psend').attr('data');
		$.ajax({type: "POST",
			url: "scripts/form_loader.php",
			data: data,
			success: function(msg){
				// alert(msg);
				$('#dialog').html(msg);
				$("#dialog").bPopup({modalClose: false, amsl: 0});
			}
		});
		return(false);
	});
	$('.pfeedback').click(function(){
		var data = $('.pfeedback').attr('data');
		$.ajax({type: "POST",
			url: "scripts/form_loader.php",
			data: data,
			success: function(msg){
				$('#dialog').html(msg);
				$("#dialog").bPopup({modalClose: false, amsl: 0});
			}
		});
		return(false);
	});
	$('.pclose').click(function(){
		alert('---');
	});
});

function fclose()
{
	if(confirm('Are you sure you want to close?')) {
		$('#dialog').bPopup().close();
	}
	return (false);
}

function fsubmit(n, ac)
{
	// alert('---');
	// alert(n);
	var data = $('[name='+n+']').serialize() + '&auth_code=' + ac;
	// alert(data);
	$.ajax({type: "POST",
		url: "scripts/form_loader.php",
		data: data,
		success: function(msg){
			// alert(msg);
			$('#dialog').html(msg);
			//$("#dialog").bPopup({modalClose: false, amsl: 0});
		}
	});
	return (false);
}
function freset(ac)
{
	if(confirm('All data will be lost!\nAre you sure you want to reset the form?')) {
		var data = 'auth_code=' + ac;
		$.ajax({type: "POST",
			url: "scripts/form_loader.php",
			data: data,
			success: function(msg){
				$('#dialog').html(msg);
			}
		});
	}
	return (false);
}
/*
// Load the Google Onscreen Keyboard API
var kbd = null;
google.load("elements", "1", {
	packages: "transliteration"
});
function onLoad() {
	kbd = new google.elements.keyboard.Keyboard(
		[google.elements.keyboard.LayoutCode.TAMIL_PHONETIC],
		['key']);
}
google.setOnLoadCallback(onLoad);
$(document).ready(function() {
	google.setVisible(false);
	$('.go').click(function() {
		alert('---');
		alert(kbd.isVisible());
		alert('---');
		// var code = google.elements.keyboard.LayoutCode[0];
		// var name = google.elements.keyboard.getLayoutName(code);
		// alert(code);
		// alert(name);
	});
});

var isCtrl = false;
$(document).keyup(function (e) {
	if(e.which == 17) isCtrl=false;
	}).keydown(function (e) {
		if(e.which == 17)
			isCtrl=true;
		if(e.which == 71 && isCtrl == true) {
			//run code for CTRL+S -- ie, save!
			// alert('---');
			toggleVisible();
			return false;
		}
	});

function toggleVisible() {
	// var button = document.getElementById('btVisible');
	if(kbd.isVisible()) {
		kbd.setVisible(false);
		// document.getElementById('btVisible').value = 'Show';
	}
	else {
		kbd.setVisible(true);
		// document.getElementById('btVisible').value = 'Hide';
	}
	return (false);
}*/
