﻿$(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 span").hover(function(){
		$(this).addClass("on");						
	},function(){
		$(this).removeClass("on");
	});
	
	//产品列表
	$(".pic_list h1").hover(function(){
		$(this).addClass("on");						
	},function(){
		$(this).removeClass("on");
	});
	
	$(".h_pic span").hover(function(){
		$(this).addClass("on");						
	},function(){
		$(this).removeClass("on");
	});
		
	//输入框
	$(".text").focus(function(){
		$(this).addClass("text_on");						
	});
	$(".text").blur(function(){
		$(this).removeClass("text_on");
	});
	$(".textarea").focus(function(){
		$(this).addClass("textarea_on");						
	});
	$(".textarea").blur(function(){
		$(this).removeClass("textarea_on");
	});
	
	//输入框
	$(".ban").hover(function(){
		$(this).addClass("ban_on");						
	},function(){
		$(this).removeClass("ban_on");
	});
	
	//
	//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(ur,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="'+ur+'">');
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="'+ur+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="obj1" width="'+w+'" height="'+h+'" quality="High" wmode="transparent">');
document.write('</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();
    }
	
}

