﻿// JScript 文件
//原用JS实现说有的链接都弹出，这样不好，去掉，在需要弹出的地方就弹出5.14
//$(document).ready(function(){init();});
//function init(){open_link_in_new_tab();}
//function open_link_in_new_tab()
//{
//    $("a").each(function(i,n){if($(n).attr("href")!="#" && $(n).attr("href")!="")$(n).attr("target","_blank")});
//}
$.extend({slideshow:function(c,b,i){function f(a){if(d.effect.use_effect){$(c+" div:has(a):eq("+focused_index+")").css({opacity:0}).css("z-index",1);$(b+" span:eq("+focused_index+")").removeClass("slideshow_altOn");$(b+" span:eq("+focused_index+")").addClass("slideshow_altOff");$(c+" div:has(a):eq("+a+")").css({opacity:0});$(b+" span:eq("+a+")").removeClass("slideshow_altOff");$(b+" span:eq("+a+")").addClass("slideshow_altOn");$(c+" div:has(a):eq("+a+")").css("z-index",2).animate({opacity:1},500)}else{$(c+
" div:has(a):eq("+focused_index+")").css("z-index",1);$(b+" span:eq("+focused_index+")").removeClass("slideshow_altOn");$(b+" span:eq("+focused_index+")").addClass("slideshow_altOff");$(c+" div:has(a):eq("+a+")").css("z-index",2);$(b+" span:eq("+a+")").removeClass("slideshow_altOff");$(b+" span:eq("+a+")").addClass("slideshow_altOn")}focused_index=a}function j(a){if(timer){clearInterval(timer);timer=null;a&&setTimeout(function(){h()},a)}}function h(){if(g.length-1)timer=setInterval(function(){f(focused_index+
1<=g.length-1?focused_index+1:0)},d.timeout)}focused_index=0;can_do_switch=1;var d={width:670,height:179,display_alt:true,timeout:3E3,effect:{use_effect:1}};$.extend(d,i);if(typeof d!="undefined"){var g=d.imgs;$(g).each(function(a,e){$(c).append("<div style='z-index:1;position:absolute;left:0px;top:0px;display:block;'><a href='"+e.url+"' target='_blank' title='"+e.alt+"'><img src='"+e.src+"' alt='"+e.alt+"' /></a></div>");d.display_alt&&$(b).append("<span class='slideshow_alt slideshow_altOff' title='"+
e.alt+"'>"+e.alt+"</span>")});$(".slideshow_alt").click(function(){j(3E3);f($(b+" span").index($(this)))})}$(c+" div:has(a):eq("+parseInt(d.imgs.length-1)+")").find("img").load(function(){f(0);h()})}});

function switch_init(_container,_suffix,_bind_event,_show_1st,_class_on,_class_off){
	switch__(_container,_suffix,_show_1st?($(_container).find("[type_='content"+_suffix+"']:first").attr("seq")):"",_class_on,_class_off);
	$(_container).find("[type_='title"+_suffix+"']").each(
		function(i,n){
			$(n).css({cursor:'pointer'});
			$(n).bind(_bind_event,function(){
				seq = $(n).attr("seq");
				switch__(_container,_suffix,seq,_class_on?_class_on:"",_class_off?_class_off:"");
			});
		}
	);
}
function switch__(_container,_suffix,_switch_to_seq,_class_on,_class_off){
	$(_container).find("[type_='content"+_suffix+"']").each(function(i,n){$(n).hide();});
	$(_container).find("[type_='title"+_suffix+"']").each(
		function(i,n){
			if(_class_on && $(n).hasClass(_class_on)){$(n).removeClass(_class_on);}
			if(_class_off && !$(n).hasClass(_class_off)){$(n).addClass(_class_off);}
		}
	);
	if (_switch_to_seq){
		$(_container).find("[type_='content"+_suffix+"'][seq='"+_switch_to_seq+"']").show();
		if(_class_off){$(_container).find("[type_='title"+_suffix+"'][seq='"+_switch_to_seq+"']").removeClass(_class_off);}
		if(_class_on){$(_container).find("[type_='title"+_suffix+"'][seq='"+_switch_to_seq+"']").addClass(_class_on);}
	}
}
//登陆位置
LoginManager={
    Handler:'/index.aspx',
    Login:function(element,username,password)
    {
        element=$(element);
        if($(username).val()==""){element.html("用户名不能为空！");return;}
        if($(password).val()==""){element.html("密码不能为空！");return;}
        var post={Ajax:'true',UserName:$(username).val(),Password:$(password).val()};element.html("正在登陆中……");
        $.post(LoginManager.Handler,post,function(res){
            var res=eval('(' + res + ')');//转换为json对象
            if(res.result=='true'){element.html(res.info);setTimeout('location.reload()',1000);}
            else{$(username).val("");$(password).val("");element.html(res.info);}
        });
    },
    LoginOut:function()
    {
        var post={Ajax:'true',LoginType:'loginout'};
        $.post(LoginManager.Handler,post,function()
            {
                alert('退出成功！');setTimeout('location.reload()',1000);
            }
        );
    }
}