// <![CDATA[
function SI_normalizeWhiteSpace(txt) {
	var rE = /\s+/gi;
	return txt.replace(rE,' ');
	}

function SI_replaceHeadlines() {
	var d = document;
	// Check for Flash and the getElementsByTagname method...
	if (!SI_hasRequiredFlash() || !d.getElementsByTagName) return;

	// Path to our swfs. Should be absolute if the pages that use this function
	// are nested in different directory depths on the server. Relative here for
	// the sample.
	var swfDir = "http://www.campingpepe.com/swf/";
	
	// Grab an array of all the <h1> tags on our page
	var h1s = d.getElementsByTagName('h1');
	
	// Because we will be removing each h1 we encounter
	// our loop might seem a little backwards but it works
	for (var i=(h1s.length-1); i>=0; i--) {
		h1 = h1s[i];
		if (h1.parentNode.nodeName=='DIV') {
			div = h1.parentNode;
			if (div.id=='titular') {
				// We've established our location in the document tree
				// and determined this h1 to be fair game because it's
				// in the primary content
				var txt;
				txt = SI_normalizeWhiteSpace(h1.innerHTML);
				
				// Create our container element and add a
				// class so we have a style hook later
				var c = d.createElement('div');
				c.className = 'h1'
				
				// Swap out the h1 with our container
				h1.parentNode.replaceChild(c,h1);
				
				// Set our width and height of the generated movie
				var swfHTML,w=360,h=40;
				
				// Set the query string that passes our txt variable to our generated movie
				var fv	= 'txt='+txt;
				var swf	= 'txt.swf';
				
				// You shouldn't need to modify this part
				swfHTML  = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+w+'" height="'+h+'">';
				swfHTML += '	<param name="movie" value="'+swfDir+swf+'" />';
				swfHTML += '	<param name="flashvars" value="'+fv+'" />';
				swfHTML += '	<param name="wmode" value="transparent" />';
				swfHTML += '	<embed src="'+swfDir+swf+'" flashvars="'+fv+'" wmode="transparent" width="'+w+'" height="'+h+'" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" />';
				swfHTML += '<'+'/object>';
				
				// Drop our movie into the container
				c.innerHTML = swfHTML;
				txt='';
				}
			}
		}
	d.body.style.height = "1px";
	d.body.style.height = "auto";
	}

function SI_init() {
	SI_replaceHeadlines();
	} window.onload = SI_init;

// A distillation of http://www.kirupa.com/developer/mx/detection.htm
// and http://www.moock.org/webdesign/flash/detection/moockfpi/


var required = 6;
var hasRequired = false;
function SI_hasRequiredFlash() {
	var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"])?navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin:0;
	if (plugin) {
		var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
		var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
		var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
		hasRequired = flashVersion >= required;
		}
	return hasRequired;
	}
// ]]>

if(navigator.appVersion.indexOf("MSIE") != -1 && navigator.appVersion.indexOf("Windows") != -1){
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('hasRequired = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & required))) \n');  
	document.write('<'+'/scr' + 'ipt\> \n');
	}