document.write("<style type=\"text/css\">"); 
document.write(".productContent li a span{filter:alpha(opacity=90);}");
document.write("#sresult{filter:Alpha(Opacity=90);}");
document.write("</style>"); 

$(function() { 
	$("#menu").append("<span id=\"sresult\"><img src=\"images/lightbox-ico-loading.gif\" width=\"24\" height=\"24\" alt=\"正在传送数据...\" /></span>");
	$("#frmsearch").submit(function(){searchinput();return false;});
	$("searchGo").click(function(){searchinput();return false;});
	$("#searchArea").click(function(){
		if ($("input[name='keywords']").val() == "关键词"){
		$("input[name='keywords']").val("");
		}
	});

     var leng  = $("#flash > ul > li").length;
	 var inde = 0;
	 var introTimer;
	 $('#flash').hover(function(){
			 clearInterval(introTimer);
		 },function(){
			 introTimer = setInterval(function(){
	 $("#flash > ul > li").eq(inde).stop(true,false).animate({opacity:"show"},1000)
		                      .siblings().hide();
				inde++;
				if(inde==leng){inde=0;}
			  } , 4000);
	 }).trigger("mouseleave");

	$("#copy > .sbnav > a:first").css("border-left","none");
    $("#logoLogin").css("opacity","0.9");
    $(".productContent").fxMarquee({ 
        speed:60,
		autoStop:true,
		direction:'up'

    }); 

	nav = $("#menu ul,#introduction ul");
    var rootli = nav.children("li");
	rootli.each(function() {
		var childA = $(this).children("a");
		if(childA.attr("href").indexOf(":") > 0) {
			childA.attr("href", $("li:eq(0)>a", childA.next()).attr("href"));
		}
	});

	$("#cooperation ul li:first-child span.more").css("display","block");
	$("#cooperation ul li:first-child ul").css("display","block");
	$("#cooperation ul li:first-child").children("a").eq(0).addClass("cooperationtitleac");

	$("#menu ul li:has(ul),#introduction ul li:has(ul)").hover(function(){
			if ($(this).children("ul").children("li").length > 1){$(this).children("ul").slideDown();$(this).children("a").eq(0).addClass("ac")}
		},function(){
			if ($(this).children("ul").children("li").length > 1){$(this).children("ul").slideUp("fast");$(this).children("a").eq(0).removeClass("ac")}
		});

    if($("body").attr("id") != "P00" && document.getElementById("fla") ) {document.getElementById("fla").innerHTML = fplay("images/fl.swf","809","143");}

	$("#cooperation a.cooperationtitle").mouseover(function(){
			$("#cooperation > ul > li").each(function(node){
				$(this).children("a").eq(0).removeClass("cooperationtitleac");
				$(this).children("span").fadeOut();
				$(this).children("ul").fadeOut();
			});
			$(this).addClass("cooperationtitleac");
			$(this).parent().children("span").fadeIn();
			$(this).parent().children("ul").fadeIn();
	});

	$("ul.list2 li h4").mouseover(function(){
			$(this).css({"background":"url(images/list2_03.jpg) no-repeat 12px center","font-weight":"bold"});
		});
	$("ul.list2 li").mouseleave(function(){
			$(this).children("h4").css({"background":"none","font-weight":"normal"});
		});
	$("ul.list0 li:even").css("background-color","#D4EAF8");

	if ($("ul.list1").length > 0) {	$("ul.list1 li a.thumb").lightBox();	}
	if ($("ul.list2").length > 0) {	$("ul.list2 li a.thumb").lightBox();	}
}); 


function fplay(swf, swfwidth, swfheight,full) {
    if (navigator.userAgent.indexOf('Firefox') > - 1) {
		if (full == "full"){
	        return('<embed src="' + swf + '" width="' + swfwidth + '" height="' + swfheight + '" quality="high" wmode="Opaque" allowFullScreen="true" allowScriptAccess="always"></embed>');
		}else{
        return('<embed src="' + swf + '" width="' + swfwidth + '" height="' + swfheight + '" quality="high" wmode="transparent"></embed>');}
    } else {
		if (full == "full"){
			return('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + swfwidth + '" height="' + swfheight + '"><param name="movie" value="' + swf + '" /><param name="quality" value="high" /><param name="menu" value="false" /><param name="wmode" value="Opaque" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /></object>');
		}else{
        return('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + swfwidth + '" height="' + swfheight + '"><param name="movie" value="' + swf + '" /><param name="quality" value="high" /><param name="menu" value="false" /><param name="wmode" value="transparent" /></object>');}
    }
}

function searchinput(){
	if ($("input[name='keywords']").attr("value") == "" || $("input[name='keywords']").attr("value") == "关键词"){
		alert("请输入关键词");
		$("input[name='keywords']").val("");
	    $("input[name='keywords']").focus();
		return false;
    }else{
		$("input[name='keywords']").attr("value",trim($("input[name='keywords']").attr("value")));
		$("#sresult").css("display","block");
		$("#sresult").html("<img src=\"images/lightbox-ico-loading.gif\" width=\"24\" height=\"24\" alt=\"正在传送数据...\" />");

		showrequest("search_ajax.asp?keywords=" + encodeURIComponent(escape($("input[name='keywords']").attr("value"))),"sresult",false);
		cls_button();
	}
}

function trim(a_strVarContent) {
var pos1, pos2, newstring;pos1 = 0;pos2 = 0;newstring = "";
	if ( a_strVarContent.length > 0 ) {
		for( i=0; i<=a_strVarContent.length; i++) { 
			if ( a_strVarContent.charAt(i) == " " ) pos1 = pos1 + 1;
			else break;
		} 
		for( i=a_strVarContent.length; i>=0 ; i--) {
			if ( a_strVarContent.charAt(i) == " " ) pos2 = pos2 + 1;
			else break;
		}
		newstring = a_strVarContent.substring(pos1, a_strVarContent.length-pos2) 
	} 
	return newstring; 
} 

function searchp(keywords,r,p,ttype){
	showrequest("search_ajax.asp?keywords=" + keywords + "&r=" + r + "&p=" + p + "&type=" + ttype,"sresult",false);cls_button();
	return false;
}

function cls_button(){
	nCol = $("#sresult > A");
	for (i=0;i<nCol.length;i++){
		if (nCol[i].className == "cls"){
			nCol[i].onclick = function(){
				this.parentNode.style.display = "none";
			}
		}
	}
}

var http_request = false;
function showrequest(url,element,asyn) {
	var isFFCLS = true;
	http_request = false;
    if (window.XMLHttpRequest) {
        http_request = new XMLHttpRequest();
        if (http_request.overrideMimeType) {
            http_request.overrideMimeType('text/xml');
        }
    } else if (window.ActiveXObject) {
        try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
            http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
        }
    }
    if (!http_request) {alert('Giving up :( Cannot create an XMLHTTP instance');return false;}
    http_request.onreadystatechange = sub_showrequest;
    http_request.open('GET', url, asyn);
    http_request.send(null);
	if ((!asyn) && (isFFCLS)) sub_showrequest();
	function sub_showrequest(){
	    if (http_request.readyState == 4) {
        if (http_request.status == 200) {
			isFFCLS = false;
			document.getElementById(element).innerHTML = http_request.responseText;
        } else {alert('There was a problem with the request.');}
		}	
	}
}
