

Effect.MoveSlider = Class.create();
Object.extend(Object.extend(Effect.MoveSlider.prototype, Effect.Base.prototype), {
  initialize: function(element) {
	this.element = $(element);
	if(!this.element) throw(Effect._elementDoesNotExistError);
	var options = Object.extend({
	  offset:    0,
	  move:    0,
	  slider: null
	}, arguments[1] || {});
	this.start(options);
  },
  setup: function() {
	// Bug in Opera: Opera returns the "real" position of a static element or
	// relative element that does not have top/left explicitly set.
	// ==> Always set top and left for position relative elements in your stylesheets 
	// (to 0 if you do not need them) 
	this.element.makePositioned();
  },
  update: function(position) {
	this.options.slider.setValue(this.options.offset + position * this.options.move);
  }
});

Effect.Scroll = Class.create();
Object.extend(Object.extend(Effect.Scroll.prototype, Effect.Base.prototype), {
  initialize: function(element) {
	this.element = $(element);
	if(!this.element) throw(Effect._elementDoesNotExistError);
	var options = Object.extend({
	  x:    0,
	  y:    0,
	  speed: 0.2,
	  mode: 'relative'
	}, arguments[1] || {});
	this.start(options);
  },
  setup: function() {
	// Bug in Opera: Opera returns the "real" position of a static element or
	// relative element that does not have top/left explicitly set.
	// ==> Always set top and left for position relative elements in your stylesheets 
	// (to 0 if you do not need them) 
	this.element.makePositioned();
	this.originalLeft = parseFloat(this.element.scrollLeft || '0');
	this.originalTop  = parseFloat(this.element.scrollTop  || '0');
	if(this.options.mode == 'absolute') {
	  // absolute movement, so we need to calc deltaX and deltaY
	  this.options.x = this.options.x - this.originalLeft;
	  this.options.y = this.options.y - this.originalTop;
	}
  },
  update: function(position) {
	this.element.scrollLeft = this.element.scrollLeft + Math.round(this.options.x * position * (this.element.scrollWidth-this.element.offsetWidth) * this.options.speed);
	this.element.scrollTop = this.element.scrollTop + Math.round(this.options.y * position *(this.element.scrollHeight-this.element.offsetHeight) * this.options.speed);
	
  }
});






IHG.ThreadLocks = function() {
	mediaModuleLayer = false;
}
var IhgThreadLocks = new IHG.ThreadLocks();

IHG.Media = function() {};

IHG.Media.Base = function() {};
IHG.Media.Base.prototype = {
	setOptions: function(options) {
		this.options = {
			fadeDuration:  1,
			fadeFps:		50,
			border:			0
		}
		Object.extend(this.options, options || {});
		
	}
}

/********************************************************

var mediaMod = new IHG.Media.Module( "mediaMod" );

var mediaLayer = new IHG.Media.Module.Layer();

mediaLayer.addImage( "mainImage.jpg", "thumImage.jpg", "lorum ipsum" );

mediaMod.add( mediaLayer );

*********************************************************/




function renderVTHtml( vtUrl, waitImg ) {
	var vtHtml = "";

if ( vtUrl.toLowerCase().indexOf(".mov") > -1 ) {
	vtHtml += " <embed alt=\"Virtual Tour\" SRC=\"" + vtUrl + "?rnd=" + 100*Math.random() + " \" WIDTH=\"408\" HEIGHT=\"268\" AUTOPLAY=\"true\" BGCOLOR=\"000000\" SHOWLOGO=\"false\" CONTROLLER=\"false\" PLUGINSPAGE=\"http://www.apple.com/quicktime/download/\" scale=\"tofit\" name=\"qttour\"></embed>"
}
else {
	var prodHost = location.protocol + "//";
	if ( prodHost.toLowerCase().indexOf("https") > -1 )
	{
		prodHost += "secure.ichotelsgroup.com";
	}
	else {
		prodHost += "www.ichotelsgroup.com";
	}

	vtHtml += " <APPLET name=ptviewer codebase=\"" + prodHost + "/hotelmedia/repository/applet/ihg/\"  archive=\"ptviewer_ihg142.jar\"  code=ptviewer.class width=408 height=268 mayscript=true>         ";
	vtHtml += " <param name=\"auto\" value=\"0.10\">                     ";
	vtHtml += " <param name=\"barcolor\" value=\"000000\">                 ";
	vtHtml += " <param name=\"quality\" value=\"3\">                 ";
	vtHtml += " <param name=\"maxspeed\" value=\"10\">                 ";
	vtHtml += " <param name=\"bgcolor\" value=\"000000\">                 ";
	vtHtml += " <param name=\"file\" value=\"ptviewer:0\">    ";

	if( waitImg.length > 0 ) {
		vtHtml += " <PARAM name=wait		value=\"" + waitImg + "\"> ";
	}

	vtHtml += " <PARAM name=pano0  value=\"{file=" + vtUrl + "} {auto=0.10}\">		 ";

	//for (var i = 0; i < vtUrls.size() ; i++ )
	//{
	//	vtHtml += " <PARAM name=pano" + i + "		value=\"{file=" + vtUrls[i] + "} {auto=0.10}\">		 ";
	//}

	vtHtml += " </APPLET> ";
}

return vtHtml;
}


function getMediaModuleHtml( modId ) {
	var moduleHtml = "";
	moduleHtml += "                  <div id='MediaContainer'>     ";
	moduleHtml += "                  <div id='disp0'></div>     ";
	moduleHtml += "                  <div id='disp1'></div>     ";
	moduleHtml += "                  <div id='dispTextContainer'>                                                                  ";
	moduleHtml += "                      <div id='dispText'></div>                                     ";
	moduleHtml += "                  </div>                                                                                        ";
	moduleHtml += "                  <div id='nav'>                                                                                ";
	moduleHtml += "                    <div id='thumbs'></div>                ";
	moduleHtml += "                    <div id='scroller'>                                                                         ";
	moduleHtml += "                      <table cellpadding='0' cellspacing='0'><tr><td>                                                                           ";
	moduleHtml += "                      <div id='sliderLeft'><a href='#' onClick=\"" + modId + ".moveScroller('-1','handle'," + modId + ".slider);return false;\"><img alt=\"\" border=\"0\" src=\" " + imagePrefix + "/cq/etc/media_library/branded/" + brandId + "/images/icons.Par.0019.Image.gif\"/></a></div>                            ";
	moduleHtml += "                      </td><td>                                                                                 ";
	moduleHtml += "                      <div id='slider'>                                                                         ";
	moduleHtml += "                        <div id='handle'><img alt=\"\" src=\" " + imagePrefix + "/cq/etc/media_library/branded/" + brandId + "/images/icons.Par.0021.Image.gif\"/></div>                          ";
	moduleHtml += "                      </div>  								";
	moduleHtml += " 			<div id='sliderbg'><img alt=\"\" src=\" " + imagePrefix + "/cq/etc/media_library/cn/0/cn/misc.Par.0014.Image.gif\"/></div> 					";                                                                                 
	moduleHtml += "                      </td><td>                                                                                 ";
	moduleHtml += "                      <div id='sliderRight'><a href='#' onClick=\"" + modId + ".moveScroller('1','handle'," + modId + ".slider);return false;\"><img alt=\"\" border=\"0\" src=\" " + imagePrefix + "/cq/etc/media_library/branded/" + brandId + "/images/icons.Par.0020.Image.gif\"/></a></div>                          ";
	moduleHtml += "                      </td></tr></table>                                                                        ";
	moduleHtml += "                    </div>                                                                                      ";
	moduleHtml += "                  </div>                                                                                        ";
	moduleHtml += "                  <div id='formats'><div id='dividerBar'></div><div id='buttons'></div></div> ";
	moduleHtml += "                  </div><div id='MediaContainerShadow'></div>                     ";
	return moduleHtml;
}

function getCssHtml () {
	cssHTML = "";
	cssHTML += "<style>";

	cssHTML += "</style>";
	return cssHTML;
}

IHG.Media.Module = Class.create();
Object.extend(Object.extend(IHG.Media.Module.prototype, IHG.Media.Base.prototype), {
	initialize: function(name,container,options) {
		this.setOptions(options);
		this.layers = new Array();
		this.currLayer = 0;
		this.name = name;
		this.container = container;
		this.slider = null;
		this.sliderVal = 0;
		this.render();
	},
	add: function( layer ) {
		layer.setModule( this );
		this.layers.push( layer );
		if ( this.layers.size() == 1 )
		{
			this.changeLayer(0);
		}
		else {
			$("buttons").innerHTML += "<a href='#' onclick='" + this.name + ".changeLayer(" + (this.layers.size()-1) + ");return false;'><img alt=\"\" style=\"margin-bottom: 10px;\" id=\"photoButton\" src=\"" + this.layers[this.layers.size()-1].getButtonOff() + "\"/></a><br>";
		}
	},
	show: function( id ) {
		this.layers[ this.currLayer ].show( id );
	},
	changeLayer: function( id ) {
		$("scroller").show();
		//preform the change layer function
		this.layers[ id ].render();
		this.currLayer = id;
		var newButtonHtml = "";
		for (var i = 0; i< this.layers.size(); i++ )
		{
			if ( i == this.currLayer ) {
				newButtonHtml += "<a href='#' onclick='" + this.name + ".changeLayer(" + i + ");return false;'><img alt=\"\" style=\"margin-bottom: 10px;\" id=\"photoButton\" src=\"" + this.layers[i].getButtonOn() + "\"/></a>";
			}
			else {
				newButtonHtml += "<a href='#' onclick='" + this.name + ".changeLayer(" + i + ");return false;'><img alt=\"\" style=\"margin-bottom: 10px;\" id=\"photoButton\" src=\"" + this.layers[i].getButtonOff() + "\"/></a>";
			}
		}
		$("buttons").innerHTML = newButtonHtml;
		var sliderScale = Math.floor(this.layers[this.currLayer].items.size() / 4);
		
		//due to IE, this cant be 0.
		if ( sliderScale == 0 ) {
			sliderScale = 1;
		}

		this.slider = new Control.Slider('handle', 'slider', {
			range: $R(0,sliderScale),
			onSlide: function(v) { eval(this.moduleName).moveDiv( v/sliderScale, 0, "thumbs"); eval(this.moduleName).sliderVal = v; },
			onChange: function(v) { eval(this.moduleName).moveDiv( v/sliderScale, 0, "thumbs"); eval(this.moduleName).sliderVal = v; },
			moduleName: this.name
		});
	},
	render: function() {
		document.write( getCssHtml() );
		$(this.container).innerHTML = getMediaModuleHtml( this.name );
		$("buttons").innerHTML ="";
		
		this.slider = new Control.Slider('handle', 'slider', {
			range: $R(0,4),
			onSlide: function(v) { eval(this.moduleName).moveDiv( v/4, 0, "thumbs"); eval(this.moduleName).sliderVal = v; },
			onChange: function(v) { eval(this.moduleName).moveDiv( v/4, 0, "thumbs"); eval(this.moduleName).sliderVal = v; },
			moduleName: this.name
		});
	},
	moveScroller: function( pSize, pObj ) {
		new Effect.MoveSlider (pObj,{ offset: this.sliderVal, move: pSize , slider: this.slider });
	},
	moveDiv: function( pX, pY, pObj ) {
		var element = $(pObj);
		element.scrollLeft = Math.round(pX*(element.scrollWidth-element.offsetWidth));
	}
});


IHG.Media.Module.VT = Class.create();
Object.extend(Object.extend(IHG.Media.Module.VT.prototype, IHG.Media.Base.prototype), {
	initialize: function( pano, name, thumb,caption, options ) {
		this.setOptions(options);
		this.pano = pano;
		this.thumb = thumb;
		this.name = name;
		this.caption=caption;
	},
	getPano: function() {
		return this.pano;
	},
	setPano: function( pano ) {
		this.pano = pano;
	},
	getThumb: function() {
		return this.thumb;
	},
	setThumb: function( thumb ) {
		this.thumb = thumb;
	},
	getName: function() {
		return this.name;
	},
	setName: function( name ) {
		this.name = name;
	},
	getCaption: function() {
		return this.caption;
	},
	setCaption: function(caption ) {
		this.caption = caption;
	}

});

IHG.Media.Module.VTCateory = Class.create();
Object.extend(Object.extend(IHG.Media.Module.VTCateory.prototype, IHG.Media.Base.prototype), {
	initialize: function(category, options) {
		this.category = category;
		this.items = new Array();
	},
	addItem: function( item ) {
		this.items.push( item );
	},
	getItem: function( id ) {
		return this.items[id];
	},
	getCategory: function() {
		return this.category;
	},
	getSize: function() {
		return this.items.size();
	}
});



IHG.Media.Module.VTLayer = Class.create();
Object.extend(Object.extend(IHG.Media.Module.VTLayer.prototype, IHG.Media.Base.prototype), {
	initialize: function(hotelCode, options) {
		this.hotelCode = hotelCode;
		this.setOptions(options);
		this.items = new Array();
		//this.currDisp = 0;
		this.module = null;
		this.threadLocked = false;
		this.imgOn = null;
		this.imgOff = null;
		this.currItem = 0;
		this.waitImg = "";
		this.vtUrls = new Array();
		this.thumbUrls = new Array();
		this.captions =  new Array();
	},
	setModule: function( module ) {
		this.module = module;
	},
	render: function() {
		$("disp0").show();
		$("disp1").hide();
		//TD#69421 PROD - IC Media Module Virtual Tours to show captions
		$("dispTextContainer").show();
		//Add Coremetrics Element tag to show VT Button was clicked.
		cmCreatePageElementTag(this.hotelCode+"-VTButton","ICMediaModule-MeetingEventsPg-VT");
		var showDropDown = "true";
		for (var i = 0; i< this.items.size() ; i++ ) {
			var xyz = this.module.name;
			var zyz = this.module;
			var category = this.items[i];
			for (var j = 0; (j < category.getSize()  ); j++ ) {
				var hasThumbNail = category.getItem(j).getThumb();				
				if (hasThumbNail != null && hasThumbNail != "") {
				   showDropDown = "false";
				   this.thumbUrls.push( category.getItem(j).getThumb() );
				}
			}
		}
		var thumbDiv = "";
		var panoIndex = 0;
		for (var i = 0; (i < this.items.size() ); i++ ) {
			var category = this.items[i];
			if (showDropDown == "true") {
				var coremetricsHTML = "";
				if (this.hotelCode) {
					coremetricsHTML = "createCMTag(value,\""+this.hotelCode+"\");";
				}
				thumbDiv += "<b>" + category.getCategory() + "</b><br /><form name='drop'><select name='rooms' onchange='" + this.module.name + ".show(value);"+coremetricsHTML+"return false;'>";
				//thumbDiv += "<b>" + category.getCategory() + "</b><br /><form><select onchange='" + this.module.name + ".show(value);";
			}
			for (var k = 0; (k < category.getSize() ); k++ ) {
				this.vtUrls.push( category.getItem(k).getPano() );
				//TD#69421 PROD - IC Media Module Virtual Tours to show captions
				var hasCaption = category.getItem(k).getCaption();
				if(hasCaption == null)
				{
					this.captions.push("");
				}
				else{
					this.captions.push(category.getItem(k).getCaption());
				}
				if (showDropDown == "false") {
					var coremetricsHTML = "";
					if (this.hotelCode) {
						coremetricsHTML = "cmCreatePageElementTag(\""+ this.hotelCode +"-thumbnail-"+panoIndex+"\",\"ICMediaModule-MeetingEventsPg-VT\");";
					}
					thumbDiv += "<a href='#' onclick='" + this.module.name + ".show(" + panoIndex + ");"+coremetricsHTML+"return false;'><img border='0' style='margin-right: 6px;' src='" + category.getItem(k).getThumb()  + "'/></a><!--" + this.module + "-->";				
				} else {
					thumbDiv += "<option value='" + panoIndex + "'>" + category.getItem(k).getName() + "</a></option>";
				}
				panoIndex++;
			}
			if (showDropDown == "true") {
				thumbDiv += "</select></form>";
			}
		}
		$("disp0").innerHTML = renderVTHtml( this.vtUrls[0], this.waitImg );
		$("thumbs").innerHTML = thumbDiv;
		$("dispText").innerHTML = this.captions[0];
		if ( this.thumbUrls.size() < 5 ) {
			$("scroller").hide();
		}
	},
	addCategory: function( item ) {
		this.items.push( item );
	},
	show: function( id ) {
		$("dispText").innerHTML = this.captions[id];
		$("disp0").innerHTML = renderVTHtml( this.vtUrls[id], this.waitImg );
		//document.ptviewer.newPanoFromList( id );
	},
	setWait: function( url ) {
		this.waitUrl = url;
	},
	addButton: function( onState, offState ) {
		this.imgOn = onState;
		this.imgOff = offState;
	},
	getButtonOn: function() {
		return this.imgOn;
	},
	getButtonOff: function() {
		return this.imgOff;
	}
	
});

IHG.Media.Module.Layer = Class.create();
Object.extend(Object.extend(IHG.Media.Module.Layer.prototype, IHG.Media.Base.prototype), {
	initialize: function(options) {
		this.setOptions(options);
		this.items = new Array();
		this.currDisp = 0;
		this.module = null;
		this.threadLocked = false;
		this.imgOn = null;
		this.imgOff = null;
		this.currImage = 0;
	},
	add: function( item ) {
		this.items.push( item );
	},
	addImage: function( img, thumb, caption, options ) {
		this.items.push( new IHG.Media.Module.Img( img, thumb, caption, options) );
	},
	addButton: function( onState, offState ) {
		this.imgOn = onState;
		this.imgOff = offState;
	},
	getButtonOn: function() {
		return this.imgOn;
	},
	getButtonOff: function() {
		return this.imgOff;
	},
	nextItem: function() {
		//this.currItem = ( (this.currItem + 1) % this.items.size );
	},
	prevItem: function() {
		//this.currItem = ( (this.currItem + (this.currItem.size - 1)) % this.items.size );
	},
	show: function( id ) {
		if( IhgThreadLocks.mediaModuleLayer || ( this.currImage == id) ) {
			return;
		}
		IhgThreadLocks.mediaModuleLayer = true;
		//preform transition to item number 'id'
		var nextDisp = this.nextId();

		var image = "<img id='image" + id + "' src='" + this.items[id].img + "'/>";
		var cap = this.items[id].caption;

		//update text and img module
		$("disp" + nextDisp).innerHTML = "<img id='image" + id + "' src='" + this.items[id].img + "'/>";
		$("dispText").innerHTML = this.items[id].caption;

		//make image visible (should be behind)
		$("disp" + nextDisp).show();
			
		//fade out old image
		new Effect.Fade('disp' + this.currDisp, { 
		  duration: 1, 
		  fps: 50,
		  afterFinish: this.fadeFinished,
		  currDisp: nextDisp,
		  prevDisp: this.currDisp
		});

		this.currDisp = nextDisp;
		this.currImage = id;
	
	},
	fadeFinished: function() {
		$("disp" + this.currDisp ).style.zIndex = "1";
		$("disp" + this.prevDisp ).style.zIndex = "0";

		$("disp" + this.prevDisp ).show();
		IhgThreadLocks.mediaModuleLayer = false;
	},
	setModule: function( id ) {
		this.module = id;
	},
	nextId: function() {
		return ((this.currDisp + 1) % 2);
	},
	prevId: function() {
		return ((this.currDisp - 1) % 2);
	},
	lock: function() {
		this.threadLocked = true;
	},
	unlock: function() {
		this.threadLocked = false;
	},
	isLocked: function() {
		return this.threadLocked;
	},
	render: function() {
		$("dispTextContainer").show();
		$("thumbs").innerHTML = "";
		for (var i = 0; i< this.items.size() ; i++ ) {
			$("thumbs").innerHTML += "<a href='#' onclick='" + this.module.name + ".show(" + i + ");return false;'><img border='0' style='margin-right: 6px;' src='" + this.items[i].thumb + "'/></a><!--" + this.module + "-->";
		}
		for (var i = 0; (i < this.items.size()) && (i < 2) ; i++ ) {
			$("disp" + i).innerHTML = "<img id='image" + i + "' src='" + this.items[i].img + "'/>";
		}
		if ( this.items.size() > 0) {
			$("dispText").innerHTML = this.items[0].caption;
		}

		if ( this.items.size() < 5 ) {
			$("scroller").hide();
		}

		$("disp0").style.zIndex = "1";
		$("disp1").style.zIndex = "0";
	}
	
});


IHG.Media.Module.Img = Class.create();
Object.extend(Object.extend(IHG.Media.Module.Img.prototype, IHG.Media.Base.prototype), {
	initialize: function( img, thumb, caption, options ) {
		this.setOptions(options);
		this.thumb = thumb;
		this.img = img;
		this.caption = caption;
	},
	renderMain: function( ) {
		return "<img border=\"" + this.options.border + "\" src=\"" + this.img + "\" />";
	},
	renderThumb: function( ) {
		return "<a onclick=" + name + ".show(" + i + ")'><img border=\"" + this.options.border + "\" src=\"" + this.thumb + "\" />";
	},
	getMain: function() {
		return this.img;
	},
	setMain: function( img ) {
		this.img = img;
	},
	getThumb: function() {
		return this.thumb;
	},
	setThumb: function( thumb ) {
		this.thumb = thumb;
	},
	getCaption: function() {
		return this.caption;
	},
	setCaption: function( caption ) {
		this.caption = caption;
	}
});


/**MEDIA MODULE VIDEO STARTS
*/
// Td# 69420 IC Meetings & Events Media Module Image Viewer
function renderVideo(vdtUrl, insetUrl) {
	var fo;
	fo = new FlashObject("http://images3.ichotelsgroup.com/cq/etc/media_library/branded/ic/flash.Par.0008.File.tmp/mediaplayer.swf", "index", "408", "306", "8", "");	
	if(typeof insetUrl == undefined || insetUrl==null){
	fo.addVariable("imageURL", "");
        fo.addParam("wmode","opaque"); 
	}else {
        fo.addVariable("imageURL", insetUrl);
	fo.addParam("wmode","transparent");
	}
	fo.addVariable("videoURL", vdtUrl);
	fo.addVariable("autoPlayvideo", "off");
	fo.addParam("scale", "noscale");
	fo.addParam("allowScriptAccess", "always");
	fo.write("disp0");

}
// Td# 69420 IC Meetings & Events Media Module Image Viewer
function createCMTag(value,hotelCode) {
	cmCreatePageElementTag(hotelCode+"-dropdown-"+value,"ICMediaModule-MeetingEventsPg-VT");
}

// Td# 69420 IC Meetings & Events Media Module Image Viewer
IHG.Media.Module.VDT = Class.create();
Object.extend(Object.extend(IHG.Media.Module.VDT.prototype, IHG.Media.Base.prototype), {
	initialize: function( pano, name, thumb, inset, options ) {
		this.setOptions(options);
		this.pano = pano;
		this.thumb = thumb;
		this.name = name;
		this.inset = inset;
	},
	getPano: function() {
		return this.pano;
	},
	setPano: function( pano ) {
		this.pano = pano;
	},
	getThumb: function() {
		return this.thumb;
	},
	setThumb: function( thumb ) {
		this.thumb = thumb;
	},
	getName: function() {
		return this.name;
	},
	setName: function( name ) {
		this.name = name;
	},

	getInset: function() {
		return this.inset;
	},
	setInset: function( inset ) {
		this.inset = inset;
	}

});

IHG.Media.Module.VDTCateory = Class.create();
Object.extend(Object.extend(IHG.Media.Module.VDTCateory.prototype, IHG.Media.Base.prototype), {
	initialize: function(category, options) {
		this.category = category;
		this.items = new Array();
	},
	addItem: function( item ) {
		this.items.push( item );
	},
	getItem: function( id ) {
		return this.items[id];
	},
	getCategory: function() {
		return this.category;
	},
	getSize: function() {
		return this.items.size();
	}
});

IHG.Media.Module.VDTLayer = Class.create();
Object.extend(Object.extend(IHG.Media.Module.VDTLayer.prototype, IHG.Media.Base.prototype), {
	initialize: function(options) {
		this.setOptions(options);
		this.items = new Array();
		this.module = null;
		this.threadLocked = false;
		this.imgOn = null;
		this.imgOff = null;
		this.currItem = 0;
		this.waitImg = "";
		this.vdtUrls = new Array();
		this.thumbUrls = new Array();
		this.insetUrls= new Array();
	},
	setModule: function( module ) {
		this.module = module;
	},
	render: function() {
		$("disp0").show();
		$("disp1").hide();
		$("dispTextContainer").hide();
		var showDropDown = "true";
		for (var i = 0; i< this.items.size() ; i++ ) {
			var xyz = this.module.name;
			var zyz = this.module;
			var category = this.items[i];
			for (var j = 0; (j < category.getSize()  ); j++ ) {
				var hasThumbNail = category.getItem(j).getThumb();				
				if (hasThumbNail != null && hasThumbNail != "") {
				   showDropDown = "false";
				   this.thumbUrls.push( category.getItem(j).getThumb() );
				}
			}
		}
		var thumbDiv = "";
		var panoIndex = 0;
		for (var i = 0; (i < this.items.size() ); i++ ) {
			var category = this.items[i];
			if (showDropDown == "true") {
				thumbDiv += "<b>" + category.getCategory() + "</b><br /><form><select onchange='" + this.module.name + ".show(value);return false;'>";
			}
			for (var k = 0; (k < category.getSize() ); k++ ) {
				this.vdtUrls.push( category.getItem(k).getPano() );
				this.insetUrls.push(category.getItem(k).getInset());
				if (showDropDown == "false") {
					thumbDiv += "<a href='#' onclick='" + this.module.name + ".show(" + panoIndex + ");return false;'><img border='0' style='margin-right: 6px;' src='" + category.getItem(k).getThumb()  + "'/></a><!--" + this.module + "-->";				
				} else {
					thumbDiv += "<option value='" + panoIndex + "'>" + category.getItem(k).getName() + "</a></option>";
				}
				panoIndex++;
			}
			if (showDropDown == "true") {
				thumbDiv += "</select></form>";
			}
		}
		renderVideo(this.vdtUrls[0],this.insetUrls[0]);
		$("thumbs").innerHTML = thumbDiv;
		if ( this.thumbUrls.size() < 5 ) {
			$("scroller").hide();
		}
	},
	addCategory: function( item ) {
		this.items.push( item );
	},
	show: function( id ) {
		renderVideo(this.vdtUrls[id],this.insetUrls[id]);
		//document.ptviewer.newPanoFromList( id );
	},
	setWait: function( url ) {
		this.waitUrl = url;
	},
	addButton: function( onState, offState ) {
		this.imgOn = onState;
		this.imgOff = offState;
	},
	getButtonOn: function() {
		return this.imgOn;
	},
	getButtonOff: function() {
		return this.imgOff;
	}
	
});

/**MEDIA MODULE VIDEO ENDS
*/
