 function JSLoad(url, container, type, defer, language, title)
   {
      // verify / attain container
      if(container == undefined || container == null) container = this;

      // setup container
      if(typeof container.write == "undefined")
         if(typeof container.document != "undefined")
            container = container.document;
         else throw "Invalid container. Unable to load [" + url + "]";

      // no type set
      if(type == undefined || type == null)
      {
         type = '';

         // no language so set default type
         if(language == undefined || language == null)
         {
            language = undefined;
            type = "text/javascript";
         }
      }

      // set default language
      if(language == undefined || language == null) language = "JavaScript";

      // set title
      if(title == undefined || title == null) title = '';

      // set defer
      if(defer == undefined) defer = false;

      // build the script object
      var script = container.createElement("script");
      script.defer = defer;
      script.language = language;
      script.title = title;
      script.type = type;
      script.charset = "UTF-8";//charset="UTF-8"
      script.src = url;

      // dynamically load the script via it's container
      var head = container.getElementsByTagName("head")[0];
      head.appendChild(script);
   }

function $(idName){
	return document.getElementById(idName);
}
function seo_index(){

	//alert('asdfasd');
	
	var rank=$('iciba_rank').getElementsByTagName('span');
	var result=$('iciba_result').getElementsByTagName('dd');
	var baidu=$('iciba_baidu').getElementsByTagName('span');
	//alert(result.length);
	var url=$('seo_text').value;
	url=url.replace(' ','');
	url=url.replace('http://','');
	url=url.replace('https://','');
	url=url.replace('//','/');
	
	//alert(url);
	if(url==''){
		alert('请输入网址');
		$('seo_text').focus();
		return ;
	}
	$('iciba_content').style.display='';	
	seo_indexP(rank,url);
	seo_indexP(result,url);
	seo_indexP(baidu,url);

}

function seo_indexP(baidu,url){		
		
		  
	   var qvar='';	
		for(i=0;i<baidu.length;i++){
		if(baidu[i].id!=''){			
			qvar=location.pathname+'?script=js' ;//'/seo_index.php?script=js';
			qvar +='&url='+url;
			qvar +='&id='+baidu[i].id;
			$(baidu[i].id).innerHTML='<img src="img/loading.gif"/>';
			//alert(qvar);
			JSLoad(qvar);
		}
	}
}
//
function index_cha(type){
	var f= $('sub_f');
	f.target='_blank';
	switch(type){
		case 1:
		case 2:
			//alert('asdf');
		    y= $('year').value;
		    m= $('month').value;
		    d= $('day').value;
			if(type==1){
				f.action='/www/riqimima.php?m='+m+'&d='+d;
			}else{
				f.action='/www/xifang.php?m='+m+'&d='+d+'&y='+y;
			}
		break;
		case 3:
			xzuo= $('xingzuo').value;
			f.action='/www/xingzuo.php?xz='+xzuo;
		break;
		case 4:
			xzuo= $('sxiao').value;
			f.action='/www/shx.php?sx='+xzuo;
		break;
		case 5:
			v1= $('xz1').value;
			v2= $('xz2').value;
			f.action='/www/xingzuodui.php?v1='+v1+'&v2='+v2;
		break;
		case 6:
			v1= $('xxing1').value;
			v2= $('xxing2').value;
			f.action='/www/xiexing.php?v1='+v1+'&v2='+v2;
		break;
		case 7:
			var sArr= new Array('鼠','牛','虎','兔','龙','蛇','马','羊','猴','鸡','狗','猪');
			v1= $('sxiao1').value;
			v2= $('sxiao2').value;
			f.action='/www/shengxiao.php?q='+encodeURIComponent(sArr[v1]+sArr[v2]);
		break;
		default:		
		return ;
	}
	f.submit();

}
function index_search(){
	//alert('hello');
	var search=$('search_txt').value;
	search=search.replace(/ /ig,'');
	if(search==''){
		//alert("请填写搜索内容");
		$('search_txt').focus();
		return;
	}
	var j=0;
	var re=new Array();
	search= search.toLowerCase();
	for(i=0;i<muDate.length;i++){	
		 tArr=muDate[i].split('__');
		 tem=tArr[0].toLowerCase();
		if(tem.indexOf(search)>-1){
			re[j]=i;
			j++;
		}
	}
	if(re.length==0){
		alert("无符合的内容");
		$('search_txt').focus();
		$('search_txt').select();
		return;
	}
	if(re.length==1){
		tArr=muDate[re[0]].split('__');
		//alert(tArr[1]);
		location.href=tArr[1];
		return ;
	}
	str='<ul>';
	for(i=0;i<re.length;i++){
		tArr=muDate[re[i]].split('__');
		if(tArr[1].indexOf('http')>=0) targ='target="_blank"';targ='';
		str+='<li><a href="'+tArr[1]+'" '+targ+'>'+tArr[0]+'</a></li>';
	}
	str+='</ul>';
	pos= getCoords($('search_txt'));
	note=$('search_context');
	note.style.left= pos.x+'px';
	note.style.top= (pos.y+20)+'px';
	note.innerHTML= str ;
	note.style.zIndex =1000;
	//note.style.backgroundColor ='red';
	note.style.width = $('search_txt').offsetWidth+'px';
	note.style.display='';
	note.className='search_context';
	
}
var index_searchD=function(){
	//alert('asdfd');
	note=$('search_context');
	note.style.display='none';
}
var iciba_search=function(type){
	//alert(type);
	var f= $('sub_f');
	f.target='_blank';
	if(type==1){
		v= $('iciba_txt').value;
		if(v=='') return ;
		f.action='http://www.iciba.com/'+encodeURIComponent(v);;
	}
	if(type==2){
		v= $('iciba_txt').value;
		if(v=='') return ;
		f.action='http://dj.iciba.com/'+encodeURIComponent(v);;
	}
	if(type==3){
		v= $('iciba_txtB').value;
		if(v=='') return ;
		f.action='http://www.iciba.com/'+encodeURIComponent(v);;
	}
	if(type==4){
		v= $('iciba_txtB').value;
		if(v=='') return ;
		f.action='http://dj.iciba.com/'+encodeURIComponent(v);;
	}
	f.submit();
}
var getCoords=function (node){
    var x = node.offsetLeft;
    var y = node.offsetTop;
    var parent = node.offsetParent;
    while (parent != null){
        x += parent.offsetLeft;
        y += parent.offsetTop;
        parent = parent.offsetParent;
    }
    return {x: x, y: y};
}
var objs= new Array();
window.onload=function(){
	if(!$('iciba_menu')) return ;
	var td=$('iciba_menu').getElementsByTagName('td');	
	j=0;
	search=location.pathname; 
	search=search.toLowerCase();; 
	key=-1;
	for(i=0;i<mStr.length;i++){
		if(mStr[i].toLowerCase().indexOf(search)>=0){
			key=i;
			break;
		}
	}
	//alert(key+':'+search);
	for(i=0;i<td.length;i++){
		if(td[i].getAttribute('menu')!=null){
			td[i].onmouseover=mover;
			td[i].onmouseout=mouter;
			if($(td[i].getAttribute('menu'))!=null){
				td[i].onmousedown=mdownr;
				objs[j]=td[i];
				objs[j].className='menu';
				j++;
			}
		}
	}	
	note=objs[key];
	mid =(note.getAttribute('menu'));
	$(mid).style.display='';
	note.className='menu_select';
	note.content= 'menu_select';
	//var tdM=

}

function mover(e){
	e= e|| window.event;
	note= e.srcElement||e.target;
	note.content = note.className;
	note.className="menu_over";
	
}
function mouter(e){
	e= e|| window.event;
	note= e.srcElement||e.target;
	note.className= note.content;
}
function mdownr(e){
	e= e|| window.event;
	note= e.srcElement||e.target;//parseInt
	mid =(note.getAttribute('menu'));
	//alert(mid);
	for(i=0;i<objs.length;i++){
		$(objs[i].getAttribute('menu')).style.display='none';//$(td[i].getAttribute('menu'));
		objs[i].className="menu";
	}
	$(mid).style.display='';
	note.className='menu_select';
	note.content= 'menu_select';
}

function more(){
	pos=getCoords($('more'));
	m=$('more_context');
	m.style.left= (pos.x-20)+'px';
	m.style.top= (pos.y+15)+'px';
	if(m.style.display=='none')m.style.display='';
	else m.style.display='none';
}

var muDate= new Array();
var mStr= new Array();
mStr[0]='天气预报__/weather/-||-在线度量衡__/unit-converter/-||-列车时刻表__/TrainTimetable/-||-手机号码所在区域查询__/mobile/-||-汉字简繁体转换__/jianfan/-||-五笔编码拼音查询__/wubi/-||-货币汇率__/currency/-||-长度单位换算__/unit-converter/length.php-||-功能热量换算__/unit-converter/heat.php-||-面积换算__/unit-converter/area.php-||-温度换算__/unit-converter/temperature.php-||-体积容量换算__/unit-converter/capacity.php-||-重量换算__/unit-converter/weight.php-||-功率换算__/unit-converter/power.php-||-压力换算__/unit-converter/pressure.php-||-邮编区号查询__/zipcode/-||-身份证查询__/idcard/-||-ems速递查询__/kuaidi/-||-转帖工具__/tools/-||-ip地址查询__/ip/';
mStr[1]='科学__/Calculator/==>个人所得税__/unit-converter/tax.php==>二手房买卖评估计算__/unit-converter/HouseEvaluation.php==>个人贷款__/unit-converter/bxjsq.php==>提前还贷__/unit-converter/tqhd.php==>个人信用评级__/unit-converter/creditstandard.php==>汽车保险计费系统__/unit-converter/CarSafe.php==>税费__/unit-converter/shfjsq.php==>公积金__/unit-converter/gjjjsq.php';
mStr[2]='万年历__/calendar/-||-车牌查询__/carlist/-||-世界时间同步查询__/time/-||-交通标志查询__/biaozhi/-||-安全期查询__/www/safe.php-||-双语菜谱__/caipu/';
mStr[3]='成语查询__/www/chengyu.php-||-历史上的今天__/today/-||-历史朝代表__/www/caodai.php-||-元素周期表__/www/zhouqi.php-||-金山词霸牛津版__http://cb.iciba.com/buy/1006.html-||-谷歌金山词霸__http://g.iciba.com/-||-在线翻译__http://fy.iciba.com-||-金山毒霸__http://www.duba.net/download/index.shtml-||-金山清理专家__http://www.duba.net/qing/-||-金山专杀工具__http://www.duba.net/zhuansha/-||-在线杀毒__http://shadu.duba.net/-||-即划即译V1.0__http://web.iciba.com/partner/jhjy04.shtml-||-浮动翻译__http://web.iciba.com/partner/float01.shtml-||-翻译搜索__http://web.iciba.com/partner/search01.shtml-||-每日一句__http://web.iciba.com/partner/daily01.shtml-||-浏览器查词__http://web.iciba.com/partner/browser01.shtml-||-遨游侧边栏__http://web.iciba.com/partner/browser02.shtml-||-浏览器插件__http://web.iciba.com/partner/browser004.shtml-||-QQ迷你门户__http://web.iciba.com/partner/client01.shtml-||-MSN机器人__http://web.iciba.com/partner/client02.shtml-||-鱼鱼桌面秀__http://web.iciba.com/partner/client03.shtml';
mStr[4]='生肖运程__/www/shx.php-||-生肖配对__/www/shengxiao.php-||-生辰八字__/www/shengchen.php-||-生日密码__/www/riqimima.php-||-星座算命__/www/xingzuo.php-||-指纹算命__/www/zhiwen.php-||-星座配对__/www/xingzuodui.php-||-西方算命__/www/xifang.php-||-金庸人物谱占卜__/www/jinyong.php-||-血型算命__/www/xiex.php-||-三才吉凶__/www/sancai.php-||-周公解梦__/www/zhougong.php-||-血型配对__/www/xiexing.php';
mStr[5]='alex排名查询__/www/alexa.php-||-搜索引擎收录查询__/www/seo_index.php-||-whois查询__/www/whois.php-||-网站反应速度查询__/www/sitespeed.php-||-百度收录查询__/www/baidu2.php-||-google收录查询__/www/google.php-||-网速查询__/www/speed.php-||-网站历史库查询__/www/history.php-||-相关关键字及指数查询__/www/baidu.php-||-随机密码生成器__/www/mima.php';

str='';
cont='';
for(i=0;i<mStr.length;i++){
	str+=cont+mStr[i];
	cont='-||-';
}
muDate= str.split('-||-');

document.onclick=function(e){	
	e= e|| window.event;
	note= e.srcElement||e.target;//parseInt
	if($('more_context') && !isOnDiv(note,'more'))$('more_context').style.display='none';
	if($('search_context') && !isOnDiv(note,'seach_b') && !isOnDiv(note,'search_context'))$('search_context').style.display='none';
}
function isOnDiv(note,id){
	if(note.id==id) return true;
	while(note.parentNode){
		note=note.parentNode;
		if(note.id==id) return true;
	}
	return false;
}