
//If you want it to move faster you can set this lower:
var speed=50

//Sets variables to keep track of what's happening
var loop, timer

//Object constructor
function makeObj(obj,nest){
    nest=(!nest) ? '':'document.'+nest+'.'
	this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
  	this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;
	this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight;
	this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight;
	this.up=goUp;this.down=goDown;	
	this.moveLeft=goLeft;this.moveRight=goRight;
	this.moveIt=moveIt; this.x; this.y;
	this.scrollWidth=bw.ns4?this.css.document.width:this.el.offsetWidth;
	this.clipWidth=bw.ns4?this.css.document.width:this.el.offsetWidth;
	
    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}

//Makes the object go up
function goDown(move){
	if(this.y>-this.scrollHeight+oCont.clipHeight){
		this.moveIt(0,this.y-move)
			if(loop) setTimeout(this.obj+".down("+move+")",speed)}}
//Makes the object go down
function goUp(move){
	if(this.y<0){
		this.moveIt(0,this.y-move)
		if(loop) setTimeout(this.obj+".up("+move+")",speed)}}

function goLeft(move){
	if(this.x<10){
		this.moveIt(this.x-move,0)
		if(loop) setTimeout(this.obj+".moveLeft("+move+")",speed)}}
function goRight(move){
	if(this.x>-this.scrollWidth+oCont.clipWidth){
		this.moveIt(this.x-move,0)
			if(loop) setTimeout(this.obj+".moveRight("+move+")",speed)}}		
		
//Calls the scrolling functions. Also checks whether the page is loaded or not.
function scroll(speed){
	if(loaded){
		loop=true;
		//if(speed>0) oScroll.down(speed)
		//else oScroll.up(speed)
		if(speed>0) oScroll.moveRight(speed)
		else oScroll.moveLeft(speed)
	}
}

//Stops the scrolling (called on mouseout)
function noScroll(){
	loop=false
	if(timer) clearTimeout(timer)}

//Makes the object
var loaded;
function scrollInit(){
	oCont=new makeObj('divCont')
	oScroll=new makeObj('divText','divCont')
	oScroll.moveIt(0,0)
	oCont.css.visibility='visible'
	loaded=true;}

//Call the init on page load
onload=scrollInit;

function test2(){
	layhei=page.y2/10*9;
	zellhoehe=page.x2/8*9;	
	buthei=page.y2/100*3;
	butwid=page.x2/3*2;
	butwidpos=page.x2/6;
	
	butheipos=page.y2/100*97;
	bildbreite=page.x2;
	bildhoehe=bildbreite/4*3;
	//Variables posiciones
	//alto de celdas de la tabla
	heightTD=100;
	//DivUp   //flecha izquierda
	leftDivUp=280 //0+2; //5px de margen
	topDivUp=180;
	//divCont
	widthDivCont=450; //ancho del div contenedor de las imagenes
	heightDivCont=page.y2/10*9 - 300; //alto del div contenedor de las imagenes	
	topDivCont=200;//page.y2/100*5; <-- top da tira de imaxes
	leftDivCont=leftDivUp+20; //<-- left da tira de imaxes (isto non se usa, de momento)
	//DivDown   //felcha Derecha
	leftDivDown=widthDivCont+280+20//30; 
	topDivDown=180;
	//Imagenes Galeria
	widthPic=100;	//ancho de imagenes
	heightPic=100;	// alto de imagenes
	//Tamaño de la imagen que se usa es una trasparente para que se vea la de fondo
	widthFlechaTrans=20;
	heightFlechaTrans=140;
	//máximo índice da tira (obxectos na tira numéranse de 0)
	numObxectosNaTira=1;
	
	
	///////
	document.write("<div id='divUp'>" +
					"<a href='#' onmouseover='scroll(-10)' onmouseout='noScroll()'> "+
						"<img src='../../../../imaxes/left.gif' "+
						  "width='"+widthFlechaTrans+"px' "+
						  "height='"+heightFlechaTrans+"px' alt='' border='0'> "+
					"</a>"+
					"</div>");
  	document.write("<div id='divDown'> "+
						"<a href='#' onmouseover='scroll(10)' "+
						"onmouseout='noScroll()'> "+
							"<img src='../../../../imaxes/right.gif' "+
							  "width='"+widthFlechaTrans+"px' "+
							  "height='"+heightFlechaTrans+"px' alt='' title='' border='0'> "+
						"</a> "+
					"</div> "+
					"<div id='divCont'>" +
						"<div id='divText'>");
	document.write("<table class='tab04' cellspacing='0' cellpadding='0'>");	
	document.write("<tr valign='top'>");
	for(i = 0; i <= numObxectosNaTira; i++) {
		picnumx = i;
		if (picnumx<10) 
		  {picnumx = "000"+i;}
		else 
		  {if (picnumx<100) 
		     {picnumx = "00"+i;}
		   else 
		     {if (picnumx<1000) 
			   {picnumx = "0"+i;}
			 }
		  };
        
		document.write("<td height='"+heightTD+"px' style='padding-right:30px;'>");		
		document.write("<img id='pic"+picnumx+"' " +												
						" src='galimaxes/pic"+picnumx+"s.jpg' " +
						"width='"+widthPic+"px' height='"+heightPic+"px' border='0' "+						
						" title='click para aumentar' " +						
						//" onClick=\"parent.cambiaImagenEniFrameContenido('pic"+picnumx+".JPG')\" " +
						//" onClick=\"parent.frames[0].cambiarImg('pic"+picnumx+".JPG')\" " +
						" onClick=\"javascript:Abrir_Fiestra('galimaxes/pic"+picnumx+".jpg')\" " +
						" onMouseover='slowhigh(this)' onMouseout='slowlow(this)' " +
						" class='gradualshine' >");		
		document.write("</td>");
	}	
		document.write("</tr>");
        
		document.write("</table></div></div>");
        document.write("<style type='text/css'>");
		
		document.write(".gradualshine{ " +
						"filter:alpha(opacity=30); " +
						"opacity:0.3; " +
						"}");
        document.write("#divDown{position:absolute; left:"+leftDivDown+"; top:"+topDivDown+";}");
        document.write("#divUp{position:absolute; left:"+leftDivUp+"; top:"+topDivUp+";}");
        //document.write("#divCont{position:absolute; width:"+page.x2+"; height:"+layhei+"; overflow:hidden; top:"+conheipos+"; left:0; clip:rect(0,"+page.x2+","+layhei+",0); visibility:hidden;}");		
		document.write("#divCont{position:absolute; width:"+widthDivCont+"; height:"+heightDivCont+"; overflow:hidden; top:"+topDivCont+"; left:"+leftDivCont+"; clip:rect(0,"+page.x2+","+layhei+",0); visibility:hidden;}");
        document.write("#divText{position:absolute; top:0; left:0;}");
		document.writeln("</style>");

        window.onresize=resized;
}
function domoz(){
	for(i = 0; i <=12; i++) {
	picnumx = i;
	if (picnumx<10) {picnumx = "0"+i;};
	id="pic"+picnumx;
	document.getElementById(id).style.MozOpacity='0.3';}
}
/************************************************************************/
/********************************************************************************
Copyright (C) 1999 Thomas Brattli
This script is made by and copyrighted to Thomas Brattli at www.bratta.com
Visit for more great scripts. This may be used freely as long as this msg is intact!
I will also appriciate any links you could give me.
********************************************************************************/
//Default browsercheck, added to all scripts!
function checkBrowser(){
	this.ver=navigator.appVersion
	this.dom=document.getElementById?1:0
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0;
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;	
	this.ie4=(document.all && !this.dom)?1:0;
	this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns5)
	return this
}
bw=new checkBrowser()
/********************************************************************************
Here's the pageobject, see www.bratta.com/dhtml for tutorial on how it works.
********************************************************************************/
function makePageObject(){
	this.x=0;
	this.x2=(bw.ns4 || bw.ns5)?innerWidth:document.body.offsetWidth-4;
	this.y=0;
	this.y2=(bw.ns4 || bw.ns5)?innerHeight:document.body.offsetHeight-4;
	this.x50=this.x2/2;
	this.y50=this.y2/2;
	this.x10=(this.x2*10)/100
	this.y10=(this.y2*10)/100
	this.x15=(this.x2*15)/100
	this.y15=(this.y2*15)/100
	return this;
}
function resized(){
	page2=new makePageObject()
	if(page2.x2!=page.x2 || page2.y2!=page.y2){
		location.reload() //If the width or height have changed we reload the page.
	}
}

function myStyle(){
	page=new makePageObject()
	siz=page.x2/115 + page.y2/115
	zwischenraum=page.x2/200;
	
	col01 = '#c0c0c0';
	col02 = '#223333';
	col03 = '#556666'; //col03 = '#333333'; col03 = '#445555'; 
	col04 = '#900000';
	col05 = '#00cc99';
	col06 = '#505050';
	col07 = '#202020';
	col08 = '#404040';	
	col09 = '#292929';		
	
col01 = '#ffffff';
	col02 = '#ffffff';
	col03 = '#ffffff'; //col03 = '#333333'; col03 = '#445555';  //bgcolor
	col04 = '#ffffff';
	col05 = '#ffffff';
	col06 = '#ffffff';
	col07 = '#ffffff';
	col08 = '#ffffff';	
	col09 = '#ffffff';
        document.write("<style type='text/css'>");
		
		
		
        document.write("a:active { text-decoration:none; color:"+col01+"; }");
        document.write("a:hover { text-decoration:none; color:"+col01+"; }");
        //document.write("a:link { text-decoration:none; color:"+col01+"; }");
        //document.write("a:visited { text-decoration:none; color:"+col01+"; }");
        document.write(".bodyg { background-color:"+col02+"; margin-left:0; margin-right:0; margin-top:0; margin-bottom:0;width:100%;height:100%;overflow:hidden;}");
        document.write(".bodyb { background: url(../imaxes/fondogal.gif) no-repeat;  background-color:"+col03+"; margin-left:0; margin-right:0; margin-top:0; margin-bottom:0;width:100%;height:100%;overflow:hidden;}");
        document.write("font { font-family:Verdana,Arial,sans-serif; }");
        document.write(".fon01 { color:"+col01+"; font-weight:700; font-size:"+siz+"px; }");
        document.write(".fon02 { color:"+col01+"; font-weight:500; font-size:"+siz+"px; }");
        document.write(".fon03 { color:"+col01+"; font-weight:700; font-size:"+siz*1.2+"px; }");
        document.write(".fon04 { color:"+col01+"; font-weight:700; font-size:"+siz*1.5+"px; }");
        document.write(".fon05 { color:"+col04+"; font-weight:700; font-size:"+siz+"px; }");
        document.write(".fon06 { color:"+col04+"; font-weight:700; font-size:"+siz*1.2+"px; }");
        document.write(".fon07 { color:"+col04+"; font-weight:700; font-size:"+siz*2+"px; }");
        document.write(".fon08 { color:"+col04+"; font-weight:700; font-size:"+siz*2.5+"px; }");
        document.write(".fon09 { color:"+col04+"; font-weight:500; font-size:"+siz*.9+"px; }");
        document.write(".fon10 { color:"+col04+"; font-weight:900; font-size:"+siz+"px; }");
        document.write(".fon11 { color:"+col05+"; font-weight:700; font-size:"+siz+"px; visibility:hidden; }");
        document.write(".fon12 { color:"+col05+"; font-weight:700; font-size:"+siz+"px; }");
        document.write(".fon13 { color:"+col02+"; font-weight:500; font-size:"+siz*.1+"px; }");
        document.write(".fon14 { color:"+col03+"; font-weight:500; font-size:"+siz*.9+"px; }");        
        document.write(".fon15 { color:"+col02+"; font-weight:500; font-size:"+siz*.9+"px; }");
        document.write(".fon16 { color:"+col01+"; font-weight:700; font-size:"+page.x2/10+"px; }");
        document.write(".tab01 { border:0px; }");
	document.write(".tab02 { background-color:"+col03+"; border-style:solid; border-width:1px; border-top-color:"+col06+"; border-bottom-color:"+col07+"; border-left-color:"+col06+"; border-right-color:"+col07+"; }");        
        document.write(".tab03 { border:0px; background-color:"+col02+";  padding:0;}");
        document.write(".tab04 { border:1px;}");
	document.write(".tab05 { background-color:"+col02+"; border-style:none; border-width:'"+page.x2/50+"px'; border-color='"+col02+"'; }");              
        document.write(".cel01 { background-color:"+col02+"; border-style:solid; border-width:1px; border-top-color:"+col08+"; border-bottom-color:"+col09+"; border-left-color:"+col08+"; border-right-color:"+col09+"; cursor:default; }");
        document.write(".cel02 { background-color:"+col02+"; border-style:solid; border-width:1px; border-top-color:"+col07+"; border-bottom-color:"+col06+"; border-left-color:"+col06+"; border-right-color:"+col07+"; cursor:hand; }");
        document.write(".cel03 { padding-top:0px; padding-bottom:"+zwischenraum+"px; padding-left:0px; padding-right:"+zwischenraum+"px; }");
        document.write(".cel04 { padding-top:0px; padding-bottom:"+zwischenraum+"px; padding-left:"+zwischenraum+"px; padding-right:"+zwischenraum+"px; }");
        document.write(".cel05 { background-color:"+col02+"; border-style:solid; border-width:1px; border-top-color:"+col07+"; border-bottom-color:"+col06+"; border-left-color:"+col07+"; border-right-color:"+col06+"; padding-top:"+siz/2+"px; padding-bottom:"+siz/2+"px; padding-left:"+siz/2+"px; padding-right:"+siz/2+"px; }");
        document.write(".cel06 { background-color:"+col03+"; border-style:none; border-width:1px; border-color:"+col03+"; }");  
       	document.write(".seeon { visibility:visible; }");
       	document.write(".seeof { visibility:hidden; }");
        document.write(".alig01 { text-align:center; vertical-align:top; }");
        document.write(".alig02 { text-align:center; vertical-align:middle; }");
        document.write(".alig03 { text-align:center; vertical-align:bottom; }"); 
        document.write(".horu1 { color:"+col02+"; }"); 	
       	document.write("</style>");
		
        window.onresize=resized;
}