// JavaScript Document

(function(a){
    a.fn.dosSlideshow4=function(p){
        var p=p||{};

        var autoplay=p&&p.autoplay?p.autoplay:"enable";
        var slideshow_width=p&&p.slideshow_width?p.slideshow_width:"720";
        var slideshow_height=p&&p.slideshow_height?p.slideshow_height:"276";
        var thumbnail_width=p&&p.thumbnail_width?p.thumbnail_width:"230";
        var time_Interval = p&&p.time_Interval?p.time_Interval:"6000";
        var directory=p&&p.directory?p.directory:"images";
        slideshow_height = parseInt(slideshow_height);
        slideshow_width = parseInt(slideshow_width);
        time_Interval = parseInt(time_Interval);
        var g=a(this);
        var current = -1;
        var y=g.children(".switchBigPic").children("div").length;
        var v;
        var w;
        if(y==0){
            g.append("Require content");
            return null
        }
        init();
        if(autoplay == "enable"){
            play();
        }else{
            current = 0;
            showpic();
        }
        g.find(".nav").children("li").hover(
            function(){
                var index = g.find(".nav").children("li").index($(this));
                if(index != current){
                    current = index;
                    showpic();
                }
            },
            function(){

            }
        );
        g.hover(
            function(){

            },
            function(){
                if(autoplay == "enable"){
                    v=setTimeout(play,time_Interval);
                }
            }
        );
        function init(){
           
		    g.css("width",slideshow_width+"px").css("height",slideshow_height+"px").css("position","relative").css("font-family", "Trebuchet MS, Arial, Helvetica, sans-serif") .css("border","none").css("overflow","hidden");
			
            g.find("a").css("color","#666");
            
			g.find("img").css("border","none");
            
			g.find("ul").css("margin","0px").css("padding","0,0,0,0px");
            
			g.find("li").css("margin","0px").css("padding","0,5,0,0px").css("list-style","none");
            
			g.find(".switchBigPic").css("position","relative");
            
			g.find(".switchBigPic").children("div").css("position","absolute").css("overflow","hidden");
			
			
            //g.find(".switchBigPic").children("div").children("p").css("position","absolute").css("padding","5px").css("margin","0px").css("bottom","0px").css("opacity","0.8").css("background-color","#000").css("color","#FFF").css("font-size","12px").css("width","100%");
			
			//sets size and properties of thumbnail (nav) of slideshow
            g.find(".nav").css("width",thumbnail_width+"px").css("height",slideshow_height+"px").css("position","absolute").css("right","0px");
			
            g.find(".nav").children("li").css("height","88px").css("background-image","url("+directory+"flashtext-bg6a.png)").css("line-height","16px").css("border-bottom","none").css("border-right","none");
			
            g.find(".nav").children("li").children("a").css("text-decoration","none").css("height","49px").css("display","block").css("padding-left","25px").css("padding-top","24px").css("font-size","12px").css("font-weight","bold");
			
            g.find(".nav").children("li").css("margin-left","0px");
            
			g.find(".switchBigPic").children("div").hide();
        
		}
		
		// Sets background and animation properties for thumbnail (nav) of slideshow
		function showpic(){
            clearTimeout(v);
            g.find(".nav").children("li").css("background-image","url("+directory+"flashtext-bg6a.png)").css("border-bottom","none");
            g.find(".nav").children("li").eq(current).css("background-image","url("+directory+"flash-on6.png)").css("border-bottom","none");
            g.find(".switchBigPic").children("div").fadeOut();
            g.find(".switchBigPic").children("div").eq(current).fadeIn();
            //g.find(".nav").children("li").eq(current).animate({marginLeft: '-25px'}, "fast");
            g.find(".nav").children("li").eq(w).animate({marginLeft: '0px'}, "fast");
            w = current;

        }
        function play(){
			
            current++;
            if(current>=y){
                current=0
            }
            showpic();
            v=setTimeout(play,time_Interval);
        }
    }
})(jQuery);
