// *****************************************
// FUCNTIONS FUER VOLKSWAGEN.DE
// *****************************************
// POSITIONIERUNG DES LAYERS und globale Variablen

		var posTop  = 200;
		var posLeft = 100;
		var psymaPopupURL = 'http://www.psyma-surveys.com/uc/abes_volkswagen/';
		var layercount =	'';
		var fadeLayerIn  = false;                                     // langsames einblenden --> true or false
		var layerTimer   =  800; 
    
		var imgEckeLinks  = "http://www.volkswagen.de/vwcms_publish/etc/medialib/vwcms/virtualmaster/com/misc/psyma.Par.0001.Image.gif";
		var imgEckeRechts = "http://www.volkswagen.de/vwcms_publish/etc/medialib/vwcms/virtualmaster/com/misc/psyma.Par.0002.Image.gif";
		var imgLogoVW     = "http://www.volkswagen.de/vwcms_publish/etc/medialib/vwcms/virtualmaster/com/misc/psyma.Par.0006.Image.gif";
		var imgLogoPsyma = "http://www.volkswagen.es/vwcms_publish/etc/medialib/vwcms/virtualmaster/es/javascript.Par.0006.Image.gif"; // Please enter here the URL of the Psyma logo
		var imgdot		  = "http://www.volkswagen.es/vwcms_publish/etc/medialib/vwcms/virtualmaster/es/javascript.Par.0004.Image.gif"; // Please enter here the URL of the dot.gif;
		var img_shadow	  = "http://www.volkswagen.es/vwcms_publish/etc/medialib/vwcms/virtualmaster/es/javascript.Par.0005.Image.gif"; // Please enter here the URL of the shadow.gif

		var psyma_cookie = true;                                      //  PSYMA COOKIE - ZUR LIVE-SCHALTUNG BITTE AKTIVIEREN!!!
		var samplingRate =  15;                                      // Wahrscheinlichkeit in Prozent, mit der ein PopUp aufgehen soll
		var rndNumber    = Math.round( 1 + 100 * (Math.random()) );   // Zufallzahl zwischen 0 und 100
		function psyma_init_layer(){} // dummy function
// ERSETZEN DER URSPRUENGLICHEN FUNCTION "showPopup()"
		function showPopup() {
				if ( rndNumber <= samplingRate ) {
            psyma_init_layer();
				}
		}

// NEU BESCHREIBEN DER BUEHNE MIT WMODE=TRANSPARENT
		function chgFlash() {
		    flashDiv = document.getElementsByTagName("object")[0].parentNode;
		    flashDivHTML = flashDiv.innerHTML;
		    // REPLACEN DER VERSCHIEDEN JAVASCRIPT-INTERPRETATIONEN DIV. BROWSER
		    flashDivHTMLRewritten = flashDivHTML.replace(/<PARAM NAME="LOOP" VALUE="false">/gi,'<PARAM NAME="LOOP" VALUE="false"><PARAM NAME="WMODE" VALUE="transparent">'); //IE
		    flashDivHTMLRewritten = flashDivHTMLRewritten.replace(/NAME="WMode" VALUE="Window"/gi,'NAME="WMode" VALUE="transparent"'); //IE
			flashDivHTMLRewritten = flashDivHTMLRewritten.replace(/NAME="Play" VALUE="0"/gi,'NAME="Play" VALUE="1"'); //IE
			//alert(flashDivHTMLRewritten);
        
// XML PATH AUSLESEN 
		if(flashDivHTMLRewritten.indexOf('xmldata=') > -1) {
	        xmlPath = flashDivHTMLRewritten.split('xmldata=');
	        xmlPathTemp = xmlPath[1].split('.xml');
	        xmlPathComplete = xmlPathTemp[0] + ".xml"
	        flashDivHTMLRewritten = flashDivHTMLRewritten.replace(/.swf"/gi,'.swf?xmldata='+xmlPathComplete+'"');
        }
		    flashDivHTMLRewritten = flashDivHTMLRewritten.replace(/loop="false"/gi,'loop="false" WMODE="transparent" '); // MOZ
			  flashDivHTMLRewritten = flashDivHTMLRewritten.replace(/LOOP="0"/gi,'loop="0" WMODE="transparent" '); // OPERA

			// Added by txus
			flashDivHTMLRewritten = flashDivHTMLRewritten.replace(/wmode="windows"/gi,' '); 

        //showContent(flashDivHTMLRewritten);

			  flashDiv.innerHTML = flashDivHTMLRewritten;
		}

// HILFSFUNCTION!!!  
    function showContent(cont) {
       var fenster = window.open("", "neu")
       if (fenster != null){
          with (fenster.document){
             open()
             write("<"+"HTML"+">")
             write("<"+"HEAD"+">")
             write("<"+"TITLE"+">Popup Maker"+"<"+"/TITLE"+">")
             write("<"+"/HEAD"+">")
             write("<"+"BODY BGCOLOR=#ffffff"+">")
             write("<"+"font style='font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-weight: normal; color: #000000;'"+">")
             write("<"+"textarea"+" cols=80 rows=30>"+cont+"<"+"/textarea"+">")
             write("<"+"br"+">")
             write("<"+"br"+">"+"<"+"br"+">")
             write("<"+"/BODY"+">"+"<"+"/HTML"+">")
             close()
          }
       }
    }
	
	
// *****************************************
// BEGIN PSYMA FUNCTIONS
// *****************************************	
<!--//--><![CDATA[//><!--

		var psyma_use_cookies = psyma_cookie;
		var psyma_launched = 0;
		var psyma_launched_cookie = "psyma_launched";
		var psyma_fade = true;
		
		var image1 = new Image();
		var image2 = new Image();
	
		image1.src = imgEckeLinks;
		image2.src = imgEckeRechts;


		function get_psyma_cookie(a) {
			if ( psyma_use_cookies ) {
				var c=document.cookie.split(a+"=");
				return (c.length>1)?unescape(c[1].split(";")[0]):"";
			} else
				return null;
		}

		// set cookie
		function set_psyma_cookie(name, value, path, domain, secure, expires) {
			if ( psyma_use_cookies ) {
				document.cookie =
				  name + "="
				  + escape(value)
				  + ((path) ? "; path=" + path : "")
				  + ((expires) ? "; expires=" + expires.toGMTString() : "")
				  + ((domain) ? "; domain=" + domain : "")
				  + ((secure) ? "; secure" : "");
			}
		}
		
		psyma_launched = get_psyma_cookie(psyma_launched_cookie);

		if ( psyma_launched != 1 &&  rndNumber <= samplingRate) 
		{
			function psyma_findLayer(name, doc) {
				var i, layer;
				var length = doc.layers.length;
				for (i = 0; i < length; i++) {
					layer = doc.layers[i];
					if (layer.name == name)	{
						return layer;
					}
					if (layer.document.layers.length > 0) {
						if ((layer = psyma_findLayer(name, layer.document)) != null) {
							return layer;
						}
					}
				}
				return null;
			}

		function psyma_showLayer(id) {
			// if (document.layers) document.layers[''+id+''].visibility = "show"
			if (document.layers) {
				id = psyma_findLayer(id, document);
				id.visibility = "show";
			} else if (document.all) {
				document.all[''+id+''].style.visibility = "visible";
			} else if (document.getElementById)	{
				document.getElementById(''+id+'').style.visibility = "visible";
			}				
		}

		function psyma_hideLayer(id) {
			// if (document.layers) document.layers[''+id+''].visibility = "hide"
			if (document.layers) {
				id = psyma_findLayer(id, document);
				id.visibility = "hide";
			} else if (document.all) {
				document.all[''+id+''].style.visibility = "hidden";
			} else if (document.getElementById)	{
				document.getElementById(''+id+'').style.visibility = "hidden";
			}				
		}

		function psyma_posLayer(id,lax,lay)	{
			if (lax) {
				if (document.layers) { document.layers[''+id+''].left = lax }
				else if (document.all) { document.all[''+id+''].style.left = lax }
				else if (document.getElementById) { document.getElementById(''+id+'').style.left = lax + "px" }
			}
			if (lay) {
				if (document.layers) { document.layers[''+id+''].top = lay }
				else if (document.all) { document.all[''+id+''].style.top = lay }
				else if (document.getElementById) { document.getElementById(''+id+'').style.top = lay + "px"}
			}
		}

		function psyma_button1() {
			psyma_hideLayer('psyma_layer');
			var psyma_width = window.screen.width;
			var psyma_height = window.screen.height - 100;
			if (psyma_width >= 1000)
				psyma_width = 1000;
			if (psyma_height >= 700)
				psyma_height = 700;
			var survey_window = window.open(psymaPopupURL, 'psyma_survey', 'toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=yes,width='+psyma_width+',height='+psyma_height+',top=0,left=0');
			if (survey_window)
				survey_window.opener.focus();
			return false;
		}

		function psyma_button2()
		{
			psyma_hideLayer('psyma_layer');
			return false;
		}

		function psyma_write_layer()
		{
			document.write('<style type="text/css">');
			document.write('#psyma_layer { display: block; visibility: hidden; z-index: 100000; position: absolute; top: 100px; left: 0px; width: 550px; font-family: Arial, Helvetica, sans-serif; font-size: 13px; background-color: #fff; color: #000000; border: 3px solid #9999A3; padding: 0; }');
			document.write('#psyma_layer p { font-family: Arial, Helvetica, sans-serif; font-size: 13px; padding: 0; margin: 0 0 10px 0; line-height: 105%; }');
			document.write('#psyma_layer #header-background { width: 100%; height: 50px; z-index: 0; background-color: #E6E6EB; }');
			document.write('#psyma_layer #header-background2 { width: 100%; height: 20px; z-index: 0; background: #9999A3  url('+img_shadow+') repeat-x 0 15px; }');
			document.write('#psyma_layer #titel { font-family: Arial, Helvetica, sans-serif; position: absolute; top: 28px; right: 20px; color: #000; background-color: none; font-size: 18px; font-weight: bold; z-index: 1; }');
			document.write('#psyma_layer #client-logo-li { position: absolute; top: 11px; left: 20px; padding: 0; margin: 0; text-align: center; width: auto; background: #fff url('+image1.src+') no-repeat top left; }');
			document.write('#psyma_layer #client-logo-re { padding: 0 15px 15px 15px; background: url('+image2.src+') no-repeat top right; }');
			document.write('#psyma_layer a:link, #psyma_layer a:active, #psyma_layer a:visited, #psyma_layer a:hover { font-size: 13px; font-family: Arial, Helvetica, sans-serif; color: #3C5F8C; text-decoration: underline; }');
			document.write('#psyma_layer a:hover { text-decoration: none; }');
			document.write('#psyma_layer a:link, #psyma_layer a:active, #psyma_layer a:visited, #psyma_layer a:hover { font-size: 13px; font-family: Arial, Helvetica, sans-serif; color: #3C5F8C; text-decoration: underline; }	#psyma_text { font-family: Arial, Helvetica, sans-serif; font-size: 13px; margin: 30px 20px 0px 20px; padding: 0; }');
			document.write('#psyma_text { text-align: left; font-family: Arial, Helvetica, sans-serif; font-size: 13px; margin: 50px 20px 0px 20px; padding: 0; }');
			document.write('#psyma_layer #psyma_liste { font-family: Arial, Helvetica, sans-serif; margin: 10px 20px 10px 20px; padding: 0 0 0 15px; list-style: square; font-size: 11px; }');
			document.write('#psyma_button table { border-collapse: collapse; margin: 5px 0 10px 0; }');
			document.write('#psyma_button td { font-family: arial; font-size: 13px; padding: 0; margin: 0; }');	
			document.write('#psyma_button .psyma_button_text { width: 100%; padding: 0 0 0 5px; background: #fff url('+imgdot+') repeat-x bottom left; }');
			document.write('#psyma_button a:link, #psyma_button a:active, #psyma_button a:visited, #psyma_button a:hover { font-size: 13px; display: block; width: 100px; text-align: center; text-decoration: none; color: #000; background-color: #E6E6EB; padding: 7px 5px; border: 1px solid #E6E6EB;}');	
			document.write('#psyma_button a:hover { color: #000; background-color: #fff; border: 1px solid #E6E6EB;}');
			document.write('#psyma_liste .link_small:link, #psyma_liste .link_small:active, #psyma_liste .link_small:visited, #psyma_liste .link_small:hover, #psyma_layer .link_small:link, #psyma_layer .link_small:active, #psyma_layer .link_small:visited, #psyma_layer .link_small:hover { font-size: 11px; font-family: Arial, Helvetica, sans-serif; color: #3C5F8C; text-decoration: underline; }');
			document.write('#psyma_liste li { text-align: left; font-size: 11px; }');
			document.write('#psyma_layer #psyma_logo { margin: -10px 0 10px 0; padding: 0 20px 0 10px; float: right; }');
			document.write('</style>');
			document.write('<div id="psyma_layer">');
			document.write('<div id="header-background"></div>');
			document.write('<div id="header-background2"></div>');
			document.write('<div id="titel">¡Su opinión cuenta!</div>');
			document.write('<div id="client-logo-li"><div id="client-logo-re"><img src="'+imgLogoVW+'" alt="client logo"/></div></div>');
			document.write('<div style="position: absolute; top: 75px; right: 20px;"><a href="#" onclick="psyma_hideLayer(\'psyma_layer\'); return false;">cerrar</a></div>');
			document.write('<div id="psyma_text">');
			document.write('<p>Querido visitante,</p>');
			document.write('<p>Si es la <u>primera vez</u> en nuestra página o ya ha visitado la página <u>varias veces</u>, apreciamos su opinión para ayudarnos a mejorar nuestra página web. </p>');
			document.write('<p>¿Le gustaría participar en una encuesta online (solo 8-10 minutos)? </p>');
			document.write('<div id="psyma_button">');
			document.write('<table>');
			document.write('<tr>');
			document.write('<td><a id="psyma_button1" href="#" onclick="psyma_button1();">Sí,</a></td>');
			document.write('<td class="psyma_button_text">Quiero participar después de visitar el sitio web.</td>');
			document.write('</tr>');
			document.write('</table>');
			document.write('<table>');
			document.write('<tr>');
			document.write('<td><a id="psyma_button2" href="#" onclick="psyma_button2();">No, gracias</a></td>');
			document.write('<td class="psyma_button_text">No quiero participar.</td>');
			document.write('</tr>');
			document.write('</table>');    
			document.write('</div>');			
			document.write('<p style="clear: both;"></p>');
			document.write('<a href="#" onclick="window.open(\'http://www.psyma-statistics.com/documents/wtp.php?lang=es_no_prize\', \'por_wtp\', \'toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=yes,width=500,height=400,top=0,left=0\'); return false;">&iquest;Por qu&eacute; participar?</a>');
			document.write('</div>');
			document.write('<div id="psyma_logo"><img src="'+imgLogoPsyma+'" alt="Psyma Online Research"/></div>');
			document.write('<ul id="psyma_liste">');
			document.write('<li>Realizado para Volkswagen por <a class="link_small" href="#" onclick="window.open(\'http://www.psyma-statistics.com/documents/por.php?lang=es\', \'por_info\', \'toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=yes,width=500,height=400,top=0,left=0\'); return false;">Psyma Research+Consulting</a>.</li>');
			document.write('<li><a class="link_small" href="#" onclick="window.open(\'http://www.psyma-statistics.com/documents/privacy.php?lang=es\', \'psyma_privacy\', \'toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=yes,width=500,height=610,top=0,left=0\'); return false;">Garantizamos la confidencialidad de sus datos</a></li>');
			document.write('</ul>');
			document.write('<img src="'+layercount+'" width="1" height="1" style="visibility: hidden;"/>');
			document.write('</div>');
		}

			// fade script thanks to Richard Rutter
			function psyma_initObject(id) {
				
			  objectId = id;
			  object = document.getElementById(objectId);
        if (fadeLayerIn) {
			    psyma_setOpacity(object, 0);
        }
			  object.style.visibility = 'visible';
        if ((document.getElementsByTagName("object")[0] != undefined) || (document.getElementsByTagName("object")[0] != null)) {
          chgFlash();
        }
        setTimeout("psyma_fadeIn(objectId,0)",layerTimer);
//			  psyma_fadeIn(objectId,0);
			}

			function psyma_setOpacity(obj, opacity) {
			  opacity = (opacity == 100)?99.999:opacity;
			  
			  // IE/Win
			  obj.style.filter = "alpha(opacity:"+opacity+")";
			  
			  // Safari<1.2, Konqueror
			  obj.style.KHTMLOpacity = opacity/100;
			  
			  // Older Mozilla and Firefox
			  obj.style.MozOpacity = opacity/100;
			  
			  // Safari 1.2, newer Firefox and Mozilla, CSS3
			  obj.style.opacity = opacity/100;
			}

			function psyma_fadeIn(objId,opacity) {
			  if (document.getElementById) {
				obj = document.getElementById(objId);
				if (fadeLayerIn && (opacity <= 100)) {
				  psyma_setOpacity(obj, opacity);
				  opacity += 5;
				  window.setTimeout("psyma_fadeIn('"+objId+"',"+opacity+")", 3);
				}
				else {
				  obj.style.visibility = "visible";
				}
			  }
			}
			
		function psyma_init_layer()
		{
			var myWidth = 0, myHeight = 0;

			if( typeof( window.innerWidth ) == 'number' )
			{

				//Non-IE
				myWidth = window.innerWidth;
				myHeight = window.innerHeight;
			} 
			else if ( document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight) )
			{
				//IE 6+ in 'standards compliant mode'
				myWidth = document.documentElement.clientWidth;
				myHeight = document.documentElement.clientHeight;
			}
			else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
			{
				//IE 4 compatible
				myWidth = document.body.clientWidth;
				myHeight = document.body.clientHeight;
			}

			poswidth = (780 - 550) / 2;
			psyma_posLayer("psyma_layer", poswidth, 30);
			if ( psyma_fade && navigator.userAgent.indexOf("Netscape") < 0 )
				{
					psyma_initObject("psyma_layer");
				}
				else
					psyma_showLayer("psyma_layer");

			set_psyma_cookie(psyma_launched, 1, "/", "", "", "")
		}

		psyma_write_layer();
		
		// function to be called on script execution -- cache existing function
		
		if (window.onload)
		{
			cached_onload = window.onload;
			window.onload = new Function(				
				"new_onload",
				"psyma_init_layer();" +			
				"cached_onload();" +
				""
			);
		}
		else
		{
			window.onload = psyma_init_layer;
		}

	} // end of if psyma_participation



//--><!]]>