Subversion Repositories SmartDukaan

Rev

Blame | Last modification | View Log | RSS feed

// Ebizon Move script js into the file

$(document).ready(function(){
        $('#addAdrBtn').click(function(){
                $('#newShipAdr').show();
                scrollWin();
        });
        var lastQueryType = -1;

  function scrollWin(){
    $('html, body').animate({
      scrollTop: $("#newShipAdr").offset().top
    }, 2000);
  }

  $('.category-tabs').click(function() {
    var items = this.id;
    var title = this.title;
    var url = this.name;
    var itemsarray = items.split('-');
    var catId = itemsarray[1];
    var params = "categoryid="+catId;
    if(itemsarray.length > 2){
        params = params+"&brand="+itemsarray[2];
    }
    removeLastActiveState();
    $('a.activeTab').each(function(index) {
      $('a.activeTab').removeClass('activeTab');
    });
    $(this).addClass('category-tabs activeTab');
    hideShowTabContent("otherTabContent", "show");
    setContentHeading(title);
    hideShowTabContent("multifacetedSearch", "hide");
    hideShowTabContent("browseContent", "hide");
    // Ajax call to fecth data in page class
    jQuery.ajax({
      url: "/"+url,
      type: "GET",
      data: params,
      contentType: "text/html",
      cache: false,
      success: function(html){
        if(html!=1){
          $('#productListCenter2').html(html);
          $('#productListCenter2 ul.product-description li').truncate({addtitle: true});
        }else{
        }
      }
    });
    return false;
  });
  $('.showBrowse').click(function() {
    removeLastActiveState();
    activeTab("catTab1");
    hideShowTabContent("multifacetedSearch", "show");
    hideShowTabContent("browseContent", "show");
    hideShowTabContent("otherTabContent", "hide");
  });

  if(document.getElementById("txtDateOfBirth")){
    $("#txtDateOfBirth").datepicker({
        changeMonth: true,
        changeYear: true,
        yearRange: '1940:2000'
    });
  }


  if (document.getElementById("frmShippingAddress")) {
    $("#frmShippingAddress").validate( {
      rules : {
        name : "required",
        line1 : {
            required : true,
            minlength : 1,
            maxlength : 60
          },
        state : {
          required : true,
          minlength : 1
        },
        city : "required",
        pincode : {
          required : true,
          digits : true,
          minlength : 6,
          maxlength : 6
        },
        phone : {
          required : true,
          digits : true,
          minlength : 10,
          maxlength : 10
        }
      },
      messages: {
        line1: {
          maxlength : $.format("Please enter no more than {0} characters. Enter the remaining address in next line.")
        }
      }
    });
  }

  if(document.getElementById("#frmLogin")) {
    $("#frmLogin").validate({
      rules: {
        email: {
          required: true,
          email: true
        },
        password: {
          required: true,
          minlength: 6,
          maxlength: 20
        }
      }
    });
  }
  if(document.getElementById("#datepicker")) {
    $("#datepicker").datepicker({ });
  }
  // Research "delete" Item
  $('.add-research-pane5').live('click', function() {
    addResearch('pane5', 'multi');
  });
  $('.add-to-cart-pane5').live('click', function() {
    addToCart('pane5', 'multi');
  });
  $('.add-to-cart-pane1').live('click', function() {
    addToCart('pane1', 'multi');
  });
  $('#signinClass').click(function() {
    changeSignInClass();
  });
  $('.add-to-research-icon').live('click', function() {
    var items = this.id;
    var itemsarray = items.split('-');
        
    addResearch(itemsarray[1], itemsarray[0]);
    return false;
  });
});