$(function(){
	
	//按钮1
	$(".h_ban_a").hover(function(){		 
		$(this).css("background-position","0 0");
	},function(){		 
		$(this).css("background-position","0 -31px");
	})
	
	//按钮2
	$(".h_ban_b").hover(function(){		 
		$(this).css("background-position","134px 0");
	},function(){		 
		$(this).css("background-position","134px -31px");
	})
	
	//列表图片状态
	$(".pic_class").hover(function(){//产品目录
		$(this).addClass("on");						
	},function(){
		$(this).removeClass("on");
	});
	
	$(".pic_list span").hover(function(){//产品列表
		$(this).addClass("on");						
	},function(){
		$(this).removeClass("on");
	});
	
	$(".project div").hover(function(){
		$(this).addClass("on");						
	},function(){
		$(this).removeClass("on");
	});
	
	//输入框
	$(".text").focus(function(){
		$(this).addClass("text_on");						
	});
	$(".text").blur(function(){
		$(this).removeClass("text_on");
	});
	
	//输入框
	$(".ban").hover(function(){
		$(this).addClass("ban_on");						
	},function(){
		$(this).removeClass("ban_on");
	});
	
	//产品详细菜单
	$(".view_pic_menu td a:first").addClass("on");
	$(".view_pic_menu td:first").addClass("on");
	$(".view_pic_show ul:not(:first)").hide();
	$(".view_pic_menu td").each(function(index) {
			$(this).hover(
			function() {
					$(".view_pic_menu td a.on").removeClass("on");
					$(".view_pic_menu td.on").removeClass("on");
					$(this).addClass("on");
					$(this).find("a").addClass("on");
					$(".view_pic_show > ul:visible").hide();
					$(".view_pic_show ul:eq(" + index + ")").show();
			});
	});
	
	//产品弹出展示
	$(".view_pic_menu a").each(function(index) {
		$(this).click(
    function() {
			$(".form > ul").hide();
      $(".form > ul:eq(" + index + ")").show();
			var t=$(".form ul:eq(" + index + ")").find("img").attr("alt");
			$("#DialogDiv h2 > span").html(t);
      $("#BgDiv").css({ display:"block",height:$(document).height()});
      var yscroll=document.documentElement.scrollTop;
      $("#DialogDiv").css("top","100px");
      $("#DialogDiv").css("display","block");
      document.documentElement.scrollTop=0;
   });
	 });
   $("#btnClose").click(function()
   {
      $("#BgDiv").css("display","none");
      $("#DialogDiv").css("display","none");
   });
	
	//下拉菜单
	$(".nav li.sl").each(function(index) {
			$(this).hover(
			function() {
					$(".nav dl:eq(" + index + ")").show();
			},function(){
		      $(".nav dl").hide();
	    });
	});
	$(".nav dd").hover(function(){
		$(this).addClass("s");						
	},function(){
		$(this).removeClass("s");
	});
	
	//loadPage("p_class", "p_class.asp");
	//loadPage("home_about", "home_about.asp");
	//loadPage("home_plist", "home_plist.asp");
	  
	$(".im_ban a").click(function(){
		$("#im_a").hide();
		$("#im_b").show();
		SetCookie("cook_im",1);
	});
	
	$("#im_b a").click(function(){
		$("#im_a").show();
		$("#im_b").hide();
		SetCookie("cook_im",0);
	});
	
	//im_cookie();
}) 


//动态加载页面(id显示页面的容器组件ID,url欲加载页面网址)
function loadPage(id, url) { 
	$("#"+id).addClass("loader"); 
	$("#"+id).append("<img src='../images/ico/loading.gif' height='18px'> 加载中..."); 
	$.ajax({ 
	type: "get", 
	url: url, 
	cache: false, 
	error: function() { $("#"+id).append("<img src='../images/ico/loading.gif' height='18px'> 加载错误...");  }, 
	success: function(msg) { 
	$("#"+id).empty().append(msg); 
	$("#"+id).removeClass("loader"); 
	} 
	}); 
}

//js加载flash
function flash_swf(u,w,h){
	document.write('<object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" id="obj1" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" border="0" width="'+w+'" height="'+h+'">');
	document.write('<param name="movie" value="'+u+'">');
	document.write('<param name="quality" value="high"> ');
	document.write('<param name="wmode" value="transparent"> ');
	document.write('<param name="menu" value="false"> ');
	document.write('<embed src="'+u+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="obj1" width="'+w+'" height="'+h+'" quality="High" wmode="transparent"></embed>');
	document.write('</object>');
}

//js加载flash
function flash_flv(u,w,h,t){
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+w+'" height="'+h+'">');
    document.write('<param value="/FLV/Flvplayer.swf" name="movie" />');
    document.write('<param value="high" name="quality" />');
    document.write('<param value="true" name="allowFullScreen" />');
    document.write('<param value="vcastr_file='+u+'&amp;LogoText='+t+'&amp;BufferTime=3" name="FlashVars" />');
		document.write('<embed width="'+w+'" height="'+h+'" allowfullscreen="true" flashvars="vcastr_file='+u+'&amp;LogoText='+t+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" src="/FLV/Flvplayer.swf" type="application/x-shockwave-flash"></embed>');
		document.write('</object>');
}

//设置cookie.
function SetCookie(name,value){
	document.cookie=name+"="+escape(value)+";path=/";
}

//获取cookie
function getCookie(name) {
	var strCookie = document.cookie;
	var arrCookie = strCookie.split("; ");
	for (var i = 0; i < arrCookie.length; i++) {
			var arr = arrCookie[i].split("=");
			if (arr[0] == name) return arr[1];
	}
	return "";
}

//判断cookie
var cook_im = getCookie("cook_im")//聊天层状态
	function im_cookie() {
	//判断状态
	if (cook_im == 1) { //如果为1就是已展开
		$("#im_a").hide();
		$("#im_b").show();
    } else {
		$("#im_a").show();
		$("#im_b").hide();
    }
}

