var regions = [{"name":"Alice Springs","id":"45","state":"Northern Territory"},{"name":"Central Highlands\/Northern","id":"36","state":"Queensland"},{"name":"Central North\/Midlands","id":"19","state":"Tasmania"},{"name":"Central Plateau\/Derwent Valley","id":"21","state":"Tasmania"},{"name":"Central West","id":"4","state":"Western Australia"},{"name":"Central West\/Flinders","id":"37","state":"Queensland"},{"name":"Central Wheat Belt","id":"8","state":"Western Australia"},{"name":"Channel Country","id":"38","state":"Queensland"},{"name":"Darling Downs\/Burnett","id":"40","state":"Queensland"},{"name":"Darwin-Daly","id":"42","state":"Northern Territory"},{"name":"East Coast","id":"18","state":"Tasmania"},{"name":"East Gippsland","id":"32","state":"Victoria"},{"name":"Great Southern","id":"7","state":"Western Australia"},{"name":"Katherine-Roper","id":"43","state":"Northern Territory"},{"name":"Kimberley","id":"3","state":"Western Australia"},{"name":"Mallee","id":"28","state":"Victoria"},{"name":"Maranoa\/Warrego","id":"39","state":"Queensland"},{"name":"Mid-North\/Flinders","id":"26","state":"South Australia"},{"name":"Murraylands","id":"24","state":"South Australia"},{"name":"North Central","id":"34","state":"Victoria"},{"name":"North Coast","id":"10","state":"NSW\/ACT"},{"name":"North East","id":"17","state":"Tasmania"},{"name":"North West","id":"22","state":"Tasmania"},{"name":"North West\/Gulf","id":"41","state":"Queensland"},{"name":"NorthEast","id":"31","state":"Victoria"},{"name":"Northern Country","id":"30","state":"Victoria"},{"name":"Northern Tablelands","id":"12","state":"NSW\/ACT"},{"name":"Northern Wheat\/Sheep","id":"14","state":"NSW\/ACT"},{"name":"Other\/Interior","id":"9","state":"Western Australia"},{"name":"Pilbara","id":"2","state":"Western Australia"},{"name":"Riverland","id":"25","state":"South Australia"},{"name":"South Coast","id":"11","state":"NSW\/ACT"},{"name":"South Coastal","id":"5","state":"Western Australia"},{"name":"South East","id":"20","state":"Tasmania"},{"name":"South West","id":"1","state":"Western Australia"},{"name":"SouthEast","id":"23","state":"South Australia"},{"name":"Southeast Coastal","id":"6","state":"Western Australia"},{"name":"Southern Tablelands","id":"13","state":"NSW\/ACT"},{"name":"Southern Wheat\/Sheep","id":"15","state":"NSW\/ACT"},{"name":"Tennant Creek","id":"44","state":"Northern Territory"},{"name":"West Coast\/Eyre Peninsula","id":"27","state":"South Australia"},{"name":"West\/South Gippsland","id":"33","state":"Victoria"},{"name":"Western","id":"16","state":"NSW\/ACT"},{"name":"Western districts","id":"35","state":"Victoria"},{"name":"Wimmera","id":"29","state":"Victoria"}]; var treeRegions = {"r1":10,"r2":0,"r3":2,"r4":2,"r5":2,"r6":2,"r7":2,"r8":2,"r9":0,"r10":12,"r11":12,"r12":12,"r13":12,"r14":12,"r15":12,"r16":12,"r17":10,"r18":10,"r19":10,"r20":10,"r21":10,"r22":10,"r23":6,"r24":6,"r25":6,"r26":6,"r27":6,"r28":12,"r29":12,"r30":10,"r31":10,"r32":8,"r33":10,"r34":10,"r35":10,"r36":12,"r37":12,"r38":12,"r39":12,"r40":12,"r41":12,"r42":2,"r43":2,"r44":2,"r45":2}; $(document).ready(function(){ if ($('input#region').attr('value') != null && $('input#region').attr('value') != 0){ var f_v = $('input#region').attr('value'); f_v = 'area.state-region[value='+f_v+']'; region_name = $(f_v).attr('alt'); $('span#scenario_region').html(region_name); } $('a.region_pop').click(function(){ var temp = findPosY(this); var temp_x = findPosX(this); temp= temp - 400; temp_x= temp_x - 300; $('#region_box').css('top', temp+"px"); $('#region_box').css('left', temp_x+"px") $("#region_box").fadeIn("slow"); return false; }); $('span.close_region a').click(function(){ $("#region_box").fadeOut("slow"); return false; }); $('span.back_region a').click(function(){ $('span.back_region').hide(); $('img.map_region').attr('src','/assets/img/map_1.png'); $('img.map_region').attr('usemap','#Map'); return false; }); $('area.general').click(function() { var prev_region = $('input#state').attr('value',region); var region = $(this).attr('alt'); if (prev_region != region){ $('span#scenario_region').html(''); $('input#region').attr('value',''); } $('span#scenario_state').html(region); $('input#state').attr('value',region); $("#sheep-option").show(); $("#savana-table").hide(); $('area.general').blur();// need to lose focus on the item for IE7 if(region == 'NSW/ACT'){ $('img.map_region').attr('src','/assets/img/nsw_1.jpg'); $('img.map_region').attr('usemap','#Map-nsw'); } else if (region =='Western Australia'){ $("#savana-table").show(); $('img.map_region').attr('src','/assets/img/wa_1.jpg'); $('img.map_region').attr('usemap','#Map-wa'); } else if (region =='Northern Territory'){ $("input#has_ent_sheep").attr('checked', false); $("#sheep-option").hide(); $("#savana-table").show(); $("#scenario-savana-label").show(); $('img.map_region').attr('src','/assets/img/nt_1.jpg'); $('img.map_region').attr('usemap','#Map-nt'); } else if (region =='South Australia'){ $('img.map_region').attr('src','/assets/img/st_1.jpg'); $('img.map_region').attr('usemap','#Map-st'); } else if (region =='Queensland'){ $("#savana-table").show(); $('img.map_region').attr('src','/assets/img/ql_1.jpg'); $('img.map_region').attr('usemap','#Map-ql'); } else if (region =='Victoria'){ $('img.map_region').attr('src','/assets/img/vic_1.jpg'); $('img.map_region').attr('usemap','#Map-vic'); } else if (region =='Tasmania'){ $('img.map_region').attr('src','/assets/img/taz_1.jpg'); $('img.map_region').attr('usemap','#Map-taz'); } $('span.back_region').show(); return false; }); $('area.state-region').click(function() { var region = $(this).attr('alt'); var index_region = $(this).attr('value'); $('span#scenario_region').html(region); $('input#region').attr('value',index_region); regionActions(); $("#region_box").fadeOut("slow"); return false; }); $('#state').bind('change', function(){ this.form.region.options.length = 1; options = new Array(); for(i=0; i < regions.length; i++){ if(regions[i].state == this.value){ this.form.region.options[this.form.region.options.length] = new Option(regions[i].name, regions[i].id) } } this.form.region.options[0].selected = true; if(this.value=="Northern Territory"){ this.form.has_ent_sheep.checked=false; $("#sheep-option").hide(); }else{ $("#sheep-option").show(); } }); $('#has_ent_beef_store').click(function(){if(this.checked){this.form.ent_beef.checked=true;}}); $('#has_ent_beef_breed').click(function(){if(this.checked){this.form.ent_beef.checked=true;}}); $('#ent_beef').click(function(){if(!this.checked){this.form.has_ent_beef_store.checked=false;this.form.has_ent_beef_breed.checked=false;}}); $('#has_ent_intensive_beef').click(function(){if(this.checked){this.form.ent_intensive_feed.checked=true;}}); $('#has_ent_intensive_pigs').click(function(){if(this.checked){this.form.ent_intensive_feed.checked=true;}}); $('#ent_intensive_feed').click(function(){if(!this.checked){this.form.has_ent_intensive_beef.checked=false;this.form.has_ent_intensive_pigs.checked=false;}}); forcePercentage("#pstr_dry_legume_pct"); forcePercentage("#pstr_wet_legume_pct"); $('#pstr_dry_legume, #pstr_dry_legume_pct').change(function(){ if(!isNaN($("#pstr_dry_legume").val()) && !isNaN($("#pstr_dry_legume_pct").val())){ $("#pstr_dry_legume_pct_more").html(parseInt($("#pstr_dry_legume").val() * ($("#pstr_dry_legume_pct").val() / 100))); } }); $('#pstr_wet_legume, #pstr_wet_legume_pct').change(function(){ if(!isNaN($("#pstr_wet_legume").val()) && !isNaN($("#pstr_wet_legume_pct").val())){ if($("#pstr_wet_legume").val() == 0){ $("#pstr_wet_legume_pct_more").html("0"); }else{ $("#pstr_wet_legume_pct_more").html(parseInt($("#pstr_wet_legume").val() * ($("#pstr_wet_legume_pct").val() / 100))); } } }); forceNumeric("#savana_grasslands_area"); forceNumeric("#savana_grasslands_area_burn"); forceNumeric("#savana_woodlands_area"); forceNumeric("#savana_woodlands_area_burn"); }); function regionActions(){ region = $('input#region').val(); regionCount = treeRegions["r" + region]; if(regionCount == 0){ $("#has_ent_trees")[0].checked = false; $("#ent_trees").hide(); }else{ $("#ent_trees").show(); } }