﻿var newsCon;//新闻内容
var PicWidth;//图片集锦未隐藏宽度
var imgWidth=174;//图片集锦每张图片所占宽
var current=0;//图片集锦当前
var clen;
var PP;//图片集锦定时
var AP;//公告滑动
var an;//公告对象

$(document).ready(function(){
if(document.getElementById("add_f"))//加入收藏夹
{
	var $addf=$("#add_f");
	$addf.click(function(){addBookmark("福建省外服机构服务中心","http://www.cnfesc.com")});
}


if($(".pic_show").length>0)//图片集锦
{
	var ps_len=$(".pic_show .show .Pic li").length;
	var i=0;
	var cli;
	
	if(ps_len%5==0)
	{
		clen=ps_len/5;
	}
	else
	{
		clen=parseInt((ps_len/5))+1;
	}
	while(i<clen)
	{
		i++;
		cli=$('<li class="left">'+i+'</li>');
		$(".current").append(cli);
		$(".current li").eq(i-1).bind("mouseover",pfb);
	}
	$(".current li").eq(0).addClass("cnow");
	if (window.XMLHttpRequest) //ff ie7
	{PicWidth=ps_len*imgWidth;}
	else{PicWidth=ps_len*imgWidth+5;}//ie6
	$(".pic_show .show .Pic").css("width",PicWidth);
	$(".l_btn").bind("click",left_f);
	$(".r_btn").bind("click",right_f);
	PP=setInterval(picf,6000);
	$(".pic_show .con").hover(function(){clearInterval(PP);},function(){PP=setInterval(picf,6000);});
	$(".current").hover(function(){clearInterval(PP);},function(){PP=setInterval(picf,6000);});
	$(".pic_show .show .Pic li").hover(function(){$(this).css("border-color","#B33232")},function(){$(this).css("border-color","#d0d0d0")});
}
if($(".sidebar").length>0)//栏目页面菜单
{
	$(".sidebar li").hover(function(){$(this).css("background-position","-186px -167px")},
						   function(){$(this).css("background-position","-185px -138px")});
}
if($(".maincon .classlist").length>0)//栏目列表
{
	$(".maincon .classlist li").hover(function(){$(this).css("background","#efefef url(images/hxjy_pic.png) -190px -342px no-repeat")},
							 function(){$(this).css("background","#ffffff url(images/hxjy_pic.png) -190px -315px no-repeat")});
}
if($(".newscon .con p").length>0)//获取新闻内容
{newsCon=$(".newscon .con p");}
});
//加入收藏夹
function addBookmark(title, url) {
        if (window.sidebar) {
            window.sidebar.addPanel(title, url, "");
        } else if (document.all) {
            window.external.AddFavorite(url, title);
        } else if (window.opera && window.print) {
            return true;
        }
}

if($(".wmcj").length>0)//首页滑动门
{
	$(".wmcj .title li").bind("mouseover",dx);
}

//首页滑动门
function dx()
{
	var n;
	switch(this.id)
	{
		case "t1":
		 n=0;break;
		case "t2":
		 n=1;break;
		case "t3":
		 n=2;break;
		case "t4":
		 n=3;break;
		case "t5":
 		 n=4;break;
	}
        
	$(".wmcj .wmcj_now").removeClass("wmcj_now");
	$(this).addClass("wmcj_now");
        var i=0;
	while(i < $(".wmcj .title li").length)
	{
     	   $(".wmcj .con").find(".indexlist").eq(i).addClass("hide");
	   i++;
	}
	$(".wmcj .con").find(".indexlist").eq(n).removeClass("hide");
}

if($(".wmcj1").length>0)//首页滑动门
{
	$(".wmcj1 .title li").bind("mouseover",dx1);
}

//首页滑动门
function dx1()
{
	var n;
	switch(this.id)
	{
		case "t1":
		 n=0;break;
		case "t2":
		 n=1;break;
		case "t3":
		 n=2;break;
		case "t4":
		 n=3;break;
	}
	$(".wmcj1 .wmcj_now").removeClass("wmcj_now");
	$(this).addClass("wmcj_now");
	var i=0;
	while(i<$(".wmcj1 .title li").length)
	{
                       if(!$(".wmcj1 .con").find(".indexlist").eq(i).hasClass("hide"))
     		 $(".wmcj1 .con").find(".indexlist").eq(i).addClass("hide");
	          i++;
	}
	$(".wmcj1 .con").find(".indexlist").eq(n).removeClass("hide");
}


//图片集锦滑动门
function pfb()
{
	$(".Pic").stop(true,true);
	current=$(this).text()-1;
	$(".Pic").animate({left:'-'+current*imgWidth*5},300);
	$(".cnow").removeClass("cnow");
	$(".current li").eq(current).addClass("cnow");
}
//图片集锦定时
function picf()
{
	$(".Pic").stop(true,true);
	if(current==clen-1)
	{
		current=0;
		$(".Pic").animate({left:"0"},300);
	}
	else
	{
		current++;
		$(".Pic").animate({left:'-'+current*imgWidth*5},300);
	}
	$(".cnow").removeClass("cnow");
	$(".current li").eq(current).addClass("cnow");
}
//图片集锦向左
function left_f()
{
	$(".Pic").stop(true,true);
	if(current==0)
	{
		current=clen-1;
		$(".Pic").animate({left:'-'+current*imgWidth*5},300);
	}
	else
	{
		current--;
		$(".Pic").animate({left:'-'+current*imgWidth*5},300);
	}
	$(".cnow").removeClass("cnow");
	$(".current li").eq(current).addClass("cnow");
}
//图片集锦向右
function right_f()
{
	$(".Pic").stop(true,true);
	if(current==clen-1)
	{
		current=0;
		$(".Pic").animate({left:'-'+current*imgWidth*5},300);
	}
	else
	{
		current++;
		$(".Pic").animate({left:'-'+current*imgWidth*5},300);
	}
	$(".cnow").removeClass("cnow");
	$(".current li").eq(current).addClass("cnow");
}
//新闻列表高光
function listOver()
{
	$(this).css("background","#efefef url(../images/cnfesc_style_pic.png) -290px -478px no-repeat");
}
function listOut()
{
	$(this).css("background","");
}
//大字体
function bigFont()
{
	newsCon.css("font-size","24px");
}
//中字体
function normalFont()
{
	newsCon.css("font-size","18px");
}
//小字体
function smallFont()
{
	newsCon.css("font-size","14px");
}

