with(productsList = new Function()){
	prototype.instanceName ="";
	prototype.targetName ="";
	prototype.itemsArray =Array();
	prototype.imgSmallObjArray =Array();
	prototype.defaultItems =-1;
	prototype.ilmInstance ="";
	// slider obj
	prototype.instanceObj =null;
	prototype.tmpImgObj =null;
	prototype.firstImage =null;

	// privat
	prototype.iW =173;
	prototype.countLoadImg =0;

	prototype.currentItemId =-1;
    prototype.beforeItemNum =0;

	prototype.init =function(){
		if(jr_lib.browser().name =="Opera")  this.opacityTime =60;
       //loading images fo interfase
       imgTmpArray =Array();

       imgTmpArray[0] =new Image();
       imgTmpArray[0].src ="images/loading.gif";

       this.preloadImages();

       this.instanceObj =document.getElementById(this.targetName);
       this.createSlider();
    }

	prototype.createSlider =function(){
        var tmpStr ="";

        for(i =0; i <this.itemsArray.length; i++) {
        	tmpStr +="<div id=\"smallImg_"+this.instanceName+i+"\" class=\"sBottomItem\" onMouseOver=\""+this.instanceName+".itemHandle('h', " +i +");\" onMouseOut=\""+this.instanceName+".itemHandle('o', " +i +");\" onClick=\""+this.instanceName+".runCmd(" +i +");\" style=\"left:"+(i*(132+5)+12)+"px;top:0\"><div id=\"itemImg_"+this.instanceName+i+"\"></div><a>" +this.itemsArray[i].title +"</a></div>";
        }

		this.instanceObj.innerHTML =tmpStr;

    	this.loadSmallImage();
    }

    prototype.itemNoSelected =function (n){
    	if(this.currentItemId ==-1) return false;
    	tmpItemObj =document.getElementById("smallImg_"+this.instanceName+n);
    	tmpItemImageObj =document.getElementById("itemImg_"+this.instanceName+n);
     	tmpItemObj.className ="sBottomItem";
      	tmpItemImageObj.style.background ="none";
      	this.currentItemId =-1;
   }

	prototype.itemHandle =function (event, n){
    	tmpItemObj =document.getElementById("smallImg_"+this.instanceName+n);
    	tmpItemImageObj =document.getElementById("itemImg_"+this.instanceName+n);
        if(n != this.currentItemId) {
    		if(event =="h") {
        		tmpItemObj.className ="sBottomItem sBottomItemHover";
        		tmpItemImageObj.style.background ="#fff";
    		}
    		else if(event =="o") {
            	tmpItemObj.className ="sBottomItem";
            	tmpItemImageObj.style.background ="none";
    		}
    		else if(event =="s") {
                if(this.currentItemId !=-1) {
            		tmpCurrentItemObj =document.getElementById("smallImg_"+this.instanceName+this.currentItemId);
            		tmpCurrentItemImageObj =document.getElementById("itemImg_"+this.instanceName+this.currentItemId);
            		tmpCurrentItemObj.className ="sBottomItem";
            		tmpCurrentItemImageObj.style.background ="none";
                }

            	this.currentItemId =n;
        		tmpItemObj.className ="sBottomItem sBottomItemSelect";
        		tmpItemImageObj.style.background ="#fff";

    		}
    	}
	}

	prototype.btn360Handle =function (status){
		if(this.btn360Obj.className =="btn360 btn360Select") return false;

		if(status ==1) {
			this.btn360Obj.className ="btn360 btn360Hover";
		}
		else if(status ==0) {
			this.btn360Obj.className ="btn360";
		}
	}


	prototype.currentItemOff =function (){
		this.topContObj.innerHTML ="";
		if(this.currentItemId !=-1) {
    		tmpCurrentItemObj =document.getElementById("smallImg_"+this.instanceName+this.currentItemId);
    		tmpCurrentItemImageObj =document.getElementById("itemImg_"+this.instanceName+this.currentItemId);
    		tmpCurrentItemObj.className ="sBottomItem";
    		tmpCurrentItemImageObj.style.background ="none";
    		this.currentItemId =-1;
    	}
	}

	prototype.startScroll =function (direction){
		this.scrollBarControl();
		if(this.scrollInterval ==null) {
			this.scrollCarrentStep =0;
			if((direction ==0 && parseInt(this.sScrollLine.style.left) <0) || (direction ==1 && (this.iW*(this.itemsArray.length-1) -Math.abs(parseInt(this.sScrollLine.style.left))) >this.sScrollBox.offsetWidth))
				this.scrollInterval =setInterval(this.instanceName +".sliderScroll('" +direction +"');", this.scrollTime);
        }
    }

	prototype.sliderScroll =function (direction){
    	if(direction ==0) {

        	if(this.scrollCarrentStep +this.scrollStep <=this.scrollWidth) {
        		this.sScrollLine.style.left = parseInt(this.sScrollLine.style.left) +this.scrollStep +"px";
        		this.scrollCarrentStep +=this.scrollStep;
        	} else {
        		this.sScrollLine.style.left =parseInt(this.sScrollLine.style.left) -(this.scrollCarrentStep -this.scrollWidth) +"px";
        		clearInterval(this.scrollInterval);
        		this.scrollInterval =null;
        		this.scrollCarrentStep =0;
        		this.btnHandle();
        	}

    	}
    	else if(direction ==1) {

        	if(this.scrollCarrentStep +this.scrollStep <=this.scrollWidth) {
        		this.sScrollLine.style.left = parseInt(this.sScrollLine.style.left) -this.scrollStep +"px";
        		this.scrollCarrentStep +=this.scrollStep;
        	} else {

        		this.sScrollLine.style.left =parseInt(this.sScrollLine.style.left) +(this.scrollCarrentStep - this.scrollWidth) +"px";

        		clearInterval(this.scrollInterval);
        		this.scrollInterval =null;
        		this.scrollCarrentStep =0;
        		this.btnHandle();
        	}
    	}
    }

	// load small images
	prototype.loadSmallImage =function (){
    	if(this.countLoadImg <this.itemsArray.length) {
    		tmpStr2 =this.instanceName+".endLoadSmallImage();";
    		this.imgSmallObjArray[this.countLoadImg] =new Image();
    	    this.imgSmallObjArray[this.countLoadImg].onload =function(){eval(tmpStr2);};
    	    this.imgSmallObjArray[this.countLoadImg].src =this.itemsArray[this.countLoadImg].img;
    	}
    	else {
    		this.countLoadImg =0;
    		this.runCmd(this.defaultItems);
    		return false;
    	}
    }

	prototype.endLoadSmallImage =function (){
		this.imgSmallObjArray[this.countLoadImg].onload=null;
        var objImgCont =document.getElementById("itemImg_"+this.instanceName+this.countLoadImg);
        objImgCont.style.background ="none";//"url('"+this.itemsArray[this.countLoadImg].img+"')";

        objImgCont.innerHTML =this.insertImage(this.itemsArray[this.countLoadImg].img, this.imgSmallObjArray[this.countLoadImg].width, this.imgSmallObjArray[this.countLoadImg].height, "");
        this.countLoadImg ++;
        this.loadSmallImage();
	}

	prototype.preloadImages =function() {
		imgPreLoadArray =Array();
		for(i=1; i<this.itemsArray.length; i++) {
			if(this.itemsArray.actions =="showImage") {
				imgPreLoadArray[i] = new Image();
		    	imgPreLoadArray[i].src = this.itemsArray[i].file;
			}
		}
	}


	// function by view comands
	prototype.runCmd =function(numItem, runStat) {

        var runSt =runStat || 1;

		if((this.ilmInstance !="") && (this.currentItemId ==numItem) && (runSt !=2)){
			this.itemNoSelected(numItem);
        	eval("tmpObj=" +this.ilmInstance);
        	eval(this.ilmInstance +".hide();");
        	tmpObj.showAllLink();
			return false;
		}

		if(numItem ==-1) return false; //for getLink or no auto select item
		this.itemHandle("s", numItem);

		if(runSt ==2) return false;

		eval(this.instanceName +".selectIlms(" +numItem +");");
	}

	prototype.selectIlms =function(numItem) {
    	eval("tmpObj=" +this.ilmInstance);
       eval(this.ilmInstance +".hide();");
        tmpObj.showAllLink();
        tmpObj.hideOthersLink(this.itemsArray[numItem].ilmLinks);

        //Show images
		for (var name_e in tmpObj.config) {
    		if(this.itemsArray[numItem].ilmLinks.indexOf(name_e) !=-1) {
    			if(document.getElementById(name_e)){
    				tmpObj.show(name_e, 2);

    			}
    		}
		}
    }

	prototype.insertImage =function(path, w, h, style) {
		var browser =jr_lib.browser().name +jr_lib.browser().version;
		if(browser !='IE6.0') tmpImg ="<img border=\"0\" width=\""+w+"px\" height =\""+h+"px\" src=\""+path+"\" style=\""+style+"\"/>";
			else tmpImg ="<span style=\"display:inline-block;" +style +"width:"+w+"px;height:"+h+"px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+path+"', sizingMethod='scale');\"></span>";

		return tmpImg;
	}

}


//config
obj_pl = new productsList(); // create new slider
obj_pl.instanceName ="obj_pl"; // name instance of class
obj_pl.targetName ="products_list"; // the select container
obj_pl.ilmInstance ="ilmLincksObj";

	//---items (img - url small image; )
obj_pl.itemsArray[obj_pl.itemsArray.length] ={
	img: "/resources/images/gallery/cals/small-img.png",
	title: "Cavity Auto Scanner",
	ilmLinks: "ilm-linck-cavity-survey"      //String comma separated
}
obj_pl.itemsArray[obj_pl.itemsArray.length] ={
	img: "/resources/images/gallery/void-scaner/small-img.png",
	title: "Void Scanner",
	ilmLinks: "ilm-linck-void-survey"
}
obj_pl.itemsArray[obj_pl.itemsArray.length] ={
	img: "/resources/images/gallery/quarryman/small-img.png",
	title: "Quarryman Pro",
	ilmLinks: "ilm-linck-quarry-survey"
}
obj_pl.itemsArray[obj_pl.itemsArray.length] ={
	img: "/resources/images/gallery/cabled-boretrak/small-img.png",
	title: "Cabled Boretrak",
	ilmLinks: "ilm-linck-borehole-deviation-surveying"
}
obj_pl.itemsArray[obj_pl.itemsArray.length] ={
	img: "/resources/images/gallery/dynascan/small-img.png",
	title: "Dynascan",
	ilmLinks: "ilm-linck-topographic-mapping,ilm-linck-beach-profiling"
}
obj_pl.itemsArray[obj_pl.itemsArray.length] ={
	img: "/resources/images/gallery/ilm/ilm_35/small-img.png",
	title: "ILM35",
	ilmLinks: "ilm-linck-altimeter-sys,ilm-linck-height-detection"
}
obj_pl.itemsArray[obj_pl.itemsArray.length] ={
	img: "/resources/images/gallery/fanbeam/small-img.png",
	title: "Fanbeam",
	ilmLinks: "ilm-linck-dymanic-positioning"
}

