var ns = (document.layers) ? 1:0;
var loop, timer ;
var isIn=0 ;
var loaded;

function makeObj(obj,nest){
  nest = (!nest) ? '':'document.'+nest+'.';
  this.el = ns ? eval(nest+'document.'+obj):document.all[obj];
  this.css = ns ? eval(nest+'document.'+obj):document.all[obj].style;

  this.scrollWidth = ns ? this.css.document.width:this.el.offsetWidth;
  this.clipWidth = ns ? this.css.clip.width:this.el.offsetWidth;
  this.scrollHeight= ns ?this.css.document.height:this.el.offsetHeight;
  this.clipHeight= ns ?this.css.clip.height:this.el.offsetHeight;
  this.left = goLeft;
  this.right = goRight;
  this.moveIt = moveIt;
  this.obj = obj + "Object";
  eval(this.obj + "=this");
  return this;
}
function moveIt(x,y){
  this.x = x;
  this.y = y;
  this.css.left = this.x;
  this.css.top = this.y;
}
function goRight(move){
  if (this.x > (380-this.scrollWidth)  ){
    this.moveIt(this.x-move,0);
    if (loop) setTimeout(this.obj+".right("+move+")",50);
  }
}
function goLeft(move){
  if (this.x<0){
    this.moveIt(this.x-move,0);
    if (loop) setTimeout(this.obj+".left("+move+")",50);
  }
}
function scrollX(speed){
	if( this.isIn==0 ){
		isIn = 1 ;
		scrollInit('divCont','divText', '0');
	}
  if (loaded){
    loop = true;
    if (speed>0) oScroll.right(speed);
    else oScroll.left(speed);
  }
}
function scrollY(speed){
  if (loaded){
    loop = true;
    if (speed>0) oScroll.left(speed);
    else oScroll.up(speed);
  }
}
function noScroll(){
  loop = false;
  if (timer) clearTimeout(timer);
}
function scrollInit(div1,div2, moveX){
  pageWidth= ns ? innerWidth:(document.body.offsetWidth-100);
  oCont = new makeObj(div1);
  oScroll = new makeObj(div2,div1);
  oScroll.moveIt( moveX*(-1),0);
  loaded = true;
}

function ChgImage( img_path ){
	document.all.myimage.src = img_path ;
}

function clickImg( nowi , imgCount ){
	for( var k=0 ; k<imgCount ; k++ ){
		document.getElementById("t_img_"+k).style.borderWidth=0;
	}
	document.getElementById("t_img_"+nowi).style.borderColor="#FF6633";
	document.getElementById("t_img_"+nowi).style.borderWidth=2;
}

