// ajax sabit url tanimlamalari
var ajaxUris = {
    authenticate                : "/uye/authenticate",
    rememberPassword            : "/uye/remember-password",
    product							        : "/product",
    wizardProduct					      : "/urun-sihirbazi",
    wizardProductSave           : "/urun-sihirbazi/kaydet",
    wizardProductResult         : "/urun-sihirbazi/sonuc",
    contactFormSubmit				    : "/iletisim/send-form",
    newsletterSubscribeSubmit		: "/iletisim/newsletter-subscribe",
    ProductCommentList          : "/urun/yorumlar",
    ProductCommentSubmit        : "/urun/yorum-ekle",
    register                    : "/uye/register",
    addCart                     : "/sepet/ekle",
    updateCart                  : "/sepet/guncelle",
    queryCouponCode             : "/kupon-kodu-sorgula",
    recipePaging                : "/yemek-tarifleri/sayfa",
    shared                      : "/araclar/save-url-sharing",
    switchContactPoint          : "/iletisim/switch-contact-point"
};




jQuery(document).ready(function($){

  // urun arama
  $("#squery-submit").click(function(){

    var action = $("#frm-squery").attr("action");
    location.href = action+'?squery='+$("#squery").val();

  });



  // giris
  $("#submit-login").click(function(){

    var t = $(this);

    t.addClass("disabled");
    Cufon.refresh();

    $.ajax({
      type: "POST",
      url: ajaxUris.authenticate,
      data: $("#frm-login").serialize(),
      dataType: "json",
      success: function(response){
        if ( response.success == true ){
          if ( response.redirect > '' )
          top.location.href = response.redirect;else
          top.location.reload();
        }
        else{
          $('#errors-login').html('');
          $.each(response.message, function(key, val){
            $('#errors-login').show();
            $('#errors-login').append("<li>"+val+"</li>");
          });
        }
      },
      error: function (request, status, error) {
        //alert(request);
      }
    });

    t.removeClass("disabled");
    Cufon.refresh();

    return false;

  });


});




//Verilen string icerisindeki hash karakterlerini temizler.
function clearHash( str ){

  return str.replace(/^.*#/, '');

}




/*
function Deneme(t1, t2){

  this.test1 = t1;
  this.test2 = t2;

  this.getTest1 = function(){
    return this.test1;
  };


  this.getTest2 = function(){
    return this.test2;
  };
}


deneme = new Deneme("152435243", "5ds5d45s4d");
alert(deneme.getTest1());
alert(deneme.getTest2());
*/

