
function init() {

reTarget();

}





// =================================================================

// FLACCESS v1.3 LITE (c)2004 Sergi Meseguer (http://zigotica.com/)

// For DOM browsers only and builds always on the fly (on call)

// Released under Creative Commons ShareAlike license: 

// http://creativecommons.org/licenses/by-sa/2.0/

// Check out http://meddle.dzygn.com/eng/tools/ or 

// http://meddle.dzygn.com/esp/utilidades/ for further info

// =================================================================



// Set this variable to 1 if you want to alert intermediate steps:

var flaccess_debug;



function checkFlash(min){

var version = 0;

if(!min) min = 10;

if (navigator.plugins)  { 

if(navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {

var desc = navigator.plugins["Shockwave Flash"].description;

version = parseInt(desc.substring(16)); 

}

else if(navigator.appVersion.indexOf("MSIE")>-1){ 

// loop by Geoff Stearns (geoff@deconcept.com, http://blog.deconcept.com/)

result = false;

   for(var i = min; i >= 3 && result != true; i--){

    execScript('on error resume next: result = IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.'+i+'"))','VBScript');

version = i;

}

}

}

return version;

}



function addFlash(minversion,path,width,height,node) {

if(!document.getElementById) return false;



// defining arguments (from arguments array) in object and embed elements:

var minargs = 5;

var objpars = '<param name="movie" value="'+path+'">';

var empars = ' src="'+path+'" ';

var align = '';

var flashid = '';

var salign = '';

var flvars = '';

var allowedObjParams = ["menu","play","quality","scale","devicefont","bgcolor","wmode","salign","base"];  

var allowedEmbParams = ["menu","play","quality","scale","devicefont","bgcolor","wmode","base","swliveconnect"]; 



for(var op=parseInt(arguments.length);op>minargs;op--) {

var tmp = arguments[op-1].split(":"); var tmpname = tmp[0];var tmpvalue = tmp[1];

if(allowedObjParams.indexOf(tmpname.toLowerCase()) >-1) { 

objpars += '<param name="'+tmpname+'" value="'+tmpvalue+'">';

}

if(allowedEmbParams.indexOf(tmpname.toLowerCase()) >-1) {

empars += ' '+tmpname+'="'+tmpvalue+'" ';

}

if(tmpname.toLowerCase() == "align") {

align = ' align="'+tmpvalue+'" ';

}

if(tmpname.toLowerCase() == "salign") {

salign = ' salign="'+tmpvalue+'" ';

}

if(tmpname.toLowerCase() == "flashvars") {

if(minversion>=6) flvars = tmpvalue;

else alert("flashVars support was not available until flash version 6");

}

}





if(checkFlash(minversion) >= minversion){

if(flaccess_debug==1) alert("minimum flash " + minversion + " is ok, we have version " + checkFlash())



// splits flash id and node id

var col = node.split(",");

var flid = col[0];

var parentid = col[1];

if(minversion>=6){

if(flvars!='') flvars += '&';

flvars += 'flid='+node;

objpars += '<param name="flashvars" value="'+flvars+'">';

}



// flash object:

var obj = '<object '+flashid+' id="'+flid+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+width+'" height="'+height+'" '+align+'>';

obj += objpars;

obj += '<embed src="'+path+'" name="'+flid+'" id="name'+flid+'" width="'+width+'" height="'+height+'"  '+empars+' type="application/x-shockwave-flash" '+align+' '+salign;

if(minversion>=6) obj += ' flashvars="'+flvars+'" ';

obj += ' pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>';

obj += '</object>'



if(flaccess_debug==1) alert(" flid: " + flid + "\n\n" + obj);



if(document.getElementById(parentid)) {

document.getElementById(parentid).innerHTML = obj;

document.getElementById(parentid).style.height = height+"px";

document.getElementById(parentid).style.width = width+"px";

}



}

else {

if(flaccess_debug==1) alert("we have version " + checkFlash() + " and we needed flash " + minversion)

}



}



// extending Array, by Aaron Boodman (youngpup.net):

Array.prototype.indexOf = function(foo) { 

for (var i = 0; i < this.length; i++)  

if (foo == this[i]) return i;  

return -1;  

}











/* +++++ AjaxTabs - Script para el cambio de fotos en portada +++++ */

/***********************************************

* Ajax Tabs Content script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)

* This notice MUST stay intact for legal use

* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code

***********************************************/





var bustcachevar=0 //bust potential caching of external pages after initial request? (1=yes, 0=no)

var loadstatustext="<div style='color:#b2b8b9; font-size: 11px;'><img src='images/cargando.gif' /> cargando ...</div>"



////NO NEED TO EDIT BELOW////////////////////////

var loadedobjects=""

var defaultcontentarray=new Object()

var bustcacheparameter=""



function ajaxpage(url, containerid, targetobj){

var page_request = false

if (window.XMLHttpRequest) // if Mozilla, Safari etc

page_request = new XMLHttpRequest()

else if (window.ActiveXObject){ // if IE

try {

page_request = new ActiveXObject("Msxml2.XMLHTTP")

} 

catch (e){

try{

page_request = new ActiveXObject("Microsoft.XMLHTTP")

}

catch (e){}

}

}

else

return false

var ullist=targetobj.parentNode.parentNode.getElementsByTagName("li")

for (var i=0; i<ullist.length; i++)

ullist[i].className=""  //deselect all tabs

targetobj.parentNode.className="selected"  //highlight currently clicked on tab

if (url.indexOf("#default")!=-1){ //if simply show default content within container (verus fetch it via ajax)

document.getElementById(containerid).innerHTML=defaultcontentarray[containerid]

return

}

document.getElementById(containerid).innerHTML=loadstatustext

page_request.onreadystatechange=function(){

loadpage(page_request, containerid)

}

if (bustcachevar) //if bust caching of external page

bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()

page_request.open('GET', url+bustcacheparameter, true)

page_request.send(null)

}



function loadpage(page_request, containerid){

if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))

document.getElementById(containerid).innerHTML=page_request.responseText

}



function loadobjs(revattribute){

if (revattribute!=null && revattribute!=""){ //if "rev" attribute is defined (load external .js or .css files)

var objectlist=revattribute.split(/\s*,\s*/) //split the files and store as array

for (var i=0; i<objectlist.length; i++){

var file=objectlist[i]

var fileref=""

if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding

if (file.indexOf(".js")!=-1){ //If object is a js file

fileref=document.createElement('script')

fileref.setAttribute("type","text/javascript");

fileref.setAttribute("src", file);

}

else if (file.indexOf(".css")!=-1){ //If object is a css file

fileref=document.createElement("link")

fileref.setAttribute("rel", "stylesheet");

fileref.setAttribute("type", "text/css");

fileref.setAttribute("href", file);

}

}

if (fileref!=""){

document.getElementsByTagName("head").item(0).appendChild(fileref)

loadedobjects+=file+" " //Remember this object as being already added to page

}

}

}

}



function savedefaultcontent(contentid){// save default ajax tab content

if (typeof defaultcontentarray[contentid]=="undefined") //if default content hasn't already been saved

defaultcontentarray[contentid]=document.getElementById(contentid).innerHTML

}



function startajaxtabs(){

for (var i=0; i<arguments.length; i++){ //loop through passed UL ids

var ulobj=document.getElementById(arguments[i])

var ulist=ulobj.getElementsByTagName("li") //array containing the LI elements within UL

for (var x=0; x<ulist.length; x++){ //loop through each LI element

var ulistlink=ulist[x].getElementsByTagName("a")[0]

if (ulistlink.getAttribute("rel")){

var modifiedurl=ulistlink.getAttribute("href").replace(/^http:\/\/[^\/]+\//i, "http://"+window.location.hostname+"/")

ulistlink.setAttribute("href", modifiedurl) //replace URL's root domain with dynamic root domain, for ajax security sake

savedefaultcontent(ulistlink.getAttribute("rel")) //save default ajax tab content

ulistlink.onclick=function(){

ajaxpage(this.getAttribute("href"), this.getAttribute("rel"), this)

loadobjs(this.getAttribute("rev"))

return false

}

if (ulist[x].className=="selected"){

ajaxpage(ulistlink.getAttribute("href"), ulistlink.getAttribute("rel"), ulistlink) //auto load currenly selected tab content

loadobjs(ulistlink.getAttribute("rev")) //auto load any accompanying .js and .css files

}

}

}

}

}