﻿//==============crossSlide=========================
/*
* Copyright 2007-2008 by Tobia Conforto <tobia.conforto@gmail.com>
*
* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along with this program; if not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Versions: 0.1    2007-08-19  Initial release
*                  2008-08-21  Re-released under GPL v2
*           0.1.1  2008-09-18  Compatibility with prototype.js
*           0.2    2008-10-15  Linkable images, contributed by Tim Rainey <tim@zmlabs.com>
*           0.3    2008-10-22  Added option to repeat the animation a number of times, then stop
*           0.3.1  2008-11-11  Better error messages
*           0.3.2  2008-11-11  Fixed a couple of CSS bugs, contributed by Erwin Bot <info@ixgcms.nl>
*/

jQuery.fn.crossSlide = function(opts, plan) {
    var self = this,
			self_width = this.width(),
			self_height = this.height();

    // generic utilities
    function format(str) {
        for (var i = 1; i < arguments.length; i++)
            str = str.replace(new RegExp('\\{' + (i - 1) + '}', 'g'), arguments[i]);
        return str;
    }

    function abort() {
        arguments[0] = 'crossSlide: ' + arguments[0];
        throw format.apply(null, arguments);
    }

    // first preload all the images, while getting their actual width and height
    (function(proceed) {

        var n_loaded = 0;
        function loop(i, img) {
            // for (i = 0; i < plan.length; i++) but with independent var i, img (for the closures)
            img.onload = function(e) {
                n_loaded++;
                plan[i].width = img.width;
                plan[i].height = img.height;
                if (n_loaded == plan.length)
                    proceed();
            }
            img.src = plan[i].src;
            if (i + 1 < plan.length)
                loop(i + 1, new Image());
        }
        loop(0, new Image());

    })(function() {  // then proceed

        // utility to parse "from" and "to" parameters
        function parse_position_param(param) {
            var zoom = 1;
            var tokens = param.replace(/^\s*|\s*$/g, '').split(/\s+/);
            if (tokens.length > 3) throw new Error();
            if (tokens[0] == 'center')
                if (tokens.length == 1)
                tokens = ['center', 'center'];
            else if (tokens.length == 2 && tokens[1].match(/^[\d.]+x$/i))
                tokens = ['center', 'center', tokens[1]];
            if (tokens.length == 3)
                zoom = parseFloat(tokens[2].match(/^([\d.]+)x$/i)[1]);
            var pos = tokens[0] + ' ' + tokens[1];
            if (pos == 'left top' || pos == 'top left') return { xrel: 0, yrel: 0, zoom: zoom };
            if (pos == 'left center' || pos == 'center left') return { xrel: 0, yrel: .5, zoom: zoom };
            if (pos == 'left bottom' || pos == 'bottom left') return { xrel: 0, yrel: 1, zoom: zoom };
            if (pos == 'center top' || pos == 'top center') return { xrel: .5, yrel: 0, zoom: zoom };
            if (pos == 'center center') return { xrel: .5, yrel: .5, zoom: zoom };
            if (pos == 'center bottom' || pos == 'bottom center') return { xrel: .5, yrel: 1, zoom: zoom };
            if (pos == 'right top' || pos == 'top right') return { xrel: 1, yrel: 0, zoom: zoom };
            if (pos == 'right center' || pos == 'center right') return { xrel: 1, yrel: .5, zoom: zoom };
            if (pos == 'right bottom' || pos == 'bottom right') return { xrel: 1, yrel: 1, zoom: zoom };
            return {
                xrel: parseInt(tokens[0].match(/^(\d+)%$/)[1]) / 100,
                yrel: parseInt(tokens[1].match(/^(\d+)%$/)[1]) / 100,
                zoom: zoom
            };
        }

        // utility to compute the css for a given phase between p.from and p.to
        // phase = 1: begin fade-in,  2: end fade-in,  3: begin fade-out,  4: end fade-out
        function position_to_css(p, phase) {
            switch (phase) {
                case 1:
                    var pos = 0;
                    break;
                case 2:
                    var pos = fade_ms / (p.time_ms + 2 * fade_ms);
                    break;
                case 3:
                    var pos = 1 - fade_ms / (p.time_ms + 2 * fade_ms);
                    break;
                case 4:
                    var pos = 1;
                    break;
            }
            return {
                left: Math.round(p.from.left + pos * (p.to.left - p.from.left)),
                top: Math.round(p.from.top + pos * (p.to.top - p.from.top)),
                width: Math.round(p.from.width + pos * (p.to.width - p.from.width)),
                height: Math.round(p.from.height + pos * (p.to.height - p.from.height))
            };
        }

        // check global params
        if (!opts.fade)
            abort('missing fade parameter.');
        if (opts.speed && opts.sleep)
            abort('you cannot set both speed and sleep at the same time.');
        // conversion from sec to ms; from px/sec to px/ms
        var fade_ms = Math.round(opts.fade * 1000);
        if (opts.sleep)
            var sleep = Math.round(opts.sleep * 1000);
        if (opts.speed)
            var speed = opts.speed / 1000,
					fade_px = Math.round(fade_ms * speed);

        // set container css
        self.empty().css({
            overflow: 'hidden',
            padding: 0
        });
        if (!self.css('position').match(/absolute|relative|fixed/))
            self.css({ position: 'relative' });
        if (!self.width() || !self.height())
            abort('container element does not have its own width and height');

        // prepare each image
        for (var i = 0; i < plan.length; ++i) {

            var p = plan[i];
            if (!p.src)
                abort('missing src parameter in picture {0}.', i + 1);

            if (speed) { // speed/dir mode

                // check parameters and translate speed/dir mode into full mode (from/to/time)
                switch (p.dir) {
                    case 'up':
                        p.from = { xrel: .5, yrel: 0, zoom: 1 };
                        p.to = { xrel: .5, yrel: 1, zoom: 1 };
                        var slide_px = p.height - self_height - 2 * fade_px;
                        break;
                    case 'down':
                        p.from = { xrel: .5, yrel: 1, zoom: 1 };
                        p.to = { xrel: .5, yrel: 0, zoom: 1 };
                        var slide_px = p.height - self_height - 2 * fade_px;
                        break;
                    case 'left':
                        p.from = { xrel: 0, yrel: .5, zoom: 1 };
                        p.to = { xrel: 1, yrel: .5, zoom: 1 };
                        var slide_px = p.width - self_width - 2 * fade_px;
                        break;
                    case 'right':
                        p.from = { xrel: 1, yrel: .5, zoom: 1 };
                        p.to = { xrel: 0, yrel: .5, zoom: 1 };
                        var slide_px = p.width - self_width - 2 * fade_px;
                        break;
                    default:
                        abort('missing or malformed "dir" parameter in picture {0}.', i + 1);
                }
                if (slide_px <= 0)
                    abort('picture number {0} is too short for the desired fade duration.', i + 1);
                p.time_ms = Math.round(slide_px / speed);

            } else if (!sleep) { // full mode

                // check and parse parameters
                if (!p.from || !p.to || !p.time)
                    abort('missing either speed/sleep option, or from/to/time params in picture {0}.', i + 1);
                try {
                    p.from = parse_position_param(p.from)
                } catch (e) {
                    abort('malformed "from" parameter in picture {0}.', i + 1);
                }
                try {
                    p.to = parse_position_param(p.to)
                } catch (e) {
                    abort('malformed "to" parameter in picture {0}.', i + 1);
                }
                if (!p.time)
                    abort('missing "time" parameter in picture {0}.', i + 1);
                p.time_ms = Math.round(p.time * 1000)
            }

            // precalculate left/top/width/height bounding values
            if (p.from)
                jQuery.each([p.from, p.to], function(i, from_to) {
                    from_to.width = Math.round(p.width * from_to.zoom);
                    from_to.height = Math.round(p.height * from_to.zoom);
                    from_to.left = Math.round((self_width - from_to.width) * from_to.xrel);
                    from_to.top = Math.round((self_height - from_to.height) * from_to.yrel);
                });

            // append the image element to the container
            var html = p.href
					? format('<a href="{0}"><img src="{1}"/></a>', p.href, p.src)
					: format('<img src="{0}"/>', p.src);
            jQuery(html).appendTo(self).css({
                position: 'absolute',
                visibility: 'hidden',
                top: 0,
                left: 0
            }).find('img').css({
                border: 0
            })
        }
        speed = undefined;  // speed mode has now been translated to full mode

        var imgs = self.children();

        // show first image
        imgs.eq(0).css({ visibility: 'visible' });
        if (!sleep)
            imgs.eq(0).css(position_to_css(plan[0], 2));

        // create animation chain
        var countdown = opts.loop;
        function create_chain(i, chainf) {
            // building the chain backwards, or inside out

            if (i % 2 == 0) {
                if (sleep) {

                    // still image sleep

                    var i_sleep = i / 2,
							i_hide = (i_sleep - 1 + plan.length) % plan.length,
							img_sleep = imgs.eq(i_sleep),
							img_hide = imgs.eq(i_hide);

                    var newf = function() {
                        img_hide.css('visibility', 'hidden');
                        setTimeout(chainf, sleep);
                    };

                } else {

                    // single image slide

                    var i_slide = i / 2,
							i_hide = (i_slide - 1 + plan.length) % plan.length,
							img_slide = imgs.eq(i_slide),
							img_hide = imgs.eq(i_hide),
							time = plan[i_slide].time_ms,
							slide_anim = position_to_css(plan[i_slide], 3);

                    var newf = function() {
                        img_hide.css('visibility', 'hidden');
                        img_slide.animate(slide_anim, time, 'linear', chainf);
                    };

                }
            } else {
                if (sleep) {

                    // still image cross-fade

                    var i_from = Math.floor(i / 2),
							i_to = Math.ceil(i / 2) % plan.length,
							img_from = imgs.eq(i_from),
							img_to = imgs.eq(i_to),
							from_anim = {},
							to_init = { visibility: 'visible' },
							to_anim = {};

                    if (i_to > i_from) {
                        to_init.opacity = 0;
                        to_anim.opacity = 1;
                    } else {
                        from_anim.opacity = 0;
                    }

                    var newf = function() {
                        img_to.css(to_init);
                        if (from_anim.opacity != undefined)
                            img_from.animate(from_anim, fade_ms, 'linear', chainf);
                        else
                            img_to.animate(to_anim, fade_ms, 'linear', chainf);
                    };

                } else {

                    // cross-slide + cross-fade

                    var i_from = Math.floor(i / 2),
							i_to = Math.ceil(i / 2) % plan.length,
							img_from = imgs.eq(i_from),
							img_to = imgs.eq(i_to),
							from_anim = position_to_css(plan[i_from], 4),
							to_init = position_to_css(plan[i_to], 1),
							to_anim = position_to_css(plan[i_to], 2);

                    if (i_to > i_from) {
                        to_init.opacity = 0;
                        to_anim.opacity = 1;
                    } else {
                        from_anim.opacity = 0;
                    }
                    to_init.visibility = 'visible';

                    var newf = function() {
                        img_from.animate(from_anim, fade_ms, 'linear');
                        img_to.css(to_init);
                        img_to.animate(to_anim, fade_ms, 'linear', chainf);
                    };

                }
            }

            // if the loop option was requested, push a countdown check
            if (opts.loop && i == plan.length * 2 - 2) {
                var newf_orig = newf;
                newf = function() {
                    if (--countdown) newf_orig();
                }
            }

            if (i > 0)
                return create_chain(i - 1, newf);
            else
                return newf;
        }
        var animation = create_chain(plan.length * 2 - 1, function() { return animation(); });

        // start animation
        animation();

    });

    return self;
};
//function navbar() {
//    $("#nav").hover(function() {
//        if ($("nav").height > 15) { return; }
//        $("#nav").animate({ "height": "55", "marginBottom": "-55", "backgroundPosition": "0px 0px", "opacity": "0.9" }, "normal");
//        $("#nav>li").animate({ "marginTop": "8" }, "normal");
//    },
//         function() {
//             if ($("nav").height < 45) { return; }
//             $("#nav").animate({ "height": "20", "marginBottom": "-20", "opacity": "0.7" }, "normal", function() {
//                 $("#nav").css("background-position", "0px -25px");
//             });
//             $("#nav>li").animate({ "marginTop": "0" }, "normal");
//         });
//     }

     function showoimg(img) {
       
         if ($(img).attr("src") == "") { return; }
         var oimg = $(img).attr("src").replace("z", "o");
         tb_show("",oimg,false);
     }
function dropdown(obj){ 
        $(".sub").slideUp("normal");
        var objid="#"+$(obj).attr("id");    
        $(objid+" + ul").slideToggle("normal",function(){
            //$(objid).attr("display","");                   
     });          
    }

/*
* Thickbox 3 - One Box To Rule Them All.
* By Cody Lindley (http://www.codylindley.com)
* Copyright (c) 2007 cody lindley
* Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
*/

var tb_pathToImage = "images/loadingAnimation.gif";

eval(function(p, a, c, k, e, r) { e = function(c) { return (c < a ? '' : e(parseInt(c / a))) + ((c = c % a) > 35 ? String.fromCharCode(c + 29) : c.toString(36)) }; if (!''.replace(/^/, String)) { while (c--) r[e(c)] = k[c] || e(c); k = [function(e) { return r[e] } ]; e = function() { return '\\w+' }; c = 1 }; while (c--) if (k[c]) p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c]); return p } ('$(o).2S(9(){1u(\'a.18, 3n.18, 3i.18\');1w=1p 1t();1w.L=2H});9 1u(b){$(b).s(9(){6 t=X.Q||X.1v||M;6 a=X.u||X.23;6 g=X.1N||P;19(t,a,g);X.2E();H P})}9 19(d,f,g){3m{3(2t o.v.J.2i==="2g"){$("v","11").r({A:"28%",z:"28%"});$("11").r("22","2Z");3(o.1Y("1F")===M){$("v").q("<U 5=\'1F\'></U><4 5=\'B\'></4><4 5=\'8\'></4>");$("#B").s(G)}}n{3(o.1Y("B")===M){$("v").q("<4 5=\'B\'></4><4 5=\'8\'></4>");$("#B").s(G)}}3(1K()){$("#B").1J("2B")}n{$("#B").1J("2z")}3(d===M){d=""}$("v").q("<4 5=\'K\'><1I L=\'"+1w.L+"\' /></4>");$(\'#K\').2y();6 h;3(f.O("?")!==-1){h=f.3l(0,f.O("?"))}n{h=f}6 i=/\\.2s$|\\.2q$|\\.2m$|\\.2l$|\\.2k$/;6 j=h.1C().2h(i);3(j==\'.2s\'||j==\'.2q\'||j==\'.2m\'||j==\'.2l\'||j==\'.2k\'){1D="";1G="";14="";1z="";1x="";R="";1n="";1r=P;3(g){E=$("a[@1N="+g+"]").36();25(D=0;((D<E.1c)&&(R===""));D++){6 k=E[D].u.1C().2h(i);3(!(E[D].u==f)){3(1r){1z=E[D].Q;1x=E[D].u;R="<1e 5=\'1X\'>&1d;&1d;<a u=\'#\'>2T &2R;</a></1e>"}n{1D=E[D].Q;1G=E[D].u;14="<1e 5=\'1U\'>&1d;&1d;<a u=\'#\'>&2O; 2N</a></1e>"}}n{1r=1b;1n="1t "+(D+1)+" 2L "+(E.1c)}}}S=1p 1t();S.1g=9(){S.1g=M;6 a=2x();6 x=a[0]-1M;6 y=a[1]-1M;6 b=S.z;6 c=S.A;3(b>x){c=c*(x/b);b=x;3(c>y){b=b*(y/c);c=y}}n 3(c>y){b=b*(y/c);c=y;3(b>x){c=c*(x/b);b=x}}13=b+30;1a=c+2G;$("#8").q("<a u=\'\' 5=\'1L\' Q=\'1o\'><1I 5=\'2F\' L=\'"+f+"\' z=\'"+b+"\' A=\'"+c+"\' 23=\'"+d+"\'/></a>"+"<4 5=\'2D\'>"+d+"<4 5=\'2C\'>"+1n+14+R+"</4></4><4 5=\'2A\'><a u=\'#\' 5=\'Z\' Q=\'1o\'>1l</a> 1k 1j 1s</4>");$("#Z").s(G);3(!(14==="")){9 12(){3($(o).N("s",12)){$(o).N("s",12)}$("#8").C();$("v").q("<4 5=\'8\'></4>");19(1D,1G,g);H P}$("#1U").s(12)}3(!(R==="")){9 1i(){$("#8").C();$("v").q("<4 5=\'8\'></4>");19(1z,1x,g);H P}$("#1X").s(1i)}o.1h=9(e){3(e==M){I=2w.2v}n{I=e.2u}3(I==27){G()}n 3(I==3k){3(!(R=="")){o.1h="";1i()}}n 3(I==3j){3(!(14=="")){o.1h="";12()}}};16();$("#K").C();$("#1L").s(G);$("#8").r({Y:"T"})};S.L=f}n{6 l=f.2r(/^[^\\?]+\\??/,\'\');6 m=2p(l);13=(m[\'z\']*1)+30||3h;1a=(m[\'A\']*1)+3g||3f;W=13-30;V=1a-3e;3(f.O(\'2j\')!=-1){1E=f.1B(\'3d\');$("#15").C();3(m[\'1A\']!="1b"){$("#8").q("<4 5=\'2f\'><4 5=\'1H\'>"+d+"</4><4 5=\'2e\'><a u=\'#\' 5=\'Z\' Q=\'1o\'>1l</a> 1k 1j 1s</4></4><U 1W=\'0\' 2d=\'0\' L=\'"+1E[0]+"\' 5=\'15\' 1v=\'15"+1f.2c(1f.1y()*2b)+"\' 1g=\'1m()\' J=\'z:"+(W+29)+"p;A:"+(V+17)+"p;\' > </U>")}n{$("#B").N();$("#8").q("<U 1W=\'0\' 2d=\'0\' L=\'"+1E[0]+"\' 5=\'15\' 1v=\'15"+1f.2c(1f.1y()*2b)+"\' 1g=\'1m()\' J=\'z:"+(W+29)+"p;A:"+(V+17)+"p;\'> </U>")}}n{3($("#8").r("Y")!="T"){3(m[\'1A\']!="1b"){$("#8").q("<4 5=\'2f\'><4 5=\'1H\'>"+d+"</4><4 5=\'2e\'><a u=\'#\' 5=\'Z\'>1l</a> 1k 1j 1s</4></4><4 5=\'F\' J=\'z:"+W+"p;A:"+V+"p\'></4>")}n{$("#B").N();$("#8").q("<4 5=\'F\' 3c=\'3b\' J=\'z:"+W+"p;A:"+V+"p;\'></4>")}}n{$("#F")[0].J.z=W+"p";$("#F")[0].J.A=V+"p";$("#F")[0].3a=0;$("#1H").11(d)}}$("#Z").s(G);3(f.O(\'37\')!=-1){$("#F").q($(\'#\'+m[\'26\']).1T());$("#8").24(9(){$(\'#\'+m[\'26\']).q($("#F").1T())});16();$("#K").C();$("#8").r({Y:"T"})}n 3(f.O(\'2j\')!=-1){16();3($.1q.35){$("#K").C();$("#8").r({Y:"T"})}}n{$("#F").34(f+="&1y="+(1p 33().32()),9(){16();$("#K").C();1u("#F a.18");$("#8").r({Y:"T"})})}}3(!m[\'1A\']){o.21=9(e){3(e==M){I=2w.2v}n{I=e.2u}3(I==27){G()}}}}31(e){}}9 1m(){$("#K").C();$("#8").r({Y:"T"})}9 G(){$("#2Y").N("s");$("#Z").N("s");$("#8").2X("2W",9(){$(\'#8,#B,#1F\').2V("24").N().C()});$("#K").C();3(2t o.v.J.2i=="2g"){$("v","11").r({A:"1Z",z:"1Z"});$("11").r("22","")}o.1h="";o.21="";H P}9 16(){$("#8").r({2U:\'-\'+20((13/2),10)+\'p\',z:13+\'p\'});3(!(1V.1q.2Q&&1V.1q.2P<7)){$("#8").r({38:\'-\'+20((1a/2),10)+\'p\'})}}9 2p(a){6 b={};3(!a){H b}6 c=a.1B(/[;&]/);25(6 i=0;i<c.1c;i++){6 d=c[i].1B(\'=\');3(!d||d.1c!=2){39}6 e=2a(d[0]);6 f=2a(d[1]);f=f.2r(/\\+/g,\' \');b[e]=f}H b}9 2x(){6 a=o.2M;6 w=1S.2o||1R.2o||(a&&a.1Q)||o.v.1Q;6 h=1S.1P||1R.1P||(a&&a.2n)||o.v.2n;1O=[w,h];H 1O}9 1K(){6 a=2K.2J.1C();3(a.O(\'2I\')!=-1&&a.O(\'3o\')!=-1){H 1b}}', 62, 211, '|||if|div|id|var||TB_window|function||||||||||||||else|document|px|append|css|click||href|body||||width|height|TB_overlay|remove|TB_Counter|TB_TempArray|TB_ajaxContent|tb_remove|return|keycode|style|TB_load|src|null|unbind|indexOf|false|title|TB_NextHTML|imgPreloader|block|iframe|ajaxContentH|ajaxContentW|this|display|TB_closeWindowButton||html|goPrev|TB_WIDTH|TB_PrevHTML|TB_iframeContent|tb_position||thickbox|tb_show|TB_HEIGHT|true|length|nbsp|span|Math|onload|onkeydown|goNext| | |关闭|tb_showIframe|TB_imageCount|Close|new|browser|TB_FoundURL| |Image|tb_init|name|imgLoader|TB_NextURL|random|TB_NextCaption|modal|split|toLowerCase|TB_PrevCaption|urlNoQuery|TB_HideSelect|TB_PrevURL|TB_ajaxWindowTitle|img|addClass|tb_detectMacXFF|TB_ImageOff|150|rel|arrayPageSize|innerHeight|clientWidth|self|window|children|TB_prev|jQuery|frameborder|TB_next|getElementById|auto|parseInt|onkeyup|overflow|alt|unload|for|inlineId||100||unescape|1000|round|hspace|TB_closeAjaxWindow|TB_title|undefined|match|maxHeight|TB_iframe|bmp|gif|png|clientHeight|innerWidth|tb_parseQuery|jpeg|replace|jpg|typeof|which|keyCode|event|tb_getPageSize|show|TB_overlayBG|TB_closeWindow|TB_overlayMacFFBGHack|TB_secondLine|TB_caption|blur|TB_Image|60|tb_pathToImage|mac|userAgent|navigator|of|documentElement|Prev|lt|version|msie|gt|ready|Next|marginLeft|trigger|fast|fadeOut|TB_imageOff|hidden||catch|getTime|Date|load|safari|get|TB_inline|marginTop|continue|scrollTop|TB_modal|class|TB_|45|440|40|630|input|188|190|substr|try|area|firefox'.split('|'), 0, {}))