function loadHoliday() {

	//figure out which swf file to load based on url
	var holidayUrl = window.document.location.href;
	var flashfile = "thd_holiday_container.swf";
	if(holidayUrl.indexOf("navidad") != -1) { 
		flashfile = "thd_holiday_container_esp.swf"; 
		window.document.title = "Decorando con la Sra. Claus / Pagina de inicio";
	}
		
	//get the query string params so we can pass it to flash
	var ecard = getParam("ec"); 
	var utm_source = getParam("utm_source");
	var client = getParam("client");
	var BV_SessionID = getParam("BV_SessionID");
	var BV_EngineID = getParam("BV_EngineID");
	
	//build the query string for flashvars 	
	var path = "localPath=@localPath@flash/&videoPath=video/";
	var queryString = path;
	if(ecard.length > 1) { queryString += "&ec=" + ecard; }
	if(client.length > 1) { queryString += "&client=" + client; }
	if(BV_SessionID.length > 1) { queryString += "&BV_SessionID=" + BV_SessionID; }
	if(BV_EngineID.length > 1) { queryString += "&BV_EngineID=" + BV_EngineID; }
	
	if(document.getElementById("flashcontent")) {
		//write out the flash
		var fo = new FlashObject("./flash/"+flashfile, "holiday", "100%", "100%", "7", "#FFFFFF");
		fo.addParam("FlashVars", queryString);
		fo.addParam("allowScriptAccess", "sameDomain");		
 		fo.write("flashcontent");	
	}
	resizeFlash();
}


function loadEmailCapture() {
	if(document.getElementById("flashcontent")) {
		//write out the flash
		var fo = new FlashObject("./flash/e_capture.swf", "email", "400", "250", "7", "#ffffff");
 		fo.write("flashcontent");	
	}
}

//default for small windows
function popUp(name,page,width,height) {
		popWin = window.open(page,name, "status=no,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=yes,height=" + height + "," + "width=" + width);
		popWin.focus();
}

//generic openWin that accepts parameter settings
function openWin(url,name,params) {
		theWin = window.open(url,name,params);
		theWin.focus();
}

//used to get a query string parameter based on name
function getParam(name)
{
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var tmpURL = window.location.href;
  var results = regex.exec( tmpURL );
  if( results == null )
    return "";
  else
    return results[1];
}

//used to resize flash based on the browser window size
function resizeFlash() { 
  var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
  var w = InternetExplorer ? document.body.clientWidth : window.innerWidth;
  var h = InternetExplorer ? document.body.clientHeight : window.innerHeight;

  // flash_resize.js from: http://www.mustardlab.com/developer/flash/objectresize/
  if( canResizeFlash() )
  {
	  if( h > 350 ) {
		setFlashHeight("flash-container", h);
	  } else {
		setFlashHeight("flash-container", 580);
	  }
	  if( w > 960 ) {
		setFlashWidth("flash-container", w);
	  } else {
		setFlashWidth("flash-container", 960);
	  }
  }
}

//supporting methods for resizing flash
function setFlashWidth(divid, newW){
	document.getElementById(divid).style.width = newW+"px";
}
function setFlashHeight(divid, newH){
	document.getElementById(divid).style.height = newH+"px";		
}
function setFlashSize(divid, newW, newH){
	setFlashWidth(divid, newW);
	setFlashHeight(divid, newH);
}
function canResizeFlash(){
	var ua = navigator.userAgent.toLowerCase();
	var opera = ua.indexOf("opera");
	if( document.getElementById ){
		if(opera == -1) return true;
		else if(parseInt(ua.substr(opera+6, 1)) >= 7) return true;
	}
	return false;
}

