﻿// JScript File

function CambioImagen( elem, strImagen )
{
    document.getElementById(elem).setAttribute( "src", strImagen );
}

//function AbrirDialogo( elem )
//{
////    var strImagen = document.getElementById(elem).getAttribute( "src" );
//    var strImagen = elem;
//    var details = 'toolbar=no, resizable=no, scrollbars=no, titlebar=no, width=496, height=544';
////    var details = 'toolbar=no, resizable=no, scrollbars=no, titlebar=no';
//    window.open( strImagen, '', details );
//}

function AbrirImagen( strImagen )
{
    var details = 'toolbar=no, resizable=no, scrollbars=no, titlebar=no, width=496, height=544';
    window.open( strImagen, 'HDO', details );
}

function AbrirFormularioPedido( urlForm )
{
    var details = 'toolbar=no, resizable=no, scrollbars=no, titlebar=no, width=500, height=500';
    window.open( urlForm, 'HDOP', details );
}


var slideShowSpeed = 5000
var crossFadeDuration = 3
var Pic = new Array()
Pic[0] = 'headers/Encabezado1.jpg'
Pic[1] = 'headers/Encabezado2.jpg'
Pic[2] = 'headers/Encabezado4.jpg'
Pic[3] = 'headers/Encabezado6.jpg'
Pic[4] = 'headers/Encabezado8.jpg'
Pic[5] = 'headers/Encabezado10.jpg'
var t
var j = 0
var p = Pic.length
var preLoad = new Array()
for (i = 0; i < p; i++)
{
	preLoad[i] = new Image()
	preLoad[i].src = Pic[i]
}

function runSlideShow()
{
	if (document.all)
	{
		document.images.SlideShow.style.filter="blendTrans(duration=2)"
		document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)"
		document.images.SlideShow.filters.blendTrans.Apply()      
	}
	document.images.SlideShow.src = preLoad[j].src
	if (document.all)
	{
		document.images.SlideShow.filters.blendTrans.Play()
	}
	j = j + 1
	if (j > (p-1)) j=0
	t = setTimeout('runSlideShow()', slideShowSpeed)
}

var wait_id;
function OcultarMotivo()
{
    wait_id = setTimeout( 'OcultarMotivoConDelay()', 500 );
}

function OcultarMotivoConDelay()
{
    document.getElementById( "cinta_color" ).style.visibility = "hidden";
}

function MostrarMotivo(object, newsrc)
{
    var position = new Object;
    position.x = 0;
    position.y = 0;
    position = GetAbsPosition(object);
    var pru = 0;

    clearTimeout(wait_id); 

    position.x += 20;
    position.y += 20;
    document.getElementById( "cinta_color" ).style.visibility = "visible";
    document.getElementById( "cinta_color" ).style.left = position.x + "px";
    document.getElementById( "cinta_color" ).style.top = position.y + "px";
    
    document.getElementById( "cinta_leyenda" ).innerHTML = object.alt;
    document.getElementById( "cinta_imagen" ).src = newsrc;
    


//    document.getElementById( "cinta_imagen" ).src = "Colors/CintaAzulino.gif";
}

function GetAbsPosition(object)
{
    var position = new Object;
    position.x = 0;
    position.y = 0;

    if( object )
    {
        position.x = object.offsetLeft;
        position.y = object.offsetTop;
       
        if( object.offsetParent )
        {
            var parentpos = GetAbsPosition(object.offsetParent);
            position.x += parentpos.x;
            position.y += parentpos.y;
        }
    }
    position.cx = object.offsetWidth;
    position.cy = object.offsetHeight;
    
    return position;
}



