﻿
function swapImg(imgId, lblimage, imgCaption, imgDesc, txtImg, plug, source, lnkurl, title, description, location, imgIndex, mediaId){
    var olblImg = document.getElementById(lblimage);
    if (olblImg != null && olblImg != 'undefined') {
        olblImg.href = lnkurl;
        olblImg.title = title;
    }
    var oImg = document.getElementById(imgId);
    if (oImg != null && oImg != 'undefined')
    {
        oImg.src = source;
        oImg.alt = title;
        curImgIndex = imgIndex;
    }
var oCaption = document.getElementById(imgCaption);
    if (oCaption != null && oCaption != 'undefined')
    {
        oCaption.innerText = title;
    }
var oDescription = document.getElementById(imgDesc);
    if (oDescription != null && oDescription != 'undefined')
    {
        oDescription.innerText = description;
    }
var oID = document.getElementById(txtImg);
    if (oID != null && oID != 'undefined')
    {
        oID.value = mediaId;
    }
    SetSLSendToFriendParams(plug,"MediaID",mediaId);
}

function ResizeSLSendToFriend(ctrl_id, height, width, displaystyle) {
    var ctrlid = "" + ctrl_id;
    var host = document.getElementById(ctrlid);
    if (host != null) {
        host.style.height = height + "px";
        host.style.width = width + "px";
        host.style.display = displaystyle;
    }
}
function SetSLSendToFriendParams(pluginid, propertyname, propertyvalue) {
    var ctrlid = "" + pluginid;
    var pluginsendtofrd = document.getElementById(ctrlid);
    if (pluginsendtofrd != null) {
        switch (propertyname.toLowerCase()) {
            case "mediatype": pluginsendtofrd.Content.SM_SendToFriend.SetMediaType(propertyvalue);
                break;
            case "mediadescription": pluginsendtofrd.Content.SM_SendToFriend.SetMediaDescription(propertyvalue);
                break;
            case "displayurl": pluginsendtofrd.Content.SM_SendToFriend.SetDisplayURL(propertyvalue);
                break;
            case "thumbnail": pluginsendtofrd.Content.SM_SendToFriend.SetThumbNail(propertyvalue);
                break;
            case "divclientid": pluginsendtofrd.Content.SM_SendToFriend.SetDivClientID(propertyvalue);
                break;
            case "varauxiliar":
                //alert(""+propertyvalue);
                pluginsendtofrd.Content.SM_SendToFriend.SetVarAuxiliar("" + propertyvalue);
                break;
            case "mediaid": pluginsendtofrd.Content.SM_SendToFriend.SetMediaID(propertyvalue);
                break;
        }
    }
}

function getLength(str) {
    var x = 0;
    if (str != null && str != 'undefined') {
        var len = str.length;
        x = 140 - len; ;
    }
    return x;
}



