// Pre-load part.
base = '\\server/ITECHS/Proyects/La Puesta del Sol/Web La puesta del Sol/Imagen/';
stuff = new Array('club');
omo = new Array();
nrm = new Array();
if (document.images) {
	for (i=0;i<stuff.length;i++) {
		nrm[i] = new Image; nrm[i].src = base + stuff[i] + "_1.gif";
		omo[i] = new Image; omo[i].src = base + stuff[i] + "_2.gif";
	}
}
// The functions: first mouseover, then mouseout
function over(no) {
	if (document.images) { document.images[stuff[no]].src = omo[no].src	}
}
function out(no) {
	if (document.images) { document.images[stuff[no]].src = nrm[no].src	}
}
//-->


// New window
function MM_openBrWindow(theURL,winName,features) { window.open(theURL,winName,features); }
function openBrWindow(theURL,winName,features) { window.open(theURL,winName,features); }
//Images rotate
var r_path = "\\server/ITECHS/Proyects/La Puesta del Sol/Web La puesta del Sol/Imagen/r/"
var r_i = 2
var r_mas = new Array()
var r_name = ""
var r_count = 0

function rotate_init() {
	if (!r_name && !r_count) return false
	for (i=1;i<=r_count;i++) {
		r_mas[i] = new Image
		r_mas[i].src = r_path + r_name + "/" + i + ".jpg"
	}
	img = image("rotate")
	setTimeout("rotate_images()",3000)
}

function rotate_init1(img1,img2,img3) {
	i=1;
	if ( img1 ){
		r_mas[i] = new Image
		r_mas[i].src = img1
        i++;
	}
	if ( img2 ){
		r_mas[i] = new Image
		r_mas[i].src = img2
        i++;
	}
	if ( img3 ){
		r_mas[i] = new Image
		r_mas[i].src = img3
        i++;
	}
	r_count=i-1;
	if (r_count > 1) {
		img = image("rotate")
		setTimeout("rotate_images()",3000)
	}
} 

function rotate_images() {
	if (r_count == 0) return false;
	img.setSrc(r_mas[r_i].src)
	setTimeout("rotate_images()",3000)
	r_i++
	if (r_i > r_count)	r_i = 1
}




//DRAG AND SCROLL SCRIPT
var maxScrollBar = 368, drag, text, dragapproved = false, speed = 30, loop, timer

function initScroll() {
  if (!KLayers) return false
  drag = layer("ScrollBar")
  text = layer("divText")
  left = layer("divLeft")
  if (left.exists()) {
    text.css.left = 275
    text.css.width = 275
  }
  if (text.getHeight() <= maxScrollBar) drag.css.height = maxScrollBar
  else {
    drag.css.height = parseInt((maxScrollBar * maxScrollBar) / text.getHeight())
    maxDragY = maxScrollBar - drag.getHeight()
    maxTextY = maxScrollBar - text.getHeight()
    initdrag()
   }
   drag.show()
   text.show()
   if (left.exists()) {
	   left.show()
  }
}

function initdrag() {
  document.onmousedown = drags
  document.onmouseup = new Function("dragapproved = false")
  return false
}

function drags(e) {
    if (dragapproved) {
      ev = isNC ? e : event
	    y = ev.clientY
      startDrag = parseInt(drag.style.top+0)
      document.onmousemove = move
    }
   	return false
}

function move(e){
  if (dragapproved) {
    dragY = startDrag + ev.clientY - y
    if (dragY < 0) dragY = 0
    if (dragY > maxDragY) dragY = maxDragY
    textY = Math.ceil((maxTextY * ((dragY * 100)/ maxDragY))/100)
		drag.moveTo(0,dragY)
    text.moveTo(text.getLeft(),textY)
  }
	return false
}

function scroll(s) {
  if (!dragapproved) {
    loop = true
    step = isNC ? 15 * s : 5 * s 
    textY = text.getTop() + step
    if (textY > 0 ) textY = 0
    if (textY < maxTextY) textY = maxTextY
    dragY = Math.ceil((maxDragY * ((textY * 100)/ maxTextY))/100)
		drag.moveTo(0,dragY)
    text.moveTo(text.getLeft(),textY)
    window.status = textY
		if (loop) timer = setTimeout("scroll("+s+")",speed)
	}
}
function noScroll() {
  loop = false
  if (timer) clearTimeout(timer)
}

