/* 28.08.07 */
function start_gallery_2(p_id){
	this.Acolor = "#000000"
	if(!window.document.galArray)	window.document.galArray = new Array;
	var galArry,inIndex, stageTV , thumb_holder ,thumb_table, scrollerR , scrollerL, arrowR , arrowL, play, div_elements
		galArry = window.document.galArray;
		inIndex = galArry.length
		galArry[inIndex] = this
	    div_elements = new Array;
		
		temp_arr = this.getElementsByTagName("DIV")
		temp_arr2 = this.getElementsByTagName("TABLE")
		for(i=0;i<temp_arr.length;i++){
				de_length= div_elements.length
				div_elements[de_length] = temp_arr[i]
			}
		for(i=0;i<temp_arr2.length;i++){
				de_length= div_elements.length
				div_elements[de_length] = temp_arr2[i]
			}
	play = false;	
	
	for (n=0; n<div_elements.length; n++){
		//alert(div_elements[n].id)
		switch(div_elements[n].id){
				
			case "gallery_obj_TV":
				stageTV = div_elements[n].getElementsByTagName("IMG")[0]
				this.stageTV= div_elements[n]
			break;
			case "gallery_obj_thumbs_holder" :
				thumb_holder =div_elements[n];
				this.thumb_holder =div_elements[n];
			break;
			case "thumb_table":
				thumb_table = div_elements[n];
				this.thumb_table = div_elements[n];
			break
			case "scrollerL":
				scrollerL = div_elements[n];
				this.scrollerL = scrollerL
			break
			case "scrollerR":
				scrollerR = div_elements[n];
				this.scrollerR = scrollerR
			break
			
			
		}
	}
	

	
	
	this.setPicGallery = function(){
		applyeffect(stageTV, 6)
		stageTV.src = this.href
		playeffect(stageTV)
		/*hrefObjTable = stageTV.parentNode.parentNode.parentNode.parentNode.parentNode
		hrefObjArr = thumb_table.getElementsByTagName("A")*/
		
		return false
	}
	function applyeffect(ob, p){
		if (document.all && ob.filters){
			ob.filters.revealTrans.Transition=p==null?Math.floor(Math.random()*23):p;
			ob.filters.revealTrans.stop()
			ob.filters.revealTrans.apply()
		}
	}
	function playeffect(ob){
		if (document.all && ob.filters)
			ob.filters.revealTrans.play()
	}
	
	var tmpScrollBut,sGald
	
	
 this.galScrollL =  function(){
 	if(play){
		if(thumb_holder ){

			//scrollerL.style.color == "#000000" && 
				thumb_holder.scrollLeft-=6
				clearTimeout(sGald)
				sGald =	setTimeout("window.document.galArray["+ inIndex +"].galScrollL()",30)
		}
	}
}


this.galScrollR = function(){
	
	if(play){
		
		if(thumb_holder){
				
			//scrollerL.style.color == "#000000" && 
					thumb_holder.scrollLeft+=6
					clearTimeout(sGald)
					sGald =	setTimeout("window.document.galArray["+ inIndex +"].galScrollR()",30)
			
		}
	}
	
}
//	********* INITIATE ALL Buttons ********
thumb_arr = thumb_table.getElementsByTagName("A")
	for (i=0 ; i < thumb_arr.length; i++){
		thumb_arr[i].onclick = this.setPicGallery
	}
	scrollerL.onmouseover=function(){
		play=true;
		galArry[inIndex].galScrollL()
	}
	scrollerR.onmouseover=function(){
		play=true;
		galArry[inIndex].galScrollR()
	}	
	scrollerL.onmouseout = function(){
       play=false
	   
	}
	scrollerR.onmouseout = function(){
       play=false
	}
	var sGal
	var pointerArrowR = scrollerR.getElementsByTagName("TD")[1]
	var pointerArrowL = scrollerL.getElementsByTagName("TD")[1]
	this.scrollListener = function(){
	
		obThumbs = thumb_holder
		obThumbsObs = obThumbs.getElementsByTagName("table")[0]
		obThumbsObsW =obThumbsObs.offsetWidth
		top2scroll = obThumbsObsW-obThumbs.offsetWidth-obThumbs.scrollLeft
		if( top2scroll>0 ){
			pointerArrowR.style.color = this.Acolor
	
		}else{
			pointerArrowR.style.color = ""
		}
		
		if(obThumbs.scrollLeft>0) {
				pointerArrowL.style.color = this.Acolor
		}else{
				pointerArrowL.style.color = ""
		}

	clearTimeout(sGal)
	
}
		setInterval("window.document.galArray["+ inIndex +"].scrollListener()",300)
}

 

