function closeVideo(){
			var cDiv = document.getElementById('video');
			var pDiv;
			if(cDiv) {
				pDiv = cDiv.parentNode;
				pDiv.removeChild(cDiv);
			}

			jQuery("#video").empty().remove();
			jQuery("#videoFrame").empty().remove();
			jQuery('#videoParent').empty().remove();
			jQuery("#refVideo").empty();
}

function openVideo(cid,sic,name,multi){
	var flashvars = {  
		name1: "hello",  
		name2: "world",  
		name3: "foobar"
		};
	var params = {  
		wmode : window
	};
	var attributes = {  
		id: "video",  
		name: "video"
	};
    var playerWidth = 438;
    var playerHeight = 327;
    var player="svp_player.swf";
    if(multi){
    	player="player3.swf";
    	playerWidth = 500;
    	playerHeight = 473;
    	
    }

    var playerWidthFrame = playerWidth+8;
    var playerHeightFrame = playerHeight+20;
		cClick();
		closeVideo();

	var videoTop=270;
	if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)){ //test for Firefox/x.x or Firefox x.x (ignoring remaining digits);
		videoTop=videoTop+window.pageYOffset;
	}else{
		videoTop=videoTop+document.documentElement.scrollTop;
	}
	
	jQuery("#refVideo").empty();
	jQuery("#refVideo").append("<div id='videoParent' style='z-index:10000;position: absolute;left:350px;top:"+videoTop+"px; width: "+playerWidthFrame+"px;height: "+playerHeightFrame+"px; ' >	</div>"); 
 
	var bigDiv="<div id='videoFrame' style='width: "+playerWidthFrame+"px;text-align:center;background-color:#ffcc00;height: "+playerHeightFrame+"px; ' >";
	jQuery("#videoParent")
	 .append(bigDiv+"<div style='float:left;background-color:#ffcc00;color: black;font-size:13px' >&nbsp;&nbsp;<b>"+name+"</b></div><div style='text-align:right;' ><a href='javascript:void(0);' id='closeVideo'><img   src='/images/exit.gif' border='0'/></a></div>	<div id='video' name='video'  /> <div> ");
	 
	jQuery("#closeVideo").click(closeVideo);

	swfobject.embedSWF("http://cpgimg.com/video/"+player+"?src=/PlayerXmlList?lang=0%26sic_code="+sic+"%26id="+cid+"%26mediatype=video&autoplay=1&stamp=1236885732695'","video",playerWidth,playerHeight,"9.0.0","expressInstall.swf",flashvars, params, attributes);
	
	if(typeof MapLIB != 'undefined')
		MapLIB.closeVirtualTour();
}

function openImage(cid,sic,name,multi){
	var flashvars = {  
		name1: "hello",  
		name2: "world",  
		name3: "foobar"
		};
	var params = {  
		wmode : window
	};
	var attributes = {  
		id: "video",  
		name: "video"
	};
    var playerWidth = 438;
    var playerHeight = 327;
    var player="svp_player.swf";
    if(multi){
    	player="player3.swf";
    	playerWidth = 500;
    	playerHeight = 473;
    	
    }

    var playerWidthFrame = playerWidth+8;
    var playerHeightFrame = playerHeight+20;
		cClick();
		closeVideo();

	var videoTop=270;
	if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)){ //test for Firefox/x.x or Firefox x.x (ignoring remaining digits);
		videoTop=videoTop+window.pageYOffset;
	}else{
		videoTop=videoTop+document.documentElement.scrollTop;
	}
	
	jQuery("#refVideo").empty();
	jQuery("#refVideo").append("<div id='videoParent' style='z-index:10000;position: absolute;left:350px;top:"+videoTop+"px; width: "+playerWidthFrame+"px;height: "+playerHeightFrame+"px; ' >	</div>"); 
 
	var bigDiv="<div id='videoFrame' style='width: "+playerWidthFrame+"px;text-align:center;background-color:#ffcc00;height: "+playerHeightFrame+"px; ' >";
	jQuery("#videoParent")
	 .append(bigDiv+"<div style='float:left;background-color:#ffcc00;color: black;font-size:13px' >&nbsp;&nbsp;<b>"+name+"</b></div><div style='text-align:right;' ><a href='javascript:void(0);' id='closeVideo'><img   src='/images/exit.gif' border='0'/></a></div>	<div id='video' name='video'  /> <div> ");
	 
	jQuery("#closeVideo").click(closeVideo);

	swfobject.embedSWF("http://cpgimg.com/video/"+player+"?src=/PlayerXmlList?lang=0%26sic_code="+sic+"%26id="+cid+"%26mediatype=image&autoplay=1&stamp=1236885732695'","video",playerWidth,playerHeight,"9.0.0","expressInstall.swf",flashvars, params, attributes);
	
	if(typeof MapLIB != 'undefined')
		MapLIB.closeVirtualTour();
}


function getFlashMovieObject(movieName) {
	if (window.document[movieName]) {
		return window.document[movieName];
	}
	if (navigator.appName.indexOf("Microsoft Internet") == -1) {
		if (document.embeds && document.embeds[movieName]) {
			return document.embeds[movieName];
		}
	} else { // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
		return document.getElementById(movieName);
	}
}
function StopFlashMovie(flashId) {
	var flashMovie = getFlashMovieObject(flashId);
//	flashMovie.StopPlay();
	flashMovie=null;
	return false;
}
function PlayFlashMovie(flashId) {
	RewindFlashMovie(flashId);
	var flashMovie = getFlashMovieObject(flashId);
	flashMovie.Play();
	return false;
}
function RewindFlashMovie(flashId) {
	var flashMovie = getFlashMovieObject(flashId);
	flashMovie.Rewind();
	return false;
}

function PauseFlashMovie(flashId) {
	var flashMovie = getFlashMovieObject(flashId);
	flashMovie.Pause();
	return false;
}

function resize(obj, image) {
	if (image.src == "http://fs.yellow.ca/image/yca/en/mag_plus.jpg") {
		obj.style.cssText = "font-weight:bold;font-size: 14px";
		image.src = "http://fs.yellow.ca/image/yca/en/mag_minus.jpg";
	} else {
		obj.style.cssText = "font-weight:normal;font-size: 12px";
		image.src = "http://fs.yellow.ca/image/yca/en/mag_plus.jpg";
	}
}
function toggleLayer(whichLayer) {
	if (document.getElementById) {
      //standard
		var style2 = document.getElementById(whichLayer).style;
		style2.display = style2.display != "none" ? "none" : "block";
	} else {
		if (document.all) {
      //old msie versions
			var style2 = document.all[whichLayer].style;
			style2.display = style2.display ? "" : "block";
		} else {
			if (document.layers) {
      // nn4
				var style2 = document.layers[whichLayer].style;
				style2.display = style2.display ? "" : "block";
			}
		}
	}
}

function removeElement(parent,divNum) {
  var d = document.getElementById(parent);
  var olddiv = document.getElementById(divNum);
  d.removeChild(olddiv);
}


function ieupdate() {
	objects = document.getElementsByTagName("object");
	for (var i = 0; i < objects.length; i++)
	{	
   	 objects[i].outerHTML = objects[i].outerHTML;
	}
}
	
