Subversion Repositories SmartDukaan

Rev

Rev 3830 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
794 rajveer 1
// Ebizon Move script js into the file
2
 
1809 varun.gupt 3
$(document).ready(function(){
1109 varun.gupt 4
	$('#addAdrBtn').click(function(){
5
		$('#newShipAdr').show();
6
		scrollWin();
7
	});
1380 varun.gupt 8
	var lastQueryType = -1;
1109 varun.gupt 9
 
1047 vikas 10
  function scrollWin(){
11
    $('html, body').animate({
12
      scrollTop: $("#newShipAdr").offset().top
13
    }, 2000);
14
  }
15
 
878 rajveer 16
  $('.category-tabs').click(function() {
17
    var items = this.id;
18
    var title = this.title;
19
    var url = this.name;
20
    var itemsarray = items.split('-');
21
    var catId = itemsarray[1];
1923 rajveer 22
    var params = "categoryid="+catId;
23
    //alert(itemsarray.length);
24
    if(itemsarray.length > 2){
25
    	params = params+"&brand="+itemsarray[2];
26
    }
878 rajveer 27
    removeLastActiveState();
28
    $('a.activeTab').each(function(index) {
29
      $('a.activeTab').removeClass('activeTab');
30
    });
31
    $(this).addClass('category-tabs activeTab');
32
    hideShowTabContent("otherTabContent", "show");
33
    setContentHeading(title);
34
    hideShowTabContent("multifacetedSearch", "hide");
35
    hideShowTabContent("browseContent", "hide");
36
    // Ajax call to fecth data in page class
1014 rajveer 37
    //alert("Ajax call to get best sellers");
1923 rajveer 38
    //alert(params);
878 rajveer 39
    jQuery.ajax({
1923 rajveer 40
      url: "/"+url,
878 rajveer 41
      type: "GET",
1923 rajveer 42
      data: params,
878 rajveer 43
      contentType: "text/html",
44
      cache: false,
45
      success: function(html){
46
        if(html!=1){
1014 rajveer 47
          //alert(html);
878 rajveer 48
          $('#productListCenter2').html(html);
1290 vikas 49
          $('#productListCenter2 ul.product-description li').truncate({addtitle: true});
878 rajveer 50
        }else{
1014 rajveer 51
          //alert("Sorry! Unexpected Error. Try again!");
878 rajveer 52
        }
53
      }
54
    });
55
    return false;
56
  });
57
  $('.showBrowse').click(function() {
58
    removeLastActiveState();
59
    activeTab("catTab1");
60
    hideShowTabContent("multifacetedSearch", "show");
61
    hideShowTabContent("browseContent", "show");
62
    hideShowTabContent("otherTabContent", "hide");
63
  });
1831 varun.gupt 64
 
878 rajveer 65
  if(document.getElementById("txtDateOfBirth")){
794 rajveer 66
    $("#txtDateOfBirth").datepicker({
2694 rajveer 67
    	changeMonth: true,
68
    	changeYear: true,
69
    	yearRange: '1940:2000'
794 rajveer 70
    });
71
  }
878 rajveer 72
 
73
 
74
  if (document.getElementById("frmShippingAddress")) {
75
    $("#frmShippingAddress").validate( {
76
      rules : {
77
        name : "required",
3550 vikas 78
        line1 : {
79
            required : true,
80
            minlength : 1,
81
            maxlength : 60
82
          },
878 rajveer 83
        state : {
84
          required : true,
85
          minlength : 1
86
        },
87
        city : "required",
88
        pincode : {
89
          required : true,
90
          digits : true,
91
          minlength : 6,
92
          maxlength : 6
93
        },
94
        phone : {
95
          required : true,
96
          digits : true,
97
          minlength : 10,
98
          maxlength : 10
99
        }
3550 vikas 100
      },
101
      messages: {
102
        line1: {
103
          maxlength : $.format("Please enter no more than {0} characters. Enter the remaining address in next line.")
104
        }
878 rajveer 105
      }
106
    });
107
  }
108
 
794 rajveer 109
  if(document.getElementById("#frmLogin")) {
878 rajveer 110
    $("#frmLogin").validate({
111
      rules: {
112
        email: {
113
          required: true,
114
          email: true
115
        },
116
        password: {
117
          required: true,
118
          minlength: 6,
119
          maxlength: 20
120
        }
121
      }
122
    });
123
  }
124
  if(document.getElementById("#datepicker")) {
794 rajveer 125
    $("#datepicker").datepicker({ });
126
  }
127
  // Research "delete" Item
1372 vikas 128
  $('.add-research-pane5').live('click', function() {
794 rajveer 129
    addResearch('pane5', 'multi');
878 rajveer 130
  });
1372 vikas 131
  $('.add-to-cart-pane5').live('click', function() {
1254 vikas 132
    addToCart('pane5', 'multi');
794 rajveer 133
  });
1372 vikas 134
  $('.add-to-cart-pane1').live('click', function() {
1254 vikas 135
    addToCart('pane1', 'multi');
794 rajveer 136
  });
137
  $('#signinClass').click(function() {
138
    changeSignInClass();
878 rajveer 139
  });
1199 vikas 140
  $('.add-to-research-icon').live('click', function() {
794 rajveer 141
    var items = this.id;
142
    var itemsarray = items.split('-');
1809 varun.gupt 143
 
794 rajveer 144
    addResearch(itemsarray[1], itemsarray[0]);
145
    return false;
878 rajveer 146
  });
4126 varun.gupt 147
});