﻿// JScript File
function SendAjaxLoginForm()
{
    var theMessage = "";
    var allOK = true;
    var errorMessage = "";
    theEmail = getElementValue(document.getElementById("email"));
    thePass = getElementValue(document.getElementById("password"));
    theRemember = getElementValue(document.getElementById("remember"));
    if (theEmail == "")
    {
        allOK = false;
        document.getElementById("email").className = "inputError";
        errorMessage = errorMessage + GetErrorForPageFormat(getEmptyEmailMessage("m"));
    }
    if (theEmail != "" && validateEmail(theEmail) == false)
    {
        allOK = false;
        document.getElementById("email").className = "inputError";
        errorMessage = errorMessage + GetErrorForPageFormat(getUnValidEmailMessage("m"));
    }
    if (thePass == "")
    {
        allOK = false;
        document.getElementById("password").className = "inputError";
        errorMessage = errorMessage + GetErrorForPageFormat(getEmptyPassMessage("m"));
    }
    if (allOK == false)
    {
        document.getElementById("error1").innerHTML = errorMessage;
        window.scroll(0,0);
        OpenID("error");
        return;
    }
    AjaxloginToSite(theEmail , thePass , theRemember);
}
function callback_send_form(result)
{
    if (result == "OK")
    {
        window.document.location.href = "index.aspx";
        return;
    }
    else if (result == "ACCOUNT_NOT_ACTIVATED")
    {
        errorMessage = "<p><span>-</span> .חשבונך קיים אבל לא הופעל באמצעות לינק האקטיבציה. </p>";
        document.getElementById("error1").innerHTML = errorMessage;
        window.scroll(0,0);
        OpenID("error");
    }
    else if (result == "WRONG_USERNAME")
    {
        errorMessage = "<p><span>-</span> שם המשתמש אינו קיים במערכת. <a href=\"javascript:void(0);\" onclick=\"document.getElementById('regIntro').style.display='none';document.getElementById('regIntroForm').style.display='';\">לחץ כאן לבקשת הזמנה</a></p>";
        document.getElementById("error1").innerHTML = errorMessage;
        window.scroll(0,0);
        OpenID("error");
        
    }
    else if (result == "WRONG_PASS")
    {
        errorMessage = "<p><span>-</span> הסיסמה אינה תואמת את כתובת המייל. <a href=\"ugc_register_pass.aspx\">לחץ כאן אם שכחת סיסמה</a></p-->";
        document.getElementById("error1").innerHTML = errorMessage;
        window.scroll(0,0);
        OpenID("error");
    }
    else if (result == "ACOUNT_LOCK")
    {
        errorMessage = "<p><span>-</span> טעית יותר מדי פעמים. תמתין כמה דקות. <a href=\"ugc_register_pass.aspx\">לחץ כאן אם שכחת סיסמה</a></p-->";
        document.getElementById("error1").innerHTML = errorMessage;
        window.scroll(0,0);
        OpenID("error");
    }
    else
    {
        window.document.location.href = result;
        return;
    }
    //Thinking(false);
}

function getFile(pURL , pHandlerFunc) 
{
   if (window.XMLHttpRequest) { // code for Mozilla, Safari, etc 
      xmlhttp=new XMLHttpRequest();
      xmlhttp.onreadystatechange=pHandlerFunc;
      xmlhttp.open("GET", pURL, true);
      xmlhttp.send(null);
   } 
   else if (window.ActiveXObject) 
   { //IE 
      xmlhttp=new ActiveXObject('Microsoft.XMLHTTP'); 
      if (xmlhttp) 
      {
         xmlhttp.onreadystatechange=pHandlerFunc;
         xmlhttp.open('GET', pURL, true);
         xmlhttp.send();
      }
   }
}

function postFile(pURL , pHandlerFunc) 
{
    pParameters = "";
    if (pURL.split("?").length >1)
    {
        pParameters = pURL.split("?")[1];
        pURL = pURL.split("?")[0];
    }
    if (window.XMLHttpRequest) { // code for Mozilla, Safari, etc 
      xmlhttp=new XMLHttpRequest();
      xmlhttp.onreadystatechange=pHandlerFunc;
      //alert(pParameters);
      xmlhttp.open("POST", pURL, true);
      xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
      
      xmlhttp.send(pParameters);
    } 
    else if (window.ActiveXObject) 
    { //IE 
      xmlhttp=new ActiveXObject('Microsoft.XMLHTTP'); 
      if (xmlhttp) 
      {
         xmlhttp.onreadystatechange=pHandlerFunc;
         xmlhttp.open('POST', pURL, true);
         xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
         //alert(pParameters);
         xmlhttp.send(pParameters);
      }
    }
}

function SendMail()
{
    document.getElementById("mail_sender").href="";
    CloseID("message_place1");
    theTo = document.getElementById("to").value;
    if (theTo == "")
    {
        document.getElementById("message_place").innerHTML = "למי לשלוח? לנחש?";
        OpenID("message_place1");
        window.scroll(0,200);
        document.getElementById("mail_sender").href="javascript:SendMail();";
        return;
    }
    theSubject = document.getElementById("subject").value;
    theContent = textEditor.getContent();
    if (theSubject == "")
    {
        document.getElementById("message_place").innerHTML = "ללא כותרת הא?";
        OpenID("message_place1");
        window.scroll(0,200);
        document.getElementById("mail_sender").href="javascript:SendMail();";
        return;
    }
    
    if (theContent == "")
    {
        document.getElementById("message_place").innerHTML = "ללא מילים הא?";
        OpenID("message_place1");
        window.scroll(0,200);
        document.getElementById("mail_sender").href="javascript:SendMail();";
        return;
    }
    
    sURL = "AjaxSendMail.aspx";
    sURL += "?to=" + escape(theTo);
    sURL += "&header=" + escape(theSubject);
    sURL += "&text=" + escape(theContent);
    postFile(sURL , callback_SendMail);
}

function loginToSite(sEmail , sPass , sRemember)
{
    sURL = "AjaxLogin.aspx?email=" + escape(sEmail) + "&pass=" + escape(sPass) + "&remember=" + escape(sRemember);
    postFile(sURL , callback_Login);
}

function AjaxloginToSite(sEmail , sPass , sRemember)
{
    sURL = "AjaxLogin.aspx?email=" + escape(sEmail) + "&pass=" + escape(sPass) + "&remember=" + escape(sRemember);
    postFile(sURL , callback_Ajax_Login);
}

function removeShowsFavoriteVideo(segment_id , page_id)
{
    sURL = "AjaxRemoveFavoriteSegment.aspx?segment_id=" + escape(segment_id) + "&page_id=" + escape(page_id);
    postFile(sURL , callback_FavoriteVideoResponse);
}

function RemoveFromFriends(account_id, thePage , theStartPage)
{
    sURL = "AjaxRemoveFromFriends.aspx?account_id=" + escape(account_id) + "&start_page=" + escape(theStartPage) + "&page_id=" + escape(thePage);
    if (document.getElementById("search_people_content") == null)
        sURL += "&ugc_site=1";
    postFile(sURL , callback_SearchPeople);
}

function CancelFriendship(account_id)
{
    sURL = "AjaxCancelFriendship.aspx?account_id=" + escape(account_id);
    postFile(sURL , callback_CancelFriendship);
}

function RequestFriendship(account_id)
{
    sURL = "AjaxRequestFriendship.aspx?account_id=" + escape(account_id);
    postFile(sURL , callback_CancelFriendship);
}

function ConfirmFriendship(account_id)
{
    sURL = "AjaxConfirmFriendship.aspx?account_id=" + escape(account_id);
    postFile(sURL , callback_CancelFriendship);
}

function ConfirmFriend(account_id, theStatus)
{
    sURL = "AjaxConfirmFriends.aspx?account_id=" + escape(account_id) + "&thestatus=" + escape(theStatus);
    postFile(sURL , callback_MyPageContentMPU);
}

function ConfirmAllFriends()
{
    sURL = "AjaxConfirmAllFriends.aspx";
    postFile(sURL , callback_MyPageContentMPU);
}

function RemoveClipFromFavorites(clip_id , page_id)
{
    sURL = "AjaxRemoveClipFromFavorites.aspx?clip_id=" + escape(clip_id) + "&page_id=" + escape(page_id);
    postFile(sURL , callback_FavoriteClipResponse);
}

function RemoveUGCAudioFromFavorites(audio_id , page_id)
{
    sURL = "AjaxRemoveAudioFromFavorites.aspx?audio_id=" + escape(audio_id) + "&page_id=" + escape(page_id);
    postFile(sURL , callback_FavoriteClipResponse);
}

function RemoveUGCVideoFromFavorites(video_id , page_id)
{
    sURL = "AjaxRemoveUGCVideoFromFavorites.aspx?video_id=" + escape(video_id) + "&page_id=" + escape(page_id);
    postFile(sURL , callback_FavoriteClipResponse);
}

function AddUGCVideoToFavorites(video_id , page_id)
{
    sURL = "AjaxAddUGCVideoToFavorites.aspx?video_id=" + escape(video_id) + "&page_id=" + escape(page_id);
    postFile(sURL , callback_FavoriteClipResponse);
}

function AddUGCAudioToFavorites(audio_id , page_id)
{
    sURL = "AjaxAddAudioToFavorites.aspx?audio_id=" + escape(audio_id) + "&page_id=" + escape(page_id);
    postFile(sURL , callback_FavoriteClipResponse);
}

function AddClipToFavorites(clip_id , page_id)
{
    sURL = "AjaxAddClipToFavorites.aspx?clip_id=" + escape(clip_id) + "&page_id=" + escape(page_id);
    postFile(sURL , callback_FavoriteClipResponse);
}

function addShowsFavoriteVideo(segment_id , page_id)
{
    sURL = "AjaxAddFavoriteSegment.aspx?segment_id=" + escape(segment_id) + "&page_id=" + escape(page_id);
    postFile(sURL , callback_FavoriteVideoResponse);
}

function ChangeLovedToPage(lovedType , thePage , theStartPage)
{
    sURL = "AjaxChangeLovedToPage.aspx?loveType=" + escape(lovedType) + "&page_id=" + escape(thePage) + "&start_page=" + escape(theStartPage);
    postFile(sURL , callback_LovedToPage);
}

function ChangeCommentsToPage(commentType , thePage , theStartPage)
{
    sURL = "AjaxChangeCommentsToPage.aspx?commentType=" + escape(commentType) + "&page_id=" + escape(thePage) + "&start_page=" + escape(theStartPage);
    postFile(sURL , callback_CommentsToPage);
}

function ChangeShowsToPage(thePage , theStartPage)
{
    sURL = "AjaxShowInnerContent.aspx?page_id=" + escape(thePage) + "&start_page=" + escape(theStartPage);
    postFile(sURL , callback_shows_change);
}

function ChangeUGCSongToPage(thePage , theStartPage)
{
    sURL = "AjaxUGCSubCategorySelected.aspx?page_id=" + escape(thePage) + "&start_page=" + escape(theStartPage);
    postFile(sURL , callback_articles_change);
}

function ChangeClipsToPage(thePage , theStartPage)
{
    sURL = "AjaxChangeClipsToPage.aspx?page_id=" + escape(thePage) + "&start_page=" + escape(theStartPage);
    postFile(sURL , callback_ClipsContentChane);
}

function ChangeSearchPagePicsToPage(thePage , theStartPage)
{
    sURL = "AjaxChangeSearchPagePicsToPage.aspx?page_id=" + escape(thePage) + "&start_page=" + escape(theStartPage);
    postFile(sURL , callback_SearchPageChanged);
}

function ChangeSearchPageSongsToPage(thePage , theStartPage)
{
    sURL = "AjaxChangeSearchPageSongsToPage.aspx?page_id=" + escape(thePage) + "&start_page=" + escape(theStartPage);
    postFile(sURL , callback_SearchPageChanged);
}

function ChangeSearchPageBlogsToPage(thePage , theStartPage)
{
    sURL = "AjaxChangeSearchPageBlogsToPage.aspx?page_id=" + escape(thePage) + "&start_page=" + escape(theStartPage);
    postFile(sURL , callback_SearchPageChanged);
}

function ChangeSearchPageTagsToPage(thePage , theStartPage)
{
    sURL = "AjaxChangeSearchPageTagsToPage.aspx?page_id=" + escape(thePage) + "&start_page=" + escape(theStartPage);
    postFile(sURL , callback_SearchPageChanged);
}

function ChangeSearchPageVideosToPage(thePage , theStartPage)
{
    sURL = "AjaxChangeSearchPageVideosToPage.aspx?page_id=" + escape(thePage) + "&start_page=" + escape(theStartPage);
    postFile(sURL , callback_SearchPageChanged);
}

function ChangeSearchPageArticlesToPage(thePage , theStartPage)
{
    sURL = "AjaxChangeSearchPageArticlesToPage.aspx?page_id=" + escape(thePage) + "&start_page=" + escape(theStartPage);
    postFile(sURL , callback_SearchPageChanged);
}

function ChangeSearchPagePeopleToPage(thePage , theStartPage)
{
    sURL = "AjaxChangeSearchPagePeopleToPage.aspx?page_id=" + escape(thePage) + "&start_page=" + escape(theStartPage);
    postFile(sURL , callback_SearchPageChanged);
}

function saveSkin()
{
    theSelectedID = document.getElementById("theSelected").value;
    sURL = "AjaxSaveSkin.aspx?skin_id=" + escape(theSelectedID);
    postFile(sURL , callback_SaveSkin);
}

function ChangeChartsToPage(thePage , theStartPage)
{
    sURL = "AjaxChangeChartsToPage.aspx?page_id=" + escape(thePage) + "&start_page=" + escape(theStartPage);
    postFile(sURL , callback_ChangeChartsToPage);
}

//function ChangeShowsToPage(thePage , theStartPage)
//{
    //sURL = "AjaxChangeShowsToPage.aspx?page_id=" + thePage + "&start_page=" + theStartPage;
    //postFile(sURL , callback_ChangeShowsToPage);
//}

function ChangeArticlesToPage(thePage , theStartPage)
{
    sURL = "AjaxChangeArticlesToPage.aspx?page_id=" + escape(thePage) + "&start_page=" + escape(theStartPage);
    postFile(sURL , callback_articles_change);
}

function ChangeFriendListToPage(thePage , theStartPage)
{
    sURL = "AjaxChangeFriendListToPage.aspx?page_id=" + escape(thePage) + "&start_page=" + escape(theStartPage);
    postFile(sURL , callback_FriendList);
}

function ChangeCommonFriendsToPage(thePage , theStartPage)
{
    sURL = "AjaxCommonFriends.aspx?page_id=" + escape(thePage) + "&start_page=" + escape(theStartPage);
    postFile(sURL , callback_articles_change);
}

function ChangePeopleLoveClipsToPage(clip_id,thePage , theStartPage)
{
    sURL = "AjaxMorePeopleLoveClip.aspx?clip_id=" + escape(clip_id) + "&page_id=" + escape(thePage) + "&start_page=" + escape(theStartPage);
    postFile(sURL , callback_OpenAjaxPopWind);
}

function ChangePeopleLoveSegmentToPage(clip_id,thePage , theStartPage)
{
    sURL = "AjaxMorePeopleLoveSegment.aspx?clip_id=" + escape(clip_id) + "&page_id=" + escape(thePage) + "&start_page=" + escape(theStartPage);
    postFile(sURL , callback_OpenAjaxPopWind);
}

function ChangePeopleLoveOtherToPage(clip_id,thePage , theStartPage)
{
    sURL = "AjaxMorePeopleLoveOther.aspx?clip_id=" + escape(clip_id) + "&page_id=" + escape(thePage) + "&start_page=" + escape(theStartPage);
    postFile(sURL , callback_OpenAjaxPopWind);
}

function ChangePeopleLoveArticleToPage(article_id,thePage , theStartPage)
{
    sURL = "AjaxMorePeopleLoveArticle.aspx?article_id=" + escape(article_id) + "&page_id=" + escape(thePage) + "&start_page=" + escape(theStartPage);
    postFile(sURL , callback_OpenAjaxPopWind);
}

function ChangePeopleLovePicToPage(pic_id,thePage , theStartPage)
{
    sURL = "AjaxMorePeopleLovePic.aspx?pic_id=" + escape(pic_id) + "&page_id=" + escape(thePage) + "&start_page=" + escape(theStartPage);
    postFile(sURL , callback_OpenAjaxPopWind);
}

function ChangePeopleLovePostToPage(post_id,thePage , theStartPage)
{
    sURL = "AjaxMorePeopleLovePic.aspx?post_id=" + escape(post_id) + "&page_id=" + escape(thePage) + "&start_page=" + escape(theStartPage);
    postFile(sURL , callback_OpenAjaxPopWind);
}

function UGCSubCategorySelected(ugc_type , indexOfTab)
{
    UnSelectAll("sub_category" , indexOfTab , "on");
    sURL = "AjaxUGCSubCategorySelected.aspx?ugc_type=" + escape(ugc_type) + "&sub_category_id=" + escape(indexOfTab);
    postFile(sURL , callback_articles_change);
}

function ArticlesSubCategorySelected(sub_category_id , indexOfTab)
{
    UnSelectAll("sub_category" , indexOfTab , "on");
    sURL = "AjaxArticlesSubCategorySelected.aspx?sub_category_id=" + escape(sub_category_id);
    postFile(sURL , callback_articles_change);
    dcTab = sub_category_id;
}

function UGCSongsSortByChange(theOrderID , sPageID , sStartPage)
{
    UnSelectAll("sort" , theOrderID , "current");
    sURL = "AjaxUGCSongsSortByChange.aspx?order_id=" + escape(theOrderID) + "&page_id=" + escape(sPageID) + "&start_page=" + escape(sStartPage);
    postFile(sURL , callback_articles_change);
}

function ArticlesSortByChange(theOrderID , sPageID , sStartPage)
{
    UnSelectAll("sort" , theOrderID , "current");
    sURL = "AjaxArticlesSortByChange.aspx?order_id=" + escape(theOrderID) + "&page_id=" + escape(sPageID) + "&start_page=" + escape(sStartPage);
    postFile(sURL , callback_articles_change);
}

function ClipsSortByChange(theOrderID , sPageID , sStartPage)
{
    UnSelectAll("sort" , theOrderID , "current");
    sURL = "AjaxClipsSortByChange.aspx?order_id=" + escape(theOrderID) + "&page_id=" + escape(sPageID) + "&start_page=" + escape(sStartPage);
    postFile(sURL , callback_ClipsContentChane);
}

function UserListTabClicked(tab_id , type_to_show)
{
    UnSelectAll("user_list_tab" , tab_id , "on");
    sURL = "AjaxUserListTabClicked.aspx?tab_id=" + escape(tab_id);
    postFile(sURL , callback_user_list_tab_clicked);
}

function LeftSideTabClicked(page_id,tab_id)
{
    if (document.getElementById("left_side_tab2") != null)
    {
        if (document.getElementById("left_side_tab1") != null)
            document.getElementById("left_side_tab1").className="";
    }
    else
    {
        if (document.getElementById("left_side_tab1") != null)
            document.getElementById("left_side_tab1").className="last";
    }
    
    if (document.getElementById("left_side_tab3") != null)
    {
        if (document.getElementById("left_side_tab2") != null)
            document.getElementById("left_side_tab2").className="";
    }
    else
    {
        if (document.getElementById("left_side_tab2") != null)
            document.getElementById("left_side_tab2").className="last";
    }
    
    if (document.getElementById("left_side_tab3") != null)
        document.getElementById("left_side_tab3").className="last";
    
    sName = "left_side_tab" + tab_id;
    if (tab_id != 3)
        document.getElementById(sName).className="on";
    else
        document.getElementById(sName).className="last on";
    sURL = "AjaxLeftSideTabClicked.aspx?page_id=" + escape(page_id) + "&tab_id=" + escape(tab_id);
    postFile(sURL , callback_left_side_tab_clicked);
}

function logout()
{
    RS.Execute("ugc_logout.aspx", "Logout", callback_logout, errorCallback);        
    document.location.href="ugc_login.aspx";
}

function DeleteUGCComment1(theID)
{
    sURL = "AjaxDeleteUGCComment1.aspx?comment_id=" + escape(theID);
    postFile(sURL , callback_deletecomment);
}

function deleteMyTVBoxChannel(theID)
{
    sURL = "AjaxDeleteMyTVBoxChannel.aspx?channel_id=" + escape(theID);
    postFile(sURL , callback_deleteMyTVBoxChannel);
}

function SendUGCComment(theCommentType , theRefID)
{
    inputFocus("commenttext"," התגובה שלך");
    the_title = document.getElementById("commenttitle").value;
    the_text = document.getElementById("commenttext").value;
    if (the_text == " התגובה שלך")
        the_text = "";
    if (the_title == headerTitle)
    {
        document.getElementById("message_place5").innerHTML = noHeaderMessage;
        OpenID("message_place4");
    }
    else
    {
        sURL = "AjaxSendUGCComment.aspx?comment_type=" + escape(theCommentType) + "&ref_id=" + escape(theRefID) + "&the_title=" + escape(the_title) + "&the_text=" + escape(the_text);
        postFile(sURL , callback_SendArticleComment);
    }
}

function SendArticleComment(article_id)
{
    the_title = document.getElementById("commenttitle").value;
    the_text = document.getElementById("commenttext").value;
    if (the_text == " התגובה שלך")
        the_text = "";
    if (the_title == headerTitle)
    {
        document.getElementById("message_place5").innerHTML = noHeaderMessage;
        OpenID("message_place4");
    }
    else
    {
        inputFocus("commenttext"," התגובה שלך");
        sURL = "AjaxSendArticleComment.aspx?the_title=" + escape(the_title) + "&the_text=" + escape(the_text) + "&article_id=" + escape(article_id);
        postFile(sURL , callback_SendArticleComment);
    }
}

function BuiltMyPageErrorMessage(theBaseMessage)
{
    theHTML = "<b class=\"tr\"><b class=\"tl\"></b></b>\r\n";
    theHTML += "<div >\r\n";
    theHTML += theBaseMessage + "<br/>\r\n";
    theHTML += "</div>\r\n";
    theHTML += "<b class=\"br\"><b class=\"bl\"></b></b>\r\n";
    return theHTML;
}

function MyPageInterestsSendForm()
{
    var theMessage = "";
    theArtists = getElementValue(document.getElementById("bands"));
    theMovies = getElementValue(document.getElementById("movies"));
    theShows = getElementValue(document.getElementById("programs"));
    theBooks = getElementValue(document.getElementById("books"));
    sURL = "AjaxUpdateAccountInterests.aspx";
    sURL += "?artists=" + escape(theArtists);
    sURL += "&movies=" + escape(theMovies);
    sURL += "&shows=" + escape(theShows);
    sURL += "&books=" + escape(theBooks);
    CloseID("message_place");
    postFile(sURL , callback_MyPageInterestsSendForm);
}
function IsPic(file) 
{
    extArray = new Array(".gif", ".jpg", ".png", ".jpeg");
    bExists = false;
    if (!file) 
        return false;
    while (file.indexOf("\\") != -1)
        file = file.slice(file.indexOf("\\") + 1);
    ext = file.slice(file.indexOf(".")).toLowerCase();
    for (var i = 0; i < extArray.length; i++) 
    {
        if (extArray[i] == ext) 
        { 
            bExists = true; 
            break; 
        }
    }
    return bExists;
}

function IsVideo(file) 
{
    extArray = new Array(".mpg", ".mpeg", ".avi", ".mov", ".wmv");
    bExists = false;
    if (!file) 
        return false;
    while (file.indexOf("\\") != -1)
        file = file.slice(file.indexOf("\\") + 1);
    ext = file.slice(file.indexOf(".")).toLowerCase();
    for (var i = 0; i < extArray.length; i++) 
    {
        if (extArray[i] == ext) 
        { 
            bExists = true; 
            break; 
        }
    }
    return bExists;
}

function IsAudio(file) 
{
    extArray = new Array(".mp3");
    bExists = false;
    if (!file) 
        return false;
    while (file.indexOf("\\") != -1)
        file = file.slice(file.indexOf("\\") + 1);
    ext = file.slice(file.indexOf(".")).toLowerCase();
    for (var i = 0; i < extArray.length; i++) 
    {
        if (extArray[i] == ext) 
        { 
            bExists = true; 
            break; 
        }
    }
    return bExists;
}
function UploadBackground(theSex)
{
    thePicName = document.getElementById("upload").value;
    allOK = true;
    errorMessage = "";
    if (IsPic(thePicName) == false)
    {
        allOK = false;
        errorMessage = errorMessage + GetErrorForPageFormat(getNotPicMessage(theSex));
    }
    if (allOK == false)
    {
        document.getElementById("message1_place").innerHTML = BuiltMyPageErrorMessage(errorMessage);
        OpenID("message1_place");
        return;
    }
    OpenID("pic_loading");
    CloseID("my_page_content");
    CloseID("message1_place");
    submitASPForm("my_page_design_skin.aspx?tab_id=21");
}
function UploadGalleryPic(theSex)
{
    var theMessage = "";
    //theFile = getElementValue(document.getElementById("upload"));
    thePicName = getElementValue(document.getElementById("picName"));
    theTerms = getElementValue(document.getElementById("terms"));
    theTags = getElementValue(document.getElementById("tags"));
    theDescription = getElementValue(document.getElementById("description"));
    allOK = true;
    errorMessage = "";
    //if (IsPic(theFile) == false)
    //{
        //allOK = false;
        //errorMessage = errorMessage + GetErrorForPageFormat(getNotPicMessage(theSex));
    //}
    if (thePicName == "")
    {
        allOK = false;
        errorMessage = errorMessage + GetErrorForPageFormat(getPicWithNoNameMessage(theSex));
    }
    if (theTerms == false)
    {
        allOK = false;
        errorMessage = errorMessage + GetErrorForPageFormat(getTakanonMessage(theSex));
    }
    if (allOK == false)
    {
        document.getElementById("error_place").innerHTML = BuiltMyPageErrorMessage(errorMessage);
        OpenID("error_place");
        return;
    }
    OpenID("pic_loading");
    CloseID("my_page_content");
    CloseID("error_place");
    //sParams = "";
    //sURL = "pic_name=" + escape(thePicName);
    //sURL += "&tags=" + escape(theTags);
    //sURL += "&description=" + escape(theDescription);
    if (document.getElementById("pic_uploader_swf") != null)
        document.getElementById("pic_uploader_swf").StartUpload(sURL);
    submitASPForm("my_page_update_general.aspx?tab_id=72");
    //window.setInterval('up_ReportProgress()', 100);
}

function uploadPicEnd()
{
    GetAdminPageContent(72);
}

function UpdateAudioData(theID , theSex)
{
    theSongPic = getElementValue(document.getElementById("songImg"));
    theSongName = getElementValue(document.getElementById("songName"));
    //theSongAdd = getElementValue(document.getElementById("songAdd"));
    theSongAdd = true;
    theSongDown = getElementValue(document.getElementById("songDown"));
    theJanner1 = getElementValue(document.getElementById("genre"));
    theJanner2 = getElementValue(document.getElementById("genre2"));
    theAlbum = getElementValue(document.getElementById("album"));
    theYear = getElementValue(document.getElementById("year"));
    theWords = getElementValue(document.getElementById("words"));
    theLableCompany = getElementValue(document.getElementById("labelComp"));
    theTags = getElementValue(document.getElementById("tags"));
    theDescription = getElementValue(document.getElementById("audio_desc"));
    allOK = true;
    errorMessage = "";
    if (theSongPic != "" && IsPic(theSongPic) == false)
    {
        allOK = false;
        errorMessage = errorMessage + GetErrorForPageFormat(getNotPicMessage(theSex));
    }
    if (theSongName == "")
    {
        allOK = false;
        errorMessage = errorMessage + GetErrorForPageFormat(getPicWithNoNameMessage(theSex));
    }
    if (theYear != "" && IsNumeric(theYear) == false)
    {
        allOK = false;
        errorMessage = errorMessage + GetErrorForPageFormat(getNotYearMessage(theSex));
    }
    if (allOK == false)
    {
        document.getElementById("error_place").innerHTML = BuiltMyPageErrorMessage(errorMessage);
        OpenID("error_place");
        return;
    }
    OpenID("pic_loading");
    CloseID("my_page_content");
    CloseID("error_place");
    submitASPForm("my_page_update_general.aspx?tab_id=63");
}

function SendPefrmerPage(isBand)
{
    theBands = GetArtistBandsValue();
    theArtistTypes = GetMultiSelectValue("artist");
    theMusicTools = GetMultiSelectValue("instrument");
    theJanners = GetMultiSelectValue("genre");
    theRecComps = GetMultiSelectValue("rec_comps");
    theInflu = document.getElementById("influence").value;    
    theWebPage = document.getElementById("wPage").value;   
    
    theMembers = GetBandsMemberValue();
    theAdressArea = GetMultiSelectValue("address_area");
    if (document.getElementsByName("production")[0].checked)
        theProduceType = "0";
    if (document.getElementsByName("production")[1].checked)
        theProduceType = "1";
    
    sURL = "AjaxSendPefrmerPage.aspx";
    if (isBand == false)
        sURL += "?is_bands=false";
    else
        sURL += "?is_bands=true";
    sURL += "&bands=" + escape(theBands);
    sURL += "&members=" + escape(theMembers);
    sURL += "&ArtistTypes=" + escape(theArtistTypes);
    sURL += "&AddressArea=" + escape(theAdressArea);
    sURL += "&MusicTools=" + escape(theMusicTools);
    sURL += "&Janners=" + escape(theJanners);
    sURL += "&influ=" + escape(theInflu);
    sURL += "&web_page=" + escape(theWebPage);
    sURL += "&produce_type=" + escape(theProduceType);
    sURL += "&rec_comps=" + escape(theRecComps);
    postFile(sURL , callback_SendPerformer);
}

function UpdateVideoData(theID , theSex)
{
    theSongPic = getElementValue(document.getElementById("songImg"));
    theSongName = getElementValue(document.getElementById("songName"));
    theJanner1 = getElementValue(document.getElementById("genre"));
    theJanner2 = getElementValue(document.getElementById("genre2"));
    theAlbum = getElementValue(document.getElementById("album"));
    theYear = getElementValue(document.getElementById("year"));
    theWords = getElementValue(document.getElementById("words"));
    theLableCompany = getElementValue(document.getElementById("labelComp"));
    theTags = getElementValue(document.getElementById("tags"));
    theDescription = getElementValue(document.getElementById("audio_desc"));
    allOK = true;
    errorMessage = "";
    if (theSongPic != "" && IsPic(theSongPic) == false)
    {
        allOK = false;
        errorMessage = errorMessage + GetErrorForPageFormat(getNotPicMessage(theSex));
    }
    if (theSongName == "")
    {
        allOK = false;
        errorMessage = errorMessage + GetErrorForPageFormat(getPicWithNoNameMessage(theSex));
    }
    if (theYear != "" && IsNumeric(theYear) == false)
    {
        allOK = false;
        errorMessage = errorMessage + GetErrorForPageFormat(getNotYearMessage(theSex));
    }
    if (allOK == false)
    {
        document.getElementById("error_place").innerHTML = BuiltMyPageErrorMessage(errorMessage);
        OpenID("error_place");
        window.scroll(0,0);
        return;
    }
    OpenID("pic_loading");
    CloseID("my_page_content");
    CloseID("error_place");
    submitASPForm("my_page_update_general.aspx?tab_id=53");
}

function UploadAudio(theSex)
{
    var theMessage = "";
    theSongFile = getElementValue(document.getElementById("upload"));
    theSongPic = getElementValue(document.getElementById("songImg"));
    theSongName = getElementValue(document.getElementById("songName"));
    theTerms = getElementValue(document.getElementById("terms"));
    //theSongAdd = getElementValue(document.getElementById("songAdd"));
    theSongAdd = true;
    theSongDown = getElementValue(document.getElementById("songDown"));
    theJanner1 = getElementValue(document.getElementById("genre"));
    theJanner2 = getElementValue(document.getElementById("genre2"));
    theAlbum = getElementValue(document.getElementById("album"));
    theYear = getElementValue(document.getElementById("year"));
    theWords = getElementValue(document.getElementById("words"));
    theLableCompany = getElementValue(document.getElementById("labelComp"));
    theTags = getElementValue(document.getElementById("tags"));
    theDescription = getElementValue(document.getElementById("audio_desc"));
    allOK = true;
    errorMessage = "";
    if (theSongPic != "" && IsPic(theSongPic) == false)
    {
        allOK = false;
        errorMessage = errorMessage + GetErrorForPageFormat(getNotPicMessage(theSex));
    }
    if (IsAudio(theSongFile) == false)
    {
        allOK = false;
        errorMessage = errorMessage + GetErrorForPageFormat(getNotAudioMessage(theSex));
    }
    if (theSongName == "")
    {
        allOK = false;
        errorMessage = errorMessage + GetErrorForPageFormat(getSongWithNoNameMessage(theSex));
    }
    if (theYear != "" && IsNumeric(theYear) == false)
    {
        allOK = false;
        errorMessage = errorMessage + GetErrorForPageFormat(getNotYearMessage(theSex));
    }
    if (theTerms == false)
    {
        allOK = false;
        errorMessage = errorMessage + GetErrorForPageFormat(getTakanonMessage(theSex));
    }
    
    if (allOK == false)
    {
        document.getElementById("error_place").innerHTML = BuiltMyPageErrorMessage(errorMessage);
        OpenID("error_place");
        window.scroll(0,200);
        return;
    }
    OpenID("pic_loading");
    CloseID("my_page_content");
    CloseID("error_place");
    window.scroll(0,200);
    submitASPForm("my_page_update_general.aspx?tab_id=62");
}

function SendFooterLoginForm()
{
    var theMessage = "";
    var allOK = true;
    var errorMessage = "";
    theEmail = getElementValue(document.getElementById("emailFooter"));
    thePass = getElementValue(document.getElementById("passFooter"));
    theRemember = getElementValue(document.getElementById("remember"));
    if (theEmail == "")
    {
        allOK = false;
        document.getElementById("emailFooter").className = "inputError";
        errorMessage = errorMessage + GetErrorForPageFormat(getEmptyEmailMessage("m"));
    }
    if (theEmail != "" && validateEmail(theEmail) == false)
    {
        allOK = false;
        document.getElementById("emailFooter").className = "inputError";
        errorMessage = errorMessage + GetErrorForPageFormat(getUnValidEmailMessage("m"));
    }
    if (thePass == "")
    {
        allOK = false;
        document.getElementById("passFooter").className = "inputError";
        errorMessage = errorMessage + GetErrorForPageFormat(getEmptyPassMessage("m"));
    }
    if (allOK == false)
    {
        document.getElementById("error1").innerHTML = errorMessage;
        window.scroll(0,0);
        OpenID("error");
        return;
    }
}

function UploadVideo(theSex)
{
    var theMessage = "";
    theSongFile = getElementValue(document.getElementById("upload"));
    theSongName = getElementValue(document.getElementById("songName"));
    theTerms = getElementValue(document.getElementById("terms"));
    theJanner1 = getElementValue(document.getElementById("genre"));
    theJanner2 = getElementValue(document.getElementById("genre2"));
    theAlbum = getElementValue(document.getElementById("album"));
    theYear = getElementValue(document.getElementById("year"));
    theWords = getElementValue(document.getElementById("words"));
    theLableCompany = getElementValue(document.getElementById("labelComp"));
    theTags = getElementValue(document.getElementById("tags"));
    theDescription = getElementValue(document.getElementById("audio_desc"));
    allOK = true;
    errorMessage = "";
    if (IsVideo(theSongFile) == false)
    {
        allOK = false;
        errorMessage = errorMessage + GetErrorForPageFormat(getNotVideoMessage(theSex));
    }
    if (theSongName == "")
    {
        allOK = false;
        errorMessage = errorMessage + GetErrorForPageFormat(getVideoWithNoNameMessage(theSex));
    }
    if (theYear != "" && IsNumeric(theYear) == false)
    {
        allOK = false;
        errorMessage = errorMessage + GetErrorForPageFormat(getNotYearMessage(theSex));
    }
    if (theTerms == false)
    {
        allOK = false;
        errorMessage = errorMessage + GetErrorForPageFormat(getTakanonMessage(theSex));
    }
    
    if (allOK == false)
    {
        document.getElementById("error_place").innerHTML = BuiltMyPageErrorMessage(errorMessage);
        OpenID("error_place");
        window.scroll(0,200);
        return;
    }
    OpenID("pic_loading");
    CloseID("my_page_content");
    CloseID("error_place");
    window.scroll(0,200);
    submitASPForm("my_page_update_general.aspx?tab_id=52");
}

function UploadBlog(theSex , theID)
{
    var theMessage = "";
    theTags = getElementValue(document.getElementById("tags"));
    theName = getElementValue(document.getElementById("postName"));
    theContent = textEditor.getContent();
    allOK = true;
    errorMessage = "";
    if (theName == "")
    {
        errorMessage = GetErrorForPageFormat(getNoBlogName(theSex));
        allOK = false;
    }
    if (theContent == "")
    {
        errorMessage = GetErrorForPageFormat(getNoBlogContnet(theSex));
        allOK = false;
    }
    if (allOK == false)
    {
        document.getElementById("error_place").innerHTML = BuiltMyPageErrorMessage(errorMessage);
        OpenID("error_place");
        window.scroll(0,200);
        return;
    }
    CloseID("error_place");
    sURL = "AjaxUploadBlog.aspx";
    sURL += "?tags=" + escape(theTags);
    sURL += "&id=" + escape(theID);
    sURL += "&name=" + escape(theName);
    sURL += "&post_text=" + escape(theContent);
    postFile(sURL , callback_MyPageContent);
}

function EditPost(thePostID)
{
    sURL = "AjaxUpdateBlog.aspx";
    sURL += "?id=" + escape(thePostID);
    postFile(sURL , callback_MyPageContent);
}

function UpdateGalleryPic(theID , theSex)
{
    var theMessage = "";
    thePicName = getElementValue(document.getElementById("picName"));
    theTags = getElementValue(document.getElementById("tags"));
    theDescription = getElementValue(document.getElementById("the_desc"));
    allOK = true;
    errorMessage = "";
    if (thePicName == "")
    {
        allOK = false;
        errorMessage = errorMessage + GetErrorForPageFormat(getPicWithNoNameMessage(theSex));
    }
    if (allOK == false)
    {
        document.getElementById("error_place").innerHTML = BuiltMyPageErrorMessage(errorMessage);
        OpenID("error_place");
        return;
    }
    sURL = "AjaxUpdateGalleryPic.aspx";
    sURL += "?name=" + escape(thePicName);
    sURL += "&description=" + escape(theDescription);
    sURL += "&tags=" + escape(theTags);
    sURL += "&pic_id=" + escape(theID);
    postFile(sURL , callback_MyPageContent);
}

function RemovePostConfirm(post_id)
{
    sURL = "AjaxRemovePostConfirm.aspx";
    sURL += "?id=" + escape(post_id);
    postFile(sURL , callback_RemovePostConfirm);
}

function RemovePost(post_id)
{
    sURL = "AjaxRemovePost.aspx";
    sURL += "?id=" + escape(post_id);
    postFile(sURL , callback_MyPageContent);
}

function removeSurvay(survay_id)
{
    sURL = "AjaxRemoveSurvay.aspx";
    sURL += "?id=" + escape(survay_id);
    postFile(sURL , callback_MyPageContent);
}

function saveSelectedSurvay()
{
    theID = getElementValue(document.getElementById("surveyDisplay"));
    sURL = "AjaxSaveSelectedSurvay.aspx";
    sURL += "?id=" + escape(theID);
    CloseID("message_place");
    postFile(sURL , callback_saveSelectedSurvay);
}

function SaveMoto()
{
    //OpenID("moto03");
    //CloseID("moto02");
    CloseID("message_place");
    theMoto = document.getElementById("moto_inp").value;
    sURL = "AjaxSaveMoto.aspx";
    sURL += "?moto=" + escape(theMoto);
    postFile(sURL , callback_SaveMoto);
}

function MyPageGeneralSendSurvayForm(theSex)
{
    var theMessage = "";
    theCounter = 0;
    theQ = getElementValue(document.getElementById("surveyQ"));
    A1 = getElementValue(document.getElementById("surveyA1"));
    if (A1 != "")
        theCounter++;
    A2 = getElementValue(document.getElementById("surveyA2"));
    if (A2 != "")
        theCounter++;
    A3 = getElementValue(document.getElementById("surveyA3"));
    if (A3 != "")
        theCounter++;
    A4 = getElementValue(document.getElementById("surveyA4"));
    if (A4 != "")
        theCounter++;
    defSurvay = getElementValue(document.getElementById("surveyPost"));
    allOK = true;
    errorMessage = "";
    if (theQ == "")
    {
        allOK = false;
        errorMessage = errorMessage + GetErrorForPageFormat(getSurvayNoQuestion(theSex));
    }
    if (theCounter < 2)
    {
        allOK = false; 
        errorMessage = errorMessage + GetErrorForPageFormat(getSurvayNoAnswers(theSex));
    }
    if (allOK == false)
    {
        document.getElementById("error_place").innerHTML = BuiltMyPageErrorMessage(errorMessage);
        OpenID("error_place");
        window.scroll(0,0);
        return;
    }
    sURL = "AjaxSendSurvayForm.aspx";
    sURL += "?q=" + escape(theQ);
    sURL += "&a1=" + escape(A1);
    sURL += "&a2=" + escape(A2);
    sURL += "&a3=" + escape(A3);
    sURL += "&a4=" + escape(A4);
    sURL += "&def=" + defSurvay;
    postFile(sURL , callback_MyPageContent);
}

function MyPageGeneralSendForm()
{
    var theMessage = "";
    thePName = getElementValue(document.getElementById("Pname"));
    theFName = getElementValue(document.getElementById("Fname"));
    theNName = getElementValue(document.getElementById("nickname"));
    theYear = getElementValue(document.getElementById("y"));
    theMonth = getElementValue(document.getElementById("m"));
    theDay = getElementValue(document.getElementById("d"));
    theFamilyStatus = getElementValue(document.getElementById("status"));
    theCountry = getElementValue(document.getElementById("state"));
    theAddress = getElementValue(document.getElementById("city"));
    theOccupation = getElementValue(document.getElementById("occupation"));
    theSex = getElementValue(document.getElementsByName("sex"));
    theKidoment = getElementValue(document.getElementById("phone2"));
    thePhone = getElementValue(document.getElementById("phone"));
    allOK = true;
    
    errorMessage = "";
    if ((theYear != "0" && (theMonth == "0" || theDay == "0")) ||
        (theMonth != "0" && (theYear == "0" || theDay == "0")) ||
        (theDay != "0" && (theYear == "0" || theMonth == "0")))
    {
        allOK = false;
        errorMessage = errorMessage + GetErrorForPageFormat(getParialDateMessage(theSex));
    }
    if (validatePhoneNumber(thePhone) == false)
    {
        allOK = false;
        errorMessage = errorMessage + GetErrorForPageFormat(getLongPhoneMessage(theSex));
    }
    if (theNName.length < 2 || theNName.length > 10)
    {
        allOK = false;
        errorMessage = errorMessage + GetErrorForPageFormat(getNotInSizeNickMessage(theSex));
    }
    
    if (theKidoment == "0" && thePhone != "")
    {
        allOK = false;
        errorMessage = errorMessage + GetErrorForPageFormat(getParialPhoneMessage2(theSex));
    }
    
    if (allOK == false)
    {
        document.getElementById("error_place").innerHTML = BuiltMyPageErrorMessage(errorMessage);
        OpenID("error_place");
        window.scroll(0,0);
        return;
    }
    sURL = "AjaxCheckIfNickExists.aspx";
    sURL += "?nname=" + escape(theNName);
    CloseID("message_place");
    postFile(sURL , callback_MyPageGeneralSendFormPre);
}
function MyPageGeneralSendFormPost()
{
    var theMessage = "";
    thePName = getElementValue(document.getElementById("Pname"));
    theFName = getElementValue(document.getElementById("Fname"));
    theNName = getElementValue(document.getElementById("nickname"));
    theYear = getElementValue(document.getElementById("y"));
    theMonth = getElementValue(document.getElementById("m"));
    theDay = getElementValue(document.getElementById("d"));
    theFamilyStatus = getElementValue(document.getElementById("status"));
    theCountry = getElementValue(document.getElementById("state"));
    theAddress = getElementValue(document.getElementById("city"));
    theOccupation = getElementValue(document.getElementById("occupation"));
    theSex = getElementValue(document.getElementsByName("sex"));
    theKidoment = getElementValue(document.getElementById("phone2"));
    thePhone = getElementValue(document.getElementById("phone"));
    allOK = true;
    errorMessage = "";
    if ((theYear != "0" && (theMonth == "0" || theDay == "0")) ||
        (theMonth != "0" && (theYear == "0" || theDay == "0")) ||
        (theDay != "0" && (theYear == "0" || theMonth == "0")))
    {
        allOK = false;
        errorMessage = errorMessage + GetErrorForPageFormat(getParialDateMessage(theSex));
    }
    if (theKidoment != "0" && thePhone == "")
    {
        allOK = false;
        errorMessage = errorMessage + GetErrorForPageFormat(getParialPhoneMessage(theSex));
    }
    
    if (theKidoment == "0" && thePhone != "")
    {
        allOK = false;
        errorMessage = errorMessage + GetErrorForPageFormat(getParialPhoneMessage2(theSex));
    }
    
    if (allOK == false)
    {
        document.getElementById("error_place").innerHTML = BuiltMyPageErrorMessage(errorMessage);
        OpenID("error_place");
        window.scroll(0,0);
        return;
    }
    sURL = "AjaxUpdateAccountGeneralDetails.aspx";
    sURL += "?pname=" + escape(thePName);
    sURL += "&fname=" + escape(theFName);
    sURL += "&nname=" + escape(theNName);
    sURL += "&year=" + escape(theYear);
    sURL += "&month=" + escape(theMonth);
    sURL += "&day=" + escape(theDay);
    sURL += "&fstatus=" + escape(theFamilyStatus);
    sURL += "&country=" + escape(theCountry);
    sURL += "&address=" + escape(theAddress);
    sURL += "&occupation=" + escape(theOccupation);
    sURL += "&gender=" + escape(theSex);
    sURL += "&phone_kid=" + escape(theKidoment);
    sURL += "&phone=" + escape(thePhone);
    CloseID("message_place");
    postFile(sURL , callback_MyPageGeneralSendForm);
}

function SplitByChar(toSplit , theCharToSplitWith)
{
    loc = toSplit.lastIndexOf(theCharToSplitWith);
    len = toSplit.length;
    return toSplit.substr(loc + 1,len-loc);
}

function OpenFriendsPop(theText , theID , xDiff)
{
    var coordinates = getAnchorPosition(theID);
	oDiv = document.getElementById("wordPopContainer");
	oDiv.style.left = coordinates.x + xDiff;
	oDiv.style.top = coordinates.y + 55;
	
    
    theString = SplitByChar(theText , ";");
    theString = SplitByChar(theString , ",");
    theString = SplitByChar(theString , ":");
    if (theString != "")
    {
        sURL = "AjaxOpenFriendsPop.aspx?text=" + escape(theString) + "&areaid=" + escape(theID);
        postFile(sURL , callback_OpenWordPop);
    }
    else
    {
        CloseID("wordPopContainer");
    }
}

function OpenWordPop(theType , theText , theID , xDiff)
{
    var coordinates = getAnchorPosition(theID);
	oDiv = document.getElementById("wordPopContainer");
	oDiv.style.left = coordinates.x + xDiff;
	oDiv.style.top = coordinates.y + 55;
    theString = SplitByChar(theText , ";");
    theString = SplitByChar(theString , ",");
    theString = SplitByChar(theString , ":");
    if (theString != "")
    {
        sURL = "AjaxOpenWordPop.aspx?type=" + escape(theType) + "&text=" + escape(theString) + "&areaid=" + escape(theID);
        postFile(sURL , callback_OpenWordPop);
    }
    else
    {
        CloseID("wordPopContainer");
    }
       
}

function DeleteUGCComment(theID)
{
    sURL = "AjaxDeleteUGCComment.aspx?comment_id=" + escape(theID);
    postFile(sURL , callback_MyPageContent);
}

function ConfirmAllUGCComment()
{
    sURL = "AjaxConfirmAllUGCComment.aspx";
    postFile(sURL , callback_MyPageContent);
}

function ConfirmUGCComment(theID)
{
    sURL = "AjaxConfirmUGCComment.aspx?comment_id=" + escape(theID);
    postFile(sURL , callback_MyPageContent);
}

function MyPageDeletePic(theAccountPicID)
{
    sURL = "AjaxMyPageDeletePic.aspx?pic_id=" + escape(theAccountPicID);
    postFile(sURL , callback_MyPageContent);
}

function DeleteAudio(theAccountAudioID)
{
    sURL = "AjaxMyPageDeleteAudio.aspx?audio_id=" + escape(theAccountAudioID);
    postFile(sURL , callback_MyPageContentMPU);
}

function DeleteLovedAudio(theAccountAudioID)
{
    sURL = "AjaxDeleteLovedAudio.aspx?audio_id=" + escape(theAccountAudioID);
    postFile(sURL , callback_MyPageContentMPU);
}

function DeleteVideo(theAccountVideoID)
{
    sURL = "AjaxMyPageDeleteVideo.aspx?video_id=" + escape(theAccountVideoID);
    postFile(sURL , callback_MyPageContent);
}

function MyPageUpdatePic(theAccountPicID)
{
    sURL = "AjaxMyPageUpdatePic.aspx?pic_id=" + escape(theAccountPicID);
    postFile(sURL , callback_MyPageContent);
}

function UpdateAudio(theAccountAudioID)
{
    sURL = "AjaxMyPageUpdateAudio.aspx?audio_id=" + escape(theAccountAudioID);
    postFile(sURL , callback_MyPageContent);
}

function UpdateVideo(theAccountVideoID)
{
    sURL = "AjaxMyPageUpdateVideo.aspx?video_id=" + escape(theAccountVideoID);
    postFile(sURL , callback_MyPageContent);
}

function resetBackgroundImage()
{
    sURL = "AjaxResetBackgroundImage.aspx";
    postFile(sURL , callback_MyPageContent);
}

function DesignTextReset()
{
    freeText = document.getElementById("freeText").value;
    myPics = document.getElementById("myPics").value;
    lastPosts = document.getElementById("lastPosts").value;
    myloved = document.getElementById("myloved").value;
    mycomments = document.getElementById("mycomments").value;
    friends = document.getElementById("friends").value;
    blog = document.getElementById("blog").value;
    survay = document.getElementById("survay").value;
    about = document.getElementById("about").value;
    sURL = "AjaxResetDesignTexts.aspx";
    postFile(sURL , callback_DesignTextReset);
}

function ForgotPassword()
{
    sURL = "AjaxForgotPassword.aspx";
    postFile(sURL , callback_ForgotPassword);
}

function ChangeArtistType(theGender)
{
    var errorMessage = "";
    var allOK = true;
    theArtistType = getElementValue(document.getElementsByName("artist_type"));
    theRequestText = getElementValue(document.getElementById("request_text"));
    thePhoneKidomet = getElementValue(document.getElementById("phone2"));
    thePhone = getElementValue(document.getElementById("phone"));
    if (validatePhoneNumber(thePhone) == false)
    {
        allOK = false;
        document.getElementById("phone").className = "inputError";
        errorMessage = errorMessage + GetErrorForPageFormat(getEmptyPhoneMessage(theGender));
    }	        
    if (theArtistType == "")
    {
        allOK = false;
        errorMessage = errorMessage + GetErrorForPageFormat(getEmptyArtistTypeMessage(theGender));
    }	        
    if (allOK == false)
    {
        document.getElementById("change_account_type_error").innerHTML = errorMessage;
        OpenID("change_account_type_error");
        return;
    }
    
    sURL = "AjaxChangeArtistType.aspx";
    sURL += "?artist_type=" + escape(theArtistType);
    sURL += "&phone_kidomet=" + escape(thePhoneKidomet);
    sURL += "&phone=" + escape(thePhone);
    sURL += "&text=" + escape(theRequestText);
    postFile(sURL , callback_ChangeArtistType);
}

function voteSurvay()
{
    CloseID("message_place1");
    survayValue = getElementValue(document.getElementsByName("survey"));
    if (survayValue == "")
    {
        document.getElementById("message_place1").innerHTML = noVoteSurvay;
        OpenID("message_place");
    }
    else
    {
        sURL = "AjaxVoteSurvay.aspx";
        sURL += "?vote=" + escape(survayValue);
        postFile(sURL , callback_voteSurvay);
    }
}

function ChangePassword(theGender)
{
    //document.getElementById('profileSettings-pass02').style.display='none';document.getElementById('profileSettings-pass01').style.display='';
    theOldPass = document.getElementById("passChange1").value;
    theNewPass = document.getElementById("passChange2").value;
    theNewPassConf = document.getElementById("passChange3").value;
    
    allOK = true;
    errorMessage = "";
    if (theOldPass != theCurrentPassword)
    {
        allOK = false;
        document.getElementById("passChange1").className = "inputError";
        errorMessage = errorMessage + GetErrorForPageFormat(getNotSamePasswordMessage(theGender));
    }
    if (theNewPass == "")
    {
        allOK = false;
        document.getElementById("passChange2").className = "inputError";
        errorMessage = errorMessage + GetErrorForPageFormat(getEmptyPassMessage(theGender));
    }
    if (allOK == true && theNewPass != theNewPassConf)
    {
        allOK = false;
        document.getElementById("passChange2").className = "inputError";
        document.getElementById("passChange1").className = "inputError";
        errorMessage = errorMessage + GetErrorForPageFormat(getDiffPasswordMessage(theGender));
    }
    if (allOK == false)
    {
        document.getElementById("change_pass_error").innerHTML = errorMessage;
        OpenID("change_pass_error");
        return;
    }
    //CloseID("profileSettings-mail02");
    //OpenID("profileSettings-mail01");
    
    sURL = "AjaxChangePassword.aspx";
    sURL += "?newPass=" + escape(theNewPass);
    postFile(sURL , callback_ChangePassword);
    
}

function ChangeEmail(theGender)
{
    theEmail = document.getElementById("EmailChange").value;
    theEmailVerification = document.getElementById("EmailChangeValid").value;
    allOK = true;
    errorMessage = "";
    if (theCurrentEmail == theEmail)
    {
        allOK = false;
        document.getElementById("EmailChange").className = "inputError";
        errorMessage = errorMessage + GetErrorForPageFormat(getSameEmailMessage(theGender));
    }
    if (theEmail == "")
    {
        allOK = false;
        document.getElementById("EmailChange").className = "inputError";
        errorMessage = errorMessage + GetErrorForPageFormat(getEmptyEmailMessage(theGender));
    }
    if (validateEmail(theEmail) == false)
    {
        allOK = false;
        document.getElementById("EmailChange").className = "inputError";
        errorMessage = errorMessage + GetErrorForPageFormat(getUnValidEmailMessage(theGender));
    }
    if (allOK == true && theEmail != theEmailVerification)
    {
        allOK = false;
        document.getElementById("EmailChange").className = "inputError";
        document.getElementById("EmailChangeValid").className = "inputError";
        errorMessage = errorMessage + GetErrorForPageFormat(getDiffEmailMessage(theGender));
    }
    if (allOK == false)
    {
        document.getElementById("change_email_error").innerHTML = errorMessage;
        OpenID("change_email_error");
        return;
    }
    //CloseID("profileSettings-mail02");
    //OpenID("profileSettings-mail01");
    
    sURL = "AjaxChangeEmail.aspx";
    sURL += "?newEmail=" + escape(theEmail);
    postFile(sURL , callback_ChangeEmail);
}

function ChangeEmailMain(theGender)
{
    theEmail = document.getElementById("EmailMainChange").value;
    theEmailVerification = document.getElementById("EmailMainChangeValid").value;
    allOK = true;
    errorMessage = "";
    if (theCurrentEmailMain == theEmail)
    {
        allOK = false;
        document.getElementById("EmailMainChange").className = "inputError";
        errorMessage = errorMessage + GetErrorForPageFormat(getSameEmailMessage(theGender));
    }
    if (theEmail == "")
    {
        allOK = false;
        document.getElementById("EmailMainChange").className = "inputError";
        errorMessage = errorMessage + GetErrorForPageFormat(getEmptyEmailMessage(theGender));
    }
    if (validateEmail(theEmail) == false)
    {
        allOK = false;
        document.getElementById("EmailMainChange").className = "inputError";
        errorMessage = errorMessage + GetErrorForPageFormat(getUnValidEmailMessage(theGender));
    }
    if (allOK == true && theEmail != theEmailVerification)
    {
        allOK = false;
        document.getElementById("EmailMainChange").className = "inputError";
        document.getElementById("EmailMainChangeValid").className = "inputError";
        errorMessage = errorMessage + GetErrorForPageFormat(getDiffEmailMessage(theGender));
    }
    if (allOK == false)
    {
        document.getElementById("change_emailMain_error").innerHTML = errorMessage;
        OpenID("change_emailMain_error");
        return;
    }
    
    sURL = "AjaxChangeEmail.aspx";
    sURL += "?newEmail=" + escape(theEmail);
    sURL += "&emailType=main";
    
    postFile(sURL , callback_ChangeEmailMain);
}

function SavePrivacy()
{
    the_comments_approval = getElementValue(document.getElementsByName("approve"));
    the_date_show = getElementValue(document.getElementsByName("approve2"));
    the_music_play = getElementValue(document.getElementsByName("play"));
    the_message_mail = getElementValue(document.getElementById("mail1"));
    the_comments_mail = getElementValue(document.getElementById("mail2"));
    sURL = "AjaxSavePrivacy.aspx";
    sURL += "?comments_approval=" + escape(the_comments_approval);
    sURL += "&date_show=" + escape(the_date_show);
    sURL += "&music_play=" + escape(the_music_play);
    sURL += "&message_mail=" + escape(the_message_mail);
    sURL += "&comments_mail=" + escape(the_comments_mail);
    postFile(sURL , callback_SavePrivacy);
}

function SendDesignTexts()
{
    freeText = document.getElementById("freeText").value;
    myPics = document.getElementById("myPics").value;
    lastPosts = document.getElementById("lastPosts").value;
    myloved = document.getElementById("myloved").value;
    mycomments = document.getElementById("mycomments").value;
    friends = document.getElementById("friends").value;
    blog = document.getElementById("blog").value;
    survay = document.getElementById("survay").value;
    about = document.getElementById("about").value;
    sURL = "AjaxSendDesignTexts.aspx";
    sURL += "?freeText=" + escape(freeText);
    sURL += "&myPics=" + escape(myPics);
    sURL += "&lastPosts=" + escape(lastPosts);
    sURL += "&myloved=" + escape(myloved);
    sURL += "&mycomments=" + escape(mycomments);
    sURL += "&friends=" + escape(friends);
    sURL += "&blog=" + escape(blog);
    sURL += "&survay=" + escape(survay);
    sURL += "&about=" + escape(about);
    postFile(sURL , callback_SaveSkin);
}

function ReadMail(the_mail_id)
{
    sURL = "AjaxReadMail.aspx?type=0&id=" + the_mail_id;
    postFile(sURL , callback_MyPageContentMPU);
}

function ReadOutMail(the_mail_id)
{
    sURL = "AjaxReadMail.aspx?type=1&id=" + the_mail_id;
    postFile(sURL , callback_MyPageContentMPU);
}

function SendMessage(to_account_id)
{
    sURL = "my_page_mail_inbox.aspx?to_id=" + to_account_id;
    document.location.href=sURL;
}

function ReplyMail(the_mail_id)
{
    CloseID("error_place");
    UnSelectAll("admin_tab" , 3 , "on");
    sURL = "AjaxMyPageMailNew.aspx?reply_id=" + escape(the_mail_id);
    postFile(sURL , callback_MyPageContentMPU);
}

function GetAdminMailPageContent(tab_id)
{
    CloseID("error_place");
    if (tab_id < 10)
        UnSelectAll("admin_tab" , tab_id , "on");
    if (tab_id == 0)
    {
        sURL = "AjaxMyPageMailInbox.aspx";
        postFile(sURL , callback_MyPageContentMPU);
    }
    else if (tab_id == 1)
    {
        sURL = "AjaxMyPageMailOut.aspx";
        postFile(sURL , callback_MyPageContentMPU);
    }
    else if (tab_id == 2)
    {
        sURL = "AjaxMyPageMailArchive.aspx";
        postFile(sURL , callback_MyPageContentMPU);
    }
    else if (tab_id == 3)
    {
        sURL = "AjaxMyPageMailNew.aspx";
        postFile(sURL , callback_MyPageContentMPU);
    }
}

function GetAdminApprovePageContent(tab_id)
{
    CloseID("error_place");
    if (tab_id < 10)
        UnSelectAll("admin_tab" , tab_id , "on");
    if (tab_id == 0)
    {
        sURL = "AjaxMyPageAproveFriends.aspx";
        postFile(sURL , callback_MyPageContentMPU);
    }
    else if (tab_id == 1)
    {
        sURL = "AjaxMyPageAproveComments.aspx";
        postFile(sURL , callback_MyPageContentHover);
    }
}

function GetAdminDesignPageContent(tab_id)
{
    CloseID("error_place");
    if (tab_id < 10)
        UnSelectAll("admin_tab" , tab_id , "on");
    
    sURL = "";
    // סקינים
    if (tab_id == 0)
        sURL = "AjaxMyPageDesignSkin.aspx";
    else if (tab_id == 1)
        sURL = "AjaxMyPageDesignTexts.aspx";
    else if (tab_id == 2)
        sURL = "AjaxMyPageDesignBG.aspx";
    else if (tab_id == 21)
    {
        UnSelectAll("admin_tab" , 2 , "on");
        sURL = "AjaxMyPageDesignBG.aspx?after_load=1";
    }
        
    if (sURL != "")
        postFile(sURL , callback_MyPageContent);
}

function SafeOpenID(theID)
{
    if (document.getElementById(theID) != null)
        OpenID(theID);
}

function SafeCloseID(theID)
{
    if (document.getElementById(theID) != null)
        CloseID(theID);
}

function GetMySiteLoved(tab_id)
{
    if (tab_id < 10)
        UnSelectAll("loved_tab" , tab_id , "on");
    ChangeLovedToPage(tab_id + 1 , 1 , 1);
}

function GetMySiteComments(tab_id)
{
    if (tab_id < 10)
        UnSelectAll("comments_tab" , tab_id , "on");
    ChangeCommentsToPage(tab_id + 1 , 1 , 1);
}

function WatchImage(pic_id)
{
    UnSelectAll("admin_tab" , 2 , "on");
    //SafeCloseID("sidePlayer");
    SafeCloseID("side_profile");
    SafeCloseID("side_band_members");
    SafeCloseID("side_my_channels");
    SafeCloseID("site_frielnds");
    SafeCloseID("site_best_for_me");
    SafeCloseID("site_survay");
    SafeCloseID("site_common_frielnds");
    SafeCloseID("side_last_blogs");
    SafeOpenID("image_list_wrapper");
    sURL = "AjaxMySitePic.aspx?pic_id=" + pic_id;
    postFile(sURL , callback_WatchImage);
}

function WatchImageInt(index_id,pic_id,thePage , theStartPage)
{
    UnSelectAll("side_pic" , index_id , "current");
    sURL = "AjaxMySitePic.aspx?pic_id=" + pic_id + "&page_id=" + escape(thePage) + "&start_page=" + escape(theStartPage);
    postFile(sURL , callback_WatchImage);
}

function PostContent(post_id)
{
    document.getElementById("outer_class").className = "outer Article";
    sURL = "AjaxMySitePostContent.aspx?post_id=" + post_id;
    postFile(sURL , callback_MyPageContentMPU);   
}

function GetMySiteContent(tab_id)
{
    if (tab_id < 10)
        UnSelectAll("admin_tab" , tab_id , "on");
    sURL = "";
    document.getElementById("outer_class").className = "outer";
    if (tab_id == 0)
    {
        //SafeOpenID("sidePlayer");
        SafeOpenID("side_profile");
        SafeOpenID("side_band_members");
        SafeOpenID("side_my_channels");
        SafeOpenID("site_frielnds");
        SafeOpenID("site_best_for_me");
        SafeOpenID("site_survay");
        SafeCloseID("site_common_frielnds");
        SafeCloseID("image_list_wrapper");
        SafeCloseID("related_tags_wrapper");
        SafeCloseID("side_blogs_arch");
        SafeCloseID("side_last_blogs");
        sURL = "AjaxMySiteMain.aspx";
        postFile(sURL , callback_MyPageContentMPU
        );
    }
    else if (tab_id == 1)
    {
        //SafeCloseID("sidePlayer");
        SafeCloseID("side_profile");
        SafeCloseID("side_band_members");
        SafeCloseID("side_my_channels");
        SafeCloseID("site_frielnds");
        SafeCloseID("site_best_for_me");
        SafeCloseID("site_survay");
        SafeOpenID("site_common_frielnds");
        SafeCloseID("image_list_wrapper");
        SafeCloseID("related_tags_wrapper");
        SafeCloseID("side_blogs_arch");
        SafeCloseID("side_last_blogs");
        online = false;
        sURL = "AjaxSearchPeople.aspx?ugc_site=1&online=" + escape(online);
        sURL = sURL + "&theType=4";
        postFile(sURL , callback_MyPageContentMPU);
    }    
    else if (tab_id == 2)
    {
        //SafeCloseID("sidePlayer");
        SafeCloseID("side_profile");
        SafeCloseID("side_band_members");
        SafeCloseID("side_my_channels");
        SafeCloseID("site_frielnds");
        SafeCloseID("site_best_for_me");
        SafeCloseID("site_survay");
        SafeCloseID("site_common_frielnds");
        SafeOpenID("image_list_wrapper");
        SafeOpenID("related_tags_wrapper");
        SafeCloseID("side_blogs_arch");
        SafeCloseID("side_last_blogs");
        sURL = "AjaxMySitePic.aspx";
        postFile(sURL , callback_WatchImage);
    }    
    else if (tab_id == 3)
    {
        //SafeCloseID("sidePlayer");
        SafeCloseID("side_profile");
        SafeCloseID("side_band_members");
        SafeCloseID("side_my_channels");
        SafeCloseID("site_frielnds");
        SafeCloseID("site_best_for_me");
        SafeCloseID("site_survay");
        SafeCloseID("site_common_frielnds");
        SafeCloseID("image_list_wrapper");
        SafeCloseID("related_tags_wrapper");
        SafeOpenID("side_blogs_arch");
        SafeOpenID("side_last_blogs");
        sURL = "AjaxMySiteBlogsMain.aspx";
        postFile(sURL , callback_MyPageBlogsMain);
    }    
}

function GetSerchPageContent(tab_id)
{
    if (tab_id < 10)
        UnSelectAll("search_tab" , tab_id , "on");
    
    sURL = "";
    if (tab_id == 0)
        sURL = "AjaxChangeSearchPageVideosToPage.aspx";
    else if (tab_id == 1)
        sURL = "AjaxChangeSearchPagePeopleToPage.aspx";
    else if (tab_id == 2)
        sURL = "AjaxChangeSearchPageArticlesToPage.aspx";
    else if (tab_id == 3)
        sURL = "AjaxChangeSearchPageSongsToPage.aspx";
    else if (tab_id == 4)
        sURL = "AjaxChangeSearchPagePicsToPage.aspx";
    else if (tab_id == 5)
        sURL = "AjaxChangeSearchPageBlogsToPage.aspx";
    else if (tab_id == 6)
        sURL = "AjaxChangeSearchPageTagsToPage.aspx";
        
    if (sURL != "")
        postFile(sURL , callback_SearchPageChanged);
}

function GetAdminPageContent(tab_id)
{
    CloseID("error_place");
    if (tab_id < 10)
        UnSelectAll("admin_tab" , tab_id , "on");
    sURL = "";
    // מידע כללי
    if (tab_id == 0)
        sURL = "AjaxMyPageUpdateGeneral.aspx";
    else if (tab_id == 1)
        sURL = "AjaxMyPageInterests.aspx";
    else if (tab_id == 2)
        sURL = "AjaxMyPagePerformer.aspx";
    else if (tab_id == 3)
        sURL = "AjaxMyPageBand.aspx";
    else if (tab_id == 4)
        sURL = "AjaxMyPageAbout.aspx";
    else if (tab_id == 7)
        sURL = "AjaxMyPagePics.aspx";
    else if (tab_id == 8)
        sURL = "AjaxMyPageBlogs.aspx";
    else if (tab_id == 81)
        sURL = "AjaxMyPageBlogUpload.aspx";
    else if (tab_id == 9)
        sURL = "AjaxMyPageSurvay.aspx";
    else if (tab_id == 91)
        sURL = "AjaxMyPageSurvayUpload.aspx";
    //upload new pic
    else if (tab_id == 71)
        sURL = "AjaxMyPagePicsUpload.aspx";
    //uploading finished
    else if (tab_id == 72)
        sURL = "AjaxMyPagePicsUploadEnd.aspx";
    else if (tab_id == 6)
        sURL = "AjaxMyPageAudio.aspx";
    else if (tab_id == 61)
        sURL = "AjaxMyPageAudioUpload.aspx";
    else if (tab_id == 62)
    {
        UnSelectAll("admin_tab" , 6 , "on");    
        sURL = "AjaxMyPageAudioUploadEnd.aspx";
    }
    else if (tab_id == 63)
    {
        UnSelectAll("admin_tab" , 6 , "on");    
        sURL = "AjaxMyPageAudio.aspx";
    }    
    else if (tab_id == 5)
        sURL = "AjaxMyPageVideo.aspx";
    else if (tab_id == 51)
        sURL = "AjaxMyPageVideoUpload.aspx";
    else if (tab_id == 52)
    {
        UnSelectAll("admin_tab" , 5 , "on");    
        sURL = "AjaxMyPageVideoUploadEnd.aspx";
    }
    else if (tab_id == 53)
    {
        UnSelectAll("admin_tab" , 5 , "on"); 
        sURL = "AjaxMyPageVideo.aspx";
    }
    
    if (sURL != "")
        postFile(sURL , callback_MyPageContentMPU);
}

function callback_logout(result)
{
    if (result != "")
    {
        document.location.href=result;
        //document.location.href="ugc_login.aspx";
        return;
    }
    document.location.href = document.location.href;
     
}

function changeLoveAudioPlace(theMyAudioID , addVal)
{
    sURL = "AjaxChangeLoveAudioPlace.aspx?my_audio_id=" + escape(theMyAudioID) + "&addval=" + addVal;
    postFile(sURL , callback_MyPageContentMPU);
}

function changeMyAudioPlace(theMyAudioID , addVal)
{
    sURL = "AjaxChangeMyAudioPlace.aspx?my_audio_id=" + escape(theMyAudioID) + "&addval=" + addVal;
    postFile(sURL , callback_MyPageContentMPU);
}

function changeMyVideoPlace(theMyVideoID , addVal)
{
    sURL = "AjaxChangeMyVideoPlace.aspx?my_video_id=" + escape(theMyVideoID) + "&addval=" + addVal;
    postFile(sURL , callback_MyPageContentMPU);
}

function ClipsJannerSelected(janner_id , indexOfTab)
{
    UnSelectAll("janner" , indexOfTab , "on");
    sURL = "AjaxClipsJannerSelected.aspx?janner_id=" + escape(janner_id);
    postFile(sURL , callback_ClipsContentChane);
}

function ClipsSubMenuSelected(sub_menu_id , indexOfTab)
{
    UnSelectAll("sub_menu" , indexOfTab , "on");
    sURL = "AjaxClipsSubMenuSelected.aspx?sub_menu_id=" + escape(sub_menu_id);
    postFile(sURL , callback_ClipsContentChane);
}

function LovePic(pic_id , loveVal)
{
    sURL = "AjaxLovePic.aspx?love=" + loveVal + "&pic_id=" + escape(pic_id);
    postFile(sURL , callback_LoveArticle2);
}

function LovePost(post_id , loveVal)
{
    sURL = "AjaxLovePost.aspx?love=" + loveVal + "&post_id=" + escape(post_id);
    postFile(sURL , callback_LoveArticle2);
}

function LoveArticle(article_id , loveVal)
{
    sURL = "AjaxLoveArticle.aspx?love=" + loveVal + "&article_id=" + escape(article_id);
    postFile(sURL , callback_LoveArticle);
}

function DontLoveArticle(article_id)
{
    sURL = "AjaxLoveArticle.aspx?love=0&article_id=" + escape(article_id);
    postFile(sURL , callback_LoveArticle);
}

function PeopleFriends(theType , theSubMenu)
{
    online = false;
    if (theSubMenu == 1)
        online = true;
    UnSelectAll("people_sub" , theSubMenu , "current");
    sURL = "AjaxSearchPeople.aspx?ugc_site=1&online=" + escape(online);
    sURL = sURL + "&theType=" + escape(theType);
    postFile(sURL , callback_MyPageContentMPU);
}

function PeopleSubMenuSelected(theType , theSubMenu)
{
    online = false;
    if (theSubMenu == 1)
        online = true;
    UnSelectAll("people_sub" , theSubMenu , "on");
    sURL = "AjaxSearchPeople.aspx?online=" + escape(online);
    sURL = sURL + "&theType=" + escape(theType);
    postFile(sURL , callback_SearchPeople);
}

function SendInvitationToFriend()
{
    CloseID("error_in");
    allOK = true;
    errorMessage = "";
    theEmail = getElementValue(document.getElementById("email"));
    theGender = getElementValue(document.getElementsByName("gend"));
    if (theEmail == "")
    {
        allOK = false;
        document.getElementById("email").className = "inputError";
        errorMessage = errorMessage + GetErrorForPageFormat(getEmptyEmailMessage(theGender));
    }
    if (validateEmail(theEmail) == false)
    {
        allOK = false;
        document.getElementById("email").className = "inputError";
        errorMessage = errorMessage + GetErrorForPageFormat(getUnValidEmailMessage(theGender));
    }
    if (theGender == "")
    {
        allOK = false;
        errorMessage = errorMessage + GetErrorForPageFormat(getEmptyGenderMessage(theGender));
    }
    if (allOK == false)
    {
        document.getElementById("rem_error_in").innerHTML = errorMessage;
        OpenID("error_in");
        return;
    }
    sURL = "AjaxSendInvitationToFriend.aspx?email=" + escape(theEmail);
    sURL = sURL + "&gender=" + escape(theGender);
    postFile(sURL , callback_SendInvitationToFriend);
}

function ChangeSidePicsToPage(thePage , theStartPage)
{
    sURL = "AjaxMySitePic.aspx?page_id=" + escape(thePage) + "&start_page=" + escape(theStartPage);
    postFile(sURL , callback_ChangeSidePicsToPage);
}

function ChangeBlogsMainToPageWithMonth(theArchMonth , thePage , theStartPage)
{
    sURL = "AjaxMySiteBlogsMain.aspx?page_id=" + escape(thePage) + "&start_page=" + escape(theStartPage);
    sURL = sURL + "&arch_month=" + theArchMonth;
    postFile(sURL , callback_MyPageContentMPU);
}

function ChangeBlogsMainToPage(thePage , theStartPage)
{
    sURL = "AjaxMySiteBlogsMain.aspx?page_id=" + escape(thePage) + "&start_page=" + escape(theStartPage);
    postFile(sURL , callback_MyPageContentMPU);
}

function ChangePeoplesSearchToPage(theType , thePage , theStartPage)
{
    sURL = "AjaxSearchPeople.aspx?page_id=" + escape(thePage) + "&start_page=" + escape(theStartPage);
    sURL = sURL + "&theType=" + theType;
    postFile(sURL , callback_SearchPeople);
}

function PeopleOrderBy(theType , order_by)
{
    sURL = "AjaxSearchPeople.aspx?orderby=" + (order_by+1) + "&theType=" + escape(theType);
    UnSelectAll("sort" , order_by , "current");
    postFile(sURL , callback_SearchPeople);
}

function SearchPeople(theType)
{
    var theMessage = "";
    theName = getElementValue(document.getElementById("name"));
    //if (theName == "ת’לא חייב לכתוב אגב...")
        //theName = "";
    theSex = getElementValue(document.getElementById("sex"));
    theFromAge = getElementValue(document.getElementById("age"));
    theToAge = getElementValue(document.getElementById("age2"));
    theProfileImage = getElementValue(document.getElementById("profileImgYes"));
    theLocation = getElementValue(document.getElementById("place"));
    theFamilyStatus = getElementValue(document.getElementById("pStatus"));
    theProfileType = getElementValue(document.getElementById("profileType"));
    allOK = true;
    errorMessage = "";
    sURL = "AjaxSearchPeople.aspx?name=" + escape(theName) + "&sex="+ escape(theSex) ;
    sURL = sURL + "&fromAge=" + escape(theFromAge);
    sURL = sURL + "&toAge=" + escape(theToAge);
    sURL = sURL + "&profileImage=" + escape(theProfileImage);
    sURL = sURL + "&location=" + escape(theLocation);
    sURL = sURL + "&familyStatus=" + escape(theFamilyStatus);
    sURL = sURL + "&profileType=" + escape(theProfileType);
    sURL = sURL + "&theType=" + escape(theType);
    postFile(sURL , callback_SearchPeople);
}

function SearchAllPeople(theType)
{
    var theMessage = "";
    theName = "";
    theSex = "0";
    theFromAge = "0";
    theToAge = "0";
    theProfileImage = "";
    theLocation = "0";
    theFamilyStatus = "0";
    theProfileType = "0";
    allOK = true;
    errorMessage = "";
    sURL = "AjaxSearchPeople.aspx?name=" + escape(theName) + "&sex="+ escape(theSex) ;
    sURL = sURL + "&fromAge=" + escape(theFromAge);
    sURL = sURL + "&toAge=" + escape(theToAge);
    sURL = sURL + "&profileImage=" + escape(theProfileImage);
    sURL = sURL + "&location=" + escape(theLocation);
    sURL = sURL + "&familyStatus=" + escape(theFamilyStatus);
    sURL = sURL + "&profileType=" + escape(theProfileType);
    sURL = sURL + "&theType=" + escape(theType);
    postFile(sURL , callback_SearchPeopleAll);
}

function OpenAjaxPopWind(ajaxUrl , className , width , height)
{
	if (ajaxUrl == "AjaxPopupLogin.aspx")
		document.location.href="ugc_login.aspx";
    topLoc = Math.round(pageHeight()/2) + posTop();
    leftLoc = Math.round(pageWidth()/2) - width/2;
    document.getElementById("popDiv").className = className;
    document.getElementById("popDivOuter").style.top = topLoc + "px";
    document.getElementById("popDivOuter").style.left = leftLoc + "px";
    grayOut(true);
    OpenID("popDiv");
    document.getElementById("popDivOuter").style.zIndex=700;
    i = 0;
if (document.getElementById("hpVid") != null)
	CloseID("hpVid");
    while (true)
    {
        theDivID = "the_drop_down_" + i;
        if (document.getElementById(theDivID) != null)
        {
            i++;
            CloseID(theDivID);
        }
        else
            break;
    }
    i = 0;
    while (i<6)
    {
        theDivID = "article_player_" + i;
        if (document.getElementById(theDivID) != null)
            CloseID(theDivID);
        i++;
    }
    postFile(ajaxUrl , callback_OpenAjaxPopWind);
}

function CloseAjaxPopWind()
{
    CloseID("popDiv");
    document.getElementById("popDivOuter").style.zIndex=-1;
    i = 0;
if (document.getElementById("hpVid") != null)
	OpenID("hpVid");
    while (true)
    {
        theDivID = "the_drop_down_" + i;
        if (document.getElementById(theDivID) != null)
        {
            i++;
            OpenID(theDivID);
        }
        else
            break;
    }
    i = 0;
    while (i<6)
    {
        theDivID = "article_player_" + i;
        if (document.getElementById(theDivID) != null)
            OpenID(theDivID);
        i++;
    }
    grayOut(false);
}

function Hit()
{
    sURL = "AjaxHit.aspx";
    postFile(sURL , callback_Hit);
    setTimeout("Hit()",30000);
}

function callback_SendMail()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        
        GetAdminMailPageContent(0);
	  }
    }
}

function callback_MyPageDeletePic()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        GetAdminPageContent(7);
	  }
    }
}

function callback_MyPageInterestsSendForm()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        document.getElementById("message_place1").innerHTML = "הנתונים עודכנו בהצלחה";
        window.scroll(0,200);
        OpenID("message_place");
	  }
    }
}

function callback_ForgotPassword()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        newEmail = result1.split("~~|~~")[1];
        if (result == "OK")
            theError = GetErrorForPageFormat("הסיסמה נשלחת אליך ברגעים אלו למייל: " + newEmail);
        else
            theError = GetErrorForPageFormat("בעיה בשליחת הסיסמה");
        document.getElementById("change_pass_error").innerHTML = theError;
        OpenID("change_pass_error");
	  }
    }
}

function callback_ChangeArtistType()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        if (result == "OK")
        {
            theError = GetErrorForPageFormat("בקשתך נקלטה במערכת ותטופל במהירות האפשרית");
            document.getElementById("message1_place").innerHTML = theError;
            OpenID("message1_place");
            CloseID("profileSettings02");
            OpenID("profileSettings01");
        }
        else
        {
            theError = GetErrorForPageFormat(result);
            document.getElementById("change_account_type_error").innerHTML = theError;
            OpenID("change_account_type_error");
        }
	  }
    }
}

function callback_ChangePassword()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        newEmail = result1.split("~~|~~")[1];
        newPass = result1.split("~~|~~")[2];
        if (result == "OK")
        {
            theCurrentPassword = newPass;
            theError = GetErrorForPageFormat("הסיסמה הוחלפה בהצלחה - ברגעים אלו נשלח אליך מייל אישור עם הפרטים");
            document.getElementById("message1_place").innerHTML = theError;
            OpenID("message1_place");
            CloseID("profileSettings-pass02");
            OpenID("profileSettings-pass01");
        }
        else
        {
            theError = GetErrorForPageFormat("בעיה בעדכון");
            document.getElementById("change_pass_error").innerHTML = theError;
            OpenID("change_pass_error");
        }
	  }
    }
}

function callback_SavePrivacy()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        if (result == "OK")
        {
            theError = GetErrorForPageFormat("נתוני הפרטיות עודכנו.");
            document.getElementById("change_privacy_error").innerHTML = theError;
            OpenID("change_privacy_error");
        }
        else
        {
            theError = GetErrorForPageFormat("בעיה בעדכון");
            document.getElementById("change_privacy_error").innerHTML = theError;
            OpenID("change_privacy_error");
        }
	  }
    }
}

function callback_voteSurvay()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        document.getElementById("survay_place").innerHTML = result;
	  }
    }
}

function callback_ChangeEmail()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        newEmail = result1.split("~~|~~")[1];
        if (result == "OK")
        {
            theCurrentEmail = newEmail;
            theError = GetErrorForPageFormat("המייל הוחלף בהצלחה - ברגעים אלו נשלח אליך מייל אישור עם הפרטים למייל החדש");
            document.getElementById("message1_place").innerHTML = theError;
            OpenID("message1_place");
            CloseID("profileSettings-mail02");
            OpenID("profileSettings-mail01");
            document.getElementById("current_email").value = newEmail;
        }
        else
        {
            theError = GetErrorForPageFormat("בעיה בעדכון");
            document.getElementById("change_email_error").innerHTML = theError;
            OpenID("change_email_error");
        }
	  }
    }
}

function callback_ChangeEmailMain()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        newEmail = result1.split("~~|~~")[1];
        if (result == "OK")
        {
            theCurrentEmailMain = newEmail;
            theError = GetErrorForPageFormat("המייל הוחלף בהצלחה - ברגעים אלו נשלח אליך מייל אישור עם הפרטים למייל החדש");
            document.getElementById("message1_place").innerHTML = theError;
            OpenID("message1_place");
            CloseID("profileSettings-mailMain02");
            OpenID("profileSettings-mailMain01");
            document.getElementById("current_emailMain").value = newEmail;
        }
        else
        {
            theError = GetErrorForPageFormat("בעיה בעדכון");
            document.getElementById("change_emailMain_error").innerHTML = theError;
            OpenID("change_emailMain_error");
        }
	  }
    }
}

function callback_SaveMoto()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        if (result == "OK")
        {
            document.getElementById("moto_readonly").value=document.getElementById("moto_inp").value;
            //document.getElementById("message_place1").innerHTML = "המוטו עודכן בהצלחה";
            //OpenID("message_place");
            OpenID("moto03");
            CloseID("moto01");
            CloseID("moto02");
        }
        else
        {
            OpenID("moto01");
            CloseID("moto02");
            CloseID("moto03");
        }
	  }
    }
}

function callback_saveSelectedSurvay()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        document.getElementById("message_place1").innerHTML = "הנתונים עודכנו בהצלחה";
        OpenID("message_place");
	  }
    }
}

function callback_MyPageGeneralSendForm()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        document.getElementById("message_place1").innerHTML = "הנתונים עודכנו בהצלחה";
        OpenID("message_place");
        window.scroll(0,200);
        //alert("סבבה");
	  }
    }
}

function callback_MyPageGeneralSendFormPre()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        if (result == "OK")
            MyPageGeneralSendFormPost();
        else
        {
            document.getElementById("message_place1").innerHTML = "הכינוי כבר תפוש. מה בנוגע למקוריות?";
            OpenID("message_place");
            window.scroll(0,200);
        }
	  }
    }
}

function callback_OpenWordPop()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        if (result == "")
        {
            CloseID("wordPopContainer");
            document.getElementById("wordPopContainer").innerHTML = "<div class=\"wordPop\"><ul></ul></div>";
        }
        else
        {
            document.getElementById("wordPopContainer").innerHTML = result;
            OpenID("wordPopContainer");
        }
            
	  }
    }
}


function callback_SendPerformer()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        document.getElementById("my_page_content").innerHTML = result;
        document.getElementById("my_page_content").style.background="";
        document.getElementById("message_place1").innerHTML = "הנתונים עודכנו בהצלחה";
        OpenID("message_place");
        window.scroll(0,200);
	  }
    }
}

function callback_MyPageContentHover()
{
    callback_MyPageContent();
    InitHover();
}

function callback_EraseAllSelectedMails()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        audVidID = 0;
        if (result1.split("~~|~~").length > 2)
            audVidID = result1.split("~~|~~")[1];
        document.getElementById("my_page_content").innerHTML = result;
        document.getElementById("my_page_content").style.background="";
        
        if (document.getElementById("musicEditor") != null)
        {
            var so = new SWFObject("flash/AudioPlayer_Article.swf", "musicEditor", "481px", "60px", "9");
            so.addParam("FlashVars", "song_id=" + audVidID + "&song_type=4&visitor_id=" + visitor_id);
            so.addParam("allowFullScreen", "true");
            so.addParam("allowScriptAccess", "sameDomain");
            so.write("musicEditor");
        }        
        if (document.getElementById("videoEditor") != null)
        {
            var so = new SWFObject("flash/VideoPlayer_Single.swf", "videoEditor", "481px", "407px", "9");
            so.addParam("FlashVars", "video_id=" + audVidID + "&video_type=4&visitor_id=" + visitor_id);
            so.addParam("allowFullScreen", "true");
            so.addParam("allowScriptAccess", "sameDomain");
            so.write("videoEditor");
        } 
        if (document.getElementById("textEditor") != null)
        {
            theStartVal = "";
            if (document.getElementById("editor_start_value") != null)
                theStartVal = document.getElementById("editor_start_value").innerHTML;
            textEditor = new richTextEditor("textEditor", "bodyBlack", 500 , theStartVal);
        }         
        //document.getElementById("message_place1").innerHTML = "סבבה. המיילים נמחקו בהצלחה";
        //document.getElementById("message_place").className = "mpRem";
        
        //OpenID("message_place1");
        InitMPU();
	  }
    }
}

function callback_deleteMyTVBoxChannel()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        document.getElementById("my_channels").innerHTML = result;
	  }
    }
}

function callback_deletecomment()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        SafeCloseID("comment_" + result);
	  }
    }
}

function callback_MyMySiteSidePic()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        document.getElementById("image_list_wrapper").innerHTML = result;
	  }
    }
}

function callback_ChangeSidePicsToPage()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result2 = result1.split("~~|~~")[1];
        result3 = result1.split("~~|~~")[2];
        document.getElementById("image_list_wrapper").innerHTML = result2;
        document.getElementById("related_tags_wrapper").innerHTML = result3;
      }
    }
}

function callback_MyPageBlogsMain()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        result2 = result1.split("~~|~~")[1];
        document.getElementById("my_page_content").innerHTML = result;
        document.getElementById("my_page_content").style.background="";
        document.getElementById("side_blogs_arch").innerHTML = result2;
        
        InitHover();
        InitMPU();
      }
    }
}

function callback_WatchImage()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        result2 = result1.split("~~|~~")[1];
        result3 = result1.split("~~|~~")[2];
        document.getElementById("my_page_content").innerHTML = result;
        document.getElementById("my_page_content").style.background="";
        document.getElementById("image_list_wrapper").innerHTML = result2;
        document.getElementById("related_tags_wrapper").innerHTML = result3;
        
        InitHover();
        InitMPU();
      }
    }
}

function callback_MyPageContentMPU()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText; 
        result = result1.split("~~|~~")[0];
        audVidID = 0;
        if (result1.split("~~|~~").length > 2)
            audVidID = result1.split("~~|~~")[1];
        document.getElementById("my_page_content").innerHTML = result;
        document.getElementById("my_page_content").style.background="";
        if (document.getElementById("musicEditor") != null)
        {
            var so = new SWFObject("flash/AudioPlayer_Article.swf", "musicEditor", "481px", "60px", "9");
            so.addParam("FlashVars", "song_id=" + audVidID + "&song_type=4&video_type=4&visitor_id=" + visitor_id);
            so.addParam("allowFullScreen", "true");
            so.addParam("allowScriptAccess", "sameDomain");
            so.write("musicEditor");
        }        
        if (document.getElementById("videoEditor") != null)
        {
            var so = new SWFObject("flash/VideoPlayer_Single.swf", "videoEditor", "481px", "407px", "9");
            so.addParam("FlashVars", "video_id=" + audVidID + "&video_type=4&visitor_id=" + visitor_id);
            so.addParam("allowFullScreen", "true");
            so.addParam("allowScriptAccess", "sameDomain");
            so.write("videoEditor");
        } 
        if (document.getElementById("audioPlayer") != null)
        {
            var so = new SWFObject("flash/AudioPlayer_Artist.swf", "audioPlayer", "666px", "244px", "9");
            so.useExpressInstall("flash/expressinstall.swf");
            so.addParam("wmode", "transparent");
            so.addParam("menu", "false");
            so.addParam("allowFullScreen", "true");
            so.addParam("allowScriptAccess", "sameDomain");
            theFlashVars = "playlist_ugc_id=" + playlist_account_id;
            start_id=audio_start_id;
            start_type=audio_start_type;
            theFlashVars += "&visitor_id=" + visitor_id;
            theFlashVars += "&start_id=" + start_id + "&start_type=" + start_type + "&visitor_email=" +visitorEmail;
            so.addParam("FlashVars", theFlashVars);
            so.write("audioPlayer");
        } 
        if (document.getElementById("videoPlayer") != null)
        {
            var so = new SWFObject("flash/VideoPlayer_Playlist.swf", "videoPlayer", "664px", "406px", "9");
            so.useExpressInstall("flash/expressinstall.swf");
            //so.addParam("wmode", "transparent");
            so.addParam("menu", "false");
            so.addParam("allowFullScreen", "true");
            so.addParam("allowScriptAccess", "sameDomain");
            theFlashVars = "playlist_ugc_id=" + playlist_account_id;
            start_id=video_start_id;
            start_type=video_start_type;
            theFlashVars += "&visitor_id=" + visitor_id;
            theFlashVars += "&start_id=" + start_id + "&start_type=" + start_type + "&visitor_email=" +visitorEmail;
            so.addParam("FlashVars", theFlashVars);
            so.write("videoPlayer");
        } 
        if (document.getElementById("pic_uploader") != null)
        {
            //var soUploaderPic = new SWFObject("flash/FileUpload.swf", "pic_uploader_swf", "200px", "100px", "9");
            var soUploaderPic = new SWFObject("flash/FileUpload.swf", "pic_uploader_swf", "310px", "30px", "9");
            soUploaderPic.useExpressInstall("flash/expressinstall.swf");
            soUploaderPic.addParam("menu", "false");
            soUploaderPic.addParam("allowFullScreen", "true");
            soUploaderPic.addParam("allowScriptAccess", "sameDomain");
            theFlashVars = "base_url=http://localhost:2763/MTV/ugc_upload_pic_gateway.aspx&upload_end_func=uploadPicEnd&button_text=יעי";
            soUploaderPic.addParam("FlashVars", theFlashVars);
            soUploaderPic.write("pic_uploader");
            //document.getElementById("pic_uploader").innerHTML = document.getElementById("uploader_place_holder").innerHTML;
            //document.getElementById("uploader_place_holder").innerHTML = "";
            //window.pic_uploader_swf = document.getElementById('pic_uploader_swf');
            //OpenID("pic_uploader");
        }
        if (document.getElementById("textEditor") != null)
        {
            theStartVal = "";
            if (document.getElementById("editor_start_value") != null)
                theStartVal = document.getElementById("editor_start_value").innerHTML;
            //if (textEditor == null)
                textEditor = new richTextEditor("textEditor", "bodyBlack", 500 , theStartVal);
            //else
                //textEditor.setContent(theStartVal);
        } 
            
        InitHover();
        InitMPU();
        
        if (document.getElementById("nickname") != null)      
            document.getElementById("nickname").focus();
        else if (document.getElementById("bands") != null)      
        {
            if (document.getElementById("bandsTags01") != null)
                OpenID("bandsTags01");
            //document.getElementById("bands").focus();
        }
        else if (document.getElementById("artist") != null)      
            document.getElementById("artist").focus();
        else if (document.getElementById("genre") != null)      
            document.getElementById("genre").focus();
        //InitMyLoved();
	  }
    }
}

function callback_MyPageContent()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        audVidID = 0;
        if (result1.split("~~|~~").length > 2)
            audVidID = result1.split("~~|~~")[1];
        document.getElementById("my_page_content").innerHTML = result;
        document.getElementById("my_page_content").style.background="";
        if (document.getElementById("musicEditor") != null)
        {
            var so = new SWFObject("flash/AudioPlayer_Article.swf", "musicEditor", "481px", "60px", "9");
            so.addParam("FlashVars", "song_id=" + audVidID + "&song_type=4");
            so.addParam("allowFullScreen", "true");
            so.addParam("allowScriptAccess", "sameDomain");
            so.write("musicEditor");
        }        
        if (document.getElementById("videoEditor") != null)
        {
            var so = new SWFObject("flash/VideoPlayer_Single.swf", "videoEditor", "481px", "407px", "9");
            so.addParam("FlashVars", "video_id=" + audVidID + "&video_type=4&visitor_id=" + visitor_id);
            so.addParam("allowFullScreen", "true");
            so.addParam("allowScriptAccess", "sameDomain");
            so.write("videoEditor");
        } 
        if (document.getElementById("textEditor") != null)
        {
            theStartVal = "";
            if (document.getElementById("editor_start_value") != null)
                theStartVal = document.getElementById("editor_start_value").innerHTML;
            //if (textEditor == null)
                textEditor = new richTextEditor("textEditor", "bodyBlack", 500 , theStartVal);
            //else
                //textEditor.setContent(theStartVal);
        }         
	  }
    }
}

function GetSelectedMailsIDs()
{
    theIDs = "";
    cont = true;
    theIndex = 0;
    while(cont)
    {
        theTagID = "mail_select_" + theIndex;
        if (document.getElementById(theTagID) != null)
        {
            if (document.getElementById(theTagID).checked == true)
            {
                if (theIDs != "")
                    theIDs += ",";
                theIDs += document.getElementById(theTagID).value;
            }
        }
        else
        {
            cont = false;
        }
        theIndex++;
    }    
    return theIDs;
}

function ChangeMailOutPage(thePage , theStartPage)
{
    sURL = "AjaxChangeMailOutPage.aspx?start_page=" + escape(theStartPage) + "&page_id=" + escape(thePage);
    postFile(sURL , callback_MyPageContentMPU);
}

function ChangeMailInbloxArchivePage(thePage , theStartPage)
{
    sURL = "AjaxChangeMailInbloxArchivePage.aspx?start_page=" + escape(theStartPage) + "&page_id=" + escape(thePage);
    postFile(sURL , callback_MyPageContentMPU);
}

function ChangeMailInbloxPage(thePage , theStartPage)
{
    sURL = "AjaxChangeMailInboxPage.aspx?start_page=" + escape(theStartPage) + "&page_id=" + escape(thePage);
    postFile(sURL , callback_MyPageContentMPU);
}
function EraseOutboxMail(the_mail_id)
{
    sURL = "AjaxEraseAllSelectedMailsOut.aspx?ids=" + escape(the_mail_id) + "&start_page=1&page_id=1&from_tab=1";
    postFile(sURL , callback_EraseAllSelectedMails);
}
function EraseAllSelectedMailsOut(theGender, thePage , theStartPage , from_tab)
{
    theIDs = GetSelectedMailsIDs();
    if (theIDs != "")
    {
        sURL = "AjaxEraseAllSelectedMailsOut.aspx?ids=" + escape(theIDs) + "&start_page=" + escape(theStartPage) + "&page_id=" + escape(thePage) + "&from_tab=" + escape(from_tab);
        postFile(sURL , callback_EraseAllSelectedMails);
    }
    else
    {
        document.getElementById("message_place1").innerHTML = GetNotSelectedEraseMessage(theGender);
        //document.getElementById("message_place").className = "mpRem";
        OpenID("message_place");
    }
}

function EraseInboxMail(the_mail_id , from_tab)
{
    sURL = "AjaxEraseAllSelectedMails.aspx?ids=" + escape(the_mail_id) + "&start_page=1&page_id=1&from_tab=" + escape(from_tab);
    postFile(sURL , callback_EraseAllSelectedMails);
}
function EraseAllSelectedMails(theGender, thePage , theStartPage , from_tab)
{
    theIDs = GetSelectedMailsIDs();
    if (theIDs != "")
    {
        sURL = "AjaxEraseAllSelectedMails.aspx?ids=" + escape(theIDs) + "&start_page=" + escape(theStartPage) + "&page_id=" + escape(thePage) + "&from_tab=" + escape(from_tab);
        postFile(sURL , callback_EraseAllSelectedMails);
    }
    else
    {
        document.getElementById("message_place1").innerHTML = GetNotSelectedEraseMessage(theGender);
        //document.getElementById("message_place").className = "mpRem";
        OpenID("message_place");
    }
}
function PreEraseAllSelectedMailsConfirm(theGender,thePageID,theStartPage,theType)
{
    theIDs = GetSelectedMailsIDs();
    if (theIDs != "")
    {
        theFunc = "AjaxEraseAllSelectedMailsConfirm.aspx?gender=" + escape(theGender) + "&page=" + thePageID + "&startPage=" + theStartPage + "&type=" + theType;
        OpenAjaxPopWind(theFunc,'TB_pop', 528 , 441);
        CloseID("message_place");
    }
    else
    {
        document.getElementById("message_place1").innerHTML = GetNotSelectedEraseMessage(theGender);
        //document.getElementById("message_place").className = "mpRem";
        OpenID("message_place");
    }
}
function PreEraseAllSelectedMailsOutConfirm(theGender,thePageID,theStartPage,theType)
{
    theIDs = GetSelectedMailsIDs();
    if (theIDs != "")
    {
        theFunc = "AjaxEraseAllSelectedMailsOutConfirm.aspx?gender=" + escape(theGender) + "&page=" + thePageID + "&startPage=" + theStartPage + "&type=" + theType;
        OpenAjaxPopWind(theFunc,'TB_pop', 528 , 441);
        CloseID("message_place");
    }
    else
    {
        document.getElementById("message_place1").innerHTML = GetNotSelectedEraseMessage(theGender);
        //document.getElementById("message_place").className = "mpRem";
        OpenID("message_place");
    }
}
function ArchiveMail(the_mail_id)
{
    sURL = "AjaxArchiveAllSelectedMails.aspx?ids=" + escape(the_mail_id) + "&start_page=1&page_id=1&from_tab=0";
    postFile(sURL , callback_EraseAllSelectedMails);
}

function ArchiveAllSelectedMails(theGender, thePage , theStartPage , from_tab)
{
    theIDs = GetSelectedMailsIDs();
    if (theIDs != "")
    {
        sURL = "AjaxArchiveAllSelectedMails.aspx?ids=" + escape(theIDs) + "&start_page=" + escape(theStartPage) + "&page_id=" + escape(thePage) + "&from_tab=" + escape(from_tab);
        postFile(sURL , callback_EraseAllSelectedMails);
    }
    else
    {
        document.getElementById("message_place1").innerHTML = GetNotSelectedEraseMessage(theGender);
        //document.getElementById("message_place").className = "mpRem";
        OpenID("message_place");
    }
}

function UpdateAbout()
{
    sURL = "AjaxUpdateAbout.aspx?text=" + escape(textEditor.getContent());
    postFile(sURL , callback_UpdateAbout);
}

function callback_UpdateAbout()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        OpenID("message_place");
	  }
    }
}

function callback_DesignTextReset()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        document.getElementById("my_page_content").innerHTML = result;
        document.getElementById("my_page_content").style.background="";
        OpenID("message_place");
        window.scroll(0,200);
	  }
    }
}

function callback_Hit()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        if (document.getElementById("userLine") != null)
            document.getElementById("userLine").innerHTML = result;
	  }
    }
}

function callback_SendInvitationToFriend()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        if (result == "OK")
        {
            document.getElementById("friends_invite_wrapper").innerHTML = result1.split("~~|~~")[1];
            return;
        }
        else
        {
            document.getElementById("rem_error_in").innerHTML = result1.split("~~|~~")[1];
            OpenID("error_in");
        }
	  }
    }
}

function callback_SearchPeople()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        if (document.getElementById("search_people_content") != null)
            document.getElementById("search_people_content").innerHTML = result;
        else
        {
            document.getElementById("my_page_content").innerHTML = result;
            document.getElementById("my_page_content").style.background="";
        }
        InitHover();
        if (document.getElementById("all_but") != null)
            OpenID("all_but");
	  }
    }
}

function callback_SearchPeopleAll()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        if (document.getElementById("search_people_content") != null)
            document.getElementById("search_people_content").innerHTML = result;
        else
        {
            document.getElementById("my_page_content").innerHTML = result;
            document.getElementById("my_page_content").style.background="";
        }
        InitHover();
        document.getElementById("sex").value="0";
        document.getElementById("age").value="0";
        document.getElementById("age2").value="0";
        document.getElementById("profileImgYes").value="0";
        document.getElementById("place").value="0";
        document.getElementById("pStatus").value="0";
        document.getElementById("profileType").value="0";
        document.getElementById("name").value="";
        if (document.getElementById("all_but") != null)
            CloseID("all_but");
	  }
    }
}

function callback_SendArticleComment()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        CloseID("commentform");
        if (document.getElementById("nocommentsyet") != null)
            CloseID('nocommentsyet');
        CloseID("message_place4");
        OpenID("commentformToda");
	  }
    }
}

function callback_LoveArticle()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        document.getElementById("number_of_loved").innerHTML = "<img src=\"images/buttons/hart.png\" alt=\"\" />" + result;
        //ShowMessage("עשיתי את העבודה - אבל איך אני מודיע את זה? ");
	  }
    }
}

function callback_LoveArticle2()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        document.getElementById("number_of_loved").innerHTML = result;
        //ShowMessage("עשיתי את העבודה - אבל איך אני מודיע את זה? ");
	  }
    }
}

function callback_OpenAjaxPopWind()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        //alert(result);
        document.getElementById("popDiv").innerHTML = result;
        InitHover();
	  }
    }
}

function callback_SaveSkin()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        OpenID("message_place");
        window.scroll(0,200);
	  }
    }
}

function callback_SearchPageChanged()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        document.getElementById("content_place").innerHTML = result;
        InitHover();
	  }
    }
}

function callback_ClipsContentChane()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        document.getElementById("clips_content_place").innerHTML = result;
	  }
    }
}

function callback_ChangeChartsToPage()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        document.getElementById("charts_content_place").innerHTML = result;
	  }
    }
}

function callback_ChangeShowsToPage()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        document.getElementById("shows_content_place").innerHTML = result;
	  }
    }
}

function callback_CancelFriendship()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        document.getElementById("friend_but").innerHTML = result;
	  }
    }
}

function callback_RemoveFromFriends()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        alert("עשיתי את העבודה - איך אני מודיע?");
	  }
    }
}

function callback_Login()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        if (result == "OK")
        {
            window.document.location.href = "index.aspx";
            return;
        }
        else if (result == "ACCOUNT_NOT_ACTIVATED")
        {
            errorMessage = "<p><span>-</span> .חשבונך קיים אבל לא הופעל באמצעות לינק האקטיבציה. ברגעים אלו נשלח מייל נוסף עם פרטי האקטיבציה</p>";
            document.getElementById("error1").innerHTML = errorMessage;
            window.scroll(0,0);
            OpenID("error");
        }
        else if (result == "WRONG_USERNAME")
        {
            errorMessage = "<p><span>-</span> שם המשתמש אינו קיים במערכת. <a href=\"javascript:void(0);\" onclick=\"document.getElementById('regIntro').style.display='none';document.getElementById('regIntroForm').style.display='';\">לחץ כאן לבקשת הזמנה</a></p>";
            document.getElementById("error1").innerHTML = errorMessage;
            window.scroll(0,0);
            OpenID("error");
            
        }
        else if (result == "WRONG_PASS")
        {
            errorMessage = "<p><span>-</span> הסיסמה אינה תואמת את כתובת המייל. <a href=\"ugc_register_pass.aspx\">לחץ כאן אם שכחת סיסמה</a></p-->";
            document.getElementById("error1").innerHTML = errorMessage;
            window.scroll(0,0);
            OpenID("error");
        }
        else if (result == "ACOUNT_LOCK")
        {
            errorMessage = "<p><span>-</span> טעית יותר מדי פעמים. תמתין כמה דקות. <a href=\"ugc_register_pass.aspx\">לחץ כאן אם שכחת סיסמה</a></p-->";
            document.getElementById("error1").innerHTML = errorMessage;
            window.scroll(0,0);
            OpenID("error");
        }
        else
        {
            window.document.location.href = result;
        }
	  }
    }
}

function callback_Ajax_Login()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        if (result == "OK")
        {
            window.document.location.href = result;
            return;
        }
        else if (result == "ACCOUNT_NOT_ACTIVATED")
        {
            errorMessage = "<p><span>-</span> .חשבונך קיים אבל לא הופעל באמצעות לינק האקטיבציה. ברגעים אלו נשלח מייל נוסף עם פרטי האקטיבציה</p>";
            document.getElementById("error1").innerHTML = errorMessage;
            OpenID("error");
        }
        else if (result == "WRONG_USERNAME")
        {
            errorMessage = "<p><span>-</span> שם המשתמש אינו קיים במערכת. <a href=\"javascript:void(0);\" onclick=\"document.getElementById('regIntro').style.display='none';document.getElementById('regIntroForm').style.display='';\">לחץ כאן לבקשת הזמנה</a></p>";
            document.getElementById("error1").innerHTML = errorMessage;
            OpenID("error");
            
        }
        else if (result == "WRONG_PASS")
        {
            errorMessage = "<p><span>-</span> הסיסמה אינה תואמת את כתובת המייל.</p-->";
            document.getElementById("error1").innerHTML = errorMessage;
            OpenID("error");
        }
        else if (result == "ACOUNT_LOCK")
        {
            errorMessage = "<p><span>-</span> טעית יותר מדי פעמים. תמתין כמה דקות. <a href=\"ugc_register_pass.aspx\">לחץ כאן אם שכחת סיסמה</a></p-->";
            document.getElementById("error1").innerHTML = errorMessage;
            OpenID("error");
        }
        else if (result == "OK")
        {
            window.document.location.href = "index.aspx";
        }
        else
        {
            window.document.location.href = result;
        }
	  }
    }
}

function callback_FavoriteVideoResponse()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        var split_array=result.split("~|~");
        if (split_array.length == 4)
	    {
	        document.getElementById(split_array[0]).innerHTML = split_array[1];
            document.getElementById(split_array[0]).className  = split_array[2];
            document.getElementById(split_array[0]).href  = split_array[3];
	    }
	  }
    }
}

function callback_FavoriteClipResponse()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        var split_array=result.split("~|~");
        if (split_array.length == 4)
	    {
	        document.getElementById(split_array[0]).innerHTML = split_array[1];
            document.getElementById(split_array[0]).className  = split_array[2];
            document.getElementById(split_array[0]).href  = split_array[3];
	    }
	  }
    }
}

function callback_CommentsToPage()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        document.getElementById("my_comments_content").innerHTML = result;
        InitHover();
        //InitMyLoved();
      }
    }
}

function callback_LovedToPage()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        document.getElementById("my_loved_content").innerHTML = result;
        InitHover();
        //InitMyLoved();
      }
    }
}

function callback_shows_change()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        window.scroll(0,150);
        document.getElementById("shows_content_place").innerHTML = result;
        InitHover();
      }
    }
}

function callback_FriendList()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        document.getElementById("FriendList_place").innerHTML = result;
        InitHover();
      }
    }
}

function callback_articles_change()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        
        result1=xmlhttp.responseText;  
        result = result1.split("~~|~~")[0];
        document.getElementById("articles_content_place").innerHTML = result;
        InitHover();
        loadMiniPlayers();
        dcReloadTmpl();
      }
    }
}

function callback_user_list_tab_clicked()
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText; 
        result = result1.split("~~|~~")[0]; 
        document.getElementById("people_place").innerHTML = result;   
        OpenID("people_place");
        InitCarousel();
        //InitHover();
      }
    }
}

function callback_left_side_tab_clicked(result)
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText; 
        result = result1.split("~~|~~")[0]; 
        var split_array=result.split("~|~");
        if (split_array.length == 2)
	    {
	        document.getElementById("left_video_list").innerHTML = split_array[0];   
	        document.getElementById("to_channel_href").href = "tvbox.aspx?channel=" + split_array[1];
	    }
	  }
	}
}

function UnSelectAll(theBaseName , theIndexOfTag , theSelectClass)
{
    cont = true;
    theIndex = 0;
    while(cont)
    {
        theTagID = theBaseName + "_" + theIndex;
        if (document.getElementById(theTagID) != null)
        {
            if (theIndex == theIndexOfTag)
            {
                document.getElementById(theTagID).className = theSelectClass;
                document.getElementById(theTagID).onclick=function(){return false;};
            }
            else
            {
                document.getElementById(theTagID).onclick=function(){return true;};
                if (document.getElementById(theTagID).className != "")
                {
                    document.getElementById(theTagID).className = "";
                }
            }
        }
        else
        {
            cont = false;
        }
        theIndex++;
    }
}

function SendMediaMailFinal(theType , theRefID , theSender , theOwner)
{
    theFromEmail = document.getElementById("media_send_email_from").value;
    theToEmail = document.getElementById("media_send_email_to").value;
    theToName = document.getElementById("media_send_email_to_name").value;
    sURL = "AjaxSendMediaMailFinal.aspx?type=" + escape(theType) + "&sender_id=" + escape(theSender) + "&owner_id=" + escape(theOwner) + "&ref_id=" + escape(theRefID) + "&from_email=" + escape(theFromEmail) + "&to_email=" + escape(theToEmail) + "&to_name=" + escape(theToName);
    postFile(sURL , callback_SendMediaMailFinal);
}

function callback_SendMediaMailFinal(result)
{
    if (xmlhttp.readyState==4) 
    { 
      if (xmlhttp.status==200) 
      { 
        result1=xmlhttp.responseText; 
        result = result1.split("~~|~~")[0]; 
	    document.getElementById("inner_send_to_friend").innerHTML = result;   
	  }
	}
}
