//here are the settings that you should set:
var videoWidth = 533;//this should be how wide the .flv is that you are using, 
                     //but if you set it higher or lower than the actual video, 
					 //it will be expanded or contracted on the screen to be able to show it.
var videoHeight = 300; //the width of the .flv, behaves just like videoWidth


var movieAlreadyWatched = checkCookie("movieAlreadyWatched", true, 'true', 1);
var dontShowMovieAgain = checkCookie("dontShowMovieAgain", false, 'true', 1);
//this next line first uses cookies to check to see if they have not seen the video yet and checks to see if they have set
//a http get variable named force_show_movie to true and if either is true it shows the movie
if(!dontShowMovieAgain || deconcept.util.getRequestParameter("force_show_movie")=="true") {
	var so = new SWFObject("transparent_flash_video.swf", "theflashmovie", videoWidth, videoHeight, "9");
	so.addParam("wmode", "transparent");
	so.write("flashdiv");
	document.getElementById("hidemovie").innerHTML = '<a href="javascript:killMovie();">hide movie</a>';
}
else {
	document.getElementById("flashdiv").innerHTML = "<a id='showmovie' href='/?detectflash=false&force_show_movie=true'>show movie</a>";
}
//now that they've seen the video dont show it again
setCookie("dontShowMovieAgain", 'true', 365);

function transparentFlashVideoOnComplete()
{
	deleteDOMNode('flashdiv');	
	deleteDOMNode('hidemovie');	
}
function killMovie(){
	deleteDOMNode('flashdiv');	
	deleteDOMNode('hidemovie');	
	setCookie("dontShowMovieAgain", 'true', 365);
}











//some functions to help out with what we are doing

//cookie functions pasted from http://www.w3schools.com/js/js_cookies.asp
function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=")
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1 
    c_end=document.cookie.indexOf(";",c_start)
    if (c_end==-1) c_end=document.cookie.length
    return unescape(document.cookie.substring(c_start,c_end))
    } 
  }
return ""
}

function setCookie(c_name,value,expiredays){
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString())
}

function checkCookie(cookiename, setIfNotSet, valueToSetAsIfNotSet, daysToKeepCookie){
	//the next 3 lines make it so setIfNotSet, valueToSetAsIfNotSet, daysToKeepCookie are optional paramaters
	setIfNotSet = typeof(setIfNotSet) != 'undefined' ? setIfNotSet : false;
	valueToSetAsIfNotSet = typeof(valueToSetAsIfNotSet) != 'undefined' ? valueToSetAsIfNotSet : "true";
	daysToKeepCookie = typeof(daysToKeepCookie) != 'undefined' ? daysToKeepCookie : 365;
	
	var cookieValue;
	cookieValue=getCookie(cookiename)
	if (cookieValue!=null && cookieValue!="")
		return cookieValue;
	else {
		if(setIfNotSet){
			setCookie(cookiename,valueToSetAsIfNotSet,daysToKeepCookie)
		}
		return false;
	}
}
function deleteDOMNode(nodeID) {
	var el = document.getElementById(nodeID);
	el.parentNode.removeChild(el);
}