<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">
var $afterloginid = '';
var $afterpincode = '';

function session_update($afterloginid, $afterpincode) {
	if ($afterloginid != '') {
		// alert('123');
		app_session.LOGIN_ID = $afterloginid;
		//alert(LOGIN_ID);
	}
	if ($afterpincode != '') {

		app_session.LOGIN_PINCODE = $afterpincode;
	}
}


$(document).on('click change', '.changelanguage', function () {
	//delete cookie
	$.ajax({
		type: 'POST',
		url: baseurl + 'home/cookies_set/' + $(this).attr('title'),
		success: function (data) {

			window.location.reload();
		}
	});
});


$(document).on("click", '.delete_cart', function () {
	if (confirm("Are You Sure You Want To Remove?")) {
		var $row_delete = $(this).closest('tr');
		var row_id = $(this).attr('data-id');

		$.ajax({
			type: "POST",
			url: baseurl + 'home/remove_cart',
			data: {
				row_id: row_id
			},
			dataType: "json",
			success: function (result) {

				$('.cart_body').load(baseurl + 'home/load_cart');
				$('#cart').addClass('open');

				add_to_cart_length = result.size_of_cart;
				if ($segment2 == 'show_cart' &amp;&amp; result.size_of_cart == 0) {

					window.location.reload();
				}
			}
		});
	}

});


var pincode_qty;
var pincode_data_name;
var pincode_url;
var pincode_data_id;
var pincode_data_price;
var pincode_data_type;
var pincode_data_redirect;
var login_pincode;
var pincode_quick_url_redirect;

// alert(pincode_quick_url_redirect);


$(document).on('click', '.add_delete_cart', function () {
	if (confirm("Are You Sure You Want To Remove?")) {
		var $row_delete = $(this).closest('tr');
		var row_id = $(this).attr('data-id');

		$.ajax({
			type: "POST",
			url: baseurl + 'home/remove_cart',
			data: {
				row_id: row_id
			},
			dataType: "json",
			success: function (result) {
				console.log(result);
				$('.cart_body').load(baseurl + 'home/load_cart');
				// $('#cart').addClass('open');

				var alert = `&lt;div class="alert alert-dismissable" style="background-color:green;color:white;padding:1%; " align="center"&gt;
				&lt;button type="button" class="close" data- dismiss="alert" aria-hidden="true"&gt;Ã—&lt;/button&gt;Product Cart Remove Successfully&lt;/div&gt;`;
				$('.alert-container').html(alert); /* alert container class ".alert-container" */
				setTimeout(function () { /* show the alert for 3sec and then reload the page. */
					location.reload();
				}, 1000);


				//window.location.reload();
			}
		});
	}
});


$(document).on("click", '.td-button', function () {
	alert();
});


function add_insert_cart(id, name, price, qty) {
	$.ajax({
		type: "POST",
		url: baseurl + 'home/insert_cart',
		data: {
			id: id,
			name: name,
			price: price,
			qty: qty
		},
		dataType: "json",
		success: function (result) {
			$('.cart_body').load(baseurl + 'home/load_cart');
			// $('#cart').addClass('open');

			addProductNotice('Product added to Cart', '', '&lt;h3&gt;&lt;a href="#"&gt;' + $('#button-cart').attr("data-name") + '&lt;/a&gt; added to &lt;a href="#"&gt;shopping cart&lt;/a&gt;!&lt;/h3&gt;', 'success');
			setTimeout(function () {
				window.location.reload();
			}, 1000);
		}
	});
}

var product_wish_list_data_name;
var product_wish_list_data_id;
$(document).on('click', '.product_wish', function () {
	// alert('123');
	var $this = $(this);
	var loginid = app_session.LOGIN_ID;
	// alert(loginid);
	var login_uri = "";
	if ($this.attr('data-quick-url-redirect')) {
		login_uri = $this.attr('data-quick-url-redirect');
	} else {
		login_uri = $(location).attr("href");
	}
	product_wish_list_data_name = $(this).attr("data-name");

	
	product_wish_list_data_id = $(this).attr("data-id");

	var $row = '.WISH_QTY_' + product_wish_list_data_id; 
	product_wish_list_data_qty = $($row).val();

	// alert(product_wish_list_data_qty);


	// product_wish_list_data_qty = $('#hidden-product-quantity').text();

	// // alert(product_wish_list_data_qty);

	// var value = ;

	// alert(product_wish_list_data_id);
	var data_name = $(this).attr("data-name");
	if (loginid) {

		
		if (loginid != '') {

			// alert('123');
			$.ajax({
				type: "POST",
				url: baseurl + 'home/add_wish_list',
				data: {
					id: product_wish_list_data_id,
					qty: product_wish_list_data_qty
				},
				dataType: "json",
				success: function (result) {

					if (result.status != 400) {

						var url_redirect = baseurl + 'home/wish_list';

						// if ($this.attr('data-quick-url-redirect')) {

						// 	var tag = '&lt;a onclick="parent.window.location.href=' + "'" + url_redirect + "'" + '"  href="#"&gt;';
						// 	addProductNotice(tag + 'Product added to Wish List&lt;/a&gt;', '', tag + '&lt;h3&gt;' + product_wish_list_data_name + '&lt;/h3&gt;&lt;/a&gt;', 'success');

						// } else {
						// 	addProductNotice('&lt;a href="' + url_redirect + '"&gt;Product added to Wish List&lt;/a&gt;', '', '&lt;a href="' + url_redirect + '"&gt;&lt;h3&gt;' + product_wish_list_data_name + '&lt;/h3&gt;&lt;/a&gt;', 'success');
						// }
  


						// alert('Product Added To Wishlist');
						addProductNotice('&lt;a href="' + url_redirect + '"&gt;Product added to Wish List&lt;/a&gt;', '', '&lt;a href="' + url_redirect + '"&gt;&lt;h3&gt;' + product_wish_list_data_name + '&lt;/h3&gt;&lt;/a&gt;', 'success');
						// addProductNotice('Product added to Wish List', '', '', 'success');
						// alert(result.message);


						// var alert = "&lt;div class='alert alert-dismissable' style='font-weight: bold;font - size: 17px; background-color:green;color:white;padding:1%;' align='left'&gt;&lt;button type='button' class='close' data-dismiss='alert' aria-hidden='true'&gt;Ã—&lt;/button&gt;Product Added To Wishlist&lt;br&gt;&lt;p style='color:white;padding:1%; font-size: 14px; font-weight:400;'  align='left'&gt;" + data_name + "&lt;/p&gt;&lt;/div&gt;";
						// $('.alert-container').html(alert); /* alert container class ".alert-container" */
						// setTimeout(function () { /* show the alert for 3sec and then reload the page. */
						// 	location.reload();
						// }, 5000);

						

					} else {
						// alert(result.message);

						var url_redirect = baseurl + 'home/wish_list';

						// addProductNotice('Product Already Added To Wishlist', '', '', 'warning');

						addProductNotice('&lt;a href="' + url_redirect + '"&gt;Product Already Added To Wishlist&lt;/a&gt;', '', '&lt;a href="' + url_redirect + '"&gt;&lt;h3&gt;' + product_wish_list_data_name + '&lt;/h3&gt;&lt;/a&gt;', 'error');

						// alert('Product Already Added To Wishlist');

						// var alert = "&lt;div class='alert alert-dismissable' style='font-weight: bold;font - size: 17px; background-color:red;color:white;padding:1%;' align='left'&gt;&lt;button type='button' class='close' data-dismiss='alert' aria-hidden='true'&gt;Ã—&lt;/button&gt;Product Already Added To Wishlist&lt;br&gt;&lt;p style='color:white;padding:1%; font-size: 14px; font-weight:400;'  align='left'&gt;" + data_name + "&lt;/p&gt;&lt;/div&gt;";
						// $('.alert-container').html(alert); /* alert container class ".alert-container" */
						// setTimeout(function () { /* show the alert for 3sec and then reload the page. */
						// 	location.reload();
						// }, 2000);
					}
				}
			});
		} else {



			// alert(app_language.please_login);
			// if ($this.attr('data-quick-url-redirect')) {
			// 	if (window.parent == window.top) {
			// 		parent.window.location.href = baseurl + 'login?login_url=' + login_uri;
			// 	}
			// } else {
			// 	$('#exampleModal').attr('data-login-first', '3');
			// 	$('.all_page_login').first().click();
			// }
		}
	} else {


		// alert(app_language.please_login);
		if ($this.attr('data-quick-url-redirect')) {
			if (window.parent == window.top) {
				parent.window.location.href = baseurl + 'login?login_url=' + login_uri;
			}
		} else {
			
			// $('#login_modal').attr('data-login-first', '3');
			$('#login_modal').first().click();
			
		}

	}
});

$(document).on('click', '.product_wish_delete', function (e) {
	// if (confirm("Are You Sure You Want To Remove?")) {
	var loginid = app_session.LOGIN_ID;

	if (loginid != '') {
		$.ajax({
			type: "POST",
			url: baseurl + 'home/delete_wish_list',
			data: {
				id: $(this).attr('data-id')
			},
			dataType: "json",
			success: function (result) {

				// alert(result.message);
				// var alert = `&lt;div class="alert alert-dismissable" style="background-color:green;color:white;padding:1%; " align="center"&gt;
				// &lt;button type="button" class="close" data- dismiss="alert" aria-hidden="true"&gt;Ã—&lt;/button&gt;Your Wishlist Product Remove Successfully.&lt;/div&gt;`;
				// $('.alert-container').html(alert); /* alert container class ".alert-container" */

				addProductNotice('Wishlist Product', '', 'Your Wishlist Product Remove Successfully', 'success');

				// alert(result.message);
				setTimeout(function () { /* show the alert for 3sec and then reload the page. */
				window.location.reload();
				}, 4000);
				


			}
		});
	} else {
		alert("Please Login");
	}
	// }
});





var product_wish_list_data_name;
var product_wish_list_data_id;
$(document).on('click', '.product_inquiry', function () {
	// alert('123');
	var $this = $(this);
	var loginid = app_session.LOGIN_ID;
	// alert(loginid);
	var login_uri = "";
	if ($this.attr('data-quick-url-redirect')) {
		login_uri = $this.attr('data-quick-url-redirect');
	} else {
		login_uri = $(location).attr("href");
	}
	product_wish_list_data_name = $(this).attr("data-name");

	
	product_wish_list_data_id = $(this).attr("data-id");

	// product_wish_list_data_qty = $('#hidden-product-quantity').text();

	// // alert(product_wish_list_data_qty);

	// var value = ;

	// alert(product_wish_list_data_id);
	var data_name = $(this).attr("data-name");
	if (loginid) {

		
		if (loginid != '') {

			// alert('123');
			$.ajax({
				type: "POST",
				url: baseurl + 'home/add_get_offer',
				data: {
					id: product_wish_list_data_id
				},
				dataType: "json",
				success: function (result) {

					if (result.status != 400) {

						var url_redirect = baseurl + 'home/customer_wish_list';

						// if ($this.attr('data-quick-url-redirect')) {

						// 	var tag = '&lt;a onclick="parent.window.location.href=' + "'" + url_redirect + "'" + '"  href="#"&gt;';
						// 	addProductNotice(tag + 'Product added to Wish List&lt;/a&gt;', '', tag + '&lt;h3&gt;' + product_wish_list_data_name + '&lt;/h3&gt;&lt;/a&gt;', 'success');

						// } else {
						// 	addProductNotice('&lt;a href="' + url_redirect + '"&gt;Product added to Wish List&lt;/a&gt;', '', '&lt;a href="' + url_redirect + '"&gt;&lt;h3&gt;' + product_wish_list_data_name + '&lt;/h3&gt;&lt;/a&gt;', 'success');
						// }
  


						// alert('Product Added To Wishlist');

						alert(result.message);

						
						// addProductNotice('Product Inquiry', '', 'Your Request has been Submitted Successfully', 'success');
                        // addProductNotice('Your Request has been Submitted Successfully.', '', '', 'success');

						// var alert = "&lt;div class='alert alert-dismissable' style='font-weight: bold;font - size: 17px; background-color:green;color:white;padding:1%;' align='left'&gt;&lt;button type='button' class='close' data-dismiss='alert' aria-hidden='true'&gt;Ã—&lt;/button&gt;Product Added To Wishlist&lt;br&gt;&lt;p style='color:white;padding:1%; font-size: 14px; font-weight:400;'  align='left'&gt;" + data_name + "&lt;/p&gt;&lt;/div&gt;";
						// $('.alert-container').html(alert); /* alert container class ".alert-container" */
						// setTimeout(function () { /* show the alert for 3sec and then reload the page. */
						// 	location.reload();
						// }, 2000);

						// setTimeout(function () { /* show the alert for 3sec and then reload the page. */
						// 	window.location.reload();
						// 	}, 4000);

						

					} else {
						// alert(result.message);

						// addProductNotice('&lt;a href="' + url_redirect + '"&gt;Your Request has been Submitted Successfully.&lt;/a&gt;', '', '&lt;a href="' + url_redirect + '"&gt;&lt;h3&gt;' + product_wish_list_data_name + '&lt;/h3&gt;&lt;/a&gt;', 'success');

						alert(result.message);
						// addProductNotice('Product Inquiry', '', 'Your Request has been submitted Successfully', 'success');

						// alert('Product Already Added To Wishlist');

						// var alert = "&lt;div class='alert alert-dismissable' style='font-weight: bold;font - size: 17px; background-color:red;color:white;padding:1%;' align='left'&gt;&lt;button type='button' class='close' data-dismiss='alert' aria-hidden='true'&gt;Ã—&lt;/button&gt;Product Already Added To Wishlist&lt;br&gt;&lt;p style='color:white;padding:1%; font-size: 14px; font-weight:400;'  align='left'&gt;" + data_name + "&lt;/p&gt;&lt;/div&gt;";
						// $('.alert-container').html(alert); /* alert container class ".alert-container" */
						// setTimeout(function () { /* show the alert for 3sec and then reload the page. */
						// 	location.reload();
						// }, 2000);

				// 		setTimeout(function () { /* show the alert for 3sec and then reload the page. */
				// window.location.reload();
				// }, 4000);
					}
				}
			});
		} else {



			// alert(app_language.please_login);
			// if ($this.attr('data-quick-url-redirect')) {
			// 	if (window.parent == window.top) {
			// 		parent.window.location.href = baseurl + 'login?login_url=' + login_uri;
			// 	}
			// } else {
			// 	$('#exampleModal').attr('data-login-first', '3');
			// 	$('.all_page_login').first().click();
			// }
		}
	} else {


		// alert(app_language.please_login);
		if ($this.attr('data-quick-url-redirect')) {
			if (window.parent == window.top) {
				parent.window.location.href = baseurl + 'login?login_url=' + login_uri;
			}
		} else {
			
			// $('#login_modal').attr('data-login-first', '3');
			$('#login_modal').first().click();
			
		}

	}
});



var product_cart_data_name;
var product_cart_data_id;
$(document).on('click', '.addtocart', function () {
	// alert('123');
	var $this = $(this);
	var loginid = app_session.LOGIN_ID;
	// alert(loginid);
	var login_uri = "";
	if ($this.attr('data-quick-url-redirect')) {
		login_uri = $this.attr('data-quick-url-redirect');
	} else {
		login_uri = $(location).attr("href");
	}
	product_cart_data_name = $(this).attr("data-name");

	
	product_cart_data_id = $(this).attr("data-id");

	var $row = '.WISH_QTY_' + product_cart_data_id; 
	product_addtocart_data_qty = $($row).val();

	// var $row = $(this).closest('');
	// product_wish_list_data_qty = $(this).find(".input-quality").val();

	// alert(product_wish_list_data_qty);


	// product_wish_list_data_qty = $('#hidden-product-quantity').text();

	// // alert(product_wish_list_data_qty);

	// var value = ;

	// alert(product_wish_list_data_id);
	var data_name = $(this).attr("data-name");
	if (loginid) {

		
		if (loginid != '') {

			// alert('123');
			$.ajax({
				type: "POST",
				url: baseurl + 'home/add_to_cart',
				data: {
					id: product_cart_data_id,
					qty: product_addtocart_data_qty
				},
				dataType: "json",
				success: function (result) {

					if (result.status != 400) {

						var url_redirect = baseurl + 'home/show_cart';

						// if ($this.attr('data-quick-url-redirect')) {

						// 	var tag = '&lt;a onclick="parent.window.location.href=' + "'" + url_redirect + "'" + '"  href="#"&gt;';
						// 	addProductNotice(tag + 'Product added to Wish List&lt;/a&gt;', '', tag + '&lt;h3&gt;' + product_wish_list_data_name + '&lt;/h3&gt;&lt;/a&gt;', 'success');

						// } else {
						// 	addProductNotice('&lt;a href="' + url_redirect + '"&gt;Product added to Wish List&lt;/a&gt;', '', '&lt;a href="' + url_redirect + '"&gt;&lt;h3&gt;' + product_wish_list_data_name + '&lt;/h3&gt;&lt;/a&gt;', 'success');
						// }
  


						// alert('Product Added To Wishlist');

						// alert(result.message);

						if(result.message == 'Product Already Added To Cart')
						 {
							addProductNotice('&lt;a href="' + url_redirect + '"&gt;Product already added to Cart&lt;/a&gt;', '', '&lt;a href="' + url_redirect + '"&gt;&lt;h3&gt;' + product_cart_data_name + '&lt;/h3&gt;&lt;/a&gt;', 'success');

						 
						}else{

							addProductNotice('&lt;a href="' + url_redirect + '"&gt;Product added to Cart&lt;/a&gt;', '', '&lt;a href="' + url_redirect + '"&gt;&lt;h3&gt;' + product_cart_data_name + '&lt;/h3&gt;&lt;/a&gt;', 'success');

						 }

						// addProductNotice('&lt;a href="' + url_redirect + '"&gt;Product added to Cart&lt;/a&gt;', '', '&lt;a href="' + url_redirect + '"&gt;&lt;h3&gt;' + product_cart_data_name + '&lt;/h3&gt;&lt;/a&gt;', 'success');

						// addProductNotice('Product Added To Cart.', '', '', 'success');

						


						// var alert = "&lt;div class='alert alert-dismissable' style='font-weight: bold;font - size: 17px; background-color:green;color:white;padding:1%;' align='left'&gt;&lt;button type='button' class='close' data-dismiss='alert' aria-hidden='true'&gt;Ã—&lt;/button&gt;Product Added To Wishlist&lt;br&gt;&lt;p style='color:white;padding:1%; font-size: 14px; font-weight:400;'  align='left'&gt;" + data_name + "&lt;/p&gt;&lt;/div&gt;";
						// // $('.alert-container').html(alert); /* alert container class ".alert-container" */
						// setTimeout(function () { /* show the alert for 3sec and then reload the page. */
						// 	location.reload();
						// }, 2000);

						setTimeout(function () { /* show the alert for 3sec and then reload the page. */
							window.location.reload();
							}, 4000);

						

					} else {
						// alert(result.message);

						// alert(result.message);

						// addProductNotice('&lt;a href="' + url_redirect + '"&gt;Product already added to Cart&lt;/a&gt;', '', '&lt;a href="' + url_redirect + '"&gt;&lt;h3&gt;' + product_cart_data_name + '&lt;/h3&gt;&lt;/a&gt;', 'success');

						// addProductNotice('Product Already Added To Cart', '', '', 'success');

						// alert('Product Already Added To Wishlist');

						// var alert = "&lt;div class='alert alert-dismissable' style='font-weight: bold;font - size: 17px; background-color:red;color:white;padding:1%;' align='left'&gt;&lt;button type='button' class='close' data-dismiss='alert' aria-hidden='true'&gt;Ã—&lt;/button&gt;Product Already Added To Wishlist&lt;br&gt;&lt;p style='color:white;padding:1%; font-size: 14px; font-weight:400;'  align='left'&gt;" + data_name + "&lt;/p&gt;&lt;/div&gt;";
						// $('.alert-container').html(alert); /* alert container class ".alert-container" */
						// setTimeout(function () { /* show the alert for 3sec and then reload the page. */
						// 	location.reload();
						// }, 2000);
					}
				}
			});
		} else {



			// alert(app_language.please_login);
			// if ($this.attr('data-quick-url-redirect')) {
			// 	if (window.parent == window.top) {
			// 		parent.window.location.href = baseurl + 'login?login_url=' + login_uri;
			// 	}
			// } else {
			// 	$('#exampleModal').attr('data-login-first', '3');
			// 	$('.all_page_login').first().click();
			// }
		}
	} else {


		// alert(app_language.please_login);
		if ($this.attr('data-quick-url-redirect')) {
			if (window.parent == window.top) {
				parent.window.location.href = baseurl + 'login?login_url=' + login_uri;
			}
		} else {
			
			// $('#login_modal').attr('data-login-first', '3');
			$('#login_modal').first().click();
			
		}

	}
});



$(document).on('click', '.product_cart_delete', function (e) {
	// if (confirm("Are You Sure You Want To Remove?")) {
	var loginid = app_session.LOGIN_ID;

	if (loginid != '') {
		$.ajax({
			type: "POST",
			url: baseurl + 'home/delete_addtocart',
			data: {
				id: $(this).attr('data-id')
			},
			dataType: "json",
			success: function (result) {

				// alert(result.message);
				// var alert = `&lt;div class="alert alert-dismissable" style="background-color:green;color:white;padding:1%; " align="center"&gt;
				// &lt;button type="button" class="close" data- dismiss="alert" aria-hidden="true"&gt;Ã—&lt;/button&gt;Your Wishlist Product Remove Successfully.&lt;/div&gt;`;
				// $('.alert-container').html(alert); /* alert container class ".alert-container" */

				// // alert(result.message);
				// setTimeout(function () { /* show the alert for 3sec and then reload the page. */

				// }, 100000);
				// window.location.reload();

				addProductNotice('Your Cart', '', 'Your Cart Product Remove Successfully.', 'success');

				// alert(result.message);
				setTimeout(function () { /* show the alert for 3sec and then reload the page. */
				window.location.reload();
				}, 4000);
				


			}
		});
	} else {
		alert("Please Login");
	}
	// }
});





var product_wish_list_data_name;
var product_wish_list_data_id;
$(document).on('click', '.order_place', function () {
	// alert('123');
	var $this = $(this);
	var loginid = app_session.LOGIN_ID;
	// alert(loginid);
	var login_uri = "";
	if ($this.attr('data-quick-url-redirect')) {
		login_uri = $this.attr('data-quick-url-redirect');
	} else {
		login_uri = $(location).attr("href");
	}
	product_wish_list_data_name = $(this).attr("data-name");

	
	product_wish_list_data_id = $(this).attr("data-id");

     var $row = '.WISH_QTY_' + product_wish_list_data_id; 
	product_addtocart_data_qty = $($row).val();

	// alert(product_wish_list_data_id);


	// product_wish_list_data_qty = $('#hidden-product-quantity').text();

	// // alert(product_wish_list_data_qty);

	// var value = ;

	// alert(product_wish_list_data_id);
	var product_wish_list_data_name = $(this).attr("data-name");
	if (loginid) {

		
		if (loginid != '') {

			// alert('123');
			$.ajax({
				type: "POST",
				url: baseurl + 'home/order_place',
				data: {
					id: product_wish_list_data_id,
					qty: product_addtocart_data_qty
				},
				dataType: "json",
				success: function (result) {

					if (result.status != 400) {

						// var url_redirect = baseurl + 'home/customer_wish_list';

						// if ($this.attr('data-quick-url-redirect')) {

						// 	var tag = '&lt;a onclick="parent.window.location.href=' + "'" + url_redirect + "'" + '"  href="#"&gt;';
						// 	addProductNotice(tag + 'Product added to Wish List&lt;/a&gt;', '', tag + '&lt;h3&gt;' + product_wish_list_data_name + '&lt;/h3&gt;&lt;/a&gt;', 'success');

						// } else {
						// 	addProductNotice('&lt;a href="' + url_redirect + '"&gt;Product added to Wish List&lt;/a&gt;', '', '&lt;a href="' + url_redirect + '"&gt;&lt;h3&gt;' + product_wish_list_data_name + '&lt;/h3&gt;&lt;/a&gt;', 'success');
						// }
  


						// alert('Product Added To Wishlist');

						alert('Thank you for placing your order, your account manager will call back in 45 minutes to process your order .');


						// var alert = "&lt;div class='alert alert-dismissable' style='font-weight: bold;font - size: 17px; background-color:green;color:white;padding:1%;' align='left'&gt;&lt;button type='button' class='close' data-dismiss='alert' aria-hidden='true'&gt;Ã—&lt;/button&gt;Product Added To Wishlist&lt;br&gt;&lt;p style='color:white;padding:1%; font-size: 14px; font-weight:400;'  align='left'&gt;" + data_name + "&lt;/p&gt;&lt;/div&gt;";
						// // $('.alert-container').html(alert); /* alert container class ".alert-container" */
						// setTimeout(function () { /* show the alert for 3sec and then reload the page. */
						// 	location.reload();
						// }, 2000);

						// addOrderPlace('Thank you for placing your order, your account manager will call back in 45 minutes to process your order .', '', '', 'success');

				
				       setTimeout(function () { /* show the alert for 3sec and then reload the page. */
				       window.location.href = baseurl + 'home/wish_list';
			         	}, 1000);

						 

					} else {
						// alert(result.message);

						addOrderPlace('Your cart', '', 'Your cart is empty.', 'success');

				// alert(result.message);
				setTimeout(function () { /* show the alert for 3sec and then reload the page. */
				window.location.reload();
				}, 10000);

						// alert(result.message);

						// alert('Product Already Added To Wishlist');

						// var alert = "&lt;div class='alert alert-dismissable' style='font-weight: bold;font - size: 17px; background-color:red;color:white;padding:1%;' align='left'&gt;&lt;button type='button' class='close' data-dismiss='alert' aria-hidden='true'&gt;Ã—&lt;/button&gt;Product Already Added To Wishlist&lt;br&gt;&lt;p style='color:white;padding:1%; font-size: 14px; font-weight:400;'  align='left'&gt;" + data_name + "&lt;/p&gt;&lt;/div&gt;";
						// $('.alert-container').html(alert); /* alert container class ".alert-container" */
						setTimeout(function () { /* show the alert for 3sec and then reload the page. */
							location.reload();
						}, 2000);
					}
				}
			});
		} else {



			// alert(app_language.please_login);
			// if ($this.attr('data-quick-url-redirect')) {
			// 	if (window.parent == window.top) {
			// 		parent.window.location.href = baseurl + 'login?login_url=' + login_uri;
			// 	}
			// } else {
			// 	$('#exampleModal').attr('data-login-first', '3');
			// 	$('.all_page_login').first().click();
			// }
		}
	} else {


		// alert(app_language.please_login);
		if ($this.attr('data-quick-url-redirect')) {
			if (window.parent == window.top) {
				parent.window.location.href = baseurl + 'login?login_url=' + login_uri;
			}
		} else {
			
			// $('#login_modal').attr('data-login-first', '3');
			$('#login_modal').first().click();
			
		}

	}
});




$(document).on('click', '.compare_delete', function () {
	// alert($(this).attr('data-id'));
	var loginid = app_session.LOGIN_ID;
	// if (confirm("Are You Sure You Want To Remove?")) {
	if (loginid != '') {
		$.ajax({
			type: "POST",
			url: baseurl + 'home/delete_product_compare',
			data: {
				id: $(this).attr('data-id')
			},
			dataType: "json",
			success: function (result) {
				// alert(result.message);
				var alert = `&lt;div class="alert alert-dismissable" style="background-color:green;color:white;padding:1%;" align="center"&gt;
				&lt;button type="button" class="close" data- dismiss="alert" aria-hidden="true"&gt;Ã—&lt;/button&gt;Your Compare Product Remove Successfully.&lt;/div&gt;`;
				$('.alert-container').html(alert); /* alert container class ".alert-container" */
				setTimeout(function () { /* show the alert for 3sec and then reload the page. */

				}, 5000);
				location.reload();
			}
		});
	} else {
		alert("Please Login");
	}
	// }
});


$(document).on("click", '.subscribe_agripari', function () {

	if ($('.subscribe_agripari_mobile').val() == '' || $('.subscribe_agripari_mobile').val() == null || ($('.subscribe_agripari_mobile').val()).length &lt; 10 || ($('.subscribe_agripari_mobile').val()).length &gt; 10) {
		alert("Please Enter Mobile");
		return false;
	}

	//alert($('.subscribe_agripari_mobile').val());

	$.ajax({
		type: "POST",
		url: baseurl + 'home/subscribe',
		data: {
			MOBILE: $('.subscribe_agripari_mobile').val()
		},
		dataType: "json",
		success: function (result) {
			// console.log(result);
			alert(result.message);
			window.location.reload();
		}
	});
});

var compare_list_data_name;
var compare_list_data_id;
$(document).on("click", '.compare', function () {


	var $this = $(this);

	compare_list_data_id = $(this).attr('data-id');

	var loginid = app_session.LOGIN_ID;

	var login_uri = "";

	if ($this.attr('data-quick-url-redirect')) {

		login_uri = $this.attr('data-quick-url-redirect');
		//alert(login_uri);
	} else {
		login_uri = $(location).attr("href");
	}
	compare_list_data_name = $(this).attr('data-name');
	var data_name = $(this).attr("data-name");
	if (loginid) {
		// alert('123');
		if (loginid != '') {
			if (compare_list_data_id != '') {
				$.ajax({
					type: "POST",
					url: baseurl + 'home/add_product_compare',
					data: {
						id: compare_list_data_id
					},
					dataType: "json",
					success: function (result) {
						console.log(result);
						if (result.status == 200) {
							// var url_redirect = baseurl + 'home/product_compare';
							// if ($this.attr('data-quick-url-redirect')) {

							// 	var tag = '&lt;a onclick="parent.window.location.href=' + "'" + url_redirect + "'" + '"  href="#"&gt;';
							// 	addProductNotice(tag + 'Product added to Compare List&lt;/a&gt;', '', tag + '&lt;h3&gt;' + compare_list_data_name + '&lt;/h3&gt;&lt;/a&gt;', 'success');

							// } else {
							// 	addProductNotice('&lt;a href="' + url_redirect + '"&gt;Product added to Compare List&lt;/a&gt;', '', '&lt;a href="' + url_redirect + '"&gt;&lt;h3&gt;' + compare_list_data_name + '&lt;/h3&gt;&lt;/a&gt;', 'success');
							// }

							var alert = "&lt;div class='alert alert-dismissable' style='font-weight: bold;font - size: 17px; background-color:green;color:white;padding:1%;' align='left'&gt;&lt;button type='button' class='close' data-dismiss='alert' aria-hidden='true'&gt;Ã—&lt;/button&gt;Product Added To Compare List&lt;br&gt;&lt;p style='color:white;padding:1%; font-size: 14px; font-weight:400;'  align='left'&gt;" + data_name + "&lt;/p&gt;&lt;/div&gt;";
							$('.alert-container').html(alert); /* alert container class ".alert-container" */
							setTimeout(function () {
								location.reload();
							}, 2000);
							// window.location.reload();


						}
						if (result.status == 400) {
							// addProductNotice('', '', '&lt;h3&gt;' + result.message + '&lt;/h3&gt;', 'success');
							// window.location.reload();

							var alert = "&lt;div class='alert alert-dismissable' style='font-weight: bold;font - size: 17px; background-color:red;color:white;padding:1%;' align='left'&gt;&lt;button type='button' class='close' data-dismiss='alert' aria-hidden='true'&gt;Ã—&lt;/button&gt;Product Already Added To Compare List&lt;br&gt;&lt;p style='color:white;padding:1%; font-size: 14px; font-weight:400;'  align='left'&gt;" + data_name + "&lt;/p&gt;&lt;/div&gt;";
							$('.alert-container').html(alert); /* alert container class ".alert-container" */
							setTimeout(function () { /* show the alert for 3sec and then reload the page. */
								location.reload();
							}, 2000);
							// window.location.reload();

						}

					}
				});
			}
		} else {


			// alert(app_language.please_login);
			if ($this.attr('data-quick-url-redirect')) {
				if (window.parent == window.top) {
					parent.window.location.href = baseurl + 'login?login_url=' + login_uri;
				}
			} else {
				$('#logiexampleModaln_modal').attr('data-login-first', '4');
				$('.all_page_login').first().click();
			}
		}
	} else {


		//alert(app_language.please_login);
		if ($this.attr('data-quick-url-redirect')) {
			if (window.parent == window.top) {
				parent.window.location.href = baseurl + 'login?login_url=' + login_uri;
			}
		} else {
			$('#login_modal').attr('data-login-first', '4');
			$('.all_page_login').first().click();
		}

	}
});



$(document).on("click", '.investor-add', function () {
	var inv_tr_find = $(this).closest('form');
	if (inv_tr_find.find('#input-name').val() == '' || inv_tr_find.find('#input-name').val() == null) {
		alert("Please Enter Name");
		return false;
	}
	if (inv_tr_find.find('#input-mobile').val() == '' || inv_tr_find.find('#input-mobile').val() == null) {
		alert("Please Enter Mobile");
		return false;
	}
	if (inv_tr_find.find('#input-email').val() == '' || inv_tr_find.find('#input-email').val() == null) {
		alert("Please Enter Email");
		return false;
	}
	if (inv_tr_find.find('#input-city').val() == '' || inv_tr_find.find('#input-city').val() == null) {
		alert("Please Enter City");
		return false;
	}
	if (inv_tr_find.find('#input-country').val() == '' || inv_tr_find.find('#input-country').val() == null) {
		alert("Please Enter Country");
		return false;
	}

	var response = grecaptcha.getResponse();

	// alert(response);
	if (response.length == 0) {
		document.getElementById('investor-g-recaptcha-error').innerHTML = '&lt;span style="color:red;"&gt;This field is required.&lt;/span&gt;';
		return false;
	} else {
		document.getElementById('investor-g-recaptcha-error').innerHTML = '';
	}

	$(this).attr("disabled", "disabled");
	$(this).text("Sending...");
	// alert($('.subscribe_agripari_mobile').val());

	$.ajax({
		type: "POST",
		url: baseurl + 'home/investor',
		data: {
			NAME: inv_tr_find.find('#input-name').val(),
			MOBILE: inv_tr_find.find('#input-mobile').val(),
			EMAIL: inv_tr_find.find('#input-email').val(),
			CITY: inv_tr_find.find('#input-city').val(),
			COUNTRY: inv_tr_find.find('#input-country').val()
		},
		dataType: "json",
		success: function (result) {

			alert(result.message);
			window.location.reload();
		}
	});


});


// 	function validate($('#input-email').val()) {

// 		var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
// 		//var address = document.getElementById[email].value;
// 		if (reg.test($('#input-email').val()) == false) 
// 		{
// 			alert('Invalid Email Address');
// 			return (false);
// 		}
// }



////////////// contact-us add ///////////////////////////////////////

$(document).on('click submit', '.contactus-add', function () {

	

	if ($('#input-name').val() == '' || $('#input-name').val() == null) {
		// alert("Please Enter Name");
		addProductNotice('Please Enter Name', '', '', 'error');
		return false;
	}

	
	if ($('#input-email').val() == '' || $('#input-email').val() == null) {
		addProductNotice('Please Enter Email ID', '', '', 'error');
		// alert("Please Enter Email");
		return false;
	}


	var email = $('#input-email').val();
    var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	
	if (reg.test(email) == false) 
	{
		// alert('Invalid Email Address');
		addProductNotice('Invalid Email Address', '', '', 'error');
		return false;
	}

	

	if ($('#input-mobile').val() == '' || $('#input-mobile').val() == null) {
		// alert("Please Enter Mobile");
		addProductNotice('Please Enter Mobile', '', '', 'error');
		return false;
	}

	if ($('#input-city').val() == '' || $('#input-city').val() == null) {
		// alert("Please Enter City");
		addProductNotice('Please Enter City', '', '', 'error');
		return false;
	}

	if ($('#input-business-name').val() == '' || $('#input-business-name').val() == null) {
		// alert("Please Enter Business Name");
		addProductNotice('Please Enter Business Name', '', '', 'error');
		return false;
	}

	if ($('#input-pincode').val() == '' || $('#input-pincode').val() == null) {
		// alert("Please Enter Pincode");
		addProductNotice('Please Enter Pincode', '', '', 'error');
		return false;
	}


	if ($('#input-business-address').val() == '' || $('#input-business-address').val() == null) {
		// alert("Please Enter Business Address");
		addProductNotice('Please Enter Business Address', '', '', 'error');
		return false;
	}

	if ($('#input-query').val() == '' || $('#input-query').val() == null) {
		// alert("Please Enter Query");
		addProductNotice('Please Enter Query', '', '', 'error');
		return false;
	}

	if ($('input[name="TERMS"]:checked').val() == '' || $('input[name="TERMS"]:checked').val() == null) {
        // alert("Please agree to all the terms and conditions before continue");
		addProductNotice('Please agree to all the terms and conditions before continue', '', '', 'error');
		return false;
	}


	

	$.ajax({
		type: "POST",
		url: baseurl + 'home/contact_submit',
		data: {
			NAME: $('#input-name').val(),
			EMAIL: $('#input-email').val(),
			PHONE_NO: $('#input-mobile').val(),
			CITY: $('#input-city').val(),
			BUSINESS_NAME: $('#input-business-name').val(),
			PINCODE: $('#input-pincode').val(),
			BUSINESS_ADDRESS: $('#input-business-address').val(),
			QUERY: $('#input-query').val(),
			TERMS: $('input[name="TERMS"]:checked').val()
		},
		dataType: "json",
		success: function (result) {

			if (result.status == 200) {

				// addProductNotice('Contact Us', '', 'Your Request has been Submitted Successfully.', 'success');

				addProductNotice('Your Request has been Submitted Successfully.', '', '', 'success');

				setTimeout(function () { /* show the alert for 3sec and then reload the page. */
				       window.location.href = baseurl;
			         	}, 4000);
			}

			

			// alert(result.message);
			// addProductNotice('Your Request has been Submitted Successfully.', '', '', 'success');
			// window.location.reload();
			// parent.window.location.href = baseurl;
		}
	});


});


/////////////////////////////////////////////////////////////////





////////////// vendor add ///////////////////////////////////////

$(document).on('click submit', '.vendors-add', function () {

	

	if ($('#input-company-name').val() == '' || $('#input-company-name').val() == null) {
		// alert("Please Enter Name");
		addProductNotice('Please Enter Company Name', '', '', 'error');
		return false;
	}
	
	
	if ($('#input-name').val() == '' || $('#input-name').val() == null) {
		// alert("Please Enter Name");
		addProductNotice('Please Enter Name', '', '', 'error');
		return false;
	}


	if ($('#input-surname').val() == '' || $('#input-surname').val() == null) {
		// alert("Please Enter Name");
		addProductNotice('Please Enter Name', '', '', 'error');
		return false;
	}

	
	if ($('#input-email').val() == '' || $('#input-email').val() == null) {
		addProductNotice('Please Enter Email ID', '', '', 'error');
		// alert("Please Enter Email");
		return false;
	}


	var email = $('#input-email').val();
    var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	
	if (reg.test(email) == false) 
	{
		// alert('Invalid Email Address');
		addProductNotice('Invalid Email Address', '', '', 'error');
		return false;
	}

	

	if ($('#input-mobile').val() == '' || $('#input-mobile').val() == null) {
		// alert("Please Enter Mobile");
		addProductNotice('Please Enter Mobile', '', '', 'error');
		return false;
	}

	if ($('#input-city').val() == '' || $('#input-city').val() == null) {
		// alert("Please Enter City");
		addProductNotice('Please Enter City', '', '', 'error');
		return false;
	}

	
	if ($('#input-product-description').val() == '' || $('#input-product-description').val() == null) {
		// alert("Please Enter Business Address");
		addProductNotice('Please Enter Product Description', '', '', 'error');
		return false;
	}

	if ($('#input-notes').val() == '' || $('#input-notes').val() == null) {
		// alert("Please Enter Query");
		addProductNotice('Please Enter Notes', '', '', 'error');
		return false;
	}

	

	$.ajax({
		type: "POST",
		url: baseurl + 'home/vendor_submit',
		data: {
			COMPANY_NAME: $('#input-company-name').val(),
			NAME: $('#input-name').val(),
			SURNAME: $('#input-surname').val(),
			EMAIL: $('#input-email').val(),
			PHONE_NO: $('#input-mobile').val(),
			CITY: $('#input-city').val(),
			PRODUCT_DESCRIPTION: $('#input-product-description').val(),
			NOTES: $('#input-notes').val(),
		},
		dataType: "json",
		success: function (result) {

			if (result.status == 200) {

				// addProductNotice('Contact Us', '', 'Your Request has been Submitted Successfully.', 'success');

				addProductNotice('Your Request has been Submitted Successfully.', '', '', 'success');

				setTimeout(function () { /* show the alert for 3sec and then reload the page. */
				       window.location.href = baseurl;
			         	}, 4000);
			}

			

			// alert(result.message);
			// addProductNotice('Your Request has been Submitted Successfully.', '', '', 'success');
			// window.location.reload();
			// parent.window.location.href = baseurl;
		}
	});


});


/////////////////////////////////////////////////////////////////

















////////////////////////// career page jquery ////////////////////


$(document).on('submit click', '.importdata', function () {
	console.log("this", $(this));
	if ($(this).attr('data-form-id') == 'career_add') {

		if ($('#input-name').val() == '' || $('#input-name').val() == null) {
			alert("Please Enter Name");
			return false;
		}
		if ($('#input-email').val() == '' || $('#input-email').val() == null) {
			alert("Please Enter Email");
			return false;
		}
		if ($('#input-mobile').val() == '' || $('#input-mobile').val() == null) {
			alert("Please Enter Mobile");
			return false;
		}
		if ($('#input-designation').val() == '' || $('#input-designation').val() == null) {
			alert("Please Enter Designation");
			return false;
		}
		if ($('#input-file')[0].files.length &lt;= 0) {
			alert("Please select file");
			return false;
		} else {
			var ext = $('#input-file').val().split('.').pop();
			if (ext == "pdf" || ext == "docx" || ext == "doc") {

			} else {
				alert('Please select only .pdf, .docx or .doc file');
				return false;
			}
		}

		var response = grecaptcha.getResponse();
		console.log("response", response);
		if (response.length == 0) {
			document.getElementById('g-recaptcha-error').innerHTML = '&lt;span style="color:red;"&gt;This field is required.&lt;/span&gt;';
			return false;
		} else {
			document.getElementById('g-recaptcha-error').innerHTML = '';
		}
	}

	if ($(this).attr('data-form-id') == 'contact_add') {

		if ($('#input-name').val() == '' || $('#input-name').val() == null) {
			alert("Please Enter Name");
			return false;
		}
		if ($('#input-email').val() == '' || $('#input-email').val() == null) {
			alert("Please Enter Email");
			return false;
		}
		if ($('#input-mobile').val() == '' || $('#input-mobile').val() == null) {
			alert("Please Enter Mobile");
			return false;
		}
		if ($('#input-city').val() == '' || $('#input-city').val() == null) {
			alert("Please Enter City");
			return false;
		}
		if ($('#input-message').val() == '' || $('#input-message').val() == null) {
			alert("Please Enter Message");
			return false;
		}

		// var response = grecaptcha.getResponse();
		// console.log("response", response);
		// if (response.length == 0) {
		// 	document.getElementById('g-recaptcha-error').innerHTML = '&lt;span style="color:red;"&gt;This field is required.&lt;/span&gt;';
		// 	return false;
		// } else {
		// 	document.getElementById('g-recaptcha-error').innerHTML = '';
		// }
	}

	if ($(this).attr('data-form-id') == 'bulk_commodity_add') {

		if ($('#input-bulk-name').val() == '' || $('#input-bulk-name').val() == null) {
			alert("Please Enter Name");
			return false;
		}
		if ($('#input-commodity_name').find(":selected").val() == '' || $('#input-commodity_name').find(":selected").val() == null) {
			alert("Please Select Commodity Name");
			return false;
		}
		if ($('#input-qty').val() == '' || $('#input-qty').val() == null) {
			alert("Please Enter qty");
			return false;
		}
		if ($('#input-unit').find(":selected").val() == '' || $('#input-unit').find(":selected").val() == null) {
			alert("Please Select Unit");
			return false;
		}
		if ($('#input-rate').val() == '' || $('#input-rate').val() == null) {
			alert("Please Enter rate");
			return false;
		}
		if ($('#input-commodity_mobile').val() == '' || $('#input-commodity_mobile').val() == null) {
			alert("Please Enter Mobile");
			return false;
		}
		if ($('#input-description').val() == '' || $('#input-description').val() == null) {
			alert("Please Enter description");
			return false;
		}
		if (($("#bulk_commodity_editid").val() == '' || $('#bulk_commodity_editid').val() == null)) {
			console.log("$().val()", $("#bulk_commodity_editid").val());
			if ($('#input-file')[0].files.length &lt;= 0) {
				alert("Please select file");
				return false;
			}
		}
	}


	if ($(this).attr('data-form-id') == 'address_update_add') {

		if ($('#input-payment-shipping-name').val() == '' || $('#input-payment-shipping-name').val() == null) {
			alert("Please Enter Name");
			return false;
		}
		if ($('#input-payment-shipping-mobile').val() == '' || $('#input-payment-shipping-mobile').val() == null) {
			alert("Please Enter Mobile");
			return false;
		}
		if ($('#input-payment-shipping-address').val() == '' || $('#input-payment-shipping-address').val() == null) {
			alert("Please Enter Address");
			return false;
		}
		if ($('#input-payment-shipping-area').val() == '' || $('#input-payment-shipping-area').val() == null) {
			alert("Please Enter Area");
			return false;
		}
		if ($('#input-payment-shipping-country').val() == '' || $('#input-payment-shipping-country').val() == null) {
			alert("Please Select Country");
			return false;
		}
		if ($('#input-payment-shipping-state').val() == '' || $('#input-payment-shipping-state').val() == null) {
			alert("Please Select State");
			return false;
		}
		if ($('#input-payment-shipping-postcode').val() == '' || $('#input-payment-shipping-postcode').val() == null) {
			alert("Please Enter Pincode");
			return false;
		}
	}


	if ($(this).attr('data-form-id') == 'order_return_form') {


		if ($('#REASON_FOR_RETURN_ID').find(":selected").val() == '' || $('#REASON_FOR_RETURN_ID').find(":selected").val() == null) {
			alert("Please Select Reason For Return");
			return false;
		}
		if ($('#RETURN_REMARK').val() == '' || $('#RETURN_REMARK').val() == null) {
			alert("Please Enter Return Remark");
			return false;
		}

		if ($('#photo_1')[0].files.length &lt;= 2) {
			alert("Please select minimum 3 files");
			return false;
		}

	}



	var url = $(this).attr('data-url');
	var form_id = $(this).attr('data-form-id');

	var fd = new FormData();
	$('input[type="file"]').each(function () {

		var f_this = $(this);
		var f_name = f_this.attr("name");
		var file_data = f_this[0].files; // for multiple files
		for (var i = 0; i &lt; file_data.length; i++) {
			fd.append(f_name, file_data[i]);
		}

	});


	var other_data = $('#' + form_id).serializeArray();
	// alert(other_data);
	$.each(other_data, function (key, input) {
		console.log("input.name", input.name);
		console.log("input.value", input.value);
		fd.append(input.name, input.value);
	});
	console.log(fd);
	// alert(url);

	import_data(url, fd, form_id);

});

function import_data(url, fd, form_id) {
	$.ajax({
		type: "POST",
		url: url,
		data: fd,
		dataType: "json",
		contentType: false,
		cache: false,
		processData: false,
		beforeSend: function (xhr) {

		},
		success: function (data) {
			console.log(data);


			alert(data.message);
			if (data.status == 200) {

				// alert('456454644645646');

				if (form_id == 'order_return_form') {
					// window.location.href = baseurl + 'home/order_list';
					window.location.reload();
				} else {
					window.location.reload();
				}
			}

		},
		error: function (xhr, status, error) {
			console.log(xhr);
			console.log(status);
			console.log(error);
		},
		complete: function (xhr, status) {

		}
	});
}

$(document).on('click', '.view_type', function () {
	check_list_page();
});
$(document).ready(function () {
	check_list_page();
});

function check_list_page() {
	var view_type = $('.view_type.active').attr('data-view');
	console.log("view_type", view_type);
	if (view_type) {
		if (view_type == "list") {
			$(".product_page_imgs").removeClass('products-grid-page-img').addClass('products-list-page-img');
		}
		if (view_type == "grid") {
			$(".product_page_imgs").removeClass('products-list-page-img').addClass('products-grid-page-img');
		}
	}
}

// $(document).ready(function () {
// 	if (navigator.geolocation) {
// 		navigator.geolocation.getCurrentPosition(showLocation);
// 	} else {
// 		$('#location').html('Geolocation is not supported by this browser.');
// 	}
// });

function showLocation(position) {
	var latitude = position.coords.latitude;
	var longitude = position.coords.longitude;

	$.ajax({
		type: 'POST',
		url: baseurl + 'home/current_weather',
		data: {
			latitude: latitude,
			longitude: longitude
		},
		success: function (msg) {
			$("#get_weather_name").text(msg.data.name);
			$("#get_weather_description").text(msg.data.weather[0].description);
			$("#get_weather_img").attr("src", "https://openweathermap.org/img/w/" + msg.data.weather[0].icon + ".png");
			$("#get_weather_temp_max").text(msg.data.main.temp_max);
			$("#get_weather_temp_min").text(msg.data.main.temp_min);
			$("#get_weather_humidity").text(msg.data.main.humidity);
			$("#get_weather_speed").text(msg.data.wind.speed);
		}
	});
}

function order_tracking($this) {
	var shiprocket_id = $this.attr('data-shiprocket-id');
	$('.ship_order_data').html('');
	if (shiprocket_id != '' &amp;&amp; shiprocket_id != null) {

		$.ajax({
			type: 'POST',
			url: apiurl + 'web-api/web/order_tracking',
			data: {
				ID: shiprocket_id
			},
			success: function (res) {
				// console.log(res);
				if (res.status == 200) {
					$('#get_order_status').val(res.shipment_track[0].current_status);
					if (res.shipment_track[0].delivered_date != '') {
						var delive = new Date(res.shipment_track[0].delivered_date);
						var del_month = parseFloat(delive.getMonth()) + parseFloat(1);
						$('#get_delivery_date').val(delive.getDate() + del_month + delive.getFullYear());
					}
					var ship_html = '';
					if (res.shipment_track_activities.length &gt; 0) {
						var ship_data = res.shipment_track_activities;
						for (var i = 0; i &lt; ship_data.length; i++) {
							ship_html += '&lt;tr&gt;' + '&lt;td&gt;' + ship_data[i].date + '&lt;/td&gt;' + '&lt;td&gt;' + ship_data[i].activity + '&lt;/td&gt;' + '&lt;td&gt;' + ship_data[i].location + '&lt;/td&gt;' + '&lt;/tr&gt;';
						}
					}
					$('.ship_order_data').html(ship_html);
				} else {
					$('.ship_order_data').html('No Data Found');

				}
			}
		});
	}
}

$(document).on('click', '.order_tracking', function () {
	order_tracking($(this));
});

$(document).on('change select', "#input-payment-shipping-country", function () {

	var payment_state_id = $(this).attr('data-bind-id');

	$('#' + payment_state_id + ' option[value!=""]').remove();
	var payment_country_id = $(this).val();
	if (payment_country_id != '') {
		$.ajax({
			type: "POST",
			url: baseurl + 'home/get_state',
			data: {
				country_id: payment_country_id,
			},
			dataType: "json",
			success: function (result) {
				// console.log(result);
				if (result.status == 200) {

					for (var i = 0; i &lt; (result.data).length; i++) {
						$('#' + payment_state_id).append("&lt;option value='" + result.data[i].ID + "'&gt;" + result.data[i].STATENAME + "&lt;/option&gt;");
					}
				}
			}
		});
	}
});


$(document).on('click', '.button-cart', function () {


	var loginid = app_session.LOGIN_ID;

	// alert(loginid);
	var login_pincode = app_session.LOGIN_PINCODE;
	// alert(login_pincode);


	var $this = $(this);
	//alert($this);
	pincode_data_name = $(this).attr('data-name');

	pincode_url = $this.attr('data-post-url');
	pincode_data_id = $(this).attr('data-id');
	pincode_data_price = $(this).attr('data-price');
	pincode_data_type = $this.attr('data-type');
	//alert(pincode_data_type);
	pincode_data_redirect = $this.attr('data-redirect');
	// alert(pincode_data_redirect);


	var login_uri = "";
	if ($this.attr('data-quick-url-redirect')) {
		login_uri = $this.attr('data-quick-url-redirect');
		// alert(login_uri);
	} else {
		login_uri = $(location).attr("href");
	}

	if ($this.attr('data-type') == 'addtocart') {
		var qty = $("input[name*='quantity']").val();
		// alert(qty);
		var data_name = $('#button-cart').attr("data-name");

	} else if ($this.attr('data-type') == 'allproduct') {
		var qty = $(this).attr('data-qty');
		var data_name = $(this).attr("data-name");

	} else {
		var qty = $this.closest('tr').find("input[name*='quantity']").val();
		var data_name = $('#button-cart').attr("data-name");
	}
	pincode_qty = qty;


	// alert(data_name);
	// alert(data_name);
	// console.log('fsdhgh', data_name);

	// if (app_session.LOGIN_ID == '') {
	//
	//     $('#login_modal').attr('data-login-first', '2');
	//     $('.all_page_login').click();
	//
	// }
	// console.log(app_session.LOGIN_ID);


	if (loginid) {

		if (loginid != '') {

			if (login_pincode == '') {
				// alert(loginid);
				// alert(login_pincode);
				// alert(add_to_cart_length);
				$('.apply_pincode_check').click();
			} else {
				//alert(login_pincode);
				if (loginid != '' &amp;&amp; login_pincode != '') {


					if (qty != '' &amp;&amp; qty &gt;= 1) {



						$.ajax({
							type: "POST",
							url: baseurl + 'home/' + pincode_url,
							data: {
								id: pincode_data_id,
								name: pincode_data_name,
								price: pincode_data_price,
								qty: qty
							},
							dataType: "json",
							success: function (result) {

								// alert('okkk');

								if (result.status == 400) {
									// alert('400');
									$('.apply_pincode_check').click();
								} else {

									if (pincode_data_redirect &amp;&amp; pincode_data_redirect == 'checkout') {

										window.open(baseurl + "home/check_out", '_parent');
									}
									else {
										$('.cart_body').load(baseurl + 'home/load_cart');

										if ($this.attr('data-type') == 'addtocart' || $this.attr('data-type') == 'allproduct') {

											var url_redirect = baseurl + 'home/show_cart';

											// addProductNotice('&lt;a href="' + url_redirect + '"&gt;Product added to Cart&lt;/a&gt;', '', '&lt;a href="' + url_redirect + '"&gt;&lt;h3&gt;' + data_name + '&lt;/h3&gt;&lt;/a&gt;', 'success');

											// var alert = "&lt;div class='alert alert-dismissable' style='background-color:green;color:white;padding:1%;' align='left'&gt;&lt;button type='button' class='close' data-dismiss='alert' aria-hidden='true'&gt;Ã—&lt;/button&gt;Product Added To Cart&lt;br&gt;&lt;p style='background-color:green;color:white;padding:1%; font-size: 15px;'  align='left'&gt;" + data_name + "&lt;/p&gt;&lt;/div&gt; ";

											if (result.status != 100) {
												var alert = "&lt;div class='alert alert-dismissable' style='font-weight: bold;font - size: 17px; background-color:green;color:white;padding:1%;' align='left'&gt;&lt;button type='button' class='close' data-dismiss='alert' aria-hidden='true'&gt;Ã—&lt;/button&gt;Product Added To Cart&lt;br&gt;&lt;p style='color:white;padding:1%; font-size: 14px; font-weight:400;'  align='left'&gt;" + data_name + "&lt;/p&gt;&lt;/div&gt; ";
											} else {
												var alert = "&lt;div class='alert alert-dismissable' style='font-weight: bold;font - size: 17px; background-color:red;color:white;padding:1%;' align='left'&gt;&lt;button type='button' class='close' data-dismiss='alert' aria-hidden='true'&gt;Ã—&lt;/button&gt;Product Already Added To Cart&lt;br&gt;&lt;p style='color:white;padding:1%; font-size: 14px; font-weight:400;'  align='left'&gt;" + data_name + "&lt;/p&gt;&lt;/div&gt; ";
											}
											$('.alert-container').html(alert);
											setTimeout(function () {
												location.reload();
											}, 1000);

										} else {
											setTimeout(function () {
												window.location.reload();
											}, 100);
										}
									}


								}
							}
						});
					} else {
						alert("Please Enter Qty");
					}
				}
			}

		} else {
			if ($this.attr('data-quick-url-redirect')) {
				if (window.parent == window.top) {
					parent.window.location.href = baseurl + 'login?login_url=' + login_uri;
				}
			} else {
				$('#exampleModal').attr('data-login-first', '2');
				$('.all_page_login').first().click();
			}

		}
	} else {
		/*alert('222');*/
		if ($this.attr('data-quick-url-redirect')) {
			/*alert('333');*/
			if (window.parent == window.top) {
				parent.window.location.href = baseurl + 'login?login_url=' + login_uri;
			}
		} else {
			//alert('444');
			$('#exampleModal').attr('data-login-first', '2');
			$('.all_page_login').first().click();
		}

	}

});


$(document).on('click submit', '.check_pincode', function () {



	if ($('#input-pincode').val() == '' || $('#input-pincode').val() == null) {
		alert('Please Enter Delivery Pincode');
		return false;
	}

	// console.log('pincode_data_id', pincode_data_id);
	$.ajax({
		type: "POST",
		url: baseurl + 'home/check_pincode_code',
		data: {
			pincode: $('#input-pincode').val(),
			combination_id: pincode_data_id,
			LOGIN_TYPE: 2
		},
		dataType: "json",
		success: function (result) {

			// alert('123');

			// $('.close').click();
			if (result.status == 200) {
				// console.log(result.data[0].PINCODE);
				session_update('', result.data);
				if (pincode_qty != '' &amp;&amp; pincode_qty &gt;= 1) {

					$.ajax({
						type: "POST",
						url: baseurl + 'home/' + pincode_url,
						data: {
							id: pincode_data_id,
							name: pincode_data_name,
							price: pincode_data_price,
							qty: pincode_qty
						},
						dataType: "json",
						success: function (result) {
							console.log(result);
							$('.cart_body').load(baseurl + 'home/load_cart');

							if (pincode_data_redirect &amp;&amp; pincode_data_redirect == 'checkout') {
								// window.location.href = baseurl + "home/check_out";
								window.open(baseurl + "home/check_out", '_parent');
							} else {
								if (pincode_data_type == 'addtocart' || pincode_data_type == 'allproduct') {

									var url_redirect = baseurl + 'home/show_cart';

									if (pincode_quick_url_redirect) {
										var tag = '&lt;a onclick="parent.window.location.href=' + "'" + url_redirect + "'" + '"  href="#"&gt;';
										addProductNotice(tag + 'Product added to Cart&lt;/a&gt;', '', tag + '&lt;h3&gt;' + pincode_data_name + '&lt;/h3&gt;&lt;/a&gt;', 'success');
									} else {
										// addProductNotice('&lt;a href="' + url_redirect + '"&gt;Product added to Cart&lt;/a&gt;', '', '&lt;a href="' + url_redirect + '"&gt;&lt;h3&gt;' + pincode_data_name + '&lt;/h3&gt;&lt;/a&gt;', 'success');
										setTimeout(function () {
											window.location.reload();
										}, 100);
									}

								} else {
									setTimeout(function () {
										window.location.reload();
									}, 100);
								}
							}
						}
					});
				} else {
					alert("Please Enter Qty");
				}
			} else {
				alert(result.message);
			}
		}
	});

});

$('.customer-new-seller').hide();
$('.customer-new-customer').hide();

$(document).on("click", '.forgot-password', function () {
	$('.for-login').hide();
	$('.for-forgot-pwd').show();
	$('.loginSocialBtn').hide();
	$(this).closest('#login_modal').find('h4').text(new_customer_forget_password);
	$(this).closest('#login-register-modal').find('header').text('Forgot Password');
	$(this).closest('#login-register-modal').find('p').text('Please provide your mobile no. for get password');
});
$(document).on("click", '.newtoagripari,.newtoagripari_new', function () {
	if ($(this).attr('data-customer') == 'newcustomer') {
		$('.customer-new-customer').show();
		$('.for-login').hide();
		$('.for-forgot-pwd').hide();
		$('.loginSocialBtn').show();

		$('.newtoagripari').text('Existing User? Log in');
		$('.newtoagripari').attr('data-customer', 'login');
		$('.newtoagripari').attr('title', 'Existing User? Log in');

		$('.newtoagripari').closest('#login_modal').find('h4').text(new_customer);
		$('.newtoagripari').closest('#login-register-modal').find('header').text('Register on Mitticool');
		$('.newtoagripari').closest('#login-register-modal').find('p').text('Please provide your details for signup on Mitticool');
	} else {

		$('.customer-new-customer').hide();
		$('.customer-new-seller').hide();
		$('.for-login').show();
		$('.for-forgot-pwd').hide();
		$('.loginSocialBtn').show();
		$('.newtoagripari').attr('data-customer', 'newcustomer');
		$('.newtoagripari').text('New Registration?');
		$('.newtoagripari').attr('title', 'Create an Account');
		$('.newtoagripari').closest('#login_modal').find('h4').text(new_customer_login);
		$('.newtoagripari').closest('#login-register-modal').find('header').text('Login on Mitticool');
		$('.newtoagripari').closest('#login-register-modal').find('p').text('Please provide your mobile no. and password for login on Mitticool');
	}

});

$(document).on("click", '.back-forgot-password', function () {
	$('.for-login').show();
	$('.for-forgot-pwd').hide();
	$('.loginSocialBtn').show();
	$(this).closest('#login_modal').find('h4').text(new_customer_login);
	$(this).closest('#login-register-modal').find('header').text('Login On Mitticool');
	$(this).closest('#login-register-modal').find('p').text('Please provide your mobile no. and password for login on Mitticool');
});

$(document).on("click", '.close', function () {
	$('.customer-new-seller').hide();
	$('.customer-new-customer').hide();
	$('.for-login').show();
	$('.for-forgot-pwd').hide();
	$(this).closest('#login_modal').find('h4').text(new_customer_login);
});






$(document).on("click submit", '.forgot-pwd', function () {
	if ($('#input-forgot-email').val() == '' || $('#input-forgot-email').val() == null) {
		alert("Please Enter Email");
		return false;
	}

	
	// if ($('#input-forgot-mobile').val().length != 10) {
	// 	alert("Please Enter 10 Digit Mobile no.");
	// 	return false;
	// }

	$.ajax({
		type: "POST",
		// url: apiurl + 'app/jqry/send_password',
		url:baseurl + 'home/forgot_password',
		data: {
			EMAIL: $('#input-forgot-email').val(),
			LOGIN_TYPE: 2
		},
		dataType: "json",
		beforeSend: function (xhr, settings) { },
		success: function (result) {
			console.log(result);
			// alert(result.message);

			// setTimeout(function () {
			// 	window.location.reload();
			// }, 4000);
			// // if (result.status == 200) {
			// // 	// $('.for-login').show();
			// // 	// $('.for-forgot-pwd').hide();
			// // }
			// window.location.reload();

			addProductNotice('Forgot password link sent successfully on given email id.', '', '', 'success');

				// alert(result.message);
				setTimeout(function () { /* show the alert for 3sec and then reload the page. */
				window.location.reload();
				}, 4000);
		},
		error: function (jqXHR, textStatus, errorThrown) {

		},
		complete: function (xhr, status) {

		}

	});
	return false;
});

// $(document).on("click submit", '.customer_send_otpss', function () {
// 	var aa = $('#input-email').val();
// 	if ($('#input-otp').val() == '' || $('#input-otp').val() == null) {
// 			alert("Please Enter OTP");
// 			return false;
// 		}
	
// 	if ($('#input-email').val() == '' || $('#input-email').val() == null) {
// 		alert("Please Enter Email");
// 		return false;
// 	}

	

// 	// alert(aa);
// 	// if ($('#input-mobile').val().length != 10) {
// 	// 	alert("Please Enter 10 Digit Mobile no.");
// 	// 	return false;
// 	// }

// 	$.ajax({
// 		type: "POST",
// 		url: apiurl + 'app/jqry/send_otp',
// 		data: JSON.stringify({
// 			EMAIL: $('#input-email').val(),
// 			LOGIN_TYPE: 2
// 		}),
// 		dataType: "json",
// 		beforeSend: function (xhr, settings) { },
// 		success: function (result) {

// 			if (result.status == 200) {
// 				$('.customer-new-seller').show();
// 				$('.customer-new-customer').hide();
// 				$('#login-register-modal header').text('Register on Mitticool');
// 				$('#login-register-modal p').text('Please provide your details for signup on Mitticool');
// 				$(this).attr('data-customer', 'login');
// 			} else {
// 				alert(result.message);
// 				$('.customer-new-seller').hide();
// 			}
// 			// window.location.reload();
// 		},
// 		error: function (jqXHR, textStatus, errorThrown) {

// 		},
// 		complete: function (xhr, status) {

// 		}

// 	});

// 	return false;
// });

$(document).on("click", '.customer_register', function () {

	// alert(baseurl);
	// alert(baseurl + 'login/save');

	

	if ($('#input-name').val() == '' || $('#input-name').val() == null) {
		// alert("Please Enter Name");
		addProductNotice('Please Enter Name', '', '', 'error');
		return false;
	}

	if ($('#input-email').val() == '' || $('#input-email').val() == null) {
		// alert("Please Enter Email");
		addProductNotice('Please Enter Email', '', '', 'error');
		return false;
	}


	var email = $('#input-email').val();
    var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	
	if (reg.test(email) == false) 
	{
		// alert('Invalid Email Address');
		addProductNotice('Invalid Email Address', '', '', 'error');
		return false;
	}

	

	if ($('#input-mobile').val() == '' || $('#input-mobile').val() == null) {
		// alert("Please Enter Mobile");
		addProductNotice('Please Enter Mobile', '', '', 'error');
		return false;
	}
	
	

	if ($('#input-reg-pwd').val() == '' || $('#input-reg-pwd').val() == null) {
		// alert("Please Enter Password");
		addProductNotice('Please Enter Password', '', '', 'error');
		return false;
	}


	if ($('#input-address_proof').val() == '' || $('#input-address_proof').val() == null) {
		// alert("Please Add Business Proof");
		addProductNotice('Please Add Business Proof', '', '', 'error');
		return false;
	}

	// if ($('#input-address_proof').val() == '' || $('#input-address_proof').val() == null) {
	// 	alert("Please Add Address Proof");
	// 	return false;
	// }



	if ($('input[name="TERMS"]:checked').val() == '' || $('input[name="TERMS"]:checked').val() == null) {
        // alert("Please agree to all the terms and conditions before continue");
		addProductNotice('Please agree to all the terms and conditions before continue.', '', '', 'error');
		return false;
	}

	
	// if ($('#input-reg-pwd').val().length &lt; 6) {
	// 	alert("Please Password Length");
	// 	return false;
	// }

	// if ($('#input-reg-confirm-pwd').val() == '' || $('#input-reg-confirm-pwd').val() == null) {
	// 	alert("Please Enter Confirm Password");
	// 	return false;
	// }

	// if ($('#input-reg-pwd').val() != $('#input-reg-confirm-pwd').val()) {
	// 	alert("Please Enter Password Not Match");
	// 	return false;
	// }

	// if ($('#input-otp').val() == '' || $('#input-otp').val() == null) {
	// 	alert("Please Enter OTP");
	// 	return false;
	// }
	// var formData = new FormData($('#registration_upload')[0]);

	// $(this).text("PLEASE WAIT...");

	var formData = new FormData($('#registration_upload')[0]);
	
	$(".customer_register&gt;span").text("Please wait...");
	
	$.ajax({
		type: "POST",
		url: baseurl + 'login/save',
		data: formData,
		contentType: false,
        processData: false,
		dataType:"json",
		success: function (result) {
			console.log(result.status);
			if (result.status == 200) {
				// $(this).text("Please Wait...");
				// alert('success');
				$("#input-otp-email").val(result.customer_data[0].EMAIL)

			    $('.customer-new-seller_otp').show();
				$('.customer-new-seller').show();
				$('.customer-new-customer').hide();
				
				
				// $('#login-register-modal header').text('Register on Mitticool');
				// $('#login-register-modal p').text('Please provide your details for signup on Mitticool');
				// $(this).attr('data-customer', 'login');

				

			} else {

				// alert('failed');
				$(".customer_register&gt;span").text("Continue");
				// $(this).text("Continue");
				alert(result.message);
				
				$('.customer-new-seller_otp').hide();
				$('.customer-new-seller').hide();
			}
		},
		error: function (jqXHR, textStatus, errorThrown) {

		},
		complete: function (xhr, status) {

		}
	});

	// $.ajax({
	// 	type: "POST",
	// 	url: baseurl + 'login/save',
	// 	data: formData,
	// 	contentType: false,
	// 	dataType: "json",
	// 	success: function (result) {
	// 		console.log("dassd2222",result);
	// 		// if (result.status == 200) {
	// 		// 	session_update(result.data[0].ID);
	// 		// 	if ($('#login_modal').attr('data-login-first') == '2') {
	// 		// 		$('.close').click();
	// 		// 		$('#login_modal').attr('data-login-first', '1');
	// 		// 		$('.apply_pincode_check').click();

	// 		// 		$('.customer-new-seller').show();
	// 		//      	$('.customer-new-customer').hide();

	// 		// 	} else if ($('#login_modal').attr('data-login-first') == '3') {
	// 		// 		$('.close').click();
	// 		// 		$('#login_modal').attr('data-login-first', '1');
	// 		// 		add_to_wish_list();

	// 		// 		$('.customer-new-seller').show();
	// 		// 	$('.customer-new-customer').hide();

	// 		// 	} else if ($('#login_modal').attr('data-login-first') == '4') {
	// 		// 		$('.close').click();
	// 		// 		$('#login_modal').attr('data-login-first', '1');
	// 		// 		add_to_compare_list();

	// 		// 		$('.customer-new-seller').show();
	// 		// 	$('.customer-new-customer').hide();
	// 		// 	} else {
	// 		// 		setTimeout(function () {
	// 		// 			window.location.reload();
	// 		// 		}, 100);
	// 		// 	}
	// 		// } else {
	// 		// 	alert(result.message);
	// 		// }

	// 		if (result.status == 200) {
	// 			// $("#input-otp-email").val(result.customer_data[0].EMAIL)
	// 			// $('.customer-new-seller_otp').show();
	// 			// $('.customer-new-seller').show();
	// 			// $('.customer-new-customer').hide();
	// 			// // $('#login-register-modal header').text('Register on Mitticool');
	// 			// // $('#login-register-modal p').text('Please provide your details for signup on Mitticool');
	// 			// // $(this).attr('data-customer', 'login');
	// 		} else {
	// 			// alert(result.message);
	// 			// $('.customer-new-seller_otp').hide();
	// 			// $('.customer-new-seller').hide();
	// 		}
	// 	},
	// 	error: function (jqXHR, textStatus, errorThrown) {

	// 	},
	// 	complete: function (xhr, status) {

	// 	}
	// });
});

$(document).on("click submit", '.customer_send_otpss', function () {

	// alert(baseurl + 'login/save');
	if ($('#input-otp').val() == '' || $('#input-otp').val() == null) {
		// alert("Please Enter Otp");
		addProductNotice('Please Enter Otp', '', '', 'error');
		return false;
	}

	$.ajax({
		type: "POST",
		url: baseurl + 'login/confirm_otp',
		data: {
			OTP: $('#input-otp').val(),
			EMAIL: $('#input-otp-email').val(),
			LOGIN_TYPE: 2
		},
		dataType: "json",
		success: function (result) {
			if (result.status == 200) {
				setTimeout(function () {
					window.location.reload();
				}, 100);
			}
			else
			{
				// alert(result.message);
				addProductNotice('Invalid Otp', '', '', 'error');
			}
			
		},
		error: function (jqXHR, textStatus, errorThrown) {

		},
		complete: function (xhr, status) {

		}
	});
});



$(document).on("click submit", '.change_password', function () {

	if ($('#change-input-old-password').val() == '' || $('#change-input-old-password').val() == null) {
		alert("Please Enter Current Password");
		return false;
	}


	if ($('#change-input-password').val() == '' || $('#change-input-password').val() == null) {
		alert("Please Enter New Password");
		return false;
	}

	if ($('#change-input-password').val().length &lt; 6) {
		alert("Confirm Password");
		return false;
	}


	if ($('#change-input-confirm').val() == '' || $('#change-input-confirm').val() == null) {
		alert("Please Enter Confirm Password");
		return false;
	}

	if ($('#change-input-password').val() != $('#change-input-confirm').val()) {
		alert("Password not match");
		return "false";
	}

	$.ajax({
		type: "POST",
		url: baseurl + 'login/change_password',
		data: {
			OLD_PASSWORD: $('#change-input-old-password').val(),
			NEW_PASSWORD: $('#change-input-password').val()
		},
		dataType: "json",
		beforeSend: function (xhr, settings) { },
		success: function (result) {

			if (result.status == 200) {
				// alert(result.message);
				// alert('Success');
				// window.location.href = baseurl;

				addProductNotice('Password Update Successfully.', '', '', 'success');

				// alert(result.message);
				setTimeout(function () { /* show the alert for 3sec and then reload the page. */
				window.location.reload();
				}, 4000);
			} else {
				// alert(result.message);
				// alert('Failed');

				addProductNotice('Old Password not match.', '', '', 'success');

				// alert(result.message);
				setTimeout(function () { /* show the alert for 3sec and then reload the page. */
				window.location.reload();
				}, 4000);
			}
		},
		error: function (jqXHR, textStatus, errorThrown) {

		},
		complete: function (xhr, status) {

		}

	});

	return false;
});



$(document).on("click submit", '.change_passwordss', function () {

	if ($('#change-input-old-password').val() == '' || $('#change-input-old-password').val() == null) {
		// alert("Please Enter Current Password");
		addProductNotice('Please Enter Current Password','','','error');
		return false;
	}


	if ($('#change-input-password').val() == '' || $('#change-input-password').val() == null) {
		// alert("Please Enter New Password");
		addProductNotice('Please Enter New Password','','','error');
		return false;
	}

	if ($('#change-input-password').val().length &lt; 6) {
		// alert("Confirm Password");
		addProductNotice('New password should be at least 6 characters long','','','error');
		return false;
	}


	if ($('#change-input-confirm').val() == '' || $('#change-input-confirm').val() == null) {
		// alert("Please Enter Confirm Password");
		addProductNotice('Please Enter Confirm Password','','','error');
		return false;
	}

	if ($('#change-input-password').val() != $('#change-input-confirm').val()) {
		// alert("New Password and Confirm Password not matched");
		addProductNotice('New Password and Confirm Password not matched','','','error');
		return "false";
	}

	$.ajax({
		type: "POST",
		url: baseurl + 'home/change_passwordss',
		data: {
			OLD_PASSWORD: $('#change-input-old-password').val(),
			NEW_PASSWORD: $('#change-input-password').val()
		},
		dataType: "json",
		beforeSend: function (xhr, settings) { },
		success: function (result) {

			if (result.status == 200) {
				// alert(result.message);
				// alert('Success');
				// window.location.href = baseurl;

				addProductNotice('Password Change Successfully.', '', '', 'success');

				// alert(result.message);
				setTimeout(function () { /* show the alert for 3sec and then reload the page. */
				window.location.reload();
				}, 3000);
			} else {
				// alert(result.message);
				// alert('Failed');

				addProductNotice('Old Password Does Not Match.', '', '', 'error');

				// alert(result.message);
				// setTimeout(function () { /* show the alert for 3sec and then reload the page. */
				// window.location.reload();
				// }, 4000);
			}
		},
		error: function (jqXHR, textStatus, errorThrown) {

		},
		complete: function (xhr, status) {

		}

	});

	return false;
});



$(document).on("click submit", '.forgot_passwordss', function () {

	var random_key = $('#random-key').val(); 

	if ($('#change-input-password').val() == '' || $('#change-input-password').val() == null) {
		// alert("Please Enter New Password");
		addProductNotice('Please Enter New Password','','','error');
		return false;
	}

	if ($('#change-input-password').val().length &lt; 6) {
		addProductNotice('New password','','New password should be at least 6 characters long','error');
		return false;
	}


	if ($('#change-input-confirm').val() == '' || $('#change-input-confirm').val() == null) {
		// alert("Please Enter Confirm Password");
		addProductNotice('Please Enter Confirm Password','','','error');
		return false;
	}

	if ($('#change-input-password').val() != $('#change-input-confirm').val()) {
		addProductNotice('New Password','','New Password and Confirm Password not matched','error');
		return "false";
	}

	$.ajax({
		type: "POST",
		url: baseurl + 'home/change_set_password',
		data: {
			NEW_PASSWORD: $('#change-input-password').val(),
			CONF_PASSWORD: $('#change-input-confirm').val(),
			RANDOM_KEY: random_key
		},
		dataType: "json",
		beforeSend: function (xhr, settings) { },
		success: function (result) {

			if (result.status == 200) {
				// alert(result.message);
				// alert('Success');
				// window.location.href = baseurl;

				addProductNotice('Password', '', 'Password Change Successfully.', 'success');

				// alert(result.message);
				setTimeout(function () { /* show the alert for 3sec and then reload the page. */
				window.location.reload();
				}, 3000);
			} else {
				// alert(result.message);
				// alert('Failed');

				addProductNotice('Old Password', '', 'Old Password Dose Not Match', 'error');

				// alert(result.message);
				// setTimeout(function () { /* show the alert for 3sec and then reload the page. */
				// window.location.reload();
				// }, 4000);
			}
		},
		error: function (jqXHR, textStatus, errorThrown) {

		},
		complete: function (xhr, status) {

		}

	});

	return false;
});


$(document).on('click submit', '.customer-login', function () {

	if ($('#input-cutomer-email').val() == '' || $('#input-cutomer-email').val() == null) {
		// alert("Please Enter Email");
		addProductNotice('Please Enter Email', '', '', 'error');
		return false;
	}

	var email = $('#input-cutomer-email').val();
    var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	
	if (reg.test(email) == false) 
	{
		// alert('Invalid Email Address');
		addProductNotice('Invalid Email Address', '', '', 'error');
		return false;
	}

	// if ($('#input-customer-mobile').val().length != 10) {
	// 	alert("Please Enter 10 Digit Mobile No.");
	// 	return false;
	// }

	if ($('#input-customer-pwd').val() == '' || $('#input-customer-pwd').val() == null) {
		// alert("Please Enter Password");
		addProductNotice('Please Enter Password', '', '', 'error');
		return false;
	}
	// $('.apply_pincode_check').click();
	$.ajax({
		type: "POST",
		url: baseurl + 'login/customer_session',
		data: {
			EMAIL: $('#input-cutomer-email').val(),
			PASSWORD: $('#input-customer-pwd').val(),
			LOGIN_TYPE: 2
		},
		dataType: "json",
		success: function (result) {
			//alert(print_r(result));
			if (result.status == 200) {

				// addProductNotice('Login Successfully','','');
				// alert('123')

				session_update(result.data[0].ID);
				if ($('#exampleModal').attr('data-login-first') == '2') {
					$('.close').click();



					// alert($('#exampleModal').attr('data-login-first'));

					$('#exampleModal').attr('data-login-first', '1');
					// alert('123');


					setTimeout(function () { /* show the alert for 3sec and then reload the page. */
						location.reload();
					}, 1000);

					$('.apply_pincode_check').click();

				} else if ($('#exampleModal').attr('data-login-first') == '3') {
					$('.close').click();
					$('#exampleModal').attr('data-login-first', '1');
					add_to_wish_list();
				} else if ($('#exampleModal').attr('data-login-first') == '4') {
					$('.close').click();
					$('#exampleModal').attr('data-login-first', '1');
					add_to_compare_list();
				} else {
					setTimeout(function () {
						window.location.reload();
					}, 100);
				}

			} else {
				// alert(result.message);

				addProductNotice('Login','','Invalid Email ID or Password','error');
			}
		}
	});
});

$(document).on('click', '.customer-otp', function () {

	if ($('#input-mobile').val() == '' || $('#input-mobile').val() == null) {
		alert("Please Enter Mobile No.");
		return false;
	}
	if ($('#input-mobile').val().length != 10) {
		alert("Please Enter 10 Digit Mobile No.");
		return false;
	}

	$.ajax({
		type: "POST",
		url: apiurl + 'app/jqry/customer_send_otp',
		data: JSON.stringify({
			MOBILE: $('#input-mobile').val(),
			LOGIN_TYPE: 2
		}),
		dataType: "json",
		success: function (result) {

			if (result.status == 400) {
				alert(result.message);
			} else {
				$('#input-otp').val('').focus();
			}
		}
	});
});



function add_to_wish_list() {
	var loginid = app_session.LOGIN_ID;
	// alert(loginid);
	if (loginid != '') {
		$.ajax({
			type: "POST",
			url: baseurl + 'home/add_wish_list',
			data: {
				id: product_wish_list_data_id
			},
			dataType: "json",
			success: function (result) {

				if (result.status != 400) {

					var url_redirect = baseurl + 'home/customer_wish_list';


					addProductNotice('&lt;a href="' + url_redirect + '"&gt;Product added to Wish List&lt;/a&gt;', '', '&lt;a href="' + url_redirect + '"&gt;&lt;h3&gt;' + product_wish_list_data_name + '&lt;/h3&gt;&lt;/a&gt;', 'success');

					setTimeout(function () {
						window.location.reload();
					}, 100);

				} else {
					alert(result.message);
				}
			}
		});
	} else {

		$('#login_modal').attr('data-login-first', '3');
		$('.all_page_login').first().click();
	}
}

function add_to_compare_list() {
	var loginid = app_session.LOGIN_ID;

	if (loginid != '') {
		if (compare_list_data_id != '') {
			$.ajax({
				type: "POST",
				url: baseurl + 'home/add_product_compare',
				data: {
					id: compare_list_data_id
				},
				dataType: "json",
				success: function (result) {
					console.log(result);
					if (result.status == 200) {
						var url_redirect = baseurl + 'home/product_compare';

						addProductNotice('&lt;a href="' + url_redirect + '"&gt;Product added to Compare List&lt;/a&gt;', '', '&lt;a href="' + url_redirect + '"&gt;&lt;h3&gt;' + compare_list_data_name + '&lt;/h3&gt;&lt;/a&gt;', 'success');

						setTimeout(function () {
							window.location.reload();
						}, 100);
					}
					if (result.status == 400) {
						addProductNotice('', '', '&lt;h3&gt;' + result.message + '&lt;/h3&gt;', 'success');
						// window.location.reload();
					}

				}
			});
		}
	} else {

		$('#login_modal').attr('data-login-first', '4');
		$('.all_page_login').first().click();
	}
}


$('.hide_quantity').click(function () {

	var $ch_valss = $('.quantitys').val() == '' ? 0 : parseInt($('.quantitys').val());

	$('.quantityss').val($ch_valss);

});


function cheng_qty($this) {

	setTimeout(function () {
		var $ch_row = parseInt($($this).attr('data-check-qty'));
		// alert($ch_row);
		var $ch_val = $('.bind_qty').val() == '' ? 0 : parseInt($('.bind_qty').val());

		// alert($ch_val);


		$('.qty_val').val($ch_vals);

		if ($ch_row &gt; $ch_val) {

			//alert($ch_val);
			alert("Please Enter Minimum " + $ch_row + " Quantity");
			$('.bind_qty').val($ch_row);
		}
	}, 1000);

}

$('.get_total_qty').click(function () {



	var $this = $(this).closest('div');
	var total_qty = $('.bind_qty').val() == '' ? 0 : parseInt($('.bind_qty').val());

	// alert(total_qty);

	$('.total_quantity').val(total_qty);



});

$(document).on('click', '.order_cancel_by_customer', function () {

	if (confirm('Are You Sure Cancel This Order')) {

		// alert('Success4567891230');

		var REASON_FOR_CANCEL_ID = $('#REASON_FOR_CANCEL_ID').val();
		var CANCEL_MESSAGE = $('#CANCEL_MESSAGE').val();
		var order_update_id = $('#order_update_id').val();

		if (order_update_id != '' &amp;&amp; order_update_id != 'undefined') {

			$.ajax({
				type: "POST",
				url: baseurl + 'home/order_cancel',
				data: {
					REASON_FOR_CANCEL_ID: REASON_FOR_CANCEL_ID,
					CANCEL_MESSAGE: CANCEL_MESSAGE,
					OB_PRODUCT_ID: order_update_id,
					LOGIN_TYPE: 2
				},
				dataType: "json",
				success: function (result) {


					// alert(result.message);
					if (result.status == 200) {
						window.location.href = baseurl + 'home/order_list';
					}
				}
			});
		}
	}

});


$(document).on('click', '.Order_cancelModal', function () {
	// alert("dszzsdsdssssssssssssssssssssssssss");
	console.log($(this).attr('data-update-id'));
	$('#order_update_id').val($(this).attr('data-update-id'));

});

$(document).on('click', '.order_return', function () {
	$('#order_return_form')[0].reset();
	// console.log($(this).attr('data-update-id'));
	$('#order_return_id').val($(this).attr('data-update-id'));

	// console.log($('#order_return_id').val($(this).attr('data-update-id')))
});

// $('.cancelled_order').click(function () {

// 	var tracking_order_id = $('.tracking_order_id').val();

// 	$('.hidden_order_id').val(tracking_order_id);

// });

// $('.cancelled_orderss').click(function () {

// 	var $this = $(this).closest('div');


// 	var tracking_order_id = $this.find('.tracking_order_id').val();

// 	//alert(tracking_order_id);

// 	$('.hidden_order_id').val(tracking_order_id);

// });


function razorpay(data) {
	// Checkout details as a json
	var options = data;

	/**
	 * The entire list of Checkout fields is available at
	 * https://docs.razorpay.com/docs/checkout-form#checkout-fields
	 */
	options.handler = function (response) {
		document.getElementById('razorpay_payment_id').value = response.razorpay_payment_id;
		document.getElementById('razorpay_signature').value = response.razorpay_signature;
		document.razorpayform.submit();
	};

	// Boolean whether to show image inside a white frame. (default: true)
	options.theme.image_padding = false;

	options.modal = {
		ondismiss: function () {
			localStorage.setItem("shortCutFunction", "error");
			localStorage.setItem("title", "");
			localStorage.setItem("msg", "Payment Failed.");
			location.reload();
			console.log("This code runs when the popup is closed");
		},
		// Boolean indicating whether pressing escape key
		// should close the checkout form. (default: true)
		escape: true,
		// Boolean indicating whether clicking translucent blank
		// space outside checkout form should close the form. (default: false)
		backdropclose: false
	};

	var rzp = new Razorpay(options);

	rzp.open();
}

// $('.get_quantity').click(function () {

// 	alert('hello');

// 	var qty_no = $('.qty_no').val();
// 	alert(qty_no)
// 	var hidden_price = $('.hidden_price').val();

// 	// alert(qty_no);
// 	// var directory_price = $this.find('.directory_price').val();
// 	// var directory_title = $this.find('.directory_title').val();
// 	// // alert(directory_title);
// 	// $('.directory_pricing').text(directory_price);
// 	$('.qty_noss').text(qty_no);
// 	$('.hidden_prices').text(hidden_price);
// 	// $('.directory_pricing').val(directory_price);

// });

// function increaseValue() {

// 	var value = parseInt($('#quantity').val());
// 	var p = parseInt($('.princeee').attr('data-amount'));

// 	alert(p);

// 	var tot_qty = value + 1;
// 	var to = tot_qty * p;

// 	$('quantity').val(tot_qty);
// 	$('#product-price').text('â‚¹' + to);
// 	$('#product-detail-price').text('â‚¹' + to);
// 	$('#total-product-price').text('â‚¹' + to);

// }

// function decreaseValue() {

// 	var value = parseInt($('#quantity').val());
// 	var p = parseInt($('.princeee').attr('data-amount'));

// 	var tot_qty = value - 1;
// 	var to = tot_qty * p;

// 	$('quantity').val(tot_qty);
// 	$('#product-price').text('â‚¹' + to);
// 	$('#product-detail-price').text('â‚¹' + to);
// 	$('#total-product-price').text('â‚¹' + to);

// }
// decreaseValue

function increaseValue() {

	var $this = $(this).closest('td');
	var price = $this.find('.princeeesss').attr('data-amount');

	// alert(price);


	var value = parseInt($('#quantity').val());
	var p = parseInt($('.princeee').attr('data-amount'));

	var tot_qty = value + 1;
	var to = tot_qty * p;

	$('quantity').val(tot_qty);
	$('#product-price').text('â‚¹' + to);
	$('#product-detail-price').text('â‚¹' + to);
	$('#total-product-price').text('â‚¹' + to);

}

function decreaseValue() {

	var value = parseInt($('#quantity').val());
	var p = parseInt($('.princeee').attr('data-amount'));
	var min = parseInt(($('#quantity').attr('min')));

	var tot_qty = value - 1;

	if (tot_qty &gt;= min &amp;&amp; value &gt;= min) {
		// alert(tot_qty);
		var to = tot_qty * p;

		$('quantity').val(tot_qty);
		$('#product-price').text('â‚¹' + to);
		$('#product-detail-price').text('â‚¹' + to);
		$('#total-product-price').text('â‚¹' + to);
	}

}


function decreaseValueget($this) {
	var $row = $this.closest('tr');

	var value = $row.find('.bind_qty').val();
	var p = $row.find('.princeee').attr('data-amount');
	var min = parseInt($($this).attr('data-check-qty'));
	var tot_qty = value - 1;

	var SHIPPING_CHARGE = $('.SHIPPING_CHARGE').val();
	var COUPONCODE = $('.COUPONCODE').val();
	var COUPONCODE_TYPE = $('.COUPONCODE_TYPE').val();
	// var DISCOUNT_MRP_AMOUNT = $('.DISCOUNT_MRP_AMOUNT').val();
	var DISCOUNT_MRP_AMOUNT = 0;

	if (tot_qty &gt;= min &amp;&amp; value &gt;= min) {
		var to = tot_qty * p;
		$row.find('.bind_qty').val(tot_qty);
		$row.find('.TOTAL_QTY_PRICE').val(to);
		$row.find('.TOTAL_QTY_PRICE_TEXT').text('â‚¹ ' + to);

		var total = 0;
		$('.TOTAL_QTY_PRICE').each(function () {
			total += +$(this).val();
		});

		$('#product-price').text('â‚¹ ' + total);
		$('#hidden-product-price').val(total);
		$('#hidden-product-qty').val(tot_qty);

		var dis = 0;
		if (COUPONCODE != '') {
			if (COUPONCODE_TYPE == '1') {
				dis = COUPONCODE;
			}

			if (COUPONCODE_TYPE == '2') {
				dis = (Math.round(COUPONCODE * total / 100)).toFixed(2);
			}
		}

		var MAIN_TOTAL = (parseFloat(total) + parseFloat(SHIPPING_CHARGE)) - (parseFloat(dis) + parseFloat(DISCOUNT_MRP_AMOUNT));

		$('.COUPONCODE_AMOUNT_TEXT').text('â‚¹ ' + dis);
		$('.COUPONCODE_AMOUNT').val(dis);
		$('#total-product-price').text(MAIN_TOTAL);
	}

}

$(document).on('keyup click', '.decreaseValue', function () {
	decreaseValueget($(this));
});


function increaseValueget($this) {
	var $row = $this.closest('tr');

	var value = $row.find('.bind_qty').val();
	var p = $row.find('.princeee').attr('data-amount');
	var min = parseInt($($this).attr('data-check-qty'));
	var tot_qty = parseFloat(value) + 1;

	var SHIPPING_CHARGE = $('.SHIPPING_CHARGE').val();
	var COUPONCODE = $('.COUPONCODE').val();
	var COUPONCODE_TYPE = $('.COUPONCODE_TYPE').val();
	// var DISCOUNT_MRP_AMOUNT = $('.DISCOUNT_MRP_AMOUNT').val();
	var DISCOUNT_MRP_AMOUNT = 0;


	if (tot_qty &gt;= min &amp;&amp; value &gt;= min) {
		var to = tot_qty * p;
		$row.find('.bind_qty').val(tot_qty);
		$row.find('.TOTAL_QTY_PRICE').val(to);
		$row.find('.TOTAL_QTY_PRICE_TEXT').text('â‚¹ ' + to);

		var total = 0;
		$('.TOTAL_QTY_PRICE').each(function () {
			total += +$(this).val();
		});

		$('#product-price').text('â‚¹ ' + total);
		$('#hidden-product-price').val(total);
		$('#hidden-product-qty').val(tot_qty);

		var dis = 0;
		if (COUPONCODE != '') {
			if (COUPONCODE_TYPE == '1') {
				dis = COUPONCODE;
			}

			if (COUPONCODE_TYPE == '2') {
				dis = (Math.round(COUPONCODE * total / 100)).toFixed(2);
			}
		}

		var MAIN_TOTAL = (parseFloat(total) + parseFloat(SHIPPING_CHARGE)) - (parseFloat(dis) + parseFloat(DISCOUNT_MRP_AMOUNT));

		$('.COUPONCODE_AMOUNT_TEXT').text('â‚¹ ' + dis);
		$('.COUPONCODE_AMOUNT').val(dis);
		$('#total-product-price').text(MAIN_TOTAL);

	}


	// alert(total);
}

$(document).on('keyup click', '.increaseValue', function () {
	increaseValueget($(this));
});

function details_decreaseValueget($this) {
	// var $row = $this.closest('tr');

	var value = parseInt($('.bind_qty').val());
	var p = parseInt($('.princeee').attr('data-amount'));
	var min = parseInt($($this).attr('data-check-qty'));
	var tot_qty = parseFloat(value) - 1;



	if (tot_qty &gt;= min &amp;&amp; value &gt;= min) {
		var to = tot_qty * p;
		$('.bind_qty').val(tot_qty);
		$('.total_p_price').text('â‚¹ ' + to);

		$('#hidden-product-quantity').val(tot_qty);
	}

}

$(document).on('keyup click', '.details_decreaseValue', function () {
	details_decreaseValueget($(this));
});

function details_increaseValueget($this) {
	// var $row = $this.closest('tr');

	var value = parseInt($('.bind_qty').val());
	var p = parseInt($('.princeee').attr('data-amount'));
	var min = parseInt($($this).attr('data-check-qty'));
	var tot_qty = parseFloat(value) + 1;


	if (tot_qty &gt;= min &amp;&amp; value &gt;= min) {
		var to = tot_qty * p;
		$('.bind_qty').val(tot_qty);
		$('.total_p_price').text('â‚¹ ' + to);
		$('#hidden-product-quantity').val(tot_qty);
		// $('#dddd').attr('data-ddd',tot_qty);
	}

	// alert(tot_qty);

}

$(document).on('keyup click', '.details_increaseValue', function () {
	details_increaseValueget($(this));
});

var product_cart_name;
var product_cart_id;
$(document).on('click', '.increase,.decrease', function () {

	product_wish_list_data_id = $(this).attr("data-cart");

	var $row = '.WISH_QTY_' + product_wish_list_data_id; 
	product_wish_list_data_qty = $($row).val();

	// alert(product_wish_list_data_qty);

	
		$.ajax({
			type: "POST",
			url: baseurl + 'home/cart_qty_update',
			data: {
				id: product_wish_list_data_id,
				qty: product_wish_list_data_qty

			},
			dataType: "json",
			success: function (result) {
				console.log(result);
				// $('.cart_body').load(baseurl + 'home/load_cart');
				// // $('#cart').addClass('open');

				// var alert = `&lt;div class="alert alert-dismissable" style="background-color:green;color:white;padding:1%; " align="center"&gt;
				// &lt;button type="button" class="close" data- dismiss="alert" aria-hidden="true"&gt;Ã—&lt;/button&gt;Product Cart Remove Successfully&lt;/div&gt;`;
				// $('.alert-container').html(alert); /* alert container class ".alert-container" */
				// setTimeout(function () { /* show the alert for 3sec and then reload the page. */
				// 	location.reload();
				// }, 1000);


				//window.location.reload();
			}
		});

});



function uploadFiles() {

	// alert('123');
	var formData = new FormData($('#uploadForm')[0]);

	alert(formData);

	$.ajax({
		url: baseurl + 'home/upload_files',
		type: 'POST',
		data: formData,
		contentType: false,
		processData: false,
		success: function(response) {
			displayResult(response);
		},
		error: function() {
			Swal.fire('Error', 'Failed to upload files', 'error');
		}
	});
}

function displayResult(response) {
	var outputDiv = $('#output');
	outputDiv.html('');

	if (response.success) {
		$.each(response.files, function(index, file) {
			outputDiv.append('&lt;p&gt;' + file.name + ' - ' + file.base64 + '&lt;/p&gt;');
		});
	} else {
		Swal.fire('Error', response.message, 'error');
	}
}


function myFunction() {
	var x = document.getElementsByClassName('myInput')[0];
	if (x.type === "password") {
	  x.type = "text";
	  $('.show_eyes').show();
	  $('.hide_show_eyes').hide()
	} else {
	  x.type = "password";
	  $('.show_eyes').hide();
	  $('.hide_show_eyes').show()
	}
  }


  function myFunction2() {
	var x = document.getElementsByClassName('myInput2')[0];
	if (x.type === "password") {
	  x.type = "text";
	  $('.show_eyes1').show();
	  $('.hide_show_eyes1').hide()
	} else {
	  x.type = "password";
	  $('.show_eyes1').hide();
	  $('.hide_show_eyes1').show()
	}
  }









</pre></body></html>