D:\host\scoreman.in\highrange2026\j.js

/*
$(document).bind("mobileinit", function(){
$.mobile.pushStateEnabled = false;
});


var
    last_hash = '',
    no_hash_change_warning = false;

$(document).bind("pageshow", function( event, ui ){
    window.last_hash = document.location.hash;
	setraces();
});

$(document).bind("pagebeforechange", function( event, ui ){
  //  event.preventDefault();
    if (!window.no_hash_change_warning) {
      window.no_hash_change_warning = true;
    } else {
      window.no_hash_change_warning = false;
    }

    document.location.hash = window.last_hash;
      if (!window.no_hash_change_warning) {
      //  window.alert(window.lang.cannot_leave_page);
	  console.log("no refresh");
      }
   
});
*/
$(document).ready(function() {
  $.ajaxSetup({ cache: false });
});
$(document).on('pageinit', '#login', function(){  


	var $clubsjson="";
$.getJSON("clubs.json?v=1", function(json) {
  //  console.log(json); // this will show the info it in firebug console
	$clubsjson=json;
	
});


$('#district1').change(function() {
//	alert("Hi");
console.log('Handler for .change() called.');
  //load districts
   $('#clubusername').empty();//.append($('<option></option>').val('Select District').html('Select District'));
    var matchVal = $("#district1 option:selected").text();
    $clubsjson.filter(function (dts) {
        if (dts.district== matchVal) {
            $("#clubusername").append($('<option></option>').val(dts.clubname).html(dts.clubname));
			}
	});

	 $("#clubusername").append($('<option></option>').val("OPEN ENTRY").html("OPEN ENTRY"));

	
	 $("#clubusername").val('Select Club / Team').change();
	 
	 
});

});

$(document).on('pageinit', '#entrypage', function(){  

$('#dobfile').bind('change', function() {

  //this.files[0].size gets the size of your file.
  //alert(this.files[0].size);
  if(this.files[0].size > 1048576){
       alert("Please select PDF File Size less than 1 MB","Error!");
       this.value = "";
    };

});

$('#photofile').bind('change', function() {

  //this.files[0].size gets the size of your file.
  //alert(this.files[0].size);
 //this.files[0].size gets the size of your file.
  //alert(this.files[0].size);
  if(this.files[0].size > 1048576){
       alert("Please select Photo File Size less than 1 MB","Error!");
       this.value = "";
    };

});



	$('#email').blur(function() {
    var testEmail = /^[A-Z0-9._%+-]+@([A-Z0-9-]+\.)+[A-Z]{2,4}$/i;
    if (testEmail.test(this.value)==false) //alert('passed');
  new $.nd2Toast({ // The 'new' keyword is important, otherwise you would overwrite the current toast instance
   message : "Please enter valid Email ID", // Required
   action : { // Optional (Defines the action button on the right)
     title : "OK", // Title of the action button
//     link : "/any/link.html", // optional (either link or fn or both must be set to define an action)
     fn : function() { // function that will be triggered when action clicked
           this.select();
     },
     color : "red" // optional color of the button (default: 'lime')
   },
   ttl : 8000 // optional, time-to-live in ms (default: 3000)
 });

});

/* disabled for karnataka open 2019
var $statesjson="";
$.getJSON("states.json", function(json) {
  //  console.log(json); // this will show the info it in firebug console
	$statesjson=json;
	 $('#state').empty();//.append($('<option></option>').val('Select State').html('Select State'));
	 for (var i = 0; i < json.length; i++) {
		 // console.log(json[i].State);
           $("#repstate").append($('<option></option>').val(json[i].State).html(json[i].State));
		   
		    $("#residingstate").append($('<option></option>').val(json[i].State).html(json[i].State));
			
	 }
	//  $("#state").val('Select State').change();
});

*/
var $statedtjson="";
$.getJSON("statendt.json", function(json) {
  //  console.log(json); // this will show the info it in firebug console
	$statedtjson=json;
	
});

var $clubsjson="";
$.getJSON("clubs.json", function(json) {
  //  console.log(json); // this will show the info it in firebug console
	$clubsjson=json;
	
});


// $('#repstate').change(function() {
//   //alert('Handler for .change() called.');
//   //load districts
//    $('#repdistrict').empty();//.append($('<option></option>').val('Select District').html('Select District'));
//     var matchVal = $("#repstate option:selected").text();
//     $statedtjson.filter(function (dts) {
//         if (dts.State== matchVal) {
//             $("#repdistrict").append($('<option></option>').val(dts.District).html(dts.District));
// 			}
// 	});
	
// 	 $("#repdistrict").val('Select District').change();
	 
	 
// });

// $('#repdistrict').change(function() {
// console.log('Handler for .change() called.');
//   //load districts
//    $('#repstate').empty();//.append($('<option></option>').val('Select District').html('Select District'));
//     var matchVal = $("#repdistrict option:selected").text();
//     $clubsjson.filter(function (dts) {
//         if (dts.district== matchVal) {
//             $("#repstate").append($('<option></option>').val(dts.clubname).html(dts.clubname));
// 			}
// 	});

// 	 $("#repstate").append($('<option></option>').val("OPEN ENTRY").html("OPEN ENTRY"));

	
// 	 $("#repstate").val('Select Club / Team').change();
	 
	 
// });

$('#residingstate').change(function() {
  //alert('Handler for .change() called.');
  //load districts
   $('#residingdistrict').empty();//.append($('<option></option>').val('Select District').html('Select District'));
    var matchVal = $("#residingstate option:selected").text();
    $statedtjson.filter(function (dts) {
        if (dts.State== matchVal) {
            $("#residingdistrict").append($('<option></option>').val(dts.District).html(dts.District));
			}
	});
	
	 $("#residingdistrict").val('Select District').change();
	 
	 
});


});



 function get_age(born, now) {
      var birthday = new Date(now.getFullYear(), born.getMonth(), born.getDate());
      if (now >= birthday) 
        return now.getFullYear() - born.getFullYear();
      else
        return now.getFullYear() - born.getFullYear() - 1;
    }
   function refreshPage() {
  $.mobile.changePage(
    window.location.href,
    {
      allowSamePageTransition : true,
      transition              : 'none',
      showLoadMsg             : false,
      reloadPage              : true
    }
	
  );
  
  console.log("refreshed");
} 
	 function calcagegroup($cat)
 {
	
    /*  var pattern=/^(?:(?:31(\/|-|\.)(?:0?[13578]|1[02]))\1|(?:(?:29|30)(\/|-|\.)(?:0?[1,3-9]|1[0-2])\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})$|^(?:29(\/|-|\.)0?2\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:0?[1-9]|1\d|2[0-8])(\/|-|\.)(?:(?:0?[1-9])|(?:1[0-2]))\4(?:(?:1[6-9]|[2-9]\d)?\d{2})$/gm;
     
      var Val_date=$("#dob").val();

     
     if(pattern.test(Val_date)==true)
     {

     	new $.nd2Toast({ // The 'new' keyword is important, otherwise you would overwrite the current toast instance
   message :"Please enter valid Date of Birth.", // Required
     color : "green" ,// optional color of the button (default: 'lime')
   ttl : 1200 // optional, time-to-live in ms (default: 3000)
 });

         //alert("Invalid Date");
        // $("#dob").val("");
        // $("#dob").focus();
		 $("#age").val($("#dob").val());
         return;
     }
    else
     {
    //   alert("hi"+Val_date);
         
         
         var dobsplit = Val_date.split("-"); 

var dob = new Date(dobsplit[0], dobsplit[1] - 1, dobsplit[2]);*/

    dob=new Date($("#dobdate").val()+"-"+$("#dobmonth").val()+"-"+$("#dobyear").val());  

 var ason = new Date("2025/12/31");
//var age = Math.floor((ason-dob) / (365.25 * 24 * 60 * 60 * 1000));
         
         var age=get_age(dob,ason);


             //    var age=2020-$("#dobyear").val();
         
         if(age>90)
         {
             alert("Please check date of birth.");
             return;
         }

         $("#aget").val(age+" as on "+ ason.getDate() + '-' + (ason.getMonth()+1) + '-' +  ason.getFullYear());
		 $("#age").val(age);
         var agegroup="";
      
        //var rulesjson='{"agegroups": [{    "agegroup":"Below 6",    "agefr": 1,    "ageto": 5,    "events": "a", "agorder":1  },  {        "agegroup":"6 to 8", "agefr": 6,    "ageto": 7,   "events": "a" , "agorder":2  },    {     "agegroup":"8 to 10", "agefr": 8,    "ageto": 9,    "events": "a" , "agorder":3   },    {     "agegroup":"10 to 12", "agefr": 10,    "ageto": 11,    "events": "a", "agorder":4  },   {     "agegroup":"12 to 16", "agefr": 12,    "ageto": 15,    "events": "a" , "agorder":5   },    {     "agegroup":"Above 16", "agefr": 16,    "ageto": 1000,    "events": "a" , "agorder":6   }]}';
		  //  var rulesjson='{"agegroups": [{    "agegroup":"Below 6",    "agefr": 1,    "ageto": 5,    "events": "a", "agorder":1  },  {        "agegroup":"6 to 8", "agefr": 6,    "ageto": 7,   "events": "a" , "agorder":2  },    {     "agegroup":"8 to 12", "agefr": 8,    "ageto": 11,    "events": "a" , "agorder":3   }, {     "agegroup":"12 to 16", "agefr": 12,    "ageto": 15,    "events": "a" , "agorder":5   },    {     "agegroup":"Above 16", "agefr": 16,    "ageto": 1000,    "events": "a" , "agorder":6   }]}';
		 //56thnat var rulesjson='{"agegroups": [{     "agegroup":"8 to 12", "agefr": 8,    "ageto": 11,    "events": "a" , "agorder":3   }, {     "agegroup":"12 to 16", "agefr": 12,    "ageto": 15,    "events": "a" , "agorder":5   },    {     "agegroup":"Above 16", "agefr": 16,    "ageto": 1000,    "events": "a" , "agorder":6   }]}';

    var rulesjson='{"agegroups": [{ "agegroup":"4 to 6 - Cadet", "agefr": 4,    "ageto": 5,  "events": "a" , "agorder":0   }, {"agegroup":"6 to 8 - Cadet", "agefr": 6,    "ageto": 7,    "events": "a" , "agorder":1   }, {     "agegroup":"8 to 10 - Cadet", "agefr": 8,    "ageto": 9,    "events": "a" , "agorder":2   },    { "agegroup":"10 to 12 - Cadet", "agefr": 10,    "ageto": 11,    "events": "a" , "agorder":3   },    {     "agegroup":"12 to 15 - Sub Junior", "agefr": 12,    "ageto": 14,    "events": "a" , "agorder":4   },    {     "agegroup":"15 to 18 - Junior", "agefr": 15,    "ageto": 17,    "events": "a" , "agorder":5   },    {     "agegroup":"Above 18 - Senior", "agefr": 18,    "ageto": 90,    "events": "a" , "agorder":6   }]}';


	//2024 var rulesjson='{"agegroups": [{     "agegroup":"Below 5", "agefr": 2,    "ageto": 4,  "events": "a" , "agorder":0   }, {"agegroup":"5 to 7 - Cadet", "agefr": 5,    "ageto": 6,    "events": "a" , "agorder":1   }, {     "agegroup":"7 to 9 - Cadet", "agefr": 7,    "ageto": 8,    "events": "a" , "agorder":2   },    {     "agegroup":"9 to 11 - Cadet", "agefr": 9,    "ageto": 10,    "events": "a" , "agorder":3   },    {     "agegroup":"11 to 14 - Sub Junior", "agefr": 11,    "ageto": 13,    "events": "a" , "agorder":4   },    {     "agegroup":"14 to 17 - Junior", "agefr": 14,    "ageto": 16,    "events": "a" , "agorder":5   },    {     "agegroup":"Above 17 - Senior", "agefr": 17,    "ageto": 90,    "events": "a" , "agorder":6   }]}';
	//with masters var rulesjson='{"agegroups": [{     "agegroup":"5 to 7 - Cadet", "agefr": 5,    "ageto": 6,    "events": "a" , "agorder":1   }, {     "agegroup":"7 to 9 - Cadet", "agefr": 7,    "ageto": 8,    "events": "a" , "agorder":2   },    {     "agegroup":"9 to 11 - Cadet", "agefr": 9,    "ageto": 10,    "events": "a" , "agorder":3   },    {     "agegroup":"11 to 14 - Sub Junior", "agefr": 11,    "ageto": 13,    "events": "a" , "agorder":4   },    {     "agegroup":"14 to 17 - Junior", "agefr": 14,    "ageto": 16,    "events": "a" , "agorder":5   },    {     "agegroup":"Above 17 - Senior", "agefr": 17,    "ageto": 29,    "events": "a" , "agorder":6   },    {     "agegroup":"Above 30 - Master", "agefr": 30,    "ageto": 90,    "events": "a" , "agorder":7   }]}';	  
			//noida2019    var rulesjson='{"agegroups": [{     "agegroup":"5 to 7 - Cadet", "agefr": 5,    "ageto": 6,    "events": "a" , "agorder":1   }, {     "agegroup":"7 to 9 - Cadet", "agefr": 7,    "ageto": 8,    "events": "a" , "agorder":2   },    {     "agegroup":"9 to 11 - Cadet", "agefr": 9,    "ageto": 10,    "events": "a" , "agorder":3   },    {     "agegroup":"11 to 14 - Sub Junior", "agefr": 11,    "ageto": 13,    "events": "a" , "agorder":4   },    {     "agegroup":"14 to 17 - Junior", "agefr": 14,    "ageto": 16,    "events": "a" , "agorder":5   },    {     "agegroup":"Above 17 - Senior", "agefr": 17,    "ageto": 90,    "events": "a" , "agorder":6   }]}';
			
        var radioValuesel = $("input[name='skatertype']:checked").val();
		//if(radioValuesel =="Alpine" || radioValuesel =="Downhill" || radioValuesel =="Roller-Derby"|| radioValuesel =="Roller-Freestyle"|| radioValuesel =="Skateboarding")
		if($cat=='2')
		{
			  rulesjson='{"agegroups": [{"agegroup":"Above 12", "agefr": 12,    "ageto": 1000,    "events": "a" , "agorder":7   }]}';
		//alert(rulesjson);
		}
		

     var jsonobj = jQuery.parseJSON(rulesjson);
$.each(jsonobj.agegroups, function(i,s) {
   
    if(age>=s.agefr && age<=s.ageto)
    {
        agegroup=s.agegroup;
       agorder=s.agorder;



if(agegroup=="Below 5")
{
	$('#rsfino').prop('disabled', true);
	$('#rsfino').val("NA");
}
else
{
	$('#rsfino').prop('disabled', false);
}

         if(age >= 35)
			  {

			  	 $('#masters').prop('disabled', false);
			  	  $('#newpassword').prop('disabled', false);
			  //	  alert("Enable master")

			  }else
			  {

			  		$('#masters').prop('checked', false).checkboxradio( "refresh" );

			  	 $('#masters').prop('disabled', true);
			  	 	$('#newpassword').prop('disabled', true);
			  }

			  if(age >= 35 &&  $('#masters').prop('checked')==true)
			  {
			  	 agegroup="Above 35 - Master";
       agorder=7;
			  }

		
        $("#ag").val(agegroup);
		        $("#agorder").val(agorder);
		//		alert(agorder);
      //   alert(agegroup);
	  
	 // if(agegroup=="8 to 10" || agegroup=="10 to 12")

	 $('#rink1').prop('disabled', true);
$('#rink2').prop('disabled', true);
$('#rink3').prop('disabled', true);

$('#road1').prop('disabled', true);
$('#road2').prop('disabled', true);


$('#rink4').prop('disabled', true);
$('#rink5').prop('disabled', true);
$('#rink6').prop('disabled', true);
$('#rink7').prop('disabled', true);


$('#p2p').prop('disabled', true);
$('#elim').prop('disabled', true);

$('#road3').prop('disabled', true);
$('#road4').prop('disabled', true);
$('#road5').prop('disabled', true);

$('#p2prd').prop('disabled', true);
$('#elimrd').prop('disabled', true);
$('#relay').prop('disabled', true);
$('#marathon').prop('disabled', true);




		  if(agegroup=="4 to 6 - Cadet" || agegroup=="6 to 8 - Cadet")
	  {

	 $('#rink1').prop('disabled', false);
$('#rink2').prop('disabled', false);
$('#rink3').prop('disabled', false);

$('#rink4').prop('disabled', false); //5 to 7 added in 2020-21 for inline
$('#rink5').prop('disabled', false);
$('#rink6').prop('disabled', false);
		   
		  
		  }
		  else if(agegroup=="8 to 10 - Cadet" || agegroup=="10 to 12 - Cadet" )
		  {


$('#rink1').prop('disabled', false);
$('#rink2').prop('disabled', false);
$('#rink3').prop('disabled', false);
$('#road1').prop('disabled', false);

$('#rink4').prop('disabled', false);
$('#rink5').prop('disabled', false);
$('#rink6').prop('disabled', false);
$('#road4').prop('disabled', false);

}
else if(agegroup=="12 to 15 - Sub Junior" )
		  {

$('#rink2').prop('disabled', false);
$('#rink3').prop('disabled', false);
$('#road1').prop('disabled', false);
$('#road2').prop('disabled', false);


$('#rink5').prop('disabled', false);
$('#rink6').prop('disabled', false);
$('#rink7').prop('disabled', false);

$('#p2p').prop('disabled', false);

$('#road3').prop('disabled', false);
$('#road4').prop('disabled', false);
$('#road5').prop('disabled', false);

$('#relay').prop('disabled', false);

 $('input:checkbox').checkboxradio( "refresh" );
}
else if(agegroup=="15 to 18 - Junior" || agegroup=="Above 18 - Senior")
{

$('#rink2').prop('disabled', false);
$('#rink3').prop('disabled', false);
$('#road1').prop('disabled', false);
$('#road2').prop('disabled', false);

$('#rink5').prop('disabled', false);
$('#rink6').prop('disabled', false);

$('#rink7').prop('disabled', false); //dual tt

$('#elim').prop('disabled', false);

$('#road3').prop('disabled', false);
$('#road4').prop('disabled', false);


$('#p2p').prop('disabled', false);
$('#p2prd').prop('disabled', false);
$('#elimrd').prop('disabled', false);


$('#relay').prop('disabled', false);
$('#marathon').prop('disabled', false);
 $('input:checkbox').checkboxradio( "refresh" );
}
else if(agegroup=="Above 35 - Master")
{

//$('#rink5').prop('disabled', false).checkboxradio( "refresh" );
//$('#rink6').prop('disabled', false).checkboxradio( "refresh" );


//$('#elim').prop('disabled', false).checkboxradio( "refresh" );

//$('#relay').prop('disabled', false).checkboxradio( "refresh" );

//console.log("Master Events");
 $('input:checkbox').checkboxradio( "refresh" );

}
	 $('input:checkbox').checkboxradio( "refresh" );		  
		console.log(age);   



			  
			


if(agegroup=="Above 35 - Master")
{

//	$('#skatertype3').prop('checked', false).checkboxradio( "refresh" );
			$('#skatertype3').prop('disabled', false).checkboxradio( "refresh" ); //below 5 q
			
		//	$('#skatertype4').prop('checked', false).checkboxradio( "refresh" ); //tenacity
			$('#skatertype4').prop('disabled', true).checkboxradio( "refresh" ); ///below 5 inline

			
			$('#skatertype1').prop('disabled', true).checkboxradio( "refresh" ); //speed-quad
			$('#skatertype2').prop('disabled', false).checkboxradio( "refresh" ); //speed-inline


			
		//	$('#skatertype14').prop('checked', false).checkboxradio( "refresh" );
			$('#skatertype5').prop('disabled', false).checkboxradio( "refresh" ); //artistic
			
		//	$('#skatertype6').prop('checked', false).checkboxradio( "refresh" );
			$('#skatertype6').prop('disabled', false).checkboxradio( "refresh" ); //rh
			
		//	$('#skatertype7').prop('checked', false).checkboxradio( "refresh" );
			$('#skatertype7').prop('disabled', false).checkboxradio( "refresh" ); //il hockey
 			
		//	$('#skatertype12').prop('checked', false).checkboxradio( "refresh" );
			$('#skatertype12').prop('disabled', true).checkboxradio( "refresh" ); //inline fs

			  $('#alpine').prop('disabled', true).checkboxradio( "refresh" );
				  $('#downhill').prop('disabled', true).checkboxradio( "refresh" );
				  $('#rollerderby').prop('disabled', false).checkboxradio( "refresh" );
				  $('#rollerfreestyle').prop('disabled', true).checkboxradio( "refresh" );
		  $('#skateboarding').prop('disabled', false).checkboxradio( "refresh" );
				   


}
			  
	  setraces();

//2021 starts here

	  	$('#skatertype1').prop('disabled', false).checkboxradio( "refresh" );
	  	$('#skatertype2').prop('disabled', false).checkboxradio( "refresh" );
	  	$('#skatertype3').prop('disabled', false).checkboxradio( "refresh" );
	  	$('#skatertype4').prop('disabled', false).checkboxradio( "refresh" );
	  	$('#skatertype5').prop('disabled', false).checkboxradio( "refresh" );
	  	$('#skatertype6').prop('disabled', false).checkboxradio( "refresh" );
	  	$('#skatertype7').prop('disabled', false).checkboxradio( "refresh" );
	  	$('#skatertype8').prop('disabled', false).checkboxradio( "refresh" );
	  	$('#skatertype9').prop('disabled', false).checkboxradio( "refresh" );
	  	$('#skatertype10').prop('disabled', false).checkboxradio( "refresh" );
	  	$('#skatertype11').prop('disabled', false).checkboxradio( "refresh" );
	  	$('#skatertype12').prop('disabled', false).checkboxradio( "refresh" );
	  	$('#skatertype13').prop('disabled', false).checkboxradio( "refresh" );
	  	$('#skatertype14').prop('disabled', false).checkboxradio( "refresh" );
	  	$('#skatertype15').prop('disabled', false).checkboxradio( "refresh" );
	  	$('#skatertype16').prop('disabled', false).checkboxradio( "refresh" );
	  	$('#skatertype17').prop('disabled', false).checkboxradio( "refresh" );
	  	$('#skatertype18').prop('disabled', false).checkboxradio( "refresh" );
	  

// $('#skatertype3').prop('checked', false).checkboxradio( "refresh" );
// $('#skatertype14').prop('checked', false).checkboxradio( "refresh" );
// 	$('#skatertype1').prop('checked', false).checkboxradio( "refresh" );
// 			$('#skatertype2').prop('checked', false).checkboxradio( "refresh" );

			   if(age<4)
			  { //alpine & downhill - not below 11

			
			$('#skatertype3').prop('disabled', false).checkboxradio( "refresh" );
			
	$('#skatertype14').prop('disabled', false).checkboxradio( "refresh" );
		
			$('#skatertype1').prop('disabled', true).checkboxradio( "refresh" );

			$('#skatertype2').prop('disabled', true).checkboxradio( "refresh" );

$('#skatertype3').checkboxradio( "refresh" );
$('#skatertype14').checkboxradio( "refresh" );

 

			  }
			  else
			  {

			
			$('#skatertype3').prop('disabled', false).checkboxradio( "refresh" );

			$('#skatertype14').prop('disabled', false).checkboxradio( "refresh" );

	 
		 $('#skatertype1').prop('disabled', false).checkboxradio( "refresh" );

		  $('#skatertype2').prop('disabled', false).checkboxradio( "refresh" );

			  }

			  if(agegroup=="Above 35 - Master")
{

	$('#skatertype3').prop('checked', false).checkboxradio( "refresh" );
			$('#skatertype3').prop('disabled', false).checkboxradio( "refresh" ); //below 5 q
			
		//	$('#skatertype4').prop('checked', false).checkboxradio( "refresh" ); //tenacity
			$('#skatertype4').prop('disabled', false).checkboxradio( "refresh" ); ///below 5 inline

			
			$('#skatertype1').prop('disabled', false).checkboxradio( "refresh" ); //speed-quad
			$('#skatertype2').prop('disabled', false).checkboxradio( "refresh" ); //speed-inline


			
			$('#skatertype14').prop('checked', false).checkboxradio( "refresh" );
			$('#skatertype5').prop('disabled', false).checkboxradio( "refresh" ); //artistic
			
		//	$('#skatertype6').prop('checked', false).checkboxradio( "refresh" );
			$('#skatertype6').prop('disabled', false).checkboxradio( "refresh" ); //rh
			
		//	$('#skatertype7').prop('checked', false).checkboxradio( "refresh" );
			$('#skatertype7').prop('disabled', false).checkboxradio( "refresh" ); //il hockey
 			
		//	$('#skatertype12').prop('checked', false).checkboxradio( "refresh" );
			$('#skatertype12').prop('disabled', true).checkboxradio( "refresh" ); //inline fs

//alpine & downhill 
			$('#skatertype13').prop('checked', false).checkboxradio( "refresh" );
			$('#skatertype13').prop('disabled', true).checkboxradio( "refresh" );

			$('#skatertype14').prop('checked', false).checkboxradio( "refresh" );
			$('#skatertype14').prop('disabled', false).checkboxradio( "refresh" );

//derby & scooter
			$('#skatertype17').prop('checked', false).checkboxradio( "refresh" );
			$('#skatertype17').prop('disabled', true).checkboxradio( "refresh" );

			$('#skatertype18').prop('checked', false).checkboxradio( "refresh" );
			$('#skatertype18').prop('disabled', true).checkboxradio( "refresh" );
}
        return;
    }

}); 
         if(agegroup=="")
         {
            $("#ag").val(":("); 
			
			new $.nd2Toast({ // The 'new' keyword is important, otherwise you would overwrite the current toast instance
   message :"Please enter valid Date of Birth.", // Required
     color : "green" ,// optional color of the button (default: 'lime')
   ttl : 3000 // optional, time-to-live in ms (default: 3000)
 });
         }
         if(agegroup=="" && age==0)
         {
            $("#ag").val("hey ;) A new born baby?! check date..");
			
					new $.nd2Toast({ // The 'new' keyword is important, otherwise you would overwrite the current toast instance
   message :"Please enter valid Date of Birth.", // Required
     color : "green" ,// optional color of the button (default: 'lime')
   ttl : 3000 // optional, time-to-live in ms (default: 3000)
 });
         }
         
       

  //2020    }
   
     
 }
 
 function setraces() {
	 console.log("clear setting races...");
	var radioValue = $("input[name='skatertype']:checked").val();
	if(radioValue=="Speed-Quad"){
               $('#sqraces').show();
			   $('#siraces').hide();
			   $('#u8qraces').hide();
			   $('#u8iraces').hide();
			   $('#tenraces').hide();
			   $('#artisticraces').hide();
			     $('#hockeyraces1').hide();
				  $('#hockeyraces2').hide();
				 	 $('#inlinefreestyleraces').hide();
					 
					  $('#hockeyadd').hide();
            }
			else if(radioValue=="Speed-Inline"){
               $('#sqraces').hide();
			   $('#siraces').show();
			   $('#u8qraces').hide();
			     $('#u8iraces').hide();
			   $('#tenraces').hide();
			   $('#artisticraces').hide();
			$('#hockeyraces1').hide();
				  $('#hockeyraces2').hide();
					 $('#inlinefreestyleraces').hide();
					 
					  $('#hockeyadd').hide();
					  
            }
				else if(radioValue=="Beginner-Quad"){
               $('#sqraces').hide();
			   $('#siraces').hide();
			   $('#u8qraces').show();
			     $('#u8iraces').hide();
			   $('#tenraces').hide();
			   $('#artisticraces').hide();
			   $('#hockeyraces1').hide();
				  $('#hockeyraces2').hide();
					 $('#inlinefreestyleraces').hide();
					 
					  $('#hockeyadd').hide();
            }
			else if(radioValue=="Beginner-Inline"){
               $('#sqraces').hide();
			   $('#siraces').hide();
			   $('#u8qraces').hide();
			     $('#u8iraces').show();
			   $('#tenraces').hide();
			   $('#artisticraces').hide();
			   $('#hockeyraces1').hide();
				  $('#hockeyraces2').hide();
					 $('#inlinefreestyleraces').hide();
					 
					  $('#hockeyadd').hide();
            }
				else if(radioValue=="Tenacity"){
               $('#sqraces').hide();
			   $('#siraces').hide();
			   $('#u8qraces').hide();
			     $('#u8iraces').hide();
			   $('#tenraces').show();
			   $('#artisticraces').hide();
			   $('#hockeyraces1').hide();
				  $('#hockeyraces2').hide();
					 $('#inlinefreestyleraces').hide();
					 
					  $('#hockeyadd').hide();
            }
				else if(radioValue=="Artistic"){
               $('#sqraces').hide();
			   $('#siraces').hide();
			   $('#u8qraces').hide();
			     $('#u8iraces').hide();
			   $('#tenraces').hide();
			    $('#artisticraces').show();
				$('#hockeyraces1').hide();
				  $('#hockeyraces2').hide();
				 	 $('#inlinefreestyleraces').hide();
					 
					  $('#hockeyadd').hide();
            }
			else if(radioValue=="Roller-Hockey")
			{
				  $('#sqraces').hide();
			   $('#siraces').hide();
			   $('#u8qraces').hide();
			     $('#u8iraces').hide();
			   $('#tenraces').hide();
			    $('#artisticraces').hide();
				 $('#hockeyraces1').show();
				  $('#hockeyraces2').hide();
				 $('#inlinefreestyleraces').hide();
				 
				  $('#hockeyadd').show();
			}
			
				else if(radioValue=="Inline-Hockey")
			{
				  $('#sqraces').hide();
			   $('#siraces').hide();
			   $('#u8qraces').hide();
			     $('#u8iraces').hide();
			   $('#tenraces').hide();
			    $('#artisticraces').hide();
				 $('#hockeyraces1').hide();
				  $('#hockeyraces2').show();
				 $('#inlinefreestyleraces').hide();
				 
				  $('#hockeyadd').show();
				  
			}
			
				else if(radioValue=="Inline-Freestyle")
			{
				  $('#sqraces').hide();
			   $('#siraces').hide();
			   $('#u8qraces').hide();
			     $('#u8iraces').hide();
			   $('#tenraces').hide();
			    $('#artisticraces').hide();
				 $('#hockeyraces1').hide();
				  $('#hockeyraces2').hide();
				  
				 $('#inlinefreestyleraces').show();
				 
				  $('#hockeyadd').hide();
			}
			else
			{
				  $('#sqraces').hide();
			   $('#siraces').hide();
			   $('#u8qraces').hide();
			     $('#u8iraces').hide();
			   $('#tenraces').hide();
			    $('#artisticraces').hide();
				$('#hockeyraces1').hide();
				  $('#hockeyraces2').hide();
				 $('#inlinefreestyleraces').hide();
				 
				  $('#hockeyadd').hide();
		}
			
			
			
			
			
	

$('#rink1').prop('checked', false);
$('#rink2').prop('checked', false);

$('#road1').prop('checked', false);
$('#road2').attr("checked",false);

$('#rink3').prop('checked', false);
$('#rink4').attr("checked",false);

$('#rink5').attr("checked",false);
$('#rink6').attr("checked",false);
$('#rink7').attr("checked",false);


$('#p2p').attr("checked",false);
$('#elim').attr("checked",false);

$('#road3').attr("checked",false);
$('#road4').attr("checked",false);
$('#road5').attr("checked",false);

$('#p2prd').attr("checked",false);
$('#elimrd').attr("checked",false);
$('#relay').attr("checked",false);
$('#marathon').attr("checked",false);

$('#u8race1q').attr("checked",false);
$('#u8race2q').attr("checked",false);

$('#u8race1i').attr("checked",false);
$('#u8race2i').attr("checked",false);

$('#tenrace1').attr("checked",false);
$('#tenrace2').attr("checked",false);

$('#figure').attr("checked",false);
$('#free').attr("checked",false);
$('#pair').attr("checked",false);
$('#solodance').attr("checked",false);
$('#coupledance').attr("checked",false);
$('#inlinefree').attr("checked",false);
$('#quartet').attr("checked",false);

$('#classicslalom').attr("checked",false);
$('#speedslalom').attr("checked",false);

$('#rollerhockey1').attr("checked",false);
$('#inlinehockey1').attr("checked",false);

$('#alpine').prop('checked', false);
$('#downhill').prop('checked', false);
$('#rollerderby').prop('checked', false);
$('#rollerfreestyle').prop('checked', false);
$('#skateboarding').prop('checked', false);
$('#precision').prop('checked', false);
$('#showgroup').prop('checked', false);


$("input[type='radio']").checkboxradio();
$("input[type='radio']").checkboxradio("refresh");
			

console.log("done...");

}
  
  
  function clearform() {
	  
	  setraces();
	  $('#entryform')[0].reset();
	  
	//  $('#sname').val("");
	  $('#dob').val("");
	  $('#age').val("");
	  $('#ag').val("");
	  $('#phone').val("");
	  	  $('#clubname').val("");
	  	//  $('#repstate').val("");
		  	  $('#address').val("");
			  
			   $('#address2').val("");
			    $('#setpassword').val("");
				
				 $('#residingstate').val("");
				  $('#residingdistrict').val("");
				   $('#repstate').val("");
				    $('#repdistrict').val("");
					
			  
			  
			  	  $('#blood').val("");
				  	  $('#photofile').val("");
					  
					   $('#dobfile').val("");
					   
					   $('#aadhaarpass').val("");
					  
					  
	  $('#mode').val("new");
	  $('#applno').val("");
	  
	  $('#skatertype').attr("checked",false).trigger('updateState');
	  $("input[type='radio']").checkboxradio();
$("input[type='radio']").checkboxradio("refresh");

	 setraces();
	
	  
	 	  $('#image-editor3 > div.cropit-preview.box > div').css('background-image', 'url("")');
	 	  
					  $('#entryform > div:nth-child(2) > div:nth-child(1) > div > div > div.cropit-preview.box > div').css('background-image', 'url("")');
					  
			
			 $('#image-editor2 > div.cropit-preview.box > div').css('background-image', 'url("")');
			 
			$('#entryform > div:nth-child(1) > div:nth-child(1) > div:nth-child(3) > div > div.cropit-preview.box > div').css('background-image', 'url("")');
					   $('#uploadeddob').attr("src","");
					  
	   $('#entrypage').trigger('create');
	  
	  console.log("new ready");
	  
  }
  
  function checkform() {
	  
	  	//check selected races
			var quadcnt=0;
			var inlinecnt=0;
			var tencnt=0;
			var u8cnt=0;
			var artcnt=0;
			var othercnt=0;
			var infscnt=0;
			
			var hkycnt=0;
			
			var maincnt=0;
			
			var filesizeok=false;
			
			if($('#alpine').is(':checked'))
{
	othercnt++;
}

if($('#downhill').is(':checked'))
{
	othercnt++;
}

if($('#rollerderby').is(':checked'))
{
	othercnt++;
}

if($('#rollerfreestyle').is(':checked'))
{
	othercnt++;
}

if($('#skateboarding').is(':checked'))
{
	othercnt++;
}

if(othercnt>1)
{
	alert("You can select only one Other Discipline.","Error!");
					
					return false;

}
			
			if($('#rollerhockey1').is(':checked') || $('#inlinehockey1').is(':checked'))
			{
				hkycnt=1;
			}
			
			var radioValue = $("input[name='skatertype']:checked").val();
	if(radioValue=="Speed-Quad"){
       			maincnt=1;
			   if($('#rink1').is(':checked'))
				{
					quadcnt++;
				}
				if($('#rink2').is(':checked'))
				{
					quadcnt++;
				}
					if($('#rink3').is(':checked'))
				{
					quadcnt++;
				}
				if($('#road1').is(':checked'))
				{
					quadcnt++;
				}
					if($('#road2').is(':checked'))
				{
					quadcnt++;
				}
				
				
				
            }
			else if(radioValue=="Speed-Inline"){
			    maincnt=1;
				
				
             
			 	if($('#rink4').is(':checked'))
				{
					inlinecnt++;
				}
				if($('#rink5').is(':checked'))
				{
					inlinecnt++;
				}
				if($('#rink6').is(':checked'))
				{
					inlinecnt++;
				}
						if($('#rink7').is(':checked'))
				{
					inlinecnt++;
				}
				if($('#elim').is(':checked'))
				{
					inlinecnt++;
				}
			
				
				if($('#road3').is(':checked'))
				{
					inlinecnt++;
				}

				if($('#road4').is(':checked'))
				{
					inlinecnt++;
				}
				

				if($('#road5').is(':checked'))
				{
					inlinecnt++;
				}
				
				
							
	
						
					if($('#p2prd').is(':checked'))
				{
					inlinecnt++;
				}
				
				
				
            }
			else if(radioValue=="Beginner-Quad"){
			    maincnt=1;
               if($('#u8race1q').is(':checked'))
			{
				u8cnt++;
			}
			if($('#u8race2q').is(':checked'))
			{
				u8cnt++;
			}
			}
			else if(radioValue=="Beginner-Inline"){
			    maincnt=1;
			if($('#u8race1i').is(':checked'))
			{
				u8cnt++;
			}
			
			if($('#u8race2i').is(':checked'))
			{
				u8cnt++;
			}
			  
            }
				else if(radioValue=="Tenacity"){
				    
				    maincnt=1;
             if($('#tenrace1').is(':checked'))
			{
				tencnt++;
			}
			if($('#tenrace2').is(':checked'))
			{
				tencnt++;
			}
			
			 
            }
			else if(radioValue=="Artistic"){
			    maincnt=1;
             if($('#figure').is(':checked'))
			{
				artcnt++;
			}
			if($('#free').is(':checked'))
			{
				artcnt++;
			}
			if($('#inlinefree').is(':checked'))
			{
				artcnt++;
			}
			if($('#pair').is(':checked'))
			{
				artcnt++;
			}
			if($('#solodance').is(':checked'))
			{
				artcnt++;
			}
			if($('#coupledance').is(':checked'))
			{
				artcnt++;
			}
			/*if($('#quartet').is(':checked'))
			{
				artcnt++;
			}
			*/
			 
            }
			else if(radioValue=="Inline-Freestyle"){
			    maincnt=1;
               if($('#classicslalom').is(':checked'))
			{
				infscnt++;
			}
			if($('#speedslalom').is(':checked'))
			{
				infscnt++;
			}
			if($('#pairslalom').is(':checked'))
			{
				infscnt++;
			}
			  
			}
			else if(radioValue=="Roller-Hockey"){
			    maincnt=1;
               if($('#rollerhockey1').is(':checked'))
			{
				hkycnt++;
			}
			
			  
			}
			else if(radioValue=="Inline-Hockey"){
			    maincnt=1;
               if($('#inlinehockey1').is(':checked'))
			{
				hkycnt++;
			}
			
			  
			}
				else if(radioValue=="Inline-Alpine" || radioValue=="Adjustable-Quad" || radioValue=="Adjustable-Inline" || radioValue=="Alpine-Downhill" || radioValue=="Roller-Freestyle" || radioValue=="Inline-Downhill" || radioValue=="Roller-Scooter"|| radioValue=="Skateboarding" || radioValue=="Roller-Derby"){
			    maincnt=1;
othercnt=1;
			  
			}
			else if(typeof radioValue === "undefined")
			{
			//othercnt=1;
		
			//maincnt=1;
			
			//alert("Please Select Races m" + radioValue,"Error!");
					
			//		return false;
					
			
			}
			else
			{
				maincnt=1;
			
		alert("Please Select Races " + radioValue,"Error!");
					
			return false;
			}
			
			
	
			
			
	if(quadcnt==0 && inlinecnt==0 && tencnt==0 && u8cnt==0 && artcnt==0 && infscnt==0 && othercnt==0 && hkycnt==0 && maincnt==1)
				{


					alert("Please Select Races","Error!");
					
					return false;
				}
				
				if(artcnt>4)
				{
					alert("Please Select Maximum 4 out of 6 Events - Artistic","Error!");
					
					return false;
				}
				
				if(tencnt>0 && tencnt!=2)
				{
					alert("Please Select 2 out of 2 Races - Tenacity","Error!");
					
					return false;
				}
				
				if(quadcnt>0 && inlinecnt>0)
				{
					alert("Please Select Quad or Inline. Not Both","Error");
					
					return false;
				}
				
				
				
				var age;
				
				age=parseInt($('#age').val());
				if(quadcnt>0)
				{
				if(age>=8)
				{
					if(quadcnt>3)
					{
						alert("Please Select Maximum 3 out of 4 Races in QUAD","Error!");
						
						return false;
						
					}
					
				}
				if(age<8)
				{
					if(quadcnt>2)
					{
						alert("Please Select 2 out of 3 Races - QUAD","Error!");
					
						return false;
						
					}
					
			}
				}
				else if(inlinecnt>0)
				{

						if(age<8)
				{
					if(inlinecnt>2)
					{
						alert("Please Select 2 out of 3 Races - INLINE","Error!");
					
						return false;
						
					}
					
			}

					if(age<15) //corrected on 22 09 2019 before it was 11
					{
						if(inlinecnt>3)
					{
							alert("Please Select Maximum 3 out of 4 Races - INLINE","Error!");
							
							return false;
							
						}
						
					}
				if(age>=15 && age<30) //corrected on 22 09 2019 before it was 11
					{
						if(inlinecnt>3)
						{
							alert("Please Select Maximum 3 Races - INLINE","Error!");
						return false;
							
						}
						
					}
					if(age>=35)
					{
						if(inlinecnt>3)
						{
							alert("Please Select 3 out of 4 Races - INLINE. ","Error!");
					return false;
					
						}
					}
				}
				
				
		/*			   if(typeof $('#dobfile').files[0] !== 'undefined'){
        var size=$('#dobfile').files[0].fileSize;
                filesizeok = 1048576 > size;
				alert(size);
                if(filesizeok==true)
				{
					
				}
				else
				{
					alert("Please select PDF File Size less than 1 MB","Error!");
					
					return false;
				}
					   }
				
				if(typeof $('#photofile').files[0] !== 'undefined'){
				 var psize=$('#photofile').files[0].fileSize;
                filesizeok = 1048576 > psize;
				alert(size);
                if(filesizeok==true)
				{
					
				}
				else
				{
					alert("Please select Photo File Size less than 1 MB","Error!");
					
					return false;
				}
				
				}
				*/
           
		
		
	

		
				
				return true;
  }
    
	 function teammanagers() {
		 
		// $.mobile.navigate( '#entrypage' );
	//	$("#formhead").text("Add Entry");
		$.mobile.changePage(
    "#teammanager",
    {
      allowSamePageTransition : true,
      showLoadMsg             : false,
      reloadPage              : false
    }
	
  );
	 }
	 
	 function newapp() {
		 
		// $.mobile.navigate( '#entrypage' );
		$("#formhead").text("Entry Form");
		$.mobile.changePage(
    "#entrypagea",
    {
      allowSamePageTransition : true,
	  transition: "none",
      showLoadMsg             : false,
      reloadPage              : false
    }
	
  );
   $("#photofile").prop("required",true);
	 $("#photofile1").prop("required",true);
  
	  clearform();
	 // refreshPage();
		 
	 }
	 

	   function rejectapp($appnum) {
	
	 var field_userid = "status:"+$appnum ;
        var value = "Rejected" ;
			  console.log("reject");
			  
			  	var str = field_userid + "=" + value;
			jQuery.ajax({
				type: "POST",
				url: "micro.php",
				data: str,
				cache: false,
				 dataType: 'text',
				success: function(data){
						//jQuery('#down_update').html(htmld);
						
							console.log(data);
							
							if(data=="Updated")
				{
					$("#status"+$appnum).text("Rejected");
					
					new $.nd2Toast({ // The 'new' keyword is important, otherwise you would overwrite the current toast instance
   message :"AppNo : "+ $appnum+ " marked as REJECTED Successfully.", // Required
     color : "green" ,// optional color of the button (default: 'lime')
   ttl : 3000 // optional, time-to-live in ms (default: 3000)
 });
 
				}
				}
			});
    /*    $.post('micro.php' , field_userid + "=" + value, function(data){
            if(data != '')re
			{
			//	message_status.show();
			//	message_status.text(data);
			console.log(data);
				if(data=="Updated")
				{
					$("#status"+$appnum).text("Deleted");
				}
				//hide the message
				//setTimeout(function(){message_status.hide()},1000);
			}
        });*/
	
	  }
	  


	  function approveapp($appnum) {
	
	 var field_userid = "status:"+$appnum ;
        var value = "Approved by state" ;
			  console.log("Approved");
			  
			  	var str = field_userid + "=" + value;
			jQuery.ajax({
				type: "POST",
				url: "micro.php",
				data: str,
				cache: false,
				 dataType: 'text',
				success: function(data){
						//jQuery('#down_update').html(htmld);
						
							console.log(data);
							
							if(data=="Updated")
				{
					$("#status"+$appnum).text("Approved by state");
					
					new $.nd2Toast({ // The 'new' keyword is important, otherwise you would overwrite the current toast instance
   message :"AppNo : "+ $appnum+ " marked as Approved by state Successfully.", // Required
     color : "green" ,// optional color of the button (default: 'lime')
   ttl : 3000 // optional, time-to-live in ms (default: 3000)
 });
 
				}
				}
			});
    /*    $.post('micro.php' , field_userid + "=" + value, function(data){
            if(data != '')
			{
			//	message_status.show();
			//	message_status.text(data);
			console.log(data);
				if(data=="Updated")
				{
					$("#status"+$appnum).text("Deleted");
				}
				//hide the message
				//setTimeout(function(){message_status.hide()},1000);
			}
        });*/
	
	  }



	  function deleteapp($appnum) {
	
	 var field_userid = "status:"+$appnum ;
        var value = "Delete" ;
			  console.log("delete");
			  
			  	var str = field_userid + "=" + value;
			jQuery.ajax({
				type: "POST",
				url: "micro.php",
				data: str,
				cache: false,
				 dataType: 'text',
				success: function(data){
						//jQuery('#down_update').html(htmld);
						
							console.log(data);
							
							if(data=="Updated")
				{
					$("#status"+$appnum).text("Deleted");
					
					new $.nd2Toast({ // The 'new' keyword is important, otherwise you would overwrite the current toast instance
   message :"AppNo : "+ $appnum+ " marked for Deletion Successfully.", // Required
     color : "green" ,// optional color of the button (default: 'lime')
   ttl : 3000 // optional, time-to-live in ms (default: 3000)
 });
 
				}
				}
			});
    /*    $.post('micro.php' , field_userid + "=" + value, function(data){
            if(data != '')
			{
			//	message_status.show();
			//	message_status.text(data);
			console.log(data);
				if(data=="Updated")
				{
					$("#status"+$appnum).text("Deleted");
				}
				//hide the message
				//setTimeout(function(){message_status.hide()},1000);
			}
        });*/
	
	  }
	  
	 
	 	    function loadfromrsfidb($appno,$dobs)
	  {


	  	if($appno=="" || $dobs=="" )
	  	{
	  		alert("Please enter application number and date of birth.");
	  		return;
	  	}

	 // 	alert($appno);
loadprof($appno,$dobs);	

	  }

	    function loadfromrsfidb($appno)
	  {


	  	if($appno==""  )
	  	{
	  		alert("Please enter application number and date of birth.");
	  		return;
	  	}

	 // 	alert($appno);
loadprof($appno,"");	

	  }

	 
	  function loadprof($appnum)	 
	  {
		  
		   $('input[data-type="search"]').val("");
	 $('input[data-type="search"]').trigger("keyup");
		  
		  
		   var interval = setInterval(function(){
        $.mobile.loading('show');
        clearInterval(interval);
    },1);  
	 
	// $("#formhead").text("Edit Entry");
	 
	  $("#photofile").prop("required",false);
	 $("#photofile1").prop("required",false);
	 
	 $('.cropit-image-preview').css('background-image', ''); //remove preview-images
$('.cropit-image-background').removeAttr('src'); //remove background images
	 
	 //alert(appnum);
	 // $.cookie('last-scroll-top', $(window).scrollTop());
	 // $('#myPopup').popup('open'); 
	/// $.mobile.navigate( '#entrypage' );
	
/*	$.mobile.changePage(
    "#entrypage",
    {
      allowSamePageTransition : true,
	  transition: "true",
      showLoadMsg             : true,
      reloadPage              : false
	}
    );
	*/


	  clearform();
	//  https://indiaskate.com/skaterbase21/rsfiapi.php?appno=501295&req=load&akey=106a73fee69071e618fbb0d508d8a651
	  jQuery.ajaxSetup({async:false});

	  $.ajax({
  url: "https://indiaskate.com/skaterbase25/sb25.php?&req=load&akey=106a73fee69071e618fbb0d508d8a651&appno="+$appnum,
  success: function(data, status){   //load from rsfi data
    //   alert("Data: " + data + "\nStatus: " + status);
		
		 xmlDoc = $.parseXML( data );
  $xml = $( xmlDoc );
 //console.log($xml);
//alert($xml.find( "stat" ).text());
if($xml.find( "stat" ).text()!="ok")
{
	 $.mobile.loading('hide');
	alert("Invalid Application Number. Please enter a valid number.");
	return;
}

 if($xml.find( "gender" ).text()=='Male')
 {
	$('#gender2').prop('checked', false).checkboxradio( "refresh" );
	   $('#gender1').prop('checked', true).checkboxradio( "refresh" );
	   
	 
 }
else
{
	 $('#gender1').prop('checked', false).checkboxradio( "refresh" );
	$('#gender2').prop('checked', true).checkboxradio( "refresh" );
	
}
 

$('#mode').val("new1");
	 $('#stateref').val($appnum);


  
   $('#sname').val($xml.find("sname").text());
  
     $('#skatertypersfi').val($xml.find("skatertype").text());
  var $dobt=$xml.find( "dob" ).text();
  //21-Mar-2007
  //alert($dobt.substr(7,4)+"-"+$dobt.substr(3,3)+"-"+$dobt.substr(0,2));
  var d=new Date($dobt);
  //alert(d.getMonth()+1);
  var mnth=d.getMonth()+1;
 // alert($dobt.substr(7,4)+"-"+("0" + mnth).slice(-2)+"-"+$dobt.substr(0,2));
////	  $('#dob').val($dobt.substr(7,4)+"-"+("0" + mnth).slice(-2)+"-"+$dobt.substr(0,2));
 // $('#dob').val(d);

  
	//  $('#dob').val($dobt.substr(6,4)+"-"+$dobt.substr(3,2)+"-"+$dobt.substr(0,2));
	console.log($dobt);
	  $('#dobyear').val($dobt.substr(7,4)).change(); 
$('#dobmonth').val($dobt.substr(3,3)).change(); 
$('#dobdate').val($dobt.substr(0,2)).change(); 

 
	  $('#age').val("");
	  $('#ag').val("");
	  $('#phone').val($xml.find( "phone" ).text());
	  	 
		  	  $('#address').val($xml.find( "address" ).text());
			  	  $('#blood').val($xml.find( "bloodgroup" ).text());

			  	  $('#email').val($xml.find( "email" ).text());
$('#pin').val($xml.find( "pin" ).text());
$('#city').val($xml.find( "city" ).text());
$('#address2').val($xml.find( "address2" ).text());
$('#school').val($xml.find( "school" ).text());		

 // $('#repstate').val($xml.find( "repdistrict" ).text()).change();
 //$('#repdistrict').append(`<option>Select District</option>`);

$repdt=$xml.find('repdistrict').text();
if($repdt=="Chengalpattu")
{
	$repdt="Kanchipuram";
}
if($repdt=="Tirupathur" || $repdt=="Ranipet" )
{
	$repdt="Vellore";
}
if($repdt=="Kallakurichi" )
{
	$repdt="Viluppuram";
}
if($repdt=="Tenkasi" )
{
	$repdt="Tirunelveli";
}

           $('#repdistrict').append(`<option>`+$repdt+`</option>`);

$('#repdistrict').val("SELECT DISTRICT").change();



var $clubsjson="";
$.getJSON("clubs.json", function(json) {
  //  console.log(json); // this will show the info it in firebug console
	$clubsjson=json;
	
});

//   //load districts
//    $('#repstate').empty();//.append($('<option></option>').val('Select District').html('Select District'));
//     var matchVal = $($xml.find( "repdistrict" ).text()).text();
//     $clubsjson.filter(function (dts) {
//         if (dts.district== matchVal) {
//             $("#repstate").append($('<option></option>').val(dts.clubname).html(dts.clubname));
// 			}

// console.log($xml.find( "repdistrict" ).text()+dts.clubname);
// 	});
	
// 	 $("#repstate").val('Select Club / Team').change();
// $('#repdistrict').trigger("change");
// $('#repdistrict').trigger("refresh");



 $('#syllabus').val($xml.find( "syllabus" ).text()).change();


				  //	  $('#photofile').val($xml.find( "photo" ).text());
				///	 $('#uploadedphoto').attr("src",$xml.find( "photo" ).text());
					 d = new Date();
					 if($xml.find( "doburl" ).text() != "")
					 {
				//j	 $('#uploadeddob').attr("src","https://indiaskate.com/skaterbase21/"+$xml.find( "doburl" ).text());

					 $('#doburlh').val("https://indiaskate.com/skaterbase22/"+$xml.find( "doburl" ).text());		

					 
					 }
					 
					 	 if($xml.find( "oturl" ).text() != "")
					 {
				//j	 $('#uploadeddob').attr("src",$xml.find( "oturl" ).text());
					 }
					
				//	 $xml.find( "photo" ).text()
					 
					//  $('#photourl').val($xml.find( "photo" ).text()+"?"+d.getTime());
					  
					   // $('#image-editor2 > div.cropit-preview.box > div').css('background-image', 'url(' + $xml.find( "doburl" ).text() + ')');
					   
					   //   $('#image-editor2 > div.cropit-preview.box > div').css('background-size','contain');
						  // $('#image-editor2 > div.cropit-preview.box > div').css('background-repeat','no-repeat');


						  //   $('#image-editor3 > div.cropit-preview.box > div').css('background-image', 'url(' + $xml.find( "oturl" ).text() + ')');
					   
					   //   $('#image-editor3 > div.cropit-preview.box > div').css('background-size','contain');
						  // $('#image-editor3 > div.cropit-preview.box > div').css('background-repeat','no-repeat');
					
					  $('#entryform > div:nth-child(2) > div:nth-child(1) > div > div > div.cropit-preview.box > div').css('background-image', 'url(' + $xml.find( "photourl" ).text() + ')');
					  


					  
					  //$('.cropit-preview-image-container').empty().html('<img class="cropit-preview-image" alt="img"  src="'+$xml.find( "photo" ).text()+'"');
					  
					 // $('.cropit-image-background').removeAttr('src');
					 
					 // $('.image-editor').cropit('imageSrc', window.location.href.split("#")[0].substring(0, window.location.href.split("#")[0].lastIndexOf('/') + 1)+$xml.find( "photo" ).text());
  // alert( window.location.href.split("#")[0].substring(0, window.location.href.split("#")[0].lastIndexOf('/') + 1)+$xml.find( "photo" ).text());
 //window.open(window.location.href.split("#")[0].substring(0, window.location.href.split("#")[0].lastIndexOf('/') + 1)+$xml.find( "photo" ).text(),'_blank');
  
  
    calcagegroup();
  //setraces();
  
  
  	  $('#skatertype2').prop('checked', false).checkboxradio( "refresh" );
	   $('#skatertype3').prop('checked', false).checkboxradio( "refresh" );
	   $('#skatertype1').prop('checked', false).checkboxradio( "refresh" );
	   $('#skatertype4').prop('checked', false).checkboxradio( "refresh" );
	   $('#skatertype5').prop('checked', false).checkboxradio( "refresh" );
	   $('#skatertype6').prop('checked', false).checkboxradio( "refresh" );
	   $('#skatertype7').prop('checked', false).checkboxradio( "refresh" );
	   $('#skatertype8').prop('checked', false).checkboxradio( "refresh" );
	   $('#skatertype9').prop('checked', false).checkboxradio( "refresh" );
	   $('#skatertype10').prop('checked', false).checkboxradio( "refresh" );
	   $('#skatertype11').prop('checked', false).checkboxradio( "refresh" );
	   $('#skatertype12').prop('checked', false).checkboxradio( "refresh" );
	   $('#skatertype13').prop('checked', false).checkboxradio( "refresh" );
	    $('#skatertype14').prop('checked', false).checkboxradio( "refresh" );

	        $('#skatertype15').prop('checked', false).checkboxradio( "refresh" );
	            $('#skatertype16').prop('checked', false).checkboxradio( "refresh" );
	                $('#skatertype17').prop('checked', false).checkboxradio( "refresh" );
	                    $('#skatertype18').prop('checked', false).checkboxradio( "refresh" );
	   

	   $("input[name=skatertype][value=" + $xml.find( "skatertype" ).text() + "]").prop('checked', true);

	  if($xml.find( "skatertype" ).text()=="Inline-Alpine" || $xml.find( "skatertype" ).text()=="Inline-Downhill" )
	  {
	  	$("input[name=skatertype][value=Alpine-Downhill]").prop('checked', true);
	  }

	
 
 setraces();
console.log("loading values...");

//$('#photo-data').val($xml.find( "photo" ).text());
  $('.hidden-image-data').val($xml.find( "photourl" ).text());
   $('.hidden-dob-data').val($xml.find( "doburl" ).text());
   
$('#school').val($xml.find( "school" ).text());

   $('#rsfiappno').val($appnum);
   //alert($('#rsfino').val());

//alert("rh" + $xml.find( "rollerhockey" ).text());

// sch=$xml.find( "school" ).text();
//alert(sch);
//$('#select-choice-1b').val(sch).prop('selected', true);
//alert($xml.find("parentoccupation").text());
//$('#parentoccupation').val($xml.find("parentoccupation").text());
//alert($xml.find( "clubname" ).text());
//$('#clubname').val($xml.find( "clubname" ).text()).change();

//$('#parentoccupation').val($xml.find("parentoccupation").text());
//$('#residingstate1').val($xml.find("residingstate").text());
//$('#residingdistrict1').val($xml.find("residingdistrict").text());
 // $('#repstate').val($xml.find( "clubname" ).text()).change();
  // $('#repstate').val($xml.find( "clubname" ).text()).change();



// jQM refresh
//$('#select-choice-1b').selectmenu("refresh", true);


 var interval = setInterval(function(){
        $.mobile.loading('hide');
        clearInterval(interval);
    },1); 
	
	 $('#entrypage').trigger('create');

	 	$.mobile.changePage(
    "#entrypage",
    {
      allowSamePageTransition : true,
	  transition: "true",
      showLoadMsg             : true,
      reloadPage              : false
	}
    );

  
    }
});


	//  $.get(, ); //end of get


	
 $.mobile.loading('hide');

 console.log("done loading rsfi");

	  }


 function editapp($appnum) {
	 
//	alert("Coming Soon..");
//	return;
	 
  var interval = setInterval(function(){
        $.mobile.loading('show');
        clearInterval(interval);
    },1);  
	 
	 $("#formhead").text("Edit Entry");
	 
	  $("#photofile").prop("required",false);
	 $("#photofile1").prop("required",false);
	 $("#photofile3").prop("required",false);
	 
	 $('.cropit-image-preview').css('background-image', ''); //remove preview-images
$('.cropit-image-background').removeAttr('src'); //remove background images
	 
	 //alert(appnum);
	 // $.cookie('last-scroll-top', $(window).scrollTop());
	 // $('#myPopup').popup('open'); 
	/// $.mobile.navigate( '#entrypage' );
	
	$.mobile.changePage(
    "#entrypage",
    {
      allowSamePageTransition : true,
	  transition: "true",
      showLoadMsg             : true,
      reloadPage              : false
	}
    );
	


	  clearform();
	  
	  $.get("service1.php?&req=edit&appno="+$appnum, function(data, status){
    //   alert("Data: " + data + "\nStatus: " + status);
		
		 xmlDoc = $.parseXML( data ),
  $xml = $( xmlDoc );
   //alert($xml.find( "gender" ).text());
 if($xml.find( "gender" ).text()=='Male')
 {
	$('#gender2').prop('checked', false).checkboxradio( "refresh" );
	   $('#gender1').prop('checked', true).checkboxradio( "refresh" );
	   
	 
 }
else
{
	 $('#gender1').prop('checked', false).checkboxradio( "refresh" );
	$('#gender2').prop('checked', true).checkboxradio( "refresh" );
	
}

 if($xml.find( "agegroup" ).text()=='Above 35 - Master')
 {
	$('#masters').prop('disabled', false).checkboxradio( "refresh" );
	   $('#masters').prop('checked', true).checkboxradio( "refresh" );
	   
	 
 }
else
{
	$('#masters').prop('disabled', true).checkboxradio( "refresh" );
	   $('#masters').prop('checked', false).checkboxradio( "refresh" );
	
}

$('#mode').val("edit");
	 $('#applno').val($appnum);

  $('#rsfiappno').val($xml.find( "skaterid" ).text());
  
   $('#sname').val($xml.find( "sname" ).text());
      $('#skatertypersfi').val($xml.find( "skatertype" ).text());
  
  var $dobt=$xml.find( "dob" ).text();
  
	//  $('#dob').val($dobt.substr(6,4)+"-"+$dobt.substr(3,2)+"-"+$dobt.substr(0,2));


	 
	console.log($dobt);
	  $('#dobyear').val($dobt.substr(7,4)).change(); 
$('#dobmonth').val($dobt.substr(3,3)).change(); 
$('#dobdate').val($dobt.substr(0,2)).change(); 


	  $('#age').val("");
	  $('#ag').val("");
	  $('#phone').val($xml.find( "phone" ).text());

   $('#repdistrict').append(`<option>`+$xml.find('repdistrict').text()+`</option>`);

	    $('#repdistrict').val($xml.find( "repdistrict" ).text());

	       $('#repstate').append(`<option>`+$xml.find('repstate').text()+`</option>`);

    $('#repstate').val($xml.find( "repstate" ).text());


	  	   $('#email').val($xml.find( "email" ).text());
		  	  $('#address').val($xml.find( "address" ).text());
		  	   	  $('#address2').val($xml.find( "address2" ).text());
		  	   	   	  $('#city').val($xml.find( "city" ).text());
		  	   	   	   	  $('#pin').val($xml.find( "pin" ).text());

			  	  $('#blood').val($xml.find( "bloodgroup" ).text());
				 
				  //	  $('#photofile').val($xml.find( "photo" ).text());
				///	 $('#uploadedphoto').attr("src",$xml.find( "photo" ).text());
					 d = new Date();
					 if($xml.find( "doburl" ).text() != "")
					 {
					 $('#uploadeddob').attr("src",$xml.find( "doburl" ).text());
					 }
					 
					  if($xml.find( "oturl" ).text() != "")
					 {
					 $('#uploadedot').attr("src",$xml.find( "oturl" ).text());
					 }
					 
					
				//	 $xml.find( "photo" ).text()
					 
					//  $('#photourl').val($xml.find( "photo" ).text()+"?"+d.getTime());
					  
					   $('#image-editor2 > div.cropit-preview.box > div').css('background-image', 'url(' + $xml.find( "doburl" ).text() + ')');
					   
					     $('#image-editor2 > div.cropit-preview.box > div').css('background-size','contain');
						  $('#image-editor2 > div.cropit-preview.box > div').css('background-repeat','no-repeat');
						  
						   $('#image-editor3 > div.cropit-preview.box > div').css('background-image', 'url(' + $xml.find( "oturl" ).text() + ')');
					   
					     $('#image-editor3 > div.cropit-preview.box > div').css('background-size','contain');
						  $('#image-editor3 > div.cropit-preview.box > div').css('background-repeat','no-repeat');


				
					  $('#entryform > div:nth-child(2) > div:nth-child(1) > div > div > div.cropit-preview.box > div').css('background-image', 'url(' + $xml.find( "photourl" ).text() + ')');
					  
					  
					  //$('.cropit-preview-image-container').empty().html('<img class="cropit-preview-image" alt="img"  src="'+$xml.find( "photo" ).text()+'"');
					  
					 // $('.cropit-image-background').removeAttr('src');
					 
					 // $('.image-editor').cropit('imageSrc', window.location.href.split("#")[0].substring(0, window.location.href.split("#")[0].lastIndexOf('/') + 1)+$xml.find( "photo" ).text());
  // alert( window.location.href.split("#")[0].substring(0, window.location.href.split("#")[0].lastIndexOf('/') + 1)+$xml.find( "photo" ).text());
 //window.open(window.location.href.split("#")[0].substring(0, window.location.href.split("#")[0].lastIndexOf('/') + 1)+$xml.find( "photo" ).text(),'_blank');
  
  
    calcagegroup();
  //setraces();
  
  
  	  $('#skatertype2').prop('checked', false).checkboxradio( "refresh" );
	   $('#skatertype3').prop('checked', false).checkboxradio( "refresh" );
	   $('#skatertype1').prop('checked', false).checkboxradio( "refresh" );
	   $('#skatertype4').prop('checked', false).checkboxradio( "refresh" );
	   $('#skatertype5').prop('checked', false).checkboxradio( "refresh" );
	   $('#skatertype6').prop('checked', false).checkboxradio( "refresh" );
	   $('#skatertype7').prop('checked', false).checkboxradio( "refresh" );
	   $('#skatertype8').prop('checked', false).checkboxradio( "refresh" );
	   $('#skatertype9').prop('checked', false).checkboxradio( "refresh" );
	   $('#skatertype10').prop('checked', false).checkboxradio( "refresh" );
	   $('#skatertype11').prop('checked', false).checkboxradio( "refresh" );
	   $('#skatertype12').prop('checked', false).checkboxradio( "refresh" );
	   $('#skatertype13').prop('checked', false).checkboxradio( "refresh" );
	    $('#skatertype14').prop('checked', false).checkboxradio( "refresh" );
	   
	        $('#skatertype15').prop('checked', false).checkboxradio( "refresh" );
	            $('#skatertype16').prop('checked', false).checkboxradio( "refresh" );
	                $('#skatertype17').prop('checked', false).checkboxradio( "refresh" );
	                    $('#skatertype18').prop('checked', false).checkboxradio( "refresh" );
	   

	   	   $("input[name=skatertype][value=" + $xml.find( "skatertype" ).text() + "]").prop('checked', true);


 
 
 setraces();
console.log("loading values...");

//$('#photo-data').val($xml.find( "photo" ).text());
  $('.hidden-image-data').val($xml.find( "photourl" ).text());
   $('.hidden-dob-data').val($xml.find( "doburl" ).text());
      $('.hidden-ot-data').val($xml.find( "oturl" ).text());

      $('#dobfile').prop('required', false);
   
  if($xml.find( "rink1" ).text()=='P')
 {
	 
 $('#rink1').prop("checked",true).checkboxradio("refresh");
//console.log("r1...");
 }
  if($xml.find( "rink2" ).text()=='P')
 {$('#rink2').prop("checked",true).checkboxradio("refresh"); }
  if($xml.find( "road1" ).text()=='P')
 { $('#road1').prop("checked",true).checkboxradio("refresh");}
  if($xml.find( "road2" ).text()=='P')
 {$('#road2').prop("checked",true).checkboxradio("refresh"); }

  if($xml.find( "rink3" ).text()=='P')
 {$('#rink3').prop("checked",true).checkboxradio("refresh"); }
  if($xml.find( "rink4" ).text()=='P')
 {$('#rink4').prop("checked",true).checkboxradio("refresh"); }

if($xml.find( "rink5" ).text()=='P')
{$('#rink5').prop("checked",true).checkboxradio("refresh"); }
  
 if($xml.find( "rink6" ).text()=='P')
  	{$('#rink6').prop("checked",true).checkboxradio("refresh"); }

   if($xml.find( "rink7" ).text()=='P')
  	{$('#rink7').prop("checked",true).checkboxradio("refresh"); }
 

  if($xml.find( "p2p" ).text()=='P')
 { $('#p2p').prop("checked",true).checkboxradio("refresh");}
  if($xml.find( "elim" ).text()=='P')
 {$('#elim').prop("checked",true).checkboxradio("refresh"); }


  if($xml.find( "road3" ).text()=='P')
 {$('#road3').prop("checked",true).checkboxradio("refresh"); }
  if($xml.find( "road4" ).text()=='P')
 { $('#road4').prop("checked",true).checkboxradio("refresh");}
  if($xml.find( "road5" ).text()=='P')
 { $('#road5').prop("checked",true).checkboxradio("refresh");}


  if($xml.find( "p2prd" ).text()=='P')
 { $('#p2prd').prop("checked",true).checkboxradio("refresh");}
  if($xml.find( "elimrd" ).text()=='P')
 {$('#elimrd').prop("checked",true).checkboxradio("refresh"); }
  if($xml.find( "relay" ).text()=='P')
 { $('#relay').prop("checked",true).checkboxradio("refresh");}

  if($xml.find( "mixedrelay" ).text()=='P')
 { $('#mixedrelay').prop("checked",true).checkboxradio("refresh");}

  if($xml.find( "marathon" ).text()=='P')
 {$('#marathon').prop("checked",true).checkboxradio("refresh"); }
  
  
  if($xml.find( "u8race1q" ).text()=='P')
 { $('#u8race1q').prop("checked",true).checkboxradio("refresh");}
  if($xml.find( "u8race2q" ).text()=='P')
 {$('#u8race2q').prop("checked",true).checkboxradio("refresh"); }

  if($xml.find( "u8race1i" ).text()=='P')
 { $('#u8race1i').prop("checked",true).checkboxradio("refresh");}
  if($xml.find( "u8race2i" ).text()=='P')
 {$('#u8race2i').prop("checked",true).checkboxradio("refresh"); }

  if($xml.find( "adjrink1" ).text()=='P')
 { $('#rollerscooter').prop("checked",true).checkboxradio("refresh");}
  if($xml.find( "adjrink2" ).text()=='P')
 { $('#tenrace2').prop("checked",true).checkboxradio("refresh");}
 // if($xml.find( "adjrink3" ).text()=='P')
 //{ $('#tenrace3').prop("checked",true).checkboxradio("refresh");}

 if($xml.find( "figure" ).text()=='P')
 { $('#figure').prop("checked",true).checkboxradio("refresh");}
 if($xml.find( "free" ).text()=='P')
 { $('#free').prop("checked",true).checkboxradio("refresh");}
 if($xml.find( "pair" ).text()=='P')
 { $('#pair').prop("checked",true).checkboxradio("refresh");}

$('#pairpartnername').val($xml.find( "pairpartnername" ).text());
$('#pairpartnerag').val($xml.find( "pairpartnerag" ).text());

 if($xml.find( "solodance" ).text()=='P')
	 { $('#solodance').prop("checked",true).checkboxradio("refresh");}
 if($xml.find( "pairdance" ).text()=='P')
 { $('#coupledance').prop("checked",true).checkboxradio("refresh");}
$('#coupledancepartnername').val($xml.find( "coupledancepartnername" ).text());
$('#coupledancepartnerag').val($xml.find( "coupledancepartnerag" ).text());


 if($xml.find( "inlinefree" ).text()=='P')
 { $('#inlinefree').prop("checked",true).checkboxradio("refresh");}

 if($xml.find( "quartet" ).text()=='P')
 { $('#quartet').prop("checked",true).checkboxradio("refresh");}


 if($xml.find( "classicslalom" ).text()=='P')
 { $('#classicslalom').prop("checked",true).checkboxradio("refresh");}
 if($xml.find( "speedslalom" ).text()=='P')
 { $('#speedslalom').prop("checked",true).checkboxradio("refresh");}

 if($xml.find( "alpine" ).text()=='P')
 { $('#alpine').prop("checked",true).checkboxradio("refresh");}
 if($xml.find( "downhill" ).text()=='P')
 { $('#downhill').prop("checked",true).checkboxradio("refresh");}
 if($xml.find( "rollerderby" ).text()=='P')
 { $('#rollerderby').prop("checked",true).checkboxradio("refresh");}
 if($xml.find( "rollerfreestyle" ).text()=='P')
 { $('#rollerfreestyle').prop("checked",true).checkboxradio("refresh");}
 if($xml.find( "skateboarding" ).text()=='P')
 { $('#skateboarding').prop("checked",true).checkboxradio("refresh");}
 if($xml.find( "precisionskating" ).text()=='P')
 { $('#precision').prop("checked",true).checkboxradio("refresh");}
 if($xml.find( "showgroup" ).text()=='P')
 { $('#showgroup').prop("checked",true).checkboxradio("refresh");}

if($xml.find( "quadhockey" ).text()=='P')
 { $('#rollerhockey1').prop("checked",true).checkboxradio("refresh");}
if($xml.find( "inlinehockey" ).text()=='P')
 { $('#inlinehockey1').prop("checked",true).checkboxradio("refresh");}

$('#select-choice-1b').val($xml.find( "hockeyplayertype" ).text()).change();
//console.log($xml.find( "hockeyplayertype" ).text());
$('#jerseyno').val($xml.find( "jerseyno" ).text());

$('#school').val($xml.find( "school" ).text());

//alert("rh" + $xml.find( "rollerhockey" ).text());

// sch=$xml.find( "school" ).text();
//alert(sch);
//$('#select-choice-1b').val(sch).prop('selected', true);
//alert($xml.find("parentoccupation").text());
$('#parentoccupation').val($xml.find("parentoccupation").text());
$('#residingstate1').val($xml.find("residingstate").text());
$('#residingdistrict1').val($xml.find("residingdistrict").text());
//alert($xml.find( "clubname" ).text());
 $('#clubname').val($xml.find( "clubname" ).text()).change();
  $('#repstate').val($xml.find( "club" ).text()).change();
// $('#repstate').val($xml.find( "clubname" ).text()).change();
 $('#syllabus').val($xml.find( "syllabus" ).text()).change();

// jQM refresh
//$('#select-choice-1b').selectmenu("refresh", true);


 var interval = setInterval(function(){
        $.mobile.loading('hide');
        clearInterval(interval);
    },1); 
	
	 $('#entrypage').trigger('create');
  
    });
	
 $.mobile.loading('hide');
 }	
	function printlist()
	{
		var doc = new jsPDF('landscape');
var specialElementHandlers = {
    '#editor': function (element, renderer) {
        return true;
    }
};


    doc.fromHTML($('#listtable').html(), 150, 150, {
        'width': 1000,
            'elementHandlers': specialElementHandlers
    });
   // doc.save('sample-file.pdf');
doc.output('dataurlnewwindow');

alert("hi");
	}