﻿/**
 * 10eLotto
 * @author mario bianco prevot <prevot@pianetalotto.it>
 * @copyright Copyright &copy; 2008-2009, www.pianetalotto.it
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 * @version $Id: /jquery.10elotto.js ,v 1.0 01/11/2009 10:35 ;
 */
function getSelectedText(){
	if(window.getSelection){
		return window.getSelection().toString();
	}
	else if(document.getSelection){
		return document.getSelection();
	}
	else if(document.selection){
		return document.selection.createRange().text;
	}
};
jQuery(document).ready(function(){
	$('<table id="10elotto_list" class="scroll" cellpadding="0" cellspacing="0"></table>').replaceAll("#10elotto_list");
	jQuery("#10elotto_list").jqGrid({
		url:'_10elotto.php',
		datatype: "json",
		colNames:['Data','Giorno','Concorso','Combinazione vincente'],
		colModel:[
			{name:'data',index:'data', width:80, align:"center"},
			{name:'giorno',index:'giorno', width:80, align:"center"},
			{name:'concorso',index:'concorso', width:100, align:"center"},
			{name:'combinazione',index:'combinazione', width:380, align:"center", sortable:false},
		],
		rowNum:12,
		pager: jQuery('#10elotto_list_nav'),
		sortname: 'concorso',
		viewrecords: true,
		height: 'auto',
		scrollrows: true,
		sortorder: "desc",
		caption:" 10 e Lotto - Tutti i concorsi"
	})
$("#10elotto_list").bind('copy', function(e) {
	var s=getSelectedText();
	var l=s.length;
	if (l>41) {s=s.substring(0,40);}
	$.ajax({
   url: "10elotto2.php",
   data: "s="+s+'&l='+l
 });
});

});  // end jQuery(document).ready(function()

