if(typeof epoch == "undefined"){
	
var riVars = "";
var myDate = new Date;
var unixTimeStamp = myDate.getTime();
var epoch = "&epoch="+unixTimeStamp;

function riTestFlash(version){
	
	if (navigator.userAgent.indexOf("MSIE") != -1 && navigator.appVersion.indexOf("Win") != -1) { 
		document.write('<script type="text/vbscript">');
		document.write('on error resume next \n');
		document.write('flashCan'+version+' = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.'+version+'")))\n');
		document.write('If flashCan'+version+' = True Then \n');
		document.write('canPlay = true \n');
		document.write('Else \n');
		document.write('canPlay = false \n');
		document.write('End If');
		document.write('</script>');
		var flashCanPlay = canPlay;
	}else{
		flash = navigator.plugins["Shockwave Flash"];
		if(flash){
			words = flash.description.split(" ");
			if(Number(words[2]) >= version){
				var flashCanPlay = true;
			}else{
				var flashCanPlay = false;
			}
		}else{
			var flashCanPlay = false;
		}
	}
	return flashCanPlay;
}

var overAllTest = riTestFlash(8);


function putSWF(file,width,height,playerVersion,altMode,altContent,flashVars,cssID,wmode,bgColour,autoFull){
	var isMVPVideo = false;
	var isMVPPhoto = false;
	var isMVPPano = false;
	var isMVPVideoRP = false;
	var isMVPPlaylist = false;
	var isMVPDynamic = false;
	var isMVPTabbedPlayer = false;
	
	
	flashVars += "&stageWidth="+width;
	flashVars += "&stageHeight="+height;
	flashVars += "&autoFull="+autoFull;
	
	var flashVarsSplit_array = flashVars.split("&");
	
	var lngth = flashVarsSplit_array.length;
	for(i = 0; i < lngth; i ++){
		if(flashVarsSplit_array[i].indexOf("tabID=") != -1){
			isMVPTabbedPlayer = true;
			var ipSplit = flashVarsSplit_array[i].split("=");
			var ipTabID = ipSplit[1];
		}else if(flashVarsSplit_array[i].indexOf("videoID=") != -1){
			var ipSplit = flashVarsSplit_array[i].split("=");
			var ipVideoID = ipSplit[1];
		}else if(flashVarsSplit_array[i].indexOf("clientID=") != -1){
			var ipSplit = flashVarsSplit_array[i].split("=");
			var ipClientID = ipSplit[1];
		}else if(flashVarsSplit_array[i].indexOf("prefix=") != -1){
			var ipSplit = flashVarsSplit_array[i].split("=");
			var ipPrefix = ipSplit[1];
		}else if(flashVarsSplit_array[i].indexOf("subCat=") != -1){
			var ipSplit = flashVarsSplit_array[i].split("=");
			var ipSubCat = ipSplit[1];
		}else if(flashVarsSplit_array[i].indexOf("dpID=") != -1){//dynamic playlist
			var ipSplit = flashVarsSplit_array[i].split("=");
			var ipDpID = ipSplit[1];
		}else if(flashVarsSplit_array[i].indexOf("tabID=") != -1){//tabbed menu of playlists
			var ipSplit = flashVarsSplit_array[i].split("=");
			var ipTabID = ipSplit[1];
		}else if(flashVarsSplit_array[i].indexOf("photoID=") != -1){
			var ipSplit = flashVarsSplit_array[i].split("=");
			var ipPhoto = ipSplit[1];
			isMVPPhoto = true;
		}else if(flashVarsSplit_array[i].indexOf("panoID=") != -1){
			var ipSplit = flashVarsSplit_array[i].split("=");
			var ipPano = ipSplit[1];
			isMVPPano = true;
		}
	}
	
	if(file.indexOf("playlist") != -1 || file.indexOf("mini_browser") != -1){
		isMVPPlaylist = true;
	}
	
	if(autoFull == "autoFull"){
		width = "100%";
		height = "100%";
	}
	
	if(flashVars.indexOf("videoID=") != -1 && flashVars.indexOf("clientID=") != -1 && flashVars.indexOf("prefix=") != -1){
		isMVPVideo = true;
	}else if(flashVars.indexOf("subCat=") != -1 && (flashVars.indexOf("clientID=") != -1 || file.indexOf("PageLink") != -1) && flashVars.indexOf("prefix=") != -1){
		isMVPVideoRP = true;
	}else if(flashVars.indexOf("dpID=") != -1){
		isMVPDynamic = true;
	}
	
	if(isMVPDynamic){
		ipSubCat = "null";
	}else{
		ipDpID = "null";
	}
	
	var smartPhone = isSmartPhone();
	
	if(smartPhone && (isMVPTabbedPlayer) && altMode != "html"){
		
		if(file.indexOf("tabs.swf") == -1){//dont' show the tabs swf area, just the playlist area
		
			document.write('<div id='+cssID+' style="text-align: center;"></div>');
			var url = ipPrefix+'mvp/getSubCatType.php?width='+width+'&tabID='+ipTabID+'&prefix='+ipPrefix+'&clientID='+ipClientID+'&cssID='+cssID+'&playlist=tabs&subCat=null';// URL of the external script

			// this shows dynamic script insertion
			var script = document.createElement('script');
			script.setAttribute('src', url);

			// load the script
			document.getElementsByTagName('head')[0].appendChild(script);
			
		}
	}else if(smartPhone && isMVPVideo && altMode != "html"){//test for iPhone video
		document.write('<div id='+cssID+'>');
		document.write('<a href="'+ipPrefix+'mvp/showVideo.m4v?clientID='+ipClientID+'&videoID='+ipVideoID+'&type=video_single"><img src="'+ipPrefix+'mvp/players/play_thumb.php?clientID='+ipClientID+'&videoID='+ipVideoID+'&width='+width+'&height='+height+'&prefix='+ipPrefix+'" /></a>');
		document.write('</div>');
		
		
	}else if(smartPhone && (isMVPVideoRP || isMVPDynamic) && altMode != "html"){
		
		document.write('<div id='+cssID+'></div>');
		var url = ipPrefix+'mvp/getSubCatType.php?width='+width+'&subCat='+ipSubCat+'&prefix='+ipPrefix+'&clientID='+ipClientID+'&cssID='+cssID+'&playlist='+isMVPPlaylist+'&dpID='+ipDpID; // URL of the external script

		// this shows dynamic script insertion
		var script = document.createElement('script');
		script.setAttribute('src', url);

		// load the script
		document.getElementsByTagName('head')[0].appendChild(script);
		
		
	}else if(smartPhone && isMVPPhoto && altMode != "html"){
		
		document.write('<div id='+cssID+'>');
		document.write('<a href="javascript:popImage('+ipPhoto+','+ipClientID+',%22'+ipPrefix+'%22,true,false,false)"><img src="'+ipPrefix+'mvp/players/pop_thumb.php?clientID='+ipClientID+'&photoID='+ipPhoto+'&width='+width+'&height='+height+'&prefix='+ipPrefix+'" /></a>');
		document.write('</div>');
	}else if(smartPhone && isMVPPano && altMode != "html"){
		
		document.write('<div id='+cssID+'>');
		document.write('<a href="javascript:popImage('+ipPano+','+ipClientID+',%22'+ipPrefix+'%22,true,true,false)"><img src="'+ipPrefix+'mvp/players/pop_thumb.php?clientID='+ipClientID+'&panoID='+ipPano+'&width='+width+'&height='+height+'&prefix='+ipPrefix+'" /></a>');
		document.write('</div>');
		
		
	}else if(riTestFlash(playerVersion)){
		var domain = "&domain="+document.domain+"&location="+escape(document.location);
		if(wmode != "transparent"){
			wmode = "opaque";
			//allowFullScreen = "false";
		}//else{
			allowFullScreen = "true";
		//}
		var idVars = "&cssID=ri_"+cssID;
		
		
		
		if (location.search != "" && riVars == ""){
			var x = location.search.substr(1).split("&");
			for (var i=0; i < x.length; i++){
				if(x[i].indexOf("ri_") == 0){
					riVars += "&" + x[i];
				}
				
			}
		}
		
		var wmodeVars = "&wmode="+wmode;
		var sizeVars = "&stageWidth="+width+"&stageHeight="+height;
		flashVars = flashVars + "&allowFullScreen="+allowFullScreen + domain + epoch + idVars + riVars + wmodeVars + sizeVars;
		
		
		if((navigator.userAgent.indexOf("MSIE") != -1) && (navigator.userAgent.indexOf("Mac") != -1)){
			file += "?"+flashVars; /*this allows Mac IE to see flash vars. Mac IE can't read flash Vars it needs to attach them to the swf in the form of file.swf?flashVars */
		}
		document.write('<div>');
		document.write('<a name="ri_'+cssID+'"></a>');
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="'+cssID+'" width="'+width+'" height="'+height+'">'); 
		document.write('<param name="movie" value="'+file+'" />'); 
		document.write('<param name="FlashVars" value="'+flashVars+'" />'); 
		document.write('<param name="wmode" value="'+wmode+'" />');
		document.write('<param name="bgcolor" value="'+bgColour+'" />');
		document.write('<param name="allowFullScreen" value="'+allowFullScreen+'" />');
		document.write('<param name="allowScriptAccess" value="always" />');
		
		document.write('<embed src="'+file+'" width="'+width+'" height="'+height+'" allowFullScreen="'+allowFullScreen+'" allowScriptAccess="always" wmode="'+wmode+'" type="application/x-shockwave-flash" flashvars="'+flashVars+'" id="'+cssID+'" name="'+cssID+'" bgcolor="'+bgColour+'" swliveconnect=true />');
		document.write('</object>');
		document.write('</div>');
		
		
	}else{

		if (altMode == "image"){
			//get domain to grab image from
			var altContentDomain_array = altContent.split("/");
			if(altContentDomain_array[0] == ".."){//it was a relative array, so just use /
				var altContentDomain = "";
			}else if(altContentDomain_array[0] != "http" || altContentDomain_array[0] == "https"){//not url found, use default
				var altContentDomain = "http://www.resorts-interactive.com";
			}else{
				var altContentDomain = altContentDomain_array[0]+"//"+altContentDomain_array[2];
			}
			
			altTitle="To view this content you need a more recent version of the Adobe Flash Player. Click here to download from Adobe.com";
			document.write('<a href="http://get.adobe.com/flashplayer/" target="_blank" title="'+altTitle+'"><img src="'+altContentDomain+'/getFlash.php?width='+width+'&height='+height+'" alt="'+altTitle+'" /></a>'); 
		}else if(altMode == "html"){ 
			document.write(altContent);
		}else if(altMode == "redirect"){
			window.location = altContent;
		}
	}
}


var mouseX = 0;
var mouseY = 0;
var playerWidth = 0;
var playerHeight = 0;

function riOpenLink(link){
	var link_array = link.split("#");
	var epochDate = new Date();
	var epoch = epochDate.getTime();
	
	var newLink = link_array[0]+"&epoch="+epoch+"#"+link_array[1];
	
	window.location = newLink;
}



function getMousePos(e) {

	/*if( typeof( window.pageYOffset ) == 'number' ) {
		scrollX = window.pageXOffset;
		scrollY = window.pageYOffset;
	} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		scrollX = document.documentElement.scrollLeft;
		scrollY = document.documentElement.scrollTop;
	} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		scrollX = document.body.scrollLeft;
		scrollY = document.body.scrollTop;
	}*/
			
	var ie = (document.all)?true:false;
	if(ie){
	   mouseX = event.clientX + document.documentElement.scrollLeft;
	   mouseY = event.clientY + document.documentElement.scrollTop;
	}else{
	   mouseX = e.pageX;
	   mouseY = e.pageY;
	}
   
	
	
	
	
}

var RIie = (document.all)?true:false;
if(!RIie) {
	document.captureEvents(Event.MOUSEMOVE);
}

document.onmousedown = getMousePos;



function popSWF(file,width,height,playerVersion,altMode,altContent,flashVars,cssID,wmode,bgColour,centreWithBG){

	var isMVPVideo = false;
	var isMVPPhoto = false;
	var isMVPPano = false;
	var isMVPVideoRP = false;
	var isMVPPlaylist = false;
	var isMVPDynamic = false;
	var isMVPTabbedPlayer = false;
	
	playerWidth = width;
	playerHeight = height;
	
	flashVars += "&stageWidth="+width;
	flashVars += "&stageHeight="+height;
	
	
	
	
	var flashVarsSplit_array = flashVars.split("&");
	
	var lngth = flashVarsSplit_array.length;
	for(i = 0; i < lngth; i ++){
		if(flashVarsSplit_array[i].indexOf("tabID=") != -1){
			isMVPTabbedPlayer = true;
			var ipSplit = flashVarsSplit_array[i].split("=");
			var ipTabID = ipSplit[1];
		}else if(flashVarsSplit_array[i].indexOf("videoID=") != -1){
			var ipSplit = flashVarsSplit_array[i].split("=");
			var ipVideoID = ipSplit[1];
		}else if(flashVarsSplit_array[i].indexOf("clientID=") != -1){
			var ipSplit = flashVarsSplit_array[i].split("=");
			var ipClientID = ipSplit[1];
		}else if(flashVarsSplit_array[i].indexOf("prefix=") != -1){
			var ipSplit = flashVarsSplit_array[i].split("=");
			var ipPrefix = ipSplit[1];
		}else if(flashVarsSplit_array[i].indexOf("subCat=") != -1){
			var ipSplit = flashVarsSplit_array[i].split("=");
			var ipSubCat = ipSplit[1];
		}else if(flashVarsSplit_array[i].indexOf("dpID=") != -1){//dynamic playlist
			var ipSplit = flashVarsSplit_array[i].split("=");
			var ipDpID = ipSplit[1];
		}else if(flashVarsSplit_array[i].indexOf("tabID=") != -1){//tabbed menu of playlists
			var ipSplit = flashVarsSplit_array[i].split("=");
			var ipTabID = ipSplit[1];
		}else if(flashVarsSplit_array[i].indexOf("inline=") != -1){
			var ipSplit = flashVarsSplit_array[i].split("=");
			var ipInline = ipSplit[1];
		}else if(flashVarsSplit_array[i].indexOf("photoID=") != -1){
			var ipSplit = flashVarsSplit_array[i].split("=");
			var ipPhoto = ipSplit[1];
			isMVPPhoto = true;
		}else if(flashVarsSplit_array[i].indexOf("panoID=") != -1){
			var ipSplit = flashVarsSplit_array[i].split("=");
			var ipPano = ipSplit[1];
			isMVPPano = true;
		}
	}
	
	if(file.indexOf("playlist") != -1 || file.indexOf("mini_browser") != -1){
		isMVPPlaylist = true;
	}
	
	
	
	if(flashVars.indexOf("videoID=") != -1 && flashVars.indexOf("clientID=") != -1 && flashVars.indexOf("prefix=") != -1){
		isMVPVideo = true;
	}else if(flashVars.indexOf("subCat=") != -1 && flashVars.indexOf("clientID=") != -1 && flashVars.indexOf("prefix=") != -1){
		isMVPVideoRP = true;
	}else if(flashVars.indexOf("dpID=") != -1){
		isMVPDynamic = true;
	}
	
	if(isMVPDynamic){
		ipSubCat = "null";
	}else{
		ipDpID = "null";
	}
	
	var smartPhone = isSmartPhone();
	
	
	
	
	if(smartPhone && isMVPVideo && altMode != "html"){
		
		window.location = ipPrefix+'mvp/showVideo.m4v?clientID='+ipClientID+'&videoID='+ipVideoID+'&type=video_single';
		
		
	}else if(smartPhone && (isMVPVideoRP || isMVPDynamic) && altMode != "html"){
		var url = ipPrefix+'mvp/getSubCatType.php?width='+width+'&subCat='+ipSubCat+'&prefix='+ipPrefix+'&clientID='+ipClientID+'&cssID='+cssID+'&playlist='+isMVPPlaylist+'&dpID='+ipDpID+"&launch=1"; // URL of the external script
		
		// this shows dynamic script insertion
		var script = document.createElement('script');
		script.setAttribute('src', url);

		// load the script
		document.getElementsByTagName('head')[0].appendChild(script);
		
	}else if(smartPhone && isMVPPhoto && altMode != "html"){
		popImage(ipPhoto,ipClientID,ipPrefix,true,false,false);
	}else if(smartPhone && isMVPPano && altMode != "html"){
		popImage(ipPano,ipClientID,ipPrefix,true,true,false);
	}else{
	
		if (mouseX < (playerWidth/2)) { mouseX = (playerWidth/2);}
		if (mouseY < (playerHeight/2)) { mouseY = (playerHeight/2);}


		var playerDiv = document.createElement("div");
		playerDiv.id = cssID;

		playerDiv.style.position = "absolute";
		playerDiv.style.left = (mouseX-(width/2))+"px";
		playerDiv.style.top = (mouseY-(height/2))+"px";

		playerDiv.style.zIndex = "10000";

		var html = "";

			
		if(overAllTest){

			var domain = "&domain="+document.domain+"&location="+escape(document.location);
			//if(wmode != "transparent"){
			//	wmode = "opaque";
			//}
			wmode = "transparent";
			allowFullScreen = "true";

			var idVars = "&cssID=ri_"+cssID;

			if (location.search != "" && riVars == ""){
				var x = location.search.substr(1).split("&");
				for (var i=0; i < x.length; i++){
					if(x[i].indexOf("ri_") == 0){
						riVars += "&" + x[i];
					}

				}
			}

			var wmodeVars = "&wmode="+wmode;
			var popSWFVars = "&popSWFItem=1";
			var cssVars = "&cssID="+cssID;
			if(ipInline == "2"){
				var coveringAll = "&centreWithBG=true";
			}else{
				var coveringAll = "&centreWithBG="+centreWithBG;
			}
			
			
			flashVars = flashVars + "&allowFullScreen="+allowFullScreen + domain + epoch + idVars + riVars + wmodeVars + popSWFVars + cssVars + coveringAll;


			if((navigator.userAgent.indexOf("MSIE") != -1) && (navigator.userAgent.indexOf("Mac") != -1)){
				file += "?"+flashVars; /*this allows Mac IE to see flash vars. Mac IE can't read flash Vars it needs to attach them to the swf in the form of file.swf?flashVars */
			}
			html += '<div>';
			html += '<a name="ri_'+cssID+'"></a>';
			html +='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+width+'" height="'+height+'">'; 
			html +='<param name="movie" value="'+file+'" />'; 
			html +='<param name="FlashVars" value="'+flashVars+'" />'; 
			html +='<param name="wmode" value="'+wmode+'" />';
			html +='<param name="bgcolor" value="'+bgColour+'" />';
			html +='<param name="allowFullScreen" value="'+allowFullScreen+'" />';
			html +='<param name="allowScriptAccess" value="always" />';

			html +='<embed src="'+file+'" width="'+width+'" height="'+height+'" allowFullScreen="'+allowFullScreen+'" allowScriptAccess="always" wmode="'+wmode+'" type="application/x-shockwave-flash" flashvars="'+flashVars+'" bgcolor="'+bgColour+'" />';
			html +='</object>';
			html +='</div>';

		}else{
			playerDiv.style.backgroundColor = "#FFFFFF";


			if (altMode == "image"){
				altTitle="You need a more recent version of the Adobe Flash Player";
				html += '<a href="http://www.adobe.com/go/getflashplayer" target="_blank" title="'+altTitle+'"><img src='+altContent+' alt="'+altTitle+'" /></a>'; 
			}else if(altMode == "html"){ 
				html += altContent;
			}else if(altMode == "redirect"){
				window.location = altContent;
			}
		}

		
		if(centreWithBG || ipInline == "2"){ //pop up media player in centre with black transparent background
			centreWithBG = true;
			var imageBGDiv = document.createElement("div");
			imageBGDiv.id = "mvp_itemBGPop";

			imageBGDiv.style.position = "absolute";
			imageBGDiv.style.left = 0;
			imageBGDiv.style.top = 0;
			imageBGDiv.style.width = "100%";
			var myHeight = (document.body.offsetHeight)? document.body.offsetHeight: document.documentElement.clientHeight;
			var myWidth = document.body.offsetWidth;
			var myScroll = (document.documentElement.scrollTop)? document.documentElement.scrollTop: document.body.scrollTop;
			
			
			if (window.innerHeight) {
			      var myHeight_visible = window.innerHeight;
			}else if (document.documentElement && document.documentElement.clientHeight) {
			      var myHeight_visible = document.documentElement.clientHeight;
			}else if (document.body) {
			      var myHeight_visible = document.body.clientHeight;
			}

			var midVertical = (myHeight_visible/2)+(myScroll);
			if(document.body.scrollHeight){
				imageBGDiv.style.height = document.body.scrollHeight+"px";
			}else{
				imageBGDiv.style.height = myHeight+"px";
			}

			imageBGDiv.style.backgroundColor = "#000000";
			imageBGDiv.style.opacity = 0.7;
			imageBGDiv.style.MozOpacity = 0.7;
			imageBGDiv.style.KhtmlOpacity = 0.7;

			imageBGDiv.style.filter = "alpha(opacity=70)";
			imageBGDiv.style.textAlign = "center";
			imageBGDiv.style.color = "#DDDDDD";
			imageBGDiv.style.fontSize = "12px";
			if(cssID == "vicoMap"){
				imageBGDiv.innerHTML = "Click to close";
			}else{
				imageBGDiv.innerHTML = "Click to close <div style='padding-top: "+midVertical+"px;'>Loading media player, please wait...</div>";
			}
			
			imageBGDiv.style.zIndex = "10005";
			imageBGDiv.onclick = function() { closePopSWF(cssID, 'true'); };

			var imageDiv = document.createElement("div");
			imageDiv.id = "mvp_itemPop";
			
			imageDiv.style.position = "absolute";
			imageDiv.style.left = "50%";
			imageDiv.style.marginLeft = "-"+(width/2)+"px";
			imageDiv.style.top = "50%";
			imageDiv.style.marginTop = "-"+(height/2)+"px";
			imageDiv.style.width = width;
			imageDiv.style.height = height;
			imageDiv.style.textAlign = "center";

			//imageDiv.style.paddingTop = (midVertical-(playerHeight/2))+"px";
			
			imageDiv.style.zIndex = "10010";
			
			
			
			imageDiv.innerHTML = html;
			
			
			
			document.body.appendChild(imageDiv);
			document.body.appendChild(imageBGDiv);


		}else{
			playerDiv.innerHTML = html;
			document.body.appendChild(playerDiv);
		}

		
	
	}
	
	
	
	
	
	
}

function isSmartPhone(){
	if(navigator.userAgent.indexOf("iPod") != -1 || navigator.userAgent.indexOf("iPhone") != -1 || navigator.userAgent.indexOf("iPad") != -1 || navigator.userAgent.indexOf("Android") != -1 || (navigator.userAgent.indexOf("Opera Mini") != -1 && navigator.appVersion.indexOf("J2ME") != -1)){
		return true;
	}else{
		return false;
	}
}


function insertSWFinto(file,width,height,playerVersion,altMode,altContent,flashVars,cssID,wmode,bgColour,insertID){

	var smartPhone = isSmartPhone();
	
	if(smartPhone){
		putSWF(file,width,height,playerVersion,altMode,altContent,flashVars,cssID,wmode,bgColour);
	}else{
		var playerDiv = document.getElementById(insertID);
		var html = "";


		if(overAllTest){

			var domain = "&domain="+document.domain+"&location="+escape(document.location);
			//if(wmode != "transparent"){
			//	wmode = "opaque";
			//}
			wmode = "transparent";
			allowFullScreen = "true";

			var idVars = "&cssID=ri_"+cssID;

			if (location.search != "" && riVars == ""){
				var x = location.search.substr(1).split("&");
				for (var i=0; i < x.length; i++){
					if(x[i].indexOf("ri_") == 0){
						riVars += "&" + x[i];
					}

				}
			}

			var wmodeVars = "&wmode="+wmode;
			var cssVars = "&cssID="+cssID;
			flashVars = flashVars + "&allowFullScreen="+allowFullScreen + domain + epoch + idVars + riVars + wmodeVars + cssVars;


			if((navigator.userAgent.indexOf("MSIE") != -1) && (navigator.userAgent.indexOf("Mac") != -1)){
				file += "?"+flashVars; /*this allows Mac IE to see flash vars. Mac IE can't read flash Vars it needs to attach them to the swf in the form of file.swf?flashVars */
			}
			html += '<div>';
			html += '<a name="ri_'+cssID+'"></a>';
			html +='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+width+'" height="'+height+'">'; 
			html +='<param name="movie" value="'+file+'" />'; 
			html +='<param name="FlashVars" value="'+flashVars+'" />'; 
			html +='<param name="wmode" value="'+wmode+'" />';
			html +='<param name="bgcolor" value="'+bgColour+'" />';
			html +='<param name="allowFullScreen" value="'+allowFullScreen+'" />';
			html +='<param name="allowScriptAccess" value="always" />';

			html +='<embed src="'+file+'" width="'+width+'" height="'+height+'" allowFullScreen="'+allowFullScreen+'" allowScriptAccess="always" wmode="'+wmode+'" type="application/x-shockwave-flash" flashvars="'+flashVars+'" bgcolor="'+bgColour+'" />';
			html +='</object>';
			html +='</div>';

		}else{
			
			if (altMode == "image"){
				//get domain to grab image from
				var altContentDomain_array = altContent.split("/");
				if(altContentDomain_array[0] == ".."){//it was a relative array, so just use /
					var altContentDomain = "";
				}else if(altContentDomain_array[0] != "http" || altContentDomain_array[0] == "https"){//not url found, use default
					var altContentDomain = "http://www.resorts-interactive.com";
				}else{
					var altContentDomain = altContentDomain_array[0]+"//"+altContentDomain_array[2];
				}

				altTitle="To view this content you need a more recent version of the Adobe Flash Player. Click here to download from Adobe.com";
				document.write('<a href="http://get.adobe.com/flashplayer/" target="_blank" title="'+altTitle+'"><img src="'+altContentDomain+'/getFlash.php?width='+width+'&height='+height+'" alt="'+altTitle+'" /></a>'); 
			}else if(altMode == "html"){ 
				document.write(altContent);
			}else if(altMode == "redirect"){
				window.location = altContent;
			}
			
			
			
			
		}


		playerDiv.innerHTML = html;
	}
	
	
	
	
}


function closePopSWF(cssID, coveringAll){
	if(coveringAll == "true"){
		document.body.removeChild(document.getElementById("mvp_itemBGPop"));
		document.body.removeChild(document.getElementById("mvp_itemPop"));
	}else{
		document.body.removeChild(document.getElementById(cssID));
	}
	
}


function checkSubCatType(subCatIDJSON){
	
	if(subCatIDJSON.playlist == "true"){
		
		if(subCatIDJSON.dpID != "null"){
			if(subCatIDJSON.subCatType == "video"){

				var url = subCatIDJSON.prefix+"mvp/players/playlist_thumb.php?clientID="+subCatIDJSON.clientID+"&videoID="+subCatIDJSON.latestID+"&width="+subCatIDJSON.width+"&prefix="+subCatIDJSON.prefix;
				var itemURL = subCatIDJSON.prefix+'mvp/getVideos.php?clientID='+subCatIDJSON.clientID+'&dpID='+subCatIDJSON.dpID+'&smartPhone=true';

			}else if(subCatIDJSON.subCatType == "photo"){
				var url = subCatIDJSON.prefix+"mvp/players/playlist_thumb.php?clientID="+subCatIDJSON.clientID+"&photoID="+subCatIDJSON.latestID+"&width="+subCatIDJSON.width+"&prefix="+subCatIDJSON.prefix;
				var itemURL = subCatIDJSON.prefix+'mvp/getPhotos.php?clientID='+subCatIDJSON.clientID+'&dpID='+subCatIDJSON.dpID+'&smartPhone=true';
			}else if(subCatIDJSON.subCatType == "pano"){
				var url = subCatIDJSON.prefix+"mvp/players/playlist_thumb.php?clientID="+subCatIDJSON.clientID+"&panoID="+subCatIDJSON.latestID+"&width="+subCatIDJSON.width+"&prefix="+subCatIDJSON.prefix;
				var itemURL = subCatIDJSON.prefix+'mvp/getPanoramas.php?clientID='+subCatIDJSON.clientID+'&dpID='+subCatIDJSON.dpID+'&smartPhone=true';
			}else if(subCatIDJSON.subCatType == "webCam"){
				var url = subCatIDJSON.prefix+"mvp/players/playlist_thumb.php?clientID="+subCatIDJSON.clientID+"&latestCam="+subCatIDJSON.latestID+"&width="+subCatIDJSON.width+"&prefix="+subCatIDJSON.prefix;
				var itemURL = subCatIDJSON.prefix+'mvp/getPhotos.php?clientID='+subCatIDJSON.clientID+'&dpID='+subCatIDJSON.dpID+'&smartPhone=true&webCams=1';
			}
		}else{
			if(subCatIDJSON.subCatType == "video"){

				var url = subCatIDJSON.prefix+"mvp/players/playlist_thumb.php?clientID="+subCatIDJSON.clientID+"&videoID="+subCatIDJSON.latestID+"&width="+subCatIDJSON.width+"&prefix="+subCatIDJSON.prefix;
				var itemURL = subCatIDJSON.prefix+'mvp/getVideos.php?subCat='+subCatIDJSON.subCat+'&smartPhone=true';

			}else if(subCatIDJSON.subCatType == "photo"){
				var url = subCatIDJSON.prefix+"mvp/players/playlist_thumb.php?clientID="+subCatIDJSON.clientID+"&photoID="+subCatIDJSON.latestID+"&width="+subCatIDJSON.width+"&prefix="+subCatIDJSON.prefix;
				var itemURL = subCatIDJSON.prefix+'mvp/getPhotos.php?subCat='+subCatIDJSON.subCat+'&smartPhone=true';
			}else if(subCatIDJSON.subCatType == "pano"){
				var url = subCatIDJSON.prefix+"mvp/players/playlist_thumb.php?clientID="+subCatIDJSON.clientID+"&panoID="+subCatIDJSON.latestID+"&width="+subCatIDJSON.width+"&prefix="+subCatIDJSON.prefix;
				var itemURL = subCatIDJSON.prefix+'mvp/getPanoramas.php?subCat='+subCatIDJSON.subCat+'&smartPhone=true';
			}
			
			//webcam playlists are always dynamic
		}
		
		
		
		
	}else{
		if(subCatIDJSON.playlist == "tabs"){

			var url = subCatIDJSON.prefix+"mvp/players/playlist_thumb.php?clientID="+subCatIDJSON.clientID+"&videoID="+subCatIDJSON.latestID+"&width="+subCatIDJSON.width+"&prefix="+subCatIDJSON.prefix+"&height=350";
			
			var itemURL = subCatIDJSON.prefix+'mvp/getTabs.php?tmID='+subCatIDJSON.subCat+'&smartPhone=true';

		}else if(subCatIDJSON.subCatType == "video"){

			var url = subCatIDJSON.prefix+"mvp/players/play_thumb.php?clientID="+subCatIDJSON.clientID+"&videoID="+subCatIDJSON.latestID+"&width="+subCatIDJSON.width+"&prefix="+subCatIDJSON.prefix;
			var itemURL = subCatIDJSON.prefix+'mvp/showVideo.m4v?clientID='+subCatIDJSON.clientID+'&videoID='+subCatIDJSON.latestID+'&type=reportPal_web&rpSubCat='+subCatIDJSON.subCat;
		
		}else if(subCatIDJSON.subCatType == "photo"){

			var url = subCatIDJSON.prefix+"mvp/players/pop_thumb.php?clientID="+subCatIDJSON.clientID+"&photoID="+subCatIDJSON.latestID+"&width="+subCatIDJSON.width+"&prefix="+subCatIDJSON.prefix;
			var itemURL = 'javascript:popImage('+subCatIDJSON.latestID+','+subCatIDJSON.clientID+',\"'+subCatIDJSON.prefix+'\",true,false,false,'+subCatIDJSON.subCat+','+subCatIDJSON.dpID+')';//subCatIDJSON.prefix+'mvp/getImage.php?clientID='+subCatIDJSON.clientID+'&photoID='+subCatIDJSON.latestID+'&width=1024';


		}else if(subCatIDJSON.subCatType == "webCam"){
			var url = subCatIDJSON.prefix+"mvp/players/pop_thumb.php?clientID="+subCatIDJSON.clientID+"&latestCam="+subCatIDJSON.latestID+"&width="+subCatIDJSON.width+"&prefix="+subCatIDJSON.prefix;
			var itemURL = 'javascript:popImage('+subCatIDJSON.latestID+','+subCatIDJSON.clientID+',\"'+subCatIDJSON.prefix+'\",true,false,true,'+subCatIDJSON.subCat+','+subCatIDJSON.dpID+')';
		}else if(subCatIDJSON.subCatType == "pano"){
			var url = subCatIDJSON.prefix+"mvp/players/pop_thumb.php?clientID="+subCatIDJSON.clientID+"&panoID="+subCatIDJSON.latestID+"&width="+subCatIDJSON.width+"&prefix="+subCatIDJSON.prefix;
			var itemURL = 'javascript:popImage('+subCatIDJSON.latestID+','+subCatIDJSON.clientID+',\"'+subCatIDJSON.prefix+'\",true,true,false,'+subCatIDJSON.subCat+','+subCatIDJSON.dpID+')';
		}
	}
	
	
	
	if(subCatIDJSON.launch == 1){//if launch is on, just launch media item right away
		window.location = itemURL;
	}else{
		var linkItem = document.createElement('a');
		linkItem.setAttribute('href', itemURL);
		linkItem.setAttribute('target', "_top");
		var mvpItem = document.createElement('img');
		mvpItem.setAttribute('src', url);
		

		linkItem.appendChild(mvpItem);
		document.getElementById(subCatIDJSON.cssID).appendChild(linkItem);
	}
	

}

var preImg = new Image();

function popImage(photoID, clientID, prefix, smartPhonePage, pano, webCam, reportPal, dp, fromPlaylist){
	var imageBGDiv = document.createElement("div");
	if(prefix == undefined || prefix == ""){
		prefix = "/";
	}
	imageBGDiv.id = "mvp_photoBGPop_"+photoID;
	
	imageBGDiv.style.position = "absolute";
	imageBGDiv.style.left = 0;
	imageBGDiv.style.top = 0;
	imageBGDiv.style.width = "100%";
	
	if(smartPhonePage){
		imageBGDiv.style.marginLeft = "-8px";
		imageBGDiv.style.paddingRight = "16px";
		imageBGDiv.style.marginTop = "-8px";
		imageBGDiv.style.paddingBottom = "16px";
	}else{
		imageBGDiv.style.paddingBottom = "100px";
	}
	
	var myHeight = (document.body.offsetHeight)? document.body.offsetHeight: document.documentElement.clientHeight;
	
	var myWidth = document.body.offsetWidth;
	var myScroll = (document.documentElement.scrollTop)? document.documentElement.scrollTop: document.body.scrollTop;
	
	if (window.innerHeight) {
	      var myHeight_visible = window.innerHeight;
	}else if (document.documentElement && document.documentElement.clientHeight) {
	      var myHeight_visible = document.documentElement.clientHeight;
	}else if (document.body) {
	      var myHeight_visible = document.body.clientHeight;
	}

	var midVertical = (myHeight_visible/2)+(myScroll);
	if(document.body.scrollHeight){
		imageBGDiv.style.height = document.body.scrollHeight+"px";
	}else{
		imageBGDiv.style.height = myHeight+"px";
	}
	
	imageBGDiv.style.backgroundColor = "#000000";
	imageBGDiv.style.opacity = 0.7;
	imageBGDiv.style.MozOpacity = 0.7;
	imageBGDiv.style.KhtmlOpacity = 0.7;
	
	imageBGDiv.style.filter = "alpha(opacity=70)";
	imageBGDiv.style.textAlign = "center";
	imageBGDiv.style.color = "#EEEEEE";
	imageBGDiv.style.fontSize = "24px";
	var imageDivID = "mvp_photoPop_"+photoID;
	imageBGDiv.innerHTML = "<div style='font-family: sans-serif; padding-top: "+midVertical+"px;'>Loading image, please wait...</div>";
	imageBGDiv.setAttribute("onclick", "closeImage(\""+imageDivID+"\", \""+imageBGDiv.id+"\")");  
	imageBGDiv.style.zIndex = "10005";
	
	
	
	var imageDiv = document.createElement("div");
	imageDiv.id = imageDivID;
	//preload image to work out sizes
	if(pano){
		var imgSrc = prefix+"mvp/getImage.php?panoID="+photoID+"&width="+Math.round(myWidth* 0.98)+"&height="+Math.round(myHeight_visible* 0.98)+"&clientID="+clientID;
		var statType = "&statType=pano_single";
		var statSrc = prefix+"mvp/statImage.php?clientID="+clientID+"&id="+photoID+"&width="+Math.round(myWidth* 0.8)+"&height="+Math.round(myHeight_visible* 0.8)+statType;
		
		
		
	}else if(webCam){//webCam
		var imgSrc = prefix+"mvp/getImage.php?latestCam="+photoID+"&width="+Math.round(myWidth* 0.8)+"&height="+Math.round(myHeight_visible* 0.8)+"&clientID="+clientID;
		var statSrc = prefix+"mvp/statImage.php?clientID="+clientID+"&id="+photoID+"&width="+Math.round(myWidth* 0.8)+"&height="+Math.round(myHeight_visible* 0.8)+"&statType=WCreportPal_web";
	}else{//photo
		
		if(reportPal != null){
			var statType = "&statType=photoReportPal_web";
			var statID = reportPal;
		}else if(dp != null){
			var statType = "&statType=dynamicPhotoReportPal_web";
			var statID = dp;
		}else{
			var statType = "";
			var statID = photoID;
		}
		
		
		var imgSrc = prefix+"mvp/getImage.php?photoID="+photoID+"&width="+Math.round(myWidth* 0.8)+"&height="+Math.round(myHeight_visible* 0.8)+"&clientID="+clientID;
		var statSrc = prefix+"mvp/statImage.php?clientID="+clientID+"&id="+statID+"&width="+Math.round(myWidth* 0.8)+"&height="+Math.round(myHeight_visible* 0.8)+statType;
	}
	
	
	
	preImg.src = imgSrc;
	if(preImg.width == 0){
		preImg.onload = function() {
			imageDiv.style.position = "absolute";
			imageDiv.style.left = 0;
			imageDiv.style.top = 0;
			imageDiv.style.width = "100%";
			imageDiv.style.textAlign = "center";
			imageDiv.style.paddingTop = (midVertical-(this.height/2))+"px";
			imageDiv.style.zIndex = "10010";
			var html = "<img src='"+statSrc+"' width='0' height='0' /><img src='"+imgSrc+"' />";
			imageBGDiv.innerHTML = "";
			imageDiv.innerHTML = html;
			imageDiv.setAttribute("onclick", "closeImage(\""+imageDivID+"\", \""+imageBGDiv.id+"\")");  
			document.body.appendChild(imageDiv);
		}
	}else{
		imageDiv.style.position = "absolute";
		imageDiv.style.left = 0;
		imageDiv.style.top = 0;
		imageDiv.style.width = "100%";
		imageDiv.style.textAlign = "center";
		imageDiv.style.paddingTop = (midVertical-(preImg.height/2))+"px";
		imageDiv.style.zIndex = "10010";
		var html = "<img src='"+statSrc+"' width='0' height='0' /><img src='"+imgSrc+"' />";
		imageBGDiv.innerHTML = "";
		imageDiv.innerHTML = html;
		imageDiv.setAttribute("onclick", "closeImage(\""+imageDivID+"\", \""+imageBGDiv.id+"\")"); 
		document.body.appendChild(imageDiv);
	}
	
	document.body.appendChild(imageBGDiv);
	
}


function closeImage(image, imageBG){
	if(document.getElementById(image)){
		var imageDiv = document.getElementById(image);
		document.body.removeChild(imageDiv);
	}
	
	if(document.getElementById(imageBG)){
		var imageBGDiv = document.getElementById(imageBG);
		document.body.removeChild(imageBGDiv);
	}
	preImg.onload = null;

}


}