PageSourceSearch

https://www.fongphotography.online/sy-inc/js/store.js?0d6a07403b8fe83ff73a9dcbd3ef7c0eb

js fongphotography.online collected 2026-10-10 01:34:24 UTC 88,565 bytes, 3,012 lines download raw bytes

1$(document).ready(function(){
2	$(".defaultfield").bind('focus', function() { 
3		if($(this).val() == $(this).attr("default")) { 
4			$(this).val("");
5		}
6	});
7	$('.defaultfield').bind('blur', function() { 
8		if($(this).val() == "") { 
9			$(this).val($(this).attr("default"));
10		}
11	});
12});
13function showqtydiscount() { 
14	$("#qtydiscountprices").slideToggle(200);
15}
16function showfilteroptions(id) { 
17	stopslideshow();
18	$("#"+id).slideToggle(200);
19}
20function toggleIt(id) { 
21	$("#"+id).slideToggle(200);
22}
23
24function preorderqtydiscount(id) { 
25	$("#qtydiscountprices-"+id).slideToggle(200);
26}
27
28function showGraphicOptions(id) { 
29	$("#graphic-option-"+id).slideToggle(200);
30	$('html, body').animate({
31		scrollTop: $("#graphic-option-container-"+id).offset().top
32	}, 200);
33}
34
35function selectGraphicOption(id,sel_id,name) { 
36	$("#opt-"+id).val(sel_id);
37	$("#opt-selected-name-"+id).html(name);
38	$("#graphic-option-"+id).slideUp(200);
39
40    $('html, body').animate({
41        scrollTop: $("#graphic-option-"+id).offset().top - 90
42    }, 200);
43
44}
45
46function showGraphicOptionsCheckout(id) { 
47	$("#graphic-option-"+id).slideToggle(200);
48	$('html, body').animate({
49		scrollTop: $("#graphic-option-container-"+id).offset().top
50	}, 200);
51}
52
53function selectGraphicOptionCheckout(id,sel_id,name,fieldname,pic) { 
54	$("#"+fieldname).val(sel_id);
55	$("#opt-selected-name-"+id).html(name);
56	$("#graphic-option-"+id).slideUp(200);
57	if(pic !== "") { 
58		$("#opt-select-graphic-"+id).html('<img src="'+pic+'"  class="graphicoptioncheckout">');
59    } else { 
60		$("#opt-select-graphic-"+id).html('');
61	}
62	$('html, body').animate({
63        scrollTop: $("#graphic-option-container-"+id).offset().top - 90
64    }, 200);
65	checkhiddeninputerror();
66}
67
68function openroomview(pid) { 
69	hideMiniCart();
70	fixbackground();
71	$("#buybackground").fadeIn(50, function() { 
72		if(isslideshow) { 
73			if(isslideshow == true) { 
74				stopSlideshow();
75			}
76		}
77		loading();
78
79		$.get(tempfolder+"/sy-inc/room-view/room-view.php?pid="+pid, function(data) {
80
81			$("#photoprodsinner").html(data);
82			$("#photoprods").slideDown(200, function() { 
83				if($("body").width() <= 800) { 
84					$("#closebuyphototab").show();
85				} else { 
86					$("#closebuyphoto").show();
87				}
88				loadingdone();
89			});
90		});
91	});
92}
93
94
95function showstoreitem(did) { 
96	$("#storeitembackground").show(); 
97	$.get(tempfolder+"/sy-inc/store-item.php?did="+did, function(data) {
98		$('#storeitembackground').click(function() {
99			closestoreitem()
100		 });
101
102		 $('#storeitemcontainer').click(function(event){
103			 event.stopPropagation();
104		 });
105
106		$("#storeitemcontainer").css({"top":$(window).scrollTop()+50+"px"});
107		$("#storeiteminner").html(data);
108				adjustsite();
109
110		$("#storeitemcontainer").fadeIn(200, function() { 
111			$("#closestoreitem").fadeIn(100);
112		});
113	});
114	
115}		
116function closestoreitem() { 
117	$("#storeitemcontainer").fadeOut(200, function() { 
118		$("#closestoreitem").fadeOut(100);
119
120		$("#storeiteminner").html("");
121		$("#storeitembackground").fadeOut(200);
122	});
123
124}
125
126function showrequireremove(id) { 
127	$("#remove-"+id).slideToggle(200);
128}
129
130function showpackageremove(id) { 
131	$("#remove-package-"+id).slideToggle(200);
132}
133
134function openoptions(id) { 
135	// $(".photoprod").fadeOut(200);
136	$(".options-"+id).slideToggle(200);
137}
138
139function openpackageoptions(id) { 
140	$(".options-"+id).slideToggle(200);
141}
142
143function addordernotes() { 
144	$("#order_notes").slideToggle(200);
145}
146
147function photokeywords() { 
148	hideMiniCart();
149	fixbackground();
150	$("#buybackground").fadeIn(50);
151	if(isslideshow) { 
152		if(isslideshow == true) { 
153			stopSlideshow();
154		}
155	}
156	loading();
157	$("#photoprods").css({"top":$(window).scrollTop()+50+"px"});
158		$.get(tempfolder+"/sy-inc/photo_keywords.php?did="+$("#vinfo").attr("did")+"&sub_id="+$("#vinfo").attr("sub_id"), function(data) {
159			$("#photoprodsinner").html(data);
160			$("#photoprods").slideDown(200, function() { 
161				if($("body").width() <= 800) { 
162					$("#closebuyphoto").show();
163				} else { 
164					$("#closebuyphototab").show();
165				}
166				sizeBuyPhoto();
167				loadingdone();
168
169				$('html').click(function() {
170				 closebuyphoto();
171				 });
172
173			 $('#photoprods').click(function(event){
174				 event.stopPropagation();
175			 });
176
177			});
178		});
179}
180function giftcertificate(id) { 
181	$("#gallerysharebg").attr("data-window","giftcertificate");
182	$("#accloading").show();
183	closebuyphoto();
184	$("#gallerysharebg").fadeIn(100, function() { 
185		if($(window).scrollTop() < 80) { 
186			to = 80;
187		} else { 
188			to = $(window).scrollTop();
189		}
190		if($("#giftcertificate").length == 0) {
191			$("#gallerysharebg").after('<div id="giftcertificate" class="gallerypopup"></div>');
192		}
193			$.get(tempfolder+"/sy-inc/store/store_gift_certificate.php?cart_id="+id, function(data) {
194			$("#accloading").hide();
195			$("#giftcertificate").html(data);
196			$("#giftcertificate").css({"top":to+"px"}).fadeIn(200);
197		});
198	});
199}
200function giftcertificateredeem(where) { 
201	$("#gallerysharebg").attr("data-window","giftcertificateredeem");
202	$("#accloading").show();
203	closebuyphoto();
204	$("#gallerysharebg").fadeIn(100, function() { 
205		if($(window).scrollTop() < 80) { 
206			to = 80;
207		} else { 
208			to = $(window).scrollTop();
209		}
210		if($("#giftcertificateredeem").length == 0) {
211			$("#gallerysharebg").after('<div id="giftcertificateredeem" class="gallerypopup"></div>');
212		}
213			$.get(tempfolder+"/sy-inc/store/store_redeem_gift_certificate.php", function(data) {
214			$("#accloading").hide();
215			$("#giftcertificateredeem").html(data);
216			$("#giftcertificateredeem").css({"top":to+"px"}).fadeIn(200);
217		});
218	});
219}
220
221
222function redeemprintcredit(pc_code) { 
223	$("#gallerysharebg").attr("data-window","printcredit");
224	$("#accloading").show();
225	$("#gallerysharebg").fadeIn(100, function() { 
226		if($(window).scrollTop() < 80) { 
227			to = 80;
228		} else { 
229			to = $(window).scrollTop();
230		}
231		if($("#printcredit").length == 0) {
232			$("#gallerysharebg").after('<div id="printcredit" class="gallerypopup"></div>');
233		}
234			$.get(tempfolder+"/sy-inc/store/store_redeem_print_credit.php?pc_code="+pc_code, function(data) {
235			$("#accloading").hide();
236			$("#printcredit").html(data);
237			$("#printcredit").css({"top":to+"px"}).fadeIn(200);
238		});
239	});
240}
241
242function redeemcoupon(where,code) { 
243	timeout = 0;
244	if($("#page-wrapper").css("position") == "fixed") { 
245		timeout = 300;
246		closebuyphoto();
247	}
248	setTimeout(function(){
249		$("#gallerysharebg").attr("data-window","redeemcoupon");
250		$("#accloading").show();
251
252		$("#gallerysharebg").fadeIn(100, function() { 
253
254			if($("#vinfo").attr("view-photo-fixed") == "1") { 
255				to = $("#ssheader").height() + $(window).scrollTop() + 24;
256				if($("#redeemcoupon").length == 0) {
257					$("#ssheader").after('<div id="redeemcoupon" class="gallerypopup"></div>');
258				}
259
260			} else { 
261				if($(window).scrollTop() < 80) { 
262					to = 80;
263				} else { 
264					to = $(window).scrollTop();
265				}
266				if($("#redeemcoupon").length == 0) {
267					$("#gallerysharebg").after('<div id="redeemcoupon" class="gallerypopup"></div>');
268				}
269			}
270				$.get(tempfolder+"/sy-inc/store/store_redeem_coupon.php?where="+where+"&code="+code, function(data) {
271				$("#accloading").hide();
272				$("#redeemcoupon").html(data);
273				$("#redeemcoupon").css({"top":to+"px"}).fadeIn(200);
274			});
275		});
276	}, timeout);
277}
278
279
280
281function findphotos() { 
282	hideMiniCart();
283	fixbackground();
284	$("#buybackground").fadeIn(50);
285	if(isslideshow) { 
286		if(isslideshow == true) { 
287			stopSlideshow();
288		}
289	}
290	loading();
291	$("#photoprods").css({"top":$(window).scrollTop()+50+"px"});
292		$.get(tempfolder+"/sy-inc/find_photos_window.php", function(data) {
293			$("#photoprodsinner").html(data);
294			$("#photoprods").slideDown(200, function() { 
295				$("#closebuyphoto").show();
296				sizeBuyPhoto();
297				loadingdone();
298
299				$('html').click(function() {
300				 closebuyphoto();
301				 });
302
303			 $('#photoprods').click(function(event){
304				 event.stopPropagation();
305			 });
306
307			});
308		});
309}
310
311
312function getstates(country,gettax,shiponly) { 
313	$.get(tempfolder+'/sy-inc/store/store_cart_actions.php?action=getstatelist&country='+country, function (data) { 
314		if(shiponly == "1") { 
315			$("#ship_state").html(data);
316			getTax();
317		} else { 
318			$("#state").html(data);
319			if(gettax == "1") { 
320				$("#ship_state").html(data);
321				getTax();
322			}
323		}
324	});
325}
326function sendtocart(classname,date_id) { 
327	var fields = {};
328	if(!date_id) {
329		var date_id = "";
330	}
331	var rf = false;
332	var stop;
333	var mes;
334
335	$("#select_option_message").slideUp(200);
336
337
338
339
340	$(".itemrequired").each(function(i){
341		var this_id = this.id;
342		if($('#'+this_id).val() == "") { 
343			if($("#"+this_id).attr("opttype") == "tabs") { 
344				$('#'+this_id).parent().addClass('inputError');
345			} else { 
346				$('#'+this_id).addClass('inputError');
347			}
348			rf = true;
349		} else { 
350			if($("#"+this_id).attr("opttype") == "tabs") { 
351				$('#'+this_id).parent().removeClass('inputError');
352			} else { 
353				$('#'+this_id).removeClass('inputError');
354			}
355		}
356	} );
357
358	if(rf == true || stop == true) {
359		if(rf == true) {
360			$("#select_option_message").slideDown(200);
361		}
362		return false;
363	} else { 
364		$("#min_qty_message").slideUp(200);
365
366		 $("#addtocart"+date_id).hide();
367		 $("#addtocartloading"+date_id).show();
368
369		$('.'+classname).each(function(){
370			var $this = $(this);
371			if( $this.attr('type') == "radio") { 
372				if($this.attr("checked")) { 
373					fields[$this.attr('name')] = $this.val(); 
374	//				alert($this.attr('name')+': '+ $this.attr('type')+' CHECKED- '+$this.val());
375				}
376			} else if($this.attr('type') == "checkbox") { 
377				if($this.attr("checked")) { 
378					fields[$this.attr('name')] += $this.val(); 
379					// alert($this.attr('name')+': '+ $this.attr('type')+' CHECKED- '+$this.val());
380				}
381
382			} else { 
383				fields[$this.attr('name')] = $this.val(); 
384			//	alert($this.attr('name') +" = "+ $this.val() );
385			}
386		});
387
388		fields['curphoto'] = $("#photo-"+$("#slideshow").attr("curphoto")).attr("pkey");
389		fields['curphotodid'] = $("#vinfo").attr("did");
390		fields['cart_photo_bg'] = $("#gs-bgimage-id").val();
391
392		if(Math.abs(fields['prod_qty']) < Math.abs(fields['qty_min']))  { 
393			$("#min_qty_message").slideDown(200);
394				 $("#addtocart"+date_id).show();
395				 $("#addtocartloading"+date_id).hide();
396		} else if(fields['prod_qty'] < 0) { 
397			$("#min_qty_message").slideDown(200);
398				 $("#addtocart"+date_id).show();
399				 $("#addtocartloading"+date_id).hide();
400		} else { 
401			$.post(tempfolder+'/sy-inc/store/store_cart_actions.php', fields,	function (data) { 
402				// alert(data);
403
404				if($("#addaction").attr("data-redirect") =="1") { 
405					window.location.href=$("#addaction").val();
406				}
407
408				if(fields['from_photo'] > 0) { 
409					showMiniCart('','1');
410				} else { 
411					showMiniCart();
412				}
413				 $("#submitinfo").html(data);
414				updateCartMenu();
415				setTimeout(function(){
416					if(fields['from_photo'] > 0) { 
417						$("#vinfo").attr("viewing-store-photo-prod","1");
418						closestoreitem();
419						showaddphototoproduct();
420					}
421				 $("#addtocart"+date_id).show();
422				 $("#addtocartloading"+date_id).hide();
423				},500)
424			 } );
425		}
426	}
427	return false;
428}
429
430
431
432
433function sendtocartlist(classname,date_id) { 
434	var fields = {};
435	if(!date_id) {
436		var date_id = "";
437	}
438	var rf = false;
439	var stop;
440	var mes;
441
442	$("#select_option_message").slideUp(200);
443	$(".itemrequired-"+date_id).each(function(i){
444		var this_id = this.id;
445		if($('#'+this_id).val() == "") { 
446			if($("#"+this_id).attr("opttype") == "tabs") { 
447				$('#'+this_id).parent().addClass('inputError');
448			} else { 
449				$('#'+this_id).addClass('inputError');
450			}
451			rf = true;
452		} else { 
453			if($("#"+this_id).attr("opttype") == "tabs") { 
454				$('#'+this_id).parent().removeClass('inputError');
455			} else { 
456				$('#'+this_id).removeClass('inputError');
457			}
458		}
459	} );
460
461	if(rf == true || stop == true) {
462		if(rf == true) {
463			$("#select_option_message").slideDown(200);
464		}
465		return false;
466	} else { 
467		$("#min_qty_message").slideUp(200);
468
469		 $("#addtocart"+date_id).hide();
470		 $("#addtocartloading"+date_id).show();
471
472		$('.'+classname).each(function(){
473			var $this = $(this);
474			if( $this.attr('type') == "radio") { 
475				if($this.attr("checked")) { 
476					fields[$this.attr('name')] = $this.val(); 
477	//				alert($this.attr('name')+': '+ $this.attr('type')+' CHECKED- '+$this.val());
478				}
479			} else if($this.attr('type') == "checkbox") { 
480				if($this.attr("checked")) { 
481					fields[$this.attr('name')] += $this.val(); 
482					// alert($this.attr('name')+': '+ $this.attr('type')+' CHECKED- '+$this.val());
483				}
484
485			} else { 
486				fields[$this.attr('name')] = $this.val(); 
487			//	alert($this.attr('name') +" = "+ $this.val() );
488			}
489		});
490
491		fields['curphoto'] = $("#photo-"+$("#slideshow").attr("curphoto")).attr("pkey");
492		fields['curphotodid'] = $("#vinfo").attr("did");
493
494		if(Math.abs(fields['prod_qty']) < Math.abs(fields['qty_min']))  { 
495			$("#min_qty_message").slideDown(200);
496				 $("#addtocart"+date_id).show();
497				 $("#addtocartloading"+date_id).hide();
498		} else if(fields['prod_qty'] < 0) { 
499			$("#min_qty_message").slideDown(200);
500				 $("#addtocart"+date_id).show();
501				 $("#addtocartloading"+date_id).hide();
502		} else { 
503			$.post(tempfolder+'/sy-inc/store/store_cart_actions.php', fields,	function (data) { 
504				// alert(data);
505
506				if($("#addaction-"+date_id).attr("data-redirect") =="1") { 
507					window.location.href=$("#addaction-"+date_id).val();
508				}
509
510				if(fields['from_photo'] > 0) { 
511					showMiniCart('','1');
512				} else { 
513					showMiniCart();
514				}
515				 $("#submitinfo").html(data);
516				updateCartMenu();
517				setTimeout(function(){
518					if(fields['from_photo'] > 0) { 
519						$("#vinfo").attr("viewing-store-photo-prod","1");
520						storeproductnexttophoto($("#slideshow").attr("curphoto"));
521					}
522				 $("#addtocart"+date_id).show();
523				 $("#addtocartloading"+date_id).hide();
524				},500)
525			 } );
526		}
527	}
528	return false;
529}
530function updateCartMenu() { 
531	$.get(tempfolder+"/sy-inc/store/store_cart_actions.php?action=updatecartmenu", function(data) {
532		$("#viewcartlink").show();
533		$("#checkoutlink").show();
534		$(".showcartmenus").show();
535		$("#cartlinktotal").html(data);
536		$(".cartlinktotal").html(data);
537		$("#photobuycarttotal").html(data).show();
538		$("#viewphotocarttotal").show();
539		$("#viewcartpagetotal").html(data);
540		$("#viewcartpagesubtotal").html(data);
541		$.get(tempfolder+"/sy-inc/store/store_cart_actions.php?action=updatecartmenuitems", function(data) {
542			if(data > 0) { 
543				$(".viewphotocartlink").show();
544				$(".viewimageshoppingcart").slideDown(200, function() { 
545					height = $(".viewimageshoppingcart:visible").outerHeight();
546					if($("#selectgsbackground").length > 0) { 
547						setTimeout(function() { 
548							if($(".viewimageshoppingcart:visible").css("display") == "block") { 
549
550
551								if($("#mainpackagecontainer").length > 0) { 
552									carttab = $("#managepackagecarttab").height();
553									newbottom = Math.round($("#mainpackagecontainer").height() - carttab);
554
555								} else { 
556									newbottom = $(".viewimageshoppingcart:visible").outerHeight();
557								}
558
559								$("#selectgsbackground").css({"bottom": newbottom+"px"});
560							}
561						}, 200);
562					}					
563				});
564
565			}
566			$(".carttotalcircle").html(data);
567		});
568	});
569
570}
571
572/*
573function showMiniCart(pck,from_photo) { 
574	if(!pck) { 
575		pck = "";
576	}
577	if(!from_photo) { 
578		from_photo = "";
579	}
580
581	$("#gallerysharebg").attr("data-window","minicart");
582	$("#accloading").show();
583	closebuyphoto();
584	$("#gallerysharebg").fadeIn(100, function() { 
585		if($(window).scrollTop() < 80) { 
586			to = 80;
587		} else { 
588			to = $(window).scrollTop();
589		}
590		if($("#minicart").length == 0) {
591			$("#gallerysharebg").after('<div id="minicart" class="gallerypopup"></div>');
592		}
593		$.get(tempfolder+"/sy-inc/store/store_view_cart_mini.php?package="+pck+"&from_photo="+from_photo, function(data) {
594			$("#accloading").hide();
595			$("#minicart").html(data);
596			$("#minicart").css({"top":to+"px"}).fadeIn(200);
597		});
598	});
599}
600*/
601
602var cntimer;
603
604function cartnotice(data,hide) { 
605	cnid = Math.floor((Math.random() * 10000) + 1);
606	$(".cartnotice").remove();
607		clearTimeout(cntimer);
608
609	$("body").append('<div class="cartnotice hide" id="cartnotice-'+cnid+'">'+data+'</div>');
610
611	$("#cartnotice-"+cnid).fadeIn(100, function() { 
612			cntimer = setTimeout(function() { 
613				$("#cartnotice-"+cnid).fadeOut(100);
614			}, hide);
615	});
616}
617
618function closecartnotice() { 
619	$(".cartnotice").fadeOut(100, function() { 
620		$(".cartnotice").remove();
621	});
622
623}
624
625function showMiniCart(pck,from_photo,time) { 
626	if(!pck) { 
627		pck = "";
628	}
629	if(!from_photo) { 
630		from_photo = "";
631	}
632
633	$.get(tempfolder+"/sy-inc/store/store_view_cart_mini_3.php?package="+pck+"&from_photo="+from_photo, function(data) {
634		if(time > 0) { 
635			cartnotice(data, time);
636		} else { 
637			cartnotice(data, 8000);
638		}
639		/* 
640		$("#viewcartinner").html(data);
641		$("#viewcarttop").slideDown(200);
642		$('html').click(function() {
643		 hideMiniCart();
644		 });
645
646		 $('#viewcartinner').click(function(event){
647			 event.stopPropagation();
648		 });
649
650		 */
651	});
652
653
654}
655function hideMiniCart() { 
656	$("#viewcarttop").slideUp(200);
657	$("#viewcartinner").html("");
658	closestoreitem();
659	$("#footercheckout").slideDown(400);
660
661}
662
663function removeFromCart(cid) { 
664	$.get(tempfolder+"/sy-inc/store/store_cart_actions.php?action=removefromcart&cid="+cid+"", function(data) {
665		$("#cart-"+cid).slideUp(200);
666		if(data == "remove") { 
667			$(".checkoutpagebutton").hide();
668			$("#cartisempty").show();
669			$("#storecarttext").hide();
670		}
671		$.get(tempfolder+"/sy-inc/store/store_cart_actions.php?action=updateTotal", function(data) {
672			$("#expressprice").val(data);
673			updateCartMenu();
674		});
675		
676
677	});
678
679}
680
681function checkhiddeninputerror() { 
682	$(".hiddeninput").each(function(i){
683		if($("#"+this.id).val() == "") { 
684			if($("#"+this.id).hasClass("required")) { 
685				$("#"+$("#"+this.id).attr("data-hidden-input-for")).addClass('error');
686			} else { 
687				$("#"+$("#"+this.id).attr("data-hidden-input-for")).removeClass('error');
688			}
689		} else { 
690			$("#"+$("#"+this.id).attr("data-hidden-input-for")).removeClass('error');
691		}
692	} );
693}
694
695function createaccount(classname,loggedin,ckpass) { 
696	var fields = {};
697//	 $("#addtocart").hide();
698//	 $("#addtocartloading").show();
699	var rf = false;
700	var stop;
701	var mes;
702	$("#textconsentselect").slideUp(10);
703	$("#consentselect").slideUp(10);
704
705
706
707	$("#accresponse").slideUp(10).removeClass("error");
708	$(".required").each(function(i){
709		var this_id = this.id;
710		if($('#'+this_id).val() == "") { 
711			$('#'+this_id).addClass('inputError');
712			rf = true;
713		} else { 
714			$('#'+this_id).removeClass('inputError');
715		}
716	} );
717
718	checkhiddeninputerror();
719	
720		if($("#checkout").attr("loggedin") == "0") { 
721			if($("#email_address").attr("data-check") == "1") { 
722				if($("#email_address").val() !== $("#email_address_2").val()) {
723					 $("#accresponse").addClass("error").html($("#accresponse").attr("mismatchemail")).slideDown(100);
724					 stop = true;
725					 return false;
726				}
727			}
728		}
729
730		if($("#agreeterms").length > 0) { 
731			if($("#agreeterms").attr("checked")) { 
732
733			} else { 
734				alert("You did not accept the terms & conditions");
735				return false;
736				 stop = true;
737			}
738		}
739
740		if($("#gallery_contact_consent_no").length > 0) { 
741		  if (!$("input[name='gallery_contact_consent']:checked").val()) {
742				$("#consentselect").slideDown(200);
743				 rf = true;
744
745			}
746		}
747	if($("#phone_consent_1").length > 0) { 
748		if($("#order_phone").val() !== "") { 
749		  if (!$("input[name='phone_consent']:checked").val()) {
750				$("#textconsentselect").slideDown(200);
751				 stop = true;
752			}
753		}
754	}
755
756		if($("#checkout").attr("loggedin") == "0" && $("#checkout").attr("ckpass") == "1" && $("#checkout").attr("account") !== "disabled"  &&  $("#newpassword").attr("data-check") == "1") { 
757			if($("#newpassword").val() !== $("#renewpassword").val()) {
758				$("#newpassword").val(""); 
759				$("#renewpassword").val(""); 
760				 $("#accresponse").addClass("error").html($("#accresponse").attr("passwordsnomatch")).slideDown(100);
761				stop = true;
762				 return false;
763			}
764		}
765
766	if(rf == true || stop == true) {
767		if(rf == true) {
768			 $("#accresponse").addClass("error").html($("#accresponse").attr("emptyfields")).slideDown(100);
769		}
770		return false;
771	} else { 
772
773		// Fields are checked and go so lets move on to shipping. 
774
775
776		$('.'+classname).each(function(){
777			var $this = $(this);
778			if( $this.attr('type') == "radio") { 
779				if($this.attr("checked")) { 
780					fields[$this.attr('name')] = $this.val(); 
781	//				alert($this.attr('name')+': '+ $this.attr('type')+' CHECKED- '+$this.val());
782				}
783			} else if($this.attr('type') == "checkbox") { 
784				if($this.attr("checked")) { 
785					fields[$this.attr('name')] = $this.val(); 
786	//				alert($this.attr('name')+': '+ $this.attr('type')+' CHECKED- '+$this.val());
787				}
788
789			} else { 
790				fields[$this.attr('name')] = $this.val(); 
791			}
792		});
793
794		if($("#checkout").attr("loggedin") == "1" || $("#no_account").attr("checked") ||  $("#checkout").attr("account") == "disabled") {
795
796			$("#maininfo").slideUp();
797			if($("#checkout").attr("ship") == "1") { 
798
799				getShipping();
800				fields['action'] = "updateaccount";
801				$.post(tempfolder+'/sy-inc/store/store_cart_actions.php', fields,	function (data) { 
802
803				// alert("here, add customer info: "+data);
804				});
805
806				$("#progressshipping").removeClass("checkoutprogress").addClass("checkoutprogressdone");
807			} else { 
808
809	if($("#photoviewbg").length <= 0) { 
810		$("body").prepend('<div id="photoviewbg" class="hide"><div id="stockphotoloading"><div class="loadingspinner"></div></div></div>');
811				}
812			$("#photoviewbg").fadeIn(400);
813
814			$.get(tempfolder+'/sy-inc/store/store_cart_actions.php?action=checkcheckoutfields', function(data) {
815				d = data.split('|');
816				$("#gift_certificate_amount").val(d[0]);
817				$("#credit_amount").val(d[1]);
818				$("#discount_amount").val(d[2]);
819				$("#eb_amount").val(d[3]);
820
821				$("#tax_price").val(d[4]);
822				$("#vat_price").val(d[5]);
823				$("#shipping_price").val(d[6]);
824				$("#taxable_amount").val(d[7]);
825				$("#sub_total").val(d[8]);
826				//$("#grand_total").val(d[9]);
827
828				// 6/25/2023 added this timeout function to add a slight delay
829				// to try to fix the strage rare issue tax, credit, etc... get zeroed out when 
830				// checking empty fields. 
831
832
833
834
835				setTimeout(function(){
836					getgrandtotal(0);
837					fields['action'] = "updateaccount";
838					$.post(tempfolder+'/sy-inc/store/store_cart_actions.php', fields,	function (data) { 
839
840					// alert("here, add customer info: "+data);
841					});
842					setTimeout(function(){
843						if($("#grand_total").val()<=0) {  
844							$(".paymentoptionsavailable").hide();
845							$("#pay_total_zero").val("1");
846							$("#payzerototal").show();
847							$("#stripe-sel").attr("checked", false);
848							$("#checkout").attr("action",$("#checkout").attr("data-action"));
849
850						} else { 
851							$("#zerototal").html("");
852						}
853						$("#paymentselect").slideDown();
854
855						// Adding the address fields to PayPal checkout
856						if($("#card-holder-name").length > 0) { 
857							$("#card-holder-name").val($("#first_name").val()+" "+$("#last_name").val());
858						}
859						if($("#card-billing-address-street").length > 0) { 
860							$("#card-billing-address-street").val($("#address").val());
861						}
862						if($("#card-billing-address-city").length > 0) { 
863							$("#card-billing-address-city").val($("#city").val());
864						}
865						if($("#card-billing-address-state").length > 0) { 
866							$("#card-billing-address-state").val($("#state").val());
867						}
868						if($("#card-billing-address-zip").length > 0) { 
869							$("#card-billing-address-zip").val($("#zip").val());
870						}
871						if($("#card-billing-address-country").length > 0) { 
872							$("#card-billing-address-country").val($("#country option:selected").attr("data-abr"));
873						}
874						// end PayPal checkout fields/
875
876
877						$("#progresspayment").removeClass("checkoutprogress").addClass("checkoutprogressdone");
878						$("#stripe-name").val($("#first_name").val()+" "+ $("#last_name").val());
879						if($("#square-sel").attr("checked")) { 
880						//	sqPaymentForm.setPostalCode($("#zip").val());
881						}
882				   $('html').animate({scrollTop:0}, 100); 
883					$('body').animate({scrollTop:0}, 100); 
884					
885
886					$("#photoviewbg").fadeOut(200);
887					},1000);
888				},600);
889			});
890
891
892		}
893
894		if($("#checkoutinfo").hasClass("hidesmall")) {
895			
896		} else { 
897			$("#checkoutinfo").slideDown();
898		}
899			$("#accresponse").html("");
900			$("#pagelogin").slideUp();
901				off = $("#progressinfo").offset();
902				scrollto = off.top - $("#shopmenucontainer").height();
903			   $('html').animate({scrollTop:scrollto}, 'slow'); 
904			$('body').animate({scrollTop:scrollto}, 'slow'); 
905
906
907		} else { 
908			// added this function here because we were having a zero total when creating an account at checkout 
909			getgrandtotal(0);
910
911
912			$.post(tempfolder+'/sy-inc/store/store_cart_actions.php', fields,	function (data) { 
913
914			data = $.trim(data);
915			if(data == "good") {
916				
917
918				$("#checkout").attr("loggedin", "1");
919				$("#checkout").attr("ckpass", "0");
920				$("#emails").hide();
921				$("#passes").hide();
922				$("#editinfo").show();
923				$("#maininfo").slideUp();
924				if($("#checkout").attr("ship") == "1") { 
925					getShipping();
926					$("#progressshipping").removeClass("checkoutprogress").addClass("checkoutprogressdone");
927				} else { 
928
929
930				$.get(tempfolder+'/sy-inc/store/store_cart_actions.php?action=checkcheckoutfields', function(data) {
931					d = data.split('|');
932					$("#gift_certificate_amount").val(d[0]);
933					$("#credit_amount").val(d[1]);
934					$("#discount_amount").val(d[2]);
935					$("#eb_amount").val(d[3]);
936
937					$("#tax_price").val(d[4]);
938					$("#vat_price").val(d[5]);
939					$("#shipping_price").val(d[6]);
940					$("#taxable_amount").val(d[7]);
941					$("#sub_total").val(d[8]);
942					// $("#grand_total").val(d[9]);
943
944					getgrandtotal(1);
945					setTimeout(function(){
946
947						if($("#grand_total").val()<=0) { 
948							$(".paymentoptionsavailable").hide();
949							$("#pay_total_zero").val("1");
950							$("#payzerototal").show();
951							$("#stripe-sel").attr("checked", false);
952							$("#checkout").attr("action",$("#checkout").attr("data-action"));
953
954						} else { 
955							$("#zerototal").html("");
956						}
957						$("#paymentselect").slideDown();
958						$("#stripe-name").val($("#first_name").val()+" "+ $("#last_name").val());
959
960
961
962						// Adding the address fields to PayPal checkout
963						if($("#card-holder-name").length > 0) { 
964							$("#card-holder-name").val($("#first_name").val()+" "+$("#last_name").val());
965						}
966						if($("#card-billing-address-street").length > 0) { 
967							$("#card-billing-address-street").val($("#address").val());
968						}
969						if($("#card-billing-address-city").length > 0) { 
970							$("#card-billing-address-city").val($("#city").val());
971						}
972						if($("#card-billing-address-state").length > 0) { 
973							$("#card-billing-address-state").val($("#state").val());
974						}
975						if($("#card-billing-address-zip").length > 0) { 
976							$("#card-billing-address-zip").val($("#zip").val());
977						}
978						if($("#card-billing-address-country").length > 0) { 
979							$("#card-billing-address-country").val($("#country option:selected").attr("data-abr"));
980						}
981						// end PayPal checkout fields/
982
983
984
985
986						if($("#square-sel").attr("checked")) { 
987						//	sqPaymentForm.setPostalCode($("#zip").val());
988						}
989						$("#progresspayment").removeClass("checkoutprogress").addClass("checkoutprogressdone");
990						},1000);
991
992					});
993
994				}
995				$("#pagelogin").slideUp();
996				$("#shippingrow").slideDown();
997
998				 $("#accresponse").html("");
999				off = $("#progressinfo").offset();
1000				scrollto = off.top - $("#shopmenucontainer").height();
1001			   $('html').animate({scrollTop:scrollto}, 'slow'); 
1002			$('body').animate({scrollTop:scrollto}, 'slow'); 
1003
1004			} else { 
1005				// alert(data);
1006			 $("#accresponse").show().html(data);
1007			}
1008		});
1009
1010		}
1011
1012	return false;
1013	}
1014
1015}
1016
1017function swapStates() {
1018
1019	$(".allstates").hide();
1020	ct = $("#country").val();
1021	ctn = ct.replace(" ","_");
1022	$(".ct-"+ctn).show();
1023
1024
1025}
1026function getTax() { 
1027	$(".checkout").hide();
1028	$(".checkoutnavloading").show();
1029
1030	setTimeout(function(){
1031	var pickup = $("input[name=ship_select]:checked").attr("data-pickup");
1032	if($("#checkout").attr("taxwhere") == "shipping") { 
1033		var state = $("#ship_state").val();
1034		var zip = encodeURIComponent($("#ship_zip").val());
1035		var country = $("#ship_country").val();
1036	} else { 
1037		var state = $("#state").val();
1038		var zip = encodeURIComponent($("#zip").val());
1039		var country = $("#country").val();
1040	}
1041	var amount = $("#taxable_amount").attr("data-org-tax-amount"); 
1042	var tax_exempt = $("#tax_exempt").val();
1043	if(tax_shipping == 1) { 
1044		amount = Math.abs(amount) + Math.abs($("#shipping_price").val());
1045		$("#taxable_amount").val(amount);
1046	}
1047
1048
1049	$.get(tempfolder+'/sy-inc/store/store_cart_actions.php?action=getTax&sid='+state+'&zip='+zip+'&pickup='+pickup+'&country='+country+'&total='+amount+"&tax_exempt="+tax_exempt, function(data) {
1050	// alert(amount+" - "+$("#shipping_price").val()+" state: "+state+" : data: "+data)
1051
1052		tax = data.split('|');
1053		taxprice = priceFormat(tax[0]);
1054		vatprice = priceFormat(tax[2]);
1055
1056		$("#vattotal").html(vatprice);
1057		$("#vatonpercent").html(tax[3]);
1058
1059
1060		$("#taxtotal").html(taxprice);
1061		$("#taxonpercent").html(tax[1]);
1062		$("#tax_price").val(tax[0]);
1063
1064		$("#tax_percentage").val(tax[1]);
1065		if(tax[2] > 0) { 
1066			$("#vat_price").val(tax[2]);
1067			$("#vat_percentage").val(tax[3]);
1068			$("#vatrow").slideDown();
1069		} else { 
1070			$("#vat_price").val(0);
1071			$("#vat_percentage").val(0);
1072			$("#vatrow").slideUp(100);
1073		}
1074
1075		if(tax[0] > 0) { 
1076			$("#taxrow").fadeIn(100);
1077		} else { 
1078			$("#taxrow").fadeOut(100);
1079		}
1080		$.get(tempfolder+'/sy-inc/store/store_cart_actions.php?action=checkcheckoutfields', function(data) {
1081			d = data.split('|');
1082			$("#gift_certificate_amount").val(d[0]);
1083			$("#credit_amount").val(d[1]);
1084			$("#discount_amount").val(d[2]);
1085			$("#eb_amount").val(d[3]);
1086
1087			$("#tax_price").val(d[4]);
1088			$("#vat_price").val(d[5]);
1089			$("#shipping_price").val(d[6]);
1090			$("#taxable_amount").val(d[7]);
1091			$("#sub_total").val(d[8]);
1092			// $("#grand_total").val(d[9]);
1093			getgrandtotal();
1094
1095			$(".checkout").fadeIn(200);
1096			$(".checkoutnavloading").hide();
1097		});
1098
1099	});
1100	},200);
1101}
1102
1103function getShipping() { 
1104	var amount = $("#ship_on").val();
1105
1106	updateCheckoutAddress();
1107	if($("#shippingaddressside").attr("data-hide-shipping") == "1") { 
1108		$("#shippingaddressside").slideUp(100);
1109	} else { 
1110		$("#shippingaddressside").slideDown(100);
1111	}
1112
1113
1114	$.get(tempfolder+'/sy-inc/store/store_cart_actions.php?action=getShipping&view=checkout&state='+$("#ship_state").val()+'&country='+$("#ship_country").val()+'&total='+amount, function(data) {
1115	data = $.trim(data);
1116	$("#shippingbuttons").hide();
1117	$("#shippingbuttonsloading").show();
1118
1119	$("#shippingselect").html(data);
1120	$("#shippingcontainer").slideDown();
1121	var shipValue = Math.abs($("#shipdefault").attr("price"));
1122
1123	shipprice = priceFormat(shipValue);
1124	/* Grab address to send to shipping fields */
1125	$("#shippingtotal").html(shipprice);
1126	$("#shippingtotal").attr("price",shipValue);
1127	$("#shipping_price").val(shipValue);
1128	$("#shippingrow").slideDown();
1129	getTax();
1130	$.get(tempfolder+'/sy-inc/store/store_cart_actions.php?action=checkcheckoutfields', function(data) {
1131		d = data.split('|');
1132		$("#gift_certificate_amount").val(d[0]);
1133		$("#credit_amount").val(d[1]);
1134		$("#discount_amount").val(d[2]);
1135		$("#eb_amount").val(d[3]);
1136
1137		$("#tax_price").val(d[4]);
1138		$("#vat_price").val(d[5]);
1139		$("#shipping_price").val(d[6]);
1140		$("#taxable_amount").val(d[7]);
1141		$("#sub_total").val(d[8]);
1142		// $("#grand_total").val(d[9]);
1143		getgrandtotal(1);
1144	});
1145});
1146}
1147
1148function editInfo() { 
1149	$("#editinfo").hide();
1150	$("#maininfo").slideDown();
1151	$("#paymentselect").slideUp();
1152	$("#shippingcontainer").slideUp();
1153	$("#grandtotalrow").hide();
1154	$("#pay_total_zero").val("0");
1155	$("#progresspayment").removeClass("checkoutprogressdone").addClass("checkoutprogress");
1156	$("#progressshipping").removeClass("checkoutprogressdone").addClass("checkoutprogress");
1157
1158}
1159function saveshipping() { 
1160		$("#shippingaddresserror").slideUp(100);
1161
1162		rf = false;
1163		if($("#shippingaddressside").css('display') == "none") { 
1164
1165		} else { 
1166
1167			$(".shiprequired").each(function(i){
1168				var this_id = this.id;
1169				if($('#'+this_id).val() == "") { 
1170					$('#'+this_id).addClass('inputError');
1171					rf = true;
1172				} else { 
1173					$('#'+this_id).removeClass('inputError');
1174				}
1175			} );
1176		}
1177	
1178		if(rf == true) { 
1179			$("#shippingaddresserror").slideDown(200);
1180		} else { 
1181
1182
1183	$.get(tempfolder+'/sy-inc/store/store_cart_actions.php?action=checkcheckoutfields', function(data) {
1184		d = data.split('|');
1185		$("#gift_certificate_amount").val(d[0]);
1186		$("#credit_amount").val(d[1]);
1187		$("#discount_amount").val(d[2]);
1188		$("#eb_amount").val(d[3]);
1189
1190		$("#tax_price").val(d[4]);
1191		$("#vat_price").val(d[5]);
1192		$("#shipping_price").val(d[6]);
1193		$("#taxable_amount").val(d[7]);
1194		$("#sub_total").val(d[8]);
1195		// $("#grand_total").val(d[9]);
1196		getgrandtotal(0);
1197
1198		setTimeout(function() { 
1199
1200		$("#paymentselect").slideDown();
1201		$("#stripe-name").val($("#first_name").val()+" "+ $("#last_name").val());
1202		if($("#square-sel").attr("checked")) { 
1203		//	sqPaymentForm.setPostalCode($("#zip").val());
1204		}
1205
1206
1207
1208		// Adding the address fields to PayPal checkout
1209		if($("#card-holder-name").length > 0) { 
1210			$("#card-holder-name").val($("#first_name").val()+" "+$("#last_name").val());
1211		}
1212		if($("#card-billing-address-street").length > 0) { 
1213			$("#card-billing-address-street").val($("#address").val());
1214		}
1215		if($("#card-billing-address-city").length > 0) { 
1216			$("#card-billing-address-city").val($("#city").val());
1217		}
1218		if($("#card-billing-address-state").length > 0) { 
1219			$("#card-billing-address-state").val($("#state").val());
1220		}
1221		if($("#card-billing-address-zip").length > 0) { 
1222			$("#card-billing-address-zip").val($("#zip").val());
1223		}
1224		if($("#card-billing-address-country").length > 0) { 
1225			$("#card-billing-address-country").val($("#country option:selected").attr("data-abr"));
1226		}
1227		// end PayPal checkout fields/
1228
1229
1230
1231		if($("#grand_total").val()<=0) { 
1232			$(".paymentoptionsavailable").hide();
1233			$("#pay_total_zero").val("1");
1234			$("#payzerototal").show();
1235			$("#stripe-sel").attr("checked", false);
1236			$("#checkout").attr("action",$("#checkout").attr("data-action"));
1237
1238			} else { 
1239				$("#zerototal").html("");
1240			}
1241			setTimeout(function() { 
1242			$('html, body').animate({
1243					scrollTop: $("#progressinfo").offset().top
1244				}, 100);
1245		}, 200);
1246
1247		$("#shippingcontainer").slideUp();
1248		$("#progresspayment").removeClass("checkoutprogress").addClass("checkoutprogressdone");
1249	
1250		}, 100);
1251		});
1252	}
1253}
1254
1255function getgrandtotal(wait) { 
1256	if(wait == 1) { 
1257		waittime = 2200;
1258	} else { 
1259		waittime = 0;
1260	}
1261
1262	$("#grandtotal").hide();
1263	$("#grandtotalloading").show();
1264	$(".checkout").hide();
1265	$(".checkoutnavloading").show();
1266
1267			setTimeout(function(){
1268				$("#shippingbuttons").fadeIn(50);
1269				$("#shippingbuttonsloading").hide();
1270				var subtotal = Math.abs($("#subtotal").attr("price"));
1271				if($("#checkout").attr("ship") == "1") { 
1272					var shipping = Math.abs($("#shippingtotal").attr("price"));
1273				} else { 
1274					var shipping = 0;
1275				}
1276				var discount = Math.abs($("#discount_amount").val());
1277				var eb = Math.abs($("#eb_amount").val());
1278				var tax = Math.abs($("#tax_price").val());
1279				var vat = Math.abs($("#vat_price").val());
1280				var credit = Math.abs($("#credit_amount").val());
1281				var gift_certificate = Math.abs($("#gift_certificate_amount").val());
1282				var order_payment_fee_flat = Math.abs($("#order_payment_fee_flat").val());
1283				var order_payment_fee_percent = Math.abs($("#order_payment_fee_percent").val());
1284				var order_payment_fee_taxable = $("#order_payment_fee_taxable").val();
1285
1286
1287				gtotal = subtotal - eb - discount + shipping + tax + vat;
1288				if(gtotal <= credit) { 
1289					gtotal = 0;
1290				} else { 
1291					gtotal = gtotal - credit;
1292				}
1293				if(gtotal < gift_certificate) {
1294					gtotal = 0;
1295				} else { 
1296					gtotal = gtotal - gift_certificate;
1297				}
1298			
1299				/*
1300				order_payment_fee = (((gtotal)  * order_payment_fee_percent) / 100) + order_payment_fee_flat;
1301				if(order_payment_fee > 0) { 
1302					gtotal = gtotal + order_payment_fee;
1303				}
1304
1305				$("#order_payment_fee").val(order_payment_fee);
1306				$("#order_payment_fee_price").html(priceFormat(order_payment_fee));
1307				if(order_payment_fee_taxable == "1") { 
1308					if($("#tax_percentage").val() > 0) { 
1309						order_payment_fee_tax_amount = (order_payment_fee * $("#tax_percentage").val()) / 100;
1310						$("#order_payment_fee_tax_amount").val(order_payment_fee_tax_amount);
1311						$("#order_payment_fee_tax_amount_show").html(priceFormat(order_payment_fee_tax_amount));
1312
1313						if(order_payment_fee_tax_amount > 0) { 
1314							gtotal = gtotal + order_payment_fee_tax_amount;
1315						}
1316
1317
1318					}
1319
1320					if($("#vat_percentage").val() > 0) { 
1321
1322						order_payment_fee_vat_amount = (order_payment_fee * $("#vat_percentage").val()) / 100;
1323						$("#order_payment_fee_vat_amount").val(order_payment_fee_vat_amount);
1324						$("#order_payment_fee_vat_amount_show").html(priceFormat(order_payment_fee_vat_amount));
1325						if(order_payment_fee_vat_amount > 0) { 
1326							gtotal = gtotal + order_payment_fee_vat_amount;
1327						}
1328
1329					}			
1330				}
1331				*/
1332			// Getting total changed in 3.6 update
1333			//	gtotal = gtotal.toFixed(2);
1334			// To: 
1335				gtotal = Math.round(gtotal * 100) / 100
1336				gtotalsend = gtotal;
1337				$("#grand_total").val(gtotal);
1338				gtotal = priceFormat(gtotal);
1339
1340				$("#grandtotal").html(gtotal);
1341				$("#grandtotalrow").slideDown();
1342				$("#grandtotal").show();
1343				$("#grandtotalloading").hide();
1344				$(".checkout").fadeIn(200);
1345				$(".checkoutnavloading").hide();
1346
1347				// Also set the grand total sesssion here: 
1348				$.get(tempfolder+'/sy-inc/store/store_cart_actions.php?action=checkCoupon&email='+$("#email_address").val()+"&grand_total="+gtotalsend+"&noredirect=1", function(data) {
1349					if(data == "nogood") { 
1350							window.location.href=tempfolder+"/index.php?view=cart";
1351					}
1352
1353				});
1354			},waittime);
1355
1356}
1357
1358
1359function addshipping() { 
1360
1361	selValue = $('input[name=ship_select]:checked').attr("price"); 
1362	pick_up = $('input[name=ship_select]:checked').attr("data-pickup"); 
1363
1364	if(pick_up == "1") { 
1365		$("#shippingaddressside").slideUp(100);
1366	} else { 
1367		$("#shippingaddressside").slideDown(100);
1368	}
1369
1370
1371	shipprice = priceFormat(selValue);
1372	$("#shippingtotal").html(shipprice);
1373	$("#shippingtotal").attr("price",selValue);
1374	$("#shipping_price").val(selValue);
1375
1376
1377
1378	$.get(tempfolder+'/sy-inc/store/store_cart_actions.php?action=setShippingPriceSession&shipping_price='+selValue, function(data) {
1379
1380		$("#shippingrow").slideDown();
1381		getTax();
1382		$("#shippingbuttons").hide();
1383		$("#shippingbuttonsloading").show();
1384
1385		setTimeout(function() { 
1386
1387
1388		$.get(tempfolder+'/sy-inc/store/store_cart_actions.php?action=checkcheckoutfields', function(data) {
1389			d = data.split('|');
1390			$("#gift_certificate_amount").val(d[0]);
1391			$("#credit_amount").val(d[1]);
1392			$("#discount_amount").val(d[2]);
1393			$("#eb_amount").val(d[3]);
1394
1395			$("#tax_price").val(d[4]);
1396			$("#vat_price").val(d[5]);
1397			$("#shipping_price").val(d[6]);
1398			$("#taxable_amount").val(d[7]);
1399			$("#sub_total").val(d[8]);
1400			// $("#grand_total").val(d[9]);
1401
1402				getgrandtotal();
1403				$("#shippingbuttons").show();
1404				$("#shippingbuttonsloading").hide();
1405
1406
1407
1408
1409			});
1410		}, 1100);
1411
1412	});
1413
1414}
1415
1416
1417function showLogin() { 
1418	$("#accountlogin").toggle();	
1419	$("#forgotpassword").hide();
1420	$(".forgotpassword").show();
1421	$("#accountloginresponse").hide();
1422}
1423
1424
1425function forgotpasswordform() {
1426	$("#accountlogin").hide();
1427	$("#forgotpassword").show();
1428	$(".forgotpassword").hide();
1429}
1430function forgotpasswordpageform() {
1431	$("#pagelogin").hide();
1432	$("#forgotpasswordpage").show();
1433	$("#forgotpasswordpagelink").hide();
1434	$("#loginresponse").html("");
1435}
1436function cancelforgotpassword() { 
1437	 $("#pagelogin").show();
1438	 $("#forgotpasswordpage").hide();
1439	 $("#forgotemail").val("");
1440	 $("#forgotemailmessagepage").show();
1441	 $("#forgotloginresponsepage").hide();
1442	$("#forgotpasswordpagelink").show();
1443}
1444function accountlogin(classname) { 
1445	var fields = {};
1446	var rf = false;
1447	var mes;
1448	$("#accountloginresponse").hide();
1449
1450	$(".lrequired").each(function(i){
1451		var this_id = this.id;
1452		if($('#'+this_id).val() == "") { 
1453			$('#'+this_id).addClass('inputError');
1454			rf = true;
1455		} else { 
1456			$('#'+this_id).removeClass('inputError');
1457		}
1458	} );
1459	if(rf == true) { 
1460		return false;
1461	} else { 
1462
1463
1464		$('.'+classname).each(function(){
1465			var $this = $(this);
1466			if( $this.attr('type') == "radio") { 
1467				if($this.attr("checked")) { 
1468					fields[$this.attr('name')] = $this.val(); 
1469				}
1470			} else if($this.attr('type') == "checkbox") { 
1471				if($this.attr("checked")) { 
1472					fields[$this.attr('name')] += ","+$this.val(); 
1473				}
1474
1475			} else { 
1476				fields[$this.attr('name')] = $this.val(); 
1477			}
1478		});
1479		$.post(tempfolder+'/sy-inc/store/store_cart_actions.php', fields,	function (data) { 
1480			data = $.trim(data);
1481			if(data == "good") { 
1482				window.location.href="";
1483			} else { 
1484				 $("#accountloginresponse").show();
1485				 $("#accountloginresponse").html(data);
1486			}
1487		});
1488	return false;
1489	}
1490}
1491
1492
1493
1494
1495function customerlogin(classname,view,indexpage) { 
1496	var fields = {};
1497	var rf = false;
1498	var mes;
1499	$(".loginrequired").each(function(i){
1500		var this_id = this.id;
1501		if($('#'+this_id).val() == "") { 
1502			$('#'+this_id).addClass('inputError');
1503			rf = true;
1504		} else { 
1505			$('#'+this_id).removeClass('inputError');
1506		}
1507	} );
1508	if(rf == true) { 
1509	//	showErrorMessage("You have required fields empty which are highlighted.");	
1510	//	setTimeout("hideErrorMessage()", 4000);
1511		return false;
1512	} else { 
1513	$("#loginsubmitpage").hide();
1514	$("#loginloadingpage").show();
1515
1516
1517		$('.'+classname).each(function(){
1518			var $this = $(this);
1519			if( $this.attr('type') == "radio") { 
1520				if($this.attr("checked")) { 
1521					fields[$this.attr('name')] = $this.val(); 
1522	//				alert($this.attr('name')+': '+ $this.attr('type')+' CHECKED- '+$this.val());
1523				}
1524			} else if($this.attr('type') == "checkbox") { 
1525				if($this.attr("checked")) { 
1526					fields[$this.attr('name')] = $this.val(); 
1527	//				alert($this.attr('name')+': '+ $this.attr('type')+' CHECKED- '+$this.val());
1528				}
1529
1530			} else { 
1531				fields[$this.attr('name')] = $this.val(); 
1532			}
1533		});
1534		$.post(tempfolder+'/sy-inc/store/store_cart_actions.php', fields,	function (data) { 
1535			data = $.trim(data);
1536			if(data == "good") { 
1537				if($("#requirereturn").val() !== "") { 
1538					window.location.href=$("#requirereturn").val();
1539				} else if($("#sub").val() !== "") { 
1540					window.location.href="index.php?sub="+$("#sub").val();
1541				} else { 
1542					window.location.href=indexpage+"?view="+view;
1543				}
1544			} else { 
1545				 $("#loginresponse").html(data);
1546					$("#loginsubmitpage").show();
1547					$("#loginloadingpage").hide();
1548
1549			}
1550		});
1551	return false;
1552	}
1553}
1554
1555function newpassword(classname) { 
1556	var fields = {};
1557	var rf = false;
1558	var mes;
1559	$("#forgotloginresponse").hide();
1560
1561	$(".fprequired").each(function(i){
1562		var this_id = this.id;
1563		if($('#'+this_id).val() == "") { 
1564			$('#'+this_id).addClass('inputError');
1565			rf = true;
1566		} else { 
1567			$('#'+this_id).removeClass('inputError');
1568		}
1569	} );
1570	if(rf == true) { 
1571		return false;
1572	} else { 
1573
1574
1575		$('.'+classname).each(function(){
1576			var $this = $(this);
1577			if( $this.attr('type') == "radio") { 
1578				if($this.attr("checked")) { 
1579					fields[$this.attr('name')] = $this.val(); 
1580				}
1581			} else if($this.attr('type') == "checkbox") { 
1582				if($this.attr("checked")) { 
1583					fields[$this.attr('name')] += ","+$this.val(); 
1584				}
1585
1586			} else { 
1587				fields[$this.attr('name')] = $this.val(); 
1588			}
1589		});
1590		$.post(tempfolder+'/sy-inc/store/store_cart_actions.php', fields,	function (data) { 
1591			data = $.trim(data);
1592			if(data == "good") { 
1593				 $("#forgotloginresponse").show();
1594				 $("#forgotloginresponse").html($("#forgotloginresponse").attr("success"));
1595				 $("#forgotemailmessage").hide();
1596				 $("#forgotemail").val("");
1597			} else { 
1598				 $("#forgotloginresponse").show();
1599				 $("#forgotloginresponse").html(data);
1600				 $("#forgotemailmessage").hide();
1601			}
1602		});
1603	return false;
1604	}
1605}
1606
1607
1608function newpasswordpage(classname) { 
1609	var fields = {};
1610	var rf = false;
1611	var mes;
1612	$("#forgotloginresponsepage").hide();
1613
1614	$(".feprequired").each(function(i){
1615		var this_id = this.id;
1616		if($('#'+this_id).val() == "") { 
1617			$('#'+this_id).addClass('inputError');
1618			rf = true;
1619		} else { 
1620			$('#'+this_id).removeClass('inputError');
1621		}
1622	} );
1623	if(rf == true) { 
1624		return false;
1625	} else { 
1626
1627
1628		$('.'+classname).each(function(){
1629			var $this = $(this);
1630			if( $this.attr('type') == "radio") { 
1631				if($this.attr("checked")) { 
1632					fields[$this.attr('name')] = $this.val(); 
1633				}
1634			} else if($this.attr('type') == "checkbox") { 
1635				if($this.attr("checked")) { 
1636					fields[$this.attr('name')] += ","+$this.val(); 
1637				}
1638
1639			} else { 
1640				fields[$this.attr('name')] = $this.val(); 
1641			}
1642		});
1643		$.post(tempfolder+'/sy-inc/store/store_cart_actions.php', fields,	function (data) { 
1644			data = $.trim(data);
1645			if(data == "good") { 
1646				 $("#forgotloginresponsepage").show();
1647				 $("#forgotloginresponsepage").addClass("success").html($("#forgotloginresponsepage").attr("success"));
1648				 $("#pagelogin").show();
1649				 $("#forgotpasswordpage").hide();
1650				 $("#forgotemail").val("");
1651			} else { 
1652				 $("#forgotloginresponsepage").show();
1653				 $("#forgotloginresponsepage").html(data);
1654				 $("#forgotemailmessagepage").hide();
1655			}
1656		});
1657	return false;
1658	}
1659}
1660
1661
1662
1663function changepassword(classname) { 
1664	var fields = {};
1665	var rf = false;
1666	var mes;
1667	$("#changepasswordresponse").hide();
1668	$(".cprequired").each(function(i){
1669		var this_id = this.id;
1670		if($('#'+this_id).val() == "") { 
1671			$('#'+this_id).addClass('inputError');
1672			rf = true;
1673		} else { 
1674			$('#'+this_id).removeClass('inputError');
1675		}
1676	} );
1677	if(rf == true) { 
1678		return false;
1679	} else { 
1680
1681
1682		$('.'+classname).each(function(){
1683			var $this = $(this);
1684			if( $this.attr('type') == "radio") { 
1685				if($this.attr("checked")) { 
1686					fields[$this.attr('name')] = $this.val(); 
1687				}
1688			} else if($this.attr('type') == "checkbox") { 
1689				if($this.attr("checked")) { 
1690					fields[$this.attr('name')] += ","+$this.val(); 
1691				}
1692
1693			} else { 
1694				fields[$this.attr('name')] = $this.val(); 
1695			}
1696		});
1697		$.post(tempfolder+'/sy-inc/store/store_cart_actions.php', fields,	function (data) { 
1698			data = $.trim(data);
1699			if(data == "good") { 
1700				 $("#changepasswordresponse").show();
1701				 $("#changepasswordresponse").addClass("success").html($("#changepasswordresponse").attr("success"));
1702				 $("#forgotemailmessage").hide();
1703				 $("#forgotemail").val("");
1704			} else { 
1705				$("#newpass").val("");
1706				$("#renewpass").val("");
1707				 $("#changepasswordresponse").show();
1708				 $("#changepasswordresponse").html(data);
1709				 $("#forgotemailmessage").hide();
1710			}
1711		});
1712	return false;
1713	}
1714}
1715
1716	function changphonenumber(classname) { 
1717	var fields = {};
1718	var rf = false;
1719	var mes;
1720	$("#changephoneresponse").slideUp(100);
1721	$(".phonerequired").each(function(i){
1722		var this_id = this.id;
1723		if($('#'+this_id).val() == "") { 
1724			$('#'+this_id).addClass('inputError');
1725			rf = true;
1726		} else { 
1727			$('#'+this_id).removeClass('inputError');
1728		}
1729	} );
1730	if(rf == true) { 
1731		return false;
1732	} else { 
1733		$('.'+classname).each(function(){
1734			var $this = $(this);
1735			if( $this.attr('type') == "radio") { 
1736				if($this.attr("checked")) { 
1737					fields[$this.attr('name')] = $this.val(); 
1738				}
1739			} else if($this.attr('type') == "checkbox") { 
1740				if($this.attr("checked")) { 
1741					fields[$this.attr('name')] += ","+$this.val(); 
1742				}
1743			} else { 
1744				fields[$this.attr('name')] = $this.val(); 
1745			}
1746		});
1747
1748		if($("#phone_consent_1").attr("checked")) { 
1749			fields['phone_consent'] = "1";
1750		}
1751		if($("#phone_consent_2").attr("checked")) { 
1752			fields['phone_consent'] = "2";
1753		}
1754		$.post(tempfolder+'/sy-inc/store/store_cart_actions.php', fields,	function (data) { 
1755			data = $.trim(data);
1756			if(data == "good") { 
1757				 $("#changephoneresponse").slideDown(100);
1758			} else { 
1759				 $("#changephoneresponse").hide();
1760			}
1761		});
1762	return false;
1763	}
1764}
1765function changeemailaddress(classname) { 
1766	var fields = {};
1767	var rf = false;
1768	var mes;
1769	$("#changeemailresponse").hide();
1770	$(".emrequired").each(function(i){
1771		var this_id = this.id;
1772		if($('#'+this_id).val() == "") { 
1773			$('#'+this_id).addClass('inputError');
1774			rf = true;
1775		} else { 
1776			$('#'+this_id).removeClass('inputError');
1777		}
1778	} );
1779	if(rf == true) { 
1780		return false;
1781	} else { 
1782		$('.'+classname).each(function(){
1783			var $this = $(this);
1784			if( $this.attr('type') == "radio") { 
1785				if($this.attr("checked")) { 
1786					fields[$this.attr('name')] = $this.val(); 
1787				}
1788			} else if($this.attr('type') == "checkbox") { 
1789				if($this.attr("checked")) { 
1790					fields[$this.attr('name')] += ","+$this.val(); 
1791				}
1792			} else { 
1793				fields[$this.attr('name')] = $this.val(); 
1794			}
1795		});
1796		$.post(tempfolder+'/sy-inc/store/store_cart_actions.php', fields,	function (data) { 
1797			data = $.trim(data);
1798			if(data == "good") { 
1799				 $("#changeemailresponse").show();
1800				 $("#changeemailresponse").addClass("success").html($("#changeemailresponse").attr("success"));
1801			} else { 
1802				 $("#changeemailresponse").show();
1803				 $("#changeemailresponse").html(data);
1804			}
1805		});
1806	return false;
1807	}
1808}
1809function changeaddress(classname) { 
1810	var fields = {};
1811	var rf = false;
1812	var mes;
1813	$("#changeaddressresponse").hide();
1814	$(".required").each(function(i){
1815		var this_id = this.id;
1816		if($('#'+this_id).val() == "") { 
1817			$('#'+this_id).addClass('inputError');
1818			rf = true;
1819		} else { 
1820			$('#'+this_id).removeClass('inputError');
1821		}
1822	} );
1823	if(rf == true) { 
1824		return false;
1825	} else { 
1826		$('.'+classname).each(function(){
1827			var $this = $(this);
1828			if( $this.attr('type') == "radio") { 
1829				if($this.attr("checked")) { 
1830					fields[$this.attr('name')] = $this.val(); 
1831				}
1832			} else if($this.attr('type') == "checkbox") { 
1833				if($this.attr("checked")) { 
1834					fields[$this.attr('name')] += ","+$this.val(); 
1835				}
1836			} else { 
1837				fields[$this.attr('name')] = $this.val(); 
1838			}
1839		});
1840		$.post(tempfolder+'/sy-inc/store/store_cart_actions.php', fields,	function (data) { 
1841			data = $.trim(data);
1842			if(data == "good") { 
1843				 $("#changeaddressresponse").show();
1844				 $("#changeaddressresponse").addClass("success").html($("#changeaddressresponse").attr("success"));
1845			} else { 
1846				 $("#changeaddressresponse").show();
1847				 $("#changeaddressresponse").html(data);
1848			}
1849		});
1850	return false;
1851	}
1852}
1853
1854
1855
1856function priceFormat(price) { 
1857	price = parseFloat(price).toFixed(2);
1858	fprice  = pformat.replace("[CURRENCY_SIGN]", cursign);
1859	fprice  = fprice.replace("[PRICE]", price);
1860	return fprice;
1861}
1862
1863function toggleShippingAddress() { 
1864	if($("#ship_billing1").attr("checked")) { 
1865		$("#checkoutshipping").slideUp(200);
1866
1867		$(".required").each(function(i){
1868			var this_id = this.id;
1869			$("#ship_"+this_id).val($('#'+this_id).val());
1870		} );
1871		
1872		$(".shiprequired").attr("readonly", "readonly");
1873		$(".shiprequired").addClass("disabledinput");
1874	} else { 
1875		$(".shiprequired").removeAttr("readonly");
1876		$(".shiprequired").removeClass("disabledinput");
1877		$("#checkoutshipping").slideDown(200);
1878
1879	}
1880	getTax();
1881}
1882
1883function updateShippingAddress() { 
1884	$("#ship_first_name").val($("#first_name").val());
1885	$("#ship_last_name").val($("#last_name").val());
1886	$("#ship_business").val($("#business_name").val());
1887	$("#ship_address").val($("#address").val());
1888	$("#ship_city").val($("#city").val());
1889	$("#ship_state").val($("#state").val());
1890	$("#ship_zip").val($("#zip").val());
1891	$("#ship_country").val($("#country").val());
1892}
1893
1894function updateCheckoutAddress()  {
1895	var fname = $("#first_name").val();	
1896	$("#ck_first_name").html(fname);
1897 	$("#ck_last_name").html($("#last_name").val());
1898 	$("#ck_email").html($("#email_address").val());
1899 	$("#ck_address").html($("#address").val());
1900 	$("#ck_city").html($("#city").val());
1901 	$("#ck_state").html($("#state").val());
1902 	$("#ck_zip").html($("#zip").val());
1903
1904//	if($("#ship_billing1").attr("checked")) { 
1905		$("#ship_first_name").val(fname);
1906		$("#ship_last_name").val($("#last_name").val());
1907		$("#ship_business").val($("#business_name").val());
1908		$("#ship_address").val($("#address").val());
1909		$("#ship_city").val($("#city").val());
1910		$("#ship_state").val($("#state").val());
1911		$("#ship_zip").val($("#zip").val());
1912		$("#ship_country").val($("#country").val());
1913//	}
1914
1915	$("#ship_ck_first_name").html($("#ship_first_name").val());
1916 	$("#ship_ck_last_name").html($("#ship_last_name").val());
1917 	$("#ship_ck_address").html($("#ship_address").val());
1918 	$("#ship_ck_city").html($("#ship_city").val());
1919 	$("#ship_ck_state").html($("#ship_state").val());
1920 	$("#ship_ck_zip").html($("#ship_zip").val());
1921
1922}
1923
1924
1925function noAccount() { 
1926	if($("#no_account").attr("checked")) { 
1927		$("#accountpasswords").hide();
1928		$("#newpassword").removeClass("required");
1929		$("#renewpassword").removeClass("required");
1930	} else { 
1931		$("#newpassword").addClass("required");
1932		$("#renewpassword").addClass("required");
1933		$("#accountpasswords").show();
1934
1935	}
1936//	$("#shippingaddress").slideToggle();
1937}
1938
1939
1940function checkForm(classname,terms) { 
1941	var noreturn = false;
1942	var er_mess = "Your have errors \r\n";
1943	
1944	$("."+classname).each(function(i){
1945		var this_id = this.id;
1946		if($('#'+this_id).val() == "") { 
1947			er_mess += $('#'+this_id).attr("errormessage")+"\r\n";
1948			noreturn = true;
1949
1950			$('#'+this_id).addClass('inputError');
1951		} else { 
1952			$('#'+this_id).removeClass('inputError');
1953		}
1954	} );
1955
1956
1957	if(terms == "1") { 
1958		if($("#agreeterms").attr("checked")) { 
1959
1960		} else { 
1961			er_mess += "You did not accept the terms & conditions \r\n";
1962			noreturn = true;
1963
1964		}
1965	}
1966
1967	if(noreturn == true) {
1968		alert(er_mess);
1969		return false;
1970	} else {
1971	clearbookingcheck();
1972	$("body").attr("data-checkout-timer","1");
1973	$("#cardSubmit-"+classname).hide();
1974	$("#cardSubmitLoading-"+classname).show();
1975
1976
1977	$('#checkout').submit(function() {
1978		return true;
1979	});
1980
1981		return true;
1982	}
1983	$('#checkout').submit(function() {
1984		return true;
1985	});
1986	return true;
1987}
1988function createaccountonly(classname,loggedin,ckpass,redirectindex,walldesigner,wdid,returnlink) { 
1989	var fields = {};
1990	if(redirectindex == 1) { 
1991		 $("#nasubmit").hide();
1992		 $("#nasubmitloading").show();
1993	}
1994	var rf = false;
1995	var mes;
1996	var stop;
1997	$("#consentselect").hide();
1998			$("#textconsentselect").hide();
1999	$("#acceptterms").hide();
2000
2001	if($("#gallery_contact_consent_no").length > 0) { 
2002	  if (!$("input[name='gallery_contact_consent']:checked").val()) {
2003			$("#consentselect").slideDown(200);
2004			 stop = true;
2005
2006		}
2007	}
2008	if($("#agreeterms").length > 0) { 
2009	  if (!$("input[name='agreeterms']:checked").val()) {
2010			$("#acceptterms").slideDown(200);
2011			 stop = true;
2012
2013		}
2014	}
2015
2016	if($("#phone_consent_1").length > 0) { 
2017		if($("#order_phone").val() !== "") { 
2018		  if (!$("input[name='phone_consent']:checked").val()) {
2019				$("#textconsentselect").slideDown(200);
2020				 stop = true;
2021			}
2022		}
2023	}
2024
2025
2026	$("#accresponse").slideUp(100).removeClass("error");
2027	$(".required").each(function(i){
2028		var this_id = this.id;
2029		if($('#'+this_id).val() == "") { 
2030			$('#'+this_id).addClass('inputError');
2031			rf = true;
2032		} else { 
2033			$('#'+this_id).removeClass('inputError');
2034		}
2035	} );
2036	if($("#email_address").attr("data-check") == "1") { 
2037		if($("#email_address").val() !== $("#email_address_2").val()) {
2038			 $("#accresponse").addClass("error").html($("#accresponse").attr("mismatchemail")).slideDown(100);
2039			if(redirectindex == 1) { 
2040				 $("#nasubmit").show();
2041				 $("#nasubmitloading").hide();
2042			}
2043
2044			 stop = true;
2045			 return false;
2046		}
2047	}
2048	$("#email_address").val($("#email_address").val().trim())
2049		if( !isValidEmailAddress($("#email_address").val())) { 
2050			$("#email_address").addClass('inputError');
2051			 $("#accresponse").addClass("error").html($("#email_address").attr("data-invalid-email")).slideDown(100);
2052			if(redirectindex == 1) { 
2053				 $("#nasubmit").show();
2054				 $("#nasubmitloading").hide();
2055			}
2056
2057			stop = true;
2058			 return false;
2059
2060		} else { 
2061			$("#email_address").removeClass('inputError');
2062		}
2063
2064
2065		if($("#first_name").val() !== "") { 
2066			if($("#first_name").val() == $("#last_name").val()) {
2067				 $("#accresponse").addClass("error").html($("#accresponse").attr("samefirstlastname")).slideDown(100);
2068					if(redirectindex == 1) { 
2069						 $("#nasubmit").show();
2070						 $("#nasubmitloading").hide();
2071					}
2072
2073				 stop = true;
2074				 return false;
2075			}
2076		}
2077
2078	if($("#newpassword").attr("data-check") == "1") { 
2079		if($("#newpassword").val() !== $("#renewpassword").val()) {
2080			$("#newpassword").val(""); 
2081			$("#renewpassword").val(""); 
2082			 $("#accresponse").addClass("error").html($("#accresponse").attr("passwordsnomatch")).slideDown(100);
2083			if(redirectindex == 1) { 
2084				 $("#nasubmit").show();
2085				 $("#nasubmitloading").hide();
2086			}
2087
2088			stop = true;
2089			return false;
2090		}
2091	}
2092
2093
2094	if(rf == true || stop == true) {
2095		if(rf == true) {
2096			 $("#accresponse").addClass("error").html($("#accresponse").attr("emptyfields")).slideDown(100);
2097			if(redirectindex == 1) { 
2098				 $("#nasubmit").show();
2099				 $("#nasubmitloading").hide();
2100			}
2101
2102		}
2103		return false;
2104	} else { 
2105
2106		$("#createaccountbuttonloading").show();
2107		$("#createaccountbuttondiv").hide();
2108		document.getElementById("createaccountbutton").disabled = true;
2109
2110
2111		$('.'+classname).each(function(){
2112			var $this = $(this);
2113			if( $this.attr('type') == "radio") { 
2114				if($this.attr("checked")) { 
2115					fields[$this.attr('name')] = $this.val(); 
2116	//				alert($this.attr('name')+': '+ $this.attr('type')+' CHECKED- '+$this.val());
2117				}
2118			} else if($this.attr('type') == "checkbox") { 
2119				if($this.attr("checked")) { 
2120					fields[$this.attr('name')] = $this.val(); 
2121	//				alert($this.attr('name')+': '+ $this.attr('type')+' CHECKED- '+$this.val());
2122				}
2123
2124			} else { 
2125				fields[$this.attr('id')] = $this.val(); 
2126				//fields[$this.attr('name')] = $this.val(); 
2127			}
2128		});
2129
2130		if(botdetect() == false) { 
2131			 $("#accresponse").html('<div class="pc"><div class="error" style="font-size: 21px;">I\m sorry, but our spam bot protection is thinking you might be a spam bot. If this is in error, please email us directly at ('+$("#from_message_to").attr("em")+'). Sorry for any inconvenience</div></div>');
2132		} else { 
2133			$.post(tempfolder+'/sy-inc/store/store_cart_actions.php', fields,	function (data) { 
2134
2135			data = $.trim(data);
2136			if(data == "good") { 
2137				if($("#accresponse").attr("data-email_confirm_account") == "1") { 
2138					$("#newaccount").slideUp(200, function() { 
2139						$("#newaccountconfirm").slideDown();
2140					});
2141
2142				} else { 
2143					if($("#return_page").length > 0) { 
2144						window.location.href=$("#return_page").val();	
2145					} else if(walldesigner == 1) { 
2146						window.location.href="index.php?view=room&rw="+wdid+"";
2147					} else if(returnlink == 1) { 
2148						window.location.href="index.php?view=returnlink";
2149					} else if(redirectindex == 1) { 
2150						window.location.href="index.php";
2151					} else if($("#return_page").length > 2) { 
2152						window.location.href=$("#return_page").val();
2153					} else { 
2154						$("#newaccount").slideUp(200, function() { 
2155							$("#newaccountsuccess").slideDown();
2156						});
2157					}
2158				}
2159			} else { 
2160				if(redirectindex == 1) { 
2161					 $("#nasubmit").show();
2162					 $("#nasubmitloading").hide();
2163				}
2164
2165			 $("#accresponse").addClass("error").html(data).slideDown(100);
2166			}
2167		});
2168		}
2169	}
2170	return false;
2171}
2172
2173function newAccountExpress(classname) { 
2174	var fields = {};
2175	var rf = false;
2176	var mes;
2177	$("#newaccountexpressresponse").hide();
2178
2179	$(".narequired").each(function(i){
2180		var this_id = this.id;
2181		if($('#'+this_id).val() == "") { 
2182			$('#'+this_id).addClass('inputError');
2183			rf = true;
2184		} else { 
2185			$('#'+this_id).removeClass('inputError');
2186		}
2187	} );
2188	if(rf == true) { 
2189		return false;
2190	} else { 
2191
2192
2193		$('.'+classname).each(function(){
2194			var $this = $(this);
2195			if( $this.attr('type') == "radio") { 
2196				if($this.attr("checked")) { 
2197					fields[$this.attr('name')] = $this.val(); 
2198				}
2199			} else if($this.attr('type') == "checkbox") { 
2200				if($this.attr("checked")) { 
2201					fields[$this.attr('name')] += ","+$this.val(); 
2202				}
2203
2204			} else { 
2205				fields[$this.attr('name')] = $this.val(); 
2206			}
2207		});
2208		$.post(tempfolder+'/sy-inc/store/store_cart_actions.php', fields,	function (data) { 
2209			data = $.trim(data);
2210			if(data == "good") { 
2211	//			alert("GOOD");
2212				window.location.href=tempfolder+"/index.php?view=account";
2213			} else { 
2214				 $("#newaccountexpressresponse").show();
2215				 $("#newaccountexpressresponse").html(data);
2216			}
2217		});
2218	return false;
2219	}
2220}
2221
2222function expressPlaceOrder() { 
2223	$("#placeexpress").hide();
2224	$("#expressloading").show();
2225}
2226
2227function fixbackground() { 
2228	p = $('#page-wrapper').offset().top - $(window).scrollTop();
2229	w = $('#page-wrapper').width();
2230	st = $("#page-wrapper").attr("st");
2231	if(st == "0") { 
2232		$("#page-wrapper").attr("st", $(window).scrollTop());
2233	}
2234	$("#page-wrapper").css({"position":"fixed", "top":p+"px", "left":"50%", "width":w+"px", "margin-left":"-"+w/2+"px"});
2235}
2236
2237function unfixbackground() { 
2238	$("#page-wrapper").css({"position":"relative", "top":"auto", "width":"100%", "left":"auto","margin-left":"auto"});
2239	$("body").scrollTop($("#page-wrapper").attr("st"));
2240	$("html").scrollTop($("#page-wrapper").attr("st"));
2241	$("#page-wrapper").attr("st", "0");
2242	adjustsite();
2243
2244}
2245
2246function closebuyphoto() { 
2247	$('html').unbind('click');
2248	$("#closebuyphoto").hide();
2249	// alert($("#vinfo").attr("package_thumb_photo"));
2250	$("#photoprods").fadeOut(20, function() { 
2251		if($("#vinfo").attr("view-photo-fixed") == "0") { 
2252			unfixbackground();
2253		}
2254		if($("#vinfo").attr("package_thumb_photo")!="") { 
2255			$("#vinfo").attr("package_from_thumb","");
2256			$("#vinfo").attr("package_thumb_photo","");
2257			unfixbackground();
2258		}
2259
2260		$("#photoprodsinner").html("");
2261		$("#thumbpreview").hide();
2262		$("#buybackground").fadeOut(20, function() { 
2263		/*
2264		 if($("#slideshow").attr("fullscreen") == 1) { 
2265			$(window).scrollTop($(window).scrollTop()+1);			
2266		 } else { 
2267			 $('#th-'+$("#slideshow").attr("curphoto")).scrollView();
2268		 }
2269		 */
2270		});
2271	});
2272}
2273
2274
2275function viewtermsconditions() { 
2276	fixbackground();
2277	$("#buybackground").fadeIn(50, function() { 
2278		$("#termsandconditions").css({"top":$(window).scrollTop()+50+"px"});
2279		if($("body").width() <= 800) { 
2280			$("#termsandconditions").css({"width":"100%","left":"0px","margin-left":"0px"});
2281		}
2282		$("#termsandconditions").fadeIn(200, function() { 
2283			$("#closebuyphoto").show();
2284		});
2285	});
2286}
2287
2288function viewaccounttermsconditions() { 
2289	fixbackground();
2290	$("#buybackground").fadeIn(50, function() { 
2291		$("#termsandconditions").css({"top":$(window).scrollTop()+50+"px"});
2292		if($("body").width() <= 800) { 
2293			$("#termsandconditions").css({"width":"100%","left":"0px","margin-left":"0px"});
2294		}
2295		$("#termsandconditions").fadeIn(200, function() { 
2296			$("#closebuyphoto").show();
2297		});
2298	});
2299}
2300
2301function agreetoterms() { 
2302	unfixbackground();
2303	$("#agreeterms").attr("checked", "checked");
2304	$("#termsandconditions").css({"top":$(window).scrollTop()+50+"px"});
2305	$("#termsandconditions").fadeOut(100, function() { 
2306	$("#buybackground").fadeOut(50);
2307	});
2308}
2309function donotagreetoterms() { 
2310	unfixbackground();
2311	$("#agreeterms").attr("checked",false);
2312	$("#termsandconditions").css({"top":$(window).scrollTop()+50+"px"});
2313	$("#termsandconditions").fadeOut(100, function() { 
2314	$("#buybackground").fadeOut(50);
2315	});
2316}
2317
2318
2319
2320function viewcart() { 
2321	hideMiniCart();
2322	fixbackground();
2323	window.scrollTo(0,0);
2324
2325	$("#buybackground").fadeIn(50, function() { 
2326		if(isslideshow) { 
2327			if(isslideshow == true) { 
2328				stopSlideshow();
2329			}
2330		}
2331
2332		if($("#vinfo").attr("view-photo-fixed") == "1") { 
2333		   $('html').animate({scrollTop:0}, 100); 
2334			$('body').animate({scrollTop:0}, 100); 
2335		}
2336		loading();
2337		pt = $("body").css("padding-top").replace("px", "");
2338		pt = Math.abs(pt);
2339		$("#photoprods").css({"top":50 + pt+"px"});
2340			$.get(tempfolder+"/sy-inc/store/store_view_cart_window.php", function(data) {
2341				$("#photoprodsinner").html(data);
2342				$("#photoprods").slideDown(200, function() { 
2343					if($("body").width() <= 800) { 
2344						$("#closebuyphototab").show();
2345					} else { 
2346						$("#closebuyphoto").show();
2347					}
2348					sizeBuyPhoto();
2349					loadingdone();
2350
2351					$('html').click(function() {
2352					 closebuyphoto();
2353					 });
2354
2355				 $('#photoprods').click(function(event){
2356					 event.stopPropagation();
2357				 });
2358
2359				});
2360			});
2361	});
2362}
2363
2364
2365function buyphotothumb(pkg,pic,date_id,pos,sub_id) { 
2366		clickthumbnail(pic);
2367}
2368function buyphoto(pkg,pic,date_id,fav_pl,sub_id) { 
2369	fixbackground();
2370	if(fav_pl) { 
2371		fav_pl = fav_pl;
2372	} else { 
2373		fav_pl = '0';
2374	}
2375	$("#buybackground").fadeIn(50,function() { 
2376		if(isslideshow == true) { 
2377			stopSlideshow();
2378		}
2379		fixbackground();
2380		window.scrollTo(0,0);
2381		loading();
2382		if(!pic) { 
2383			pic = $("#photo-"+$("#slideshow").attr("curphoto")).attr("pkey");
2384		}
2385		if(!date_id) { 
2386			date_id = $("#photo-"+$("#slideshow").attr("curphoto")).attr("did");
2387			if(typeof date_id === "undefined") { 
2388				date_id = $("#vinfo").attr("did");
2389			}
2390		}
2391		if(!sub_id) { 
2392			sub_id = $("#vinfo").attr("sub_id");
2393			if($("#vinfo").attr("view") == "favorites") { 
2394				sub_id = $("#photo-"+$("#slideshow").attr("curphoto")).attr("subid");
2395			}
2396		}
2397		$("#photoprods").css({"top":50+"px"});
2398			$.get(tempfolder+"/sy-inc/store/store_photos_buy_v2_list_products.php?pid="+pic+"&date_id="+date_id+"&mobile="+ismobile+"&sub_id="+sub_id+"&color_id="+$("#filter").attr("color_id")+"&packages="+pkg+"&group_id="+$("#vinfo").attr("group-id")+"&kid="+$("#vinfo").attr("kid")+"&keyWord="+$("#vinfo").attr("keyWord")+"&fav_pl="+fav_pl+"&view="+$("#vinfo").attr("view")+"&from_time="+$("#vinfo").attr("from_time")+"&search_date="+$("#vinfo").attr("search_date")+"&passcode="+$("#vinfo").attr("passcode")+"&search_length="+$("#vinfo").attr("search_length"), function(data) {
2399				$("#photoprodsinner").html(data);
2400
2401				$("#photoprods").slideDown(200, function() { 
2402					window.scrollTo(0,0);
2403					if($("body").width() <= 800) { 
2404						$("#closebuyphototab").show();
2405					} else { 
2406						$("#closebuyphoto").show();
2407					}
2408					sizeBuyPhoto();
2409					loadingdone();
2410
2411					$('html').click(function() {
2412					 closebuyphoto();
2413					 });
2414
2415			 $('#photoprods').click(function(event){
2416				 event.stopPropagation();
2417			 });
2418
2419				});
2420			});
2421	});
2422}
2423function showPackage() { 
2424	$("#buybackground").fadeIn(50);
2425	if(isslideshow == true) { 
2426		stopSlideshow();
2427	}
2428	loading();
2429	pic = $("#photo-"+$("#slideshow").attr("curphoto")).attr("pkey");
2430	date_id = $("#photo-"+$("#slideshow").attr("curphoto")).attr("did");
2431	sub_id = $("#vinfo").attr("sub_id");
2432	if($("#photopackagecontainer").attr("status") == "0") { 
2433		$("#photopackagecontainer").css({"top":$(window).scrollTop()+50+"px"});
2434		$("#photopackagecontainer").attr("status", "1");
2435	}
2436
2437		$.get(tempfolder+"/sy-inc/store/store_package_photo.php?pid="+pic+"&date_id="+date_id+"&sub_id="+sub_id+"&package_id="+$("#vinfo").attr("package-id")+"&view="+$("#vinfo").attr("view")+"&color_id="+$("#filter").attr("color_id"), function(data) {
2438			$("#photopackageinner").html(data);
2439			$("#photopackagecontainer").slideDown(200, function() { 
2440				$("#closeaddtopackage").show();
2441				sizeBuyPhoto();
2442				loadingdone();
2443
2444				$('html').click(function() {
2445				 closeaddtopackage();
2446				 });
2447
2448			 $('#photopackagecontainer').click(function(event){
2449				 event.stopPropagation();
2450			 });
2451
2452			});
2453		});
2454
2455}
2456
2457function showPackageOne() { 
2458	pic = $("#photo-"+$("#slideshow").attr("curphoto")).attr("pkey");
2459	date_id = $("#photo-"+$("#slideshow").attr("curphoto")).attr("did");
2460	sub_id = $("#vinfo").attr("sub_id");
2461	$.get(tempfolder+"/sy-inc/store/store_package_photo_one.php?pid="+pic+"&date_id="+date_id+"&sub_id="+sub_id+"&color_id="+$("#filter").attr("color_id"), function(data) {
2462		$("#singlephotopackagetabinner").html(data);
2463	});
2464}
2465
2466
2467
2468function closeaddedpackage() { 
2469	hideMiniCart();
2470	/*
2471	if($("#vinfo").attr("prodplace") == "0") { 
2472		closebuyphoto();
2473	}
2474	headerheight = $("#ssheader").height();
2475	$("#ssClose").css({"top":headerheight+"px"});
2476	*/
2477}
2478
2479function closeaddtopackage() { 
2480	$('html').unbind('click');
2481	$("#closeaddtopackage").hide();
2482	$("#buybackground").fadeOut(200);
2483	$("#photopackagecontainer").attr("status", "0");
2484	if($("#vinfo").attr("has_package_one") == 1 && $("#vinfo").attr("has_package") == "1") { 
2485		showPackageOne();
2486	}
2487
2488	$("#photopackagecontainer").slideUp(200, function() { 
2489		$("#photopackageinner").html("");
2490		// $("#thumbpreview").hide();
2491	});
2492}
2493
2494
2495
2496function sizeBuyPhoto() { 
2497	w = $("#thumbpreview").attr("dw");
2498	h = $("#thumbpreview").attr("dh");
2499	padding =$("#photoprodsinner").css('padding-top');
2500	padding = padding.replace("px", "");
2501
2502	ow = Math.abs($("#photobuyview").width() - Math.abs(padding));
2503//	alert(ow+" > "+w);
2504	if(ow < w) { 
2505		p = ow / w;
2506		h = Math.abs($("#thumbpreview").attr("dh")) * p;
2507		$("#thumbpreview").css({"width":ow+"px", "height":h+"px", "background-size": ow+"px "+h+"px"});
2508		$("#thumbpreview").attr("dw",ow);
2509		$("#thumbpreview").attr("dh",h);
2510	}
2511	$("#thumbpreview").fadeIn(200, function() { 
2512	});
2513}
2514
2515function filterPhoto(color,colorname,pic) { 
2516	if(isslideshow == true) { 
2517		stopSlideshow();
2518	}
2519	$("#filteroption-"+pic).slideUp(100);
2520
2521	pfid = $("#photoview-"+pic).attr("pfid");
2522	cid = $("#photo-"+$("#slideshow").attr("curphoto")).attr("cid");
2523	if(color == "original") { 
2524		$("#photoview-"+pic).attr("src", tempfolder+"/sy-photo.php?thephoto="+pic+"|"+pfid+"|"+cid+"");
2525		$("#filtername").html("");
2526		$("#filter").attr("color_id","");
2527	} else { 
2528	loading();
2529
2530		$("#photoview-"+pic).attr("src", tempfolder+"/sy-photo.php?thephoto="+pic+"|"+pfid+"|"+cid+"|"+color);
2531		$("#photoview-"+pic).imagesLoaded(function() {
2532		$("#photoview-"+pic).fadeIn(200);
2533			//$("#filtername").html(colorname);
2534			$("#filter").attr("color_id", color);
2535			loadingdone();
2536		});
2537	}
2538}
2539
2540function removeFilterPhoto() { 
2541	if($("#filter").attr("color_id") !=="") { 
2542		pic = $("#photo-"+$("#slideshow").attr("curphoto")).attr("pkey");
2543		pfid = $("#photo-"+$("#slideshow").attr("curphoto")).attr("pfid");
2544		cid = $("#photo-"+$("#slideshow").attr("curphoto")).attr("cid");
2545		$("#photo-"+$("#slideshow").attr("curphoto")).attr("src", $("#photo-"+$("#slideshow").attr("curphoto")).attr("thissrc"));
2546		$("#filtername").html("");
2547		$("#filter").attr("color_id","");
2548	}
2549}
2550
2551function adjustqty(id,dir) {
2552	if(dir == "up") { 
2553		val = parseInt($("#"+id).val()) + 1;
2554	}
2555	if(dir == "down") { 
2556		val = parseInt($("#"+id).val()) - 1;
2557		if(val < 1) { 
2558			val = 1;
2559		}
2560	}
2561	$("#"+id).val(val);
2562}   
2563
2564
2565function cropphoto(pic,photoprod,cart_id,rotate,change,disable) { 
2566//	$("#buybackground").fadeIn(50);
2567	hideMiniCart();
2568	$('html').unbind('click');
2569	loading();
2570	if(!pic) { 
2571		pic = $("#photo-"+$("#slideshow").attr("curphoto")).attr("pkey");
2572	}
2573
2574	$("#photocrop").css({"top":$(window).scrollTop()+50+"px"});
2575		$.get(tempfolder+"/sy-inc/store/store_photo_crop.php?pid="+pic+"&photoprod="+photoprod+"&cart_id="+cart_id+"&rotate="+rotate+"&change="+change+"&disable="+disable, function(data) {
2576			$("#photocropinner").html(data);
2577			$("#photocrop").slideDown(200, function() { 
2578				$("#closephotocrop").show();
2579	//			sizeBuyPhoto();
2580				loadingdone();
2581			});
2582		});
2583}
2584
2585function closecropphoto() { 
2586	$('html').unbind('click');
2587	$("#photocrop").slideUp(200, function() { 
2588		$("#photocropinner").html("");
2589	});
2590}
2591
2592function addphotofav(pic,date_id,sub_id) { 
2593
2594	if($("#photoview-"+pic).attr("data-fav") == "1") { 
2595		$.get(tempfolder+"/sy-inc/store/store_cart_actions.php?action=removefromfavs&pid="+pic+"&did="+date_id, function(data) {	
2596			// $("#favoritestotaltop").html(data);
2597			$(".favoritestotal").html(data);
2598			$("#photoview-"+pic).attr("data-fav","0");
2599			if(data <= 0) { 
2600				$(".viewphotofavoriteslink").hide();
2601			}
2602		});
2603		$(".photo-fav-"+pic).removeClass("icon-heart").addClass("icon-heart-empty");
2604	} else { 
2605		gsbg = $("#gs-gal-id").val();
2606		gs_bg_id = $("#gs-bgimage-id").val();
2607
2608		$(".photo-fav-"+pic).removeClass("icon-heart-empty").addClass("icon-heart");
2609		$("#photoview-"+pic).attr("data-fav","1");
2610
2611		$.get(tempfolder+"/sy-inc/store/store_cart_actions.php?action=addtofavs&pid="+pic+"&did="+date_id+"&sub_id="+sub_id+"&gsbg="+gsbg+"&gs_bg_id="+gs_bg_id, function(data) {
2612			$(".favoritestotal").html(data);
2613			if(data > 0) { 
2614				$(".viewphotofavoriteslink").show();
2615				$(".viewimageshoppingcart").slideDown(200);
2616			} else { 
2617				$(".viewphotofavoriteslink").hide();
2618
2619			}
2620
2621		});
2622		$(".favoritesviewing").show();
2623	}
2624}
2625
2626function comparephoto(pic,date_id,sub_id) { 
2627
2628	if($("#photoview-"+pic).attr("data-compare") == "1") { 
2629		$(".checked-"+pic).hide();
2630		$.get(tempfolder+"/sy-inc/store/store_cart_actions.php?action=removecompare&pid="+pic+"&did="+date_id+"&sub_id="+sub_id, function(data) {	
2631			$(".comparetotal").html(data);
2632			if(data > 1) { 
2633				$(".comparebar").slideDown(100, function() { });
2634			} else { 
2635				$(".comparebar").slideUp(100, function() { });
2636			}
2637		});
2638		$("#photoview-"+pic).attr("data-compare", "0");
2639	} else { 
2640		$(".checked-"+pic).show();
2641		$("#photoview-"+pic).attr("data-compare","1");
2642
2643		$.get(tempfolder+"/sy-inc/store/store_cart_actions.php?action=addtocompare&pid="+pic+"&did="+date_id+"&sub_id="+sub_id, function(data) {
2644			$(".comparetotal").html(data);
2645			if(data > 1) { 
2646				$(".comparebar").slideDown(100, function() { });
2647			} else { 
2648				$(".comparebar").slideUp(100, function() { });
2649			}
2650		});
2651	}
2652}
2653
2654function showcomparephotos() { 
2655	parent.location.hash = '#compare';
2656	$("#slideshow").attr("comparephotos","1")
2657	$("#comparephotos").fadeIn(100);
2658	$.get(tempfolder+"/sy-inc/store/store_cart_actions.php?action=comparephotosshow", function(data) {	
2659		window.scrollTo(0,0);
2660		$("body").css({"overflow-y":"hidden"});
2661		$("#comparephotosdisplay").html("").append(data).css({"margin-top":$("#comparenav").outerHeight()+"px", "top":"0"});
2662		newh = $(window).height() - $("#comparenav").outerHeight();
2663		// $("#log").show().html($(window).height()+" outter height:  "+$("#comparenav").outerHeight()+" = "+newh);
2664		$(".comparetd").css({"height":newh+"px"});
2665		$("#comparephotosdisplaycontainer").css({"top":$("#comparenav").outerHeight()+"px"});
2666		$("#comparephotosdisplaycontainer").css({"height":newh+"px"});
2667		$(".comparephoto").each(function(i){
2668			if($(this).attr("hh") > newh) { 
2669				$(this).css({"height":newh+"px"});
2670			}
2671		})
2672
2673		$(".comparetable").css({"height":newh+"px", "display":"block", "top":"0","position":"absolute", "margin":"auto"});
2674		$("#comparephotosdisplay").fadeIn(100, function() { 
2675			$(".compareactionscontainer").each(function(i){
2676				po = $(this).parent().offset().left;
2677				$(this).css({"position":"absolute", "left":po + 20+"px","top":$(this).parent().find(".comparephoto").position().top + 40+"px"});
2678				// $("#log").show().append(":  "+$(this).parent().find(".comparephoto").position().top);
2679			})
2680			
2681		});
2682	});
2683}
2684function removecompareview(p,td,key) { 
2685	$.get(tempfolder+"/sy-inc/store/store_cart_actions.php?action=removecompareview&p="+p, function(data) {	
2686		$("#"+td).fadeOut(100, function() { 
2687			
2688		if($("#slideshow").attr("curphoto") == $("[pkey="+key+"]").attr("ppos")) { 
2689			$(".checked").hide();
2690		}
2691
2692		$("[pkey="+key+"]").attr("compare","0");
2693
2694			$("#comparetotal").html(data);
2695			if(data <=0) { 
2696				closecomparephotos();
2697			}
2698			if(data == 1) { 
2699				$("#comparebar").slideUp(100, function() { 
2700					sizePhoto($("#slideshow").attr("curphoto"));	
2701						if($("#photoproductsnexttophoto").css('display') == "none") { 
2702							sscloseright = 0;
2703						} else { 
2704							sscloseright = $("#photoproductsnexttophoto").css('width');
2705						}
2706						$("#ssClose").css({"top":$("#ssheader").height()+"px","right":sscloseright});
2707				});
2708			}
2709			$(".compareactionscontainer").each(function(i){
2710				po = $(this).parent().offset().left;
2711				$(this).css({"position":"absolute", "left":po + 20+"px","top":$(this).parent().find(".comparephoto").position().top + 40+"px"});
2712				// $("#log").show().append(":  "+$(this).parent().find(".comparephoto").position().top);
2713			})
2714			
2715
2716		});
2717	});
2718
2719}
2720
2721function compareviewclick(u) { 
2722	window.location.href=u;
2723}
2724
2725function closecomparephotos(clear) { 
2726	$("#slideshow").attr("comparephotos","0");
2727	if(clear == "1") { 
2728		$.get(tempfolder+"/sy-inc/store/store_cart_actions.php?action=removeallcompare", function(data) {	
2729			$(".comparecheck").hide();
2730			$(".photoviewphoto").attr("data-compare","0");
2731			$(".comparebar").slideUp(100, function() { });
2732		});
2733	}
2734
2735
2736	$("#comparephotosdisplay").fadeOut(100, function() { 
2737		$("#comparephotosdisplay").html("");
2738		$("#comparephotos").fadeOut(100);
2739		$("body").css({"overflow-y":"auto"});
2740	});
2741	
2742
2743}
2744
2745
2746function addphotofavthumb(pos,pic_key) { 
2747	gsbg = $("#gs-gal-id").val();
2748	gs_bg_id = $("#gs-bgimage-id").val();
2749
2750	if($("#photo-fav-"+pic_key).hasClass("icon-heart")) { 
2751		$.get(tempfolder+"/sy-inc/store/store_cart_actions.php?action=removefromfavs&pid="+pic_key+"&did="+$("#photo-fav-"+pic_key).attr("did")+"&gsbg="+gsbg, function(data) {	
2752			$("#favoritestotaltop").html(data);
2753			$(".favoritestotaltop").html(data);
2754			if(data <= 0) { 
2755				$(".viewphotofavoriteslink").hide();
2756			}
2757
2758		});
2759
2760		$("#photo-fav-"+pic_key).removeClass("icon-heart").addClass("icon-heart-empty");
2761		$("#photo-"+pic_key).attr("fav", "0");
2762	} else { 
2763		$("#photo-fav-"+pic_key).removeClass("icon-heart-empty").addClass("icon-heart");
2764		$.get(tempfolder+"/sy-inc/store/store_cart_actions.php?action=addtofavs&pid="+pic_key+"&did="+$("#photo-fav-"+pic_key).attr("did")+"&sub_id="+$("#photo-fav-"+pic_key).attr("sub_id")+"&gsbg="+gsbg+"&gs_bg_id="+gs_bg_id, function(data) {
2765			$("#favoritestotaltop").html(data);
2766			$(".favoritestotaltop").html(data);
2767			if(data > 0) { 
2768				$(".viewphotofavoriteslink").show();
2769			}
2770
2771		});
2772	}
2773}
2774
2775
2776function hidephoto(pos,pic_key) { 
2777	gsbg = $("#gs-gal-id").val();
2778	if($("#photo-hide-"+pic_key).hasClass("on")) { 
2779		$.get(tempfolder+"/sy-inc/store/store_cart_actions.php?action=unhidephoto&pid="+pic_key+"&did="+$("#photo-hide-"+pic_key).attr("did")+"&gsbg="+gsbg, function(data) {	
2780			// $("#favoritestotaltop").html(data);
2781			// $(".favoritestotaltop").html(data);
2782		});
2783		$("#th-"+pic_key).removeClass("hiddenphoto");
2784		if($("#photo-hide-"+pic_key).removeClass("on"));
2785		$(".photo-message-"+pic_key).html("").hide();
2786		$("#photo-hide-"+pic_key).addClass("icon-eye").removeClass("icon-eye-off");
2787
2788		// $("#photo-hide-"+pic_key).attr("title",$("#photo-hide-"+pic_key).attr("data-hide"));
2789	} else { 
2790		$("#th-"+pic_key).addClass("hiddenphoto");
2791		if($("#photo-hide-"+pic_key).addClass("on"));
2792		$(".photo-message-"+pic_key).html($("#photo-hide-"+pic_key).attr("data-hidden-message")).show();
2793		$.get(tempfolder+"/sy-inc/store/store_cart_actions.php?action=hidephoto&pid="+pic_key+"&did="+$("#photo-hide-"+pic_key).attr("did")+"&sub_id="+$("#photo-fav-"+pic_key).attr("sub_id")+"&gsbg="+gsbg, function(data) {
2794		//	$("#favoritestotaltop").html(data);
2795		//	$(".favoritestotaltop").html(data);
2796			$("#photo-hide-"+pic_key).removeClass("icon-eye").addClass("icon-eye-off");
2797		});
2798	}
2799}
2800
2801
2802function hidephotofull(pos,pic) { 
2803	gsbg = $("#gs-gal-id").val();
2804	date_id = $("#vinfo").attr("did");
2805
2806	if(Math.abs($("#photoview-"+pic).attr("pic_hide")) > 0) { 
2807		$.get(tempfolder+"/sy-inc/store/store_cart_actions.php?action=unhidephoto&pid="+pic+"&did="+date_id+"&gsbg="+gsbg, function(data) {	
2808			// $("#favoritestotaltop").html(data);
2809			// $(".favoritestotaltop").html(data);
2810			$(".hidephoto-"+pic).removeClass("icon-eye-off").addClass("icon-eye");
2811			$("#th-"+pic).removeClass("hiddenphoto");
2812			$(".hiddenphotomessage-"+pic).html($("#photoview-"+pic).attr("ht")).slideUp(100);
2813			$(".photo-message-"+pic).html("").hide();
2814			$("#photo-hide-"+pic).removeClass("icon-eye-off").addClass("icon-eye");
2815		});
2816
2817
2818		/*
2819		if($("#photo-hide-"+pic).removeClass("on"));
2820		if($(".photo-message-"+pic)) { 
2821			$(".photo-message-"+pic).html("").hide();
2822		}
2823		$("#hidden-full-photo").hide();
2824		*/
2825		$("#photoview-"+pic).attr("pic_hide","0")
2826		// $("#photo-hide-"+pic).attr("title",$("#photo-hide-"+pic).attr("data-hide"));
2827	} else { 
2828		$("#th-"+pic).addClass("hiddenphoto");
2829		/*
2830		if($("#photo-hide-"+pic).addClass("on"));
2831		if($(".photo-message-"+pic)) { 
2832			$(".photo-message-"+pic).html($("#photo-"+pic).attr("ht")).show();
2833		}
2834		*/
2835		$.get(tempfolder+"/sy-inc/store/store_cart_actions.php?action=hidephoto&pid="+pic+"&did="+date_id+"&gsbg="+gsbg, function(data) {
2836			$(".hidephoto-"+pic).removeClass("icon-eye").addClass("icon-eye-off");
2837			$(".hiddenphotomessage-"+pic).html($("#photoview-"+pic).attr("ht")).slideDown(100);
2838			$(".photo-message-"+pic).html($("#photo-hide-"+pic).attr("data-hidden-message")).show();
2839			$("#photo-hide-"+pic).removeClass("icon-eye").addClass("icon-eye-off");
2840
2841			$("#hidden-full-photo").show();
2842			$("#photoview-"+pic).attr("pic_hide","1")
2843		//	$("#favoritestotaltop").html(data);
2844		//	$(".favoritestotaltop").html(data);
2845		});
2846	}
2847}
2848
2849
2850function removefavthumb(pos,pic_key) { 
2851	date_id = $("#vinfo").attr("did");
2852	$.get(tempfolder+"/sy-inc/store/store_cart_actions.php?action=removefromfavs&pid="+pic_key+"&did="+date_id, function(data) {	
2853		$("#favoritestotal").html(data);
2854		$("#favoritestotaltop").html(data);
2855			$(".favoritestotaltop").html(data);
2856	});
2857	$("#styledthumb-"+pos).fadeOut(200);
2858
2859}
2860
2861function PopupCenter(url, title, w, h) {
2862    // Fixes dual-screen position                         Most browsers      Firefox
2863    var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : screen.left;
2864    var dualScreenTop = window.screenTop != undefined ? window.screenTop : screen.top;
2865
2866    width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
2867    height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;
2868
2869    var left = ((width / 2) - (w / 2)) + dualScreenLeft;
2870    var top = ((height / 2) - (h / 2)) + dualScreenTop;
2871    var newWindow = window.open(url, title, 'scrollbars=yes, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
2872
2873    // Puts focus on the newWindow
2874    if (window.focus) {
2875        newWindow.focus();
2876    }
2877}
2878
2879
2880function sharephoto(type,url,appid,name,siteurl,pub,pic,url,descr,sharefile) { 
2881	if(url.indexOf("?")>0) { 
2882		sep = "&";
2883	} else {
2884		sep = "?";
2885	}
2886	imgvar = "image";
2887
2888
2889	$.get(tempfolder+"/sy-inc/store/store_cart_actions.php?action=logshare&did="+$("#vinfo").attr("did")+"&where="+type+"&pic="+pic, function(data) {	});
2890
2891
2892
2893	if(type == "email") { 
2894		PopupCenter("mailto:?subject=Photo&body="+url+""+encodeURIComponent(sep)+""+imgvar+"="+pic+"%0D%0A"+descr, type, 640, 480)
2895	}
2896
2897
2898	if(type == "facebook") { 
2899		PopupCenter("http://www.facebook.com/dialog/share?app_id="+appid+"&href="+url+""+encodeURIComponent(sep)+""+imgvar+"="+pic+"&picture="+sharefile+"&name="+name+"&description="+descr+"&display=popup&close=true", type, 800, 480)
2900
2901	}
2902
2903	if(type == "pinterest") { 
2904		PopupCenter("//pinterest.com/pin/create/button/?url="+url+""+encodeURIComponent(sep)+""+imgvar+"="+pic+"&media="+sharefile+"&description="+name, type, 640, 480)
2905	}
2906
2907	if(type == "twitter") { 
2908		PopupCenter("https://twitter.com/intent/tweet?text="+name+"&url="+url+""+encodeURIComponent(sep)+""+imgvar+"="+pic, type, 640, 480)
2909	}
2910}
2911
2912function sharephotothumb(type,url,pic,appid,name,siteurl,pub, pic_key) { 
2913//	pic = $("#photo-"+$("#slideshow").attr("curphoto")).attr("pkey");
2914//	url = $("#photo-"+$("#slideshow").attr("curphoto")).attr("pagelink");
2915	descr = $("#displayThumbnailPage").attr("data-share-descr");
2916
2917	if(url.indexOf("?")>0) { 
2918		sep = "&";
2919	} else {
2920		sep = "?";
2921	}
2922	imgvar = "image";
2923
2924
2925	$.get(tempfolder+"/sy-inc/store/store_cart_actions.php?action=logshare&did="+$("#vinfo").attr("did")+"&where="+type+"&pic="+pic_key, function(data) {	});
2926
2927
2928
2929	if(type == "email") { 
2930		PopupCenter("mailto:?subject=Photo&body="+url+"%0D%0A"+descr, type, 640, 480)
2931	}
2932
2933	if(type == "facebook") { 
2934		PopupCenter("https://www.facebook.com/dialog/share?app_id="+appid+"&href="+url+"&picture="+pic+"&name="+name+"&description="+descr+"&display=popup&close=true", type, 800, 480)
2935	}
2936
2937	if(type == "pinterest") { 
2938		PopupCenter("//pinterest.com/pin/create/button/?url="+url+"&media="+pic+"&description="+name, type, 640, 480)
2939	}
2940
2941	if(type == "twitter") { 
2942		PopupCenter("https://twitter.com/intent/tweet?text="+name+"&url="+url, type, 640, 480)
2943	}
2944}
2945function selectPaymentOption(thisopt,thisform) { 
2946	$(".payoption").each(function(i){
2947		var this_id = this.id;
2948		$("#"+this_id).hide();
2949	} );
2950	$("#"+thisform).show();
2951	if(thisopt == "square"){ 
2952		// sqPaymentForm.setPostalCode($("#zip").val());
2953		$("#checkout").attr("action",$("#checkout").attr("data-square-action"));
2954	} else { 
2955		$("#checkout").attr("action",$("#checkout").attr("data-action"));
2956	}
2957}
2958
2959function selectPaymentFromOrder() { 
2960	$("#paymentdiv").css({"top":$(window).scrollTop()+"px"});
2961	if($("#square-sel").attr("checked")) { 
2962	// 	sqPaymentForm.setPostalCode($("#zip").val());
2963	}
2964	$("#paymentdivbg").fadeIn(50, function() { 
2965		$("#paymentdiv").fadeIn(100, function() { 
2966			$("#closepaymentdiv").fadeIn(50);
2967		});
2968	});
2969}
2970function closeSelectPaymentFormOrder() { 
2971	$("#closepaymentdiv").fadeOut(100);
2972	$("#paymentdiv").fadeOut(100, function() { 
2973
2974		$("#paymentdivbg").fadeOut(100);
2975	});
2976
2977}
2978
2979function ppexpresscheckout() { 
2980	hideMiniCart();
2981	fixbackground();
2982	$("#buybackground").fadeIn(50, function() { 
2983		if(isslideshow) { 
2984			if(isslideshow == true) { 
2985				stopSlideshow();
2986			}
2987		}
2988		loading();
2989		$("#photoprods").css({"top":50+"px", "max-width":"400px","width":"100%","margin-left":"-200px"});
2990			$.get(tempfolder+"/sy-inc/store/store_express.php", function(data) {
2991				$("#photoprodsinner").html(data);
2992				$("#photoprods").slideDown(200, function() { 
2993					if($("body").width() <= 800) { 
2994						$("#closebuyphototab").show();
2995					} else { 
2996						$("#closebuyphoto").show();
2997					}
2998					loadingdone();
2999
3000					$('html').click(function() {
3001					 closebuyphoto();
3002					 });
3003
3004				 $('#photoprods').click(function(event){
3005					 event.stopPropagation();
3006				 });
3007
3008				});
3009			});
3010	});
3011}
3012

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.