/****************************** 来自 common.js 文件中的函数 ******************/
/*** 加载顶部菜单 ****/
menuHover = function() {
	var cssRule;
	var newSelector;
	for (var i = 0; i < document.styleSheets.length; i++)
		for (var x = 0; x < document.styleSheets[i].rules.length ; x++)
			{
			cssRule = document.styleSheets[i].rules[x];
			if (cssRule.selectorText.indexOf("LI:hover") != -1)
			{
				 newSelector = cssRule.selectorText.replace(/LI:hover/gi, "LI.iehover");
				document.styleSheets[i].addRule(newSelector , cssRule.style.cssText);
			}
		}
	var getElm = document.getElementById("navigation").getElementsByTagName("LI");
	if( getElm!=null&&getElm.length>0 ){
		for (var i=0; i<getElm.length; i++) {
			getElm[i].onmouseover=function() {
				this.className+=" iehover";
			}
			getElm[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" iehover\\b"), "");
			}
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", menuHover);
/*** 搜索按钮 ***/
function doSearch(){
	var keyword = document.getElementById("input_keyword").value;
	var url = "http://www.google.com/search?domains=www.kass.com.cn&sitesearch=www.kass.com.cn&q="+keyword;
	window.open(url);
}



/** 实现图片自动切换的效果 ***/
var t;
var n = count = 0;    
$(document).ready(function(){    
    count = $("#play_list a").size();    
    $("#play_list a:not(:first-child)").hide();    
    //$("#play_info").html($("#play_list a:first-child").find("img").attr('alt'));    
    $("#play_text li:first-child").css({"background":"#fff",'color':'#000'});    
    //$("#play_info").click(function(){window.open($("#play_list a:first-child").attr('href'), "_blank")});    

    $("#play_text li").click(function() {    
        var i = $(this).text() - 1;    
        showImage(i);

		/** 只要点击了数字控件，就不再自动切换图片 ***/
		clearInterval(t);
    });
 
    t = setInterval("showAuto()", 3000);
	/***
    $("#play").hover(
		function(){ clearInterval(t); },		
		function(){t = setInterval("showAuto()", 5000);}
	);
	***/
});

   
function showAuto()    
{    
    n = n >= (count - 1) ? 0 : n + 1;    
    showImage(n);
}

function showImage(index){
	n = index;    
	if (index >= count) 
		return;    
	//$("#play_info").html($("#play_list a").eq(index).find("img").attr('alt'));    
	//$("#play_info").unbind().click(function(){window.open($("#play_list a").eq(index).attr('href'), "_blank")})    
	$("#play_list a").filter(":visible").fadeOut(500).parent().children().eq(index).fadeIn(1000);    
	$("#play_text li").eq(index).css({"background":"#fff",'color':'#000'}).siblings().css({"background":"#000",'color':'#fff'});    
}