    $("#content").hide();
    
    var g_hl;
    var g_pics = 15;
    var g_nbc = '#484850';
    var g_hlc = '#CAC7A9';
    var g_imgPath = "img/home/";
    var g_counter = 0;
    $("#secondPic").hide();

    var g_mainPicName;

    function setMainPic(pic, num, subt){
        if(!$.browser.msie){
            g_currentPic = getIndexInUL(pic.parentNode.parentNode, pic);
            $(".larr").hide();
            $(".rarr").hide();
        }
		$("#div_picture_subtitle").append(subt);
		$("#div_picture_subtitle").empty();
		$("#div_picture_subtitle").append(subt);
		g_mainPicName = num+'_big.jpg' ;
		//pic.style.borderColor=g_hlc;
		if(g_hl){g_hl.style.borderColor=g_nbc;}
		g_hl = pic;
		var image = new Image();
		image.src = g_imgPath + g_mainPicName;
		$("#div_middle").append(image);
		$("#div_middle :eq(1)").hide();
		$("#div_middle :eq(0)").fadeOut("slow", function(){
			$("#div_middle :eq(0)").remove();
			$('body').get()[0].style.cursor="wait";
			load();
		});
	}

	function load(){
		if($("#div_middle :eq(0)").get()[0].complete){
			$("#div_middle :eq(0)").fadeIn("slow");
			$("body").get()[0].style.cursor="auto";
            if(!$.browser.msie){
                $(".larr").show();
                $(".rarr").show();
            }
			return;
		}
		window.setTimeout("load()", 500);
	}

    /**
     * changes style sheet parameter
     */
	function cs(bg, mn, fg){
		$("body").css({backgroundColor:bg,color:fg});
		$("a").css({color:fg});
        $(".handle").css({color:fg});
		$("#main").css({backgroundColor:mn,color:fg});
		$("#statement").css({backgroundColor:mn,color:fg});
		$("i.img_thmb").css("borderColor", fg);
		g_nbc = bg;
		g_hlc = fg;
        $(".span_navi > a").each(function () {
                var href = $(this).attr("href")
                href = href.split("?")[0];
                href += "?bg="+bg.replace("#","")+"&mn="+mn.replace("#","")+"&fg="+fg.replace("#","");
             $(this).attr("href", href);
            //alert(href)
       });
	}

    /**
     * checks if previously a css has been set.
     */
    function ccs(){
       //set css to previous select scheme
       if (window.location.search != ""){
            var params = window.location.search.replace("?","");
            params = params.split("&");
            cs(params[0].replace("bg=","#"),params[1].replace("mn=","#"), params[2].replace("fg=","#"))
        }
    }
	function fn(){
		for (i = 0; i < document.images.length; ++i) {
			if (document.images[i].complete == false) {
			  $("#loader").append(".");
              g_counter++;
              if(0 == g_counter % 10)$("#loader").append("<br/>");
			  window.setTimeout("fn()", 100);
			  return;
			}
		}
		$("#loader").fadeOut("slow", function(){
            $("#content").fadeIn("slow");
            scroller();
		});
	 }
     
    function scroller() {
        var container = $('div.sliderGallery');
        var ul = $('ul', container);
        var itemsWidth = ul.innerWidth() - container.outerWidth();
        $('.slider', container).slider({
            minValue: 0,
            maxValue: itemsWidth,
            handle: '.handle',
            stop: function (event, ui) {
                ul.animate({'left' : ui.value * -1 * itemsWidth / 100}, 500);
            },
            slide: function (event, ui) {
                ul.css('left', ui.value * -1 * itemsWidth / 100);
            }
        });
    };
    
    function getIndexInUL(ul, cur){
        var j = -1;
        for (var i = 0; i <= ul.childNodes.length; i++){
            if(1 == ul.childNodes[i].nodeType){
                j++;
                if(ul.childNodes[i].firstChild == cur)return j;
            }
        }
    }
    
    function up(){
         g_currentPic++;
         if(g_numPics <= g_currentPic)g_currentPic = 0;
         $('li:eq('+g_currentPic+') img').click();
    }
    
    function down(){
         g_currentPic--;
         if(g_currentPic <= -1)g_currentPic = g_numPics -1;
         $('li:eq('+g_currentPic+') img').click();
    }
	
	function fade(elmnt, val){
		if($.browser.msie){return;}
		$(elmnt).fadeTo('fast', val)
	}

