$(document).ready(function(){

      var states = new Array();

      states['2'] = new Array('2006','2007','2008'); //Andhra Pradesh
      states['3'] = new Array('2007','2008'); //Arunachal Pradesh					
      states['4'] = new Array('2006','2007','2008'); //Assam					
      states['5'] = new Array('2006','2007','2008'); //Bihar

      states['33'] = new Array('2006','2007','2008'); //Chhatisgarh
      states['11'] = new Array('2005','2006','2007','2008'); //Gujarat
      states['12'] = new Array('2007','2008'); //Haryana
      states['13'] = new Array('2007','2008'); //Himachal Pradesh
      states['14'] = new Array('2008'); //Jammu & Kashmir
      states['20'] = new Array('2007','2008'); //Jharkhand
      states['15'] = new Array('2007','2008'); //Karnataka
      states['16'] = new Array('2005','2006','2007','2008'); //Kerala

      states['17'] = new Array('2006','2007','2008'); //Madhya Pradesh
      states['18'] = new Array('2005','2006','2007','2008'); //Maharashtra
      states['20'] = new Array('2008'); //Manipur
      states['21'] = new Array('2008'); //Meghalaya
      states['22'] = new Array('2007','2008'); //Mizoram
      states['23'] = new Array('2008'); //Nagaland
      states['24'] = new Array('2006','2007','2008'); //Orissa

      states['26'] = new Array('2008'); //Punjab
      states['27'] = new Array('2007','2008'); //Rajasthan
      states['28'] = new Array('2007','2008'); //Sikkim
      states['29'] = new Array('2005','2006','2007','2008'); //Tamil Nadu
      states['30'] = new Array('2005','2006','2007','2008'); //Tripura
      states['31'] = new Array('2006', '2007', '2008'); //Uttar Pradesh
      states['35'] = new Array('2006','2007','2008'); //Uttaranchal
      states['32'] = new Array('2005','2006','2007', '2008'); //West bengal

  $('#istate').change(function(){
    if($(this).val() != 0) {
      $('#idistrict').find('option').remove();
      $('#idistrict').load(base_url + 'data/state/' + $(this).val());
    }
  });
  $('#idistrict').change(function(){
    if($(this).val() != 0) {
      $('#igp').find('option').remove();
      $('#igp').load(base_url + 'data/district/' + $(this).val());
    }
  });
  $('#igp').change(function(){
    if($(this).val() != 0) {
      $('#details').load(base_url + 'data/gp/' + $(this).val(),function(){
        $('#mapviewcanvas').css('border-color','#445c82');
        $('#ngpTabs').show();
        $('#tabCanvas').html('&nbsp;');
      });
    }
  });
  
  $('#d').click(function(){
    if($('#igp').val() != 0) {
      $('#tabCanvas').load(base_url + 'data/gp_details/' + $('#igp').val());
      
    }
    return false;
  });
  
  $('#p').click(function(){
    $('#tabCanvas').html('&nbsp;');
    if($('#istate').val() != 0) {
      for(x in states[$('#istate').val()]) {
       $('#tabCanvas').html($('#tabCanvas').html() + '&nbsp;' + '<img src="/ngp/public/images/state/'+$('#istate').val() +'-'+'01-'+states[$('#istate').val()][x]+'.jpg" />');
      }
    }
    return false;
  });
  
  $('#t').click(function(){
    $('#tabCanvas').html('&nbsp;');
    if($('#istate').val() != 0) {
      for(x in states[$('#istate').val()]) {
       $('#tabCanvas').html($('#tabCanvas').html() + '&nbsp;' + '<img src="/ngp/public/images/state/'+$('#istate').val() +'-'+'02-'+states[$('#istate').val()][x]+'.jpg" />');
      }
    }
    return false;
  });
  
});
