
function playFlash1Time(movieName,cookieName,goToFrame) {
	stopmovie(movieName);
	var hasPlayed = getcookie(cookieName);

	if (hasPlayed != "true") {
	   playmovie(movieName);
	   setcookie(cookieName,"true",365);
	}
	else { 	
		stopmovie(movieName); 
		if (goToFrame == "first") {
  			thisMovie(movieName).GotoFrame(1);
		}
		else if (!isNaN(goToFrame)) {
  			thisMovie(movieName).GotoFrame(goToFrame);
		}
		else {
  			thisMovie(movieName).GotoFrame(thisMovie(movieName).TotalFrames);
		}
	}
}

function thisMovie(movieName) {
  // IE and Netscape refer to the movie object differently.
  // This function returns the appropriate syntax depending on the browser.
  if (navigator.appName.indexOf ("Microsoft") !=-1) {
    return window[movieName]
  } else {
    return document[movieName]
  }
}

function playmovie(movieName) {
  if (movieIsLoaded(thisMovie(movieName))) {
    thisMovie(movieName).Play();
  }
}

function stopmovie(movieName) {
  if (movieIsLoaded(thisMovie(movieName))) {
    thisMovie(movieName).StopPlay();
  	thisMovie(movieName).GotoFrame(thisMovie(movieName).TotalFrames);
  }
}

// Checks if movie is completely loaded.
// Returns true if yes, false if no.
function movieIsLoaded (theMovie) {
  // First make sure the movie's defined.
  if (typeof(theMovie) != "undefined") {
    // If it is, check how much of it is loaded.
    return theMovie.PercentLoaded() == 100;
  } else {
    // If the movie isn't defined, it's not loaded.
    return false;
  }
}

function setcookie(name,value,duration){
cookiestring=name+"="+escape(value)+";EXPIRES="+getexpirydate(duration);
document.cookie=cookiestring;
}

function getexpirydate( nodays){
var UTCstring;
Today = new Date();
nomilli=Date.parse(Today);
Today.setTime(nomilli+nodays*24*60*60*1000);
UTCstring = Today.toUTCString();
return UTCstring;
}

function getcookie(cookiename) {
 var cookiestring=""+document.cookie;
 var index1=cookiestring.indexOf(cookiename);
 if (index1==-1 || cookiename=="") return ""; 
 var index2=cookiestring.indexOf(';',index1);
 if (index2==-1) index2=cookiestring.length; 
 return unescape(cookiestring.substring(index1+cookiename.length+1,index2));
}
