function gfGetTianQi(){if(localStorage.city){gfGetTianQiDo()}else{var B=navigator.language;if(B=="zh-CN"){var A="http://s-85283.gotocdn.com/getposition.php"}else{var A="http://s-82923.gotocdn.com/get_position.php"}$.get(A,function(C){if(C!="/"&&C!=""){localStorage.city=C;gfGetTianQiDo()}else{}})}}function gfGetTianQiDo(){var E=new Date();var C=E.getFullYear()+"-"+E.getMonth()+E.getDate()+E.getHours();var B=navigator.language;if(!localStorage.city){if(B=="zh-CN"){var D="http://php.weather.sina.com.cn/xml.php?password=DJOYnieT8234jlsK&day=0&city="+UrlEncode("深圳")}else{var D="http://php.weather.sina.com.cn/xml.php?password=DJOYnieT8234jlsK&day=0&city="+UrlEncode("北京")}}else{var A=localStorage.city;if(B=="zh-CN"){var D="http://php.weather.sina.com.cn/xml.php?password=DJOYnieT8234jlsK&day=0&city="+UrlEncode((A))+"&random="+C}else{var D="http://php.weather.sina.com.cn/xml.php?password=DJOYnieT8234jlsK&day=0&city="+UrlEncode((A))+"&random="+C}}$.ajax({url:D,dataType:"xml",success:function(H){var G=$(H);var I="";var F=G.find("city").text();I+=F+"&nbsp;&nbsp;";I+=G.find("temperature1").text()+"℃&nbsp;&nbsp";if(B=="zh-CN"){I+=G.find("status1").text()}else{}if(F!=""){$("#get_wea").html(I);$("#get_wea").attr("city",F);$("#get_wea").attr("foreign_city",F)}},error:function(){return false}})}$(document).ready(function(){gfGetTianQi();$("#get_wea").mousedown(function(){var C=navigator.language;if(C=="zh-CN"){var B=$("#get_wea").attr("city");if(B){var A="http://dh.myie.me/zujian/tianqidetail/?city="+B}else{var A="http://s-85283.gotocdn.com/weather/tianqi.php"}window.open(A,"_blank")}else{var B=$("#get_wea").attr("foreign_city");if(B.length>=3){var A="http://www.bing.com/weather/search?q="+B}else{var A="http://www.bing.com/weather/search?q=weather"}window.open(A,"_blank")}});$("#set_city").mousedown(function(){var B='<div class="lightbox" id="lightbox5">';B+='<div id="setcity">';B+='<div id="wea_back"></div>';B+='<h4 class="h3">'+chrome.i18n.getMessage("default_city")+"</h4>";B+="<p>"+chrome.i18n.getMessage("city_alert")+"</p>";B+='<div style="width:400px;height:50px;margin-bottom:10px;">';B+='<input type="button" class="thebutton" posi="0" id="getposi" value="'+chrome.i18n.getMessage("locate")+'"/>';B+="</div>";B+='<input type="text" class="theinput" id="city_input"/>';B+='<input type="button" class="thebutton" id="wea_finish" value="'+chrome.i18n.getMessage("wea_ok")+'"/>';B+='<div id="city_su">';B+="</div>";B+="</div>";B+="</div>";$("body").append(B);$("#city_input")[0].focus();var C=navigator.language;if(C=="zh-CN"){var A="http://s-85283.gotocdn.com/getposition.php"}else{var A="http://s-82923.gotocdn.com/get_position.php"}$.get(A,function(D){if(D!="/"&&D!=""){$("#getposi").attr("posi",D);$("#getposi").val(D)}else{$("#getposi").val(chrome.i18n.getMessage("locatefailed"))}});$("#getposi").live("mousedown",function(E){var D=$(this).attr("posi");if(D!="0"){$("#city_input").val(D)}});$("#wea_back").click(function(D){$("#lightbox5").remove()});return false});$("#city_input").live("keyup",function(B){$("#city_su").show();var A=$("#city_input").val();if(A==""){$("#city_su").hide()}if(Lang=="zh-CN"){$.get("http://s-85283.gotocdn.com/citysu.php?name="+A,function(D){$("#city_su").children().remove();D=JSON.parse(D);for(var C=0;C<D.length;C++){$("#city_su").append('<div class="city_name" cn="'+D[C]+'">'+D[C]+"</div>")}})}else{$.get("http://s-82923.gotocdn.com/citysu_us.php?name="+A,function(D){$("#city_su").children().remove();D=JSON.parse(D);for(var C=0;C<D.length;C++){$("#city_su").append('<div class="city_name" cn="'+D[C].province+"/"+D[C].cityname+'">'+D[C].province+"/"+D[C].cityname+"</div>")}})}});$(".city_name").live("mousedown",function(B){var A=$(B.target).attr("cn");$("#city_input").val(A)});$("#wea_finish").live("click",function(C){var A=$("#city_input").val();if(A==""){return false}else{var B=A.substring(A.length-1,A.length);if(B=="县"||"区"==B||"市"==B){A=A.substring(0,A.length-1)}localStorage.city=A;$("#get_wea").html(chrome.i18n.getMessage("getweather"));gfGetTianQi();$("#lightbox5").remove()}})});