Warning: opendir(header-img) [function.opendir]: failed to open dir: No such file or directory in /var/www/vhosts/viajesmarimartur.com/httpdocs/utils/functions.php.inc on line 1410
var headerImgs = Array();
var headerTimeout;
function precarga() {
if (!document.images) return;
var ar = new Array();
var arguments = precarga.arguments;
for (var i = 0; i < arguments.length; i++) {
ar[i] = new Image();
ar[i].src = arguments[i];
}
}
function setOpacity(obj, opacity) {
opacity = (opacity == 100)?99.999:opacity;
if (obj != null) {
// 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 mifadeOut(objId,opacity) {
if (document.getElementById) {
obj = document.getElementById(objId);
if(opacity >= 20) {
setOpacity(obj, opacity);
opacity -= 6;
headerTimeout = setTimeout("mifadeOut('"+objId+"',"+opacity+")", 70);
} else {
if('SECUANCIAL' == 'SECUANCIAL'){
obj.style.backgroundImage = "url('"+headerImgs[headerCont]+"')";
obj.myUrl = headerImgs[headerCont];
mifadeIn(objId,opacity);
headerCont = (headerCont + 1)%headerImgs.length;
headerTimeout = setTimeout("mifadeOut('"+objId+"', 100)", 4000);
} else if('SECUANCIAL' == 'RANDOM'){
obj.style.backgroundImage = "url('"+headerImgs[headerCont]+"')";
obj.myUrl = headerImgs[headerCont];
mifadeIn(objId,opacity);
var tempCont = headerCont;
while(tempCont == headerCont){
tempCont = Math.floor(headerImgs.length*Math.random());
}
headerCont = tempCont;
headerTimeout = setTimeout("mifadeOut('"+objId+"', 100)", 6000);
}
}
}
}
function mifadeIn(objId,opacity) {
if (document.getElementById) {
obj = document.getElementById(objId);
if (opacity <= 100) {
setOpacity(obj, opacity);
opacity += 6;
headerTimeout = setTimeout("mifadeIn('"+objId+"',"+opacity+")", 70);
}
}
}
function mifadeOutFirst(){
obj = document.getElementById('header-img');
obj.style.backgroundImage = "url('"+headerImgs[headerCont]+"')";
obj.style.cursor='pointer';
obj.myUrl = headerImgs[headerCont];
Event.observe('header-img','click',function($event){
var partes = this.myUrl.split("/");
ruta = partes[(partes.length-1)];
partes = ruta.split(".");
var temp=''
for(var i=0;i<(partes.length-1);i++){
temp+=partes[i];
}
new Ajax.Request("header-links/"+temp+".txt", {
method: 'get',
onSuccess: function(transport) {
window.location.href=transport.responseText;
},
onError : function(error){
alert("error : "+error);
}
});
})
mifadeIn('header-img',50);
headerCont = (headerCont + 1)%headerImgs.length;
headerTimeout = setTimeout("mifadeOut('header-img', 100)", 5000);
}
headerCont = Math.floor(headerImgs.length*Math.random());
window.onload = mifadeOutFirst;