﻿var c_kws = [ ["2008年北京车展", "qq下载", "卡巴7.0激活码", "iphone", "中文维基百科"],["差生", "不要在我寂寞的时候说爱我", "火花", "这就是我", "爱不能做主"],["功夫之王", "左右", "江山美人", "三国之见龙卸甲", "黄石的孩子", "黄金罗盘"],["我爱黑涩会", "越狱兔子", "魔幻手机", "斗牛要不要", "大奥"],["杨思敏", "非主流", "张筱雨", "张柏芝", "俞晴", "陈慧琳", "林志玲"],["旅游", "酒店", "公交查询", "GPS", "自驾路线", "自助游", "出行路线"],["扔谭静坠楼的3名韩国人", "抵制家乐福", "德国最大官方电视台投票中止火炬传递"]];var today=[], today_i=-2;var cur_sc = "sc1";var acc = ["&tn=wode", "&client=pub-1023602766778897&forid=1", "&pid=un_64165_176_13_0"];var sps = [["百度", "http://www.baidu.com/s?ie=utf-8&wd=", "谷歌", "http://www.google.com/custom?hl=zh-CN&ie=utf-8&q=", "狗狗", "http://www.gougou.com/search?id=1014876&search=", "雅虎", "http://search.cn.yahoo.com/search?ei=gbk&p="], ["百度", "http://mp3.baidu.com/m?ie=gb2312&ct=134217728&word=", "狗狗", "http://mp3.gougou.com/search?id=1014876&search=", "雅虎", "http://music.cn.yahoo.com/search?mimetype=all&ei=gbk&p="], ["狗狗", "http://movie.gougou.com/search?id=1014876&search=", "百度", "http://v.baidu.com/search.php?type=0&ie=gb2312&&word="], ["狗狗", "http://video.gougou.com/search?id=1014876&s=", "百度", "http://video.baidu.com/v?ie=gb2312&word="], ["百度", "http://image.baidu.com/i?ie=gb2312&ct=201326592&word=", "谷歌", "http://images.google.cn/images?ie=utf-8&q="], ["百度", "http://map.baidu.com/#word="], ["百度", "http://news.baidu.com/ns?ie=gb2312&word=", "谷歌", "http://news.google.cn/news?ie=utf-8&q="], ];var pref_sp = [0,1,0,0,0,0,0];function init(){ pop_sps();var lis = $('s-cates').getElementsByTagName("LI");for(var i=0; i<lis.length; i++)with(lis[i]){id = "sc" + (i+1);onclick = function() {set_sc(this);};}window.onresize = resize;document.onclick = stat;resize();getToday();set_c_kws();}function resize_sep(o1, o2, id1, id2){var p1 = pos($(o1)), p2 = pos($(o2));with($(id1).style){top = (p1.y - 1) + "px";left = p1.x + "px";width = (p2.x - p1.x + 1) + "px";}var w1 = $(o1).offsetWidth, w2 = $(o2).offsetWidth;with($(id2).style){top = (p1.y - 1) + "px";left = (p2.x + w2) + "px";width = (w1 - w2 + p1.x - p2.x) + "px";}}function resize(){resize_sep('s' ,cur_sc, 'se-l', 'se-r');}function pop_sps(){var sp = $('s-provider');sp.innerHTML = "";var sc = parseInt(cur_sc.substring(2)) - 1;for(var i=0; i<sps[sc].length; i+=2){var o = dc("OPTION");o.innerHTML = sps[sc][i];o.value = sps[sc][i+1];if(pref_sp[sc]*2 == i) o.selected = true;sp.appendChild(o);}}function set_sp(){var sc = parseInt(cur_sc.substring(2)) - 1;pref_sp[sc] = $('s-provider').selectedIndex;}function set_sc(sc){if(sc.id == cur_sc) return;$(cur_sc).className = "";sc.style.color = $(cur_sc).style.color;sc.className = "cur";cur_sc = sc.id;resize();pop_sps(); set_c_kws();}function search(ev){var e = ev || window.event;if(e){var key = window.event ? e.keyCode : e.which;if(key == 13) do_s();}}function do_s(){var orig = $("keyword").value, key = encodeURIComponent(orig);var sp = $('s-provider'), sc = parseInt(cur_sc.substring(2)) - 1;var t = sp.options[pref_sp[sc]].value;var url = sps[sc][pref_sp[sc]*2+1] + ((t.indexOf('gb2312') > 0 || t.indexOf('gbk') > 0 || t.indexOf('#') > 0)? gb2312(orig) : key);if(t.indexOf('.baidu.') > 0)url += acc[0];else if(url.indexOf('.google.') > 0)url += acc[1];else if(url.indexOf('.yahoo.') > 0)url += acc[2];window.open(url);swzdby('s.htm?kw=' + gb2312(orig));}function stat(){var ev = arguments[0] || window.event;var s = ev.target || ev.srcElement;try{if(s.tagName=="A" && s.href.indexOf("http://") == 0){ if(s.href.indexOf("http://" + location.host) != 0) swzdby("e2.htm?url="+s.href);}}catch(e){}return true;}function today_next() {if(!today.length) return;today_i = (today_i+2) % today.length;var td = today[today_i], first = td.length-4;var d = td.substr(0, first) + ".";d += td.substr(first, 2) + ".";d += td.substr(first+2, 2) + " ";$('today-in-history').innerHTML = d + today[today_i+1];}function getToday() {var d = new Date();var m = d.getMonth() + 1;var day = d.getDate();var u = m < 10 ? "0" + m : m;u += day < 10 ? "0" + day : day;ajax("../tih/" + u + ".js", function(d){if(d){eval(d);today = names;}});window.setInterval(today_next, 3000);}function set_c_kws(){$('hot-s-cate').innerHTML = "";var no = parseInt(cur_sc.substring(2)) - 1;for(var i=0;i<c_kws[no].length;i++){var a = dc("A");if(c_kws[no][i].indexOf("#") == 0){ var t = c_kws[no][i].split('#');a.innerHTML = t[1];a.href = t[2];}else{a.innerHTML = c_kws[no][i];if(no > 0 && no < 4)a.href= sps[no][no==1?3:1] + encodeURIComponent(c_kws[no][i]);else a.href= sps[0][1] + encodeURIComponent(c_kws[no][i]) + acc[0];}a.target = "_blank";$('hot-s-cate').appendChild(a);}}function getBit(m,n) {return (m>>n)&1;}function lunar(d){ var nums = "一二三四五六七八九十"; var mons = "正二三四五六七八九十冬腊";var Cal = [0x41A95,0xD4A,0xDA5,0x20B55,0x56A,0x7155B,0x25D,0x92D,0x5192B,0xA95,0xB4A,0x416AA,0xAD5,0x90AB5,0x4BA,0xA5B,0x60A57,0x52B,0xA93,0x40E95];var madd=[0,31,59,90,120,151,181,212,243,273,304,334];var total,m,n,k;var isEnd = false;var t = d.getYear();if (t<1900) t+=1900;total=(t-2001)*365+Math.floor((t-2001)/4)+madd[d.getMonth()]+d.getDate()-23;if(d.getYear()%4==0&&d.getMonth()>1) total++;for(m=0;;m++){k=(Cal[m]<0xfff)?11:12;for(n=k;n>=0;n--){if(total<=29+getBit(Cal[m],n)){ isEnd=true;break;}total = total-29-getBit(Cal[m],n);}if(isEnd) break;}var cYear=2001 + m;var cMonth=k-n+1;var cDay=total;if(k==12){ if(cMonth==Math.floor(Cal[m]/0x10000)+1)cMonth=1-cMonth;if(cMonth>Math.floor(Cal[m]/0x10000)+1) cMonth--; }var cHour=Math.floor((d.getHours()+3)/2); var t=""; if(cMonth<1) { t+="闰";t+=mons.charAt(-cMonth-1);} else {t+=mons.charAt(cMonth-1);}t+="月";t+=(cDay<11)?"初":((cDay<20)?"十":((cDay<30)?"廿":"卅"));if(cDay%10!=0||cDay==10)t+=nums.charAt((cDay-1)%10);return t;}function date(){var d = new Date();var ymd = d.getFullYear() + "年" + (d.getMonth()+1) + "月" + d.getDate() + "日";var week = ['日', '一', '二', '三', '四', '五', '六'];var w = "星期" + week[d.getDay()];var l = "农历" + lunar(d);return ymd + " " + l + " " + w;}