Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

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