﻿var dir = (document.domain == 'web' ? '/anneysen':'');
var AutoClick = '';

function mh(obj) {
    if (document.all) {
        obj.style.behavior = 'url(#default#homepage)';
        obj.setHomePage('http://www.anneysen.com/');
    }
    else alert('Tarayıcınız otomaik ana sayfa atama desteklemiyor. Siteyi açılış sayfanız yapmak için ayarlar bölümünden "Ana sayfam yap" bolume http://www.anneysen.com yazmanız gerekmektedir.');
    return false;
}

function sb(obj) {
    if (document.all) {
        window.external.AddFavorite('http://www.anneysen.com/', 'anneysen.com');
    }
    else alert('Tarayıcınız otomaik favoriler eklemeyi desteklemiyor. Siteyi favorilerinize eklemek için CTRL + D tuşlarına aynı anda basmanız gerekmektedir.');
    return false;
}
function IsimAnaliziSearch() {

    var tosearch = $('.fbContainer #Search').val().replace('"', '').replace('ş', 's').replace('ğ', 'g').replace('ç', 'c').replace('ö', 'o').replace('ü', 'u').replace('"','').split(' ');
    if ($('.fbContainer #Search').val() != "Aradığınız isim" && tosearch[0].trim() != '')
        window.location = "http://www.anneysen.com/Facebookapplications/SearchResults.aspx?searchphrase=" + tosearch[0];

}
function PostOnWall(name,description,link,picture,caption) {
    
    var params = {};
    params['message'] = '';
    
    params['name'] = name;
    params['description'] = description;
    params['link'] = link;
    params['picture'] = picture;
    params['caption'] = caption;
    FB.api('/me/feed', 'post', params, function(response) {
        if (!response || response.error) { alert('Error occured'); }
        else {
            //alert('Published to stream - you might want to delete it now!');
        }
    });

//       params['name'] = 'Name';
//       params['description'] = 'description';
//       params['link'] = 'http://www.anneysen.com/';
//       //params['picture'] = 'http://www.facebook.com/?ref=logo';
//       params['caption'] = 'facebook developer';
//       FB.api('/me/feed', 'post', params, function(response) {
//            if (!response || response.error) { alert('Error occured'); }
//            else {
//                alert('Published to stream - you might want to delete it now!');
//           }
//       });


}
function IsUseralreadyUsedApp(currentfbuserid) {

    $.ajax({
        type: "POST",
        url: "http://www.anneysen.com/WebMethods/InsertFacebookData.aspx/IsUseralreadyUsedApp",
        data: "{ 'currentfbuserid' : '" + currentfbuserid + "'}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function(msg) {
       

            if (msg.d == 'true') {

                window.location = "http://www.anneysen.com/Facebookapplications/If-Not-Liked.aspx"                

            }
            else {
                
            }
        },
        error: function(xmlHttpRequest, textStatus, errorThrown) {
            //alert(textStatus + ", " + errorThrown + ", " + xmlHttpRequest);
        }
    });
}

function InsertFacebookUserName(currentfbuserid, currentfbusername) {

    $.ajax({
        type: "POST",
        url: "http://www.anneysen.com/WebMethods/InsertFacebookData.aspx/InsertFacebookUsername",
        data: "{ 'currentfbuserid' : '" + currentfbuserid + "','currentfbusername' : '" + currentfbusername + "'}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function(msg) {


            if (msg.d == 'true') {

                
            }
            else {
                alert("no");
            }
        },
        error: function(xmlHttpRequest, textStatus, errorThrown) {
            //alert(textStatus + ", " + errorThrown + ", " + xmlHttpRequest);
        }
    });
}
function flash(w, h, u, t) {
    document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='" + w + "' height='" + h + "'><param name='movie' value='" + u + "'><param name='quality' value='high'>");

    if (t == "y") {
        document.write("<param name='wmode' value='transparent'>");
    }

    document.write("<embed wmode='transparent' src='" + u + "' quality='high' type='application/x-shockwave-flash' width='" + w + "' height='" + h + "'></embed></object>");
}

function WithFacebookLogin(){

    FB.login(function(response) {
        if (response.authResponse) {

            FB.api('/me', function(response) {
                var currentfbusername;
                var currentfbuserid;
                var email;
                var birthdate;
                var firstname;
                var lastname;
                currentfbusername = response.name;
                currentfbuserid = response.id;
                email = response.email;
                birthdate = response.birthday;
//                firstname = response.name.split(' ')[0];
//                lastname = response.name.split(' ')[1];
                firstname = response["first_name"];
                lastname = response["last_name"];
                document.location.href = "http://www.anneysen.com/FacebookConnect/FacebookLoginControl.aspx?email=" + email + "&id=" + currentfbuserid + "&birthdate=" + birthdate+"&firstname="+firstname+"&lastname="+lastname;
            });
        } else {
            alert('User cancelled login or did not fully authorize.');
        }
    }, { scope: 'read_stream,publish_stream,offline_access,user_likes,email, user_birthday' });


   
}
function FBLogin() {
    FB.login(function(response) {
        if (response.authResponse) {
            //alert("Yetkiler alindi");
            // user is logged in and granted some permissions.
            // perms is a comma separated list of granted permissions
            FB.api('/me', function(response) {
                var currentfbusername;
                var currentfbuserid;

                currentfbusername = response.name;
                currentfbuserid = response.id;
                var posted = false;
                FB.api('/me/posts', function(response) {


                    for (var i = 0; i < response.data.length; i++) {

                        if (response.data[i].link == "http://www.facebook.com/apps/application.php?id=211217758916144#!/anneysen?sk=app_211217758916144") {
                            posted = true;


                        }



                    }
                    if (posted == false)
                        PostOnWall('İsimler karakter hakkında neler anlatıyor?', 'Sen de kullanmak istersen uygulamayı yükle.', 'http://www.facebook.com/apps/application.php?id=211217758916144#!/anneysen?sk=app_211217758916144', 'http://www.anneysen.com/App_Themes/CommunitySite/Images/facebook/isimanalizilogo.jpg', currentfbusername + ', anneysen.com İsim Analizi uygulamasını kullandı.');




                });


                //InsertFacebookUserName(currentfbuserid, currentfbusername);
                FB.api('/me/likes', function(response) {
                    var isliked = false;
                    for (var i = 0; i < response.data.length; i++) {
                        if (response.data[i].id == "213688395846") {
                            isliked = true;
                            
                            break;
                        }

                    }
                    if (isliked == true)
                        window.location = "http://www.anneysen.com/Facebookapplications/Search-Isim.aspx";
                    else
                        window.location = "http://www.anneysen.com/Facebookapplications/If-Not-Liked.aspx";
                });


            });

        } else {
            // user is not logged in
            alert("login basarisiz ya da yetkiler alınamadı");
        }
    }, { scope: 'read_stream,publish_stream,offline_access,user_likes' });
}




//function DocumentReady() {
$(document).ready(function() {
    var besindex = 0;
    $('.Center .uz_UzmanlikAlaniTitle').each(function() {
        if ($(this).html() != 'Beslenme ve Diyet') {
            $(this).hide();
            $('.Center').children('.uz_UzmanMakaleList').eq(besindex).hide();

        }
        besindex++;
    });
    $('.uz_UzmanlikAlaniList select').change(function() {
        $('.Center .uz_UzmanlikAlaniTitle').hide();
        $('.Center .uz_UzmanMakaleList').hide();
        var catname = $(this).val();
        var i = 0;

        $('.Center .uz_UzmanlikAlaniTitle').each(function() {
            if ($(this).html() == catname) {
                $('.Center').children('.uz_UzmanMakaleList').eq(i).show();

            }
            i++;
        });
        $('.Center .uz_UzmanlikAlaniTitle').each(function() {
            if ($(this).html() == catname) {
                $(this).show();
                return false;
            }
        });

    });
    $('.epostatd input').focus(function() {
        $('.epostadiv').show();
    });
    $('.epostatd input').blur(function() {
        $('.epostadiv').hide();
    });
    $('.sifretd input').focus(function() {
        $('.sifrediv').show();
    });
    $('.sifretd input').blur(function() {
        $('.sifrediv').hide();
    });
    $('.usernametd input').focus(function() {
        $('.usernamediv').show();
    });
    $('.usernametd input').blur(function() {
        $('.usernamediv').hide();
    });
    $('.childtd input').focus(function() {
        $('.tarihdiv').show();
    });
    $('.childtd input').blur(function() {
        $('.tarihdiv').hide();
    });
    $('.usernametd  .registerlabel').blur(function() {
        //alert($(this).val());
        $('.usernamechecking').load('http://www.anneysen.com/CustomPages/CheckUserName.aspx?username=' + $(this).val() + '  .result');
        $('.usernamechecking').show();



    });
    $('.withfacelogin').click(function() {
        WithFacebookLogin();
    });
    $(".UserDateOfBirthdiv span").each(function() {
        if ($(this).text() == '' || $(this).text() == 'N/A') {
            $(this).text(' -');
            $(this).val(' -');
        }

    });
    $(".anneleresorposttext").each(function() {

        if ($.browser.safari || $.browser.mozilla || $.browser.opera)
        { $(this).find('style').remove(); }
        else
            $('style', $(this)).remove();
        $('script', $(this)).remove();

        var regex = new RegExp("(\<)(?!([\/]?)(br|p|b|i|li)(\s|\/|\>))(.*?\>)", "gi");

        $(this).html(linkify($(this).html().replace(regex, "")));



        //$(this).html(linkify($(this).text()));
    });
    $(".PostText").each(function() {
        $(this).html(linkify($(this).text()));
    });
    $(".CommentDetail .CommentText").each(function() {
        $(this).html(linkify($(this).text()));
    });
    $(".BlogPostBody").each(function() {
        //        if ($.browser.safari || $.browser.mozilla || $.browser.opera)
        //        { $(this).find('style').remove(); }
        //        else
        //        $('style', $(this)).remove();
        //        $('script', $(this)).remove();

        //        var regex = new RegExp("(\<)(?!([\/]?)(br|p|b|i|li)(\s|\/|\>))(.*?\>)", "gi");

        //        $(this).html(linkify($(this).html().replace(regex, "")));

    });
    $(".UzmanCevap").each(function() {
        $('style', $(this)).remove();
        $('script', $(this)).remove();
        var regex = new RegExp("(\<)(?!([\/]?)(br|p|b|i|li)(\s|\/|\>))(.*?\>)", "gi");

        $(this).html(linkify($(this).html().replace(regex, "")));

    });
    $(".anneysenblogbody").each(function() {


        //        $('style', $(this)).remove();
        //        $('script', $(this)).remove();
        //        var regex = new RegExp("(\<)(?!([\/]?)(br|p|b|i|li)(\s|\/|\>))(.*?\>)", "gi");

        //        $(this).html(linkify($(this).html().replace("[if !supportLists]", "").replace("[if !supportLists]", "").replace("[endif]", "").replace("[endif]", "").replace("[endif]", "").replace("[if !supportLists]", "").replace("<!---->", "").replace("<!---->", "").replace("<!---->", "").replace(regex, "")));
    });


    $('.DontShow').change(function() {

        $('.resdiv').load('http://www.anneysen.com/CustomPages/DontShowPopupAgain.aspx' + ' .result');


    });
    $('.DontShow').click(function() {

        $('.resdiv').load('http://www.anneysen.com/CustomPages/DontShowPopupAgain.aspx' + ' .result');


    });
    $('.openregister').click(function() {
        window.parent.document.location.href = 'http://www.anneysen.com/register.aspx';
    });

    $(".UserNotification .UserSharing").each(function() {
        $(this).html(linkify($(this).text()));
    });
    $(".ReCommentInner .UserSharing").each(function() {
        //$(this).html(linkify($(this).text()));
    });
    $(".gruplarposttext").each(function() {
        $(this).html(linkify($(this).text()));
    });




    $('.facePage_Login').click(function() {
        FBLogin();

    });
    $('.isimanaliziredirectfb').click(function() {
        window.open('http://www.anneysen.com/bebek-isimleri.aspx', '_blank');
        //alert("test");
    });
    $('.AnnelereSorLikeBtn').click(function() {
        //alert("'.likescount" + $(this).attr('PostID') + "'");
        //var likeclass = "'.likescount" + $(this).attr('PostID') + "'";
        //alert($("'.likescount." + $(this).attr('PostID') + "'").html());
        var likecount = $("'.likescount." + $(this).attr('PostID') + "'").html();
        var postidtolike = $(this).attr('PostID');
        //alert($(likeclass).text());
        likecount++;
        var thisbtn = $(this);

        $.ajax({
            type: "POST",
            url: "http://www.anneysen.com/WebMethods/AnneysenLikeEvents.aspx/AnnelereSorLike",
            data: "{ 'postid' : '" + $(this).attr('PostID') + "'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function(msg) {





                if (msg.d == 'true') {
                    $("'.likescount." + postidtolike + "'").html(likecount);
                    $("'.likescount." + postidtolike + "'").show();
                    $("'.likeinfo." + postidtolike + "'").show();
                    thisbtn.hide();
                }
                else {
                    alert("false");
                }
            },
            error: function(xmlHttpRequest, textStatus, errorThrown) {
                //alert(textStatus + ", " + errorThrown + ", " + xmlHttpRequest);
            }
        });
    });

    //    if (window.location.href == "http://www.anneysen.com/FacebookApplications/Facebook-Isim-Analizi.aspx") {
    //        alert("yes");
    //        FB.api('/me', function(response) {
    //            var currentuserid = response.id;
    //            IsUseralreadyUsedApp(currentuserid);
    //        });

    //    }
    //    //alert(window.location.href);
    //    if (window.location.href == "http://www.anneysen.com/Facebookapplications/If-Not-Liked.aspx") {
    //        alert(window.location.href);
    //        FB.api('/me/likes', function(response) {
    //            var isanneysenpageliked = false;
    //            for (var i = 0; i < response.data.length; i++) {
    //                if (response.data[i].id == "213688395846") {
    //                    isanneysenpageliked = true;



    //                    break;
    //                }
    //                if (isanneysenpageliked == true)
    //                    window.location = "http://www.anneysen.com/Facebookapplications/Search-Isim.aspx";

    //            }

    //        });

    //    }

    $('.fbContainer #Search').click(function() {

        if ($(this).val() == "Aradığınız isim")
            $(this).val("");

    });
    $('.NameShareButton').click(function() {

        FB.getLoginStatus(function(response) {
            if (response.session) {
                PostOnWall('İsimler karakter hakkında neler anlatıyor?', 'Sen de isim analizini yapmak istersen anneysen.com İsim Analizi uygulamasını yükle.', 'http://www.facebook.com/apps/application.php?id=211217758916144#!/anneysen?sk=app_211217758916144', 'http://www.anneysen.com/App_Themes/CommunitySite/Images/facebook/isimanalizilogo.jpg', $('.NameResult').html() + ': ' + $('.NameDescription').html());
                alert("İsim analizi duvarınızda başarıyla paylaşılmıştır");
            } else {
                FBLogin();
            }
        });



        //alert($('.NameResult').html() + ': ' + $('.NameDescription').html());

    });
    $('.anneleresorfbshare').click(function() {
        var title = $(this).attr('Title');
        var link = $(this).attr('Link');
        var desc = $(this).attr('Desc');
        FB.login(function(response) {
            if (response.authResponse) {

                var params = {};
                params['message'] = '';

                params['name'] = title;
                params['description'] = desc;
                params['link'] = link;


                FB.api('/me/feed', 'post', params, function(response) {
                    if (!response || response.error) { alert('Error occured'); }
                    else {
                        alert('Soru başarıyla duvarınızda paylaşılmıştır!');
                    }
                });

            } else {

            }
        }, { scope: 'read_stream,publish_stream,offline_access,user_likes,email, user_birthday' });
        return false;
    });
    $('.fbContainer .fbSearchBtn').click(function() {
        var tosearch = $('.fbContainer #Search').val().replace('ş', 's').replace('"', '').replace('ğ', 'g').replace('ç', 'c').replace('ö', 'o').replace('ü', 'u').replace('"', '').split(' ');

        if ($('.fbContainer #Search').val() != "Aradığınız isim" && $('.fbContainer #Search').val().trim() != '')
            window.location = "http://www.anneysen.com/Facebookapplications/SearchResults.aspx?searchphrase=" + tosearch[0];

    });

    if ($('.membersallyazi').html() == "Henüz hiç bir yazı bulunmamaktadır.")
        $('.mAnneblogs a').hide();
    if ($('.nophotos').html() == "Hiçbir fotoğrafı bulunmamaktadır.")
        $('.allphotos').hide();


    KeyWordHiLite();
    $(".InterestsSamples a").click(function() {

        var $text = $(".InterestsTextArea");

        $text[0].value += this.innerHTML + ", ";
        return false;
    });
    $(".InterestsSamples2 a").click(function() {

        var $text = $(".InterestsTextArea2");

        $text[0].value += this.innerHTML + ", ";
        return false;
    });
    $(".AttributesSamples a").click(function() {
        var $text = $(".AttributesTextArea");

        $text[0].value += this.innerHTML + ", ";
        return false;
    });

    $(".CountryCity span").each(function() {
        var str = $(this).text();
        var arr = str.split(";");
        $(this).text(arr[1]);
    });
    $(".CountryCity span").each(function() {
        var str = $(this).text();
        var arr = str.split(";");
        $(this).text(arr[1]);
    });


    $('#plcRoot_Layout_zoneContent_SubContent_SubContent_Layout_zoneCenterLeft_logonminiform_loginElem_Password').attr('value', 'Şifre');
    //alert('anneysen test');




    $('#adhoodBannerDiv').css('position', 'absolute');
    $('.titlefooter a').each(function() { if ($(this).attr('onclick') == '') $(this).attr('href', '#'); });
    $('.ContentButton').css({ 'BackgroundImage': 'url(' + dir + '/App_Themes/CommunitySite/Images/Buttons/Orange99.gif) no-repeat top', 'border': 'none' });
    $('.centerarea .gurupekle').css('marginTop', '10px');
    //$('.LogonTextBox:first').focus();
    //$('.CornerContainer > div').css({ 'margin': '0', 'padding': '0' });
    if ($('.ProfessionList').length) $('.QstCategories').hide();
    if ($('.MakaleListError').length) $('.MakaleList td').hide();
    if ($('.VideoListError').length) $('.VideoList td').hide();
    $('.VideoList').addClass('MakaleList');


    $('.UzmanQstSearchContainer .uLeft input').val('Uzmanlara Sor içerisinde');
    $('.UzmanQstSearchContainer .uLeft input').keydown(function(event) { if (event.keyCode == 13) { $('.UzmanQstSearchContainer .uRight img').click(); return false; } });

    $('.UzmanQstSearchContainer .uLeft input').click(function() { $(this).val(''); });
    $('.UzmanQstSearchContainer .uRight img').click(function() { var t = $('.UzmanQstSearchContainer .uLeft input').val(); if (t) window.location.href = dir + '/Experts/Sorular.aspx?w=' + t; });
    $('.EditForm').css('border', 'none');
    $('.EditForm').css('margin-left', '5px');
    $('.EditForm').css('margin-top', '10px');
    $('.PageContent').css('border', 'none');

    $('.txtSearch').click(function() { $(this).val(''); });
    $('.CevapKategorileri').change(function() { window.location = "Forums.aspx?Category=" + $('.CevapKategorileri :selected').text(); });

    $('#imgCevapButton').click(function() {

        window.location = dir + '/Forums.aspx?Category=' + $('.SoruCevaplari :selected').text();


    });
    $('.registerlabeldate').attr('readonly', 'readonly');


    if ($('.gp').text().length > 0) {

        $('.allminegroups').remove();
    }
    if ($('.gp2').text().length > 0) {

        $('.allminegroups2').remove();
    }
    $('#imgSor').click(function() {

        //    alert($('.SoruCevaplari ').val());
        window.location = dir + '/Forums/Create.aspx?replyto=0&Category=' + $('.SoruCevaplari :selected').val();


    });
    $('#imgGoster').click(function() {

        //    alert($('.SoruCevaplari ').val());
        window.location = dir + '/Forums.aspx?Category=' + $('.SoruCevaplari2 :selected').text() + '&CategoryID=' + $('.SoruCevaplari2 :selected').val();


    });
    $('.SorularDropDownlist').change(function() {
        window.location = "/Forums/Create.aspx?replyto=0&Category=" + $('.SorularDropDownlist').val();
    });
    $('ul.dropdown > li > ul.sub_menu > li > a').mouseover(function() {
        $('a', $(this).parent().parent().parent()).each(function() {
            $(this).css('color', '#589442');
            return false;
        });
    });

    $('ul.dropdown > li ').mouseover(function() {
        $('a', $(this)).each(function() {
            $(this).css('color', '#589442');
            return false;
        });
    });
    $('ul.dropdown > li ').mouseout(function() {
        $('a', $(this)).each(function() {
            if ($(this).parent().attr('class') != 'Selected') {
                $(this).css('color', 'white');
                return false;
            }
        });
    });
    $('ul.dropdown > li > ul.sub_menu ').mouseout(function() {
        $('a', $(this).parent()).each(function() {
            if ($(this).parent().attr('class') != 'Selected') {
                $(this).css('color', 'white');
                return false;
            }
        });
    });
    $(".memberleft").mouseover(function() {

        var left = $(this).offset().left;
        //alert(left);
        $(this).parent().find('.membercursor').css('margin-left', (left - 491) + 'px');

        $(this).parent().find('.membercursor').show();
        //alert($(this).parent().find('.membercursor').attr('left'));
    });
    $(".memberleft").mouseout(function() {


        $(this).parent().find('.membercursor').hide();
    });




    $(".CMSListMenuUL li > a").hover(menuOver, menuOut);
    $('.TopMenuDigerButton,.UzmanlaraSorButton').hover(menuOver, menuOut);
    $(".SubMenu").hover(menuOver, menuOut);
    //    $(".registerbuttonstyle").click(function() {

    //        if ($(".kullanimsrtlari input:first").is(':checked') == false) {
    //            alert("Lütfen kullanım şartlarını okuyun ve işaretleyin..");
    //            return false;
    //        }
    //    });

    $(".ContentButton2").click(function() {
        alert("dfsdfs")
        if ($(".uyeliksrtlari input:first").is(':checked') == false) {
            alert("Lütfen grup üyelik  şartlarını okuyun ve işaretleyin..");
            return false;
        }
    });
    $(".deletealbum").click(function() {

        if (confirm("Bu albümü silmek istediğinden emin misin?")) {

            window.location = "MyAlbums.aspx?Delete=True&MediaLibraryID=" + $(this).attr("id");
        }


    });
    $(".deletephoto").click(function() {

        if (confirm("Bu fotoğrafı silmek istediğinizden emin misiniz?")) {

            window.location = "MyPhotos.aspx?Delete=True&FileID=" + $(this).attr("id");
        }


    });

    /* Update Page Title's */
    $('.PageTitle').each(
        function() {
            var prefix = $(this)[0].attributes.getNamedItem("prefix");
            if (prefix != null) {
                prefix = prefix.value;
                var TitleDiv = '<div style="float:left;"><img src="' + dir + '/app_themes/communitysite/images/titles/' + prefix + '_left.gif"></div>';
                TitleDiv += '<div style="float:left; width:590px; height:40px; background-image:url(' + dir + '/app_themes/communitysite/images/titles/' + prefix + '_back.gif); background-image:repeat:x;">' + $(this).html() + "</div>";
                TitleDiv += '<div style="float:right;"><img src="' + dir + '/app_themes/communitysite/images/titles/' + prefix + '_right.gif"></div><div style="clear:both; height:5px;"></div>';
                $(this).html(TitleDiv);
            }
        }
    );
    $('select.RedirectMe').change(function() { if ($(this).val()) window.location.href = $(this).val(); })
    $('.UzmanTabContainer .Tab').each(function() {
        var TabDiv = '<div class="Left"></div><div class="Body">' + $(this).html() + '</div><div class="Right"></div>';
        $(this).html(TabDiv);
    });

    /* Uzman Tabs */
    $('.UzmanTabContainer .Tab').click(function() {
        $('.UzmanTabContainer .Tab').each(function() {
            $(this).removeClass('Tab_off');
            $(this).addClass('Tab_on');
        });
        $(this).removeClass('Tab_on');
        $(this).addClass('Tab_off');
        $('.TabDiv').each(function() { $(this).parent().parent().hide(); });
        $('#Tab_' + $(this).attr('id')).parent().parent().show();
    });
    if (!AutoClick) $('.UzmanTabContainer .Tab:first').click();
    else $('#' + AutoClick).click();
    if ($('.UzmanCevap').text() == '') $('.UzmanCevap').html('Soru henüz yanıtlanmamıştır.');
    $('#tdUserName input:first').keyup(function() {
        if ($(this).val().length > 12) {
            alert('anneysen.com kullanıcı ismi en fazla 12 karakter olabilir.');
            $(this).val($(this).val().substr(0, 12));
        }
    });

    $('#Tab_SoruSor .TextAreaField').keyup(function() {
        if ($(this).val().length > 1000) {
            alert('1000 karakterden fazla yazamazsınız.');
            $(this).val($(this).val().substr(0, 1000));
        }
        $('#ToplamHarf').html($(this).val().length);
    });
    $('#Tab_SoruSor .FormButton').click(function() {
        if ($('#ToplamHarf').html() != '') {
            if ($('#ToplamHarf').html() < 50) {
                alert('Lütfen sorunuzu 50 karakteri geçecek şekilde detaylandırın.');
                return false;
            }
        }
        {
            if ($('.txtSoru').val() == '') {
                alert('Lütfen soru başlığını girin.');
                return false;
            }
        }
        $(this).hide();
    });


    //    $('#RootPostButton').click(function() {
    //        
    //    });

    $(".chkfavoriisim").click(function() {

        if ($(".chkfavoriisim").is(':checked') == true) {

            if ($('.silinecekdeger').val() == '')
                $('.silinecekdeger').val($('.silinecekdeger').val() + $(this).val());

            else
                $('.silinecekdeger').val($('.silinecekdeger').val() + ';' + $(this).val());

        }

    });
    $(".chkfavoriisim1").click(function() {


        $(".chkfavoriisim").attr('checked', this.checked);
    });
    $(".chkMessageDelete").click(function() {

        if ($(".chkMessageDelete").is(':checked') == true) {

            if ($('.silinecekmessageiddeger').val() == '')
                $('.silinecekmessageiddeger').val($('.silinecekmessageiddeger').val() + $(this).val());

            else
                $('.silinecekmessageiddeger').val($('.silinecekmessageiddeger').val() + ',' + $(this).val());

        }
        // alert($('.silinecekmessageiddeger').val());

    });
    $(".chkMessageDeleteAll").click(function() {


        $(".chkMessageDelete").attr('checked', this.checked);
    });
    $('.blogmonthdiv .AnneysenBloglariBlogMonthName').click(function() {
        $('.SamePostLinks').hide();
        $('.SamePostLinks', $(this).parent()).show();

    });
    $(".DeleteAllMs").click(function() {

        if (confirm("Bu mesajları silmek istediğinizden emin misiniz?")) {
            var tab = $('.TabControlSelected a').html();
            var todeletemessageids = $('.silinecekmessageiddeger').val();

            $.ajax({
                type: "POST",
                url: "http://www.anneysen.com/WebMethods/InsertPostIntotheWall.aspx/DeleteMessages",
                data: "{ 'messegeids' : '" + todeletemessageids + "','tab' : '" + tab + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function(msg) {
                    //alert($('.cevaptext ' + postid).val());

                    if (msg.d == 'true') {


                        alert("Mesajlarınız başarı ile silinmiştir.");
                        window.location = window.location.href;
                    }
                    else {
                        alert("false");
                    }
                },
                error: function(xmlHttpRequest, textStatus, errorThrown) {
                    //alert(textStatus + ", " + errorThrown + ", " + xmlHttpRequest);
                }
            });


        }


    });

    $(".FavoriListeSecilenleriSil").click(function() {
        //    $(".chkfavoriisim").each(function() {
        //    
        //            if ($(".chkfavoriisim").is(':checked') == true) {

        //                if ($('.silinecekdeger').val() == '')
        //                    $('.silinecekdeger').val($('.silinecekdeger').val() + $(this).val());

        //                else
        //                    $('.silinecekdeger').val($('.silinecekdeger').val() + ';' + $(this).val());
        //            }

        //        });

        //alert($('.silinecekdeger').val());



        window.location = 'http://www.anneysen.com/Bebek-Isimleri.aspx?Silinecekler=' + $('.silinecekdeger').val();
    });
    //}
    $('.yemektarifcheckbox').click(function() {


        $(".yemektarifcheckbox").attr('checked', false);
        $(this).attr('checked', true);
    });
    $('.yemekturucheckbox').click(function() {


        $(".yemekturucheckbox").attr('checked', false);
        $(this).attr('checked', true);
    });
    $('.TarifleriGoster').click(function() {
        window.location = 'http://www.anneysen.com/Yemek-Tarifleri/Yemek-Tarifi-Ara.aspx?Kategori=' + $('.yemektarifcheckbox:checked').val() + '&YemekTuru=' + $('.yemekturucheckbox:checked').val() + '&Malzemeler=&Sure=&Fotografli=False';
    });
    $(".topOuterDiv .logonminiouter .LogonField").click(function() {

        $(this).val("");
    });
    $(".txtNewHomeUyelOl").click(function() {

        $(this).val("");
    });
    $("#AjaxRoot .WallDeletePost").live('click', function() {
        if (confirm("Bu yazınızı silmek istediğinizden emin misiniz?")) {

            var todeletepostid = $(this).attr('PostID');
            var todeletepostuserid = $(this).attr('PostUserID');

            var deletespan = $(this).parent().parent();

            //deletespan.hide();
            $.ajax({
                type: "POST",
                url: "http://www.anneysen.com/WebMethods/InsertPostIntotheWall.aspx/DeleteWallPost",
                data: "{ 'postid' : '" + todeletepostid + "' ,'postuserid' : '" + todeletepostuserid + "','forumid' : '" + 878 + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function(msg) {
                    //alert($('.cevaptext ' + postid).val());

                    if (msg.d == 'true') {


                        deletespan.hide();
                    }
                    else {
                        alert("false");
                    }
                },
                error: function(xmlHttpRequest, textStatus, errorThrown) {
                    //alert(textStatus + ", " + errorThrown + ", " + xmlHttpRequest);
                }
            });


        }
    });
    $(".WallDeletePost").click(function() {
        if (confirm("Bu yazınızı silmek istediğinizden emin misiniz?")) {

            var todeletepostid = $(this).attr('PostID');
            var todeletepostuserid = $(this).attr('PostUserID');

            var deletespan = $(this).parent().parent();


            //deletespan.hide();
            $.ajax({
                type: "POST",
                url: "http://www.anneysen.com/WebMethods/InsertPostIntotheWall.aspx/DeleteWallPost",
                data: "{ 'postid' : '" + todeletepostid + "' ,'postuserid' : '" + todeletepostuserid + "','forumid' : '" + 878 + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function(msg) {
                    //alert($('.cevaptext ' + postid).val());
                    //alert(msg.d);
                    if (msg.d == 'true') {


                        deletespan.hide();
                    }
                    else {
                        alert("false");
                    }
                },
                error: function(xmlHttpRequest, textStatus, errorThrown) {
                    //alert(textStatus + ", " + errorThrown + ", " + xmlHttpRequest);
                }
            });


        }
    });
    $('.ShareBtnSmall').click(function() {
        //$(this).hide();

        $(this).attr('src', $(this).attr('src').replace('Yayinla.gif', '20110513_lutfenbekleyin.gif'));
        var postid = $(this).attr('Title');
        var posttext = $("'.CommentComposer." + postid + "'").val().replace('\'', '"').replace('\'', '"').replace('\'', '"').replace('\'', '"').replace('\'', '"').replace('\'', '"');

        //        alert(postid + "///" + posttext);
        //        return;
        if ($.trim(posttext) == '') {
            alert('Lütfen yorumunuzu yazın..');
            return false;
        }
        $.ajax({
            type: "POST",
            url: "http://www.anneysen.com/WebMethods/InsertPostIntotheWall.aspx/InsertPostIntotheWall",
            data: "{ 'postid' : '" + postid + "' ,'posttext' : '" + posttext + "','forumid' : '" + 878 + "'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function(msg) {
                //alert($('.cevaptext ' + postid).val());

                if (msg.d != "") {
                    //                    alert($('.AjaxData.' + postid).html());
                    var ajaxhtml = "";
                    if ($('.AjaxData.' + postid).html() != null)
                        ajaxhtml = $('.AjaxData.' + postid).html();

                    //                    $('.ReCommentContainer.' + postid).attr('style', 'display:block;');
                    //                    $('.ReCommentContainer.' + postid + ' span:first').text(msg.d);
                    $('.AjaxData.' + postid).html(ajaxhtml + msg.d);
                    $("'.CommentComposer." + postid + "'").val('Yorum Yap..');
                    $("'.CommentComposer." + postid + "'").attr('rows', '1');
                    $("'.ShareBtnSmall." + postid + "'").hide();
                    $("'.ShareBtnSmall." + postid + "'").attr('src', $("'.ShareBtnSmall." + postid + "'").attr('src').replace('20110513_lutfenbekleyin.gif', 'Yayinla.gif'));
                }
                else {
                    alert("false");
                }
            },
            error: function(xmlHttpRequest, textStatus, errorThrown) {
                //alert(textStatus + ", " + errorThrown + ", " + xmlHttpRequest);
            }
        });
        $(this).show();
    });
    $('.ReplyDetailButton').click(function() {
        var postid = $(this).attr('ThreadID');
        var forumid = $(this).attr('ForumID');
        var posttext = $('.ReplyBox').val();


        $.ajax({
            type: "POST",
            url: "http://www.anneysen.com/WebMethods/InsertPostIntotheWall.aspx/InsertPostIntotheWall",
            data: "{ 'postid' : '" + postid + "' ,'posttext' : '" + posttext + "','forumid' : '" + forumid + "'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function(msg) {
                //alert($('.cevaptext ' + postid).val());
                //alert(postid);
                if (msg.d != "") {

                    var ajaxhtml = "";
                    if ($('.DiscussionsMainList').html() != null)
                        ajaxhtml = $('.DiscussionsMainList').html();

                    //                    $('.ReCommentContainer.' + postid).attr('style', 'display:block;');
                    //                    $('.ReCommentContainer.' + postid + ' span:first').text(msg.d);

                    $('.DiscussionsMainList').html(ajaxhtml + msg.d);
                }
                else {
                    alert("false");
                }
            },
            error: function(xmlHttpRequest, textStatus, errorThrown) {
                //alert(textStatus + ", " + errorThrown + ", " + xmlHttpRequest);
            }
        });

    });


    $('.UserNotification').each(function(index) {
        var wallsayac = 0;
        $(this).children('.ReCommentContainer').each(function(index) {
            wallsayac++;
            //alert(wallsayac);

        });
        if (wallsayac > 2) {
            var newsayac = wallsayac - 2;
            var sayactext = 'tüm yorumları göster (+' + newsayac + ')';

            $(this).children('.wallcommentsleftcount').text(sayactext);
            $(this).children('.ReCommentContainer').hide();
            $(this).children('.ReCommentContainer').eq(wallsayac - 1).show();
            $(this).children('.ReCommentContainer').eq(wallsayac - 2).show();

        }
    });
    $('.wallcommentsleftcount').click(function() {
        $(this).hide();
        $(this).parent().children('.ReCommentContainer').show();
    });
    $('.AnneysenWallOuterDiv').each(function(index) {
        var wallsayac = 0;
        $(this).children('.UserComments').each(function(index) {
            wallsayac++;
            //alert(wallsayac);
            if (wallsayac > 15) {
                $(this).hide();
                var sayactext = 'Daha eskiler';
                $(this).parent().children('.anneysenwallcommentsleftcount').text(sayactext);


            }
        });

    });

    $('.anneysenwallcommentsleftcount').click(function() {


        var wallsayac = 0;
        $('.AnneysenWallOuterDiv').children('.UserComments').each(function(index) {

            if ($(this).css('display') != 'none') {
                wallsayac++;
            }

        });
        if (wallsayac >= 30) {
            $(this).hide();
        }

        var dizi = new Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);

        $.each(dizi, function(index) {

            $('.AnneysenWallOuterDiv').children('.UserComments').eq(wallsayac + index + 1).show();
        });

        //$('.ZoneMain').attr('style', 'background-color: white; margin-top: 10px; height: 7000px;');


    });
    $('.ElbiImageClick').click(function() {
        if ($('.txtElbi').val() == "") {
            alert("LÜTFEN CEVABINIZI YAZIN");
            return;
        }
        else
            $('.ElbiImageClick').hide();
    });
    $('#RootPostButton').click(function() {
        //$(this).hide();
        $(this).attr('src', $(this).attr('src').replace('Yayinla.gif', '20110513_lutfenbekleyin.gif'));
        var postid = 0;

        var posttext = $('.UserComposerMain').val().replace('\'', '"').replace('\'', '"').replace('\'', '"').replace('\'', '"').replace('\'', '"').replace('\'', '"');

        if ($.trim(posttext) == '') {
            alert('Lütfen  ne düşündüğünüzü yazın..');
            return false;
        }

        $.ajax({
            type: "POST",
            url: "http://www.anneysen.com/WebMethods/InsertPostIntotheWall.aspx/InsertPostIntotheWall",
            data: "{ 'postid' : '" + postid + "' ,'posttext' : '" + posttext + "','forumid' : '" + 2 + "'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function(msg) {

                if (msg.d != "") {

                    var ajaxhtml = "";
                    if ($('.AjaxDataRoot').html() != null)
                        ajaxhtml = $('.AjaxDataRoot').html();


                    $('.AjaxDataRoot').html(msg.d + ajaxhtml);
                    $('.UserComposerMain').val('');
                    $('#RootPostButton').hide();
                    $('#RootPostButton').attr('src', $('#RootPostButton').attr('src').replace('20110513_lutfenbekleyin.gif', 'Yayinla.gif'));

                }
                else {
                    alert("false");
                }
            },
            error: function(xmlHttpRequest, textStatus, errorThrown) {

            }
        });

        $(this).show();
    });

});
function getMenuId(item) {
    var menuId;
    if (item.tagName == "A")
        menuId = $(item).parent().attr("id");
    else
        menuId = $(item).attr("id").substr(4);
    return menuId;
}
function menuOver() {
    var menuId;
    var divId;
    menuId = getMenuId(this);
    $link = $("#" + menuId);
    divId = "div_" + menuId;
    if ($link.length) {
        $link[0].active = $link.hasClass("CMSListMenuHighlightedLI");
        $link.addClass("CMSListMenuHighlightedLI");
        $link.addClass("CMSListMenuLI");
    }
    else {
        if ($(this).attr('id') != divId) $link = $(this);
        else return;
    }
    var $div = $("#" + divId);
    var pos = $link.offset();
    $div.show();
    if (divId != "div_menuElem_LI_0_6_2")
        $div.css({ position: "absolute", left: pos.left + "px", top: (pos.top + $link.height()) + "px" });
    else
        $div.css({ position: "absolute", left: pos.left-262 + "px", top: (pos.top + $link.height()) + "px" });
}
function menuOut() {
    var menuId = menuId = getMenuId(this);
    $link = $("#" + menuId);
    if ($link.length) {        
        if (!$link[0].active)
            $link.removeClass("CMSListMenuHighlightedLI");
        $link.addClass("CMSListMenuLI");
    }
    else {
        if ($(this).attr('id') != divId) $link = $(this);
        else return;
    }   
    var divId = "div_" + menuId;
    var $div = $("#" + divId);
    $div.hide();
    

}
function EditItem(customtableid, itemId) {
    window.location = 'http://www.anneysen.com/Home/EditMyProfile/Kids.aspx?customtableid=' + customtableid + '&itemid=' + itemId;



}
function ViewItem(customtableid, itemId) {
    window.location = 'http://www.anneysen.com/Home/EditMyProfile/Kids.aspx?customtableid=' + customtableid + '&itemid=' + itemId;



}
function DeleteConfirm() { return confirm(deleteConfirmation); }

//menuElem

/////////////


var SearchEngineVariable = 'q';

function KeyWordIncludeReferrer() {
    try {
        var ref = document.referrer.toUpperCase();
        if (ref.indexOf('GOOGLE.COM') > 0) { SearchEngineVariable = 'q'; return true; }
        if (ref.indexOf('YAHOO.COM') > 0) { SearchEngineVariable = 'p'; return true; }
        if (ref.indexOf('LOCALHOST') > 0) { SearchEngineVariable = 'q'; return true; }
    }
    catch (exception) { KeyWordProcessError('KeyWordIncludeReferrer', exception); }
    return false;
}


function KeyWordIncludeUrl() {
    var Href = document.location.href.toUpperCase();

    try {
       // if (Href.indexOf('anneysen') > -1) { return true; }
        //if (Href.indexOf('LOCALHOST') > -1) { return true; }
        return true;
    }
    catch (exception) { KeyWordProcessError('KeyWordIncludeUrl', exception); }
    return false;
}



function KeyWordGetColor(idx) {
    var color = '#CCCCCC';

    switch (idx) {
        case 0:
            color = '#99FF99'; break;
        case 1:
            color = 'yellow'; break;
        case 2:
            color = '#FFCCFF'; break;
        case 3:
            color = '#CC99FF'; break;
        case 4:
            color = '#99CCFF'; break;
        case 5:
            color = '#FFCC99'; break;
        case 6:
            color = '#CCCCFF'; break;
        case 7:
            color = '#66CCFF'; break;
        default:
            break;
    }
    return color;
}


function KeyWordExcludePhrase(keyword) {

    var ret = false;

    switch (keyword.toUpperCase()) {
        case 'AND': return true;
        case 'OR': return true;
        case 'SITE:EGGHEADCAFE.COM': return true;
        case 'SITE:WWW.EGGHEADCAFE.COM': return true;
        case '': return true;
    }

    return false;
}



function KeyWordGetKeyWordsFromQueryString() {

    if (KeyWordIncludeReferrer() == false) { return true; }

    var keywords = new Array();
    var ref = document.referrer;
    var pair;
    var qIndex = 0;
    var qs;
    var prm;

    try {


        qIndex = ref.indexOf('?');

        if (qIndex < 1) { return keywords; }

        ref = KeyWordReplace(ref, '%22', '');

        qs = ref.substring(qIndex + 1, ref.length);

        prm = qs.split('&');

        for (i = 0; i < prm.length; i++) {

            pair = prm[i].split('=');

            temp = unescape(pair[0]).split('+');
            name = temp.join(' ');

            if (name != SearchEngineVariable) { continue; }

            temp = unescape(pair[1]).split('+');

            for (k = 0; k < temp.length; k++) {
                if (KeyWordExcludePhrase(temp[k]) == true) { continue; }
                keywords.push(temp[k]);
            }

        }

    }
    catch (exception) { KeyWordProcessError('KeyWordGetKeyWordsFromQueryString', exception); }
    return keywords;
}

function linkify(inputText) {
    
    var replaceText, replacePattern1, replacePattern2, replacePattern3;

    

    replacePattern1 = /(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim;
    replacedText = inputText.replace(replacePattern1, '<a href="$1" target="_blank" style="color:black;">$1</a>');

    replacePattern2 = /(^|[^\/])(www\.[\S]+(\b|$))/gim;
    replacedText = replacedText.replace(replacePattern2, '$1<a href="http://$2" target="_blank" style="color:black;">$2</a>');

    replacePattern3 = /(\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,6})/gim;
    replacedText = replacedText.replace(replacePattern3, '<a href="mailto:$1" style="color:black;">$1</a>');

    return replacedText;
}


function KeyWordHiLite() {
    
    if (KeyWordIncludeUrl() == false) { return true; }
    var keywords;
    var keywordssubstring;
    var Links;
    var rng;
    var before = '&nbsp;<font style="color: #000000;text-decoration:none;background-color: ';
    var after = '</b>&nbsp;</font>&nbsp;';
    
    try {
        //if (keywords == "hamilelik anneysen") { alert(keywords.length); }
        //alert(KeyWordGetKeyWordsFromQueryString());
        keywords = KeyWordGetKeyWordsFromQueryString();
        //keywordssubstring = keywords.split(' ');
        if (keywords.length < 1) { return true; }
        //alert(keywordssubstring.length);
        //Links = KeyWordGetLinks();
        //alert(keywords.length);
        for (k = 0; k < keywords.length; k++) {
            
            rng = document.body.createTextRange();
             
            for (i = 0; rng.findText(keywords[k]) != false; i++) {
                
                try { rng.pasteHTML(before + KeyWordGetColor(k) + ';">&nbsp;<b>' + rng.text + after); }
                catch (e) { KeyWordProcessError('KeyWordHiLite Text Range', e); }
                finally { rng.collapse(false); }

            }

            rng.collapse(true);
        }

        //KeyWordCleanLinks(Links);

    }
    catch (exception) { KeyWordProcessError('KeyWordHiLite', exception); }

}



function KeyWordGetLinks() {

    var Links = new Array();

    for (i = 0; i < document.body.getElementsByTagName('A').length; i++) {
        Links[i] = new Array(document.body.getElementsByTagName('A')[i].href, document.body.getElementsByTagName('A')[i].innerHTML);
    }

    return Links;
}



function KeyWordCleanLinks(Links) {
    for (i = 0; i < document.body.getElementsByTagName('A').length; i++) {
        document.body.getElementsByTagName('A')[i].href = Links[i][0];
        document.body.getElementsByTagName('A')[i].innerHTML = Links[i][1];
    }
}


function KeyWordProcessError(functionName, e) {
    if (e.description == null) {
        //	  alert(functionName + ' ' + e.message); 
    }
    else {
        //  alert(functionName + ' ' + e.description);
    }
}

function KeyWordReplace(OrgVal, SearchVal, ReplaceVal) {
    var Val;
    var RegExp = eval("/" + SearchVal + "/g");
    if (OrgVal.indexOf(SearchVal) < 1) { return OrgVal; }
    Val = OrgVal.replace(RegExp, ReplaceVal);
    return Val;
}






 
