// JavaScript Document
  
function scroll_execute(images, banner_width, speed)
{
	// Variables
	var max_height = 75;
	var image_height = 0;
	var image_width = 0;
	var image_location = 0;
	var image_space = 100;
	var last_image_width = image_space;
	
	// Display Images
	for(i=0; i<images.length; i++)
	{
		// Create Temporary Image
		temp_image = new Image();
		temp_image.src = images[i][1];
		
		// Calculate Image Height
		if(temp_image.height > max_height)
		{
			image_height = max_height;
			image_width = (temp_image.width / temp_image.height) * max_height;
		}
		else
		{
			image_height = temp_image.height;
			image_width = temp_image.width;
		}
		
		// Display Image if Width > 0px
		if(image_width > 0)
		{
			// Set Image Position
			image_location += last_image_width;
			images[i][2] = image_location;
			images[i][3] = image_width;
			
			// Display Image
			document.write('<div class="scroll_image" id="img'+i+'" style="left:'+image_location+'px; top:20px; width:'+image_width+'; height:'+image_height+';">');
			document.write('<a href="'+images[i][0]+'" target="_blank">');
			//document.write('position = '+image_location+'; width = '+image_width);
			document.write('<img src="'+images[i][1]+'" width="'+image_width+'" height="'+image_height+'" alt="'+images[i][0]+'" title="'+images[i][0]+'" border="0" />');
			document.write('</a></div>');		
			last_image_width = image_width + image_space;
		}
	}
	imgScroll(images, image_space, banner_width, speed, image_location);
}
 
function imgScroll(images, image_space, banner_width, speed, total_width)
{
	var image_ct = images.length;
	
	for(i=0; i<images.length; i++)
	{
		document.getElementById('img'+i).style.left = images[i][2] + "px";
		images[i][2]--;		
		if(images[i][2] < (-1*(images[i][3]+image_space))+1)
		{
			if(total_width < banner_width)
				images[i][2] = banner_width;
			else
				images[i][2] = total_width - images[i][3];
		}
    }
	scroller=setTimeout(function() {imgScroll(images, image_space, banner_width, speed, total_width)},speed);
}