// JavaScript Document

$(function(){
	$('#keyword').focus(function(){
		if(this.value=="可留空，或输入软件名称、功能等"){
			this.value="";
			$('#keywords').css("color","#000000");
			}
	})
	$('#keyword').blur(function(){
		if(this.value==""){
			this.value="";
			$('#keywords').css("color","#999999");
			}
	})
})

function Check()
{
var keyword= document.getElementById('Formser').keyword;
if(keyword.value=="可留空，或输入软件名称、功能等"){
			keyword.value="";}

}
function CheckInput(){
    var keyword= document.getElementById('FormEnt').keyword;
    var key = document.getElementById('FormArt').keyword;
    var soft= document.getElementById('FormSoft').keyword;
    if(keyword.value=="请输入关键字..."){
        keyword.value="";
    }
	if(key.value == "请输入关键字..."){
	    key.value = "";
	}
	if(soft.value == "请输入关键字..."){
	    soft.value = "";
	}
}

//切换tab
$(function(){
	var tmpInterval;
	var delay = 150;
	$("#top_company").find("dl").each(function(){
		$(this).find("dt:first").toggleClass("active").next().toggle().end().end().find("dt").mouseover(function(){
			tmpref = this;
			clearTimeout(tmpInterval);
			tmpInterval = setTimeout("loadTab(tmpref)", delay);
		}).mouseout(function(){
			clearTimeout(tmpInterval);
		});
	});
	$("#top_product").find("dl").each(function(){
		$(this).find("dt:first").toggleClass("active").next().toggle().end().end().find("dt").mouseover(function(){
			tmpref = this;
			clearTimeout(tmpInterval);
			tmpInterval = setTimeout("loadTab(tmpref)", delay);
		}).mouseout(function(){
			clearTimeout(tmpInterval);
		});
	});
	$("#search").find("dl").each(function(){
		$(this).find("dt:first").toggleClass("active").next().toggle().end().end().find("dt").mouseover(function(){
			tmpref = this;
			clearTimeout(tmpInterval);
			tmpInterval = setTimeout("loadTab(tmpref)", delay);
		}).mouseout(function(){
			clearTimeout(tmpInterval);
		});
	});
	$("#index_lasted").find("dl").each(function(){
		$(this).find("dt:first").toggleClass("active").next().toggle().end().end().find("dt").mouseover(function(){
			tmpref = this;
			clearTimeout(tmpInterval);
			tmpInterval = setTimeout("loadTab(tmpref)", delay);
		}).mouseout(function(){
			clearTimeout(tmpInterval);
		});
	});
	
});

function loadTab(e){
	$(e).parent().find(".active").toggleClass("active").next().toggle();
	$(e).blur().toggleClass("active").next().toggle();
}

//改变图片大小
function AlbumDrawImage(ImgD,size){ 
var image=new Image(); 
image.src=ImgD.src; 
	if (image.width > image.height){
		ImgD.width=size; 
		ImgD.height=(image.height*size)/image.width; 
	}else{
		ImgD.height=size; 
		ImgD.width=(image.width*size)/image.height;
	}
}