

//***************  PictureScroller  ***************
//
//
//

var numOfRunMoviePictures = 5;
var runMovieSpeed 		  = 4000;
var runMovieLeft 		  = 0;
var runMovieTop 		  = 0;
var runMovieWidth 		  = 560;
var runMovieHeight 		  = 80;
var runMoviePictureHeight = 60;
var runMoviePictureWidth  = 70;
var runMovieBG = '/InetSale/images/runMovie.gif';


function picRec(name, src, ShowID, SiteID, pw, ph, text){
	//preload image
	var newImage = new Image();
	newImage.src = src;

	this.name = name;
	this.src = src;
	this.ShowID = ShowID;
	this.SiteID = SiteID;
	this.pw = pw;
	this.ph = ph;
	this.text;
	return this;
}

function shiftPictures(){
	if (aPic != null){
		var temp = aPic[0];
		for (var i = 1; i < aPic.length; i++){
			aPic[i - 1] = aPic[i];
		}
		aPic[aPic.length - 1] = temp;
	}
}


function changePictures(){
	if (aPic != null){
		for (var i = 0; i < numOfRunMoviePictures; i++){
			getObj('pic' + i).src = aPic[i].src;
			getObj('pic' + i).width = aPic[i].pw;
			getObj('pic' + i).height = aPic[i].ph;
			if (isNS6){
				getObj('picref' + i).href = 'InetSale.ShowInfo?SiteID=' + aPic[i].SiteID + '&ShowID=' + aPic[i].ShowID;
			}
			else {
				getObj('picref' + i).href = 'InetSale.ShowInfo?SiteID=' + aPic[i].SiteID + '&ShowID=' + aPic[i].ShowID;
			}
		}
	}
}


function doChangePictures(){
	if (aPic != null){
		shiftPictures();
		changePictures();
	}
}


function startRunMovie(){
	changeTime = setTimeout("startRunMovie()" , runMovieSpeed);
	doChangePictures();
}


function buildRunMovie(){
	var strPic = new String('');
	strPic += 	'<div id="pictures" style="position: absolute; top: ' + runMovieTop +
				'px; left: ' + runMovieLeft + 'px;">' +
				'<table cellpadding="0" cellspacing="0" border="0"' +
				' width="' + runMovieWidth + '" height="' + runMovieHeight + '>"' +
				/*
				'<tr><td class="mainbg" colspan="' + ((numOfRunMoviePictures * 2) + 1) +'">' +
				'<img src=\"' + TEMPLATE_PATH + 'arrow_right_blue.gif\"> Alle aktiviteter' +
              			'&nbsp;&nbsp;<img src=\"' + TEMPLATE_PATH + 'arrow_right_red.gif\"> Aktuelle aktiviteter' +
              			'&nbsp;&nbsp;<img src=\"' + TEMPLATE_PATH + 'arrow_right_red.gif\"> Kommende aktiviteter' +
				'</td></tr>' +
				*/
				'<tr><td width="' + runMovieWidth + '"' +
				' colspan="' + ((numOfRunMoviePictures * 2) + 1) + '" background="' +
				runMovieBG + '" height="6" style="font-size: 1px;">&nbsp;</td></tr>' +
				'<tr><td bgcolor="#000000" style="font-size: 1px;" width="4">&nbsp;</td>';
			
	for (var i = 0; i < numOfRunMoviePictures; i++){
		strPic += 	'<td align="center" bgcolor="#000000" width="' + runMoviePictureWidth + ' height="' + runMoviePictureHeight + '">' +
					'<a href="#" id="picref' + i + '">' +
					'<img name="pic' + i + '" border="0" src="' + unescape(aPic[i].src) + '"' +
					//' width="' + runMoviePictureWidth + ' height="' + runMoviePictureHeight + '">' +
					' width="' + aPic[i].pw + ' height="' + aPic[i].ph + '">' +
					'</a></td>' +
					'<td bgcolor="#000000" style="font-size: 1px;" width="4">&nbsp;</td>';
	}
	strPic += 	'</tr>' +
				'<tr><td colspan="' + ((numOfRunMoviePictures * 2) + 1) + '" background="' +
				runMovieBG + '" height="6" style="font-size: 1px;">&nbsp;</td></tr>' +
				'</table></div>';
	
	document.open();
	document.write(strPic);
	document.close();
	
}

