/* linea js collection */


var browser_ok;
var imgs;
var imgs_;
var total_img;
var preload;
var img_butt_class;



img_butt_class = new Array ();
img_butt_class["hi"] = "img_butt_active";
img_butt_class["lo"] = "img_butt";

img_x = new Array ();
img_y = new Array ();


if (((navigator.appName.indexOf("Microsoft") > -1 )&&(parseInt(navigator.appVersion.substring(0)) >=4))|| ((navigator.appName.indexOf("Netscape") > -1 )&&(parseInt(navigator.appVersion.substring(0)) >=4)))
{browser_ok="si";}

/* --------------------------------------------------------------------------*/

/* this is for the **** windows explorer, to teach him makin a good navigation */

sfHover = function() {
			var sfEls = document.getElementById("nav").getElementsByTagName("LI");
			for (var i=0; i<sfEls.length; i++) {
				sfEls[i].onmouseover=function() {
					this.className+=" sfhover";
				}
				sfEls[i].onmouseout=function() {
					this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
				}
			}
		}

		if (window.attachEvent) window.attachEvent("onload", sfHover);


/* --------------------------------------------------------------------------*/
/* image slide thing functions FOR MORE THAN ONE SHOW PER PAGE*/

function preload_img_(showid) {

if (browser_ok && imgs_[showid]) {

	if (!preload) preload = new Array ();
	
	total_img = (imgs_[showid].length); 
	preload[showid] = new Array ()


for (i = 1; i <= total_img; i++) {
		if (!showid) {
		preload[i] = new Image();
        preload[i].src = imgs[i-1];
		}
		else {
		preload[showid][i] = new Image();
        preload[showid][i].src = imgs_[showid][i-1];
        }
	}
	}
}



function img_display_(num, showid) {	

if (document.getElementById('linea_img_'+showid) && document.getElementById('linea_img_'+showid).src) {
if ( showid && preload[showid] && preload[showid][num] && preload[showid][num].src ) {
	
	// change img
	document.getElementById('linea_img_'+showid).src = preload[showid][num].src;
	
	if (img_x[num] && img_y[num]) {
	    document.getElementById('linea_img_'+showid).width = img_x[num];
	    document.getElementById('linea_img_'+showid).height = img_y[num];
	    }
	
if (document.getElementById('img_butt_'+showid+'_'+num) && document.getElementById('img_butt_'+showid+'_'+num).className) {
	
	// change active butt
	document.getElementById('img_butt_'+showid+'_'+num).className = img_butt_class["hi"] ;
	
	if (total_img && total_img>0) {
		for (i = 1; i <= total_img; i++) {
		if (i!=num && document.getElementById('img_butt_'+showid+'_'+i) && document.getElementById('img_butt_'+showid+'_'+i).className) {
			document.getElementById('img_butt_'+showid+'_'+i).className = img_butt_class["lo"] ;
			}
		}
	}
	}
	
	}
	} 
}


/* --------------------------------------------------------------------------*/
/* image slide thing functions */

function preload_img() {

if (browser_ok && imgs) {

total_img = (imgs.length);
preload = new Array ()

for (i = 1; i <= total_img; i++) {
		preload[i] = new Image();
        preload[i].src = imgs[i-1];
	}
	}
}



function img_display(num) {	

if (document.getElementById('linea_img') && document.getElementById('linea_img').src) {
if (preload && preload[num] && preload[num].src) {
	
	// change img
	document.getElementById('linea_img').src = preload[num].src;
	
	if (img_x[num] && img_y[num]) {
	    document.getElementById('linea_img').width = img_x[num];
	    document.getElementById('linea_img').height = img_y[num];
	    }
	
if (document.getElementById('img_butt_'+num) && document.getElementById('img_butt_'+num).className) {
	
	// change active butt
	document.getElementById('img_butt_'+num).className = img_butt_class["hi"] ;
	
	if (total_img && total_img>0) {
		for (i = 1; i <= total_img; i++) {
		if (i!=num && document.getElementById('img_butt_'+i) && document.getElementById('img_butt_'+i).className) {
			document.getElementById('img_butt_'+i).className = img_butt_class["lo"] ;
			}
		}
	}
	}
	
	}
	}	
}


function run_img_show(num,sec) {	

if (document.getElementById('linea_img') && document.getElementById('linea_img').src) {
if (preload) {

	num = num+1;
	if (num > total_img) num = 1;
	
	img_display(num);
	setTimeout("run_img_show("+num+","+sec+")",(sec*1000) );
	
		}
	
	}

}


function start_img_show(sec) {
	setTimeout("run_img_show(1,"+sec+")",(sec*1000) );
}

function run_img_show(num,sec) {	

if (document.getElementById('linea_img') && document.getElementById('linea_img').src) {
if (preload && total_img && total_img>0) {

	num = num+1;
	if (num > total_img) num = 1;
	
	img_display(num);
	setTimeout("run_img_show("+num+","+sec+")",(sec*1000) );
	
		}
	
	}

}


function start_random_show(sec) {
	setTimeout("run_random_show("+sec+")",(sec*1000) );
}


function run_random_show(sec) {	

if (document.getElementById('linea_img') && document.getElementById('linea_img').src) {
if (preload && total_img && total_img>0) {

	rand = Math.random()
	num = Math.ceil(rand*total_img)
	
	img_display(num);
	setTimeout("run_random_show("+sec+")",(sec*1000) );
	
		}
	
	}

}


