﻿function moreMenu(page)
{  
  if(page!="0")
  {
    location.href=page;
  }
}


////限制汉字
//function ischinese(s)
//{ 
//    var ret=true;     //onkeyup="value=value.replace(/[^\u4E00-\u9FA5]/g,'')" 
//    for(var i=0;i<s.length;i++) 
//    ret=ret && (s.charCodeAt(i)>=10000); 
//    return ret; 
//}
function ischinese(s)
{   
   if(/^[\u4e00-\u9fa5]+$/.test(s))   
   {           
     return  true;   
   }     
   else  
   {
     return  false;  
   } 
}

//姓氏
function show()
{
  document.getElementById("pop").style.display = "";
}
function hide()
{
  document.getElementById("pop").style.display = "none";
}
function inpt(xing)
{
  document.getElementById("tbxSurname").value=xing;
  document.getElementById("pop").style.display = "none";
}


//生肖
function DaysNumberofDate(DateGL){
return parseInt((Date.parse(DateGL)-Date.parse(DateGL.getYear()+"/1/1"))/86400000)+1;
}
function CnDateofDate(DateGL){
var CnData=new Array(
0x16,0x2a,0xda,0x00,0x83,0x49,0xb6,0x05,0x0e,0x64,0xbb,0x00,0x19,0xb2,0x5b,0x00,
0x87,0x6a,0x57,0x04,0x12,0x75,0x2b,0x00,0x1d,0xb6,0x95,0x00,0x8a,0xad,0x55,0x02,
0x15,0x55,0xaa,0x00,0x82,0x55,0x6c,0x07,0x0d,0xc9,0x76,0x00,0x17,0x64,0xb7,0x00,
0x86,0xe4,0xae,0x05,0x11,0xea,0x56,0x00,0x1b,0x6d,0x2a,0x00,0x88,0x5a,0xaa,0x04,
0x14,0xad,0x55,0x00,0x81,0xaa,0xd5,0x09,0x0b,0x52,0xea,0x00,0x16,0xa9,0x6d,0x00,
0x84,0xa9,0x5d,0x06,0x0f,0xd4,0xae,0x00,0x1a,0xea,0x4d,0x00,0x87,0xba,0x55,0x04
);
var CnMonth=new Array();
var CnMonthDays=new Array();
var CnBeginDay;
var LeapMonth;
var Bytes=new Array();
var I;
var CnMonthData;
var DaysCount;
var CnDaysCount;
var ResultMonth;
var ResultDay;
var yyyy=DateGL.getYear();
var mm=DateGL.getMonth()+1;
var dd=DateGL.getDate();
if(yyyy<100) yyyy+=1900;
if ((yyyy < 1997) || (yyyy > 2020)){
    return 0;
    }
Bytes[0] = CnData[(yyyy - 1997) * 4];
Bytes[1] = CnData[(yyyy - 1997) * 4 + 1];
Bytes[2] = CnData[(yyyy - 1997) * 4 + 2];
Bytes[3] = CnData[(yyyy - 1997) * 4 + 3];
if ((Bytes[0] & 0x80) != 0) {CnMonth[0] = 12;}
else {CnMonth[0] = 11;}
CnBeginDay = (Bytes[0] & 0x7f);
CnMonthData = Bytes[1];
CnMonthData = CnMonthData << 8;
CnMonthData = CnMonthData | Bytes[2];
LeapMonth = Bytes[3];
for (I=15;I>=0;I--){
    CnMonthDays[15 - I] = 29;
    if (((1 << I) & CnMonthData) != 0 ){
      CnMonthDays[15 - I]++;}
    if (CnMonth[15 - I] == LeapMonth ){
      CnMonth[15 - I + 1] = - LeapMonth;}
    else{
      if (CnMonth[15 - I] < 0 ){CnMonth[15 - I + 1] = - CnMonth[15 - I] + 1;}
      else {CnMonth[15 - I + 1] = CnMonth[15 - I] + 1;}
      if (CnMonth[15 - I + 1] > 12 ){ CnMonth[15 - I + 1] = 1;}
    }
}
DaysCount = DaysNumberofDate(DateGL) - 1;
if (DaysCount <= (CnMonthDays[0] - CnBeginDay)){
    if ((yyyy > 1901) && (CnDateofDate(new Date((yyyy - 1)+"/12/31")) < 0)){
      ResultMonth = - CnMonth[0];}
    else {ResultMonth = CnMonth[0];}
    ResultDay = CnBeginDay + DaysCount;
}
else{
    CnDaysCount = CnMonthDays[0] - CnBeginDay;
    I = 1;
    while ((CnDaysCount < DaysCount) && (CnDaysCount + CnMonthDays[I] < DaysCount)){
      CnDaysCount+= CnMonthDays[I];
      I++;
    }
    ResultMonth = CnMonth[I];
    ResultDay = DaysCount - CnDaysCount;
}
if (ResultMonth > 0){
    return ResultMonth * 100 + ResultDay;}
else{return ResultMonth * 100 - ResultDay;}
}
function CnEra(YYYY){
var arrShengXiao=new Array();
arrShengXiao[0] = "生肖属鼠<br>起名宜有：月、艹、山、田、亻、禾、木、米、鱼、宀、金、白、玉、豆、钅等部首为吉。<br>起名忌有：山、刀、力、弓、土、忄、石、皮、氵、马、酉、火、车等部首为凶。";
arrShengXiao[1] = "生肖属牛<br>起名宜有：水、艹、豆、米、金、玉、宀、亻、木、氵、钅等部首为吉。<br>起名忌有：月、火、田、车、马、石、山、血、糸、刀、力、几等部首为凶。";
arrShengXiao[2] = "生肖属虎<br>起名宜有：山、玉、金、木、示、水、月、犭、马、氵、钅等部首为吉。<br>起名忌有：田、口、日、火、足、父、弓、血、力、刀、糸等部首为凶。";
arrShengXiao[3] = "生肖属兔<br>起名宜有：月、艹、山、田、亻、入、禾、木、宀、金、白、玉、豆、钅、犭等部首为吉。<br>起名忌有：马、酉、石、刀、力、皮、氵、川等部首为凶。";
arrShengXiao[4] = "生肖属龙<br>起名宜有：水、金、玉、白、赤、月、鱼、酉、亻、氵、钅等部首为吉。<br>起名忌有：土、田、禾、衣、忄、日、石、艹、力、刀、犭、糸、火等部首为凶。";
arrShengXiao[5] = "生肖属蛇<br>起名宜有：艹、虫、豆、鱼、酉、木、禾、田、山、金、玉、月、土、钅等部首为吉。<br>起名忌有：忄、石、刀、血、弓、亻、糸、火等部首为凶。";
arrShengXiao[6] = "生肖属马<br>起名宜有：艹、金、玉、木、禾、虫、米、亻、月、土、才、钅等部首为吉。<br>起名忌有：田、火、氵、车、石、力、酉、马等部首为凶。";
arrShengXiao[7] = "生肖属羊<br>起名宜有：金、白、玉、月、田、豆、米、马、禾、木、亻、艹、鱼等部首为吉。<br>起名忌有：糸、忄、犭、车、氵、山、日、火等部首为凶。";
arrShengXiao[8] = "生肖属猴<br>起名宜有：木、禾、金、玉、豆、米、田、山、月、水、亻、氵等部首为吉。<br>起名忌有：火、石、口、人、冖、糸、刀、力、皮、犭等部首为凶。";
arrShengXiao[9] = "生肖属鸡<br>起名宜有：米、豆、虫、木、禾、玉、月、宀、冖、山、艹、金、钅等部首为吉。<br>起名忌有：石、糸、刀、力、皮、犭、马、日、酉、弓等部首为凶。";
arrShengXiao[10] = "生肖属狗<br>起名宜有：鱼、豆、米、宀、冖、马、金、玉、艹、田、木、月、禾、水、亻、氵、钅等部首为吉。<br>起名忌有：火、石、山、日、糸、酉、车、刀、父、言等部首为凶。";
arrShengXiao[11] = "生肖属猪<br>起名宜有：豆、米、鱼、水、金、玉、月、木、人、山、土、艹、氵等部首为吉。<br>起名忌有：糸、石、刀、血、弓、儿、皮、父等部首为凶。";
        
return arrShengXiao[YYYY%12];
}
function shengXiao(DateGL){
var YYYY=DateGL.getFullYear();
var MM=DateGL.getMonth()+1;
var CnMM=parseInt(Math.abs(CnDateofDate(DateGL))/100);
if(YYYY<100) YYYY+=1900;
if(CnMM>MM) YYYY--;
YYYY-=1864;
return CnEra(YYYY);
}

function shengXiaoNum(DateGL){
var YYYY=DateGL.getFullYear();
var MM=DateGL.getMonth()+1;
var CnMM=parseInt(Math.abs(CnDateofDate(DateGL))/100);
if(YYYY<100) YYYY+=1900;
if(CnMM>MM) YYYY--;
YYYY-=1864;
return CnEraNum(YYYY);
}
function CnEraNum(YYYY){
//var Tiangan=new Array("甲","乙","丙","丁","戊","己","庚","辛","壬","癸");
//var Dizhi=new Array("子(鼠)","丑(牛)","寅(虎)","卯(兔)","辰(龙)","巳(蛇)",
                    //"午(马)","未(羊)","申(猴)","酉(鸡)","戌(狗)","亥(猪)");
//var Dizhi=new Array("子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥");
var Dizhi=new Array("0","1","2","3","4","5","6","7","8","9","10","11");
return Dizhi[YYYY%12];
}



//星座
function star(month,date)
{ 
if (month == 1 && date >=20 || month == 2 && date <=18) {value = "水瓶座";} 

if (month == 2 && date >=19 || month == 3 && date <=20) {value = "双鱼座";} 

if (month == 3 && date >=21 || month == 4 && date <=19) {value = "白羊座";} 

if (month == 4 && date >=20 || month == 5 && date <=20) {value = "金牛座";} 

if (month == 5 && date >=21 || month == 6 && date <=21) {value = "双子座";} 

if (month == 6 && date >=22 || month == 7 && date <=22) {value = "巨蟹座";} 

if (month == 7 && date >=23 || month == 8 && date <=22) {value = "狮子座";} 

if (month == 8 && date >=23 || month == 9 && date <=22) {value = "室女座";} 

if (month == 9 && date >=23 || month == 10 && date <=22) {value = "天秤座";} 

if (month == 10 && date >=23 || month == 11 && date <=21) {value = "天蝎座";} 

if (month == 11 && date >=22 || month == 12 && date <=21) {value = "人马座";} 

if (month == 12 && date >=22 || month == 1 && date <=19) {value = "摩羯座";} 

return value;
} 

function starNum(month,date)
{ 
if (month == 1 && date >=20 || month == 2 && date <=18) {value = "11";} 

if (month == 2 && date >=19 || month == 3 && date <=20) {value = "12";} 

if (month == 3 && date >=21 || month == 4 && date <=19) {value = "1";} 

if (month == 4 && date >=20 || month == 5 && date <=20) {value = "2";} 

if (month == 5 && date >=21 || month == 6 && date <=21) {value = "3";} 

if (month == 6 && date >=22 || month == 7 && date <=22) {value = "4";} 

if (month == 7 && date >=23 || month == 8 && date <=22) {value = "5";} 

if (month == 8 && date >=23 || month == 9 && date <=22) {value = "6";} 

if (month == 9 && date >=23 || month == 10 && date <=22) {value = "7";} 

if (month == 10 && date >=23 || month == 11 && date <=21) {value = "8";} 

if (month == 11 && date >=22 || month == 12 && date <=21) {value = "9";} 

if (month == 12 && date >=22 || month == 1 && date <=19) {value = "10";} 

return value;
}


function showshare(itype)
{
    var share_title = encodeURI(document.title);
 	    var share_url = encodeURIComponent("http://www.qimingzi.net");
 	    //alert(share_url);
 	    var share_pic = encodeURI('http://www.qimingzi.net/images/logo.gif');

 	    //sina 微博
    if(itype=="1")
    { window.open('http://v.t.sina.com.cn/share/share.php?url='+ share_url+'&title='+ share_title+'&pic='+ share_pic,'_blank');}

    //腾讯微博
    if(itype=="2")
    {
	    var _appkey = encodeURI("8e91bc8984b445bd9e371464fdd8ab28");//你从腾讯获得的appkey
	    var _site = 'http://www.99166.com/';//你的网站地址

	    var _u = 'http://v.t.qq.com/share/share.php?url='+share_url+'&appkey='+_appkey+'&site='+_site+'&pic='+share_pic+'&title='+share_title;
	      window.open( _u,'', 'width=700, height=680, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, location=yes, resizable=no, status=no' );
    }
    //QQ空间
    if(itype=="3"){
	     window.open('http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url='+ share_url,'_blank');
    }
    //人人
    if(itype=="4"){
	     window.open('http://share.renren.com/share/buttonshare.do?link='+ share_url,'_blank');
    }
    //开心网
    if(itype=="5"){
	     window.open('http://www.kaixin001.com/~repaste/repaste.php?&rurl='+ share_url+'&rtitle='+ share_title,'_blank');
    }
    //豆瓣
    if(itype=="6"){
	     window.open('http://www.douban.com/recommend/?url='+ share_url+'&title='+ share_title,'_blank');
    }
      //hi百度
    if(itype=="7"){
	     window.open('http://apps.hi.baidu.com/share/?url='+ share_url+'&title='+ share_title,'_blank');
    }
}

function getYear()
{
  var year=document.getElementById("ddlYear");
  for(var i=1970;i<=2012;i++)
  {
    var option=new Option(i+"年",i);
    year.options.add(option);
  }
  
  var month=document.getElementById("ddlMonth");
  for(var i=1;i<13;i++)
  {
    var option=new Option(i+"月",i);
    month.options.add(option);
  }
  
  var day=document.getElementById("ddlDate");
  for(var i=1;i<31;i++)
  {
    var option=new Option(i+"日",i);
    day.options.add(option);
  }   
  month.value="1";
  day.value="1";
} 
function getHour()
{
  var hour=document.getElementById("ddlHour");
  for(var i=0;i<=23;i++)
  {
    var option=new Option(i+"时",i);
    hour.options.add(option);
  }  
  
  var minute=document.getElementById("ddlMinute");
  for(var i=1;i<=60;i++)
  {
    var option=new Option(i+"分",i);
    minute.options.add(option);
  }   
}   
function getYearB()
{
  var year=document.getElementById("ddlYearB");
  for(var i=1970;i<=2012;i++)
  {
    var option=new Option(i+"年",i);
    year.options.add(option);
  }
  
  var month=document.getElementById("ddlMonthB");
  for(var i=1;i<13;i++)
  {
    var option=new Option(i+"月",i);
    month.options.add(option);
  }
  
  var day=document.getElementById("ddlDateB");
  for(var i=1;i<31;i++)
  {
    var option=new Option(i+"日",i);
    day.options.add(option);
  }   
  month.value="1";
  day.value="1";
}    
function getDate()
{
    var iYear = document.getElementById("ddlYear").value;
    var iMonth = document.getElementById("ddlMonth").value;
    var objDay= document.getElementById("ddlDate");
    objDay.innerHTML="";
    if(iMonth==1||iMonth==3||iMonth==5||iMonth==7||iMonth==8||iMonth==10||iMonth==12)
    {
        for(var j=1;j<=31;j++)
        {             
          var option=new Option(j+"日",j);
          objDay.options.add(option);   
        }
    }
    if(iMonth==4||iMonth==6||iMonth==9||iMonth==11)
    {
        for(var j=1;j<=30;j++)
        {           
          var option=new Option(j+"日",j);
          objDay.options.add(option);  
        }
    }
    if(iMonth==2)
    {
        if (iYear % 4 == 0 && (iYear % 100 != 0 || iYear % 400 == 0))
        {
            for(var j=1;j<=29;j++)
            {           
              var option=new Option(j+"日",j);
              objDay.options.add(option);    
            }
        }
        else
        {
            for(var j=1;j<=28;j++)
            {           
              var option=new Option(j+"日",j);
              objDay.options.add(option);   
            }
        }
    }
    objDay.value="1";
}
function getDateB()
{
    var iYear = document.getElementById("ddlYearB").value;
    var iMonth = document.getElementById("ddlMonthB").value;
    var objDay= document.getElementById("ddlDateB");
    objDay.innerHTML="";
    if(iMonth==1||iMonth==3||iMonth==5||iMonth==7||iMonth==8||iMonth==10||iMonth==12)
    {
        for(var j=1;j<=31;j++)
        {             
          var option=new Option(j+"日",j);
          objDay.options.add(option);   
        }
    }
    if(iMonth==4||iMonth==6||iMonth==9||iMonth==11)
    {
        for(var j=1;j<=30;j++)
        {           
          var option=new Option(j+"日",j);
          objDay.options.add(option);  
        }
    }
    if(iMonth==2)
    {
        if (iYear % 4 == 0 && (iYear % 100 != 0 || iYear % 400 == 0))
        {
            for(var j=1;j<=29;j++)
            {           
              var option=new Option(j+"日",j);
              objDay.options.add(option);    
            }
        }
        else
        {
            for(var j=1;j<=28;j++)
            {           
              var option=new Option(j+"日",j);
              objDay.options.add(option);   
            }
        }
    }
    objDay.value="1";
}


