﻿// JavaScript Document
jQuery(document).ready(function(){
	LoadJS();
});

var scollCount = 0;

function LoadJS()
{
	NavJS();
	NavSelected();
	SearchList();
	CheckSearch();
	IndexJS();
	PageWitd();
	ListJS();
	showBiref();
	showCustomerService();
}

///导航栏特效
function NavJS()
{
	//导航鼠标覆盖特效
	jQuery(".navImg").mouseover(function(){
			var imgurl=jQuery(this).attr('src');
			var hoverimgurl=jQuery(this).attr('alt');			
			jQuery(this).attr('src',hoverimgurl)
			jQuery(this).attr('alt',imgurl)
		}).mouseout(function(){
			var imgurl=jQuery(this).attr('src');
			var hoverimgurl=jQuery(this).attr('alt');			
			jQuery(this).attr('src',hoverimgurl)
			jQuery(this).attr('alt',imgurl)		
		});
}

function NavSelected()
{
    var url = document.URL;
    var urlsub=url.split('/');
    url = "";
    var imgurl=jQuery("."+urlsub[3]).attr('src');	
	var hoverimgurl=jQuery("."+urlsub[3]).attr('alt');
		
	jQuery("."+urlsub[3]).attr('src',hoverimgurl);
	jQuery("."+urlsub[3]).attr('alt',hoverimgurl);
}
///顶部搜索
function SearchList()
{
    var isover;
    isover = false;
    
	jQuery(".top_search_list_show").click(function(){
		jQuery(".search ul").css('display','block');
		jQuery(".top_search_list").css('display','list-item');
		jQuery(".top_search_list[title='"+jQuery(".top_search_list_show").attr('title')+"']").css('display','none')
	});
	jQuery(".top_search_list").mouseover(function(){
		jQuery(".top_search_list").css('background','none');									   
		jQuery(this).css('background','#b2d7e9');
	});
	jQuery(".top_search_list").click(function(){
		jQuery(".search ul").css('display','none');									   
		jQuery(".top_search_list_show").html(jQuery(this).html());
		jQuery(".top_search_list_show").attr('title',jQuery(this).attr('title'));
		jQuery("#searchtype").val(jQuery(this).attr('title'));
	});
	
	jQuery(".top_search_list_show").mouseout(function(){
	        jQuery(".search ul").css('display','none');	    
	});
	
	jQuery(".search ul").mouseover(function(){
	    jQuery(this).css('display','block');
	}).mouseout(function(){
	    jQuery(this).css('display','none');
	});
	
}

function CheckSearch()
{    
    jQuery("#searchform").submit(function(){
        if(jQuery("#keyword").val())
        {
            jQuery("#searchform").attr('action','/' + jQuery("#searchtype").val() + '/search.htm')
        }
        else
        {
            alert("请输入要搜索的关键字！");
            return false;
        }
    });
}
///

///首页内容区特效
function IndexJS()
{
	jQuery(".lebel_title,.lebel_title_hover").mouseover(function(){
			jQuery(".lebel_title_hover").attr('class','lebel_title');
			var id=jQuery(this).attr('id').substr(5);
			jQuery(".lebel_content_show").attr('class','lebel_content');
			jQuery("#content"+id).attr('class','lebel_content_show');
			jQuery(this).attr('class','lebel_title_hover');	
		});
	jQuery(".produtPhoto1").mouseover(function(){
			jQuery("#img1").attr('src',jQuery(this).attr('ImgUrl')).css("display","inline");			
		});
	
	jQuery(".produtPhoto2").mouseover(function(){
			jQuery("#img2").attr('src',jQuery(this).attr('ImgUrl')).css("display","inline");			
		});
	
	jQuery(".produtPhoto1,.produtPhoto2").mouseout(function(){
			jQuery("#img1,#img2").css("display","none");
		});
}

///页面分页元素宽度
function PageWitd()
{
	var li_num = jQuery(".bottom_page li").size();
	var li_width = jQuery(".bottom_page .pagenum").width() + 17;	
	if(li_width==17)
	{
		li_width = jQuery(".bottom_page .pagenum_hove").width() + 2;
	}
	var li_button_width = jQuery(".page_button").width()*2;
	var allwidth = li_num*li_width+li_button_width+10;
	jQuery(".bottom_page").css('width',allwidth + 'px');
	
}

///产品、文章、案例等左侧列表特效
function ListJS()
{
	jQuery(".parent_class,.parent_class_show").mouseover(function(){
		var id = jQuery(this).attr('id').substr(6);
		jQuery(".parent_class_show").attr('class','parent_class');
		jQuery(this).attr('class','parent_class_show');
		jQuery(".child_class_show").attr('class','child_class');
		jQuery("#child"+id).attr('class','child_class_show');		
	});
}
///产品列表鼠标特效
function showBiref()
{
	jQuery(".item").mouseover(function(){
		jQuery(".item_hover").attr('class','item');
		jQuery(".showbiref").attr('class','cancelbiref');
		jQuery(this).attr('class','item_hover');
		jQuery(this).find(".cancelbiref").attr('class','showbiref');
	});
	jQuery(".product_list").mouseout(function(){
		jQuery(".item_hover").attr('class','item');
		jQuery(".showbiref").attr('class','cancelbiref');
	});
}

//客服特效
function showCustomerService()
{
	jQuery("#customerService").mouseover(function(){jQuery("#leyerCustomService").css('height','76px');}).mouseout(function(){jQuery("#leyerCustomService").css('height','0px');});
	jQuery("#leyerCustomService").mouseover(function(){jQuery("#leyerCustomService").css('height','76px');}).mouseout(function(){jQuery("#leyerCustomService").css('height','0px');});	
}
