
function MM_openBrWindow(theURL,winName,features) { //v2.0
  var popWin = window.open(theURL,winName,features);
}

function openWindow() {
    var url = "/en_US/dawn/dropandwin/age_validation.do";
    MM_openBrWindow(url, "game", "width=590, height=400");
}
/**
 * This is called from the Flash when the user clicks
 * the preview button.  Use the a, p, and b code 
 * to determine the correct URL to show.  This only
 * shows a single placeholder HTML file.
 * 
 * @a - the animal code
 * @p - the position code
 * @b - the background code
 * @fn - the sender's first name
 * @ln - the sender's last name
 */
function openPreview(a, p, b, fn, ln) {   
    var url = "/en_US/dawnsaveswildlife/previewEcard.do";
    url += "?a=" + a;
    url += "&p=" + p;
    url += "&b=" + b;
    url += "&fn=" + fn;    
    url += "&ln=" + ln;
    
 
  MM_openBrWindow(url, 'ecardPreview', 'width=498,height=489');
}

function openVideo(){
	var url="/en_US/dawnsaveswildlife/home/video/pop_video.html";
		window.open(url,"video","width=500, height=427");
}
function openTeaser(){
	var url="/en_US/dawnenvironment/home/video/pop_video_released.html";
		window.open(url,"video","width=500, height=427");
}
function openEpesode(episodenum){
	var url="/en_US/savingwildlife/episode.do";
	url +="?epnum="+episodenum;
		window.open(url,"video","width=500, height=475");
}
function selectImage(param){
	
	document.getElementById('image1').className = '';
	document.getElementById('image2').className = '';
	document.getElementById('image3').className = '';
	document.getElementById('image' + param).className = "selected";
	document.getElementById('stfFormSubmit').style.visibility='visible';
	document.getElementById('noStfFormSubmit').style.visibility='hidden';
	document.getElementById('hiddenfield').value= param;
	}

/**
 *
 * Cookie will be set for 44 years
 *
 */
function setCookie(name,value){
  var today = new Date();
  today.setTime( today.getTime() );
  // cookie will get set for 44 years
  var expires = 365*44 * 1000 * 60 * 60 * 24;
  var expires_date = new Date( today.getTime() + (expires) );
  document.cookie = name + "=" +escape( value ) +";expires="+expires_date.toGMTString();
} 

/**
 * This function will read the cookie and return the cookie value.
 *
 */
function readCookie(name){
  var start = document.cookie.indexOf( name + "=" );
  var len = start + name.length + 1;
  if ( ( !start ) &&
    ( name != document.cookie.substring( 0, name.length ) ) )
   {
   return null;
   }
   if ( start == -1 ) return null;
     var end = document.cookie.indexOf( ";", len );
     if ( end == -1 ) end = document.cookie.length;
   return unescape( document.cookie.substring( len, end ) );
}

/**
 *This function will be called by Send-Ecard flash.
 * It will check whether cookie with name "dawnsaveswildlife_dropcounter" is set or not.
 * If cookie is not set then it will set the cookie
 *
 */
function setEchoCookie(){

 var value = readCookie('dawnsaveswildlife_dropcounter');
 
 if(value == null){
  setCookie('dawnsaveswildlife_dropcounter','dropcounter_value_123456');
 }
}


//Bottle code javascript
function initBottleCode(){
document.getElementById('1').className="btldon_tab_blue";
document.getElementById('2').className="btldon_tab_blue";
document.getElementById('3').className="btldon_tab_blue";
document.getElementById('4').className="btldon_tab_blue";
document.getElementById('5').className="btldon_tab_blue";
}

function setdiv(id){
initBottleCode();
var selid=id;
document.getElementById(selid).className="btldon_tab_orange";
}

function rightnav(id){
var d = document.getElementById('btldon_cont');
if(document.getElementById('specialedt')!=null){
 d.removeChild(document.getElementById('specialedt'));
}
if(document.getElementById('directfoam')!=null){
 d.removeChild(document.getElementById('directfoam'));
}
if(document.getElementById('refills')!=null){
 d.removeChild(document.getElementById('refills'));
}
if(document.getElementById('5690oz')!=null){
 d.removeChild(document.getElementById('5690oz'));
}
if(document.getElementById('ineligible')!=null){
 d.removeChild(document.getElementById('ineligible'));
}
divname='image'+id;

document.getElementById('image1').style.display='none';
document.getElementById('image2').style.display='none';
document.getElementById('image3').style.display='none';
document.getElementById('image4').style.display='none';
document.getElementById('image5').style.display='none';

document.getElementById(divname).style.display='block';
document.forms[0].finalurl.value=id;
}