PageSourceSearch

https://www.ukplatinumservices.com/jscripts/subpages.js?v20250703

js ukplatinumservices.com collected 2026-10-08 19:54:44 UTC 19,979 bytes, 594 lines download raw bytes

1var _sub = (function () {
2	var header, banner;
3	var _init_global_variables = function(){
4		header = $("#header"),
5		banner = $("#banner"),
6		slideshow = banner.find(".slideshow");
7	}
8	var _init_title = function(){
9		if($(window).width()>1000){
10			var t = banner.find("h3.title"),
11				s = t.find(">span"),
12				fs = t.css('font-size');
13			fs = parseInt(fs, 10);
14			while(s.width()>t.outerWidth() && fs > 10){
15				fs = fs - 2;
16				t.css({'font-size':fs});
17				t = banner.find("h3.title");
18				s = t.find(">span");
19			}
20		}else{
21			var t = banner.find("h3.title"),
22				s = t.find(">span");
23			t.css({bottom:t.outerHeight()-4});
24		}
25	}
26	var _init_share = function(){
27		var s = $("#social_container");	
28		if(!s.length) return;
29		s.find(".label").unbind("click").click(function(){
30			$(this).hide();
31			s.find(".close").addClass("anim");
32			s.find(".icons").addClass("anim").find("a.social_icon").each(function(index,value){
33				var el = $(this);
34				setTimeout(function(){
35					el.addClass("anim");
36				},50 * index);
37			});
38		});
39		s.find("a.close").unbind("click").click(function(){
40			$(this).removeClass("anim");
41			s.find(".label").show();
42			s.find(".icons").removeClass("anim").find("a.social_icon").removeClass("anim");
43		});
44	}
45	var _init_contact = function(){
46		var appf = $("#contactform:not([data-type='agent'])");
47		if(!appf.length){
48			return;	
49		}
50		appf.find(".selector a").unbind("click").click(function(){
51			_clear_appform();
52			var sid = $(this).data("type");
53			appf.find(".selector a").removeClass("selected");
54			$(this).addClass("selected");
55			appf.find(".form").removeClass("open").end().find(".form[data-type='"+sid+"']").addClass("open");
56		});
57		appf.find("a.submit").unbind("click").text("Send Enquiry").click(function(){
58			_validate_appform();
59		});	
60		appf.find(".chwrap").unbind("click").click(function(){
61			var el = $(this);
62			if(el.hasClass("checked")){
63				el.removeClass("checked");	
64				el.find("input").prop('checked', false);	
65			}else{
66				el.addClass("checked");
67				appf.find(".checkwrap").removeClass("incorrect");
68				el.find("input").prop('checked', true);
69			}
70		});
71		var input = document.querySelector("#_phone");
72		iti = window.intlTelInput(input, {
73			initialCountry: "auto",
74			  geoIpLookup: function(callback) {
75				$.get('https://ipinfo.io', function() {}, "jsonp").always(function(resp) {
76				  var countryCode = (resp && resp.country) ? resp.country : "";
77				  callback(countryCode);
78				});
79			  }
80		});
81		input.addEventListener('countrychange', function(e) {
82		  	$("#_phone").val('+' + iti.getSelectedCountryData().dialCode+' ');
83		});
84		initFlags();
85		function initFlags(){
86			if(!appf.find(".iti__flag-container").length){
87				setTimeout(function(){
88					initFlags();
89				},100);
90			}else{
91				appf.find(".fieldwrap.phone span.floating-label").insertAfter($("#_phone"));		
92			}
93		}
94	}
95	var _validate_appform = function(){
96		var base = '+' + iti.getSelectedCountryData().dialCode;
97		var appf = $("#contactform:not([data-type='agent'])"),
98			pass = 1,
99			s = appf.find(".selector a.selected").data("type");
100			a = appf.find("#_name"),
101			b = appf.find("#_phone"),
102			c = appf.find("#_email"),
103			d = appf.find("#_text"),
104			f = appf.find("#_program"),
105			g = appf.find("#_location"),
106			h = appf.find("#_apply1"),
107			i = appf.find("#_apply2"),
108			j = appf.find(".checkwrap"),
109			k = appf.find("#_country"),
110			l = appf.find("#_qualification"),
111			m = appf.find("#_budget"),
112			o = appf.find("#_questions"),
113			p = appf.find("#_university"),
114			r = appf.find("#_referral");
115		s = !s?3:s;
116		a.val()==""?(pass=0,a.parent().addClass("incorrect")):a.parent().removeClass("incorrect");
117		(b.val()==""||b.val().trim()==base||!iti.getSelectedCountryData().name)?(pass=0,b.parent().parent().addClass("incorrect")):b.parent().parent().removeClass("incorrect");
118		c.val()==""?(pass=0,c.parent().addClass("incorrect")):c.parent().removeClass("incorrect");
119		g.val()==""?(pass=0,g.parent().addClass("incorrect")):g.parent().removeClass("incorrect");
120		if(s == 1 || s == 3){
121			d.val()==""?(pass=0,d.parent().addClass("incorrect")):d.parent().removeClass("incorrect");
122		}else{
123			g.val()==""?(pass=0,g.parent().addClass("incorrect")):g.parent().removeClass("incorrect");
124			k.val()==""?(pass=0,k.parent().addClass("incorrect")):k.parent().removeClass("incorrect");
125			l.val()==""?(pass=0,l.parent().addClass("incorrect")):l.parent().removeClass("incorrect");
126			m.val()==""?(pass=0,m.parent().addClass("incorrect")):m.parent().removeClass("incorrect");
127		}
128		/*if(!h.is(":checked") && !i.is(":checked")){
129			pass=0;
130			j.addClass("incorrect");
131		}else{
132			j.removeClass("incorrect");	
133		}*/
134		if(pass == 1){
135			appf.find("a.submit").unbind("click").text("sending...");
136			_send_appform(a.val(),b.val(),c.val(),d.val(),f.val(),g.val(),h.is(":checked")?1:0,i.is(":checked")?1:0,k.val(),l.val(),m.val(),o.val(),s,p.val(),r.val());
137		}
138	}
139	var _send_appform = function(af,bf,cf,df,ff,gf,hf,ii,kk,ll,mm,oo,ss,pp,rr){
140		var appf = $("#contactform:not([data-type='agent'])");
141		$.post("/process/_message.html",{a:af,b:bf,c:cf,d:df,f:ff,g:gf,h:hf,i:ii,k:kk,l:ll,m:mm,o:oo,s:ss,p:pp,r:rr})
142			.done(function(data){
143				switch(data.trim()){
144					case "good":
145						/*var bl = _global.loader();
146						bl.empty().append('<div class="modular"><div class="header"><div class="title">Thank You!</div><a class="close"></a></div><div class="msg">Thank you for your enquiry. We will process it and get back to you as soon as possible.</div><div class="_foot"><a class="cancel">Close</a></div></div>').find(".modular").addClass("show");
147						bl.find(".modular .header a.close,.modular a.cancel").unbind("click").click(function(){
148							$("#blanket-wrap").remove();
149						});*/
150						_clear_appform();
151						document.location.href="/enquiry-confirmation";
152					break;
153					default:
154						$('body').append('<div class="error_msg">An error occurred while sending your message. Please try again.</div>');
155						_global.setmessage();
156					break;
157				}
158				_init_contact();
159			});
160	}
161	var _clear_appform = function(){
162		var appf = $("#contactform");
163		appf.find("input,textarea").val("").closest('.fieldwrap').removeClass("incorrect");
164		appf.find(".chwrap").removeClass("checked");	
165	}
166	var _init_agentcontact = function(){
167		var appf = $("#contactform[data-type='agent']");
168		if(!appf.length){
169			return;	
170		}
171		appf.find("a.submit").unbind("click").text("Send Enquiry").click(function(){
172			_validate_agentform();
173		});	
174		appf.find(".chwrap").unbind("click").click(function(){
175			var el = $(this);
176			if(el.hasClass("checked")){
177				el.removeClass("checked");	
178				el.find("input").prop('checked', false);	
179			}else{
180				el.addClass("checked");
181				appf.find(".checkwrap").removeClass("incorrect");
182				el.find("input").prop('checked', true);
183			}
184		});
185		var input = document.querySelector("#_phone");
186		iti = window.intlTelInput(input, {
187			initialCountry: "auto",
188			  geoIpLookup: function(callback) {
189				$.get('https://ipinfo.io', function() {}, "jsonp").always(function(resp) {
190				  var countryCode = (resp && resp.country) ? resp.country : "";
191				  callback(countryCode);
192				});
193			  }
194		});
195		input.addEventListener('countrychange', function(e) {
196		  	$("#_phone").val('+' + iti.getSelectedCountryData().dialCode+' ');
197		});
198		initFlags();
199		function initFlags(){
200			if(!appf.find(".iti__flag-container").length){
201				setTimeout(function(){
202					initFlags();
203				},100);
204			}else{
205				appf.find(".fieldwrap.phone span.floating-label").insertAfter($("#_phone"));		
206			}
207		}
208	}
209	var _validate_agentform = function(){
210		var base = '+' + iti.getSelectedCountryData().dialCode;
211		var appf = $("#contactform[data-type='agent']"),
212			pass = 1,
213			a = appf.find("#_name"),
214			b = appf.find("#_surname"),
215			c = appf.find("#_location"),
216			d = appf.find("#_email"),
217			e = appf.find("#_phone"),
218			f = appf.find("#_dob"),
219			g = appf.find("#_reason"),
220			j = appf.find(".checkwrap"),
221			h = appf.find("#_apply1"),
222			i = appf.find("#_apply2"),
223			k = appf.find("#_company"),
224			l = appf.find("#_website"),
225			m = appf.find("#_sociallinks");
226		a.val()==""?(pass=0,a.parent().addClass("incorrect")):a.parent().removeClass("incorrect");
227		b.val()==""?(pass=0,b.parent().addClass("incorrect")):b.parent().removeClass("incorrect");
228		c.val()==""?(pass=0,c.parent().addClass("incorrect")):c.parent().removeClass("incorrect");
229		d.val()==""||!validateEmail(d.val().trim())?(pass=0,d.parent().addClass("incorrect")):d.parent().removeClass("incorrect");
230		(e.val()==""||e.val().trim()==base||!iti.getSelectedCountryData().name)?(pass=0,e.parent().parent().addClass("incorrect")):e.parent().parent().removeClass("incorrect");
231		f.val()==""?(pass=0,f.parent().addClass("incorrect")):f.parent().removeClass("incorrect");
232		g.val()==""?(pass=0,g.parent().addClass("incorrect")):g.parent().removeClass("incorrect");
233		if(!h.is(":checked") && !i.is(":checked")){
234			pass=0;
235			j.addClass("incorrect");
236		}else{
237			j.removeClass("incorrect");	
238		}
239		if(pass == 1){
240			appf.find("a.submit").unbind("click").text("sending...");
241			_send_agentform(a.val(),b.val(),c.val(),d.val(),e.val(),f.val(),g.val(),(h.is(":checked")?1:0),(i.is(":checked")?1:0),k.val(),l.val(),m.val());
242		}
243	}
244	function validateEmail(email) {
245		const re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
246		return re.test(String(email).toLowerCase());
247	}
248	var _send_agentform = function(af,bf,cf,df,ef,ff,gf,hf,ii,kf,lf,mf){
249		var appf = $("#contactform[data-type='agent']");
250		$.post("/process/_agentmessage.html",{a:af,b:bf,c:cf,d:df,e:ef,f:ff,g:gf,h:hf,i:ii,k:kf,l:lf,m:mf})
251			.done(function(data){
252				switch(data.trim()){
253					case "good":
254						var bl = _global.loader();
255						bl.empty().append('<div class="modular"><div class="header"><div class="title">Thank You!</div><a class="close"></a></div><div class="msg">Thank you!<br /><br />One of our team members will get in touch with you soon!</div><div class="_foot"><a class="cancel">Close</a></div></div>').find(".modular").addClass("show");
256						bl.find(".modular .header a.close,.modular a.cancel").unbind("click").click(function(){
257							$("#blanket-wrap").remove();
258						});
259						_clear_appform();
260					break;
261					default:
262						$('body').append('<div class="error_msg">An error occurred while sending your message. Please try again.</div>');
263						_global.setmessage();
264					break;
265				}
266				_init_agentcontact();
267			});
268	}
269	var _init_map = function(){
270		var mapwrap = $("#map");
271		if(!mapwrap.length){
272			return;
273		}
274		var map = $("#map .wrap > .inner"),
275		styles = [{"featureType":"administrative","elementType":"labels.text.fill","stylers":[{"color":"#444444"}]},{"featureType":"landscape","elementType":"all","stylers":[{"color":"#f2f2f2"}]},{"featureType":"poi","elementType":"all","stylers":[{"visibility":"off"}]},{"featureType":"road","elementType":"all","stylers":[{"saturation":-100},{"lightness":45}]},{"featureType":"road.highway","elementType":"all","stylers":[{"visibility":"simplified"}]},{"featureType":"road.highway","elementType":"geometry.fill","stylers":[{"color":"#e8bd4e"}]},{"featureType":"road.arterial","elementType":"geometry.fill","stylers":[{"hue":"#ff0000"}]},{"featureType":"road.arterial","elementType":"labels.icon","stylers":[{"visibility":"off"}]},{"featureType":"road.local","elementType":"geometry.fill","stylers":[{"color":"#ffffff"}]},{"featureType":"transit","elementType":"all","stylers":[{"visibility":"off"}]},{"featureType":"water","elementType":"all","stylers":[{"color":"#c2c4c4"},{"visibility":"on"}]}];
276		var mapray = [],
277			loop = true,
278			i = 1;
279		while (loop){
280			var node = {};
281			if(!map.data("address"+i)){
282				loop = false;
283				break;
284			}
285			node.latLng = map.data("address"+i);
286			node.data = map.data("label"+i);
287			mapray.push(node);
288			i = i+1;
289		}
290		if(!map.length || mapray.length == 0){
291			return;	
292		}
293		/*var mapobj = map.gmap3({ 
294			map:{
295            	options:{
296				  	center:new google.maps.LatLng(0, 0),
297                	zoom: 5,
298					scrollwheel: false,
299                	mapTypeId: "style1",
300					mapTypeControlOptions: {
301					   mapTypeIds: ["style1",google.maps.MapTypeId.ROADMAP, google.maps.MapTypeId.SATELLITE]
302					},
303					disableDefaultUI:$(document).width()>767?false:true
304              	}
305            },
306			styledmaptype:{
307			  	id: "style1",
308			  	options:{
309					name: "Platinum"
310			  	},
311			  	styles: styles
312			},
313			marker:{
314				values:mapray,
315				options: {
316					icon: new google.maps.MarkerImage(
317					"/images/map-marker.png",
318					new google.maps.Size(80, 128, "px", "px")
319				),
320				animation: google.maps.Animation.DROP
321			},
322			autofit:{},
323			events:{
324				click: function(marker, event, context){
325					var map = $(this).gmap3("get");  
326					if($(this).find(".infobubble").length){
327						$(this).gmap3({
328							clear:"overlay"
329						});
330						map.panBy(0, 100);
331						return;
332					}
333					$(this).gmap3({clear:"overlay"},{
334						overlay:{
335							latLng: marker.getPosition(),
336							options:{
337								content:  "<div class='infobubble anim'>" +
338									"<div class='text'>"+context.data+"</div>" +
339									"</div>" +
340									"<div class='arrow'></div>",
341								offset: {
342									x:-100,
343									y:-270
344								}
345							}
346						}
347					}),
348					map.panBy(0, -100)
349				},
350			}
351			}
352        });*/
353		/*$("#sublocmap").gmap3({
354		  getlatlng:{
355			//address:addr,
356			callback: function(results){
357			  $("#sublocmap").gmap3({
358				marker:{
359				  //latLng:results[0].geometry.location,
360				  values: mapray,
361				  options: {
362					icon: new google.maps.MarkerImage(
363					"/images/map-marker.png",
364					new google.maps.Size(80, 128, "px", "px")
365					)
366				  },
367				  animation: google.maps.Animation.DROP,
368				  events:{
369						click: function(marker, event, context){
370							var map = $(this).gmap3("get");  
371							if($(this).find(".infobubble").length){
372								$(this).gmap3({
373									clear:"overlay"
374								});
375								map.panBy(0, 100);
376								return;
377							}
378							$(this).gmap3({clear:"overlay"},{
379								overlay:{
380									latLng: marker.getPosition(),
381									options:{
382										content:  "<div class='infobubble anim'>" +
383											"<div class='text'>"+context.data+"</div>" +
384											"</div>" +
385											"<div class='arrow'></div>",
386										offset: {
387											x:-100,
388											y:-270
389										}
390									}
391								}
392							}),
393							map.panBy(0, -100)
394						},
395					}
396				},
397				autofit:{},
398			  });
399			},
400		  }
401		});*/
402		var myOptions = {
403			zoom: 7,
404			styles: styles,
405			mapTypeId: "style1",
406			scrollwheel: false,
407			mapTypeControl: true,
408			zoomControl: true,
409			streetViewControl: false,
410			scaleControl:true,
411			disableDoubleClickZoom: true,
412			draggable: true,
413			disableDefaultUI:true,
414			center: new google.maps.LatLng(0, 0),
415			mapTypeId: google.maps.MapTypeId.ROADMAP
416		}
417		var map = new google.maps.Map(document.getElementById("sublocmap"),myOptions);
418		var infowindow = new google.maps.InfoWindow({
419			pixelOffset: new google.maps.Size(0,-66)	
420		}); 
421		var request = $.ajax({  
422			url: "/process/_offices.cfm",
423			type: "POST",  
424			dataType: "json"
425		});
426		request.done(function(subcont) {
427			if(subcont!="error"){
428				var sData = JSON.stringify(subcont);
429				var markers = jQuery.parseJSON(sData);
430				setMarkers(map, markers);
431			}
432		});
433		var icon1 = "/images/map-marker-mini.png?blackdot";
434		var icon2 = "/images/map-marker-mini-hover.png?golddot";
435		function setMarkers(map, locations){
436			var bounds = new google.maps.LatLngBounds();
437			for (var i = 0; i < locations.length; i++) {
438				var beach = locations[i].latLng;
439				var myLatLng = new google.maps.LatLng(beach[0], beach[1]);
440				var marker = new google.maps.Marker({
441					position: myLatLng,
442					map: map,
443					icon: locations[i].options.icon,
444					animation: google.maps.Animation.DROP
445				});
446				marker['infobubble'] = locations[i].infobubble;
447				marker.addListener('click', function() {
448				   var ib = this.infobubble;
449				   map.panTo(this.getPosition());
450					onItemClick(event, this); 
451				  /*var map2 = $(this).gmap3("get");  
452					if($(this).find(".infobubble").length){
453						$(this).gmap3({
454							clear:"overlay"
455						});
456						map2.panBy(0, 100);
457						return;
458					}
459					$(this).gmap3({clear:"overlay"},{
460						overlay:{
461							latLng: marker.getPosition(),
462							options:{
463								content:  "<div class='infobubble anim'>" +
464									"<div class='text'>"+this.data+"</div>" +
465									"</div>" +
466									"<div class='arrow'></div>",
467								offset: {
468									x:-100,
469									y:-270
470								}
471							}
472						}
473					})*/
474				});
475				marker.addListener('mouseover', function(){
476					this.setIcon(icon2);
477				});
478				marker.addListener('mouseout', function(){
479					this.setIcon(icon1);
480				});
481				bounds.extend(myLatLng);
482			}
483			map.fitBounds(bounds);
484		}
485		function onItemClick(event, pin) { 
486			var contentString = pin.infobubble; 
487			//map.setCenter(pin.getPosition());
488			// Replace our Info Window's content and position 
489			infowindow.setContent(contentString); 
490			infowindow.setPosition(pin.position); 
491			infowindow.open(map);
492		}
493	}
494	var _init_scrolltrack = function(){
495		var t = $('body').find(".trc"),
496			td = $(window).width()>767?600:300;
497		$(window).unbind("scroll").scroll(function(){
498			var s = $(window).scrollTop();
499			t.each(function(){
500				/*if(s >= $(this).offset().top-td){
501					($(this).data("trc")&&$(this).data("trc")!='')?(i = $(this).data("trc"),$(this).data("trc",''),window['_index'][i].apply(null,[$(this)])):$(this).addClass("anim");
502				}*/
503				td = $(this).data("dist")?$(this).data("dist"):td;
504				if(s >= $(this).offset().top-td){
505					($(this).data("trc")&&$(this).data("trc")!=''&&$(this).data("mod")&&$(this).data("mod")!='')?(i = $(this).data("trc"),m = $(this).data("mod"),$(this).data("trc",''),window[m][i].apply(null,[$(this)])):$(this).addClass("anim");
506				}
507			});
508		});
509		//initiate all elements in the top 60% of the screen upon loading;
510		var cutoff = $(window).scrollTop() + ($(window).height() * 0.6);
511		t.each(function(){
512			if($(this).offset().top <= cutoff){
513				($(this).data("trc")&&$(this).data("trc")!=''&&$(this).data("mod")&&$(this).data("mod")!='')?(i = $(this).data("trc"),m = $(this).data("mod"),$(this).data("trc",''),window[m][i].apply(null,[$(this)])):$(this).addClass("anim");
514			}
515		});
516	}
517	var _init_sidetests = function(){
518		var st = $("#sidetestimonial");
519		if(!st.length) return;
520		var ih = st.find(".text"),
521			iho = ih.height(),
522			ah = st.find(".inner");
523		if(ah.height() > ih.height()){
524			ih.addClass("exp").append("<a class='expand'>show more</a>");	
525			st.find("a.expand").unbind("click").click(function(){
526				if($(this).hasClass("open")){
527					$(this).removeClass("open").text("show more");
528					ih.animate({'max-height':iho});
529				}else{
530					$(this).addClass("open").text("show less");
531					ih.animate({'max-height':ah.height()+40});
532				}
533			});
534		}
535	}
536	var _init_hashscroll = function(){
537		if(window.location.hash) {
538			var el = window.location.hash;
539			if($(el).length){
540				_global.scroll(el,300,500);	
541			}
542		}
543	}
544	var init = function () {
545		_init_global_variables();
546		_init_title();
547		_init_contact();
548		_init_agentcontact();
549		_init_share();
550		_init_map();
551		_init_scrolltrack();
552		_init_sidetests();
553		_init_hashscroll();
554	};
555	return {
556		init: init,
557		initscroll: _init_scrolltrack
558	};
559})();
560var _sub2 = (function () {
561	var _init_testimonials = function(){
562		var tst = $("#foottest");
563		if(!tst.length) return;
564		var loop = true;
565		if(tst.find(".entry").length<2){
566			loop = false;
567		}
568		tst.find(".list").owlCarousel({
569			items:1,
570			margin:0,
571			smartSpeed:1000,
572			nav:false,
573			autoplay:true,
574			autoplayTimeout:8000,
575			autoplayHoverPause:true,
576			loop:loop,
577			dots:true,
578			animateOut: "fadeOut",
579			autoHeight: true
580		});	
581	}
582	var init = function () {
583		_init_testimonials();
584	};
585	return {
586		init: init
587	};
588})();
589$(document).ready(function(){
590	_sub.init();
591});
592$(window).load(function(){
593	_sub2.init();
594});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.