﻿
var Jc$ = jQuery.noConflict();


function TraceError(desc, fname) {
    try {
        var obj = {
            shortdesc: desc,
            pagename: top.location.href,
            Browser: navigator.appName,
            comment: 'Error coming on ' + fname,
            projectname: 'Sample Text'

        };
        var json = Sys.Serialization.JavaScriptSerializer.serialize(obj);
        JP$.ajax(
            {
                url: Service_Path + 'Settings.svc/TraceError',
                type: 'POST',
                contentType: 'application/json;charset=utf-8',
                data: json,
                success: function(response) {

                },
                failure: function(response) {

                }
            });
    }
    catch (Error) {
    }
}


var popupid = "";

function BackDivCall(divid) {
    try {
        popupid = divid;
        var WidthHeight = GetPageSizeWithScroll();
        var width = WidthHeight[0].split("px");
        var height = WidthHeight[1].split("px");

        document.getElementById("BackDIV").style.height = parseInt(height[0]) + 15 + "px";
        document.getElementById("BackDIV").style.width = screen.width;
        document.getElementById("BackDIV").style.display = 'block';
        var z = document.getElementById(divid).style.zIndex;
        document.getElementById("BackDIV").style.zIndex = z - 20;
    }
    catch (Error) {
        TraceError(Error.message, 'Common.js:BackDivCall');
    }
}
function GetPageSizeWithScroll() {
    if (window.innerHeight && window.scrollMaxY) {
        yWithScroll = (window.innerHeight + window.scrollMaxY) + "px";
        xWithScroll = (window.innerWidth + window.scrollMaxX) + "px";
    }
    else if (document.body.scrollHeight > document.body.offsetHeight) {
        yWithScroll = (document.body.scrollHeight) + "px";
        xWithScroll = (document.body.scrollWidth) + "px";
    }
    else {
        yWithScroll = (document.height || document.body.offsetHeight) + "px";
        xWithScroll = (document.width || document.body.offsetWidth) + "px";
    }
    arrayPageSizeWithScroll = new Array(xWithScroll, yWithScroll);
    return arrayPageSizeWithScroll;

}

function ChkleftChars(ctrl, TextBox) {
    try {
        var val = document.getElementById(TextBox).value;
        if ((val.length) == 150) {
            document.getElementById(ctrl).innerHTML = "<b>0</b>";
        }
        else if ((val.length) < 150) {
            var chrslft = 150 - (val.length);
            document.getElementById(ctrl).innerHTML = "<b>" + chrslft + "</b>";
        }
        else if ((val.length) > 150) {
            document.getElementById(TextBox).value = val.substring(0, 149);
            var chrsmore = 150 - (val.length);
           
            document.getElementById(ctrl).innerHTML = "<b>0</b>";
        }
    }
    catch (Error) {
        TraceError(Error.message, 'Common.js:ChkleftChars');
    }
}


function AddOneUserDownload(userid, contentid) {
    try {
        var download = {
            UserId: userid,
            ConferenceId: Jc$("#ctl00_hdConferenceid").val(),
            ContentId: contentid,
            Description: null,
            FilePath: null
        }
        var json = Sys.Serialization.JavaScriptSerializer.serialize(download);
        Jc$.ajax({
            url: Service_Path + "Exhibithall.svc/AddOneUserDownload",
            type: 'Post',
            contentType: 'application/json;charset=utf-8',
            data: json,
            success: function(response) {
            },
            failure: function(response) {
                ShowAlertPopUp(response);
              
            }
        });
    }
    catch (Error) {
        TraceError(Error.message, 'Common.js:AddOneUserDownload');
    }

}

function GetLnkedInProfile(action) {
    try {
        var url = Domain_Path + "linkedInLogin.aspx?ActionId=" + action;
        window.open(url, "mywindow", "toolbar=no,status=no,menubar=no,location=center,scrollbars=no,height=400,width=800;left=20");
    }
    catch (Error) {
        TraceError(Error.message, 'Common.js:GetLnkedInProfile');
    }
    return false;
}

function RetoProfile(tab, id) {
    try {
        top.location.href = Domain_Path + "Uprofile.aspx?" + "tab=" + tab + "&uid=" + id;
       // var str = "tab=" + tab + "&uid=" + id;
       // EncryptURL("Uprofile", str, false, "user")
       
    }
    catch (Error) {
        TraceError(Error.message, 'Common.js:RetoProfile');
    }
}
function swapImages(id) {
    try {
        var Jc$active = Jc$('#' + id + ' .imgactive');
        var Jc$next = (Jc$('#' + id + ' .imgactive').next().length > 0) ? Jc$('#' + id + '  .imgactive').next() : Jc$('#' + id + ' img:first');
        Jc$active.fadeOut(2000, function() {
            Jc$active.removeClass('imgactive');
            Jc$active.addClass('imginactive');
            
            Jc$next.fadeIn(2000).addClass('imgactive');
        });
    }
    catch (Error) {
        TraceError(Error.message, 'Common.js:swapImages');
    }
}

function swapImagesForMainHall(id) {
    try {
        var Jc$active = Jc$('#' + id + ' .imgactive');
        var Jc$next = (Jc$('#' + id + ' .imgactive').next().length > 0) ? Jc$('#' + id + '  .imgactive').next() : Jc$('#' + id + ' img:first');
        Jc$active.fadeOut(2000, function() {
            Jc$active.removeClass('imgactive');
            Jc$active.addClass('imginactive');
            Jc$next.removeClass('imginactive');
            Jc$next.fadeIn(2000).addClass('imgactive');
        });
    }
    catch (Error) {
        TraceError(Error.message, 'Common.js:swapImagesForMainHall');
    }
}

function HideBoothPopUp() {
    Jc$("#dvBoothPop").hide();
}

function ffLoadXMLBrowser(xmlData) {
    try {
        if (xmlData != null) {
            if (window.ActiveXObject) {
                //for IE
                xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
                xmlDoc.async = "false";
                xmlDoc.loadXML(xmlData);
                return xmlDoc;
            } else if (document.implementation && document.implementation.createDocument) {
                //for Mozila
                parser = new DOMParser();
                xmlDoc = parser.parseFromString(xmlData, "text/xml");
                return xmlDoc;
            }
        }
    }
    catch (Error) {
        TraceError(Error.message, 'Common.js:swapImagesForMainHall');
        var xmlDoc = "";
        return xmlDoc;
    }
}

function Userlogout(userid, fbuserid, confid, wluserid) {
    try {
        Jc$("#ctl00_hdConferenceid").val(confid);
        Jc$("#ctl00_PHInner_hdConfId").val(confid);
        if (userid != "") {
            if (fbuserid != "0" && wluserid == "0") {
                Jc$("#v_user").hide();
                Jc$("#fb_user").show();
                Jc$("#wl_user").hide();
            }
            else if (fbuserid == "0" && wluserid == "0") {
                Jc$("#fb_user").hide();
                Jc$("#v_user").show();
                Jc$("#wl_user").hide();
            }
            else if (fbuserid == "0" && wluserid != "0") {
                Jc$("#wl_user").show();
                Jc$("#fb_user").hide();
                Jc$("#v_user").hide();
            }
        }
    }
    catch (Error) {
        TraceError(Error.message, 'Common.js:Userlogout');
    }
}



function CheckNumeric() {
    try {
        var keyCode = window.event.keyCode;
        if (keyCode < 48 || keyCode > 57) {
            window.event.returnValue = false;
        }
    }
    catch (Error) {
        TraceError(Error.message, 'Common.js:CheckNumeric');
        return false;
    }
}

function BoothUrl(templateid, boothid) {
    try {
        Navigationtobooth("BI=" + boothid);
    }
    catch (Error) {
        TraceError(Error.message, 'Common.js:BoothUrl');
    }
}

function Navigationtobooth(boothid) {    
    EncryptURL('bth', boothid)
    //top.location.href = "bth.aspx?" + boothid;
}

function EncryptURL(pageName, urltoEncrypt) {
    try {
        urltoEncrypt += "&requid=" + $("#ctl00_usrid").val();
        var value = {
        stringtoEncrpt: urltoEncrypt 
                    
        };
        var objdet = Sys.Serialization.JavaScriptSerializer.serialize(value);
        $.ajax({
            type: "POST",
            url: 'home.aspx/EncryptString',
            data: objdet,
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function(response) {
            top.location.href = Domain_Path + pageName + ".aspx?" + response.d;
            },
            failure: function(response) {
            }
        });
    }
    catch (Error) {
        WriteError(Error.description, "Common.js", "EncryptURL");
        return false;
    }
}
function DecryptURL(ecrptStr) {
    try {
        var value = {
         cipherString: ecrptStr
        
        };
        var objdet = Sys.Serialization.JavaScriptSerializer.serialize(value);
        $.ajax({
            type: "POST",
            url: 'home.aspx/DecryptString',
            data: objdet,
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function(response) {
                return response.d;
            },
            failure: function(response) {
            }
        });
    }
    catch (Error) {
        WriteError(Error.description, "Common.js", "DecryptURL");
        return false;
    }
}


function ShowBothMeanuList() {
    try {
        if (Jc$("#bthmeanu").is(':visible') == true) {
            Jc$("#bthmeanu").animate({ height: 'toggle' });
            Jc$("#idMenuArrow").attr("src", "http://virtualevent.s3.amazonaws.com/images/common/meu_arrowUp.png");
        }
        else {
            Jc$("#idMenuArrow").attr("src", "http://virtualevent.s3.amazonaws.com/images/common/meu_arrowDwn.png");
            Jc$("#bthmeanu").animate({ height: 'toggle' });
        }
    }
    catch (Error) {
        TraceError(Error.message, 'Common.js:ShowBothMeanuList');
    }
}

function ShowProductMenuList() {

    try {
        if (Jc$("#prodmenu").is(':visible') == true) {
            Jc$("#prodmenu").animate({ height: 'toggle' });
            Jc$("#idMenuArrowProd").attr("src", "http://virtualevent.s3.amazonaws.com/images/common/meu_arrowUp.png");
        }
        else {
            Jc$("#idMenuArrowProd").attr("src", "http://virtualevent.s3.amazonaws.com/images/common/meu_arrowDwn.png");
            Jc$("#prodmenu").animate({ height: 'toggle' });
        }
    }
    catch (Error) {
        TraceError(Error.message, 'Common.js:ShowProductMenuList');
    }

}

function ShowAlertPopUp(value) {
    try {
     

        var htm = "";
        htm += "<div class='MinMsgCt'>";
        htm += "<div><img src='http://virtualevent.s3.amazonaws.com/images/common/tpcrve215img.png' /></div>";
        htm += "<div class='ManMsgInct'>";
        htm += "<div class='ManMsgintxt' id='dvinnerval'>" + value + "</div>";
        htm += "</div>";
        htm += "<div><img src='http://virtualevent.s3.amazonaws.com/images/common/btcrve215img.png' /></div>";
        htm += "</div>";
        $("#dvAlertPop").attr("innerHTML", htm);
        GetCenterPosition("dvAlertPop");
        $("#dvAlertPop").show(1000);
      
        setTimeout("HideAlertPopup()", 4000);
    }
    catch (Error) {
        TraceError(Error.message, 'Common.js:ShowAlertPopUp');
    }
}
function ShowAlertPopUp2(value) {
    try {
        var htm = "";
        htm += "<div class='MinMsgCt'>";
        htm += "<div><img src='http://virtualevent.s3.amazonaws.com/images/common/tpcrve215img.png' /></div>";
        htm += "<div class='ManMsgInct'>";
        htm += "<div class='ManMsgintxt' id='dvinnerval'>" + value + "</div>";
        htm += "</div>";
        htm += "<div><img src='http://virtualevent.s3.amazonaws.com/images/common/btcrve215img.png' /></div>";
        htm += "</div>";
        $("#dvAlertPop").attr("innerHTML", htm);
        GetCenterPosition("dvAlertPop");
        $("#dvAlertPop").show(1000);

        setTimeout("HideAlertPopup()", 4000);
    }
    catch (Error) {
        TraceError(Error.message, 'Common.js:ShowAlertPopUp2');
    }
}

function ShowAlertPopupOnDemand(element, message) {
    try {
        var pos = GetElementPosition(element);
        $("#DvAlertDemand").css("left", ((pos.x) - 200) + "px");
        $("#DvAlertDemand").css("top", ((pos.y) - 115) + "px");
       
        var htm = "";
        htm += "<div class='MinMsgCt'>";
        htm += "<div><img src='http://virtualevent.s3.amazonaws.com/images/common/tpcrve215img.png' /></div>";
        htm += "<div class='ManMsgInct'>";
        htm += "<div class='ManMsgintxt' id='inner_val'>"+ message.replace(/#/g, ' ').replace(/BREAK/g, '<br />')+"</div>";
        htm += "</div>";
        htm += "<div><img src='http://virtualevent.s3.amazonaws.com/images/common/btcrve215img.png' /></div>";
        htm += "</div>";
        $("#DvAlertDemand").attr("innerHTML", htm);
        $("#DvAlertDemand").show();
       

    }
    catch (Error) {
        TraceError(Error.message, 'Common.js:ShowAlertPopupOnDemand');
    }
}

function HideAlertPopupOnDemand() {
    $("#DvAlertDemand").hide();

}

//This function set Focus at desired Index
function SetCaretPosition(elemId, caretPos) {
    try {
        var elem = document.getElementById(elemId);
        if (elem != null) {
            if (elem.createTextRange) {
                var range = elem.createTextRange();
                range.move('character', caretPos);
                range.select();
            }
            else {
                if (elem.selectionStart) {
                    elem.focus();
                    elem.setSelectionRange(caretPos, caretPos);
                }
                else
                    elem.focus();
            }
        }
    }
    catch (Error) {
        TraceError(Error.message, 'Common.js:SetCaretPosition');
    }
}

// This Function Validate Url
function validateURLbyid(id) {
    try {
        lengthValue = document.getElementById(id).value;
        var value = $.trim(lengthValue);
        if (value.indexOf("http://") == -1) {
            value = "http://" + lengthValue;
        }
        lengthValue = lengthValue.length;
        if (lengthValue != 0) {
            var j = new RegExp();
            j.compile("^[A-Za-z]+://[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$");
            if (!j.test(value)) {
                return false;
            }
            else {
                return true;
            }
        }
    }
    catch (Error) {
        TraceError(Error.message, 'Common.js:validateURLbyid');
        return false;
    }

}

//Function to get the Position of any element on webpage
function GetElementPosition(el) {
    var parent = null;
    var pos = { x: 0, y: 0 };
    var box;
    try {
        if (el.getBoundingClientRect) {
            // IE
            box = el.getBoundingClientRect();
            var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
            var scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft;

            pos.x = box.left + scrollLeft - 2;
            pos.y = box.top + scrollTop - 2;

            return pos;
        }
        else if (document.getBoxObjectFor) {
            // gecko
            box = document.getBoxObjectFor(el);
            pos.x = box.x - 2;
            pos.y = box.y - 2;
        }
        else {
            // safari/opera
            pos.x = el.offsetLeft;
            pos.y = el.offsetTop;
            parent = el.offsetParent;
            if (parent != el) {
                while (parent) {
                    pos.x += parent.offsetLeft;
                    pos.y += parent.offsetTop;
                    parent = parent.offsetParent;
                }
            }
        }


        if (window.opera) {
            parent = el.offsetParent;

            while (parent && parent.tagName != 'BODY' && parent.tagName != 'HTML') {
                pos.x -= parent.scrollLeft;
                pos.y -= parent.scrollTop;
                parent = parent.offsetParent;
            }
        }
        else {
            parent = el.parentNode;
            while (parent && parent.tagName != 'BODY' && parent.tagName != 'HTML') {
                pos.x -= parent.scrollLeft;
                pos.y -= parent.scrollTop;

                parent = parent.parentNode;
            }
        }
    }
    catch (Error) {
        TraceError(Error.message, 'Common.js:GetElementPosition');
    }
    return pos;
}

function HideAlertPopup() {
    $("#dvAlertPop").hide(1000);
}



function BreakString(len, str) {
    try {
        if (str == null) {
            return str="";
        }
        if (str.length > len) {
            str = str.substring(0, len) + "...";
        }
        
    }
    catch (Error) {
        TraceError(Error.message, 'Common.js:BreakString');
    }
    return str;
}

function ShowBoothAbstract(val, element) {
    try {
        var FavBoothHtml = "";
        FavBoothHtml += "<div class='Abst_MainOterCt'>";
        FavBoothHtml += "<div><img src='http://virtualevent.s3.amazonaws.com/images/common/rnd_corntop.png' width='462' height='9' /></div>";

        FavBoothHtml += "<div class='AbmidCT'>";
        FavBoothHtml += "<div class='CmoMindDiv'>";
        FavBoothHtml += "<H1>" + $("#hdBTitle" + val).val() + "</H1>";
        FavBoothHtml += "<br/>";
        FavBoothHtml += "<div class='maintxt_ImgTxt'>";
        FavBoothHtml += "<img src='" + $('#hd-logo' + val).val() + "' class='Pop_ImglftWrk'/>";
        FavBoothHtml += "<p>" + $('#hdAbstract' + val).val() + "</p>";
        FavBoothHtml += "</div>";
              FavBoothHtml += "</div>";
        FavBoothHtml += "</div>";
        FavBoothHtml += "<div><img src='http://virtualevent.s3.amazonaws.com/images/common/rnd_cornbot.png' width='462' height='9' /></div>";
        FavBoothHtml += "</div>";


        $("#DivInfo").attr('innerHTML', FavBoothHtml);
        TagToTip('DivInfo');
    }
    catch (Error) {
        TraceError(Error.message, 'Common.js:ShowBoothAbstract');
    }
}

function HideBoothAbstract() {
    try {
        UnTip();
    }
    catch (Error) {
        TraceError(Error.message, 'Common.js:HideBoothAbstract');
    }
   
}


function CheckEmail(id) {
    try {
        var str = $.trim($("#" + id).val());
        var filter = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
        if (filter.test(str))
            return true;
        else {
            return false;
        }
    }
    catch (Error) {
        TraceError(Error.message, 'Common.js:CheckEmail');
        return false;
    }
}

function ShowSecureContentPopUp(userid, confid, securecode, contentid, exttype, val) {
    try {
        var authmode = "";
        $.ajax({
            url: servicepath + "Authentication.svc/GetAuthenticationModeOfUser",
            type: 'Get',
            data: { userid: userid },
            success: function(response) {
                try {
                    response = eval(response);
                    if (response.length > 0) {
                        if (response[0].Message == null) {
                            authmode = response[0].Authmode;
                            var FavHTML = "";
                            FavHTML += "<div class='SmlPopMNBgCt'>";
                            FavHTML += "<div><img src='http://virtualevent.s3.amazonaws.com/images/common/sml_rndtopcrv.png' /></div>";
                            FavHTML += "<div class='SmlPopMnNpCtMN'>";
                            FavHTML += "<div class='SmlPopMidmnCT'>";
                            FavHTML += "<div class='SmlPopBlnkWhtCt'>";
                            FavHTML += "<div class='SmlPopUserMn'>";
                            FavHTML += "<div class='SmlPopMhed_MnCT'>";
                            FavHTML += "<div class='SmlPopHedCtMnCcn'>Send Message</div>";
                            FavHTML += "<div class='SmlClostab'><a onclick=ClosePopupById('BusinessOnDemand'); title=Close'><img src='http://virtualevent.s3.amazonaws.com/images/common/rnd_close_icn.png' /></a></div>";
                            FavHTML += "</div>";
                            FavHTML += "<div class='SmlPopMidWknAra'>";
                            FavHTML += "<div class='RSPOPOtCt'>";
                            FavHTML += "<div class='RSPOPMidWokCt'>";
                            FavHTML += "<div class='RSPOPwhed'>";
                            FavHTML += "<div class='RSPOPPP'  style='width:130px;'>To Request for password</div>";
                            if (authmode != 2) {
                                FavHTML += "<div class='RSPOPRgthPP' style='float:left'><input onclick=SendPassRequest(" + userid + "," + contentid + "," + confid + ",'" + exttype + "'," + authmode + ") type='button' value='Click here' /></div>";

                            }
                            if (authmode == 2) {
                                FavHTML += "<div class='RSPOPMidWokCt'>";
                                FavHTML += "<div class='RSPOPSucEmCt'>Enter your email id</div>";
                                FavHTML += "<div class='RSPOPPtCMN'><input id='txtAuthMail' type='text'/></div>";
                                FavHTML += "</div><br/>";
                                FavHTML += "<div class='RSPOPRgthPP'><input onclick=SendPassRequest(" + userid + "," + contentid + "," + confid + ",'" + exttype + "'," + authmode + ") type='button' value='Click here' /></div>";
                            }
                            FavHTML += "</div>";
                            FavHTML += "</div>";
                            FavHTML += "<div class='RSPOPOrTxt'>Or</div>";
                            FavHTML += "<div class='RSPOPMidWokCt'>";
                            FavHTML += "<div class='RSPOPSucEmCt'>Enter Password</div>";
                            FavHTML += "<div class='RSPOPPtCMN'><input id='txtAuthPass' type='password'/></div>";
                            FavHTML += "</div>";
                            FavHTML += "</div>";
                            FavHTML += "<div class='ThrdBmnCt'>";
                            FavHTML += "<div class='SmlPopDnw_btCt'><input type='button' value='Submit' class='FPopButnw' onclick=CheckContentPass('" + securecode + "','" + $("#txtAuthPass").val() + "'," + val + ") /></div>";
                            FavHTML += "</div></div></div></div></div>";
                            FavHTML += "<div><img src='http://virtualevent.s3.amazonaws.com/images/common/sml_rndbotcrv.png' /></div>";
                            FavHTML += "</div></div>";
                            $("#BusinessOnDemand").attr("innerHTML", FavHTML);
                            GetCenterPosition("BusinessOnDemand");
                            $("#BusinessOnDemand").show(1000);
                        }
                        else {
                        }
                    }
                }
                catch (Error) {
                    TraceError(Error.message, 'Common.js:ShowSecureContentPopUp');
                }
            },
            failure: function(response) {

            }
        });
    }
    catch (Error) {
        TraceError(Error.message, 'Common.js:ShowSecureContentPopUp');
    }
}

function validateHtmlTags(txtboxid) {
    var ret = false;
    try {
        str = $("#" + txtboxid).val();
        if (str.match(/([\<])([^\>]{1,})*([\>])/i) != null) {
            ret = false;
        }
        ret = true;
    }
    catch (Error) {
        TraceError(Error.message, 'Common.js:validateHtmlTags');
    }
    return ret;
}


function HidePassword(userid, confid) {
    $("#liPassword").hide();
}
function ClosePopupById_brfBcard(eleId) {

    try {
        if (eleId == "ResultOnDemand") {
            JI$('#' + eleId).attr("innerHTML", "");
        }
        JI$('#' + eleId).hide();
        JI$('#' + eleId).attr("innerHTML", "");
    }
    catch (Error) {
        TraceError(Error.message, 'Common.js:ClosePopupById_brfBcard');
    }
}
function GetBusCardDetConf2(userid, confid) {

    $.ajax(
    {
        url: Service_Path + 'Settings.svc/GetUserProfileDetails',
        data: { userid: userid },
        cache: false,
        success: function(response) {
            try {
                if (response != "[]") {

                    response = eval(response);
                    if (response[0].Message == null) {
                        if (response.length > 0) {
                            var FavBoothHtml = "";
                            FavBoothHtml += "<div class='BCard_Wrapper'>";
                            FavBoothHtml += "<div class='BCard_CloseImg'><a onclick=ClosePopupById_BCard('ViewBusinessCard'); style='cursor:pointer' ><img src='http://virtualevent.s3.amazonaws.com/images/common/close_but.png' title='Close' /></a></div>";

                            FavBoothHtml += "<div><img src='http://virtualevent.s3.amazonaws.com/images/common/bcard_topcurve.png' /></div>";

                            FavBoothHtml += "<div class='BCard_MidBgCont'>";

                            FavBoothHtml += "<div class='BCard_Mid_InnerWk'>";
                            FavBoothHtml += "<div class='BCard_HedCont'>Business card</div>";
                            FavBoothHtml += "<div class='BCard_ImgCont_Wrp'>";

                            FavBoothHtml += "<div class='BCard_ImgPoint_Cont'>";

                            FavBoothHtml += "<div class='BCard_ImgSection'>";


                            var des = SetValuesnew(response[0].customvalue);
                            var res = des.split("~");
                            var ContactNumber = res[3];
                            if (response[0].PhotoPath != null && response[0].PhotoPath != "")
                                FavBoothHtml += "<div class='BCard_Image'><a style='cursor:pointer' onclick='GoToUprf(" + userid + ")'  title='" + response[0].ScreenName + "' ><img  src='http://virtualevent.s3.amazonaws.com/images/userimages/" + response[0].PhotoPath.replace('_30X30.jpeg', '_110X84.jpeg') + "'/></a></div>";
                            else
                                FavBoothHtml += "<div class='BCard_Image'><a style='cursor:pointer' onclick='GoToUprf(" + userid + ")'  title='" + response[0].ScreenName + "' ><img src='http://virtualevent.s3.amazonaws.com/images/common/110X84_noimg.gif'/></a></div>";

                            FavBoothHtml += "<div class='BCard_TxtCont'>";
                            FavBoothHtml += "<H1><a style='cursor:pointer' onclick='GoToUprf(" + userid + ")' title='" + response[0].ScreenName + "' >" + response[0].ScreenName + "</a></H1>";
                            FavBoothHtml += "<H2>" + response[0].Title + "</H2>";
                            FavBoothHtml += "<H3>" + response[0].Company + "</H3>";
                            FavBoothHtml += "<div class='BCard_BthRep'><img src='http://virtualevent.s3.amazonaws.com/images/common/bth_respicon.png' />" + response[0].UserTypeName.toUpperCase() + "</div>";
                            FavBoothHtml += "</div>";
                            FavBoothHtml += "</div>";

                            FavBoothHtml += "<div class='BCard_PointSection'>";

                            var logopath = "";
                            switch (response[0].Company) {
                                case "Microsoft":
                                    {
                                        logopath = "microsoft.png";
                                        break;
                                    }
                                case "VeriSign":
                                    {
                                        logopath = "versign_bs.png";
                                        break;
                                    }

                                default:
                                    {
                                        logopath = "social_27.png";
                                        break;
                                    }

                            }
                            FavBoothHtml += "<div class='BCard_LogoCont'><img src='http://virtualevent.s3.amazonaws.com/images/common/" + logopath + "' /></div>";
                            FavBoothHtml += "<div class='BCard_PointCont'>Points</div>";
                            var points = "";
                            if (response[0].ActionCount != 0)
                                points = response[0].ActionCount;

                            FavBoothHtml += "<div class='BCard_Point_ResltCont'><img src='http://virtualevent.s3.amazonaws.com/images/common/bpnts_icon.png' />" + points + "</div>";

                            FavBoothHtml += "</div>";

                            FavBoothHtml += "</div>";



                            FavBoothHtml += "</div>";

                            FavBoothHtml += "<div class='BCard_Badges_Cont'>";

                            FavBoothHtml += "<div class='BCard_BgFstCont'>";
                            FavBoothHtml += "<div class='BCard_BdgHead'>";
                            FavBoothHtml += "<div class='BCard_LftHed'><H1>Badges</H1></div>";


                            var Badgespic = "";
                            if (response[0].BadgePhotoPath != null) {
                                Badgespic = response[0].BadgePhotoPath.split(",");
                                FavBoothHtml += "<ul>";
                                var badge = "";
                                if (Badgespic.length > 4) {

                                    badge = 4;
                                    FavBoothHtml += "<div class='BCard_MreBt'><a style='cursor:pointer' onclick='GoToUprf(" + userid + ")'>more</a></div>";
                                    FavBoothHtml += "</div>";
                                    FavBoothHtml += "<div class='BCard_BadgImgsCont'>";
                                }
                                else {
                                    FavBoothHtml += "<div class='BCard_MreBt'></div>";
                                    FavBoothHtml += "</div>";
                                    FavBoothHtml += "<div class='BCard_BadgImgsCont'>";
                                    badge = Badgespic.length;
                                }

                                for (var i = 0; i < badge; i++) {
                                    FavBoothHtml += "<li><img src='http://virtualevent.s3.amazonaws.com/images/common/" + Badgespic[i] + "' /></li>";
                                }
                                FavBoothHtml += "</ul>";
                            }
                            else {
                                FavBoothHtml += "<div class='BCard_MreBt'></div>";
                                FavBoothHtml += "</div>";
                                FavBoothHtml += "<div class='BCard_BadgImgsCont'>";
                                FavBoothHtml += "<div class='badgesnorecod'>No Badges Earned</div>";
                            }
                            FavBoothHtml += "</div>";

                            FavBoothHtml += "</div>";
                            FavBoothHtml += "<div class='BCard_BgSndCont'>";
                            FavBoothHtml += "<H1>Connections</H1>";

                            var follower = "";
                            var following = "";

                            if (response[0].FollowerCount != "")
                                follower = "I'm Following (" + response[0].FollowerCount + ")";
                            else
                                follower = "I'm Following (0)";
                            if (response[0].FollowingCount != "")
                                following = "Following Me (" + response[0].FollowingCount + ")";
                            else
                                following = "Following Me (0)";


                            FavBoothHtml += "<a style='cursor:pointer' onclick='GoToUprf(" + userid + ")'>" + follower + "</a>";
                            FavBoothHtml += "<a style='cursor:pointer' onclick='GoToUprf(" + userid + ")'>" + following + "</a>";

                            FavBoothHtml += "</div>";
                            FavBoothHtml += "<div class='BCard_BgThrdCont'>";
                            FavBoothHtml += "<H1>Actions</H1>";
                            FavBoothHtml += "<div class='BCard_Wkc'>";
                            FavBoothHtml += "<ul>";
                            if (response[0].TwitterName != null && response[0].TwitterName.trim() != "") {
                                FavBoothHtml += "<li><a onclick=RetoProfile('" + 'twt' + "','" + userid + "') style='cursor:pointer' target='_blank'><img src='http://virtualevent.s3.amazonaws.com/images/common/bcrd_twticon.png'  title='" + response[0].ScreenName + "`s twitter public profile.' /></a></li>";
                            }

                            var Tags = "";
                            if (response[0].TagXml != null) {
                                var Tags = GetAllTags(response[0].TagXml);
                            }
                            if (Tags != "") {
                                FavBoothHtml += "<li ><a style='cursor:pointer'><img id='icontags' src='http://virtualevent.s3.amazonaws.com/images/common/tag_icon.png'/></a></li>";
                            }
                            if (userid == $("#ctl00_usrid").val()) {
                                FavBoothHtml += "<li><a onclick='GetSettings(" + userid + "," + $("#ctl00_confid").val() + ")' style='cursor:pointer'><img src='http://virtualevent.s3.amazonaws.com/images/common/edt_icon.png'  title='Edit Profile' /></a></li>";
                            }
                            FavBoothHtml += "</ul>";
                            FavBoothHtml += "</div>";
                            FavBoothHtml += "</div>";
                            FavBoothHtml += "<div class='BCard_ContactCont'>";
                            FavBoothHtml += "<H1>Contacts</H1>";
                            FavBoothHtml += "<H2>" + ContactNumber + "</H2>";
                            FavBoothHtml += "</div>";
                            FavBoothHtml += "</div>";

                            FavBoothHtml += "</div>";

                            FavBoothHtml += "</div>";
                            FavBoothHtml += "<div><img src='http://virtualevent.s3.amazonaws.com/images/common/bcard_botcurve.png' /></div>";
                            FavBoothHtml += "</div>";
                            $("#Loaderimg").hide();
                            $("#ViewBusinessCard").attr("innerHTML", FavBoothHtml);
                            ShowTagsPopupBusinesscard(response[0].ScreenName, Tags, "icontags");
                            GetCenterPosition("ViewBusinessCard");
                            $("#ViewBusinessCard").show(2000);
                            BackDivCall('ViewBusinessCard');

                        }
                        else {
                            FavBoothHtml += "</div>";
                            FavBoothHtml += "</div>";
                            FavBoothHtml += "</div>";
                            FavBoothHtml += "</div>";
                            FavBoothHtml += "</div>";
                            FavBoothHtml += "</div>";
                            FavBoothHtml += "</div>";
                            FavBoothHtml += "</div>";
                            FavBoothHtml += "<div><img src='http://virtualevent.s3.amazonaws.com/images/common/big_botcrvimg.png' width='357' height='5' /></div>";
                            FavBoothHtml += "</div>";
                            $("#ViewBusinessCard").attr("innerHTML", FavBoothHtml);
                            GetCenterPosition("ViewBusinessCard");
                            $("#ViewBusinessCard").show(2000);
                            BackDivCall('ViewBusinessCard');
                        }
                    }
                }
            }
            catch (Error) {
                TraceError(Error.message, 'Common.js:GetBusCardDetConf2');
            }
        }

    });

}


function SendBussCard(confid, receiverid) {

    var reqParams = {
        UserId: $("#ctl00_usrid").val(),
        ConferenceId: $("#ctl00_confid").val(),
        ReceiverUserId: receiverid
    };
    var reqParams_Serialized = Sys.Serialization.JavaScriptSerializer.serialize(reqParams);
    $.ajax({
        url: Service_Path + 'NetworkLounge.svc/SendBussCard',
        type: 'POST',
        contentType: 'application/json;charset=utf-8',
        data: reqParams_Serialized,
        cache: false,
        success: function(response) {
            try {

                if (response.length > 0) {
                    response = eval(response);
                    if (response[0].Message[0].StatusCode == "101") {
                        ShowAlertPopUp("Business card sent successfully");
                        
                    }
                    else {
                        ShowAlertPopUp(response[0].Message[0].Description);
                        
                    }
                }
                else {
                    FavBoothHtml += "<br /><div>no data return</div>";
                }
            }
            catch (Error) {
                TraceError(Error.message, 'Common.js:SendBussCard');
            }
        },
        failure: function(response) {
            ShowAlertPopUp(response);

        }
    });
}


function VerifyActivationCode(ActivationCode, conferenceID) {
    var reqParams = {
        ConferenceId: conferenceID,
        activationCode: ActivationCode
    };
    var reqParams_Serialized = Sys.Serialization.JavaScriptSerializer.serialize(reqParams);
    $.ajax({
        url: Service_Path + 'Authentication.svc/ActivateOneUser',
        type: 'POST',
        contentType: 'application/json;charset=utf-8',
        data: reqParams_Serialized,
        cache: false,
        success: function(response) {
            try {
                response = eval(response);
                if (response.length > 0) {
                    if (response[0].Message[0].StatusCode == "101") {
                        
                    }
                    else {
                        ShowAlertPopUp(response[0].Message[0].Description);
                       
                    }
                }
                else {
                    FavBoothHtml += "<br /><div>no data return</div>";
                }
            }
            catch (Error) {
                TraceError(Error.message, 'Common.js:VerifyActivationCode');
            }
        },
        failure: function(response) {
            ShowAlertPopUp(response);

        }
    });
}

function GetLoggedInUsername(userId) {
    if (userId != null || userId != undefined) {
        $.ajax(
    {
        url: Service_Path + 'Settings.svc/GetUserProfileDetails',
        data: { userid: userId },
        cache: false,
        success: function(response) {
            try {
                response = eval(response);
                if (response.length > 0) {
                    $("#dvLoggedUserName").attr("innerHTML", "Hi,&nbsp;" + BreakString(18, response[0].ScreenName));
                }
            }
            catch (Error) {
                TraceError(Error.message, 'Common.js:GetLoggedInUsername');
            }
        }
    });

    }
}



function swapImages(id) {
    try {
        var Jc$active = Jc$('#' + id + ' .imgactive');
        var Jc$next = (Jc$('#' + id + ' .imgactive').next().length > 0) ? Jc$('#' + id + ' .imgactive').next() : Jc$('#' + id + ' img:first');
        Jc$active.fadeOut(2000, function() {
            Jc$active.removeClass('imgactive');
            Jc$active.addClass('imginactive');
            Jc$next.removeClass('imginactive');
            Jc$next.fadeIn(2000).addClass('imgactive');
        });
    }
    catch (Error) {
        TraceError(Error.message, 'Common.js:swapImages');
    }
}
