﻿ 

function GetBrowser()

 {
    if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)) {
        return "FireFox";
    }
    else if (/Chrome[\/\s](\d+\.\d+)/.test(navigator.userAgent)) {
        return "Chrome";
    }
    else if (/Opera[\/\s](\d+\.\d+)/.test(navigator.userAgent)) {
        return "Opera";
    }
    else if (/Safari[\/\s](\d+\.\d+)/.test(navigator.userAgent)) {
        return "Safari";
    }
    else if (/MSIE[\/\s](\d+\.\d+)/.test(navigator.userAgent)) {
        return "Internet Explorer";
    }
    else {
        return "";
    }

}

function hideframeDuplicate() {

    if (document.getElementById('iframe_RenderPopUpSearchMedia_WebSearch') != null) {
        document.getElementById('iframe_RenderPopUpSearchMedia_WebSearch').src = "";
        //document.getElementById('iframe_RenderPopUpSearchMedia_WebSearch').innerHTML = "";
    }
    
    if (document.getElementById('dvPreview') != null) {
        var objdvPreview = document.getElementById('dvPreview');
        if (objdvPreview) {
            document.getElementById('dvPreview').innerHTML = ""; //Stop playing video if running...
        }
    }
    var objdvSearch;

    if (GetBrowser() == "FireFox") {
        objdvSearch = parent.content.document.getElementById('ctl00_cp1_dvSearch');
    }
    else if (GetBrowser() == "Internet Explorer" || GetBrowser() == "Chrome" || GetBrowser() == "Safari") {
        objdvSearch = window.parent.ctl00_cp1_dvSearch;
    }
    else {
        objdvSearch = window.parent.ctl00_cp1_dvSearch;

    }
    if (objdvSearch) {
        objdvSearch.style.display = 'none';
        //objdvSearch.style.zIndex = "-100";
    }

    

}



function hideframeUploadMedia() {

     
    if (GetBrowser() == "FireFox") {
        objdvFileUpload = parent.content.document.getElementById('ctl00_cp1_dvFileUpload');
    }
    else if (GetBrowser() == "Internet Explorer" || GetBrowser() == "Chrome" || GetBrowser() == "Safari") {
        objdvFileUpload = window.parent.ctl00_cp1_dvFileUpload;
    }
    else {
        objdvFileUpload = window.parent.ctl00_cp1_dvFileUpload;
    }
    objdvFileUpload.style.display = "none";
}

function hideframeWebCam() {



    if (GetBrowser() == "FireFox") {
        objdvRecord = parent.content.document.getElementById('ctl00_cp1_dvRecord');
    }
    else if (GetBrowser() == "Internet Explorer" || GetBrowser() == "Chrome" || GetBrowser() == "Safari") {
        objdvRecord = window.parent.ctl00_cp1_dvRecord;
    }
    else {
        objdvRecord = window.parent.ctl00_cp1_dvRecord;
    }
    objdvRecord.style.visibility = "hidden";
}




//For Search Upload
function HidePopup(PopUpDivID) {
    var div_Pop = document.getElementById(PopUpDivID);
    if (div_Pop.style.display == "block") {
        div_Pop.style.display = "none";
    } else {
        div_Pop.style.display = "block";
        div_Pop.focus();
    }
}


var pImagePath = "../themes/default/images/CustomPopUp/";

var pWidthSearchMedia = 754;
var pHeightSearchMedia = 678;
var pTitleSearchMedia = "Search Web";
var pContentSearchMedia = "";
var XCord = 0;
var YCord = 0;

function RenderPopUpSearchMedia(searchType, objClick, objType, srcType, srcPage) {
    str = '<div style="width:' + pWidthSearchMedia + 'px;height:' + pHeightSearchMedia + 'px; position:absolute;z-index:1023; top:' + YCord + '; left:' + XCord + ';">';
    str += '<div style="position:absolute; left:22px; top:13px; z-index:1;"><span style="color:#FFFFFF; font-family:Trebuchet MS;font-weight:bold;font-size:12px">' + pTitleSearchMedia + '</span></div>';
    str += '<div id="CloseMe" onmousemove="document.getElementById(\'CloseMe\').style.backgroundColor = \'gray\';" onmouseout="document.getElementById(\'CloseMe\').style.backgroundColor = \'transparent\';" onclick="javascript:hideframeDuplicate();"  style="position:absolute;cursor:hand;cursor:pointer;height:20px;width:20px; right:24px; top:12px; z-index:1;"><img  style="margin-top:5px;margin-left:5px;"  src="' + pImagePath + 'closePop.png" height="11" width="11"/></div>';
    str += '<div id="TopImageContainer">';
    str += '<div id="TopLeftImage" style="float:left; width:15px;"><img style=\'vertical-align:bottom;\' src="' + pImagePath + 'LeftTop.png" height="39" width="15" /></div>';
    str += '<div id="TopCenterImage" style="float:left; width:' + (pWidthSearchMedia - 40) + 'px;"><img  style=\'vertical-align:bottom\'  src="' + pImagePath + 'MidTop.png" height="39" width="' + (pWidthSearchMedia - 40) + '" /></div>';
    str += '<div id="TopRightImage" style="float:left; width:19px;"><img style=\'vertical-align:bottom\' src="' + pImagePath + 'RightTop.png" height="39" width="19" /></div>';
    str += '</div><div id="Middle_Div">';
    str += '<div id="LeftMiddleDiv" style="float:left; width:15px; height:' + (pHeightSearchMedia - 30) + 'px;"><img src="' + pImagePath + 'LeftMiddle.png" height="' + (pHeightSearchMedia - 30) + '" width="15" /></div>';
    str += '<div id="CenterMiddleDiv"  style="float:left; background-color:#cccccc; height:' + (pHeightSearchMedia - 30) + 'px; width:' + (pWidthSearchMedia - 40) + 'px;"><div style="padding-top:14px; padding-left:3px; padding-right:3px; z-index:1;width:100%;">' + '<iframe id="iframe_RenderPopUpSearchMedia_WebSearch" frameborder="0" width=\'98%\' HEIGHT=\'580\'  src=\'../MediaSearch/SearchMedia.aspx?searchType=' + searchType + '&objClick=' + objClick + '&objType=' + objType + '&srcType=' + srcType + '&srcPage=' + srcPage + ' \'style=\'overflow-x:none\'></iframe>' + '</div></div>';
    str += '<div id="RightMiddleDiv" style="float:left; width:19px; height:' + (pHeightSearchMedia - 30) + 'px;"><img src="' + pImagePath + 'RightMiddle.png" height="' + (pHeightSearchMedia - 30) + '" width="19" /></div>';
    str += '</div><div id="BottomImages">';
    str += '<div style=" width:15px;float:left;"><img src="' + pImagePath + 'LeftBottom.png" height="32" width="15" /></div>';
    str += '<div style=" width:' + (pWidthSearchMedia - 40) + 'px;float:left;"><img src="' + pImagePath + 'MidBottom.png" height="32" width="' + (pWidthSearchMedia - 40) + '" /></div>';
    str += '<div style=" width:19px;float:left;"><img src="' + pImagePath + 'RightBottom.png"  width="19" height="32" /></div></div></div>';
    return str;
}
var pWidthArticleURL = 354;
var pHeightArticleURL = 125;
var pTitleArticleURL = "Web URL";
var pContentArticleURL = "";
function RenderPopUpArticleURL(searchType, objClick, objType, srcType, srcPage) {

    str = '<div style="width:' + pWidthArticleURL + 'px;height:' + pHeightArticleURL + 'px; position:absolute;z-index:1023; top:' + YCord + '; left:' + XCord + ';">';
    str += '<div style="position:absolute; left:22px; top:13px; z-index:1;"><span style="color:#FFFFFF; font-family:Trebuchet MS;font-weight:bold;font-size:12px">' + pTitleArticleURL + '</span></div>';
    str += '<div id="CloseMe" onmousemove="document.getElementById(\'CloseMe\').style.backgroundColor = \'gray\';" onmouseout="document.getElementById(\'CloseMe\').style.backgroundColor = \'transparent\';" onclick="javascript:jsHideMainWebUrlDiv();"  style="position:absolute;cursor:hand;cursor:pointer;height:20px;width:20px; right:24px; top:12px; z-index:1;"><img  style="margin-top:5px;margin-left:5px;"  src="' + pImagePath + 'closePop.png" height="11" width="11"/></div>';
    str += '<div id="TopImageContainer">';
    str += '<div id="TopLeftImage" style="float:left; width:15px;"><img style=\'vertical-align:bottom;\' src="' + pImagePath + 'LeftTop.png" height="39" width="15" /></div>';
    str += '<div id="TopCenterImage" style="float:left; width:' + (pWidthArticleURL - 40) + 'px;"><img  style=\'vertical-align:bottom\'  src="' + pImagePath + 'MidTop.png" height="39" width="' + (pWidthArticleURL - 40) + '" /></div>';
    str += '<div id="TopRightImage" style="float:left; width:19px;"><img style=\'vertical-align:bottom\' src="' + pImagePath + 'RightTop.png" height="39" width="19" /></div>';
    str += '</div><div id="Middle_Div">';
    str += '<div id="LeftMiddleDiv" style="float:left;width:15px; height:' + (pHeightArticleURL - 30) + 'px;"><img src="' + pImagePath + 'LeftMiddle.png" height="' + (pHeightArticleURL - 30) + '" width="15" /></div>';
    str += '<div id="CenterMiddleDiv"  style="float:left; background-color:#cccccc; height:' + (pHeightArticleURL - 30) + 'px; width:' + (pWidthArticleURL - 40) + 'px;"><div style="padding-top:4px;  padding-left:3px; padding-right:3px; z-index:1;width:100%;height:90px">' + '<iframe frameborder="0" scrolling="no"  width=\'98%\' height=\'90\'  src=\'../MediaSearch/SearchMedia.aspx?searchType=' + searchType + '&objClick=' + objClick + '&objType=' + objType + '&srcType=' + srcType + '&srcPage=' + srcPage + ' \'style=\'height:90px;\'></iframe>' + '</div></div>';
    str += '<div id="RightMiddleDiv" style="float:left; width:19px; height:' + (pHeightArticleURL - 30) + 'px;"><img src="' + pImagePath + 'RightMiddle.png" height="' + (pHeightArticleURL - 30) + '" width="19" /></div>';
    str += '</div><div id="BottomImages">';
    str += '<div style=" width:15px;float:left;"><img src="' + pImagePath + 'LeftBottom.png" height="32" width="15" /></div>';
    str += '<div style=" width:' + (pWidthArticleURL - 40) + 'px;float:left;"><img src="' + pImagePath + 'MidBottom.png" height="32" width="' + (pWidthArticleURL - 40) + '" /></div>';
    str += '<div style=" width:19px;float:left;"><img src="' + pImagePath + 'RightBottom.png"  width="19" height="32" /></div></div></div>';

    return str;
}
var pWidthUploadMedia = 354;
var pHeightUploadMedia = 125;
var pTitleUploadMedia = "My Documents";
var pContentUploadMedia = "";
function RenderPopUpUploadMedia(searchType, objClick, objType, srcType, srcPage) {

    str = '<div style="width:' + pWidthUploadMedia + 'px;height:' + pHeightUploadMedia + 'px; position:absolute;z-index:1023; top:' + YCord + '; left:' + XCord + ';">';
    str += '<div style="position:absolute; left:22px; top:13px; z-index:1;"><span style="color:#FFFFFF; font-family:Trebuchet MS;font-weight:bold;font-size:12px">' + pTitleUploadMedia + '</span></div>';
    str += '<div id="CloseMe" onmousemove="document.getElementById(\'CloseMe\').style.backgroundColor = \'gray\';" onmouseout="document.getElementById(\'CloseMe\').style.backgroundColor = \'transparent\';" onclick="javascript:hideframeUploadMedia();"  style="position:absolute;cursor:hand;cursor:pointer;height:20px;width:20px; right:24px; top:12px; z-index:1;"><img  style="margin-top:5px;margin-left:5px;"  src="' + pImagePath + 'closePop.png" height="11" width="11"/></div>';
    str += '<div id="TopImageContainer">';
    str += '<div id="TopLeftImage" style="float:left; width:15px;"><img style=\'vertical-align:bottom;\' src="' + pImagePath + 'LeftTop.png" height="39" width="15" /></div>';
    str += '<div id="TopCenterImage" style="float:left; width:' + (pWidthUploadMedia - 40) + 'px;"><img  style=\'vertical-align:bottom\'  src="' + pImagePath + 'MidTop.png" height="39" width="' + (pWidthUploadMedia - 40) + '" /></div>';
    str += '<div id="TopRightImage" style="float:left; width:19px;"><img style=\'vertical-align:bottom\' src="' + pImagePath + 'RightTop.png" height="39" width="19" /></div>';
    str += '</div><div id="Middle_Div">';
    str += '<div id="LeftMiddleDiv" style="float:left;width:15px; height:' + (pHeightUploadMedia - 30) + 'px;"><img src="' + pImagePath + 'LeftMiddle.png" height="' + (pHeightUploadMedia - 30) + '" width="15" /></div>';
    str += '<div id="CenterMiddleDiv"  style="float:left; background-color:#cccccc; height:' + (pHeightUploadMedia - 30) + 'px; width:' + (pWidthUploadMedia - 40) + 'px;"><div style="padding-top:4px;  padding-left:3px; padding-right:3px; z-index:1;width:100%;height:90px">' + '<iframe frameborder="0" scrolling="no"  width=\'98%\' height=\'90\'  src=\'../MediaSearch/UploadMedia.aspx?searchType=' + searchType + '&objClick=' + objClick + '&objType=' + objType + '&srcType=' + srcType + '&srcPage=' + srcPage + ' \'style=\'height:90px;\'></iframe>' + '</div></div>';
    str += '<div id="RightMiddleDiv" style="float:left; width:19px; height:' + (pHeightUploadMedia - 30) + 'px;"><img src="' + pImagePath + 'RightMiddle.png" height="' + (pHeightUploadMedia - 30) + '" width="19" /></div>';
    str += '</div><div id="BottomImages">';
    str += '<div style=" width:15px;float:left;"><img src="' + pImagePath + 'LeftBottom.png" height="32" width="15" /></div>';
    str += '<div style=" width:' + (pWidthUploadMedia - 40) + 'px;float:left;"><img src="' + pImagePath + 'MidBottom.png" height="32" width="' + (pWidthUploadMedia - 40) + '" /></div>';
    str += '<div style=" width:19px;float:left;"><img src="' + pImagePath + 'RightBottom.png"  width="19" height="32" /></div></div></div>';

    return str;
}

var pWidthWebCam = 454;
var pHeightWebCam = 425;
var pTitleWebCam = "Web Cam";
var pContentWebCam = "";
function RenderPopUpWebCam(searchType, objClick, objType, srcType, srcPage) {

    str = '<div style="width:' + pWidthWebCam + 'px;height:' + pHeightWebCam + 'px; position:absolute;z-index:1023; top:' + YCord + '; left:' + XCord + ';">';
    str += '<div style="position:absolute; left:22px; top:13px; z-index:1;"><span style="color:#FFFFFF; font-family:Trebuchet MS;font-weight:bold;font-size:12px">' + pTitleWebCam + '</span></div>';
    str += '<div id="CloseMe" onmousemove="document.getElementById(\'CloseMe\').style.backgroundColor = \'gray\';" onmouseout="document.getElementById(\'CloseMe\').style.backgroundColor = \'transparent\';" onclick="javascript:jsHideUploadDiv();"  style="position:absolute;cursor:hand;cursor:pointer;height:20px;width:20px; right:24px; top:12px; z-index:1;"><img  style="margin-top:5px;margin-left:5px;"  src="' + pImagePath + 'closePop.png" height="11" width="11"/></div>';
    str += '<div id="TopImageContainer">';
    str += '<div id="TopLeftImage" style="float:left; width:15px;"><img style=\'vertical-align:bottom;\' src="' + pImagePath + 'LeftTop.png" height="39" width="15" /></div>';
    str += '<div id="TopCenterImage" style="float:left; width:' + (pWidthWebCam - 40) + 'px;"><img  style=\'vertical-align:bottom\'  src="' + pImagePath + 'MidTop.png" height="39" width="' + (pWidthWebCam - 40) + '" /></div>';
    str += '<div id="TopRightImage" style="float:left; width:19px;"><img style=\'vertical-align:bottom\' src="' + pImagePath + 'RightTop.png" height="39" width="19" /></div>';
    str += '</div><div id="Middle_Div">';
    str += '<div id="LeftMiddleDiv" style="float:left;width:15px; height:' + (pHeightWebCam - 30) + 'px;"><img src="' + pImagePath + 'LeftMiddle.png" height="' + (pHeightWebCam - 30) + '" width="15" /></div>';
    str += '<div id="CenterMiddleDiv"  style="float:left; background-color:#cccccc; height:' + (pHeightWebCam - 30) + 'px; width:' + (pWidthWebCam - 40) + 'px;"><div style="padding-top:4px;  padding-left:3px; padding-right:3px; z-index:1;width:100%;height:90px">' + '<iframe id="frmWebCam" frameborder="0" scrolling="no"  width=\'98%\' height=\'390\'  src=\'../MediaSearch/UploadMedia.aspx?searchType=' + searchType + '&objClick=' + objClick + '&objType=' + objType + '&srcType=' + srcType + '&srcPage=' + srcPage + ' \'style=\'height:390px;\'></iframe>' + '</div></div>';
    str += '<div id="RightMiddleDiv" style="float:left; width:19px; height:' + (pHeightWebCam - 30) + 'px;"><img src="' + pImagePath + 'RightMiddle.png" height="' + (pHeightWebCam - 30) + '" width="19" /></div>';
    str += '</div><div id="BottomImages">';
    str += '<div style=" width:15px;float:left;"><img src="' + pImagePath + 'LeftBottom.png" height="32" width="15" /></div>';
    str += '<div style=" width:' + (pWidthWebCam - 40) + 'px;float:left;"><img src="' + pImagePath + 'MidBottom.png" height="32" width="' + (pWidthWebCam - 40) + '" /></div>';
    str += '<div style=" width:19px;float:left;"><img src="' + pImagePath + 'RightBottom.png"  width="19" height="32" /></div></div></div>';

    return str;
}


var pWidthEmbedURL = 354;
var pHeightEmbedURL = 125;
var pTitleEmbedURL = "Embed Video";
var pContentEmbedURL = "";
function RenderPopUpEmbedURL(searchType, objClick, objType, srcType, srcPage) {

    str = '<div style="width:' + pWidthEmbedURL + 'px;height:' + pHeightEmbedURL + 'px; position:absolute;z-index:1023; top:' + YCord + '; left:' + XCord + ';">';
    str += '<div style="position:absolute; left:22px; top:13px; z-index:1;"><span style="color:#FFFFFF; font-family:Trebuchet MS;font-weight:bold;font-size:12px">' + pTitleEmbedURL + '</span></div>';
    str += '<div id="CloseMe" onmousemove="document.getElementById(\'CloseMe\').style.backgroundColor = \'gray\';" onmouseout="document.getElementById(\'CloseMe\').style.backgroundColor = \'transparent\';" onclick="javascript:jsHideMainWebUrlDiv();"  style="position:absolute;cursor:hand;cursor:pointer;height:20px;width:20px; right:24px; top:12px; z-index:1;"><img  style="margin-top:5px;margin-left:5px;"  src="' + pImagePath + 'closePop.png" height="11" width="11"/></div>';
    str += '<div id="TopImageContainer">';
    str += '<div id="TopLeftImage" style="float:left; width:15px;"><img style=\'vertical-align:bottom;\' src="' + pImagePath + 'LeftTop.png" height="39" width="15" /></div>';
    str += '<div id="TopCenterImage" style="float:left; width:' + (pWidthEmbedURL - 40) + 'px;"><img  style=\'vertical-align:bottom\'  src="' + pImagePath + 'MidTop.png" height="39" width="' + (pWidthEmbedURL - 40) + '" /></div>';
    str += '<div id="TopRightImage" style="float:left; width:19px;"><img style=\'vertical-align:bottom\' src="' + pImagePath + 'RightTop.png" height="39" width="19" /></div>';
    str += '</div><div id="Middle_Div">';
    str += '<div id="LeftMiddleDiv" style="float:left;width:15px; height:' + (pHeightEmbedURL - 30) + 'px;"><img src="' + pImagePath + 'LeftMiddle.png" height="' + (pHeightEmbedURL - 30) + '" width="15" /></div>';
    str += '<div id="CenterMiddleDiv"  style="float:left; background-color:#cccccc; height:' + (pHeightEmbedURL - 30) + 'px; width:' + (pWidthEmbedURL - 40) + 'px;"><div style="padding-top:4px;  padding-left:3px; padding-right:3px; z-index:1;width:100%;height:90px">' + '<iframe frameborder="0" scrolling="no"  width=\'98%\' height=\'90\'  src=\'../MediaSearch/SearchMedia.aspx?searchType=' + searchType + '&objClick=' + objClick + '&objType=' + objType + '&srcType=' + srcType + '&srcPage=' + srcPage + ' \'style=\'height:90px;\'></iframe>' + '</div></div>';
    str += '<div id="RightMiddleDiv" style="float:left; width:19px; height:' + (pHeightEmbedURL - 30) + 'px;"><img src="' + pImagePath + 'RightMiddle.png" height="' + (pHeightEmbedURL - 30) + '" width="19" /></div>';
    str += '</div><div id="BottomImages">';
    str += '<div style=" width:15px;float:left;"><img src="' + pImagePath + 'LeftBottom.png" height="32" width="15" /></div>';
    str += '<div style=" width:' + (pWidthEmbedURL - 40) + 'px;float:left;"><img src="' + pImagePath + 'MidBottom.png" height="32" width="' + (pWidthEmbedURL - 40) + '" /></div>';
    str += '<div style=" width:19px;float:left;"><img src="' + pImagePath + 'RightBottom.png"  width="19" height="32" /></div></div></div>';

    return str;
}

///////////////////////////////////////////////
//////Used for User Profile View And Edit/////
////////////////////////////////////////////


function RenderPopUpUProfileEdit(UserId, ProfileType) {

    var pWidthUProfileEdit;
    var pHeightUProfileEdit;
    var pTitleUProfileEdit;
    var pContentUProfileEdit;
    var IframeUrl;
    var dvID;
   
    switch (ProfileType)
    {
        case 'dvShowPersonalProfile':
            pWidthUProfileEdit = 800;
            pHeightUProfileEdit = 490;
            pTitleUProfileEdit = "Personal Information";
            pContentUProfileEdit = "";
            IframeUrl = "EditProfilePersonal.aspx";
            dvID = ProfileType;
            break;
        case 'dvShowWorkEdnProfile':
             pWidthUProfileEdit = 500;
             pHeightUProfileEdit = 450;
             pTitleUProfileEdit = "Work Education";
             pContentUProfileEdit = "";
             IframeUrl = "EditProfileWorkEducation.aspx";
             dvID = ProfileType;
             break;
         case 'dvShowInterestProfile':
             pWidthUProfileEdit = 600;
             pHeightUProfileEdit = 450;
             pTitleUProfileEdit = "Interest";
             pContentUProfileEdit = "";
             IframeUrl = "EditProfileInterest.aspx";
             dvID = ProfileType;
             break;
         case 'dvShowSettingProfile':
             pWidthUProfileEdit = 700;
             pHeightUProfileEdit = 450;
             pTitleUProfileEdit = "Settings";
             pContentUProfileEdit = "";
             IframeUrl = "EditProfileSetting.aspx";
             dvID = ProfileType;
             break;
    }
     
    str = '<div style="width:' + pWidthUProfileEdit + 'px;height:' + pHeightUProfileEdit + 'px; position:absolute;z-index:1023; top:' + YCord + '; left:' + XCord + ';">';
    str += '<div style="position:absolute; left:22px; top:13px; z-index:1;"><span style="color:#FFFFFF; font-family:Trebuchet MS;font-weight:bold;font-size:12px">' + pTitleUProfileEdit + '</span></div>';
    str += '<div id="CloseMe" onmousemove="document.getElementById(\'CloseMe\').style.backgroundColor = \'white\';" onmouseout="document.getElementById(\'CloseMe\').style.backgroundColor = \'white\';" onclick="document.getElementById(\'' + dvID + '\').style.display=\'none\';"  style="position:absolute;cursor:hand;cursor:pointer;height:20px;width:20px; right:24px; top:12px; z-index:1;"><img  style="margin-top:5px;margin-left:5px;"  src="' + pImagePath + 'closePop.png" height="11" width="11"/></div>';
    str += '<div id="TopImageContainer">';
    str += '<div id="TopLeftImage" style="float:left; width:15px;"><img style=\'vertical-align:bottom;\' src="' + pImagePath + 'LeftTop.png" height="39" width="15" /></div>';
    str += '<div id="TopCenterImage" style="float:left; width:' + (pWidthUProfileEdit - 40) + 'px;"><img  style=\'vertical-align:bottom\'  src="' + pImagePath + 'MidTop.png" height="39" width="' + (pWidthUProfileEdit - 40) + '" /></div>';
    str += '<div id="TopRightImage" style="float:left; width:19px;"><img style=\'vertical-align:bottom\' src="' + pImagePath + 'RightTop.png" height="39" width="19" /></div>';
    str += '</div><div id="Middle_Div">';
    str += '<div id="LeftMiddleDiv" style="float:left;width:15px; height:' + (pHeightUProfileEdit - 30) + 'px;"><img src="' + pImagePath + 'LeftMiddle.png" height="' + (pHeightUProfileEdit - 30) + '" width="15" /></div>';
    str += '<div id="CenterMiddleDiv"  style="float:left; background-color:#ffffff; height:' + (pHeightUProfileEdit - 30) + 'px; width:' + (pWidthUProfileEdit - 40) + 'px;"><div style="padding-top:4px;  padding-left:3px; padding-right:3px; z-index:1;width:100%;height:500px">' + '<iframe frameborder="0" scrolling="no"  width=\'98%\' height=\'500\'  src=\'../User/' + IframeUrl + '?UserId=' + UserId + '\' style=\'height:500px;\'></iframe>' + '</div></div>';
    str += '<div id="RightMiddleDiv" style="float:left; width:19px; height:' + (pHeightUProfileEdit - 30) + 'px;"><img src="' + pImagePath + 'RightMiddle.png" height="' + (pHeightUProfileEdit - 30) + '" width="19" /></div>';
    str += '</div><div id="BottomImages">';
    str += '<div style=" width:15px;float:left;"><img src="' + pImagePath + 'LeftBottom.png" height="32" width="15" /></div>';
    str += '<div style=" width:' + (pWidthUProfileEdit - 40) + 'px;float:left;"><img src="' + pImagePath + 'MidBottom.png" height="32" width="' + (pWidthUProfileEdit - 40) + '" /></div>';
    str += '<div style=" width:19px;float:left;"><img src="' + pImagePath + 'RightBottom.png"  width="19" height="32" /></div></div></div>';
     
    return str;
}


function RenderPopUpUProfileEditNew(UserId, ProfileType) {
     
    var pWidthUProfileEdit;
    var pHeightUProfileEdit;
    var pTitleUProfileEdit;
    var pContentUProfileEdit;
    var IframeUrl;
    var dvID;
     
    switch (ProfileType) {
        case 'dvPersonalBtn':
            pWidthUProfileEdit = 730;
            pHeightUProfileEdit = 490;
            pTitleUProfileEdit = "Personal Information";
            pContentUProfileEdit = "";
            IframeUrl = "EditProfilePersonal.aspx";
            dvID = ProfileType;
            str = '<div id="CenterMiddleDiv"  style="float:left;margin-top:1px; background-color:#ebebeb; height:' + (pHeightUProfileEdit - 30) + 'px; width:' + (pWidthUProfileEdit - 60) + 'px;"><div style="padding-top:4px;  padding-left:3px; padding-right:3px; z-index:1;width:680px;height:475px">' + '<iframe frameborder="0" scrolling="no"  width=\'98%\' height=\'475\'  src=\'../User/' + IframeUrl + '?UserId=' + UserId + '\' style=\'height:475px;\'></iframe>' + '</div>';
            break;
        case 'dvWorkEdnBtn':
            pWidthUProfileEdit = 640;
            pHeightUProfileEdit = 280;
            pTitleUProfileEdit = "Work Education";
            pContentUProfileEdit = "";
            IframeUrl = "EditProfileWorkEducation.aspx";
            dvID = ProfileType;
            str = '<div id="CenterMiddleDiv"  style="float:left;margin-top:5px;margin-left:10px; background-color:#ebebeb; height:' + (pHeightUProfileEdit - 30) + 'px; width:' + (pWidthUProfileEdit - 40) + 'px;"><div style="padding-top:4px;  padding-left:3px; padding-right:3px; z-index:1;width:600px;height:280px">' + '<iframe frameborder="0" scrolling="no"  width=\'98%\' height=\'280\'  src=\'../User/' + IframeUrl + '?UserId=' + UserId + '\' style=\'height:280px;\'></iframe>' + '</div>';
            break;
        case 'dvInterestBtn':
            pWidthUProfileEdit = 700;
            pHeightUProfileEdit = 360;
            pTitleUProfileEdit = "Interest";
            pContentUProfileEdit = "";
            IframeUrl = "EditProfileInterest.aspx";
            dvID = ProfileType;
            str = '<div id="CenterMiddleDiv"  style="float:left; background-color:#ebebeb; height:' + (pHeightUProfileEdit - 30) + 'px; width:' + (pWidthUProfileEdit - 60) + 'px;"><div style="padding-top:4px;  padding-left:3px; padding-right:3px; z-index:1;width:680px;height:360px">' + '<iframe frameborder="0" scrolling="no"  width=\'98%\' height=\'360\'  src=\'../User/' + IframeUrl + '?UserId=' + UserId + '\' style=\'height:360px;\'></iframe>' + '</div>';
            break;
        case 'dvSettingBtn':
            pWidthUProfileEdit = 708;
            pHeightUProfileEdit = 355;
            pTitleUProfileEdit = "Settings";
            pContentUProfileEdit = "";
            IframeUrl = "EditProfileSetting.aspx";
            dvID = ProfileType;
            str = '<div id="CenterMiddleDiv"  style="float:left; background-color:#ebebeb; height:' + (pHeightUProfileEdit - 30) + 'px; width:' + (pWidthUProfileEdit - 40) + 'px;"><div style="padding-top:4px;  padding-left:3px; padding-right:3px; z-index:1;width:640px;height:345px">' + '<iframe frameborder="0" scrolling="no"  width=\'98%\' height=\'345\'  src=\'../User/' + IframeUrl + '?UserId=' + UserId + '\' style=\'height:345px;\'></iframe>' + '</div>';
            break;
    }

//    str = '<div style="width:' + pWidthUProfileEdit + 'px;height:' + pHeightUProfileEdit + 'px; position:absolute;z-index:1023; top:' + YCord + '; left:' + XCord + ';">';
//    str += '<div style="position:absolute; left:22px; top:13px; z-index:1;"><span style="color:#FFFFFF; font-family:Trebuchet MS;font-weight:bold;font-size:12px">' + pTitleUProfileEdit + '</span></div>';
//    str += '<div id="CloseMe" onmousemove="document.getElementById(\'CloseMe\').style.backgroundColor = \'white\';" onmouseout="document.getElementById(\'CloseMe\').style.backgroundColor = \'white\';" onclick="document.getElementById(\'' + dvID + '\').style.display=\'none\';"  style="position:absolute;cursor:hand;cursor:pointer;height:20px;width:20px; right:24px; top:12px; z-index:1;"><img  style="margin-top:5px;margin-left:5px;"  src="' + pImagePath + 'closePop.png" height="11" width="11"/></div>';
//    str += '<div id="TopImageContainer">';
//    str += '<div id="TopLeftImage" style="float:left; width:15px;"><img style=\'vertical-align:bottom;\' src="' + pImagePath + 'LeftTop.png" height="39" width="15" /></div>';
//    str += '<div id="TopCenterImage" style="float:left; width:' + (pWidthUProfileEdit - 40) + 'px;"><img  style=\'vertical-align:bottom\'  src="' + pImagePath + 'MidTop.png" height="39" width="' + (pWidthUProfileEdit - 40) + '" /></div>';
//    str += '<div id="TopRightImage" style="float:left; width:19px;"><img style=\'vertical-align:bottom\' src="' + pImagePath + 'RightTop.png" height="39" width="19" /></div>';
//    str += '</div><div id="Middle_Div">';
//    str += '<div id="LeftMiddleDiv" style="float:left;width:15px; height:' + (pHeightUProfileEdit - 30) + 'px;"><img src="' + pImagePath + 'LeftMiddle.png" height="' + (pHeightUProfileEdit - 30) + '" width="15" /></div>';
    
//    str += '<div id="RightMiddleDiv" style="float:left; width:19px; height:' + (pHeightUProfileEdit - 30) + 'px;"><img src="' + pImagePath + 'RightMiddle.png" height="' + (pHeightUProfileEdit - 30) + '" width="19" /></div>';
//    str += '</div><div id="BottomImages">';
//    str += '<div style=" width:15px;float:left;"><img src="' + pImagePath + 'LeftBottom.png" height="32" width="15" /></div>';
//    str += '<div style=" width:' + (pWidthUProfileEdit - 40) + 'px;float:left;"><img src="' + pImagePath + 'MidBottom.png" height="32" width="' + (pWidthUProfileEdit - 40) + '" /></div>';
//    str += '<div style=" width:19px;float:left;"><img src="' + pImagePath + 'RightBottom.png"  width="19" height="32" /></div></div></div>';

    return str;
}

//////End Used for User Profile View And Edit/////


///////////////////////////////////////////////
//////Used for User Image Edit/////
////////////////////////////////////////////
var pWidthUImageEdit = 320;
var pHeightUImageEdit = 100;
var pTitleUImageEdit = "Upload Image";
var pContentUImageEdit = "";

function RenderPopUpUImageEdit(UserId) {
    
    str = '<div style="width:' + pWidthUImageEdit + 'px;height:' + pHeightUImageEdit + 'px; position:absolute;z-index:1023; top:' + YCord + '; left:' + XCord + ';">';
    str += '<div style="position:absolute; left:22px; top:13px; z-index:1;"><span style="color:#FFFFFF; font-family:Trebuchet MS;font-weight:bold;font-size:12px">' + pTitleUImageEdit + '</span></div>';
    str += '<div id="CloseMe" onmousemove="document.getElementById(\'CloseMe\').style.backgroundColor = \'white\';" onmouseout="document.getElementById(\'CloseMe\').style.backgroundColor = \'white\';" onclick="document.getElementById(\'divIFrameUpload\').style.display=\'none\';"  style="position:absolute;cursor:hand;cursor:pointer;height:20px;width:20px; right:24px; top:12px; z-index:1;"><img  style="margin-top:5px;margin-left:5px;"  src="' + pImagePath + 'closePop.png" height="11" width="11"/></div>';
    str += '<div id="TopImageContainer">';
    str += '<div id="TopLeftImage" style="float:left; width:15px;"><img style=\'vertical-align:bottom;\' src="' + pImagePath + 'LeftTop.png" height="39" width="15" /></div>';
    str += '<div id="TopCenterImage" style="float:left; width:' + (pWidthUImageEdit - 40) + 'px;"><img  style=\'vertical-align:bottom\'  src="' + pImagePath + 'MidTop.png" height="39" width="' + (pWidthUImageEdit - 40) + '" /></div>';
    str += '<div id="TopRightImage" style="float:left; width:19px;"><img style=\'vertical-align:bottom\' src="' + pImagePath + 'RightTop.png" height="39" width="19" /></div>';
    str += '</div><div id="Middle_Div">';
    str += '<div id="LeftMiddleDiv" style="float:left;width:15px; height:' + (pHeightUImageEdit - 30) + 'px;"><img src="' + pImagePath + 'LeftMiddle.png" height="' + (pHeightUImageEdit - 30) + '" width="15" /></div>';
    str += '<div id="CenterMiddleDiv"  style="float:left; background-color:#ffffff; height:' + (pHeightUImageEdit - 30) + 'px; width:' + (pWidthUImageEdit - 40) + 'px;"><div style="padding-top:4px;  padding-left:3px; padding-right:3px; z-index:1;width:100%;height:100px">' + '<iframe frameborder="0" scrolling="no"  width=\'98%\' height=\'100\'  src=\'../User/UploadUserImage.aspx?UserId=' + UserId + '\' style=\'height:100px;\'></iframe>' + '</div></div>';
    str += '<div id="RightMiddleDiv" style="float:left; width:19px; height:' + (pHeightUImageEdit - 30) + 'px;"><img src="' + pImagePath + 'RightMiddle.png" height="' + (pHeightUImageEdit - 30) + '" width="19" /></div>';
    str += '</div><div id="BottomImages">';
    str += '<div style=" width:15px;float:left;"><img src="' + pImagePath + 'LeftBottom.png" height="32" width="15" /></div>';
    str += '<div style=" width:' + (pWidthUImageEdit - 40) + 'px;float:left;"><img src="' + pImagePath + 'MidBottom.png" height="32" width="' + (pWidthUImageEdit - 40) + '" /></div>';
    str += '<div style=" width:19px;float:left;"><img src="' + pImagePath + 'RightBottom.png"  width="19" height="32" /></div></div></div>';

    return str;
}
//////End Used for User Profile View And Edit/////


//----------------Functions for search and upload Control
//jsfuncSearch
//Created by Basil
//-------------------------Parameters Starts-----------------------------------------------
// searchType   - 'A'=Article 'I'=Picture 'R'=Audio 'V'=Video,'M' For any media(Album) 
// objClick     - for clicked object to postion it
// objType      - 'Q'=Qn  'A'=Answer or 'O'=Other,
// srcType      - 'U'=Web URL 'W'=Search Web, 'D'=Upload Media,'R'=Record, 'V'=WebCam, 'E'=Embed
// srcPage      - 'Poll'=Poll 'B'=Blog 'U'=UserProfile 'G'=Group 'A'=Album 'C'=Comments in Result 'V'= Vote in Result 'F'=First Level Comment in Result 'M'=Poll Maintenance ,'R'=Comments in Poll Result
//-------------------------Parameters Ends-------------------------------------------------

/**
*
*  Crossbrowser Drag Handler
*  http://www.webtoolkit.info/
*
**/


//document.write('<script type="text/javascript" language="javascript" src="ShowHidePopUp.js"></script>'); 
var DragHandler = {


    // private property.
    _oElem: null,


    // public method. Attach drag handler to an element.
    attach: function(oElem) {
        oElem.onmousedown = DragHandler._dragBegin;

        // callbacks
        oElem.dragBegin = new Function();
        oElem.drag = new Function();
        oElem.dragEnd = new Function();

        return oElem;
    },


    // private method. Begin drag process.
    _dragBegin: function(e) {
        var oElem = DragHandler._oElem = this;

        if (isNaN(parseInt(oElem.style.left))) { oElem.style.left = '0px'; }
        if (isNaN(parseInt(oElem.style.top))) { oElem.style.top = '0px'; }

        var x = parseInt(oElem.style.left);
        var y = parseInt(oElem.style.top);

        e = e ? e : window.event;
        oElem.mouseX = e.clientX;
        oElem.mouseY = e.clientY;

        oElem.dragBegin(oElem, x, y);

        document.onmousemove = DragHandler._drag;
        document.onmouseup = DragHandler._dragEnd;
        //return false;
    },


    // private method. Drag (move) element.
    _drag: function(e) {
        var oElem = DragHandler._oElem;

        var x = parseInt(oElem.style.left);
        var y = parseInt(oElem.style.top);

        e = e ? e : window.event;
        oElem.style.left = x + (e.clientX - oElem.mouseX) + 'px';
        oElem.style.top = y + (e.clientY - oElem.mouseY) + 'px';

        oElem.mouseX = e.clientX;
        oElem.mouseY = e.clientY;

        oElem.drag(oElem, x, y);

        //return false;
    },


    // private method. Stop drag process.
    _dragEnd: function() {
        var oElem = DragHandler._oElem;

        var x = parseInt(oElem.style.left);
        var y = parseInt(oElem.style.top);

        oElem.dragEnd(oElem, x, y);

        document.onmousemove = null;
        document.onmouseup = null;
        DragHandler._oElem = null;
    }

}



var popUpWindow;
 
var AlbumMediaCount = 0;
var ArtServerUrl = '<%=ServerUrl%>';

function jsShowTransparentDiv() {
    if (document.getElementById('divTransparent') != null) {
        document.getElementById('divTransparent').style.display = 'block';

        document.getElementById('divTransparent').style.height = '45px';  //yWithScroll + 'px';

        if (document.getElementById('ProgressIcon1') != null) {
            document.getElementById('ProgressIcon1').style.display = 'block';

            var varProgressIcon1 = document.getElementById('ProgressIcon1');

            varProgressIcon1.style.top = (progressTop + 150) + 'px';
            varProgressIcon1.style.left = (window.screen.width / 2) + 'px';
        }

        if (document.getElementById('ProgressIcon2') != null) {
            document.getElementById('ProgressIcon2').style.display = 'block';
            var varProgressIcon2 = document.getElementById('ProgressIcon2');
            varProgressIcon2.style.left = ((window.screen.width / 2) - 85) + 'px';
            if (navigator.appName == "Netscape")
                varProgressIcon2.style.top = ((window.screen.height / 2) + 210 + window.scrollMaxY / 2) + 'px';
            else
                varProgressIcon2.style.top = ((window.screen.height / 2) + 210 + document.body.scrollHeight / 3) + 'px';
            varProgressIcon2.style.width = '140px';


        }
        if (document.getElementById('ProgressIcon3') != null) {
            document.getElementById('ProgressIcon3').style.display = 'block';
            var varProgressIcon3 = document.getElementById('ProgressIcon3');
            varProgressIcon3.style.left = ((window.screen.width / 2) - 85) + 'px';
            if (navigator.appName == "Netscape")
                varProgressIcon3.style.top = ((window.screen.height / 2) - 60 + window.scrollMaxY / 2) + 'px';
            else
                varProgressIcon3.style.top = ((window.screen.height / 2) - 60 + document.body.scrollHeight / 3) + 'px';
            varProgressIcon3.style.width = '140px';
        }

        if (document.getElementById('ProgressIcon4') != null)
            document.getElementById('ProgressIcon4').style.display = 'block';
        if (document.getElementById('ProgressIcon5') != null)
            document.getElementById('ProgressIcon5').style.display = 'block';
        if (document.getElementById('ProgressIcon6') != null)
            document.getElementById('ProgressIcon6').style.display = 'block';
        if (document.getElementById('ProgressIcon7') != null)
            document.getElementById('ProgressIcon7').style.display = 'block';

        if (document.getElementById('ProgressIcon22') != null) {
            document.getElementById('ProgressIcon22').style.display = 'block';

            var varProgressIcon22 = document.getElementById('ProgressIcon22');
            varProgressIcon22.style.left = ((window.screen.width / 2) - 85) + 'px';
            if (navigator.appName == "Netscape")
                varProgressIcon22.style.top = ((window.screen.height / 2) - 60) + 'px';
            else
                varProgressIcon22.style.top = ((window.screen.height / 2) - 60) + 'px';
            varProgressIcon22.style.width = '140px';

        }

    }
}

function jsHideTransparentDiv() {
    if (document.getElementById('divTransparent') != null) {
        document.getElementById('divTransparent').style.display = 'none';
        if (document.getElementById('ProgressIcon1') != null)
            document.getElementById('ProgressIcon1').style.display = 'none';
        if (document.getElementById('ProgressIcon2') != null)
            document.getElementById('ProgressIcon2').style.display = 'none';
        if (document.getElementById('ProgressIcon3') != null)
            document.getElementById('ProgressIcon3').style.display = 'none';
        if (document.getElementById('ProgressIcon4') != null)
            document.getElementById('ProgressIcon4').style.display = 'none';
        if (document.getElementById('ProgressIcon5') != null)
            document.getElementById('ProgressIcon5').style.display = 'none';
        if (document.getElementById('ProgressIcon6') != null)
            document.getElementById('ProgressIcon6').style.display = 'none';
        if (document.getElementById('ProgressIcon7') != null)
            document.getElementById('ProgressIcon7').style.display = 'none';

        if (document.getElementById('ProgressIcon22') != null)
            document.getElementById('ProgressIcon22').style.display = 'none';
    }
}


function ShowHideTransparentDiv(command) {
    if (command == 'Show') {
        if (GetBrowser() == "FireFox") {
            //parent.content.jsShowTransparentDiv();
        }
        else {
            //window.parent.jsShowTransparentDiv();
        }
    }
    else if (command == 'Hide') {
        if (GetBrowser() == "FireFox") {
            parent.content.jsHideTransparentDiv();
        }
        else {
            window.parent.jsHideTransparentDiv();
        }
    }
}


//its call from addbutton and reply link from poll result detail page
function openDiv(control, CommentSrc, e) {

   
    var controlid = control.id;
    var objhidPollContentId = document.getElementById('ctl00_cp1_hidPollContentId');
    var objhidCommentsLevel = document.getElementById('ctl00_cp1_hidCommentsLevel');

    if (controlid.indexOf('lnkReply') > 0) {
        var sControl = controlid.replace('lnkReply', '');
        var hdnPollCommentId = document.getElementById(sControl + 'hdnPollCommentId');
        var hdPolllevel = document.getElementById(sControl + 'hdPolllevel');
        if (hdnPollCommentId != null)
            if ((hdnPollCommentId.value != ""))
            objhidPollContentId.value = hdnPollCommentId.value;
        if (hdPolllevel != null)
            if ((hdPolllevel.value != ""))
            objhidCommentsLevel.value = hdPolllevel.value;

    }
    var divid = 'ctl00_cp1_DivReply';
    jsSetReplyDivPosition(control, divid, e);
    var objtxtComments = document.getElementById('ctl00_cp1_txtReply');
    var objhdThumbNail = document.getElementById('ctl00_cp1_hidThumbNail');
    var objHiddenContent = document.getElementById('ctl00_cp1_hidContent');
    var objMedia = document.getElementById('ctl00_cp1_hidMedia');
    var objlnkReply = document.getElementById('ctl00_cp1_lnkReply');
    var objlnkAnsComment = document.getElementById('ctl00_cp1_lnkAnsComment');

    if (CommentSrc == "C") {
        document.getElementById('ctl00_cp1_lnkAnsComment').style.display = 'none';
        document.getElementById('ctl00_cp1_lnkReply').style.display = 'block';

    }
    else if (CommentSrc == "A") {
        document.getElementById('ctl00_cp1_lnkReply').style.display = 'none';
        document.getElementById('ctl00_cp1_lnkAnsComment').style.display = 'block';
    }
    objtxtComments.value = "";
    objhdThumbNail.value = "";
    objHiddenContent.value = "";
    objMedia.value = "";
    return false;
}

//function to set position for Reply Div
function jsSetReplyDivPosition(control, name, e)
 {
    if (typeof (window.innerWidth) == 'number') {
        winWidth = window.innerWidth;
        winHeight = window.innerHeight;
    }
    else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
        winWidth = document.documentElement.clientWidth;
        winHeight = document.documentElement.clientHeight;
    }
    else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
        winWidth = document.body.clientWidth;
        winHeight = document.body.clientHeight;
    }
    var scrollX, scrollY, tempX, tempY;
    if (document.all) {
        if (!document.documentElement.scrollLeft)
            scrollX = document.body.scrollLeft;
        else
            scrollX = document.documentElement.scrollLeft;

        if (!document.documentElement.scrollTop)
            scrollY = document.body.scrollTop;
        else
            scrollY = document.documentElement.scrollTop;
    }
    else {
        scrollX = window.pageXOffset;
        scrollY = window.pageYOffset;
    }
    if (!e) var e = window.event;
    if (e.keyCode) code = e.keyCode;
    else if (e.which) code = e.which;

    tempX = e.clientX;
    tempY = e.clientY;

    if (tempX < 0) tempX = 0;
    if (tempY < 0) tempY = 0;


    document.getElementById(name).style.display = "block";

    document.getElementById(name).style.left = '38%';
    if (tempY < 230) {
        document.getElementById(name).style.top = (tempY + scrollY - 30) + 'px';
    }
    else {
        document.getElementById(name).style.top = (tempY + scrollY - 230) + 'px';
    }


    var square = DragHandler.attach(document.getElementById(name));
    square.dragBegin = begin;
    square.drag = drag;
    square.dragEnd = end;

}

function begin(element, x, y) {
    var s = '#' + element.id + ' (begin drag)' + ' x:' + x + ', y:' + y;

}

function drag(element, x, y) {
    var s = '#' + element.id + ' (dragging)' + ' x:' + x + ', y:' + y;

}

function end(element, x, y) {
    var s = '#' + element.id + ' (end drag)' + ' x:' + x + ', y:' + y;

}




function jsSearch(searchType, objClick, objType, srcType, srcPage) {
    
    jsAssignSearchType(searchType);
    if (srcPage == 'Poll' && srcType == 'W') {
        jsHideUploadDiv();  //Hiding upload Div
        jsHideWebUrlDiv();  //Hiding Web Url Div
        jsShowSearchDiv();  //Showing search Div
        jsSetPosition(objClick, 250, 0, srcType); //Setting the Position        
        if (objClick.id.split('_')[1])
            lastChar = objClick.id.split('_')[1];  //last char for identifying Id
        else
            lastChar = 0;
        jsAssignIFrameContent(searchType, lastChar, objType, srcType, srcPage); //Assign IFrame Content Page

    }
    else if (srcPage == 'Poll' && srcType == 'D') {
        jsHideSearchDiv();  //Hiding upload Div
        jsHideWebUrlDiv();  //Hiding Web Url Div
        jsShowUploadDiv();  //Showing search Div
        jsSetPosition(objClick, 250, 0, srcType); //Setting the Position
        if (objClick.id.split('_')[1])
            lastChar = objClick.id.split('_')[1];  //last char for identifying Id
        else
            lastChar = 0;
        jsAssignIFrameContent(searchType, lastChar, objType, srcType, srcPage); //Assign IFrame Content Page

    }
    else if (srcPage == 'Poll' && srcType == 'U') {
        jsHideUploadDiv();  //Hiding upload Div
        jsHideSearchDiv();  //Hiding search Div
        jsShowWebUrlDiv();  //Showing Web Url Div            
        if (objClick.id.split('_')[1])
            lastChar = objClick.id.split('_')[1];  //last char for identifying Id
        else
            lastChar = 0;
        jsSetPosition(objClick, 250, 0, srcType); //Setting the Position
        jsAssignIFrameContent(searchType, lastChar, objType, srcType, srcPage); //Assign IFrame Content Page      
    }
    else if (srcPage == 'Poll' && srcType == 'E') {
        jsHideUploadDiv();  //Hiding upload Div
        jsHideSearchDiv();  //Hiding search Div
        jsShowWebUrlDiv();  //Showing Web Url Div            
        if (objClick.id.split('_')[1])
            lastChar = objClick.id.split('_')[1];  //last char for identifying Id
        else
            lastChar = 0;
        jsSetPosition(objClick, 250, 0, srcType); //Setting the Position
        jsAssignIFrameContent(searchType, lastChar, objType, srcType, srcPage); //Assign IFrame Content Page      
    }
    else if (srcPage == 'Poll' && srcType == 'A') {
        jsHideUploadDiv();  //Hiding upload Div
        jsHideSearchDiv();  //Hiding search Div
        jsShowWebUrlDiv();  //Showing Web Url Div            
        if (objClick.id.split('_')[1])
            lastChar = objClick.id.split('_')[1];  //last char for identifying Id
        else
            lastChar = 0;
        jsSetPosition(objClick, 250, 0, srcType); //Setting the Position
        jsAssignIFrameContent(searchType, lastChar, objType, srcType, srcPage); //Assign IFrame Content Page      
    }
    else if (srcPage == 'Poll' && srcType == 'V') {

        jsHideSearchDiv();  //Hiding upload Div
        jsHideWebUrlDiv();  //Hiding Web Url Div
        jsShowUploadDiv();  //Showing search Div
        jsSetPosition(objClick, 250, 0, srcType); //Setting the Position        
        if (objClick.id.split('_')[1])
            lastChar = objClick.id.split('_')[1];  //last char for identifying Id
        else
            lastChar = 0;
        jsAssignIFrameContent(searchType, lastChar, objType, srcType, srcPage); //Assign IFrame Content Page
    }
    if (srcPage == 'B' && srcType == 'W') {
        jsHideUploadDiv();  //Hiding upload Div
        jsHideWebUrlDiv();  //Hiding Web Url Div
        jsShowSearchDiv();  //Showing search Div
        jsSetPosition(objClick, 250, 0, srcType); //Setting the Position        
        if (objClick.id.split('_')[1])
            lastChar = objClick.id.split('_')[1];  //last char for identifying Id
        else
            lastChar = 0;
        jsAssignIFrameContent(searchType, lastChar, objType, srcType, srcPage); //Assign IFrame Content Page

    }
    else if (srcPage == 'G' && srcType == 'W') {
        jsHideUploadDiv();  //Hiding upload Div
        jsShowSearchDiv();  //Showing search Div
        jsSetPosition(objClick, 250, 0, srcType); //Setting the Position
        if (objClick.id.split('_')[1])
            lastChar = objClick.id.split('_')[1];  //last char for identifying Id
        else
            lastChar = 0;
        jsAssignIFrameContent(searchType, lastChar, objType, srcType, srcPage); //Assign IFrame Content Page

    }
    else if (srcPage == 'G' && srcType == 'D') {
        jsHideSearchDiv();  //Hiding upload Div
        jsShowUploadDiv();  //Showing search Div
        jsSetPosition(objClick, 250, 0, srcType); //Setting the Position
        if (objClick.id.split('_')[1])
            lastChar = objClick.id.split('_')[1];  //last char for identifying Id
        else
            lastChar = 0;
        jsAssignIFrameContent(searchType, lastChar, objType, srcType, srcPage); //Assign IFrame Content Page

    }
    else if (srcPage == 'C' && srcType == 'W') {
        jsHideUploadDiv();  //Hiding upload Div
        jsHideWebUrlDiv();  //Hiding Web Url Div
        jsShowSearchDiv();  //Showing search Div
        jsSetPosition(objClick, 250, 0, srcType); //Setting the Position
        if (objClick.id.split('_')[3])
            lastChar = objClick.id.split('_')[3];  //last char for identifying Id
        else
            lastChar = 0;
        jsAssignIFrameContent(searchType, lastChar, objType, srcType, srcPage); //Assign IFrame Content Page

    }
    else if (srcPage == 'C' && srcType == 'D') {
        jsHideSearchDiv();  //Hiding upload Div
        jsHideWebUrlDiv();  //Hiding Web Url Div
        jsShowUploadDiv();  //Showing search Div
        jsSetPosition(objClick, 250, 0, srcType); //Setting the Position
        if (objClick.id.split('_')[3])
            lastChar = objClick.id.split('_')[3];  //last char for identifying Id
        else
            lastChar = 0;
        jsAssignIFrameContent(searchType, lastChar, objType, srcType, srcPage); //Assign IFrame Content Page

    }
    else if (srcPage == 'C' && srcType == 'U') {
        jsHideUploadDiv();  //Hiding upload Div
        jsHideSearchDiv();  //Hiding search Div
        jsShowWebUrlDiv();  //Showing Web Url Div
        if (objClick.id.split('_')[3])
            lastChar = objClick.id.split('_')[3];  //last char for identifying Id
        else
            lastChar = 0;
        jsSetPosition(objClick, 250, 0, srcType); //Setting the Position
        jsAssignIFrameContent(searchType, lastChar, objType, srcType, srcPage); //Assign IFrame Content Page      
    }
    else if (srcPage == 'C' && srcType == 'V') {
        jsHideSearchDiv();  //Hiding upload Div
        jsHideWebUrlDiv();  //Hiding Web Url Div
        jsShowUploadDiv();  //Showing search Div
        jsSetPosition(objClick, 250, 0, srcType); //Setting the Position
        if (objClick.id.split('_')[3])
            lastChar = objClick.id.split('_')[3];  //last char for identifying Id
        else
            lastChar = 0;
        jsAssignIFrameContent(searchType, lastChar, objType, srcType, srcPage); //Assign IFrame Content Page
    }
    else if (srcPage == 'V' && srcType == 'W') {
        jsHideUploadDiv();  //Hiding upload Div
        jsHideWebUrlDiv();  //Hiding Web Url Div
        jsShowSearchDiv();  //Showing search Div
        jsSetPosition(objClick, 250, 0, srcType); //Setting the Position

        if (objClick.id.split('_')[3])
            lastChar = objClick.id.split('_')[3];  //last char for identifying Id
        else
            lastChar = 0;
        jsAssignIFrameContent(searchType, lastChar, objType, srcType, srcPage); //Assign IFrame Content Page

    }
    else if (srcPage == 'V' && srcType == 'D') {
        jsHideSearchDiv();  //Hiding upload Div
        jsHideWebUrlDiv();  //Hiding Web Url Div
        jsShowUploadDiv();  //Showing search Div
        jsSetPosition(objClick, 250, 0, srcType); //Setting the Position
        if (objClick.id.split('_')[3])
            lastChar = objClick.id.split('_')[3];  //last char for identifying Id
        else
            lastChar = 0;
        jsAssignIFrameContent(searchType, lastChar, objType, srcType, srcPage); //Assign IFrame Content Page
    }
    else if (srcPage == 'V' && srcType == 'U') {
        jsHideUploadDiv();  //Hiding upload Div
        jsHideSearchDiv();  //Hiding search Div
        jsShowWebUrlDiv();  //Showing Web Url Div
        if (objClick.id.split('_')[3])
            lastChar = objClick.id.split('_')[3];  //last char for identifying Id
        else
            lastChar = 0;
        jsSetPosition(objClick, 250, 0, srcType); //Setting the Position
        jsAssignIFrameContent(searchType, lastChar, objType, srcType, srcPage); //Assign IFrame Content Page      
    }
    else if (srcPage == 'V' && srcType == 'V') {
        jsHideSearchDiv();  //Hiding upload Div
        jsHideWebUrlDiv();  //Hiding Web Url Div
        jsShowUploadDiv();  //Showing search Div
        jsSetPosition(objClick, 250, 0, srcType); //Setting the Position
        if (objClick.id.split('_')[3])
            lastChar = objClick.id.split('_')[3];  //last char for identifying Id
        else
            lastChar = 0;
        jsAssignIFrameContent(searchType, lastChar, objType, srcType, srcPage); //Assign IFrame Content Page
    }
    else if (srcPage == 'F' && srcType == 'W') {
        jsHideUploadDiv();  //Hiding upload Div
        jsHideWebUrlDiv();  //Hiding Web Url Div
        jsShowSearchDiv();  //Showing search Div
        jsSetPosition(objClick, 250, 0, srcType); //Setting the Position

        if (objClick.id.split('_')[3])
            lastChar = objClick.id.split('_')[3];  //last char for identifying Id
        else
            lastChar = 0;
        jsAssignIFrameContent(searchType, lastChar, objType, srcType, srcPage); //Assign IFrame Content Page

    }
    else if (srcPage == 'F' && srcType == 'D') {
        jsHideSearchDiv();  //Hiding upload Div
        jsHideWebUrlDiv();  //Hiding Web Url Div
        jsShowUploadDiv();  //Showing search Div
        jsSetPosition(objClick, 250, 0, srcType); //Setting the Position
        if (objClick.id.split('_')[3])
            lastChar = objClick.id.split('_')[3];  //last char for identifying Id
        else
            lastChar = 0;
        jsAssignIFrameContent(searchType, lastChar, objType, srcType, srcPage); //Assign IFrame Content Page

    }
    else if (srcPage == 'F' && srcType == 'U') {
        jsHideUploadDiv();  //Hiding upload Div
        jsHideSearchDiv();  //Hiding search Div
        jsShowWebUrlDiv();  //Showing Web Url Div
        if (objClick.id.split('_')[3])
            lastChar = objClick.id.split('_')[3];  //last char for identifying Id
        else
            lastChar = 0;
        jsSetPosition(objClick, 250, 0, srcType); //Setting the Position
        jsAssignIFrameContent(searchType, lastChar, objType, srcType, srcPage); //Assign IFrame Content Page      
    }
    else if (srcPage == 'F' && srcType == 'V') {
        jsHideSearchDiv();  //Hiding upload Div
        jsHideWebUrlDiv();  //Hiding Web Url Div
        jsShowUploadDiv();  //Showing search Div
        jsSetPosition(objClick, 250, 0, srcType); //Setting the Position
        if (objClick.id.split('_')[1])
            lastChar = objClick.id.split('_')[1];  //last char for identifying Id
        else
            lastChar = 0;
        jsAssignIFrameContent(searchType, lastChar, objType, srcType, srcPage); //Assign IFrame Content Page
    }
    else if (srcPage == 'M' && srcType == 'W') {
        jsHideUploadDiv();  //Hiding upload Div
        jsHideWebUrlDiv();  //Hiding Web Url Div
        jsHideTextDiv();   //Hiding Text Div
        jsShowSearchDiv();  //Showing search Div
        jsSetPosition(objClick, 250, 0, srcType); //Setting the Position

        if (objClick.id.split('_')[3])
            lastChar = objClick.id.split('_')[3];  //last char for identifying Id
        else
            lastChar = 0;
        jsAssignIFrameContent(searchType, lastChar, objType, srcType, srcPage); //Assign IFrame Content Page

    }
    else if (srcPage == 'M' && srcType == 'D') {

        jsHideSearchDiv();  //Hiding upload Div
        jsHideWebUrlDiv();  //Hiding Web Url Div
        jsHideTextDiv();   //Hiding Text Div
        jsShowUploadDiv();  //Showing search Div
        jsSetPosition(objClick, 250, 0, srcType); //Setting the Position
        if (objClick.id.split('_')[3])
            lastChar = objClick.id.split('_')[3];  //last char for identifying Id
        else
            lastChar = 0;
        jsAssignIFrameContent(searchType, lastChar, objType, srcType, srcPage); //Assign IFrame Content Page

    }
    else if (srcPage == 'M' && srcType == 'U') {
        jsHideUploadDiv();  //Hiding upload Div
        jsHideSearchDiv();  //Hiding search Div
        jsHideTextDiv();   //Hiding Text Div
        jsShowWebUrlDiv();  //Showing Web Url Div
        if (objClick.id.split('_')[3])
            lastChar = objClick.id.split('_')[3];  //last char for identifying Id
        else
            lastChar = 0;
        jsSetPosition(objClick, 250, 0, srcType); //Setting the Position
        jsAssignIFrameContent(searchType, lastChar, objType, srcType, srcPage); //Assign IFrame Content Page      
    }
    else if (srcPage == 'M' && srcType == 'V') {
        jsHideSearchDiv();  //Hiding upload Div
        jsHideWebUrlDiv();  //Hiding Web Url Div
        jsHideTextDiv();   //Hiding Text Div
        jsShowUploadDiv();  //Showing search Div
        jsSetPosition(objClick, 250, 0, srcType); //Setting the Position
        if (objClick.id.split('_')[3])
            lastChar = objClick.id.split('_')[3];  //last char for identifying Id
        else
            lastChar = 0;
        jsAssignIFrameContent(searchType, lastChar, objType, srcType, srcPage); //Assign IFrame Content Page
    }
    else if (srcPage == 'M' && srcType == 'T') {
        jsHideSearchDiv();  //Hiding upload Div
        jsHideWebUrlDiv();  //Hiding Web Url Div
        jsHideUploadDiv();  //Showing search Div
        jsShowTextDiv();   //Showing Text Div
        jsSetPosition(objClick, 250, 0, srcType); //Setting the Position
        return false;

    }
    else if (srcPage == 'A' && srcType == 'D') {
        jsShowUploadDiv();  //Showing search Div
        jsSetPosition(objClick, 250, 0, srcType); //Setting the Position
        if (objClick.id.split('_')[3])
            lastChar = objClick.id.split('_')[3];  //last char for identifying Id
        else
            lastChar = 0;
        jsAssignIFrameContent(searchType, lastChar, objType, srcType, srcPage); //Assign IFrame Content Page

    }
    else if (srcPage == 'A' && srcType == 'V') {
        jsShowUploadDiv();  //Showing search Div
        jsSetPosition(objClick, 250, 0, srcType); //Setting the Position
        if (objClick.id.split('_')[1])
            lastChar = objClick.id.split('_')[3];  //last char for identifying Id
        else
            lastChar = 0;
        jsAssignIFrameContent(searchType, lastChar, objType, srcType, srcPage); //Assign IFrame Content Page
    }
    //Poll Result Comments
    else if (srcPage == 'R' && srcType == 'W') {
        jsHideUploadDiv();  //Hiding upload Div
        jsHideWebUrlDiv();  //Hiding Web Url Div
        jsShowSearchDiv();  //Showing search Div
        jsSetPosition(objClick, 250, 0, srcType); //Setting the Position

        if (objClick.id.split('_')[3])
            lastChar = objClick.id.split('_')[3];  //last char for identifying Id
        else
            lastChar = 0;
        jsAssignIFrameContent(searchType, lastChar, objType, srcType, srcPage); //Assign IFrame Content Page

    }
    else if (srcPage == 'R' && srcType == 'D') {
        jsHideSearchDiv();  //Hiding upload Div
        jsHideWebUrlDiv();  //Hiding Web Url Div
        jsShowUploadDiv();  //Showing search Div
        jsSetPosition(objClick, 250, 0, srcType); //Setting the Position
        if (objClick.id.split('_')[3])
            lastChar = objClick.id.split('_')[3];  //last char for identifying Id
        else
            lastChar = 0;
        jsAssignIFrameContent(searchType, lastChar, objType, srcType, srcPage); //Assign IFrame Content Page

    }
    else if (srcPage == 'R' && srcType == 'U') {
        jsHideUploadDiv();  //Hiding upload Div
        jsHideSearchDiv();  //Hiding search Div
        jsShowWebUrlDiv();  //Showing Web Url Div
        if (objClick.id.split('_')[3])
            lastChar = objClick.id.split('_')[3];  //last char for identifying Id
        else
            lastChar = 0;
        jsSetPosition(objClick, 250, 5, srcType); //Setting the Position
        jsAssignIFrameContent(searchType, lastChar, objType, srcType, srcPage); //Assign IFrame Content Page      
    }
    else if (srcPage == 'R' && srcType == 'V') {
        jsHideSearchDiv();  //Hiding upload Div
        jsHideWebUrlDiv();  //Hiding Web Url Div
        jsShowUploadDiv();  //Showing search Div
        jsSetPosition(objClick, 250, 25, srcType); //Setting the Position
        if (objClick.id.split('_')[3])
            lastChar = objClick.id.split('_')[3];  //last char for identifying Id
        else
            lastChar = 0;
        jsAssignIFrameContent(searchType, lastChar, objType, srcType, srcPage); //Assign IFrame Content Page
    }

}

//Function To Show Text Div For Comment Edit 
function jsShowTextDiv() {
    var objdvText = document.getElementById('ctl00_cp1_' + 'dvAddText');
    var objtxtAddText = document.getElementById('ctl00_cp1_' + 'txtAddText');
    if (objdvText) {
        objdvText.style.visibility = "visible";
    }
    if (objtxtAddText) {
        objtxtAddText.value = "";
    }
}
//Function To Hide Text Div For Comment Edit
function jsHideTextDiv() {
    var objdvText = document.getElementById('ctl00_cp1_' + 'dvAddText');
    if (objdvText) {
        objdvText.style.visibility = "hidden";
    }
}

function jsAssignText() {
    var objtxtAddText = document.getElementById('ctl00_cp1_' + 'txtAddText');
    var objtxtComments = document.getElementById('ctl00_cp1_txtReply');
    if (isEmpty(objtxtAddText) == true) {
        return false;
    }
    var objdvText = document.getElementById('ctl00_cp1_' + 'dvAddText');
    if (objdvText) {
        objtxtComments.value = objtxtAddText.value;
        objdvText.style.visibility = "hidden";
        objdvText.value = "";
        jsHideSearchDiv();
        var objhidCommentAdd = document.getElementById('ctl00_cp1_btnHidden');
        objhidCommentAdd.click();
        return false;
    }
}

//Function To Show Search Div
function jsShowSearchDiv() {
    var objdvSearch = document.getElementById('ctl00_cp1_' + 'dvSearch');
    if (objdvSearch) {
        objdvSearch.style.display = "block";
        //objdvSearch.style.zIndex = "999999";
    }
}
//Function To Hide Search Div
function jsHideSearchDiv() {

    //    //hideframeDuplicate();
    //    var objdvSearch = document.getElementById('ctl00_cp1_' + 'dvSearch');
    //    if (objdvSearch) {
    //        objdvSearch.innerHTML = "";
    //        objdvSearch.style.visibility = "hidden";
    //        objdvSearch.style.zIndex = "-100";

    if (document.getElementById('dvPreview') != null) {
        var objdvPreview = document.getElementById('dvPreview');
        if (objdvPreview) {
            document.getElementById('dvPreview').innerHTML = ""; //Stop playing video if running...
        }
    }
   
    
    var objdvSearch;

    if (GetBrowser() == "FireFox") {
        objdvSearch = parent.content.document.getElementById('ctl00_cp1_dvSearch');
    }
    else if (GetBrowser() == "Internet Explorer" || GetBrowser() == "Chrome" || GetBrowser() == "Safari") {
        objdvSearch = window.parent.ctl00_cp1_dvSearch;
    }
    else {
        objdvSearch = window.parent.ctl00_cp1_dvSearch;

    }
    if (objdvSearch) {
        objdvSearch.style.display = 'none';
        //objdvSearch.style.zIndex = "-100";
    }

}

//function to Show Upload Div
function jsShowUploadDiv() {
    var objdvFileUpload = document.getElementById('ctl00_cp1_' + 'dvFileUpload');
    if (objdvFileUpload) {
        objdvFileUpload.style.display = "block";
        //objdvFileUpload.style.zIndex = "1";
    }
}

//function to Hide Upload Div
function jsHideUploadDiv() {
    //    var objdvFileUpload = document.getElementById('ctl00_cp1_' + 'dvFileUpload');
    //    if (objdvFileUpload) {
    //        objdvFileUpload.innerHTML = "";
    //        objdvFileUpload.style.visibility = "hidden";
    //        objdvFileUpload.style.zIndex = "-100";
    //    }
    
    /*
    
    if (GetBrowser() == "FireFox") {
        objdvFileUpload = parent.content.document.getElementById('ctl00_cp1_dvFileUpload');
    }
    else if (GetBrowser() == "Internet Explorer" || GetBrowser() == "Chrome" || GetBrowser() == "Safari") {
    objdvFileUpload = document.getElementById('ctl00_cp1_' + 'dvFileUpload'); //window.parent.ctl00_cp1_dvFileUpload;
        if (objdvFileUpload==null)
            {
                objdvFileUpload = document.getElementById('dvFileUpload');
            }
    }
    else {
        objdvFileUpload = window.parent.ctl00_cp1_dvFileUpload;
    }

    objdvFileUpload.innerHTML = "";
    objdvFileUpload.style.display = "none";
    //objdvFileUpload.style.zIndex = "-100";
    */
}

//function to Show Web Url Div
function jsShowWebUrlDiv() {
    var objdvUrl = document.getElementById('ctl00_cp1_' + 'dvUrl');
    if (objdvUrl) {
        
        objdvUrl.style.display = 'block';
        //objdvUrl.style.zIndex = "1";

    }
}

//function to Hide Web Url Div
function jsHideWebUrlDiv() {
    var objdvUrl = document.getElementById('ctl00_cp1_' + 'dvUrl');
    var objtxtUrl = document.getElementById('ctl00_cp1_txtUrl');
    if (objtxtUrl) {
        objtxtUrl.value = "";
    }
    if (objdvUrl) {
        objdvUrl.style.display = 'none';
        //objdvUrl.style.zIndex = "-100";
    }

}
//function to Hide Main Web Url Div
function jsHideMainWebUrlDiv() {

    //window.parent.jsHideUrlDiv();

    if (GetBrowser() == "FireFox") {
        parent.content.jsHideUrlDiv();
    }
    else if (GetBrowser() == "Internet Explorer" || GetBrowser() == "Chrome" || GetBrowser() == "Safari") {

        window.parent.jsHideUrlDiv();
    }
    else {

        window.parent.jsHideUrlDiv();
    }
}


//Function for Web Url ObjType
function jsAssignQnAnsTyp(objType) //For Web Url assigning QnAns type
{
    var objhidQnAnsTyp = document.getElementById('ctl00_cp1_hidQnAnsTyp');
    if (objhidQnAnsTyp)
        objhidQnAnsTyp.value = objType;
}
function jsAssignObjClick(ObjClick) //For Web Url assigning ObjClick
{
    var objhidobjClick = document.getElementById('ctl00_cp1_hidobjClick');
    if (objhidobjClick)
        objhidobjClick.value = ObjClick;
}
function jsAssignSearchType(searchType) //Assigning Media Type
{
    var objhidmediaType = document.getElementById('ctl00_cp1_hidmediaType');

    if (objhidmediaType)
        objhidmediaType.value = searchType;

}
//Assigning Article Media Path
function jsArticleMedia(url) //For Web Url assigning Media Type
{ 
    var objhidmedia = document.getElementById('ctl00_cp1_hidArticleMedia');
    if (objhidmedia)
        objhidmedia.value = url;

}



//To check Field is Empty ot not
function isEmpty(id) {
    var val = Trim(id.value);
    if (val == "") {
        return true;
    }
    else {
        return false;
    }
}
function jsWebUrlIsEmpty() {
    var objtxtUrl = document.getElementById('ctl00_cp1_txtUrl');
    var obj_dvErrMsg = document.getElementById('ctl00_cp1_dvErrMsg');
    var hidQnAnsTyp = document.getElementById('ctl00_cp1_hidQnAnsTyp');
    var hidobjClick = document.getElementById('ctl00_cp1_hidobjClick');
    var objhidmediaType = document.getElementById('ctl00_cp1_hidmediaType');
    var hidQn = document.getElementById('ctl00_cp1_hidQn');
    if (isEmpty(objtxtUrl) == true) {
        obj_dvErrMsg.style.visibility = "visible";
        obj_dvErrMsg.innerHTML = 'Please Enter the Url';
        return false;
    }
    else {

        obj_dvErrMsg.style.visibility = "hidden";
        if (hidQnAnsTyp.value == 'Q') {
            hidQn.value = objtxtUrl.value + ',' + objhidmediaType.value;
            jsHideWebUrlDiv();
            return false;

        }
        else if (hidQnAnsTyp.value == 'A') {

            var objhidAns = document.getElementById('ctl00_cp1_hidAns' + hidobjClick.value);
            objhidAns.value = objtxtUrl.value + ',' + objhidmediaType.value;
            jsHideWebUrlDiv();
            return false;
        }

    }
}



//Function To Assign Content Page of the IFrame
function jsAssignIFrameContent(searchType, objClick, objType, srcType, srcPage) {
    var objdvSearch = document.getElementById('ctl00_cp1_' + 'dvSearch');
    if (srcType == 'W') //Search Web
    {

        if (objdvSearch) {
            objdvSearch.style.width = "680";
            objdvSearch.style.height = "550px";
            objdvSearch.style.marginLeft = "-30px";
            objdvSearch.innerHTML = RenderPopUpSearchMedia(searchType, objClick, objType, srcType, srcPage);     // "<iframe src='../MediaSearch/SearchMedia.aspx?searchType=" + searchType + "&objClick=" + objClick + "&objType=" + objType + "&srcType=" + srcType + "&srcPage=" + srcPage + "' width='680px' height='550px'></iframe>";
           
        }
    }
    else if (srcType == 'D') //Upload Media
    { 
        objdvSearch = document.getElementById('ctl00_cp1_' + 'dvFileUpload');

        //This is used for new implementation of Album image Upload
        if (objdvSearch == null) {
            objdvSearch = document.getElementById('dvFileUpload');
        }
        if (objdvSearch) {

            objdvSearch.style.width = "250";
            objdvSearch.style.height = "220px";
            objdvSearch.style.marginLeft = "-30px";
            objdvSearch.style.borderStyle = 'none';
            objdvSearch.style.display = 'block';
             objdvSearch.innerHTML = RenderPopUpUploadMedia(searchType, objClick, objType, srcType, srcPage);
             
             
            
            //objdvSearch.innerHTML = "<iframe src='../MediaSearch/UploadMedia.aspx?searchType=" + searchType + "&objClick=" + objClick + "&objType=" + objType + "&srcType=" + srcType + "&srcPage=" + srcPage + "' width='310px' height='120px'></iframe>";
        }
    }
    else if (srcType == 'U') //Web URL
    {

        objdvSearch = document.getElementById('ctl00_cp1_' + 'dvUrl');

        if (objdvSearch) {

            objdvSearch.style.width = "250";
            objdvSearch.style.height = "220px";
            objdvSearch.style.marginLeft = "-30px";
            objdvSearch.style.borderStyle = 'none';
            objdvSearch.innerHTML = RenderPopUpArticleURL(searchType, objClick, objType, srcType, srcPage);    //"<iframe src='../MediaSearch/SearchMedia.aspx?searchType=" + searchType + "&objClick=" + objClick + "&objType=" + objType + "&srcType=" + srcType + "&srcPage=" + srcPage + "' width='300px' height='120px'></iframe>";

        }

    }
    else if (srcType == 'E') //Embed 
    {
        objdvSearch = document.getElementById('ctl00_cp1_' + 'dvUrl');
        //        if (objdvSearch) {
        //            objdvSearch.innerHTML = "<iframe src='../MediaSearch/SearchMedia.aspx?searchType=" + searchType + "&objClick=" + objClick + "&objType=" + objType + "&srcType=" + srcType + "&srcPage=" + srcPage + "' width='300px' height='110px'></iframe>";

        //        }

        if (objdvSearch) {

            objdvSearch.style.width = "250";
            objdvSearch.style.height = "220px";
            objdvSearch.style.marginLeft = "-30px";
            objdvSearch.style.borderStyle = 'none';
            objdvSearch.innerHTML = RenderPopUpEmbedURL(searchType, objClick, objType, srcType, srcPage);    //"<iframe src='../MediaSearch/SearchMedia.aspx?searchType=" + searchType + "&objClick=" + objClick + "&objType=" + objType + "&srcType=" + srcType + "&srcPage=" + srcPage + "' width='300px' height='120px'></iframe>";

        }

    }
    else if (srcType == 'V') //Web Cam
    {
        objdvSearch = document.getElementById('ctl00_cp1_' + 'dvFileUpload');
        //This is used for new implementation of Album image Upload
        if (objdvSearch == null) {
            objdvSearch = document.getElementById('dvFileUpload');
        }
        if (objdvSearch) {
            objdvSearch.style.width = "480";
            objdvSearch.style.height = "550px";
            objdvSearch.style.marginLeft = "-30px";
            objdvSearch.style.display = 'block';
            objdvSearch.innerHTML = RenderPopUpWebCam(searchType, objClick, objType, srcType, srcPage);     // "<iframe src='../MediaSearch/SearchMedia.aspx?searchType=" + searchType + "&objClick=" + objClick + "&objType=" + objType + "&srcType=" + srcType + "&srcPage=" + srcPage + "' width='680px' height='550px'></iframe>";
            //objdvSearch.innerHTML = "<iframe src='../MediaSearch/UploadMedia.aspx?searchType=" + searchType + "&objClick=" + objClick + "&objType=" + objType + "&srcType=" + srcType + "&srcPage=" + srcPage + "' width='445px' height='450px'></iframe>";
        }
    }

}
function getScreenCenterX() {
    return (document.body.clientWidth / 2);
}


var progressTop;
//function to set position for an object --eg: this,38,diff bet current object,srcType)
function jsSetPosition(objClick, leftdistance, topdistance, srcType) {

    var curLeft = parseInt(findPosX(objClick));
    var curTop = parseInt(findPosY(objClick));

    if (srcType == 'W') {
        objdvSearch = document.getElementById('ctl00_cp1_' + 'dvSearch');
        curLeft = getScreenCenterX() - 340;

        //        objdvSearch.style.left = curLeft + "px";
        //        objdvSearch.style.top = (curTop + topdistance-560) + "px";

    }
    else if (srcType == 'D') {
        objdvSearch = document.getElementById('ctl00_cp1_' + 'dvFileUpload');
        //        objdvSearch.style.left = curLeft + "px";
        //        objdvSearch.style.top = (curTop + topdistance-210) + "px";
    }

    else if (srcType == 'V') {
        objdvSearch = document.getElementById('ctl00_cp1_' + 'dvFileUpload');
        //        objdvSearch.style.left = curLeft + "px";
        //        objdvSearch.style.top = (curTop + topdistance-560) + "px";
    }

    else if (srcType == 'T') {
        objdvSearch = document.getElementById('ctl00_cp1_' + 'dvAddText');
        //        objdvSearch.style.left = curLeft + "px";
        //        objdvSearch.style.top = (curTop + topdistance-210) + "px";
    }
    if (srcType == 'U' || srcType == 'E' || srcType == 'A') {
        objdvSearch = document.getElementById('ctl00_cp1_' + 'dvUrl');
        //        objdvSearch.style.left = curLeft + "px";
        //        objdvSearch.style.top = (curTop + topdistance-210) + "px";
    }
    if (objdvSearch) {
        objdvSearch.style.left = curLeft + "px";
        objdvSearch.style.top = (curTop + topdistance) + "px";
    }
    progressTop = curTop;

}
//function to get the object id
function jsGetSrcId(objClick) {
    var objClickedsrc = objClick.id;
    return objClickedsrc;
}

//function to Show the Thumbnail selected
function jsShowSelected(searchType, url, thumb, objClick, objType, srcType, srcPage, CommandType) {
    //srcPage - 'Poll'=Poll 'B'=Blog 'U'=UserProfile 'G'=Group 'A'=Album
    //srcType  - 'U'=Web URL 'W'=Search Web, 'D'=Upload Media,'R'=Record, 'V'=WebCam,'E' = Embed
   
    if (srcPage == 'Album' && searchType == 'V' && srcType == 'WC') {
        jsAssignAlbumSelectedMedia(searchType, url, thumb, objClick, objType, srcType, srcPage);
        CloseUploadMediaPopFromAlbumWC();
    }
    else if (CommandType=='webcam')
    {
        jsShowSelectedPoll(searchType, url, thumb, objClick, objType, srcType, srcPage, CommandType);
        CloseUploadMediaPopFromAlbum();
    }
    else if (CommandType == 'btnpreview') {
        jsShowSelectedPoll(searchType, url, thumb, objClick, objType, srcType, srcPage, CommandType);
        //CloseUploadMediaPopFromAlbum();
    }
    else 
    {
        jsShowSelectedPoll(searchType, url, thumb, objClick, objType, srcType, srcPage, CommandType);
    }
}


//Function To Hide Search Div
function jsHideDivSearch() {
    objdvSearch = document.getElementById('ctl00_cp1_dvSearch');
    if (dvSearch) {
        dvSearch.innerHTML = "";
        //dvSearch.style.zIndex = "-100";
        dvSearch.style.display = "none";

    }

}


//Function For Prieview Media
function jsImageVideoPreview(dvImageVideoId, hidImageVideoId, mediaType, ServerUrl, objClick) {
    
    objdvImageVideoId = document.getElementById(dvImageVideoId);
    if (objdvImageVideoId) {
        var curLeft = parseInt(findPosX(objClick));
        var curTop = parseInt(findPosY(objClick));
        objdvImageVideoId.style.left = (curLeft + 75) + "px";
        objdvImageVideoId.style.top = (curTop + 20) + "px";
    }
    closePopup();
    if (mediaType != "A") {
        if (dvImageVideoId) {
            if (document.getElementById(dvImageVideoId) != null) {
                document.getElementById(dvImageVideoId).style.display = 'block';
                document.getElementById(dvImageVideoId).style.backgroundColor = 'White';
            }
            else {
                parent.document.getElementById(dvImageVideoId).style.display = 'block';
                parent.document.getElementById(dvImageVideoId).style.backgroundColor = 'White';
            }
        }
    }
    else {
        if (dvImageVideoId) {
            document.getElementById(dvImageVideoId).style.display = 'none';
        }
    }
    if(document.getElementById('dvPreviewContent')!=null)
        var objdvPreviewContent = document.getElementById('dvPreviewContent');
    else
        var objdvPreviewContent = parent.document.getElementById('dvPreviewContent');
        
        if(document.getElementById(hidImageVideoId)!=null)
            var objhidImageVideoId = document.getElementById(hidImageVideoId);
        else
            var objhidImageVideoId = parent.document.getElementById(hidImageVideoId);
            
    if (objhidImageVideoId) {
        var param = objhidImageVideoId.value;
        if ((param.indexOf(',I') != -1) || (param.indexOf(',V') != -1))
        param = param.substring(0, param.length - 2);
        //param = param.split(',')[0];
        var sFlash = "";
        if (mediaType == "A") {
            var url = "";
            var objhidImageVideoId = document.getElementById(hidImageVideoId);
            if (objhidImageVideoId) {

                param = objhidImageVideoId.value.split(',')[0];
                url = param;
            }
            //Modified by Cyrene Jacob...use the new popUpWindow ScriptEngine in mControl.js
            //popUpWindow = window.open(url, "mywindow", "location=0,menubar=1,resizable=1,status=1,scrollbars=1,  width=500,height=600");
            openWindow(url, null, null);
            
            return false;
        }
        else if (mediaType == "I") {
            var imgPath = objhidImageVideoId.value.split(",")[0];
            if (imgPath) {
                //Modified by Cyrene Jacob...................................................
                //var sImageRender = "<img style='max-height:270px;max-width:200px;' src= '" + imgPath + "' />";
                //if (objdvPreviewContent)
                //objdvPreviewContent.innerHTML = sImageRender;
                if (parent.writeMediaDiv) {
                    parent.writeMediaDiv(imgPath, "Image Preview", "2");
                }
                else {
                   
                    writeMediaDiv(imgPath, "Image Preview", "2");
                }
            }
        }
        else if (mediaType == "V") { 
//        ServerUrl = ServerUrl + '/';
//            sFlash = GetEmbedForPreview(param, ServerUrl, 640, 385);

//            if (objdvPreviewContent) {
//                objdvPreviewContent.innerHTML = sFlash;
        //            }
        if (parent.writeMediaDiv)
            parent.writeMediaDiv(param, "Video Preview", "1");
        else
            writeMediaDiv(param, "Video Preview", "1");
       }
        
    }
}



//Function For Prieview Media For Album
function jsImageVideoPreviewAlbum_temp(dvImageVideoId, hidImageVideoId, mediaType, ServerUrl, objClick) {

    objdvImageVideoId = document.getElementById(dvImageVideoId);
    if (objdvImageVideoId) {
        var curLeft = parseInt(findPosX(objClick));
        var curTop = parseInt(findPosY(objClick));
        objdvImageVideoId.style.left = (curLeft + 75) + "px";
        objdvImageVideoId.style.top = (curTop + 20) + "px";
    }
    closePopup();
    if (mediaType != "A") {
        if (dvImageVideoId) {
            document.getElementById(dvImageVideoId).style.display = 'block';
            document.getElementById(dvImageVideoId).style.backgroundColor = 'White';
        }
    }
    else {
        if (dvImageVideoId) {
            document.getElementById(dvImageVideoId).style.display = 'none';
        }
    }

    var objdvPreviewContent = document.getElementById('dvPreviewContent');
    var objhidImageVideoId = document.getElementById(hidImageVideoId);
    if (objhidImageVideoId) {
        var param = objhidImageVideoId.value;

        param = param.split(',')[0];
        var sFlash = "";
        if (mediaType == "A") {
            var url = "";
            var objhidImageVideoId = document.getElementById(hidImageVideoId);
            if (objhidImageVideoId) {
                param = objhidImageVideoId.value.split(',')[0];
                url = param;
            }

            popUpWindow = window.open(url, "mywindow", "location=0,menubar=1,resizable=1,status=1,scrollbars=1,  width=500,height=600");
            return false;
        }
        else if (mediaType == "I") {
            var imgPath = objhidImageVideoId.value.split(",")[0];
            var ext = imgPath.substring(imgPath.lastIndexOf('.'));
            var imgPathArray = imgPath.split(ext);
            var imgPathArrayValue = imgPathArray[0].replace("UploadedImages", "UploadedThumbnails");
            imgPath = imgPathArrayValue + "_preview.jpg";
            if (imgPath) {
                var sImageRender = "<img style='max-height:270px;max-width:200px;' src= '" + imgPath + "' />";
                if (objdvPreviewContent)
                    objdvPreviewContent.innerHTML = sImageRender;
            }
        }
        else if (mediaType == "V") {
            if (param.indexOf(ServerUrl) >= 0)   //for flash
            {
                sFlash = PlayVideo(param, 0, 0, 0, ServerUrl + "/", 640, 385); //This function is declare in global.js file.
            }
            else  // for You Tube
            {
                //param = param.replace("http://www.youtube.com/watch?v=", "http://www.youtube.com/v/");
                sFlash = PlayYouTube(param, 640, 385); //This function is declare in global.js file.
            }
            if (objdvPreviewContent) {
                objdvPreviewContent.innerHTML = sFlash;
            }
        }


    }
}


function jsClosePreviewContent() {

    objdvPreviewContent = document.getElementById('dvPreviewContent');
    if (objdvPreviewContent)
        objdvPreviewContent.innerHTML = "";
    objdvImageVideo = document.getElementById('dvImageVideo')
    if (objdvImageVideo)
        objdvImageVideo.style.display = 'none';
}

//Function to Show Poll selected Media and preview controls
function jsShowSelectedPoll(searchType, url, thumb, objClick, objType, srcType, srcPage, CommandType) {
    
    if (srcType == 'W') {

        if (srcPage == 'C') {
            jsHideSearchDiv();
            jsAssignCommentSelectedMedia(searchType, url, thumb, objClick, objType, srcType, srcPage);
        }
        else if (srcPage == 'R') {
            jsHideSearchDiv();
            jsAssignResultCommentSelectedMedia(searchType, url, thumb, objClick, objType, srcType, srcPage);
        }
        else if (srcPage == 'V') {
            jsHideSearchDiv();
            jsAssignVoteCommentSelectedMedia(searchType, url, thumb, objClick, objType, srcType, srcPage);
        }
        else if (srcPage == 'F') {
            jsHideSearchDiv();
            jsAssignFirstCommentSelectedMedia(searchType, url, thumb, objClick, objType, srcType, srcPage);
        }
        else if (srcPage == 'A') {
            jsHideSearchDiv();
            jsAssignAlbumSelectedMedia(searchType, url, thumb, objClick, objType, srcType, srcPage);
        }
        else if (srcPage == 'M') {
            jsHideSearchDiv();
            jsAssignCommentEditSelectedMedia(searchType, url, thumb, objClick, objType, srcType, srcPage);
        }
        else {
            jsHideSearchDiv();
            jsAssignPollSelectedMedia(searchType, url, thumb, objClick, objType, srcType, srcPage, CommandType);
        }
    }
    else if (srcType == 'D') {
        if (srcPage == 'C') {
            jsHideUploadDiv();
            jsAssignCommentSelectedMedia(searchType, url, thumb, objClick, objType, srcType, srcPage);
        }
        else if (srcPage == 'R') {
            jsHideUploadDiv();
            jsAssignResultCommentSelectedMedia(searchType, url, thumb, objClick, objType, srcType, srcPage);
        }

        else if (srcPage == 'V') {
            jsHideUploadDiv();
            jsAssignVoteCommentSelectedMedia(searchType, url, thumb, objClick, objType, srcType, srcPage);
        }
        else if (srcPage == 'F') {
            jsHideUploadDiv();
            jsAssignFirstCommentSelectedMedia(searchType, url, thumb, objClick, objType, srcType, srcPage);
        }
        else if (srcPage == 'A') {
            jsHideUploadDiv();
            jsAssignAlbumSelectedMedia(searchType, url, thumb, objClick, objType, srcType, srcPage);
        }
        else if (srcPage == 'M') {
            jsHideUploadDiv();
            jsAssignCommentEditSelectedMedia(searchType, url, thumb, objClick, objType, srcType, srcPage);
        }
        else {
            jsHideUploadDiv();
            jsAssignPollSelectedMedia(searchType, url, thumb, objClick, objType, srcType, srcPage, CommandType);
        }
    }

    else if (srcType == 'U') //For Web Url
    {
        if (srcPage == 'C') {
            jsHideWebUrlDiv();
            jsAssignCommentSelectedMedia(searchType, url, thumb, objClick, objType, srcType, srcPage);
        }
        else if (srcPage == 'R') {
            jsHideUploadDiv();
            jsAssignResultCommentSelectedMedia(searchType, url, thumb, objClick, objType, srcType, srcPage);
        }
        else if (srcPage == 'V') {
            jsHideWebUrlDiv();
            jsAssignVoteCommentSelectedMedia(searchType, url, thumb, objClick, objType, srcType, srcPage);
        }
        else if (srcPage == 'F') {
            jsHideWebUrlDiv();
            jsAssignFirstCommentSelectedMedia(searchType, url, thumb, objClick, objType, srcType, srcPage);
        }
        else if (srcPage == 'A') {
            jsHideWebUrlDiv();
            jsAssignAlbumSelectedMedia(searchType, url, thumb, objClick, objType, srcType, srcPage);
        }
        else if (srcPage == 'M') {
            jsHideWebUrlDiv();
            jsAssignCommentEditSelectedMedia(searchType, url, thumb, objClick, objType, srcType, srcPage);
        }
        else {
            jsHideWebUrlDiv();
            jsAssignPollSelectedMedia(searchType, url, thumb, objClick, objType, srcType, srcPage, CommandType);
        }
    }
    else if (srcType == 'E') //For Embed
    {
        jsHideWebUrlDiv();
        jsAssignPollSelectedMedia(searchType, url, thumb, objClick, objType, srcType, srcPage, CommandType);

    }
    else if (srcType == 'V') {
        if (srcPage == 'C') {
            jsHideUploadDiv();
            jsAssignCommentSelectedMedia(searchType, url, thumb, objClick, objType, srcType, srcPage);
        }
        else if (srcPage == 'R') {
            jsHideUploadDiv();
            jsAssignResultCommentSelectedMedia(searchType, url, thumb, objClick, objType, srcType, srcPage);
        }
        else if (srcPage == 'V') {

            jsHideUploadDiv();
            jsAssignVoteCommentSelectedMedia(searchType, url, thumb, objClick, objType, srcType, srcPage);
        }
        else if (srcPage == 'F') {
            jsHideUploadDiv();
            jsAssignFirstCommentSelectedMedia(searchType, url, thumb, objClick, objType, srcType, srcPage);
        }
        else if (srcPage == 'A') {
            jsHideUploadDiv();
            jsAssignAlbumSelectedMedia(searchType, url, thumb, objClick, objType, srcType, srcPage);
        }
        else if (srcPage == 'M') {
            jsHideUploadDiv();
            jsAssignCommentEditSelectedMedia(searchType, url, thumb, objClick, objType, srcType, srcPage);
        }
        else {
            jsHideUploadDiv();
            jsAssignPollSelectedMedia(searchType, url, thumb, objClick, objType, srcType, srcPage, CommandType);
        }
    }

}
function jsAssignAlbumSelectedMedia(searchType, url, thumb, objClick, objType, srcType, srcPage) {
    
    var doc;
    if (srcType == "WC")
        doc = document;
    else
        doc = parent.document;
    var hdCurrentPointer = doc.getElementById('hdCurrentPointer');
    
    AlbumMediaCount = parseInt(hdCurrentPointer.value,10) + 1;
   doc.getElementById('albumMedia_' + AlbumMediaCount).style.display = 'block';

    var objhdTotalCount =doc.getElementById('ctl00_cp1_hdTotalCount');
    //Used for New implemantation of AlbumMedia
    if (objhdTotalCount == null) {
        objhdTotalCount =doc.getElementById('hdTotalCount');
    }
    objhdTotalCount.value = AlbumMediaCount;
    var objdvImgRow2 =doc.getElementById('dvImgRow2');
    objdvImgRow2.style.display = "block";

    if (AlbumMediaCount > 7) {
       doc.getElementById('dvAddNewMedia').style.display = "none";
     }
    else {
       doc.getElementById('dvAddNewMedia').style.display = "block";
     }

     var dvMediaDate =doc.getElementById('dvMediaDate_' + AlbumMediaCount);
     var objImg =doc.getElementById('ctl00_cp1_Img_' + AlbumMediaCount);
    //Used for New implemantation of AlbumMedia
    if (objImg==null)
    {
        var objImg =doc.getElementById('Img_' + AlbumMediaCount);
    }

    var objhdMedia =doc.getElementById('ctl00_cp1_hdMedia_' + AlbumMediaCount);
    //Used for New implemantation of AlbumMedia
    if (objhdMedia==null)
    {
        var objhdMedia =doc.getElementById('hdMedia_' + AlbumMediaCount);
    }

    var objhdThumb =doc.getElementById('ctl00_cp1_hdThumb_' + AlbumMediaCount);
    //Used for New implemantation of AlbumMedia
    if (objhdThumb==null)
    {
        var objhdThumb =doc.getElementById('hdThumb_' + AlbumMediaCount);    
    }
    //var objdvCover = document.getElementById('dvCover_' + AlbumMediaCount);
    var objdvDesc =doc.getElementById('divDesc' + AlbumMediaCount);
    //objdvCover.style.display = "block";
    //objdvDesc.style.display = "block";
    var objHiddenContent =doc.getElementById('ctl00_cp1_hdContent1');
    //Used for New implemantation of AlbumMedia
    if (objHiddenContent==null)
    {
        var objHiddenContent =doc.getElementById('hdContent1');
    }
    

    if (objImg) {
        var today = new Date();
        objImg.src = thumb;
        objhdMedia.value = url + ',' + Trim(searchType);
        objhdThumb.value = thumb;
        dvMediaDate.innerText = today.toLocaleDateString();
        //Showing Remove button for answer
        var btnRemoveMediaAlbum =doc.getElementById('ctl00_cp1_btnRemoveAlbumMedia_' + AlbumMediaCount);
        if (btnRemoveMediaAlbum) {
            btnRemoveMediaAlbum.style.display = 'block';
            btnRemoveMediaAlbum.onclick = "";
            btnRemoveMediaAlbum.onclick = new Function("javascript:RemoveAlbumMedia(this.id.split('_')[3])");
        }
        //For Preview
        var PreviewAlbum = document.getElementById('ctl00_cp1_ancPreview_' + AlbumMediaCount);
        if (PreviewAlbum) {
            PreviewAlbum.style.display = 'block';
            PreviewAlbum.onclick = "";
            PreviewAlbum.onclick = new Function("javascript:jsImageVideoPreviewAlbum_temp('dvImageVideo','ctl00_cp1_hdMedia_'+this.id.split('_')[3],'" + albumType + "',ServerUrl,this)");
        }
    }

    doc.getElementById('hdCurrentPointer').value = parseInt(doc.getElementById('hdCurrentPointer').value, 10) + 1;

    
    var objdvUpload = doc.getElementById('divUploadMediaWindow');
    if (AlbumMediaCount < 10) {
        objdvUpload.style.display = "block";

    }
    else {
        objdvUpload.style.display = "none";
    }

    //CloseUploadMediaPopFromAlbum();
    
    //return false;

}

function CloseUploadMediaPopFromAlbum() {
    try {
        if (window.parent.document.getElementById('divUploadMediaWindow') != null) {
            window.parent.document.getElementById('divUploadMediaWindow').style.display = 'none';
            window.parent.document.getElementById('divUploadMediaWindow').innerHTML = "";
        }
        else if (window.parent.content.document.getElementById('divUploadMediaWindow') != null) {
        
        window.parent.content.document.getElementById('divUploadMediaWindow').style.display = 'none';
        window.parent.content.document.getElementById('divUploadMediaWindow').innerHTML = "";
        }   
        
    }
    catch (ex) {
        alert(ex); 
    } 
}

function CloseUploadMediaPopFromAlbumWC()
{
    try {
        document.getElementById('divUploadMediaWindow').style.display = 'none';
        document.getElementById('divUploadMediaWindow').innerHTML = "";
    } 
    catch (ex)
   {alert(ex); } 
}

function jsAssignResultCommentSelectedMedia(searchType, url, thumb, objClick, objType, srcType, srcPage) {
     

    var objtxtComments = document.getElementById('ctl00_cp1_txtReply');
    var objhdThumbNail = document.getElementById('ctl00_cp1_hidThumbNail');
    var objHiddenContent = document.getElementById('ctl00_cp1_hidContent');
    var objMedia = document.getElementById('ctl00_cp1_hidMedia');
    var iIndex = url.lastIndexOf("/");
    var filename = "";
    if (iIndex > -1) {
        filename = url.substring(iIndex + 1);

    }
    var iTextIndex = "";
    var objLastText = "";

    if (objtxtComments.value.length > 0 && (objtxtComments.value.length - objtxtComments.value.lastIndexOf("|")) == 1) //last added content is media
    {
        (objHiddenContent.value) += url + ',' + Trim(searchType) + '|';
        (objtxtComments.value) += filename + '|';
        (objMedia.value) += url + ',' + Trim(searchType) + '|';
        (objhdThumbNail.value) += thumb + ',' + Trim(searchType) + '|';
    }
    else if (objtxtComments.value.length > 0 && (objtxtComments.value.length - objtxtComments.value.lastIndexOf("|")) > 1)//last added content is text
    {
        iTextIndex = objtxtComments.value.lastIndexOf("|");
        objLastText = objtxtComments.value.substring(iTextIndex + 1);
        (objHiddenContent.value) += objLastText + '|' + url + ',' + Trim(searchType) + '|';
        (objtxtComments.value) += '|' + filename + '|';
        (objMedia.value) += '   ' + url + ',' + Trim(searchType) + '|';
        (objhdThumbNail.value) += '   ' + thumb + ',' + Trim(searchType) + '|';

    }
    else if (objtxtComments.value.length > 0 && objtxtComments.value.lastIndexOf("|") == -1)//first added content is text
    {
        iTextIndex = objtxtComments.value.lastIndexOf("/");
        objLastText = objtxtComments.value.substring(iTextIndex + 1);
        (objHiddenContent.value) += objLastText + '|' + url + ',' + Trim(searchType) + '|';
        (objtxtComments.value) += '|' + filename + '|';
        (objMedia.value) += '   ' + url + ',' + Trim(searchType) + '|';
        (objhdThumbNail.value) += '   ' + thumb + ',' + Trim(searchType) + '|';
    }

    else {
        objHiddenContent.value = url + ',' + Trim(searchType) + '|'
        objtxtComments.value = filename + '|'
        objMedia.value = url + ',' + Trim(searchType) + '|'
        objhdThumbNail.value = thumb + ',' + Trim(searchType) + '|';
    }
    return false;

}

function jsAssignCommentSelectedMedia(searchType, url, thumb, objClick, objType, srcType, srcPage) {
     
    var objtxtComments = document.getElementById('ctl00_cp1_repPollResult_' + objClick + '_txtReply');
    var objAddcomment = document.getElementById('ctl00_cp1_txtComments');
    var objhdThumbNail = document.getElementById('ctl00_cp1_repPollResult_' + objClick + '_hdThumbNail');
    var objHiddenContent = document.getElementById('ctl00_cp1_repPollResult_' + objClick + '_hdContent');
    var objMedia = document.getElementById('ctl00_cp1_repPollResult_' + objClick + '_hdMedia');
    var iIndex = url.lastIndexOf("/");
    var filename = "";
    if (iIndex > -1) {
        filename = url.substring(iIndex + 1);

    }
    var iTextIndex = "";
    var objLastText = "";

    if (objtxtComments.value.length > 0 && (objtxtComments.value.length - objtxtComments.value.lastIndexOf("|")) == 1) //last added content is media
    {
        (objHiddenContent.value) += url + ',' + Trim(searchType) + '|';
        (objtxtComments.value) += filename + '|';
        (objMedia.value) += url + ',' + Trim(searchType) + '|';
        (objhdThumbNail.value) += thumb + ',' + Trim(searchType) + '|';
    }
    else if (objtxtComments.value.length > 0 && (objtxtComments.value.length - objtxtComments.value.lastIndexOf("|")) > 1)//last added content is text
    {
        iTextIndex = objtxtComments.value.lastIndexOf("|");
        objLastText = objtxtComments.value.substring(iTextIndex + 1);
        (objHiddenContent.value) += objLastText + '|' + url + ',' + Trim(searchType) + '|';
        (objtxtComments.value) += '|' + filename + '|';
        (objMedia.value) += '   ' + url + ',' + Trim(searchType) + '|';
        (objhdThumbNail.value) += '   ' + thumb + ',' + Trim(searchType) + '|';

    }
    else if (objtxtComments.value.length > 0 && objtxtComments.value.lastIndexOf("|") == -1)//first added content is text
    {
        iTextIndex = objtxtComments.value.lastIndexOf("/");
        objLastText = objtxtComments.value.substring(iTextIndex + 1);
        (objHiddenContent.value) += objLastText + '|' + url + ',' + Trim(searchType) + '|';
        (objtxtComments.value) += '|' + filename + '|';
        (objMedia.value) += '   ' + url + ',' + Trim(searchType) + '|';
        (objhdThumbNail.value) += '   ' + thumb + ',' + Trim(searchType) + '|';
    }

    else {
        objHiddenContent.value = url + ',' + Trim(searchType) + '|'
        objtxtComments.value = filename + '|'
        objMedia.value = url + ',' + Trim(searchType) + '|'
        objhdThumbNail.value = thumb + ',' + Trim(searchType) + '|';
    }
    return false;

}
function jsAssignVoteCommentSelectedMedia(searchType, url, thumb, objClick, objType, srcType, srcPage) {
    
    var objControlId = document.getElementById('ctl00_cp1_hdControlId');
    objClick = objControlId.value.split('_')[3]; //'ctl04';
    var objtxtComments = document.getElementById('ctl00_cp1_repPollDetail_' + objClick + '_txtComments');
    var objHiddenContent = document.getElementById('ctl00_cp1_repPollDetail_' + objClick + '_hdContent1');
    var objMedia = document.getElementById('ctl00_cp1_repPollDetail_' + objClick + '_hdMedia1');
    var objhdThumbNail = document.getElementById('ctl00_cp1_repPollDetail_' + objClick + '_hdThumbNail1');
    var iIndex = url.lastIndexOf("/");
    var filename = "";
    if (iIndex > -1) {
        filename = url.substring(iIndex + 1);

    }
    var iTextIndex = "";
    var objLastText = "";
    if (objtxtComments.value.length > 0 && (objtxtComments.value.length - objtxtComments.value.lastIndexOf("|")) == 1) //last added content is media
    {
        (objHiddenContent.value) += url + ',' + Trim(searchType) + '|';
        (objtxtComments.value) += filename + '|';
        (objMedia.value) += url + ',' + Trim(searchType) + '|';
        (objhdThumbNail.value) += thumb + ',' + Trim(searchType) + '|';
    }
    else if (objtxtComments.value.length > 0 && (objtxtComments.value.length - objtxtComments.value.lastIndexOf("|")) > 1)//last added content is text
    {
        iTextIndex = objtxtComments.value.lastIndexOf("|");
        objLastText = objtxtComments.value.substring(iTextIndex + 1);
        (objHiddenContent.value) += objLastText + '|' + url + ',' + Trim(searchType) + '|';
        (objtxtComments.value) += '|' + filename + '|';
        (objMedia.value) += '   ' + url + ',' + Trim(searchType) + '|';
        (objhdThumbNail.value) += '   ' + thumb + ',' + Trim(searchType) + '|';

    }
    else if (objtxtComments.value.length > 0 && objtxtComments.value.lastIndexOf("|") == -1)//first added content is text
    {
        iTextIndex = objtxtComments.value.lastIndexOf("/");
        objLastText = objtxtComments.value.substring(iTextIndex + 1);
        (objHiddenContent.value) += objLastText + '|' + url + ',' + Trim(searchType) + '|';
        (objtxtComments.value) += '|' + filename + '|';
        (objMedia.value) += '   ' + url + ',' + Trim(searchType) + '|';
        (objhdThumbNail.value) += '   ' + thumb + ',' + Trim(searchType) + '|';
    }

    else {
        objHiddenContent.value = url + ',' + Trim(searchType) + '|'
        objtxtComments.value = filename + '|'
        objMedia.value = url + ',' + Trim(searchType) + '|'
        objhdThumbNail.value = thumb + ',' + Trim(searchType) + '|';
    }
    return false;
    
}


function jsAssignFirstCommentSelectedMedia(searchType, url, thumb, objClick, objType, srcType, srcPage) {
    
    var objtxtComments = document.getElementById('ctl00_cp1_txtComments');
    var objhdThumbNail = document.getElementById('ctl00_cp1_hdThumbNail1');
    var objHiddenContent = document.getElementById('ctl00_cp1_hdContent1');
    var objMedia = document.getElementById('ctl00_cp1_hdMedia1');
    var iIndex = url.lastIndexOf("/");
    var filename = "";
    if (iIndex > -1) {
        filename = url.substring(iIndex + 1);

    }
    var iTextIndex = "";
    var objLastText = "";
    if (objtxtComments.value.length > 0 && (objtxtComments.value.length - objtxtComments.value.lastIndexOf("|")) == 1) //last added content is media
    {
        (objHiddenContent.value) += url + ',' + Trim(searchType) + '|';
        (objtxtComments.value) += filename + '|';
        (objMedia.value) += url + ',' + Trim(searchType) + '|';
        (objhdThumbNail.value) += thumb + ',' + Trim(searchType) + '|';
    }
    else if (objtxtComments.value.length > 0 && (objtxtComments.value.length - objtxtComments.value.lastIndexOf("|")) > 1)//last added content is text
    {
        iTextIndex = objtxtComments.value.lastIndexOf("|");
        objLastText = objtxtComments.value.substring(iTextIndex + 1);
        (objHiddenContent.value) += objLastText + '|' + url + ',' + Trim(searchType) + '|';
        (objtxtComments.value) += '|' + filename + '|';
        (objMedia.value) += '   ' + url + ',' + Trim(searchType) + '|';
        (objhdThumbNail.value) += '   ' + thumb + ',' + Trim(searchType) + '|';

    }
    else if (objtxtComments.value.length > 0 && objtxtComments.value.lastIndexOf("|") == -1)//first added content is text
    {
        iTextIndex = objtxtComments.value.lastIndexOf("/");
        objLastText = objtxtComments.value.substring(iTextIndex + 1);
        (objHiddenContent.value) += objLastText + '|' + url + ',' + Trim(searchType) + '|';
        (objtxtComments.value) += '|' + filename + '|';
        (objMedia.value) += '   ' + url + ',' + Trim(searchType) + '|';
        (objhdThumbNail.value) += '   ' + thumb + ',' + Trim(searchType) + '|';
    }

    else {
        objHiddenContent.value = url + ',' + Trim(searchType) + '|'
        objtxtComments.value = filename + '|'
        objMedia.value = url + ',' + Trim(searchType) + '|'
        objhdThumbNail.value = thumb + ',' + Trim(searchType) + '|';
    }
    return false;

}
function jsAssignCommentEditSelectedMedia(searchType, url, thumb, objClick, objType, srcType, srcPage) {
     
    var objtxtComments = document.getElementById('ctl00_cp1_txtReply');
    var objHiddenContent = document.getElementById('ctl00_cp1_hdContent');
    var objMedia = document.getElementById('ctl00_cp1_hdMedia');
    var filename = "";
    url = url.replace("http://www.youtube.com/watch?v=", "http://www.youtube.com/v/");
    filename = url;
    var iTextIndex = "";
    var objLastText = "";
    if (objtxtComments.value.length > 0 && (objtxtComments.value.length - objtxtComments.value.lastIndexOf("|")) == 1) //last added content is media
    {
        (objHiddenContent.value) += url + ',' + Trim(searchType) + '|';
        (objtxtComments.value) += filename + ',' + Trim(searchType) + '|';
        (objMedia.value) += url + ',' + Trim(searchType) + '|';
    }
    else if (objtxtComments.value.length > 0 && (objtxtComments.value.length - objtxtComments.value.lastIndexOf("|")) > 1)//last added content is text
    {
        iTextIndex = objtxtComments.value.lastIndexOf("/");
        objLastText = objtxtComments.value.substring(iTextIndex + 1);
        (objHiddenContent.value) += objLastText + '|' + url + ',' + Trim(searchType) + '|';
        (objtxtComments.value) += '|' + filename + ',' + Trim(searchType) + '|';
        (objMedia.value) += url + ',' + Trim(searchType) + '|';

    }
    else if (objtxtComments.value.length > 0 && objtxtComments.value.lastIndexOf("|") == -1)//first added content is text
    {
        iTextIndex = objtxtComments.value.lastIndexOf("/");
        objLastText = objtxtComments.value.substring(iTextIndex + 1);
        (objHiddenContent.value) += objLastText + '|' + url + ',' + Trim(searchType) + '|';
        (objtxtComments.value) += '|' + filename + ',' + Trim(searchType) + '|';
        (objMedia.value) += '|' + url + ',' + Trim(searchType) + '|';
    }

    else {
        objHiddenContent.value = url + ',' + Trim(searchType) + '|'
        objtxtComments.value = filename + ',' + Trim(searchType) + '|';
        objMedia.value = url + ',' + Trim(searchType) + '|'
    }
    var objhidCommentAdd = document.getElementById('ctl00_cp1_btnHidden');
    objhidCommentAdd.click();
    return false;

}

function jsAssignPollSelectedMedia(searchType, url, thumb, objClick, objType, srcType, srcPage, CommandType) {
    
    if (objType == "Q") {
        objselectedImage = document.getElementById('ctl00_cp1_imgPollQnSelected');

        if (objselectedImage) {
            objselectedImage.src = thumb; //Showing Selected Image
            var objRemoveMediaQn = document.getElementById('ctl00_cp1_btnRemoveMediaQn');
            if (objRemoveMediaQn)
                objRemoveMediaQn.style.display = 'block';
            var PreviewQuestion = document.getElementById('ctl00_cp1_lnkPreviewQuestion');
            if (PreviewQuestion) {
                PreviewQuestion.style.display = "block";
                PreviewQuestion.onclick = new Function("javascript:jsImageVideoPreview('dvImageVideo','ctl00_cp1_hidQn','" + searchType + "',ServerUrl,this)");

            }
            
            objThumb = document.getElementById('ctl00_cp1_hidQnThumb');
            if (objThumb) {
                objThumb.value = thumb;
            }

            objHid = document.getElementById('ctl00_cp1_hidQn');
            if (objHid) {
                objHid.value = url + "," + searchType;
            }
        }
    }
    else if (objType == "A") {
        objselectedImage = document.getElementById('ctl00_cp1_imgAns' + objClick);
        if (objselectedImage) {
            objselectedImage.src = thumb; //Showing Selected Image;
            //Assigning to Hidden Control
            objThumb = document.getElementById('ctl00_cp1_hidAnsThumb' + objClick);
            if (objThumb)
                objThumb.value = thumb;
            //Showing Remove button for answer
            var btnRemoveMediaAnswer = document.getElementById('ctl00_cp1_btnRemoveMediaAnswer' + objClick);
            if (btnRemoveMediaAnswer)
                btnRemoveMediaAnswer.style.display = 'block';
            //For Preview
            var PreviewAnswer = document.getElementById('ctl00_cp1_ancPreviewAnswer_' + objClick);
            if (PreviewAnswer) {
                PreviewAnswer.style.display = 'block';
                PreviewAnswer.onclick = new Function("javascript:jsImageVideoPreview('dvImageVideo','ctl00_cp1_hidAns'+this.id.split('_')[3],'" + searchType + "',ServerUrl,this)");

            }
            objHid = document.getElementById('ctl00_cp1_hidAns' + objClick);
            if (objHid) {
                objHid.value = url + "," + searchType;
            }
        }
    }
    else if (objType == "0") {
        objselectedImage = document.getElementById('ctl00_cp1_imgPollQnSelected');
        if (objselectedImage) {
            objselectedImage.src = thumb; //Showing Selected Image
            var objRemoveMediaQn = document.getElementById('ctl00_cp1_btnRemoveMediaQn');
            if (objRemoveMediaQn)
                objRemoveMediaQn.style.display = 'block';
            var PreviewQuestion = document.getElementById('ctl00_cp1_lnkPreviewQuestion');
            if (PreviewQuestion) {
                if (searchType == "V") {
                    PreviewQuestion.style.display = 'block';
                }
                else {
                    PreviewQuestion.style.display = 'none';
                }
            }
            
            objThumb = document.getElementById('ctl00_cp1_hidQnThumb');
            if (objThumb) {
                objThumb.value = thumb;
            }

            objHid = document.getElementById('ctl00_cp1_hidQn');
            if (objHid) {

                objHid.value = url + "," + searchType;
            }

        }
    }
    return false;
}
//Function Used For Article Upload
function funcLoadXMLDoc1(url, sFunction) {
    //Make Ajax Request           
    var xmlhttp = false;
    var status = 0;
    //CHECKING VALUE OF xmlhttp IS TRUE
    xmlhttp = window.XMLHttpRequest ? new XMLHttpRequest() :
            new ActiveXObject("Microsoft.XMLHTTP");
    if (xmlhttp) {
        //checking the state of http object
        xmlhttp.onreadystatechange = function() {
            if (xmlhttp.readyState == 4) {

                //            if (GetBrowser() == "FireFox") {
                //                parent.content.jsHideTransparentDiv();
                //            }
                //            else if (GetBrowser() == "Internet Explorer" || GetBrowser() == "Chrome" || GetBrowser() == "Safari") {
                //            window.parent.jsHideTransparentDiv();
                //            }
                //ShowHideTransparentDiv('Hide');

                //parent.content.jsHideTransparentDiv();
                if (xmlhttp.status == 200 || xmlhttp.status == 0) {
                    if (xmlhttp.responseText != "") {

                        var strXML = xmlhttp.responseText;
                        if (window.DOMParser) {
                            parser = new DOMParser();
                            objOutputXML = parser.parseFromString(strXML, "text/xml");
                            funcPopulateMedia1(objOutputXML);
                        }
                        else // Internet Explorer
                        {
                            objOutputXML = new ActiveXObject("Microsoft.XMLDOM");
                            objOutputXML.async = "false";
                            objOutputXML.loadXML(strXML);
                            funcPopulateMedia1(objOutputXML);
                        }
                    }
                }

                else if (xmlhttp.status == 404)
                    status = 0;
                else
                    status = 0;
            }
        }
        xmlhttp.open("GET", url, true);
        xmlhttp.send(null);
    }
}
//Function Used For Article Upload

function funcPopulateMedia1(objXML) { 
    try {
        if (objXML) {
            items = objXML.getElementsByTagName("Search");
            if (items.length) {
                count = items.length;
                success = items[0].childNodes[0].firstChild.nodeValue;
                if (success == "1") {
                    filetype = items[0].childNodes[1].firstChild.nodeValue;
                    //Url
                    if (!items[0].childNodes[2].firstChild.nodeValue) {
                        alert("select valid file");
                        return false;
                    }
                    else (items[0].childNodes[2].firstChild.nodeValue)
                    {
                        url = items[0].childNodes[2].firstChild.nodeValue;
                    }
                    //Savepath
                    if (!items[0].childNodes[3].firstChild.nodeValue) {
                        alert("select valid file");
                        return false;
                    }
                    else (items[0].childNodes[3].firstChild.nodeValue)
                    {
                        savepath = items[0].childNodes[3].firstChild.nodeValue;
                    }

                    if (!items[0].childNodes[4].firstChild.nodeValue) {
                        alert("select valid file");
                        return false;
                    }
                    //thumb
                    else (items[0].childNodes[4].firstChild.nodeValue)
                    {
                        thumb = items[0].childNodes[4].firstChild.nodeValue;
                        Embedthumb = thumb;
                    }

                    if (!items[0].childNodes[5].firstChild.nodeValue) {
                        alert("select valid file");
                        return false;
                    }
                    //searchType
                    else (items[0].childNodes[5].firstChild.nodeValue)
                    {
                        searchType = items[0].childNodes[5].firstChild.nodeValue;
                    }
                    if (!items[0].childNodes[6].firstChild.nodeValue) {
                        alert("select valid file");
                        return false;
                    }
                    //objClick
                    else (items[0].childNodes[6].firstChild.nodeValue)
                    {
                        objClick = items[0].childNodes[6].firstChild.nodeValue;

                    }
                    if (!items[0].childNodes[7].firstChild.nodeValue) {
                        alert("select valid file");
                        return false;
                    }
                    //objType
                    else (items[0].childNodes[7].firstChild.nodeValue)
                    {
                        objType = items[0].childNodes[7].firstChild.nodeValue;
                    }

                    if (!items[0].childNodes[8].firstChild.nodeValue) {
                        alert("select valid file");
                        return false;
                    }
                    //srcType
                    else (items[0].childNodes[8].firstChild.nodeValue)
                    {
                        srcType = items[0].childNodes[8].firstChild.nodeValue;
                    }
                    if (!items[0].childNodes[9].firstChild.nodeValue) {
                        alert("select valid file");
                        return false;
                    }
                    //srcPage
                    else (items[0].childNodes[9].firstChild.nodeValue)
                    {
                        srcPage = items[0].childNodes[9].firstChild.nodeValue;
                    }
                    if (!items[0].childNodes[10].firstChild.nodeValue) {
                        alert("select valid file");
                        return false;
                    }
                    //ServerUrl
                    else (items[0].childNodes[10].firstChild.nodeValue)
                    {
                        ServerUrl = items[0].childNodes[10].firstChild.nodeValue;

                    }

                    jsArtilcesnapshot(searchType, url, thumb, objClick, objType, srcType, srcPage, ServerUrl);

                }
                else if (success == "0") {
                    if (srcType == 'U' || srcType == 'E') {
                        alert('Enter  a valid url');
                        return false;
                    }
                    else {
                        alert('Media is not Available');
                        return false;
                    }

                }

            }
        }
    }
    catch (ex) {

    }

}


//For Article
function jsAssignPollArticleMedia(searchType, url, thumb, objClick, objType, srcType, srcPage, ServerUrl,PreviousPreview) {
    funcLoadXMLDoc1("../MediaSearch/DownloadFile.aspx?url=" + url + "&thumb=" + thumb + "&searchType=" + searchType + "&objType=" + objType + "&objClick=" + objClick + "&srcType=" + srcType + "&srcPage=" + srcPage + "&PreviousPreview=" + PreviousPreview + "", 'searchMedia');
}
//Function Used For Article snapshot

function jsArtilcesnapshot(searchType, url, thumb, objClick, objType, srcType, srcPage, ServerUrl) {
    jsArticleMedia(url);
   
    IconFile = thumb; //ServerUrl + "/Themes/default/images/Article_icon.jpg";
    if (objType == "Q") {

       // document.getElementById('hdnCurrentArticleThumbPath').value = thumb;
       // document.getElementById('imgURL').src = '';
        objselectedImage = document.getElementById('ctl00_cp1_imgPollQnSelected');
        var iTextIndex = "";
        var objLastText = "";
        if (objselectedImage) {
            objselectedImage.src = IconFile; //thumb; //Showing Selected Image

            var objRemoveMediaQn = document.getElementById('ctl00_cp1_btnRemoveMediaQn');
            if (objRemoveMediaQn)
                objRemoveMediaQn.style.display = 'block';
            var PreviewQuestion = document.getElementById('ctl00_cp1_lnkPreviewQuestion');
            if (PreviewQuestion) {
                PreviewQuestion.style.display = 'block';
                PreviewQuestion.onclick = new Function("javascript:jsImageVideoPreview('dvImageVideo','ctl00_cp1_hidQn','" + searchType + "',ServerUrl,this)");
            }
            
            objThumb = document.getElementById('ctl00_cp1_hidQnThumb');
            if (objThumb) {
                objThumb.value = IconFile;
            }

            objHid = document.getElementById('ctl00_cp1_hidQn');
            if (objHid) {

                objHid.value = url + "," + searchType;
            }

        }
    }
    else if (objType == "A") {
        objselectedImage = document.getElementById('ctl00_cp1_imgAns' + objClick);

        if (objselectedImage) {
            objselectedImage.src = IconFile; //Showing Selected Image;
            //Assigning to Hidden Control
            objThumb = document.getElementById('ctl00_cp1_hidAnsThumb' + objClick);
            if (objThumb)
                objThumb.value = IconFile;
            //Showing Remove button for answer
            var btnRemoveMediaAnswer = document.getElementById('ctl00_cp1_btnRemoveMediaAnswer' + objClick);
            if (btnRemoveMediaAnswer)
                btnRemoveMediaAnswer.style.display = 'block';
            //For Preview
            var PreviewAnswer = document.getElementById('ctl00_cp1_ancPreviewAnswer_' + objClick);
            if (PreviewAnswer) {
                PreviewAnswer.style.display = 'block';
                PreviewAnswer.onclick = new Function("javascript:jsImageVideoPreview('dvImageVideo','ctl00_cp1_hidAns'+this.id.split('_')[3],'" + searchType + "',ServerUrl,this)");

            }
            objHid = document.getElementById('ctl00_cp1_hidAns' + objClick);
            if (objHid) {
                objHid.value = url + "," + searchType;
            }
        }
    }
    else if (objType == "0") {
        objselectedImage = document.getElementById('ctl00_cp1_imgPollQnSelected');
        if (objselectedImage) {
            objselectedImage.src = IconFile; //Showing Selected Image
            var objRemoveMediaQn = document.getElementById('ctl00_cp1_btnRemoveMediaQn');
            if (objRemoveMediaQn)
                objRemoveMediaQn.style.display = 'block';
            var PreviewQuestion = document.getElementById('ctl00_cp1_lnkPreviewQuestion');
            if (PreviewQuestion) {
                if (searchType == "V") {
                    PreviewQuestion.style.display = 'block';
                }
                else {
                    PreviewQuestion.style.display = 'none';
                }
            }
            
            objThumb = document.getElementById('ctl00_cp1_hidQnThumb');
            if (objThumb) {
                objThumb.value = IconFile;
            }

            objHid = document.getElementById('ctl00_cp1_hidQn');
            if (objHid) {

                objHid.value = url + "," + searchType;
            }

        }
    }


    jsHideMainWebUrlDiv();
}





//Function For Removing the selected Media
function RemoveMedia(objType, sourceId) {
    if (objType) {
        if (objType == 'Q') {
            var objImgPollQnSelected = document.getElementById('ctl00_cp1_imgPollQnSelected');
            if (objImgPollQnSelected)
                objImgPollQnSelected.src = "../Themes/default/images/mediaBgLarge.png";
            var objThumb = document.getElementById('ctl00_cp1_hidQnThumb');
            if (objThumb)
                objThumb.value = "";
            var objHidQn = document.getElementById('ctl00_cp1_hidQn');
            if (objHidQn)
                objHidQn.value = "";
            //Hide Remove
            var objBtnRemoveMediaQn = document.getElementById('ctl00_cp1_btnRemoveMediaQn');
            if (objBtnRemoveMediaQn)
                objBtnRemoveMediaQn.style.display = 'none';
            //Hide Preview
            var objLnkPreviewQuestion = document.getElementById('ctl00_cp1_lnkPreviewQuestion');
            if (objLnkPreviewQuestion)
                objLnkPreviewQuestion.style.display = 'none';
        }
        else if (objType == 'A') {
            var objImgPollAn = document.getElementById('ctl00_cp1_imgAns' + sourceId);
            objImgPollAn.src = "../Themes/default/images/mediaBgLarge.png";
            var objThumb = document.getElementById('ctl00_cp1_hidAnsThumb' + sourceId);
            var objHidAn = document.getElementById('ctl00_cp1_hidAns' + sourceId);
            if (objHidAn)
                objHidAn.value = "";
            if (objThumb)
                objThumb.value = "";
            //Hide Remove
            objBtnRemoveMediaAnswer = document.getElementById('ctl00_cp1_btnRemoveMediaAnswer' + sourceId);
            if (objBtnRemoveMediaAnswer)
                objBtnRemoveMediaAnswer.style.display = 'none';
            //Hide Preview
            var objLnkPreviewAnswer = document.getElementById('ctl00_cp1_ancPreviewAnswer_' + sourceId);
            if (objLnkPreviewAnswer)
                objLnkPreviewAnswer.style.display = 'none';
        }
    }
}
//Function For Removing the selected Media
function RemoveAlbumMedia(sourceId) {
    var objhdTotalCount = document.getElementById('ctl00_cp1_hdTotalCount');
    var objrbtnCoverFirst = document.getElementById('ctl00_cp1_rbtnCover_1');
    AlbumMediaCount = AlbumMediaCount - 1;
    objhdTotalCount.value = AlbumMediaCount;
    var objdvUpload = document.getElementById('dvUpload');
    for (var i = 1; i <= (AlbumMediaCount + 1) - sourceId; i++) {

        var objMediaClicked = document.getElementById('ctl00_cp1_Img_' + (parseInt(sourceId) + (i - 1)));
        var objMediaNext = document.getElementById('ctl00_cp1_Img_' + (parseInt(sourceId) + i));
        var objBtnRemoveNext = document.getElementById('ctl00_cp1_btnRemoveAlbumMedia_' + (parseInt(sourceId) + i));
        var objLnkPreviewNext = document.getElementById('ctl00_cp1_ancPreview_' + (parseInt(sourceId) + i));
        var objBtnRemoveClicked = document.getElementById('ctl00_cp1_btnRemoveAlbumMedia_' + (parseInt(sourceId) + (i - 1)));
        var objLnkPreviewClicked = document.getElementById('ctl00_cp1_ancPreview_' + (parseInt(sourceId) + (i - 1)));
        var objhdMediaClicked = document.getElementById('ctl00_cp1_hdMedia_' + (parseInt(sourceId) + (i - 1)));
        var objhdMediaNext = document.getElementById('ctl00_cp1_hdMedia_' + (parseInt(sourceId) + i));
        var objhdThumbClicked = document.getElementById('ctl00_cp1_hdThumb_' + (parseInt(sourceId) + (i - 1)));
        var objhdThumbNext = document.getElementById('ctl00_cp1_hdThumb_' + (parseInt(sourceId) + i));
        var objrbtnCoverClicked = document.getElementById('ctl00_cp1_rbtnCover_' + (parseInt(sourceId) + (i - 1)));
        var objrbtnCoverNext = document.getElementById('ctl00_cp1_rbtnCover_' + (parseInt(sourceId) + i));
        if (objrbtnCoverNext.checked || objrbtnCoverClicked.checked) {
            objrbtnCoverFirst.checked = true;
        }
        objBtnRemoveClicked.onclick = objBtnRemoveNext.onclick;
        objLnkPreviewClicked.onclick = objLnkPreviewNext.onclick;
        objhdMediaClicked.value = objhdMediaNext.value;
        objhdThumbClicked.value = objhdThumbNext.value;
        objMediaClicked.src = objMediaNext.src;
    }
    var objBtnRemoveLast = document.getElementById('ctl00_cp1_btnRemoveAlbumMedia_' + (parseInt(AlbumMediaCount) + 1));
    var objLnkPreviewLast = document.getElementById('ctl00_cp1_ancPreview_' + (parseInt(AlbumMediaCount) + 1));
    var objMediaLast = document.getElementById('ctl00_cp1_Img_' + (parseInt(AlbumMediaCount) + 1));
    var objhdMediaLast = document.getElementById('ctl00_cp1_hdMedia_' + (parseInt(AlbumMediaCount) + 1));
    var objhdThumbLast = document.getElementById('ctl00_cp1_hdThumb_' + (parseInt(AlbumMediaCount) + 1));

    var objdvCoverLast = document.getElementById('dvCover_' + (parseInt(AlbumMediaCount) + 1));
    var objrbtnCoverLast = document.getElementById('ctl00_cp1_rbtnCover_' + (parseInt(AlbumMediaCount) + 1));
    if (objrbtnCoverLast.checked) {
        objrbtnCoverFirst.checked = true;
    }
    objdvCoverLast.style.display = "none";
    objhdMediaLast.value = "";
    objhdThumbLast.value = "";
    if (objMediaLast) {
        objBtnRemoveLast.style.display = "none";
        objBtnRemoveLast.onclick = "";
        objMediaLast.src = "../Themes/default/images/mediaBgLarge.png";
    }
    if (objLnkPreviewLast) {
        objLnkPreviewLast.style.display = "none";
        objLnkPreviewLast.onclick = "";
    }
    if (AlbumMediaCount < 10) {
        objdvUpload.style.display = "block";
    }
    else {
        objdvUpload.style.display = "none";
    }

}

function jsShowEmbed(searchType, url, thumb, objClick, objType, srcType, srcPage) {
    if (objType == "Q") {
        objselectedImage = document.getElementById('ctl00_cp1_imgPollQnSelected');

        if (objselectedImage) {
            objselectedImage.src = thumb; //Showing Selected Image
            var objRemoveMediaQn = document.getElementById('ctl00_cp1_btnRemoveMediaQn');
            if (objRemoveMediaQn)
                objRemoveMediaQn.style.display = 'block';
            var PreviewQuestion = document.getElementById('ctl00_cp1_lnkPreviewQuestion');
            if (PreviewQuestion) {
                PreviewQuestion.style.display = 'block';
                //PreviewQuestion.onclick = new Function("javascript:putDiv('TB_ajaxContent','Preview')")'
                PreviewQuestion.onclick = new Function("javascript:jsImageVideoPreview('dvImageVideo','ctl00_cp1_hidQn','" + searchType + "',ServerUrl,this)");

            }
            
            objThumb = document.getElementById('ctl00_cp1_hidQnThumb');
            if (objThumb) {
                objThumb.value = thumb;
            }

            objHid = document.getElementById('ctl00_cp1_hidQn');
            if (objHid) {

                objHid.value = url + "," + searchType;
            }

        }
    }
    else if (objType == "A") {
        objselectedImage = document.getElementById('ctl00_cp1_imgAns' + objClick);
        if (objselectedImage) {
            objselectedImage.src = thumb; //Showing Selected Image;
            //Assigning to Hidden Control
            objThumb = document.getElementById('ctl00_cp1_hidAnsThumb' + objClick);
            if (objThumb)
                objThumb.value = thumb;
            //Showing Remove button for answer
            var btnRemoveMediaAnswer = document.getElementById('ctl00_cp1_btnRemoveMediaAnswer' + objClick);
            if (btnRemoveMediaAnswer)
                btnRemoveMediaAnswer.style.display = 'block';
            //For Preview
            var PreviewAnswer = document.getElementById('ctl00_cp1_ancPreviewAnswer_' + objClick);
            if (PreviewAnswer) {
                PreviewAnswer.style.display = 'block';
                PreviewAnswer.onclick = new Function("javascript:jsImageVideoPreview('dvImageVideo','ctl00_cp1_hidAns'+this.id.split('_')[3],'" + searchType + "',ServerUrl,this)");

            }
            objHid = document.getElementById('ctl00_cp1_hidAns' + objClick);
            if (objHid) {
                objHid.value = url + "," + searchType;
            }
        }
    }
    else if (objType == "0") {
        objselectedImage = document.getElementById('ctl00_cp1_imgPollQnSelected');
        if (objselectedImage) {
            objselectedImage.src = thumb; //Showing Selected Image
            var objRemoveMediaQn = document.getElementById('ctl00_cp1_btnRemoveMediaQn');
            if (objRemoveMediaQn)
                objRemoveMediaQn.style.display = 'block';
            var PreviewQuestion = document.getElementById('ctl00_cp1_lnkPreviewQuestion');
            if (PreviewQuestion) {
                if (searchType == "V") {
                    PreviewQuestion.style.display = 'block';
                }
                else {
                    PreviewQuestion.style.display = 'none';
                }
            }
            
            objThumb = document.getElementById('ctl00_cp1_hidQnThumb');
            if (objThumb) {
                objThumb.value = thumb;
            }

            objHid = document.getElementById('ctl00_cp1_hidQn');
            if (objHid) {

                objHid.value = url + "," + searchType;
            }

        }
    }

    if (GetBrowser() == "FireFox") {
        parent.content.jsHideUrlDiv();
    }
    else if (GetBrowser() == "Internet Explorer" || GetBrowser() == "Chrome" || GetBrowser() == "Safari") {

        window.parent.jsHideUrlDiv();
    }
    else {

        window.parent.jsHideUrlDiv();
    }
}

function closePopup() {
    if (popUpWindow != null) popUpWindow.close();
}

String.prototype.startsWith = function(str)
{ return (this.match("^" + str) == str) }

String.prototype.between = function(prefix, suffix) {
    s = this;
    var i = s.indexOf(prefix);
    if (i >= 0) {
        s = s.substring(i + prefix.length);
    }
    else {
        return '';
    }
    if (suffix) {
        i = s.indexOf(suffix);
        if (i >= 0) {
            s = s.substring(0, i);
        }
        else {
            return '';
        }
    }
    return s;
}




function jsshowUploadMsg(Thumburl, MediaUrl) {
    objlblUploadMsg = document.getElementById('lblUploadMsg');
    objhdWebThumbUrl = document.getElementById('hdWebThumbUrl');
    objhdWebMediaUrl = document.getElementById('hdWebMediaUrl');
    objhdWebThumbUrl.value = Thumburl;
    objhdWebMediaUrl.value = MediaUrl;
    objlblUploadMsg.innerHTML = "Web Image Uploaded";
    ShowHide('false');
}
