//Si estamos en un mode, el valor de flashUrl sera diferente segun el mode.

function switch_modes(mode, flashUrl, language,imp_voucher){
	switch(mode) {
		case "PROM":
			document.write('<img src=\"/img/home/Lisboa21_' + language + '.jpg\" />');
			display_flash = false;
		break;
		case "MATINEE":
			document.write('<img src=\"/img/matinee/matinee_' + language + '.gif\" />');
			display_flash = false;
		break;
		case "TOOLBAR":
			flashUrl = 'img/home/home_toolbar.swf';
		break;
		case "CARS":
			flashUrl = 'img/home/flydrive.swf';
		break;
		case "SORRY":
			flashUrl = 'img/home/mil_disculpas_' + language + '.swf';
		break;
		case "FINDE":
			flashUrl = 'img/home/new_nubes_' + language + '.swf';
		break;
		case "RMADRID2":
			flashUrl = 'img/home/banner_rmadrid.swf';
		break;
		case "DNUP":
			flashUrl = 'img/DNUP/banner_' + language + '.swf';
		break;
		case "PR20":
			flashUrl = 'img/PR20/bannercentral_' + language + '.swf';
		break;
		case "PR30":
			flashUrl = 'img/PR30/banner_' + language + '.swf';
		break;
		case "CDGAMS":
			flashUrl = 'img/home/bannercentral_cdgmxp_' + language + '.swf';
		break;
		case "PARES":
			flashUrl = 'img/home/banner_central_PARES_' + language + '.swf';
		break;
		case "DTO20":
			flashUrl = 'img/home/banner_central_DTO20_' + language + '.swf';
		break;
		case "GM":
			flashUrl = 'img/home/getmemeber_' + language + '.swf';
		break;
		case "VCE":
			flashUrl = 'img/home/venecia_' + language + '.swf';
		break;
		case "20M":
			flashUrl = 'img/home/MODE_20MINUTES.swf';
		break;
		case "SMS":
			flashUrl = 'promo_sms/img/antena3.swf';
		break;
		case "INTR":
			flashUrl = 'img/home/promocion_interna.swf';
		break;
		case "JOVE":
			flashUrl = 'img/JOVE/carnet_jove.swf';
		break;
		case "MRTR":
			flashUrl = 'img/home/holiday_children_' + language + '.swf';
		break;
		case "CSSV":
			flashUrl = 'img/home/sevillacasablanca_' + language + '.swf';
		break;
		case "CANY":
			flashUrl = 'img/home/newyear_' + language + '.swf';
		break;
		case "WEEK":
		case "WEEK50":	
			flashUrl = 'img/home/weekenders_' + language + '.swf';
		break;
		case "BTL1":
		case "BTL":
			if (imp_voucher != "") {
				flashUrl = 'img/home/summer_' + language + '_' + imp_voucher + '.jpg';
			} else {
				flashUrl = 'img/home/' + flashfile;
			}
		break;
		default:
			flashUrl = flashUrl;
	}
	return flashUrl;
}
//Funcion para cargar el flash. 
function carregar_flash(flashUrl, transparent, language, mode_php, flashjpg, width_swf, height_swf, imp_voucher){
	var display_flash = true;
	mode_php = mode_php.toUpperCase();
	language= language.toUpperCase();
	if (mode_php!=''){
		flashUrl = switch_modes(mode_php, flashUrl, language, imp_voucher);
	}
	if (display_flash == true){
		var flashUrl_without_swf = flashUrl.split(".swf");
		flashUrl=flashUrl_without_swf[0];
		
		// -----------------------------------------------------------------------------
		// Globals
		// Major version of Flash required
		var requiredMajorVersion = 6;
		// Minor version of Flash required
		var requiredMinorVersion = 0;
		// Minor version of Flash required
		var requiredRevision = 0;
		// -----------------------------------------------------------------------------
		// 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  (mode_php=="BTL" || mode_php=="BTL1"){
			
			document.write('<a href="/offers/offer.php?language='+language+'" onclick="vuelingTracker._trackEvent("Botones Home "'+language+', "NoFlash", "Banner Default")"><img src="'+flashUrl+'" width='+width_swf+' height='+height_swf+' border="0" alt="Vueling">');
			return;
		}
		if (hasReqestedVersion) {
			//determine if the parent window is secure
			var loc = new String(window.parent.document.location);
			if (loc.indexOf("https://")!= -1){
				prefix = "https://";
			}
			else{
				prefix = "http://";
			}
			// if we've detected an acceptable version
			// embed the Flash Content SWF when all tests are passed
			AC_FL_RunContent(
						"src", flashUrl,
						"width", width_swf,
						"height", height_swf,
						"align", "middle",
						"id", flashUrl,
						"quality", "high",
						"wmode", transparent,
						"bgcolor", "#FFFFFF",
						"name", flashUrl,
						"allowScriptAccess","sameDomain",
						"type", "application/x-shockwave-flash",
						'codebase', prefix + 'fpdownload.macromedia.com/get/flashplayer/current/swflash.cab',
						"pluginspage", prefix + "www.adobe.com/go/getflashplayer"
			);
		} else {  // flash is too old or we can't detect the plugin
			document.write('<a href="/offers/offer.php?language='+language+'" onclick="vuelingTracker._trackEvent("Botones Home "'+language+', "NoFlash", "Banner Default")><img src="/img/home/'+flashjpg+'" width='+width_swf+' height='+height_swf+' border="0" alt="Vueling"></a>');
		}			
	}
}





/*funcion flash promo*/

function carregar_flash_promo(flashUrl, transparent, language, mode_php, flashjpg, width_swf, height_swf, imp_voucher){
	var display_flash = true;
	mode_php = mode_php.toUpperCase();
	language= language.toUpperCase();
	if (mode_php!=''){
		flashUrl = switch_modes(mode_php, flashUrl, language, imp_voucher);
	}
	if (display_flash == true){
		var flashUrl_without_swf = flashUrl.split(".swf");
		flashUrl=flashUrl_without_swf[0];
		
		// -----------------------------------------------------------------------------
		// Globals
		// Major version of Flash required
		var requiredMajorVersion = 6;
		// Minor version of Flash required
		var requiredMinorVersion = 0;
		// Minor version of Flash required
		var requiredRevision = 0;
		// -----------------------------------------------------------------------------
		// 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  (mode_php=="BTL" || mode_php=="BTL1"){
			document.write('<img src="'+flashUrl+'" width='+width_swf+' height='+height_swf+' border="0" alt="Vueling">');
			return;
		}
		if (hasReqestedVersion) {
			// if we've detected an acceptable version
			// embed the Flash Content SWF when all tests are passed
			AC_FL_RunContent(
						"src", flashUrl,
						"width", width_swf,
						"height", height_swf,
						"align", "middle",
						"id", flashUrl,
						"quality", "high",
						"wmode", transparent,
						"bgcolor", "#FFFFFF",
						"name", flashUrl,
						"allowScriptAccess","sameDomain",
						"type", "application/x-shockwave-flash",
						'codebase', 'http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab',
						"pluginspage", "http://www.adobe.com/go/getflashplayer"
			);
		} else {  // flash is too old or we can't detect the plugin
			document.write('<a href="/offers/offer_happy.php?language='+language+'" onclick="vuelingTracker._trackEvent("Botones Home "'+language+', "NoFlash", "Ofertas Default")><img src="/img/home/'+flashjpg+'" width='+width_swf+' height='+height_swf+' border="0" alt="Vueling"></a>');
		}			
	}
}

/*fin funcion flash promo*/






/*funcion para banner lateral*/

function carregar_flash_lateral(flashUrl, transparent, language, mode_php, flashjpg, width_swf, height_swf, imp_voucher){
	var display_flash = true;
	mode_php = mode_php.toUpperCase();
	language= language.toUpperCase();
	if (mode_php!=''){
		flashUrl = switch_modes(mode_php, flashUrl, language, imp_voucher);
	}
	if (display_flash == true){
		var flashUrl_without_swf = flashUrl.split(".swf");
		flashUrl=flashUrl_without_swf[0];
		
		// -----------------------------------------------------------------------------
		// Globals
		// Major version of Flash required
		var requiredMajorVersion = 6;
		// Minor version of Flash required
		var requiredMinorVersion = 0;
		// Minor version of Flash required
		var requiredRevision = 0;
		// -----------------------------------------------------------------------------
		// 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  (mode_php=="BTL" || mode_php=="BTL1"){
			document.write('<img src="'+flashUrl+'" width='+width_swf+' height='+height_swf+' border="0" alt="Vueling">');
			return;
		}
		if (hasReqestedVersion) {
			// if we've detected an acceptable version
			// embed the Flash Content SWF when all tests are passed
			AC_FL_RunContent(
						"src", flashUrl,
						"width", width_swf,
						"height", height_swf,
						"align", "middle",
						"id", flashUrl,
						"quality", "high",
						"wmode", transparent,
						"bgcolor", "#FFFFFF",
						"name", flashUrl,
						"allowScriptAccess","sameDomain",
						"type", "application/x-shockwave-flash",
						'codebase', 'http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab',
						"pluginspage", "http://www.adobe.com/go/getflashplayer"
			);
		} else {  // flash is too old or we can't detect the plugin
			document.write('<a href="/offers/offer.php?language='+language+'"><img src="/img/home/'+flashjpg+'" width='+width_swf+' height='+height_swf+' border="0" alt="Vueling"></a>');
		}			
	}
}

/*fin funcion para banner lateral*/



