/***************************/
/**
 * FlashObject v1.2.3: Flash detection and embed - http://blog.deconcept.com/flashobject/
 *
 * FlashObject is (c) 2005 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof com == "undefined") var com = new Object();
if(typeof com.deconcept == "undefined") com.deconcept = new Object();
if(typeof com.deconcept.util == "undefined") com.deconcept.util = new Object();
if(typeof com.deconcept.FlashObjectUtil == "undefined") com.deconcept.FlashObjectUtil = new Object();
com.deconcept.FlashObject = function(swf, id, w, h, ver, c, useExpressInstall, quality, redirectUrl, detectKey){
   this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
   this.skipDetect = com.deconcept.util.getRequestParameter(this.DETECT_KEY);
   this.params = new Object();
   this.variables = new Object();
   this.attributes = new Array();

   if(swf) this.setAttribute('swf', swf);
   if(id) this.setAttribute('id', id);
   if(w) this.setAttribute('width', w);
   if(h) this.setAttribute('height', h);
   if(ver) this.setAttribute('version', new com.deconcept.PlayerVersion(ver.toString().split(".")));
   if(c) this.addParam('bgcolor', c);
   var q = quality ? quality : 'high';
   this.addParam('quality', q);
   this.setAttribute('redirectUrl', '');
   if(redirectUrl) this.setAttribute('redirectUrl', redirectUrl);
   if(useExpressInstall) {
   // check to see if we need to do an express install
   var expressInstallReqVer = new com.deconcept.PlayerVersion([6,0,65]);
   var installedVer = com.deconcept.FlashObjectUtil.getPlayerVersion();
      if (installedVer.versionIsValid(expressInstallReqVer) && !installedVer.versionIsValid(this.getAttribute('version'))) {
         this.setAttribute('doExpressInstall', true);
      }
   } else {
      this.setAttribute('doExpressInstall', false);
   }
}
com.deconcept.FlashObject.prototype.setAttribute = function(name, value){
	this.attributes[name] = value;
}
com.deconcept.FlashObject.prototype.getAttribute = function(name){
	return this.attributes[name];
}
com.deconcept.FlashObject.prototype.getAttributes = function(){
	return this.attributes;
}
com.deconcept.FlashObject.prototype.addParam = function(name, value){
	this.params[name] = value;
}
com.deconcept.FlashObject.prototype.getParams = function(){
	return this.params;
}
com.deconcept.FlashObject.prototype.getParam = function(name){
	return this.params[name];
}
com.deconcept.FlashObject.prototype.addVariable = function(name, value){
	this.variables[name] = value;
}
com.deconcept.FlashObject.prototype.getVariable = function(name){
	return this.variables[name];
}
com.deconcept.FlashObject.prototype.getVariables = function(){
	return this.variables;
}
com.deconcept.FlashObject.prototype.getParamTags = function(){
   var paramTags = ""; var key; var params = this.getParams();
   for(key in params) {
        paramTags += '<param name="' + key + '" value="' + params[key] + '" />';
    }
   return paramTags;
}
com.deconcept.FlashObject.prototype.getVariablePairs = function(){
	var variablePairs = new Array();
	var key;
	var variables = this.getVariables();
	
	for(key in variables){
		variablePairs.push(key +"="+ variables[key]);
	}
	return variablePairs;
}
com.deconcept.FlashObject.prototype.getHTML = function() {
    var flashHTML = "";
    if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
        if (this.getAttribute("doExpressInstall")) { this.addVariable("MMplayerType", "PlugIn"); }
        flashHTML += '<embed type="application/x-shockwave-flash" wmode="transparent" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" id="'+ this.getAttribute('id') + '" name="'+ this.getAttribute('id') +'"';
		var params = this.getParams();
        for(var key in params){ flashHTML += ' '+ key +'="'+ params[key] +'"'; }
		pairs = this.getVariablePairs().join("&");
        if (pairs.length > 0){ flashHTML += ' flashvars="'+ pairs +'"'; }
        flashHTML += '></embed>';
    } else { // PC IE
        if (this.getAttribute("doExpressInstall")) { this.addVariable("MMplayerType", "ActiveX"); }
        flashHTML += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" id="'+ this.getAttribute('id') +'">';
        flashHTML += '<param name="movie" value="' + this.getAttribute('swf') + '" />';
        
        flashHTML += '<param name="wmode" value="transparent" />';
		
		var tags = this.getParamTags();
        if(tags.length > 0){ flashHTML += tags; }

		var pairs = this.getVariablePairs().join("&");
		
        if(pairs.length > 0){ flashHTML += '<param name="flashvars" value="'+ pairs +'" />'; }
        
        flashHTML += '</object>';
    }
    return flashHTML;
}
com.deconcept.FlashObject.prototype.write = function(elementId){
	if(this.skipDetect || this.getAttribute('doExpressInstall') || com.deconcept.FlashObjectUtil.getPlayerVersion().versionIsValid(this.getAttribute('version'))){
		if(document.getElementById){
		   if (this.getAttribute('doExpressInstall')) {
		      this.addVariable("MMredirectURL", escape(window.location));
		      document.title = document.title.slice(0, 47) + " - Flash Player Installation";
		      this.addVariable("MMdoctitle", document.title);
		   }
		   	if (typeof elementId == 'string') document.getElementById(elementId).innerHTML = this.getHTML();
		   	else elementId.innerHTML = this.getHTML();
		}
	}else{
		if(this.getAttribute('redirectUrl') != "") {
			document.location.replace(this.getAttribute('redirectUrl'));
		}
	}
}
/* ---- detection functions ---- */
com.deconcept.FlashObjectUtil.getPlayerVersion = function(){
   var PlayerVersion = new com.deconcept.PlayerVersion(0,0,0);
	if(navigator.plugins && navigator.mimeTypes.length){
		var x = navigator.plugins["Shockwave Flash"];
		if(x && x.description) {
			PlayerVersion = new com.deconcept.PlayerVersion(x.description.replace(/([a-z]|[A-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
		}
	}else if (window.ActiveXObject){
	   try {
   	   var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
   		PlayerVersion = new com.deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
	   } catch (e) {}
	}
	return PlayerVersion;
}
com.deconcept.PlayerVersion = function(arrVersion){
	this.major = parseInt(arrVersion[0]) || 0;
	this.minor = parseInt(arrVersion[1]) || 0;
	this.rev = parseInt(arrVersion[2]) || 0;
}
com.deconcept.PlayerVersion.prototype.versionIsValid = function(fv){
	if(this.major < fv.major) return false;
	if(this.major > fv.major) return true;
	if(this.minor < fv.minor) return false;
	if(this.minor > fv.minor) return true;
	if(this.rev < fv.rev) return false;
	return true;
}
/* ---- get value of query string param ---- */
com.deconcept.util.getRequestParameter = function(param){
	var q = document.location.search || document.location.href.hash;
	if(q){
		var startIndex = q.indexOf(param +"=");
		var endIndex = (q.indexOf("&", startIndex) > -1) ? q.indexOf("&", startIndex) : q.length;
		if (q.length > 1 && startIndex > -1) {
			return q.substring(q.indexOf("=", startIndex)+1, endIndex);
		}
	}
	return "";
}

/* add Array.push if needed (ie5) */
if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }}

/* add some aliases for ease of use / backwards compatibility */
var getQueryParamValue = com.deconcept.util.getRequestParameter;
var FlashObject = com.deconcept.FlashObject;
/*************************************************************/



function getParam(name){
    var loc = location.search;
    
    var pos = loc.indexOf(name);
    
    if (pos < 0) return null;
    
    var len = pos+name.length+1;
    
    var param = loc.substring(len);
    
    if (param.indexOf('&') > 0) param = param.substring(0, param.indexOf('&'));
    
    return param;
    
}



var idioma_c    = getParam('idioma');

var tipus       = getParam('tipus');

var iLocalNumberImg;

var idioma;

if (idioma_c == 'catala') idioma_c = 'CA';
if (idioma_c == 'castella') idioma_c = 'ES';
if (idioma_c == 'english') idioma_c = 'EN';

if (idioma_c == null) idioma_c = 'ES'//'CA'; /* CA ? ES ? EN */ 
if (tipus == null) iLocalNumberImg = 0;
else{
    iLocalNumberImg = parseInt(tipus, 10);
}

var idioma_env;

switch(idioma_c){
    case 'CA':
        idioma_env = 'catala';
        break;
    case 'ES':
        idioma_env = 'castella';
        break;
    case 'EN':
        idioma_env = 'english';
        break;
    default:
        idioma_env = 'catala';
        break;           
}

var installedVer = com.deconcept.FlashObjectUtil.getPlayerVersion();
var isFlashEnabled = installedVer.versionIsValid({major: 6, minor: 0});

if(!isFlashEnabled) window.location.href = 'noFlash.html?idioma='+idioma_c;

var PREVIEWTIPUS = null;

function getDiv(tipus){
var div;
	switch(tipus){
		case 1:
		case 2:
		case 3:	
			div = 1;
			break;
		case 4:
		case 5:
		case 6:
			div = 2;
			break;
	}
	
	return div;
}

function getElementByClassName(parent, tag, classname){
	var elms = parent.getElementsByTagName(tag);
	var elm;
	for (var i = 0; i < elms.length; i++){
		if (elms[i].className.lastIndexOf(classname) > -1){
			elm = elms[i];
			break;
		}
	}
	
	return elm;
}

function previewVideo(tipus){
	var div;
	if (PREVIEWTIPUS != null){
		div = getDiv(PREVIEWTIPUS);
		getElement('postalpreviewcolumn'+div).style.display = 'none';
		getElement('postalcolumn'+div).style.display = 'block';
		removePreview(PREVIEWTIPUS);
	}
	
	div = getDiv(tipus);

	getElement('postalpreviewcolumn'+div).style.display = 'block';
	getElement('postalcolumn'+div).style.display = 'none';
	
	createPreview(tipus);

	PREVIEWTIPUS = tipus;

}

function createPreview(tipus){
	var div = getDiv(tipus);
	var fo = new FlashObject("../swf/loader.swf", 'loader', 240, 180, '6', 'transparent');
	var canvas = getElementByClassName(getElement('postalpreviewcolumn'+div), 'div', 'flashHolder');
	fo.addVariable('tipus', tipus);
	fo.write(canvas);	
}

function removePreview(tipus){
	var div = getDiv(tipus);
	var rem = getElementByClassName(getElement('postalpreviewcolumn'+div), 'div', 'flashHolder');
	rem.innerHTML = '';	
}

function backPreviewVideo(){
	if (PREVIEWTIPUS == null) return false;
	removePreview(PREVIEWTIPUS);
	var div = getDiv(PREVIEWTIPUS);
	getElement('postalpreviewcolumn'+div).style.display = 'none';
	getElement('postalcolumn'+div).style.display = 'block';
	
	PREVIEWTIPUS = null;
	PREVIEWIDIOMA = null;	
}

function reviewVideo(){
	removePreview(PREVIEWTIPUS);
	createPreview(PREVIEWTIPUS);
}

function goToSendVideo(){
	if (PREVIEWTIPUS == null) return false;
	
	var url = '2h_postal.html'
	url+='?tipus='+PREVIEWTIPUS;
	url+='&idioma='+idioma_c;
	
	window.location.href = url; 
}


var peustextos = [
    'Vídeo de la senyora Rosa',
    'Vídeo de la señora Rosa',
    'Video of Ms Rose',
    'Vídeo del senyor Llibre',
    'Vídeo del señor Libro',
    'Video of Mr Book'
]



if (idioma_c == 'CA'){
    
    var textoshome = [
        'Aquest Sant Jordi et proposem que enviïs unes roses i uns llibres que faran que se\'n paaarli molt...',
        'Hola! Em dic Rosa i em pots enviar a qui tu ja saps... Segur que li farà molta il·lusió rebre una Rosa com jo!',
        'Hola! Em dic Antoni Llibre. Envia\'m a qui vulguis i jo m\'encarregaré de fer-li una sorpreseta...',
        'El vull tornar a veure.',
        'Envia-la a qui vulguis.',
        'Envia\'l a qui vulguis.',
        'Tornar'
    ];
    
    
    var textos = [
        'Per a qui és?',
        'Quina és la seva adreça de correu electrònic?',
        'Com et dius?',
        'Si us plau, escriu la teva adreça de correu electrònic.',
        'La hi dediques? (màx. 150 caràcters)',
        'L\'hi dediques? (màx. 150 caràcters)',
        'Envia\'l',
        'Previsualitza\'l'
    ];

	var errorMessages = {
		denom:          'No vols que sàpiga qui li envia?',
		demail:         'Escriu el teu e-mail per que et pugui donar les gràcies.',
		demailformat:   'La teva adreça de e-mail no sembla correcta.',
		anom:           'A qui li vols enviar?',
		amail:          'A on hem d\'enviar el teu regal?',
		amailformat:    'La seva adreça de e-mail no sembla correcta.',
		missatge:       'No vols dir-li res?'
	}; 
    
    var regal = {
        rosa:       'una rosa',
        llibre:     'un llibre'
    }
	
    var remitent    = 'L\'Ajuntament de Barcelona';
    var subject     = 'Feliç Sant Jordi';
    var idioma      = 'catala';
       
}

else if (idioma_c == 'ES'){
    
    var textoshome = [
        'Este Sant Jordi te proponemos que envíes unas rosas y unos libros que darán muuuuucho que hablar',
        '¡Hola! Me llamo Rosa y me puedes enviar a quien tú ya sabes… ¡Seguro que le hará mucha ilusión recibir una Rosa como yo!',
        '¡Hola! Me llamo Antonio Libro. Envíame a quien quieras y yo me encargaré de darle una sorpresita…',
        'Quiero verlo otra vez.',
        'Envíala a quien quieras.',
        'Envíalo a quien quieras.',
        'Volver'
    ];    
    
	var textos = [
		'¿Para quién es?',
		'¿Cuál es su dirección de correo electrónico?',
		'¿Cómo te llamas?',
		'Por favor, escribe tu dirección de correo electrónico.',
		'¿Se la dedicas? (máx. 150 caracteres)',
		'¿Se lo dedicas? (máx. 150 caracteres)',
		'Envíalo',
		'Visualízalo'	
	];

	var errorMessages = {
		denom:          '¿No quieres que sepa quien se lo envía?',
		demail:         'Escribe tu e-mail para que te pueda dar las gracias.',
		demailformat:   'Tu dirección de e-mail no parece correcta.',
		anom:           '¿A quién se lo quieres enviar?',
		amail:          '¿Dónde tenemos que enviar tu regalo?',
		amailformat:    'Su dirección de e-mail no parece correcta.',
		missatge:       '¿No quieres decirle nada?'	
	};
	
    var remitent    = 'Ayuntamiento de Barcelona';
    var subject     = 'Feliz Sant Jordi';
    var idioma      = 'castella';

    var regal = {
        rosa:       'una rosa',
        llibre:     'un libro'
    }    
}

else{
    
    var textoshome = [
        'This Sant Jordi we suggest you send roses or books, which everybody will be talking about...',
        'Hi. My name is Rose and you can send me to whoever you want to...  I\'m sure they will be happy to receive me...',
        'Hi. My name is Anthony Book. Send me to whoever you want to and I will give them a little surprise...',
        'Show it again.',
        'Send her to whoever you want.',
        'Send him to whoever you want.',
        'Back'
    ];    

    
	var textos = [
		'Who is it  for?',
		'What is their e-mail address?',
		'What is your name?',
		'Please write your e-mail address',
		'Do you want to write a message? (max 150 characters)',
		'Do you want to write a message? (max 150 characters)',
		'Send',
		'Preview'
	];

	var errorMessages = {
        denom:          'Don\'t want them to know who is sending this?',
        anom:           'Include your e-mail address so I\'ll be able to thank you.',
        demailformat:   'Your e-mail address doesn\'t seem to be correct.',
        anom:           'To whom do you want to send this?',
        amail:          'To what address are we sending your present?',
        amailformat:    'His or her e-mail address doesn\'t seem to be correct.',
        missatge:       'Don\'t want to say anything?'
	};
	
    var remitent    = 'Barcelona City Council';
    var subject     = 'Happy Sant Jordi';
    var idioma      = 'english';

    var regal = {
        rosa:       'a rose',
        llibre:     'a book'
    }    
}

function getNomRegal(){
    if (iLocalNumberImg < 4) return regal['rosa'];
    else return regal['llibre'];
}

if (idioma_c == 'CA') var saUrl = new Array("/www/BI/public_html/stjordi_06/htm","/www/BI/public_html/stjordi_06/postal/felicitacions/","http://www.bcn.es/stjordi_06/postal/felicitacions/","<a href=http://www.bcn.es/stjordi/postal/2h_postal.htm?idioma=CA&tipus="+tipus+".html>","<img src=http://www.bcn.es/stjordi/postals/imatges/postal/tornar_catala.gif ></a>","<img src=http://www.bcn.es/catala/laciutat/barcelona/imatges/tit_postals.gif>","<a href=http://www.bcn.es/catala/copyright/welcome.htm class=firma target=_top>&copy; Ajuntament de Barcelona.</a>","<img src=http://www.bcn.es/stjordi/swf/","<img src=http://www.bcn.es/stjordi/postals/imatges/postal/enviar_catala.gif>");
else
{
     if (idioma_c == 'ES') var saUrl = new Array("/www/BI/public_html/stjordi_06/htm","/www/BI/public_html/stjordi_06/postal/felicitacions/","http://www.bcn.es/stjordi_06/postal/felicitacions/","http://www.bcn.es/stjordi/postal/2h_postal.htm?idioma=ES&tipus="+tipus+".html","<img src=http://www.bcn.es/stjordi/postals/imatges/postal/tornar_castella.gif ></a>","<img src=/catala/laciutat/barcelona/imatges/tit_postals.gif>","<a href=http://www.bcn.es/catala/copyright/welcome.htm class=firma target=_top>&copy; Ajuntament de Barcelona.</a>","<img src=http://www.bcn.es/stjordi/swf/","<img src=http://www.bcn.es/stjordi/postals/imatges/postal/enviar_castella.gif>");	 
     else var saUrl = new Array("/www/BI/public_html/stjordi_06/htm","/www/BI/public_html/stjordi_06/postal/felicitacions/","http://www.bcn.es/stjordi_06/postal/felicitacions/","<a href=http://www.bcn.es/stjordi/postal/2h_postal.htm?idioma=EN&tipus="+tipus+".html>","<img src=http://www.bcn.es/stjordi/postals/imatges/postal/tornar_angles.gif ></a>","<img src=/catala/laciutat/barcelona/imatges/tit_postals.gif>","<a href=http://www.bcn.es/catala/copyright/welcome.htm class=firma target=_top>&copy; Ajuntament de Barcelona.</a>","<img src=http://www.bcn.es/stjordi/swf/","<img src=http://www.bcn.es/stjordi/postals/imatges/postal/enviar_angles.gif>");
}	

function send(){
    if (!checkForm()) return false;
    
    var f = fillForm();
    
    f.enviament.value = 'Enviar';
    
    f.submit();
}

function preview(){
    if (!checkForm()) return false;
    
    var f = fillForm();
    
    f.enviament.value = 'Veure';
    
    f.submit();
}

function checkForm(){
    var camps = [
        'anom',
        'amail',
        'denom',
        'demail',
        'missatge'
    ];
    
    var n = camps.length;
    
    for (var i = 0; i < n; i++){
        if (!checkField(camps[i])){
            var errorMessage = errorMessages[camps[i]];
            alert(errorMessage);
            return false;
        }
    }
    
    if (!validateMail('amail')){
        alert(errorMessages['amailformat']);
        return false;
    }
    
    if (!validateMail('demail')){
        alert(errorMessages['demailformat']);
        return false;
    }   
    
    return true; 
    
}

function checkField(name){
    var elm = document.enviamentForm[name];
    
    return (elm.value.length > 0);
}

function validateMail(name){
	var elm     = document.enviamentForm[name];
    var email   = elm.value;

	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	return filter.test(email);
}

function fillForm(){

    var f = document.enviamentForm;
    f.postal.value = "3h_postal"
    
    f.iNumberPostal.value = "postal"+iLocalNumberImg+".jpg";
    
    f.capcalera.value = f.anom.value+', '+f.denom.value+' t\'envia '+getNomRegal();//saTextos[12];
    
    f.pathpos.value = saUrl[0];   // URL fisica on hi ha el esquelet de la pagina que veura la persona que rep el correu electronic
    f.pathposma.value = saUrl[1]; // URL fisica on guarda el missatge
    f.urlpos.value = saUrl[2];    // URL on guarda el missatge
    f.UrlTornarJo.value = saUrl[3];
    f.UrlImatgeTornarJo.value = saUrl[4];		
    f.UrlImatgeTitol.value = saUrl[5];		
    f.UrlHrefCopyright.value = saUrl[6];		
    f.UrlImatge.value = saUrl[7]+f.iNumberPostal.value+" border=0 align=right>";
    f.UrlImatgePreviewEnviar.value = saUrl[8] ;
    
    return f;
}




/*****/
var sheets = document.styleSheets;
var lastSheet = sheets[sheets.length - 1];
var rules     = (lastSheet.cssRules) ? lastSheet.cssRules : lastSheet.rules;
var rLength   = rules.length;

for (var i = 0; i < rLength; i++){
	var cRule = rules[i];

	if (cRule.selectorText == '#postalformpreview'){
		if (iLocalNumberImg == 1 || iLocalNumberImg == 2 || iLocalNumberImg == 3){
	        cRule.style['background']   = 'transparent url(../imatges/postal/fonsrosa.jpg) 0 0 no-repeat';
		}
		else{
			cRule.style['background']   = 'transparent url(../imatges/postal/fonsllibre.jpg) 0 0 no-repeat';
		}
	}
}

function getElement(){
	var elms = new Array();
        
	var n = arguments.length;
        
	for (var i = 0; i < n; i++){
    	var elm = arguments[i];

    	if (typeof elm == 'string') elm = document.getElementById(elm);
            
    	if (n == 1) return elm;
            
    	elms.push(elm);
    }
        
    return elms;
}

function addEvent(elementObject, eventName, functionObject){
	var functions = Array.prototype.slice.apply(arguments, [2]);
	
	var elm = getElement(elementObject);

	for (var i = 0; i < functions.length; i++){

            if(document.addEventListener) elm.addEventListener(eventName, functions[i], false);
            else if(document.attachEvent) elm.attachEvent("on" + eventName, functions[i]);
    }
}


function setFlashMovies(){
	
	var canvas;
	
	if (getElement('postalcolumn1')){
		var fo1 = new FlashObject("http://www.bcn.es/stjordi/postals/swf/loopRosa.swf", 'postalcolumnswf1', 146, 134, '6', 'transparent');
		canvas = getElementByClassName(getElement('postalcolumn1'), 'div', 'flashHolder');
		fo1.write(canvas);
	}
	
	if (getElement('postalcolumn2')){
		var fo2 = new FlashObject("http://www.bcn.es/stjordi/postals/swf/loopLlibre.swf", 'postalcolumnswf2', 146, 134, '6', 'transparent');
		canvas = getElementByClassName(getElement('postalcolumn2'), 'div', 'flashHolder');		
		fo2.write(canvas);			
	}	

	if(getElement('flashMovie')){
		var fo3 = new FlashObject("http://www.bcn.es/stjordi/postals/swf/loader.swf", 'loader', 240, 180, '6', 'transparent');
		
		var numPostal = null;
		var img = getElement('dummyPostal');
		if (img){
			var path = img.src;
			var index = path.lastIndexOf('.');
			numPostal = path.substring(index-1, index);
		}		
		
		if (numPostal != null) fo3.addVariable('tipus', numPostal);
		else fo3.addVariable('tipus', 0);
		
		if (parseInt(numPostal, 10) < 4) getElement('bgvideo1').style.display = 'block';
		else getElement('bgvideo2').style.display = 'block';
				
		canvas = getElementByClassName(getElement('flashMovie'), 'div', 'flashHolder');
		getElement('flashMovie').style.display = 'block';
		fo3.write(canvas);	
		
		var env = document.getElementsByName('enviament');
		if (env.length > 0) getElement('menu').style.display = 'block';
		
		
		
		var str = '';
		
		numPostal = parseInt(numPostal, 10);

		
		switch(idioma_c){
		    case 'CA':
		        str = (numPostal < 4) ? "t'envia aquesta rosa des de" : 't\'envia aquest llibre des de';
		        break;
		    case 'ES':
		        str = (numPostal < 4) ? "te envía esta rosa desde" : 'te envía este libro desde';
		        break;
		    case 'EN':
		        str = (numPostal < 4) ? "sends you this rose from" : 'sends you this book from';
		        break;
		    
		}
		
		var nom = getElement('pdenom').innerHTML;
		var mail = getElement('pdemail').innerHTML;
		
		getElement('signatura').innerHTML = nom+' '+str+' '+mail;;
		
		
		var idioma;
		if (location.search.lastIndexOf('insite') < 0){
		    
		    if (numPostal == 1 || numPostal == 4) idioma = 'catala';
		    if (numPostal == 2 || numPostal == 5) idioma = 'castella';
		    if (numPostal == 3 || numPostal == 6) idioma = 'english';
		}
		else idioma = idioma_c;
		
		//getElement('barraHolder').innerHTML = getCap(idioma);
		//getElement('menuHolder').innerHTML = getMenu(idioma);
		//getElement('peuHolder').innerHTML = getPeu(idioma);
		
	}	
		
}


addEvent(window, 'load', setFlashMovies);
