var __handle=0;var get;var now=new Date();var lmanac=new Array();var lang_default=["当前选择：","当日黄历：","年","月","日","星期","今 天 是：","今日黄历：","结束日期小于开始日期!","查询数据应在三个月范围内!","查询中","查  询","全部","农历：","宜：","忌：","冲：","煞：","正冲：","胎神：","宜","忌","综合运势：","爱情运势：","无对应年份黄历数据!","&nbsp;的日子一共有","天"];var dir=["/his_short/","/lmanac/","http://tianqi.2345.com/astro/"];var cache={"syear":0,"smonth":0,"sday":0,"eyear":0,"emonth":0,"eday":0,"type":"","cond":""};var _width=["12%","7%","12%"];function $(_id){return document.getElementById(_id);}
function $c(_tag){return document.createElement(_tag);}
function loadJs(_url){_timeout=arguments[1]||0;_id=_url.replace(/\//gi,"_");if(typeof($)!="undefined"&&!$(_id)){var _js=document.createElement("script");_js.setAttribute("type","text/javascript");_js.setAttribute("id",_id);_js.setAttribute("src",_url+".js"+(_timeout?"?"+_timeout:""));document.body.insertBefore(_js,null);return true;}
return false;}
function init_get(){var _get=new Array();var _req=location.search.substr(1);if(!_req){return _get;}
_req=_req.split("&");for(_i=0;_i<_req.length;_i++){_r=_req[_i].split("=");_get[_r[0]]=unescape(_r[1]);}
return _get;}
function init(){get=init_get();_t=get["t"]!="j";var _sPre="s_";var _ePre="e_";var _year=now.getFullYear();var _month=now.getMonth()+1;var _day=now.getDate();var _nYear=_month!=12||_year==2011?_year:_year+1;var _nMonth=_year==2011?(_month<12?(_month+1)%12:_month):(_month+1)%12;$("lmanacLuck").checked=_t?"true":"";$("lmanacBad").checked=_t?"":"true";$("lmanacCond").value=get["c"]||"嫁娶";$(_sPre+"year").value=get["sy"]||_year;$(_ePre+"year").value=get["ey"]||_nYear;$(_sPre+"month").value=get["sm"]||_month;$(_ePre+"month").value=get["em"]||_nMonth;changeMonthDay(0);changeMonthDay(1);$(_sPre+"day").value=get["sd"]||_day;$(_ePre+"day").value=get["ed"]||_day;getLmanac();}
function isLeapYear(_oYear){return(((_oYear%4===0)&&(_oYear%100!==0))||(_oYear%400===0));}
function monthDay(_oYear,_oMonth){return[31,(isLeapYear(_oYear)?29:28),31,30,31,30,31,31,30,31,30,31][_oMonth];}
function changeMonthDay(_index){var _pre=_index==0?"s_":"e_";var _daySel=$(_pre+"day");_daySel.innerHTML="";var _oYear=$(_pre+"year").value;var _oMonth=$(_pre+"month").value;var _monthDay=monthDay(_oYear,_oMonth-1);for(_i=0;_i<_monthDay;_i++){var _o=new Option(_i+1,_i+1);_daySel.options.add(_o);}
return true;}
function clearTable(_o){_o.innerHTML="";return true;}
function insertHead(_o,_cond,_count){_o.innerHTML='<div style="text-align:center;border-bottom:#b0d3ee 1px solid;"><b><font class="fred">'+_cond+'</font>'+lang_default[25]+_count+lang_default[26]+'<b></div>'
return true;}
function getLmanac(){_type=$('lmanacLuck').checked?"y":"j";_cond=$("lmanacCond").value;_sPre="s_";_ePre="e_";_sYear=parseInt($(_sPre+"year").value);_eYear=parseInt($(_ePre+"year").value);_sMonth=parseInt($(_sPre+"month").value);_eMonth=parseInt($(_ePre+"month").value);_sDay=parseInt($(_sPre+"day").value);_eDay=parseInt($(_ePre+"day").value);if((_eYear<_sYear)||(_sYear==_eYear&&_eMonth<_sMonth)||(_sYear==_eYear&&_eMonth==_sMonth&&_eDay<_sDay)){alert(lang_default[8]);return false;}
_sDate=new Date(_sYear,_sMonth-1,_sDay);_eDate=new Date(_eYear,_eMonth-1,_eDay);if(_eDate-_sDate>1000*60*60*24*91){alert(lang_default[9]);return false;}
$("query").value=lang_default[10];$("query").blur();$("query").disabled=true;if(cache.syear==_sYear&&cache.eyear==_eYear&&cache.smonth==_sMonth&&cache.emonth==_eMonth&&cache.sday==_sDay&&cache.eday==_eDay&&cache.cond==_cond&&cache.type==_type){setTimeout(function(){$("query").disabled=false;$("query").value=lang_default[11];},250);return true;}
for(_i=_sYear;_i<=_eYear;_i++){loadJs(dir[1]+_i);}
__handle=setTimeout(callback,50);function callback(){var _rs="";var _fm=document.createDocumentFragment();var _count=0;for(_y=_sYear;_y<=_eYear;_y++){for(_m=_y==_sYear?_sMonth:1;_y<_eYear?_m<=12:_m<=_eMonth;_m++){for(_d=(_m==_sMonth)?_sDay:1;(_m<_eMonth||_y<_eYear)?_d<=monthDay(_y,_m-1):_d<=_eDay;_d++){if(!lmanac[_y]){clearTimeout(__handle);__handle=setTimeout(callback,50);}else{_month=_m<10?"0"+_m:_m;_day=_d<10?"0"+_d:_d;_index="d"+_month+_day;_o=lmanac[_y][_index];if(_o){_oDate=_y+lang_default[2]+_month+lang_default[3]+_day+lang_default[4];_data=(_type=="y")?_o.y:_o.j;if(_data.indexOf(_cond)!=-1||_cond==lang_default[12]){_lunar=new U(new Date(_y,_m-1,_d));_count++;_class=_count%2==0?"bgblue":"";_rs+='<span><b>'+_oDate+'&nbsp;'+_lunar.solarWeekDayInChinese+'&nbsp;'+lang_default[13]+_lunar.lunarMonth+lang_default[3]+Math.floor(_lunar.lunarDate)+lang_default[4]+'</b></span>'+"\n";_rs+='<div>';_rs+=_o.y?'<b class="fred">'+lang_default[14]+'</b>'+_o.y:"";_rs+=_o.j?'<br /><b class="fgreen">'+lang_default[15]+'</b>'+_o.j:"";_rs+=_o.c?'<br /><b class="fblue">'+lang_default[16]+'</b>'+_o.c:"";_rs+=_o.s?'<br /><b class="fblue">'+lang_default[17]+'</b>'+_o.s:"";_rs+=_o.zc?'<br /><b class="fblue">'+lang_default[18]+'</b>'+_o.zc:"";_rs+=_o.ts?'<br /><b class="fblue">'+lang_default[19]+'</b>'+_o.ts:"";_rs+="</div>\n";}}}}}}
var _t=$("result");if(clearTable(_t)){_t.style.display="block";if(insertHead(_t,(_cond!=lang_default[12]?((_type=="y"?lang_default[20]:lang_default[21])+":"):"")+_cond,_count)){if(_count>0){_t.innerHTML+=_rs;}
cache.syear=_sYear;cache.eyear=_eYear;cache.smonth=_sMonth;cache.emonth=_eMonth;cache.sday=_sDay;cache.eday=_eDay;cache.cond=_cond;cache.type=_type;setTimeout(function(){$("query").disabled=false;$("query").value=lang_default[11];},300);}}}
return true;}