﻿// JScript File
var tempRating = 0;
var currentPageID;
var Atabs = new Array();
Atabs[0] = "AtabDocument";
Atabs[1] = "AtabPhoto";
Atabs[2] = "AtabVideo";
Atabs[3] = "AtabAudio";
Atabs[4] = "AtabFolder";
Atabs[5] = "AtabBlog";
Atabs[6] = "AtabVideoPlaylist";
Atabs[7] = "AtabAudioPlaylist";
Atabs[8] = "AtabAlbums";

var Itabs = new Array();
Itabs[0] = "ItabDocument";
Itabs[1] = "ItabPhoto";
Itabs[2] = "ItabVideo";
Itabs[3] = "ItabAudio";
Itabs[4] = "ItabFolder";
Itabs[5] = "ItabBlog";
Itabs[6] = "ItabVideoPlaylist";
Itabs[7] = "ItabAudioPlaylist";
Itabs[8] = "ItabAlbums";

function postCallfunc(id) {
    try {
        for (i = 0; i <= Itabs.length - 1; i++) {
            if (Itabs[i] == id) {
                document.getElementById(Atabs[i]).style.display = "block";
                document.getElementById(Itabs[i]).style.display = "none";
            }
            else {
                document.getElementById(Itabs[i]).style.display = "block";
                document.getElementById(Atabs[i]).style.display = "none";
            }
        }
    } catch (ex) {
    }
}
function preCallfunc(loadingType) {
    try {
        document.getElementById("Anthem_ctl00_ContentPlaceHolder1_rptFileList__").innerHTML = "<img src='../images/YLoading.gif'> Loading Public " + loadingType + "...";
        //document.getElementById("midMid").innerHTML="<img src='../images/YLoading.gif'> Loading Public "+loadingType+"...";
        document.getElementById("Anthem_ctl00_ContentPlaceHolder1_lblMessage__").innerHTML = "";
    } catch (ex) {
    }
}

function pagingPreCallfunc() {
    //document.getElementById("Anthem_ctl00_ContentPlaceHolder1_rptFileList__").innerHTML="<img src='../images/YLoading.gif'> Loading...";
    playLoadingleft();
}


function AudiopreCallfunc() {
    playLoadingleft();
    //preCallfunc("Audios");
}
function AudiopostCallfunc() {
    postCallfunc("ItabAudio");
    removeLoadingleft();
}

function FolderpreCallfunc() {
    playLoadingleft();
    //preCallfunc("Folders");
}
function FolderpostCallfunc() {
    postCallfunc("ItabFolder");
    removeLoadingleft();
}

function VideopreCallfunc() {
    playLoadingleft();
    //preCallfunc("Videos");
}
function VideopostCallfunc() {
    postCallfunc("ItabVideo");
    removeLoadingleft();
}

function PhotopreCallfunc() {
    playLoadingleft();
    //preCallfunc("Photos");
}
function PhotopostCallfunc() {
    postCallfunc("ItabPhoto");
    removeLoadingleft();
}

function DocpreCallfunc() {
    playLoadingleft();
    //preCallfunc("Documents");
}
function DocpostCallfunc() {
    postCallfunc("ItabDocument");
    removeLoadingleft();
}

function BlogpreCallfunc() {
    playLoadingleft();
    //preCallfunc("Blogs");
}
function BlogpostCallfunc() {
    postCallfunc("ItabBlog");
    removeLoadingleft();
}

function VideoPlaylistpreCallfunc() {
    playLoadingleft();
    //preCallfunc("Video Playlist");
}
function VideoPlaylistpostCallfunc() {
    postCallfunc("ItabVideoPlaylist");
    removeLoadingleft();
}

function AudioPlaylistpreCallfunc() {
    playLoadingleft();
    //preCallfunc("Audio Playlist");
}
function AudioPlaylistpostCallfunc() {
    postCallfunc("ItabAudioPlaylist");
    removeLoadingleft();
}

function AlbumspreCallfunc() {
    playLoadingleft();
    //preCallfunc("Albums");
}
function AlbumspostCallfunc() {
    postCallfunc("ItabAlbums");
    removeLoadingleft();
}

function SearchpreCallfunc() {
    //preCallfunc("Searching");
    //document.getElementById("Anthem_ctl00_ContentPlaceHolder1_rptFileList__").innerHTML="<img src='../images/YLoading.gif'>Searching...";
    playLoadingleft();
}
function ClearsearchPrecall() {
    //document.getElementById("Anthem_ctl00_ContentPlaceHolder1_rptFileList__").innerHTML="<img src='../images/YLoading.gif'>Loading...";
    playLoadingleft();
}


function ClearMessages() {
    //document.getElementById("tdMessages").innerHtml="";
    document.getElementById("ctl00_ContentPlaceHolder1_lblMessage").innerHTML = "";
    playLoadingleft();
}


//  modified by sankar for sending UserName to myprofile page if it's present or to viewprofile page
var divProfileHolder = '<table width="100%"><tr><td colspan="2" align="center"><br /><img src="MyPicture.aspx?UID=#UID#" /><br><br><br></td></tr><tr><td colspan="2"><a href="../User/#MyYuntaaProfileurl#">#Profile#</a></td></tr></table>';
var tempX = "";
var tempY = "";
var IE = document.all ? true : false
if (!IE) document.captureEvents(Event.MOUSEMOVE)
function GetXyDiv(e, uId, MyYuntaaName) {
    getMouseXY(e, uId);
    var currentOffset = 0;
    if (IE) {
        currentOffset = document.documentElement.scrollTop || document.body.scrollTop;
    }
    // condition foe My Yuntaa profile Name
    var temp1 = divProfileHolder.replace("#UID#", uId);
    var temp12 = temp1.replace("#Profile#", document.getElementById("txtProfile").value);
    var temp13 = "";
    if (MyYuntaaName == "") {
        temp13 = temp12.replace("#MyYuntaaProfileurl#", "viewprofiles.aspx?ViewProfileID=" + uId);
    }
    else {
        temp13 = temp12.replace("#MyYuntaaProfileurl#", "MyProfile.aspx?UserName=" + MyYuntaaName);
    }
    document.getElementById("publicPicture").innerHTML = temp13;
    document.getElementById("publicPicture").style.display = "block";
    document.getElementById("publicPicture").style.left = tempX + "px";
    document.getElementById("publicPicture").style.top = (tempY + currentOffset) + "px";
}
function ClearDiv() {
    document.getElementById("publicPicture").style.display = "none";
}
function saveDiv() {
    document.getElementById("publicPicture").style.display = "block";
}

function getMouseXY(e) {
    //tempX = e.offsetX?(e.offsetX):e.pageX-document.getElementById("publicPicture").offsetLeft;
    //tempY = e.offsetY?(e.offsetY):e.pageY-document.getElementById("publicPicture").offsetTop;

    //alert(tempX);
    //alert(tempY);
    if (IE) {
        tempX = e.clientX + document.body.scrollLeft;
        tempY = e.clientY + document.body.scrollTop;
        //alert(document.documentElement.scrollLeft);
        //alert(document.documentElement.scrollTop);
    }
    else {
        tempX = e.pageX
        tempY = e.pageY
    }

    if (tempX < 0) {
        tempX = 0
    }
    if (tempY < 0) {
        tempY = 0
    }
    //  //return true

}

/* for rating*/
function changeRating(id) {
    if (tempRating == 0) {
        var tempID = id.substring(0, id.length - 1);
        var starID = id.substring(id.length - 1);
        for (i = 1; i <= starID; i++) {
            var stID = tempID + i;
            document.getElementById(stID).src = "../images/StarBlue.gif";
        }
    }
}

function clearRating(id) {
    if (tempRating == 0) {
        var tempID = id.substring(0, id.length - 1);
        var starID = id.substring(id.length - 1);
        for (i = 1; i <= starID; i++) {
            var stID = tempID + i;
            document.getElementById(stID).src = "../images/StarWhite.gif";
        }
    }
}

function rateIt(id) {
    var tempID = id.substring(0, id.length - 1);
    var starID = id.substring(id.length - 1);
    for (i = 1; i <= starID; i++) {
        var stID = tempID + i;
        document.getElementById(stID).src = "../images/starGold.gif";
    }
    tempRating = 1;
}
function updateMessages() {
    try {
        document.getElementById("ctl00_ContentPlaceHolder1_FileDetails1_lblMessages").innerHTML = "";
    }
    catch (err) { }

    try {
        document.getElementById("ctl00_ContentPlaceHolder1_lblMessage").innerHTML = "";
    }
    catch (err) { }


    playLoadingleft();
}
function postcallbackRating() {
    tempRating = 0;
    removeLoadingleft();
}

function currentPageCss(PageID) {
    //currentPageID=PageID;
    //document.getElementById(PageID).className="currentPageClass";
}

function updateCurrentPageCss() {
    removeLoadingleft();
    //if(document.getElementById(currentPageID))
    //{
    //        document.getElementById(currentPageID).className="currentPageClass";
    //    }
}

function activateFoldertab(commandName) {
    /*
    if(commandName=="FolderClick")
    {
    document.getElementById(Itabs[4]).style.display="block";
    document.getElementById(Atabs[4]).style.display="none";    
    }
    if(commandName=="AlbumClick")
    {
    document.getElementById(Itabs[8]).style.display="block";
    document.getElementById(Atabs[8]).style.display="none";    
    }
    if(commandName=="AudioPlaylistClick")
    {
    document.getElementById(Itabs[7]).style.display="block";
    document.getElementById(Atabs[7]).style.display="none";    
    }
    if(commandName=="VideoPlaylistClick")
    {
    document.getElementById(Itabs[6]).style.display="block";
    document.getElementById(Atabs[6]).style.display="none";    
    }
    */
}

function preFolderLoad() {
    document.getElementById("Anthem_ctl00_ContentPlaceHolder1_rptFileList__").innerHTML = "<img src='../images/YLoading.gif'> Loading...";
}
function postFolderLoad() {
}

function createTab() {
    postCallfunc(document.getElementById("ctl00_ContentPlaceHolder1_hdnTabid").value);
} 