/* C O N T E N T  -- IMAGE mover! */
/* Ein Script von Pascal Helmes */
/* E-Mail: info@pahe.de */
/* Version: 1.1 */

/* *******  EINSTELLUNGEN  ********************* */
/* Bsp: Bildname = "bildname_1.jpg" */
var bildname = "content_img";

/*	Ladebalken	*/
var speed_2 = 10;

/* Bilder mover */
var speed_1 = 50;
var anzahl = 7;/* Die anzahl von Bilder!*/

/* Blend übergangs*/
var speed_blend = 2;//** ** left & right BAR 
var blend_1 = 10;var blend_2 = 0.10;// blend.FX

/* ************************************************ */      
/*	                    Ladebalken	*/
var size = 0;

function ladebalken(){
size++;
balken.style.width = size + "px";
if (size < 657){window.setTimeout("ladebalken()", speed_2);
	}else{blend_start(); size=0; balken.style.width = size + "px";}
}        

/*	                    Ladebalken	*/
/* ************************************************ */      
/*                       Random */
/* Position */ 
var box_1_top = Math.round((Math.random()*-200)); /* ** ** zufällig  - Horizontal( | )** **/
						 			/*var box_1_top = -100;*/			  /* ** ** zentriert - Horizontal( | )** **/
var box_1_left = Math.round((Math.random()*-250));/* ** ** zufällig  - Vertical  ( - )** **/
									/*var box_1_left = -500;*/    	/* ** ** zentriert - Vertical  ( - )** **/


/* Zufalls Bild */ 
function img_random(){
var nr = Math.round((Math.random()*anzahl));//** ** Für Zufallsbild bei jedem aufruf!** **/
if (nr == 0){img_random();}/* DeBUG.Weil Bild 0 nicht exestiert! */
else{box_1.style.backgroundImage = "url("+bildname+"_"+nr+".jpg)";}
}


/*                       Random */
/* ************************************************ */      
/* ************************************************ */
/*                    Bilder mover */

function img_up(){
box_1_top++;
box_1.style.top = box_1_top + "px";
if (box_1_top < 0)
{window.setTimeout("img_up()", speed_1);}
	else
	{img_down()}
}

function img_down(){
box_1_top--;
box_1.style.top = box_1_top + "px";
if (box_1_top > -200) 
{window.setTimeout("img_down()", speed_1);}
else
{img_up()}
}

function img_left(){
box_1_left++;
box_1.style.left = box_1_left + "px";
if (box_1_left < 0)
{window.setTimeout("img_left()", speed_1);}
	else
	{img_right()}
}

function img_right(){
box_1_left--;
box_1.style.left = box_1_left + "px";         
if (box_1_left > -250)
	{window.setTimeout("img_right()", speed_1);}
	else
	{img_left()}
}
/*                    Bilder mover */
/* ************************************************ */
/* ************************************************ */
/*                  Blend übergangs*/
function blend_start(){
effect_blend_in()
}

function effect_blend_in(){
if (blend_1 != 100 && blend_2 != 1.0)
	{document.blend_effect.style.filter = "alpha(opacity="+blend_1+")";document.blend_effect.style.MozOpacity = blend_2;document.blend_effect.style.opacity = blend_2;
	 blend_1++;
	 blend_2 = blend_2+0.01;
	 window.setTimeout("effect_blend_in()", speed_blend);
	}else{img_random();
				effect_blend_out();				
			 }
}


function effect_blend_out(){
    document.blend_effect.style.filter = "alpha(opacity="+blend_1+")";
		document.blend_effect.style.MozOpacity = blend_2;
		document.blend_effect.style.opacity = blend_2;
		blend_1--;
		blend_2 = blend_2-0.01;
		if (blend_1 != 0 && blend_2 != 0.00){
		window.setTimeout("effect_blend_out()", speed_blend);
		}else{ladebalken();}
		}
/*                  Blend übergangs*/
/* ************************************************ */

