﻿function ChangeImagePreview(img)
{
    imgP = document.getElementById('ctl00_ContentPlaceHolder1_imgPreview');
    imgP.src = img;
}

var pageName = "BYMARINO Products";
function addToFavorites()
{
    if (window.external)
    {
        window.external.AddFavorite(document.location, pageName);
    } 
    else { alert("Disculpe. Su navegador no soporta esta funcionalidad");}
}

function shareFacebook()
{
    var title = pageName;
    var url = document.location;
    window.open('http://www.facebook.com/sharer.php?u='+url+'&t='+title, 'sharer', 'toolbar=0,status=0,width=626,height=436');
}

function sendByEmail() {    
    var url = document.location;

    sendemailwindow = dhtmlmodal.open('SendEmailBox', 'iframe', 'SendByMail.aspx?url=' + url, 'Enviar Producto por Email', 'width=860px,height=380px,center=1,resize=0,scrolling=1')

    sendemailwindow.onclose = function() { //Define custom code to run when window is closed
        return true
    }
}

fade = {
    speed: 5,
    finalOpacity: 100,
    currentOpacity: 0,
    elID: null,
    init: function(el) {
        fade.elID = el;
        if (!document.getElementById(el))
            return;

        if (navigator.appName == 'Netscape') {
            document.getElementById(el).style.MozOpacity = 1;
        }
        else {
            fadeInterval = setInterval('fade.doFade()', fade.speed);
        }
    },
    doFade: function(obj) {
        obj = document.getElementById(fade.elID);
        if (fade.currentOpacity < fade.finalOpacity) {
            var newOpacity = fade.currentOpacity + 3;
            obj.style.opacity = "." + (newOpacity);
            obj.style.filter = "alpha(opacity=" + newOpacity + ")";
            fade.currentOpacity = newOpacity;
        } else {
            obj.style.opacity = "." + (fade.finalOpacity);
            obj.style.filter = "alpha(opacity=" + fade.finalOpacity + ")";
            clearInterval(fadeInterval);
        }
    }
}

