var isbsmodvisible = false;
function hasLowerCase(str) {
    return (/[a-z]/.test(str));
}
function hasUpperCase(str) {
    return (/[A-Z]/.test(str));
}
function hasNumber(str) {
    return (/[0-9]/.test(str));
}
function detectMob() {
    const toMatch = [
        /Android/i,
        /webOS/i,
        /iPhone/i,
        /iPad/i,
        /iPod/i,
        /BlackBerry/i,
        /Windows Phone/i
    ];

    return toMatch.some((toMatchItem) => {
        return navigator.userAgent.match(toMatchItem);
    });
}
function ajusteazaCentrareVerticalaModal() {
  var modaleDeschise = document.querySelectorAll(
    ".modal.show .modal-dialog-centered"
  );
  modaleDeschise.forEach(function (dialog) {
    // Obține dimensiunile modalei și fereastra vizualizării
    var modalHeight = dialog.offsetHeight;
    var windowHeight = window.innerHeight;
	//console.log("mh:"+modalHeight);
	//console.log("wh:"+windowHeight);
    // Calculează distanța la marginea de sus a modalei
    var topDistance = (windowHeight - modalHeight) / 2;
	console.log("tD:"+topDistance);
    // Ajustează centrarea verticală dacă nu este corectă

	console.log("needs centering");
	dialog.style.marginTop = "0";
	dialog.style.transform = "translateY(" + Math.abs(topDistance) + "px)";
    
  });
}
$.fn.modal.Constructor.prototype._enforceFocus = function() {};
function docopylink(tocopy,evt) {
	
	let textmessage = $('#copylink1').data('msgok');
	const el = document.createElement('textarea');
    el.value = tocopy;
	console.log(el.value);
    document.getElementById('copylink1').appendChild(el);
    el.focus();
    if (el.setSelectionRange) {
      el.setSelectionRange(0, el.value.length);
    } else {
      el.select();
    }
    document.execCommand('copy');
    document.getElementById('copylink1').removeChild(el);
	swal('',textmessage,'success');
	evt.preventDefault();
}
var currentu = lasturlofpage = '';
function callchangeurl(name,url) {
	//currentu = window.location.pathname;
	url = url.replace('/','');
	window.history.pushState("", name, '/'+url);
	gtag('event', 'CLICK LOT', {
		'event_category': 'VIEW LOT PAGE',
		'event_label': 'LOT PAGE ' + name,
		'title':'LOT PAGE '+url,
		'link': url
	  });		
}
function openNLogged(id,t) {
	if(t == 0) {
		$.post('/act.php?act=loadlotpagenl',{
			id:id
		},function(rez){
			$('#bottom_order2_content').html('');
			$('#bottom_order2x_content').html(rez);
			$('#viewmyprod2').modal('show');
		},"html");
	} else {
		$.post('/act.php?act=loadlotpage',{
			id:id
		},function(rez){
			$('#bottom_order2_content').html('');
			$('#bottom_order2x_content').html(rez);
			$('#viewmyprod2').modal('show');
		},"html");
	}
}

function analiticsNomad(event) {
	// Verifică existența variabilelor
	if (!event || !event.target) {
	  console.error("Evenimentul sau ținta evenimentului nu este validă.");
	  return;
	}
  
	// Obține elementele DOM și variabilele importante
	const element = $(event.target);
	const id = element.prop('id');
	const cls = element.prop('class');
	const mod = element.data('toggle');
	const target = element.data('target');
	const parentdph = element.parent().hasClass('tprods_np');
	const act = event.type + " on link";

	
  
	// Trimite evenimente specifice în funcție de tipul de element
	if (mod != undefined) {
	  switch (target) {
		case '#connexion_box':
		  gtag('event', "LOGIN", {
			'event_category': 'LOGIN',
			'event_action': event.type,
			'event_label': act + " login button home page top",
			'title': 'CONTACT',
		  });
		  break;
		case '#contactForm':
		  let extra;
		  if (id == 'contact_ws') {
			extra = " home page top";
		  } else if (id == 'mycontact') {
			extra = " floating envelope button";
		  }
		  gtag('event', "CONTACT", {
			'event_category': 'CONTACT',
			'event_action': event.type,
			'event_label': act + " contact button" + extra,
			'title': 'CONTACT',
		  });
		  break;
	  }
	} else {
	  if (id == 'register_new') {
		gtag('event', "REGISTER", {
		  'event_category': 'Register',
		  'event_action': event.type,
		  'event_label': act + " register button home page bottom",
		  'title': 'REGISTER',
		});
	  }
	  if (cls == 'register') {
		gtag('event', "REGISTER", {
		  'event_category': 'Register',
		  'event_action': event.type,
		  'event_label': act + " register button home page top",
		  'title': 'REGISTER',
		});
	  }
  
	  
	  if (parentdph) {
		const pname = $(this).html();
		gtag('event', "IN ONE LOOK", {
		  'event_category': 'In one look',
		  'event_action': event.type,
		  'event_label': pname,
		  'title': 'In one look ' + event.type + ' ' + pname,
		});
	  }
	}
}



var ispassok = false;
$(document).ready(function(e) {
    $('#screen1,#screen2,#screen3,#screen4,#footer').width($(window).width()-20);
	$('#screen1,#screen2').height($(window).height());
	$('#screen3').css('min-height',$(window).height());
	if($('#screen1').hasClass('renting_reg')) {
		$('#screen1').css('height','auto');
		$('#screen1').css('min-height',$(window).height());
	}
	$(window).resize(function(e) {
        $('#screen1,#screen2,#screen3,#screen4,#footer').width($(window).width()-20);
		$('#screen1,#screen2').height($(window).height());
		$('#screen3').css('min-height',$(window).height());
    });

	$('body').on('click','.contact_seller_login',function(e) {
		e.preventDefault();
		$('#connexion_box').modal('show');
	});

	$('body').on('click','.callnoprod_found',function(e) {
		e.preventDefault();
		var idtoshow = $(this).parent().parent().prop('id');
		var elsearch = $(this).data('ssfind');
		if(idtoshow == 'myproducts_grid') {
			$('#searchprodss').html(elsearch);
			$('#searchpword').val(elsearch);
			$('#modal_principal_req').modal('show');
		} else {
			$('#searchprodss2').html(elsearch);
			$('#searchpword2').val(elsearch);
			$('#modal_secondary_req').modal('show');
		}
	});

	var hash = window.location.hash;
	//console.log(window.islin);
	if (hash === '#connexion_box') {
		$('#connexion_box').modal('show');
	}

	$('body').on('click','#sendarequestform2,#sendarequestform',function(e) {
		var elid= $(this).prop('id');
		var name = $('#reqnom').val();
		var email = $('#reqemailr').val();
		var msg = $('#reqmsgr').val();
		var word = $('#searchpword').val();
		if(elid == 'sendarequestform2') {
			name = $('#reqnom2').val();
			email = $('#reqemailr2').val();
			msg = $('#reqmsgr2').val();
			word = $('#searchpword2').val();
		}

		$.post('/act.php?act=requestprod',{name,email,msg,word},function(rez) {
			if(rez.result == "ok") {
				swal({title:rez.msg, type: "success"});
				if(elid == 'sendarequestform2') {
					$('#reqnom2').val('');$('#reqemailr2').val('');$('#reqmsgr2').val('');
					$('#modal_secondary_req').modal('hide');
				} else {
					$('#reqnom').val('');$('#reqemailr').val('');$('#reqmsgr').val('');
					$('#modal_principal_req').modal('hide');
				}
			} else {
				swal({title:rez.msg, type: "error"});
			}
		},'json');

	});

	let isll = 0;
	$('#rightuser a').each(function(){
		var a_href = $(this).attr('href');
		if(a_href == "logout.php"){
			isll = 1;
		}
	});
	if(isll == 0) {
		$('#viewmyprod2,#viewmyprod').on('hidden.bs.modal', function (e) {
			$('.zoomContainer').remove();
			if($('#product_search_box').is(':visible')) {
				$('body').addClass('modal-open');
			}
			if(lasturlofpage == '') lasturlofpage = '/';
			callchangeurl("",lasturlofpage);
			//console.log('ind-vp+vp2');
		});
	}
	$('#modal_principal_req,#modal_secondary_req').on('hidden.bs.modal', function (e) {
		if($('#product_search_box').is(':visible') || $('#myproj_psearch').is(':visible')) {
			$('body').addClass('modal-open');
		}
	});

	$('a').on('click mouseover', analiticsNomad);

  	$('.register').on('click mouseover', analiticsNomad);

	var template = $(".address_principal").clone();
	var created = 0;
	$("body").on("click","#newaddr",function(e){
		//e.preventDefault();
		//console.log($(".address_div:last-child").data('id'));
		var newidx = ((created > 0) ? parseInt($("#newaddr"+created).data('id')) : parseInt($(".address_div").last().data('id')));
		var newid = parseInt(newidx)+1;
		var section = template.clone();
		section.data('id',newid).prop('id','newaddr'+newid).find('h3').html(section.find('h3').text() + ' #' + newid);
		var newrema = '<a href="javascript:void(0);" class="removeaddr" data-id="newaddr'+newid+'"></a>';
		//$(newrema).insert
		$(section).find('label').each(function(index, element) {
            var fattr = $(this).attr('for');
			$(this).prop("for",fattr+newid);
        });
		$(section).find('input').each(function(index, element) {
            var fattr2 = $(this).attr('id');
			$(this).prop("id",fattr2+newid).val('');;
        });
		
		$(section).insertBefore('.rightborderdiv3');
		$(newrema).insertAfter($('#newaddr'+newid+' h3'));
		created = newid;
		
		/*$(elem).insertAfter(".address_div:last-child");
		*/
	});
	
	$("body").on("submit","#register_rent",function(e){
		if(ispassok) {
			return true;	
		} else return false;
	});
	
	$('body').on('click','.removeaddr',function(){
		var elem = $(this).data('id');
		$('#'+elem).remove();
		created--;
	});
	$('#lal').on('closed.bs.alert', function () {
	  $('#hidden_box').hide();
	});
	$('body').on('submit','#login_form',function(e){
		e.preventDefault();
		var em = $('#user').val();
		var pas = $('#pass').val();
		var mid = $('#microid').val();
		var rmb = $("#remember").is(':checked');
		$.post('/act.php?act=signin',{email:em,pass:pas,uses:mid,rmb:rmb},function(rez){
			if(rez.result == 'ok') {
				if(rez.atip == 'user') window.location.href = 'index.php';
				else window.location.href = 'atr.php';
			} else {
				$('#hidden_box').html('<div class="alert alert-'+rez.result+'" id="lal" role="alert">'+rez.msg+'<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button></div>').show();	
			}
		},'json');
		
	});
	$('body').on('keyup','#admin_pass',function(){
		var p = $(this).val();
		if(p.length >= 7) $('#sevench').addClass('okicn').removeClass('badicn');
		else $('#sevench').addClass('badicn').removeClass('okicn');
		if (hasNumber(p)) {
			$('#onenum').addClass('okicn').removeClass('badicn');
		} else {
			$('#onenum').addClass('badicn').removeClass('okicn');
		}
		
		if (hasLowerCase(p)) {
			$('#onelow').addClass('okicn').removeClass('badicn');
		} else {
			$('#onelow').addClass('badicn').removeClass('okicn');
		}
		
		if (hasUpperCase(p)) {
			$('#oneup').addClass('okicn').removeClass('badicn');
		} else {
			$('#oneup').addClass('badicn').removeClass('okicn');
		}
		
		if(p.length == 0) {
			$('#oneup').addClass('badicn').removeClass('okicn');
			$('#onelow').addClass('badicn').removeClass('okicn');
			$('#onenum').addClass('badicn').removeClass('okicn');
			$('#sevench').addClass('badicn').removeClass('okicn');
		}
		
		if(p.length >= 7 && hasNumber(p) && hasUpperCase(p) && hasLowerCase(p)) {
			ispassok = true;
		} else {
			ispassok = false;
		}
		
	});
	$(document).on('hide.bs.modal','.modal', function () {
		if($(this).find('.big_pic').length !== 0) {
			$('.big_pic').find('iframe').remove();
		}
	});
	$("body").on("click",".opic",function(e) {
		e.preventDefault();
		//$(this).addClass('sel');
		var pic = $(this).data('img');
		var bpic = $(this).data('bimg');
		var ytbe = $(this).data('ytbe');
		if(pic != '') {
			//console.log(2);
			var chh = $('.big_pic').height();

			$('.big_pic').attr('style','background-image:url('+pic+');');//'<img id="zoom_mw" src="'+pic+'" data-fancybox="images" href="'+bpic+'">');

				$('.big_pic').off('click');
				$('.big_pic').on('click',function(){
					$.fancybox.open([{ src  : bpic } ]);
				});
			
		}
		if(ytbe != '' && pic == '' && ytbe != 'undefined') {
			$('.big_pic').off('click');
			$('.big_pic').attr('style','background-image: none;');
			$('.big_pic').html('<iframe width="100%" height="100%" style="min-height:330px;" src="https://www.youtube.com/embed/'+ytbe+'" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>');
			$.fancybox.destroy();
		}
	});

	$('body').on('click','#sendacontactform',function(e){
			var msg_error = $('#sendacontactform').data("msg");
			var nom = $("#settovalidate #nom").val();
			var email = $("#settovalidate #emailc").val();
			var equipe = $("#settovalidate #equipe").val();
			var subj = $("#settovalidate #subj").val();
			var msg = $("#settovalidate #msg").val();
			
			if(nom != '' && email != '' && equipe != '' && subj != '' && msg != ''){
				$.post('/act.php?act=sendformc',{nom:nom,email:email,equipe:equipe,subj:subj,msg:msg},function(rezult){
					if(rezult.rez == "ok") {
						swal({title:rezult.msg, type: "success"}).then((result) => {
							$("#settovalidate #nom").val('');$("#settovalidate #emailc").val('');$("#settovalidate #equipe").val('');$("#settovalidate #subj").val('');$("#settovalidate #msg").val('');
							$('#contactForm').modal('hide');
						});
					} else {
						swal({title:rezult.msg, type: "error"});
					}
				},"json");
			} else {
				swal({title:msg_error, type: "error"});
			}
	});
	
	$(window).scroll();
	// Select all links with hashes
	$('a[href*="#"]')
	  // Remove links that don't actually link to anything
	  .not('[href="#"]')
	  .not('[href="#0"]')
	  .click(function(event) {
		// On-page links
		if (
		  location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') 
		  && 
		  location.hostname == this.hostname
		) {
		  // Figure out element to scroll to
		  var target = $(this.hash);
		  target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
		  // Does a scroll target exist?
		  if (target.length) {
			// Only prevent default if animation is actually gonna happen
			event.preventDefault();
			$('html, body').animate({
			  scrollTop: target.offset().top
			}, 1000, function() {
			  // Callback after animation
			  // Must change focus!
			  var $target = $(target);
			  $target.focus();
			  if ($target.is(":focus")) { // Checking if the target was focused
				return false;
			  } else {
				$target.attr('tabindex','-1'); // Adding tabindex for elements not focusable
				$target.focus(); // Set focus again
			  };
			});
		  }
		}
  	});
	  $('body').on('click','.share_lot',function(e){
		var id = $(this).data('id');
		if(id > 0) {
			$.post('/act.php?act=getlotshare',{plotid:id},function(rez){
					if(rez.result == 'ok') {
						$('#plot_share').html(rez.htm);
						$('#shareplot').modal('show');

					} else {
						swal('',rez.msg,'error');
					}
			},'json');


		}
	});
	$("body").on("shown.bs.modal", ".modal", function () {
    	ajusteazaCentrareVerticalaModal();
  	});


	$('#searchinprods2').on('keypress', function(e) {
		if (e.which === 13) {
			const searchTerm = $(this).val();
			gtag('event', "SEARCH", {
			'event_category': 'Search',
			'event_action': 'Search Bar',
			'event_label': searchTerm,
			});
		}
	});
	$('#dosearchprods').on('click', function(e) {
		const searchTerm = $("#searchinprods2").val();
		gtag('event', "SEARCH", {
		'event_category': 'Search',
		'event_action': 'Search Bar',
		'event_label': searchTerm,
		});
	});


	$('body').on('click', '.prods_np_home .doporder3', function(e) {
		let currentact = $('.tprods_np.active').find('a').html();
		let prodname = $(this).find('.name_n').html();

		gtag('event', "IN ONE LOOK", {
		'event_category': 'Product click',
		'event_action': 'Item click',
		'event_label': 'View from:'+currentact+' product:'+prodname,
		});
		
	});
	$('body').on('click mouseover', '#banners .bg_banner_item', function(e) {
		let link = $(this).find('a').prop('href');
		let ttl = $(this).find('.text-banner h3').html();
		let tip = e.type;
		gtag('event', "BANNER "+tip, {
		'event_category': 'BANNER INTERACTION',
		'event_action': 'Banner '+tip,
		'event_label': 'banner link:'+link+' title:'+ttl,
		});
	});

	$('body').on('click mouseover','.bottom_part_left .condition',function(e) {
		let lotname = $('h3.ttl_lot').html();
		let tip = e.type;
		gtag('event', String(tip).toUpperCase()+" LOT CONDITION", {
			'event_category': 'LOT CONDITION',
			'event_action': 'LOT CONDITION of '+lotname,
			'event_label': lotname,
			});
	});
	$('body').on('click mouseover','.bottom_menu_part button[data-toggle="collapse"]',function(e) {
		let lotname = $(this).find('span.value').html();
		let tip = e.type;
		gtag('event', String(tip).toUpperCase()+" BATCH CONTENT", {
			'event_category': 'BATCH CONTENT',
			'event_action': 'BATCH CONTENT for '+lotname,
			'event_label': lotname,
			});
	});
	$('body').on('click mouseover','.contact_seller_lot .contact_seller',function(e) {
		let lotname = $('h3.ttl_lot').html();
		let sell = $(this).prop('href');
		let regex = /to=(\d+)/;
		let rezultat = sell.match(regex);
		let seller = '0';
		if(rezultat) {
			seller = rezultat[1];
		}
		let tip = e.type;
		gtag('event', String(tip).toUpperCase()+" CONTACT SELLER", {
			'event_category': 'CONTACT SELLER',
			'event_action': 'CONTACT SELLER ID:' + seller + ' for lot:'+lotname,
			'event_label': lotname,
			});
	});
	$('body').on('click mouseover', '.share_lot', function(e) {
		let lotname = $('h3.ttl_lot').html();
		let lotid = $(this).data('id');
		let tip = e.type;
		gtag('event', String(tip).toUpperCase()+" PRODUCT SHARE", {
			'event_category': 'PRODUCT SHARE',
			'event_action': 'PRODUCT SHARE lotid:' + lotid + ' lotname:'+lotname,
			'event_label': lotname,
			});
	});

	$('body').on('click mouseover','.top_menux_part .menu',function(e) {
		let lotname = $('h3.ttl_lot').html();
		let lotck = $(this).html();
		let tip = e.type;
		gtag('event', String(tip).toUpperCase()+" PRODUCT "+lotck, {
			'event_category': 'PRODUCT '+lotck,
			'event_action': String(tip).toUpperCase()+' PRODUCT ' + lotck + ' at lotname:'+lotname,
			'event_label': lotname,
			});
	});
	$('body').on('click mouseover', '.big_pic', function(e) {
		let lotname = $('h3.ttl_lot').html();
		let tip = e.type;
		gtag('event', String(tip).toUpperCase()+" PRODUCT MAIN PHOTO", {
			'event_category': 'PRODUCT MAIN PHOTO',
			'event_action': String(tip).toUpperCase()+' PRODUCT MAIN PHOTO for lotname:'+lotname,
			'event_label': lotname,
			});
	});
	$('body').on('click mouseover', '.left_picsarea .opic',function(e) {
		let lotname = $('h3.ttl_lot').html();
		let tip = e.type;
		let etyp = $(this).data('img') !== '' ? 'PHOTO': 'YT VIDEO';
		gtag('event', String(tip).toUpperCase()+" PRODUCT FOLLOWING "+ etyp, {
			'event_category': 'PRODUCT FOLLOWING '+etyp,
			'event_action': String(tip).toUpperCase()+' PRODUCT FOLLOWING '+etyp+' for lotname:'+lotname,
			'event_label': lotname,
			});
	});
	$('body').on('click mouseover', '.stepper-input #sendorderto8p',function(e) {
		let lotname = $('h3.ttl_lot').html();
		let tip = e.type;
		gtag('event', String(tip).toUpperCase()+" PRODUCT ADD TO CART ", {
			'event_category': 'PRODUCT ADD TO CART',
			'event_action': String(tip).toUpperCase()+' PRODUCT ADD TO CART for lotname:'+lotname,
			'event_label': lotname,
			});
	});
	$('body').on('click mouseover', '.social a',function(e) {
		let tp = $(this).attr('class');
		let tip = e.type;
		gtag('event', String(tip).toUpperCase()+" "+String(tp).toUpperCase()+" MAIN PAGE", {
			'event_category': String(tp).toUpperCase()+' SOCIAL',
			'event_action': String(tip).toUpperCase()+' SOCIAL '+String(tp).toUpperCase(),
			'event_label': String(tp).toUpperCase(),
			});
	});
	
	$('body').on('click mouseover', '.chart_elements .flip-card',function(e) {
		let tp = $(this).find('.flip-card-back p b u').html();
		let tip = e.type;
		gtag('event', String(tip).toUpperCase()+" NOMAD PROMISES MAIN PAGE", {
			'event_category': String(tp).toUpperCase()+' NOMAD PROMISES',
			'event_action': String(tip).toUpperCase()+' NOMAD PROMISES '+String(tp).toUpperCase(),
			'event_label': String(tp).toUpperCase(),
			});
	});
	$('body').on('click mouseover', '#carrousel_sellers .item_container a',function(e) {
		let tp = String($(this).prop('href')).replace('/','');
		let tip = e.type;
		gtag('event', String(tip).toUpperCase()+" NOMAD SELLERS MAIN PAGE", {
			'event_category': String(tp).toUpperCase()+' NOMAD SELLERS',
			'event_action': String(tip).toUpperCase()+' NOMAD SELLERS '+String(tp).toUpperCase(),
			'event_label': String(tp).toUpperCase(),
			});
	});
	$('body').on('click mouseover', '#carrousel_manufacturers .item_container a',function(e) {
		let tp = $(this).data('title');
		let tip = e.type;
		gtag('event', String(tip).toUpperCase()+" NOMAD MANUFACTURER MAIN PAGE", {
			'event_category': String(tp).toUpperCase()+' NOMAD MANUFACTURER',
			'event_action': String(tip).toUpperCase()+' NOMAD MANUFACTURER '+String(tp).toUpperCase(),
			'event_label': String(tp).toUpperCase(),
			});
	});
	$('body').on('click mouseover', '.list_targeted_pages a',function(e) {
		let tp = $(this).find('.img_tsp h3').html();
		let tip = e.type;

		gtag('event', String(tip).toUpperCase()+" TARGETED PAGE "+ String(tp).toUpperCase(), {
			'event_category': String(tp).toUpperCase()+' TARGETED PAGE',
			'event_action': String(tip).toUpperCase()+' TARGETED PAGE '+String(tp).toUpperCase(),
			'event_label': String(tp).toUpperCase(),
			});
	});


	$('body').on('click mouseover', '#askdeviz',function(e) {
		let tip = e.type;

		gtag('event', String(tip).toUpperCase()+" VIEW CART", {
			'event_category': 'VIEW CART FROM POPUP',
			'event_action': String(tip).toUpperCase()+' VIEW CART FROM POPUP',
			'event_label': 'VIEW CART FROM POPUP',
			});
	});
	$('body').on('click mouseover', '#mycart',function(e) {
		let tip = e.type;

		gtag('event', String(tip).toUpperCase()+" TOP CART", {
			'event_category': 'TOP CART',
			'event_action': String(tip).toUpperCase()+' TOP CART',
			'event_label': 'TOP CART',
			});
	});

	$('body').on('click mouseover', '.minusqnt.minusqntxz',function(e) {
		let tip = e.type;

		gtag('event', String(tip).toUpperCase()+" QUANTITY -", {
			'event_category': 'POPUP ADD CART',
			'event_action': String(tip).toUpperCase()+' QUANTITY -',
			'event_label': String(tip).toUpperCase()+' QUANTITY MINUS POPUP ADD CART',
			});
	});

	$('body').on('click mouseover', '.plusqnt.plusqntxz',function(e) {
		let tip = e.type;

		gtag('event', String(tip).toUpperCase()+" QUANTITY +", {
			'event_category': 'POPUP ADD CART',
			'event_action': String(tip).toUpperCase()+' QUANTITY +',
			'event_label': String(tip).toUpperCase()+' QUANTITY PLUS POPUP ADD CART',
			});
	});

	$('body').on('click mouseover', '#plotaddpage .btn-continue',function(e) {
		let tip = e.type;

		gtag('event', String(tip).toUpperCase()+" Continue shopping", {
			'event_category': 'POPUP ADD CART',
			'event_action': String(tip).toUpperCase()+' Continue shopping',
			'event_label': String(tip).toUpperCase()+' Continue shopping POPUP ADD CART',
			});
	});
	$('body').on('click mouseover', '#plotaddpage #opendemandeclosepadd',function(e) {
		let tip = e.type;

		gtag('event', String(tip).toUpperCase()+" SEE CART", {
			'event_category': 'POPUP SEE CART',
			'event_action': String(tip).toUpperCase()+' BUTTON SEE CART',
			'event_label': String(tip).toUpperCase()+' BUTTON SEE CART POPUP',
			});
	});


	$('body').on('click mouseover', '#comm_ord_view .minusqnt',function(e) {
		let tip = e.type;

		gtag('event', String(tip).toUpperCase()+" QUANTITY -", {
			'event_category': 'FLOATING BASKET PAGE',
			'event_action': String(tip).toUpperCase()+' QUANTITY -',
			'event_label': String(tip).toUpperCase()+' QUANTITY MINUS FLOATING BASKET PAGE',
			});
	});

	$('body').on('click mouseover', '#comm_ord_view .plusqnt',function(e) {
		let tip = e.type;

		gtag('event', String(tip).toUpperCase()+" QUANTITY +", {
			'event_category': 'FLOATING BASKET PAGE',
			'event_action': String(tip).toUpperCase()+' QUANTITY +',
			'event_label': String(tip).toUpperCase()+' QUANTITY PLUS FLOATING BASKET PAGE',
			});
	});

	$('body').on('click keyup', '#comm_ord_view .orqnt',function(e) {
		let tip = e.type;

		gtag('event', String(tip).toUpperCase()+" QUANTITY EDIT", {
			'event_category': 'FLOATING BASKET PAGE',
			'event_action': String(tip).toUpperCase()+' QUANTITY EDIT',
			'event_label': String(tip).toUpperCase()+' QUANTITY EDIT FLOATING BASKET PAGE',
			});
	});
	$('body').on('click', '#comm_ord_view .delppq',function(e) {
		let tip = e.type;

		gtag('event', String(tip).toUpperCase()+" DELETE PRODUCT", {
			'event_category': 'FLOATING BASKET PAGE',
			'event_action': String(tip).toUpperCase()+' DELETE PRODUCT',
			'event_label': String(tip).toUpperCase()+' DELETE PRODUCT FLOATING BASKET PAGE',
			});
	});
	$('body').on('click', '#comm_ord_view #addnewprodstoproj',function(e) {
		let tip = e.type;

		gtag('event', String(tip).toUpperCase()+" ADD PRODUCTS", {
			'event_category': 'FLOATING BASKET PAGE',
			'event_action': String(tip).toUpperCase()+' ADD PRODUCTS',
			'event_label': String(tip).toUpperCase()+' ADD PRODUCTS FLOATING BASKET PAGE',
			});
	});
	$('body').on('click', '#comm_ord_view #nextstep_x',function(e) {
		let tip = e.type;

		gtag('event', String(tip).toUpperCase()+" CONTINUE NEXT STEP", {
			'event_category': 'FLOATING BASKET PAGE',
			'event_action': String(tip).toUpperCase()+' CONTINUE',
			'event_label': String(tip).toUpperCase()+' CONTINUE NEXT STEP FLOATING BASKET PAGE',
			});
	});

	$('body').on('click', '#comm_ord_view #nextstep_x_proforma',function(e) {
		let tip = e.type;

		gtag('event', String(tip).toUpperCase()+" GENERATE PROFORMA", {
			'event_category': 'FLOATING BASKET PAGE',
			'event_action': String(tip).toUpperCase()+' GENERATE PROFORMA',
			'event_label': String(tip).toUpperCase()+' GENERATE PROFORMA FLOATING BASKET PAGE',
			});
	});
	$('body').on('click', '#comm_ord_view #return2',function(e) {
		let tip = e.type;

		gtag('event', String(tip).toUpperCase()+" BACK ARROW", {
			'event_category': 'FLOATING BASKET PAGE',
			'event_action': String(tip).toUpperCase()+' BACK ARROW',
			'event_label': String(tip).toUpperCase()+' BACK ARROW FLOATING BASKET PAGE',
			});
	});

	$('body').on('click', '#comm_ord_view #delivery',function(e) {
		let tip = e.type;

		gtag('event', String(tip).toUpperCase()+" DELIVERY", {
			'event_category': 'FLOATING BASKET PAGE',
			'event_action': String(tip).toUpperCase()+' DELIVERY',
			'event_label': String(tip).toUpperCase()+' DELIVERY FLOATING BASKET PAGE',
			});
	});

	$('body').on('click', '#comm_ord_view #pickup',function(e) {
		let tip = e.type;

		gtag('event', String(tip).toUpperCase()+" PICKUP", {
			'event_category': 'FLOATING BASKET PAGE',
			'event_action': String(tip).toUpperCase()+' PICKUP',
			'event_label': String(tip).toUpperCase()+' PICKUP FLOATING BASKET PAGE',
			});
	});

	$('body').on('click', '#comm_ord_view #nextstep_x12',function(e) {
		let tip = e.type;

		gtag('event', String(tip).toUpperCase()+" PAY CREDIT CARD", {
			'event_category': 'PAYMENT PAGE',
			'event_action': String(tip).toUpperCase()+' PAY CREDIT CARD',
			'event_label': String(tip).toUpperCase()+' PAY CREDIT CARD PAYMENT PAGE',
			});
	});

	$('body').on('click', '#comm_ord_view #nextstep_x3',function(e) {
		let tip = e.type;

		gtag('event', String(tip).toUpperCase()+" PAY BANK TRANSFER", {
			'event_category': 'PAYMENT PAGE',
			'event_action': String(tip).toUpperCase()+' PAY BANK TRANSFER',
			'event_label': String(tip).toUpperCase()+' PAY BANK TRANSFER PAYMENT PAGE',
			});
	});
/*
	$('body').on('click', '#order_loc_tabs2 a.tab',function(e) {
		let tp = $(this).html();
		let tip = e.type;

		gtag('event', String(tip).toUpperCase()+" BACK TO "+ String(tp).toUpperCase(), {
			'event_category': 'FLOATING BASKET PAGE',
			'event_action': String(tip).toUpperCase()+' BACK TO '+String(tp).toUpperCase(),
			'event_label': 'BACK TO ' + String(tp).toUpperCase() + ' ON FLOATING BASKET PAGE',
			});
	}); */
	

});
