﻿
        var loginOpen = false;
        $(document).ready(function(){
            $(".LoginClickable span").click(function()
            {
                $(".LoginContainer").slideToggle();
            });
            $(".SearchBox input.text").focus(function()
            {
                if($(".SearchBox input.text").val()=="Site içinde ara..")
                {$(".SearchBox input.text").val("");}
                $(".SearchBox input.text").removeClass("grey");                
            });
            $(".SearchBox input.text").blur(function()
            {   if($(".SearchBox input.text").val() == "")
                {$(".SearchBox input.text").val("Site içinde ara..");}
                $(".SearchBox input.text").addClass("grey");             
            });
            $(".SearchBox input.text").keyup(function(e) {
	            if(e.keyCode == 13) {
		            siteSearch();
	            }
            });
        });
        function siteSearch()
        {
            if($(".SearchBox input.text").val() != "" && $(".SearchBox input.text").val() != "Site içinde ara..")
            {
                window.location="Search.aspx?tag="+$(".SearchBox input.text").val();
            }
        }
    function vote(shoeId, userID, objectid)
    {
        var thisObj = $(objectid).prev().children()[0];
        $.ajax({
            type: "POST",
            url: "VoteService.svc/Vote",
            data: '{"ShoeId":"'+shoeId+'","UserId":"'+userID+'"}',
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function(data) {
                if(data.d == "err")
                {popMessage("Hata oluştu, daha sonra tekrar deneyin.");}
                else if(data.d == "exists")
                {popMessage("Daha önce oy vermişsiniz. Her gönderiye bir kez oy verilebilir");}
                else if(data.d == "errSelf")
                {popMessage("Kendinize oy veremezsiniz");}
                else
                {
                    $(thisObj).text(data.d + ' oy');
                    $(thisObj).animate({ color: 'ayakta' }, 100).animate({ color: 'black' }, 2000);
                }
            },
            error:function(){popMessage("Hata oluştu, daha sonra tekrar deneyin.");}
        });
    }

    function popMessage(m)
    {
        $().message(m);
    }
    
/*Login Container*/
function loginContainerReady()
{   
     if ($.browser.mozilla) {
        $("#ctl00_UserLogin_txt_userName").keypress(catchEnter);
        $("#ctl00_UserLogin_txt_password").keypress(catchEnter);
    } 
    else {
        $("#ctl00_UserLogin_txt_userName").keydown(catchEnter);
        $("#ctl00_UserLogin_txt_password").keydown(catchEnter);
    }
    var prm = Sys.WebForms.PageRequestManager.getInstance();
    prm.add_initializeRequest(initializeRequest);

    function initializeRequest(sender, args)
    {
        $("#loading").show();
    }
}
function catchEnter(event) {
if (event.keyCode == 13) {
    $("#ctl00_UserLogin_btn_login").click();
    }
}
function submitbtn()
{
    $("#loading").show();
    var pageId = '<%=  this.UniqueID  %>';
    __doPostBack(pageId,'Savebtn_Clicked');
}
/*Login Container*/

