<!--
// -----------------------------------------------------------------------------
// Globals
// Major version of Flash required
var requiredMajorVersion = 10;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Minor version of Flash required
var requiredRevision = 0;
// -----------------------------------------------------------------------------
// -->


function openVid(ifVid, theInternal, theImage, projId, theVimeo, theU2b, theVheight, theUheight, theIheight) {
	// Make heights
	if (!theVheight) {
		var theVheight = "483";
	};
	if (!theUheight) {
		var theUheight = "505";
	};
	if (!theIheight) {
		var theIheight = "100%";
	};
	//Uncomment line below to test variables
	/*alert ("ifVid="+ifVid + " theinternal=" + theInternal + " theimage="+theImage + " projid="+projId + " thevimeo=" + theVimeo + " theu2b=" + theU2b + " thevheight=" + theVheight + " theuheight=" + theUheight + " theiheight=" + theIheight);*/
	// Check if project is valid 
	if (projId!="") {
		if (ifVid!='yes') {
			// No video, turns off video placeholder, opens image

document.getElementById('placeholder').style.display='none';	
			document.getElementById('det_image').style.display='block';
		}
		else {
			// Version check based upon the values entered above in "Globals"
			var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
			// Check to see if the version meets the requirements for playback
			if (hasReqestedVersion && theVimeo) {
					//alert (theVimeo, theVheight);
					createVimeo(theVimeo, theVheight);
			}
			else if (theInternal || theInternal!="") {
					//alert (theInternal);
					createPlayer(theInternal, theImage, theIheight);
			}
			else if (theU2b || theU2b!="") {
					createU2b(theU2b, theUheight);					
			}
			
			else {
					alert('badflash');
			};
		};
	}
	else {
		document.getElementById('placeholder_nest').innerHTML='No projects found with this ID.'
	};
};

function createVimeo (idnum, vheight) {
	var placeholder = document.getElementById("placeholder");
	var idtxt = "http://vimeo.com/moogaloop.swf?clip_id=" + idnum + "amp;server=vimeo.com&amp;autoplay=1&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=ffffff&amp;fullscreen=1";
	vimeo="<object width=\"640\" height=\"" + vheight + "\">";
	vimeo+="<param name=\"allowfullscreen\" value=\"true\" /><param name=\"allowscriptaccess\" value=\"always\" />";
	vimeo+="<param name=\"movie\" value=\"" + idtxt + "\" />";
	vimeo+="<embed src=\"" + idtxt + "\" type=\"application/x-shockwave-flash\" allowfullscreen=\"true\" allowscriptaccess=\"always\" width=\"640\" height=\"" + vheight + "\">";
	vimeo+="</embed></object>";
	placeholder.innerHTML = vimeo;
	
	document.getElementById('det_image').style.display='none';
	document.getElementById('placeholder').style.display='block';

};

function createPlayer(theFile, theImage, theHeight) {
	var s = new SWFObject('http://www.balldeep.tv/videos/mediaplayer.swf','player','640px','480px','7','#000000');
	s.addVariable("file",theFile);
	s.addVariable("image","/new_graph/"+theImage);
	s.addParam("allowfullscreen","true");
	s.addVariable("showicons","true");
	s.addVariable("displayheight","9999");
	s.addVariable("overstretch","false");
	s.addVariable("autostart","true");
	s.addVariable("repeat","false");
	s.addVariable('backcolor','0x2724ED');
	s.addVariable('bufferlength','3');
	s.write("placeholder");
	document.getElementById('det_image').style.display='none';
	document.getElementById('placeholder').style.display='block'
	};

	
function createU2b(id, height) {
	var placeholder = document.getElementById("placeholder");
	var u2bid = "http://www.youtube.com/" + id + "&autoplay=true&hl=en&fs=1";
	var u2btxt = "<object width=\"640\" height=\"" + height + "\"><param name=\"movie\" value=\"" + u2bid + "\"></param><param name=\"allowFullScreen\" value=\"true\"></param><param name=\"allowscriptaccess\" value=\"always\"></param><embed src=\"" + u2bid + "\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"640\" height=\"" + height + "\"></embed></object>";
	placeholder.innerHTML = u2btxt;
	document.getElementById('det_image').style.display='none';
	document.getElementById('placeholder').style.display='block';
};

function updateDetails (projid) {
};
