/*
Designed By HiColor
Email:	hicolor@126.com
				hicolor@yeah.net
Site:   www.hicolor.cn
Oicq:   21199555

ajax code begin--------->
*/
//loading效果
function openLoad(){
	$(".loading").show("2000");
}
function closeLoad(){
	$(".loading").hide("2000");
}
//taptabs*/
function toptab(){
var $toptab_a=".toptabs";
var $toptab_b=$($toptab_a);
if($toptab_b!=null){
$toptab_b.find("a").each(function(){
$(this).mouseover(function(){
	removetoptab($toptab_a);
  //$(this).addClass("b");
  $(this).parent().addClass("on");
	//页面加载
	switch($(this).attr("u")){ 
			case "0": {
				 $.ajax({
					type: "GET",
					url: "/AjaxPage/toptabnews.php?s=2",
					success: function(msg){
					$("#topnews").html(msg);
					}
				});	
				break;
			}
			
			case "1": {
				 $.ajax({
					type: "GET",
					url: "/AjaxPage/toptabnews.php?s=6",
					success: function(msg){
					$("#topnews").html(msg);
					}
				});	
				break;
			}
			
			case "2": {
				 $.ajax({
					type: "GET",
					url: "/AjaxPage/toptabnews.php?s=3",
					success: function(msg){
					$("#topnews").html(msg);
					}
				});	
				break;
			}
		
		}
});
});}}
function removetoptab($toptab_c){
$($toptab_c).find("a").each(function(){
$(this).parent().removeClass("on");
$(this).parent().parent().parent().removeClass("toptabs");});}


//company & product tabs*/
function companyTab(){
var $companyTab_a=".company_tab";
var $companyTab_b=$($companyTab_a);
if($companyTab_b!=null){
$companyTab_b.find("a").each(function(){
$(this).mouseover(function(){
	removecompanyTab($companyTab_a);
  //$(this).addClass("b");
  $(this).parent().addClass("up");
	//页面加载
	switch($(this).attr("c")){ 
			case "0": {
				 $.ajax({
					type: "GET",
					url: "/AjaxPage/tab_ku.php?l=1",
					success: function(msg){
					$("#list_company").html(msg);
					}
				});	
				break;
			}
			
			case "1": {
				 $.ajax({
					type: "GET",
					url: "/AjaxPage/tab_ku.php?l=2",
					success: function(msg){
					$("#list_company").html(msg);
					}
				});	
				break;
			}
		}
});
});}}
function removecompanyTab($companyTab_c){
$($companyTab_c).find("a").each(function(){
$(this).parent().removeClass("up");
$(this).parent().parent().parent().removeClass("company_tab");});}

//product list
function productTab(){
var $productTab_a="#tab_product";
var $productTab_b=$($productTab_a);
if($productTab_b!=null){
$productTab_b.find("a").each(function(){
$(this).click(function(){
	removeproductTab($productTab_a);
  //$(this).addClass("b");
  $(this).parent().addClass("up");
	//页面加载
	switch($(this).attr("p")){ 
			case "0": {
				 $.ajax({
					type: "GET",
					url: "/AjaxPage/tab_p.php",
					success: function(msg){
					$("#list_product").html(msg);
					$.ajax({url: "/Scripts/home.js",dataType: "script"});
					}
				});	
				break;
			}
			
			case "1": {
				 $.ajax({
					type: "GET",
					url: "/AjaxPage/tab_product.php?s=1",
					success: function(msg){
					$("#list_product").html(msg);
					$.ajax({url: "/Scripts/home.js",dataType: "script"});
					}
				});	
				break;
			}
			
			case "2": {
				 openLoad();
				 $.ajax({
					type: "GET",
					url: "/AjaxPage/tab_product.php?s=2",
					success: function(msg){
					$("#list_product").html(msg);
					$.ajax({url: "/Scripts/home.js",dataType: "script"});
					}
				});	
				break;
			}
			
			case "3": {
				 $.ajax({
					type: "GET",
					url: "/AjaxPage/tab_product.php?s=3",
					success: function(msg){
					$("#list_product").html(msg);
					$.ajax({url: "/Scripts/home.js",dataType: "script"});
					}
				});	
				
				break;
			}
			
			case "4": {
				 $.ajax({
					type: "GET",
					url: "/AjaxPage/tab_product.php?s=16",
					success: function(msg){
					$("#list_product").html(msg);
					$.ajax({url: "/Scripts/home.js",dataType: "script"});
					}
				});	
				
				break;
			}
			
			case "5": {
				 $.ajax({
					type: "GET",
					url: "/AjaxPage/tab_product.php?s=22",
					success: function(msg){
					$("#list_product").html(msg);
					$.ajax({url: "/Scripts/home.js",dataType: "script"});
					}
				});	
				
				break;
			}
			
			case "6": {
				 $.ajax({
					type: "GET",
					url: "/AjaxPage/tab_product.php?s=17",
					success: function(msg){
					$("#list_product").html(msg);
					$.ajax({url: "/Scripts/home.js",dataType: "script"});
					}
				});	
				
				break;
			}
			
		}
});
});}}
function removeproductTab($productTab_c){
$($productTab_c).find("a").each(function(){
$(this).parent().removeClass("up");
$(this).parent().parent().parent().removeClass("tab_list");});}

//biz list
function bizTab(){
var $bizTab_a="#tab_biz";
var $bizTab_b=$($bizTab_a);
if($bizTab_b!=null){
$bizTab_b.find("a").each(function(){
$(this).click(function(){
	removebizTab($bizTab_a);
  //$(this).addClass("b");
  $(this).parent().addClass("up");
	//页面加载
	switch($(this).attr("b")){ 
			case "0": {
				 $.ajax({
					type: "GET",
					url: "/AjaxPage/tab_b.php",
					success: function(msg){
					$("#list_biz").html(msg);
					}
				});	
				break;
			}
			
			case "1": {
				 $.ajax({
					type: "GET",
					url: "/AjaxPage/tab_biz.php?s=0",
					success: function(msg){
					$("#list_biz").html(msg);
					}
				});	
				break;
			}
			
			case "2": {
				 $.ajax({
					type: "GET",
					url: "/AjaxPage/tab_biz.php?s=1",
					success: function(msg){
					$("#list_biz").html(msg);
					}
				});	
				break;
			}
			
			case "3": {
				 $.ajax({
					type: "GET",
					url: "/AjaxPage/tab_biz.php?s=2",
					success: function(msg){
					$("#list_biz").html(msg);
					}
				});	
				break;
			}
			
			case "4": {
				 $.ajax({
					type: "GET",
					url: "/AjaxPage/tab_biz.php?s=3",
					success: function(msg){
					$("#list_biz").html(msg);
					}
				});	
				break;
			}
		}
});
});}}
function removebizTab($bizTab_c){
$($bizTab_c).find("a").each(function(){
$(this).parent().removeClass("up");
$(this).parent().parent().parent().removeClass("tab_list");});}

//job list
/*function jobTab(){
var $jobTab_a="#tab_job";
var $jobTab_b=$($jobTab_a);
if($jobTab_b!=null){
$jobTab_b.find("a").each(function(){
$(this).click(function(){
	removejobTab($jobTab_a);
  //$(this).addClass("b");
  $(this).parent().addClass("up");
	//页面加载
	switch($(this).attr("j")){ 
			case "0": {
				 $.ajax({
					type: "GET",
					url: "/main/job.html",
					success: function(msg){
					$("#list_job").html(msg);
					}
				});	
				break;
			}
			
			case "1": {
				 $.ajax({
					type: "GET",
					url: "/AjaxPage/tab_job.php",
					success: function(msg){
					$("#list_job").html(msg);
					}
				});	
				break;
			}
		}
});
});}}
function removejobTab($jobTab_c){
$($jobTab_c).find("a").each(function(){
$(this).parent().removeClass("up");
$(this).parent().parent().parent().removeClass("tab_list");});}
*/

function p_li(){
$(".list_product li").mouseover(function(){
		$(this).addClass("bg");}).mouseout(function(){
		$(this).removeClass("bg");
		});
}

function brand_li(){
$(".sub_product li").mouseover(function(){
		$(this).addClass("bg");}).mouseout(function(){
		$(this).removeClass("bg");
		});
}
//初始化欢迎内容
$(document).ready(function(){ 
	toptab();
	companyTab();
	productTab();
	bizTab();
	//jobTab();
	p_li();
	brand_li();
});