// JavaScript Documentvar page_loaded = false;var https_bool = false;if(location.protocol == "https:") https_bool = true;	function handleDivTag(divtag){	   var divtag;	   return divtag;	}	   function createRequestObject() {        var req;        if(window.XMLHttpRequest){            req = new XMLHttpRequest();        } else if(window.ActiveXObject) {            req = new ActiveXObject("Microsoft.XMLHTTP");        } else {            alert("There was a problem creating the XMLHttpRequest object");        }        return req;    }        // Make the XMLHttpRequest object    var http = createRequestObject();	var divhandler = new handleDivTag(null);    var add_request_number = 0;	var timeoutID = new Array();	var timeoutID1 = new Array();	var holder = "";	var products_page = new Array();	function set_holder() {		if (document.getElementById("adding_layer")) holder = document.getElementById("adding_layer").innerHTML;	}    function sendRequest(more,divtag) {		if (divtag == "mini_cart") {			//alert(divtag);			document.getElementById(divtag).innerHTML = "<div style='padding: 10px;'>Loading...</div>";			http.open("get", "mini_cart.php?"+more);		}		else if (divtag == "event_detail") {			document.getElementById(divtag).innerHTML = "<div style='padding: 10px;'>Loading...</div>";			http.open("get", "mini_email.php?"+more);		}        http.onreadystatechange = handleResponse;		divhandler.divtag = divtag;        http.send(null);    }    function handleResponse() {		//alert("in handle: "+http.status);        if(http.readyState == 4 && http.status == 200){            // Text returned FROM PHP script            var response = http.responseText;            if(response) {                document.getElementById(divhandler.divtag).innerHTML = response;				setTimeout("update_view()",50);				if (divhandler.divtag == "event_detail") {					if (document.getElementById("your_name")) document.getElementById("your_name").focus();				}            }        }    }	//cart functions:	function update_product(mc_cart_product_id) {			if (document.getElementById("qty_"+mc_cart_product_id).value) {				var qty = document.getElementById("qty_"+mc_cart_product_id).value;				//FIRST, GET MAX QUANTITY			var url = "filebin/ajax/php/get_max_quantity.php?product_id="+mc_cart_product_id;			var xml = new JKL.ParseXML(url);			var data = xml.parse();			var proceed = true;			if (data.result) {				var max = data.result.max;				var existing = data.result.existing;								//SKIP IF NO MAX OR NO EXISTING				if (max != 0 && existing) {									//DON'T PROCEED IF QTY IS BIGGER THAN MAX					if (parseInt(qty) > parseInt(max)) {														proceed = false;					}				}							}						if (proceed) {						var more = "action=update&";				more += "mc_cart_product_id="+document.getElementById("prod_"+mc_cart_product_id).value;				more += "&qty="+document.getElementById("qty_"+mc_cart_product_id).value;				setTimeout("sendRequest('"+more+"', 'mini_cart')",50);				//sendRequest(more,'mini_cart');				//sendRequest('action=display','cart_total');						} else {							alert("You cannot add "+qty+" product(s) to your cart.\nThere is a limit of "+max+". Please see the product page for more information on ordering larger quantities of this item.");								//RESET QTY 				document.getElementById("qty_"+mc_cart_product_id).value = existing;							}		}	}	function remove_product(mc_cart_product_id) {		var more = "action=remove&";		more += "mc_cart_product_id="+document.getElementById("prod_"+mc_cart_product_id).value;		setTimeout("sendRequest('"+more+"', 'mini_cart')",50);		//sendRequest(more,'mini_cart');	}	function validateInteger( strValue ) {	  var objRegExp  = /(^-?\d\d*$)/;	  return objRegExp.test(strValue);	}	function qty_call(product_id, event) {		price_options(product_id);		}	function price_options_all(product_ids) {		if (product_ids.length>0) {			//			var more = "action=option_price&";			var product_id_s = new Array();			var var_line_id_s = new Array();			var qty_id_s = new Array();			var gift_wrap_id_s = new Array();			for(z=0;z<product_ids.length;z++) {				if (document.getElementById("form_product")) {					var form_obj = document.getElementById("form_product");					var var_line = "";					//										for(i=0;i<form_obj.length;i++) {						if (form_obj[i].name == "product_vo") {							if (form_obj[i].value != "") var_line += form_obj[i].value +",";						}					}					if (var_line != "") {						var length = var_line.length;						var_line = var_line.substring(0, length-1); 					}					//					var temp_gift_wrap = "No";					if (document.getElementById("gift_wrap_"+product_ids[z])) 						if (document.getElementById("gift_wrap_"+product_ids[z]).checked == true) temp_gift_wrap = "Yes";					var qty_product = 0;					if (document.getElementById("qty_"+product_ids[z])) qty_product = parseInt(document.getElementById("qty_"+product_ids[z]).value);					//alert(qty_product);					qty_id_s[z] = qty_product;					var_line_id_s[z] = var_line;					product_id_s[z] = product_ids[z];					gift_wrap_id_s[z] = temp_gift_wrap;				}			}//end for loop			//let's generate request for it			var product_id = product_id_s.join(";");			var product_vo = var_line_id_s.join(";");			var gift_wrap = gift_wrap_id_s.join(";");			var qty = qty_id_s.join(";");			more +="product_id="+product_id+"&product_vo="+product_vo+"&gift_wrap="+gift_wrap+"&qty="+qty;			var url = "filebin/xml/price_options_xml.php?"+more;			var xml = new JKL.ParseXML(url);			var data = xml.parse();			if (data) {				var prod_res = data.products.product;				alert(prod_res.product_id);				for (f=0;f<prod_res.length;f++) {					alert(prod_res[f]["product_id"]);					if (document.getElementById("total_options_price_"+prod_res[f]["product_id"])) {						var price_option_total = prod_res[f]["total_price"];						if (price_option_total!="") 							document.getElementById("total_options_price_"+prod_res[f]["product_id"]).innerHTML = "<span class='price'>Product Total: $"+price_option_total+"</span>";					}				}			}		}	}	function price_options(product_id) {		if (document.getElementById("form_product")) {			var form_obj = document.getElementById("form_product");			var var_line = "";			var more = "action=option_price&product_id="+product_id;			for(i=0;i<form_obj.length;i++) {				if (form_obj[i].name == "product_vo") {					if (form_obj[i].value != "") var_line += form_obj[i].value +",";				}			}			if (var_line != "") {				var length = var_line.length;				var_line = var_line.substring(0, length-1);				more += "&product_vo="+var_line;			}			if (document.getElementById("gift_wrap_"+product_id)) {				if (document.getElementById("gift_wrap_"+product_id).checked == true) more += "&gift_wrap=Yes";				else more += "&gift_wrap=No";			}			else {				more += "&gift_wrap=No";			}			var qty_product = 0;			if (document.getElementById("qty_"+product_id)) qty_product = parseInt(document.getElementById("qty_"+product_id).value);			if (document.getElementById("qty_"+product_id)) more += "&qty="+qty_product;			if (qty_product != "NaN" && qty_product>0) {				var url = "filebin/xml/price_option_xml.php?"+more;				var xml = new JKL.ParseXML(url);				var data = xml.parse();				var price_option_total = data.total_price;				//alert(data.total_price);				if (document.getElementById("dynamic_price_"+product_id)) {					if (price_option_total!="") document.getElementById("dynamic_price_"+product_id).innerHTML = "Product Total: $"+price_option_total;				}			}		}	}	function price_options_text(product_id) {		if (document.getElementById("form_product")) {			//check/uncheck box:			if (document.getElementById("gift_wrap_"+product_id)) {				if (document.getElementById("gift_wrap_"+product_id).checked == true) document.getElementById("gift_wrap_"+product_id).checked = false;				else document.getElementById("gift_wrap_"+product_id).checked = true;			}			var form_obj = document.getElementById("form_product");			var var_line = "";			var more = "action=option_price&product_id="+product_id;			for(i=0;i<form_obj.length;i++) {				if (form_obj[i].name == "product_vo") {					if (form_obj[i].value != "") var_line += form_obj[i].value +",";				}			}			if (var_line != "") {				var length = var_line.length;				var_line = var_line.substring(0, length-1);				more += "&product_vo="+var_line;			}			if (document.getElementById("gift_wrap_"+product_id)) {				if (document.getElementById("gift_wrap_"+product_id).checked == true) more += "&gift_wrap=Yes";				else more += "&gift_wrap=No";			}			else {				more += "&gift_wrap=No";			}			if (document.getElementById("qty_"+product_id)) more += "&qty="+document.getElementById("qty_"+product_id).value;			var url = "filebin/xml/price_option_xml.php?"+more;			var xml = new JKL.ParseXML(url);			var data = xml.parse();			var price_option_total = data.total_price;			if (document.getElementById("total_options_price_"+product_id)) {				if (price_option_total!="") document.getElementById("total_options_price_"+product_id).innerHTML = "<span class='price'>Price (USD): $"+price_option_total+"</span>";			}		}	}	var gr = 0;	function apply_price_options() {		if (window.product_ids_arr) {			price_options(product_ids_arr);			//price_options_all(product_ids_arr);			//for(i=0;i<product_ids_arr.length;i++) {			//	//alert(product_ids_arr[i]);			//	setTimeout("price_options('"+product_ids_arr[i]+"')",50*i);			//}		}	}		function add_product(product_id,obj,max) {			try {			if (page_loaded) {					if (validateInteger(document.getElementById("qty_"+product_id).value) && document.getElementById("qty_"+product_id).value>0) {							current_qty = document.getElementById("qty_"+product_id).value;				//FIRST CHECK FOR PRESENCE OF REQUIRED OPEN V/O FIELDS				var vo_proceed = true;				var vo_alert = "";				if (document.getElementById('variety_prod')) {					var input_arr = document.getElementById('variety_prod').getElementsByTagName("input");									for (i=0;i<input_arr.length;i++) {						if (input_arr[i].className == "options_required" || input_arr[i].className == "options_highlight") {								input_arr[i].className = "options_required";														//ENSURE REQUIRED INPUT IS NOT EMPTY							if (input_arr[i].value == "") {								input_arr[i].className = "options_highlight";								vo_proceed = false;							}						}					}				}										//PROCEED IF REQUIRED FIELDS ARE COMPLETED				if (vo_proceed) {								//CHECK IF MAX REACHED					if (max == 0) {												//NO MAX - FINE TO ADD						var proceed = true;											} else {						if (parseInt(current_qty) > parseInt(max)) {													//SELECTED IS OVER MAX - IMMEDIATELY BLOCK							var proceed = false;							alert("You cannot add "+current_qty+" product(s) to your cart.\nThere is a limit of "+max+". Please see the product page for more information on ordering larger quantities of this item.");													} else {													//RUN QUERY TO CHECK CART							var url = "filebin/ajax/php/check_max_quantity.php?product_id="+product_id;							var xml = new JKL.ParseXML(url);							var data = xml.parse();							if (data.result) {								var in_cart = data.result;																//alert(parseInt(in_cart) + parseInt(current_qty));																if ((parseInt(in_cart) + parseInt(current_qty)) > max) {																									//COMBINATION IS TOO MANY									var proceed = false;									alert("You cannot add "+current_qty+" product(s) to your cart.\nThere is a limit of "+max+" and you already have "+in_cart+" in your cart. Please see the product page for more information on ordering larger quantities of this item.");																	} else {																	//COMBINATION IS BELOW MAX									var proceed = true;															}								} else {																//DB ERROR - COULDN"T ACCESS CART								var proceed = true;							}						}					}									if (proceed) {											//var product_id = document.getElementById("product_id").value;						var form_obj = document.getElementById("form_product");						var var_line = "";						var var_open = "";						var more = "action=add_product&product_id="+product_id;						//if gift certificate						var gc = 0;						var gc_err = "";						if (form_obj.recipient_name) {							gc = 1;							if (form_obj.purchaser_name && form_obj.purchaser_name.value != "") more+="&purchaser_name="+encodeURIComponent(form_obj.purchaser_name.value);							else gc_err += "Please provide the Purchaser's name."+"\n";							if (form_obj.recipient_name && form_obj.recipient_name.value != "") more+="&recipient_name="+encodeURIComponent(form_obj.recipient_name.value);							else gc_err += "Please provide the Recipient's name."+"\n";							if (form_obj.recipient_address && form_obj.recipient_address.value != "") more+="&recipient_address="+encodeURIComponent(form_obj.recipient_address.value);							else gc_err += "Please provide the Recipient's address."+"\n";							if (form_obj.recipient_email && form_obj.recipient_email.value != "") more+="&recipient_email="+encodeURIComponent(form_obj.recipient_email.value);							//else gc_err += "Please, provide Recipient Email"+"\n";														if (form_obj.recipient_message && form_obj.recipient_message.value != "") more+="&recipient_message="+encodeURIComponent(form_obj.recipient_message.value);														if (form_obj.tip && parseInt(form_obj.tip.value)>0) more+="&tip="+encodeURIComponent(parseInt(form_obj.tip.value));										if (form_obj.custom_price && parseInt(form_obj.custom_price.value)>0) {								if (document.getElementById("gift_required_amount") && parseInt(form_obj.custom_price.value)>=parseInt(document.getElementById("gift_required_amount").innerHTML))									more+="&custom_price="+encodeURIComponent(parseInt(form_obj.custom_price.value));								else gc_err += "Please, provide right Amount for Certificate"+": "+parseInt(document.getElementById("gift_required_amount").innerHTML)+"\n";							}							else if (form_obj.custom_price) {								gc_err += "Please, provide Amount for Certificate"+"\n";							}							//recipient_message							//more+="&gc_delivery="+encodeURIComponent(form_obj.gc_delivery.value);							//if (form_obj.gc_delivery.value == "Email" && form_obj.recipient_email.value == "") gc_err += "Please, provide Recipient Email"+"\n";						}						//+"&gift_message="+document.getElementById("gift_message_"+product_id).value;						//alert(more);								if (document.getElementById("qty_"+product_id).value <= 10000) {						//For var and objects						var reqz = 1;						for(i=0;i<form_obj.length;i++) {							//alert(number[i].value);							if (form_obj[i].name == "product_vo") {								if (form_obj[i].value != "") var_line += form_obj[i].value +",";								else reqz = 0;								//alert(form_obj[i].name+" - "+form_obj[i].value);								//k++;							}						}						if (var_line != "") {							var length = var_line.length;							var_line = var_line.substring(0, length-1);							more += "&product_vo="+var_line;						}							//For open var and values						var reqz_open = 1;						for(i=0;i<form_obj.length;i++) {							//alert(number[i].value);							if (form_obj[i].name == "product_vo_open") {																//FIRST, GET LABEL								var label_id = form_obj[i].id;								//product_vo_open_1								label_id = "product_vo_open_label_"+label_id.substring(16);								if (document.getElementById(label_id)) {									var label = document.getElementById(label_id).value;								}																//SAVE VALUE OF OPEN FIELD								if (form_obj[i].value != "") var_open += label+": "+form_obj[i].value +"***";								else reqz_open = 0;								//alert(form_obj[i].name+" - "+form_obj[i].value);								//k++;							}						}						if (var_open != "") {							var length_open = var_open.length;							var_open = var_open.substring(0, length_open-3);							more += "&product_vo_open="+var_open;						}							more += "&qty="+document.getElementById("qty_"+product_id).value;						if (document.getElementById("gift_wrap_"+product_id)) {							if (document.getElementById("gift_wrap_"+product_id).checked == true) more += "&gift_wrap=Yes";							else more += "&gift_wrap=No";						}						else {							more += "&gift_wrap=No";						}									if (gc == 0) {							//no gift certificate:							if (reqz == 1) {								document.getElementById("current_add_id").value = product_id;								//alert(reqz);								display_adding_div(obj,product_id);								adding_id = product_id;								more += "&url="+location.href;								sendRequest(more, 'mini_cart');								more = "";							}							if (reqz == 0) {								alert("Please, select size...");								more = "";							}						}						else if (gc == 1) {							//gift certificate							if (gc_err == "") {								document.getElementById("current_add_id").value = product_id;								display_adding_div(obj,product_id);								adding_id = product_id;								setTimeout("sendRequest('"+more+"', 'mini_cart')",100);							}							else if (gc_err != "") {								alert(gc_err);								more = "";							}												}					}								}			} else {									//SHOW PERSONALIZED ERROR					alert('Please complete the required personalized fields, highlighted in red.');								}		}		else {			//document.getElementById("qty_"+product_id).style.color = 'red';		}	}		}		catch(e) {		alert(e);	}	}function add_product_no_popup(product_id,obj,max) {		//Ben playing 10/21			try {					if (page_loaded) {					if (validateInteger(document.getElementById("qty_"+product_id).value) && document.getElementById("qty_"+product_id).value>0) {							current_qty = document.getElementById("qty_"+product_id).value;				//FIRST CHECK FOR PRESENCE OF REQUIRED OPEN V/O FIELDS				var vo_proceed = true;				var vo_alert = "";				if (document.getElementById('variety_prod')) {					var input_arr = document.getElementById('variety_prod').getElementsByTagName("input");									for (i=0;i<input_arr.length;i++) {						if (input_arr[i].className == "options_required" || input_arr[i].className == "options_highlight") {								input_arr[i].className = "options_required";														//ENSURE REQUIRED INPUT IS NOT EMPTY							if (input_arr[i].value == "") {								input_arr[i].className = "options_highlight";								vo_proceed = false;							}						}					}				}										//PROCEED IF REQUIRED FIELDS ARE COMPLETED				if (vo_proceed) {								//CHECK IF MAX REACHED					if (max == 0) {												//NO MAX - FINE TO ADD						var proceed = true;											} else {						if (parseInt(current_qty) > parseInt(max)) {													//SELECTED IS OVER MAX - IMMEDIATELY BLOCK							var proceed = false;							alert("You cannot add "+current_qty+" product(s) to your cart.\nThere is a limit of "+max+". Please see the product page for more information on ordering larger quantities of this item.");													} else {													//RUN QUERY TO CHECK CART							var url = "filebin/ajax/php/check_max_quantity.php?product_id="+product_id;							var xml = new JKL.ParseXML(url);							var data = xml.parse();							if (data.result) {								var in_cart = data.result;																//alert(parseInt(in_cart) + parseInt(current_qty));																if ((parseInt(in_cart) + parseInt(current_qty)) > max) {																									//COMBINATION IS TOO MANY									var proceed = false;									alert("You cannot add "+current_qty+" product(s) to your cart.\nThere is a limit of "+max+" and you already have "+in_cart+" in your cart. Please see the product page for more information on ordering larger quantities of this item.");																	} else {																	//COMBINATION IS BELOW MAX									var proceed = true;															}								} else {																//DB ERROR - COULDN"T ACCESS CART								var proceed = true;							}						}					}									if (proceed) {											//var product_id = document.getElementById("product_id").value;						var form_obj = document.getElementById("form_product_bmv");						var var_line = "";						var var_open = "";						var more = "action=add_product&product_id="+product_id;						//if gift certificate						var gc = 0;						var gc_err = "";						if (form_obj.recipient_name) {							gc = 1;							if (form_obj.purchaser_name && form_obj.purchaser_name.value != "") more+="&purchaser_name="+encodeURIComponent(form_obj.purchaser_name.value);							else gc_err += "Please provide the Purchaser's name."+"\n";							if (form_obj.recipient_name && form_obj.recipient_name.value != "") more+="&recipient_name="+encodeURIComponent(form_obj.recipient_name.value);							else gc_err += "Please provide the Recipient's name."+"\n";							if (form_obj.recipient_address && form_obj.recipient_address.value != "") more+="&recipient_address="+encodeURIComponent(form_obj.recipient_address.value);							else gc_err += "Please provide the Recipient's address."+"\n";							if (form_obj.recipient_email && form_obj.recipient_email.value != "") more+="&recipient_email="+encodeURIComponent(form_obj.recipient_email.value);							//else gc_err += "Please, provide Recipient Email"+"\n";														if (form_obj.recipient_message && form_obj.recipient_message.value != "") more+="&recipient_message="+encodeURIComponent(form_obj.recipient_message.value);														if (form_obj.tip && parseInt(form_obj.tip.value)>0) more+="&tip="+encodeURIComponent(parseInt(form_obj.tip.value));										if (form_obj.custom_price && parseInt(form_obj.custom_price.value)>0) {								if (document.getElementById("gift_required_amount") && parseInt(form_obj.custom_price.value)>=parseInt(document.getElementById("gift_required_amount").innerHTML))									more+="&custom_price="+encodeURIComponent(parseInt(form_obj.custom_price.value));								else gc_err += "Please, provide right Amount for Certificate"+": "+parseInt(document.getElementById("gift_required_amount").innerHTML)+"\n";							}							else if (form_obj.custom_price) {								gc_err += "Please, provide Amount for Certificate"+"\n";							}							//recipient_message							//more+="&gc_delivery="+encodeURIComponent(form_obj.gc_delivery.value);							//if (form_obj.gc_delivery.value == "Email" && form_obj.recipient_email.value == "") gc_err += "Please, provide Recipient Email"+"\n";						}						//+"&gift_message="+document.getElementById("gift_message_"+product_id).value;						//alert(more);								if (document.getElementById("qty_"+product_id).value <= 10000) {						//For var and objects						var reqz = 1;						for(i=0;i<form_obj.length;i++) {							//alert(number[i].value);							if (form_obj[i].name == "product_vo") {								if (form_obj[i].value != "") var_line += form_obj[i].value +",";								else reqz = 0;								//alert(form_obj[i].name+" - "+form_obj[i].value);								//k++;							}						}						if (var_line != "") {							var length = var_line.length;							var_line = var_line.substring(0, length-1);							more += "&product_vo="+var_line;						}							//For open var and values						var reqz_open = 1;						for(i=0;i<form_obj.length;i++) {							//alert(number[i].value);							if (form_obj[i].name == "product_vo_open") {																//FIRST, GET LABEL								var label_id = form_obj[i].id;								//product_vo_open_1								label_id = "product_vo_open_label_"+label_id.substring(16);								if (document.getElementById(label_id)) {									var label = document.getElementById(label_id).value;								}																//SAVE VALUE OF OPEN FIELD								if (form_obj[i].value != "") var_open += label+": "+form_obj[i].value +"***";								else reqz_open = 0;								//alert(form_obj[i].name+" - "+form_obj[i].value);								//k++;							}						}						if (var_open != "") {							var length_open = var_open.length;							var_open = var_open.substring(0, length_open-3);							more += "&product_vo_open="+var_open;						}							more += "&qty="+document.getElementById("qty_"+product_id).value;						if (document.getElementById("gift_wrap_"+product_id)) {							if (document.getElementById("gift_wrap_"+product_id).checked == true) more += "&gift_wrap=Yes";							else more += "&gift_wrap=No";						}						else {							more += "&gift_wrap=No";						}									if (gc == 0) {							//no gift certificate:							if (reqz == 1) {								document.getElementById("current_add_id").value = product_id;								//alert(reqz);								//display_adding_div(obj,product_id);								adding_id = product_id;								more += "&url="+location.href;								sendRequest(more, 'mini_cart');								more = "";							}							if (reqz == 0) {								alert("Please, select size...");								more = "";							}						}						else if (gc == 1) {							//gift certificate							if (gc_err == "") {								document.getElementById("current_add_id").value = product_id;								//display_adding_div(obj,product_id);								adding_id = product_id;								setTimeout("sendRequest('"+more+"', 'mini_cart')",100);							}							else if (gc_err != "") {								alert(gc_err);								more = "";							}												}					}								}			} else {									//SHOW PERSONALIZED ERROR					alert('Please complete the required personalized fields, highlighted in red.');								}		}		else {			//document.getElementById("qty_"+product_id).style.color = 'red';		}	}		}		catch(e) {		alert(e);	}	}  // end Ben playing	function clear_cart() {		var more = "action=clear_cart";		sendRequest(more,'mini_cart');	}		function update_shipping() {		var shipping_set = document.getElementsByName("shipping");		var ship_value = "";		if (shipping_set.length>0) {			for (i=0;i<shipping_set.length;i++) {				//alert(shipping_set[i].type+" "+shipping_set[i].checked+" "+shipping_set[i].value);				if (shipping_set[i].type == "radio" && shipping_set[i].checked == true) ship_value = shipping_set[i].value;			}		}		var more = "action=shipping&shipping="+ship_value;		//setTimeout("sendRequest('"+more+"', 'mini_cart')",100);		sendRequest(more,'mini_cart');	}	function display_cart() {		if (document.getElementById("mini_cart").style.display == "none") document.getElementById("mini_cart").style.display='block';		else document.getElementById("mini_cart").style.display='none';		//update_view();	}	function add_coupon() {		if (document.getElementById("coupon").value != "") {			var more = "action=coupon&coupon="+document.getElementById("coupon").value;			sendRequest(more, "mini_cart");		}	}	function update_view() {		http.open("get", "cart_total.php");		http.onreadystatechange = handleResponse1;		http.send(null);	}	function add_info(prod_id) {		var qty = document.getElementById("qty_"+prod_id).value;		http.open("get", "filebin/ajax/php/add_product_info.php?product_id="+prod_id+"&qty="+qty);		http.onreadystatechange = handleResponse2;		http.send(null);	}	function handleResponse2() {	   if(http.readyState == 4 && http.status == 200){		  var response = http.responseText;		  if(response) {			 if (document.getElementById("adding_layer")) document.getElementById("adding_layer").innerHTML = response;		  }		   }		}	function handleResponse1() {	   if(http.readyState == 4 && http.status == 200){		  var response = http.responseText;		  if(response) {			 // UPDATE ajaxTest content			 if (document.getElementById("cart_total")) {				 document.getElementById("cart_total").innerHTML = response;				 if (document.getElementById("current_add_id") && document.getElementById("current_add_id").value != "") {					var pr_add_id = document.getElementById("current_add_id").value;					document.getElementById("current_add_id").value = "";					if (document.getElementById("adding_layer")) add_info(pr_add_id);				 }			 }		  }		  else {			response = "something";  		  }		   }		}	function close_adding_layer() {		if (document.getElementById("adding_layer")) {			document.getElementById("adding_layer").style.display = "none";			document.getElementById("adding_layer").innerHTML = holder;			if (document.getElementById('overlay').style.display != 'none') hideOverlay();			if (browser == 'Internet Explorer'){				hideSelects('visible');			}			adding_id = "";		}	}//	function trimAll( strValue ) {	 var objRegExp = /^(\s*)$/;		//check for all spaces		if(objRegExp.test(strValue)) {		   strValue = strValue.replace(objRegExp, '');		   if( strValue.length == 0)			  return strValue;		}	   //check for leading & trailing spaces	   objRegExp = /^(\s*)([\W\w]*)(\b\s*$)/;	   if(objRegExp.test(strValue)) {		   //remove leading and trailing whitespace characters		   strValue = strValue.replace(objRegExp, '$2');		}	  return strValue;	}	function validate_email() {		var more = "email="+document.getElementById("email_reg").value;		sendRequest(more,'check_email');	}	function clear_check() {		document.getElementById("check_email").innerHTML = "&nbsp;";	}//registry suff here:	var product_list_id = "";	//keep current hml content in spec var	var whishlist_html = "";		function add_wishlist(e, product_id, mc_account_id) {			try {				if (product_id == "") product_id = product_list_id;		product_list_id = "";		var more = "product_id="+product_id+"&mc_account_id="+mc_account_id;		if (mc_account_id != "") {			//get qty if not set to 1;			var qty = 1;			if (document.getElementById("qty_"+product_id)) qty = parseInt(document.getElementById("qty_"+product_id).value);			//validateInteger(document.getElementById("qty_"+product_id).value)			if (qty>0) {					//For var and objects					var form_obj = document.getElementById("form_product");					var var_line = "";					for(i=0;i<form_obj.length;i++) {						//alert(number[i].value);						if (form_obj[i].name == "product_vo") {							if (form_obj[i].value != "") var_line += form_obj[i].value +",";							//alert(form_obj[i].value);							//k++;						}					}					if (var_line != "") {						var length = var_line.length;						var_line = var_line.substring(0, length-1);						more += "&product_vo="+var_line;					}					//end var and options									more += "&qty="+qty;					more += "&url="+location.href;					var url = "filebin/xml/add_wishlist_xml.php?"+more;					var xml = new JKL.ParseXML(url);					var data = xml.parse();					var suc = data.instance.action;					if (suc==1) {						if (document.getElementById("registry_list")) {							display_registry_contents(e, product_id, mc_account_id);							whishlist_html = document.getElementById("registry_list").innerHTML;							document.getElementById("registry_list").innerHTML = data.instance.html_return;						}						else {							alert("Product In Your Wish List!");							close_reg();						}						//document.getElementById("wish_"+product_id).value = "In WL";					}					else {						alert("Oops!");						//document.getElementById("wish_"+product_id).value = "Add WL";						//document.getElementById("wish_"+product_id).disabled = false;					}					//close_reg();			}			else {				//document.getElementById("qty_"+product_id).style.color = 'red';			}		}		else {			alert("You have to login to your account first.");			}		}		catch(e) {			alert(e);		}	}function show_registry(e) {		if (page_loaded && document.getElementById("registry_list").style.display != "block") {				//GET MC_ACCOUNT_ID		if (document.getElementById("hidden_account")) {			var mc_account_id = document.getElementById("hidden_account").value;		}				//IF USER IS LOGGED IN, ADD PRODUCT TO WISHLIST		if (mc_account_id && mc_account_id != "") {					//GET PRODUCT ID				if (document.getElementById("hidden_id")) {					var product_id = document.getElementById("hidden_id").value;				} 				if (product_id && product_id != "") {								add_wishlist(e, product_id, mc_account_id);				} else {										//SHOW ERROR IF USER HAS NOT SELECTED A WISHLIST					alert("Please first specify which product you would like to add to your wish list.");				}				//ELSE, DISPLAY LOGIN PROMPT		} else {			display_registry_contents(e, product_id, mc_account_id);		}	}  }function display_registry_contents(e, mc_account_id) {	if (page_loaded && document.getElementById("registry_list").style.display != "block") {    	centerDiv('registry_list', 100, 400); 	}		}  function centerDiv(targetDiv, topMargin, divWidth) {	//GET SCREEN SIZE	var intH = 0;	var intW = 0;	if (self.innerHeight) {	   intH = window.innerHeight;	   intW = window.innerWidth;	} else {		if (document.documentElement && document.documentElement.clientHeight) {			intH = document.documentElement.clientHeight;			intW = document.documentElement.clientWidth;		} else {			if (document.body) {				intH = document.body.clientHeight;				intW = document.body.clientWidth;			}		}	}		//GET SCROLL POSITION FOR POP-UP Y-POSITION	var spos = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop;		var ypos = parseInt(spos + parseInt(topMargin), 10); //INCLUDES TOP MARGIN	var xpos = parseInt((intW - parseInt(divWidth)) / 2, 10); //INCLUDES WIDTH OF DIV	document.getElementById(targetDiv).style.left = xpos+"px";	document.getElementById(targetDiv).style.top = ypos+"px";	//HIDE SELECTS	if (browser == 'Internet Explorer'){		hideSelects('hidden');	}	//SHOW TARGET DIV	document.getElementById(targetDiv).style.display = "block";	//SHOW OVERLAY	showOverlay();		  }   function close_reg() {	if (document.getElementById("registry_list") && document.getElementById("registry_list").style.display != "none") {		document.getElementById("registry_list").style.display = "none";		if 	(document.getElementById("registry_list")) {			if (whishlist_html != "") {				document.getElementById("registry_list").innerHTML = whishlist_html;				whishlist_html = "";			}		}		//lightbox close:		if (document.getElementById('overlay').style.display != 'none') {			hideOverlay();			hideSelects('visible');		}		//	}  }  function reg_on(obj) {	  obj.className = "div_on";  }  function reg_off(obj) {	  obj.className = "div_off";  }  //////////	//////////function event_d() {	if (page_loaded) {		var more = "action=form";		sendRequest(more,'event_detail');	}}function moveObject1(e) {	if (page_loaded) {		centerDiv('event_detail', 100, 400); 			event_d();	}	}function moveObject_sewcool(e) {	if (page_loaded) {		centerDiv('event_detail', 100, 400); 			event_sewcool();	}}function event_sewcool() {	if (page_loaded) {		var more = "action=sewcool_form";		sendRequest(more,'event_detail');	}}function moveObject(e) {  var tempX = 0;  var tempY = 0;  var offset = 5;  if (document.all) {    tempX = event.clientX + document.documentElement.scrollLeft;//document.body.scrollLeft;    tempY = event.clientY + document.documentElement.scrollTop;//document.body.scrollTop;	//alert(event.clientY+" ScrollTop:"+document.documentElement.scrollTop);  } else {    tempX = e.pageX;    tempY = e.pageY;  }  // step 4  if (tempX < 0){tempX = 0}  if (tempY < 0){tempY = 0}  	tempY = tempY - 45;	document.getElementById("event_iframe").style.left = tempX+"px";	document.getElementById("event_iframe").style.top = tempY+"px";	//alert(tempX+" "+tempY);	document.getElementById("event_iframe").style.display = "block";		document.getElementById("event_detail").style.left = tempX+"px";	document.getElementById("event_detail").style.top = tempY+"px";	//alert(tempX+" "+tempY);	document.getElementById("event_detail").style.display = "block";	event_d();  }   function close_div() {	if (document.getElementById("event_detail")) {		if (document.getElementById("event_iframe")) document.getElementById("event_iframe").style.display = "none";		//lightbox close:		if (document.getElementById('overlay').style.display != 'none') {			hideOverlay();			hideSelects('visible');		}		//		document.getElementById("event_detail").style.display = "none";	}	if (document.getElementById("new_pop")) {		document.getElementById("new_pop").style.display = "none";	} } function send_email() {	obj = document.s_email;	var more = "action=send_email";	more += "&your_name="+encodeURIComponent(obj.your_name.value);	more += "&your_email="+encodeURIComponent(obj.your_email.value);	more += "&friend_name="+encodeURIComponent(obj.friend_name.value);	more += "&friend_email="+encodeURIComponent(obj.friend_email.value);	more += "&message="+encodeURIComponent(obj.message.value);	more += "&cc_me="+encodeURIComponent(obj.cc_me.value);	if(obj.opt_in_send.checked == true) { 		more += "&opt_in_send="+encodeURIComponent(obj.opt_in_send.value);	} else {		more += "&opt_in_send=No";	}	more += "&page_url="+location.href;	sendRequest(more,'event_detail'); }  function send_email_sewcool() {	obj = document.s_email;	var more = "action=send_email_sewcool";	more += "&your_name="+encodeURIComponent(obj.your_name.value);	more += "&your_email="+encodeURIComponent(obj.your_email.value);	more += "&friend_email="+encodeURIComponent(obj.friend_email.value);	more += "&message="+encodeURIComponent(obj.message.value);	more += "&cc_me="+encodeURIComponent(obj.cc_me.value);	if(obj.opt_in_send.checked == true) { 		more += "&opt_in_send="+encodeURIComponent(obj.opt_in_send.value);	} else {		more += "&opt_in_send=No";	}	sendRequest(more,'event_detail'); }function printpage() {	window.print();  }function addOnloadEvent(fnc){  if ( typeof window.addEventListener != "undefined" ) {	window.addEventListener( "load", fnc, false );  }  else if ( typeof window.attachEvent != "undefined" ) {    window.attachEvent( "onload", fnc );  }  else {    if ( window.onload != null ) {      var oldOnload = window.onload;      window.onload = function ( e ) {        oldOnload( e );        window[fnc]();      };    }    else      window.onload = fnc;  }}addOnloadEvent(load_mini_cart);addOnloadEvent(set_holder);// TO set products total on Load use bellow//addOnloadEvent(apply_price_options);//set array to keep var and optionvar var_opt_arr = new Array();function load_mini_cart() {	if (document.getElementById("mini_cart") && !https_bool) sendRequest("action=display", "mini_cart");}function findPos(obj) {	var curleft = curtop = 0;	if (obj.offsetParent) {		curleft = obj.offsetLeft		curtop = obj.offsetTop		while (obj = obj.offsetParent) {			//alert(curleft+" + "+obj.offsetLeft);			//special case ieght6			if (obj.offsetLeft>=0)	curleft += obj.offsetLeft;			else curleft += 200;			//curleft += obj.offsetLeft;			curtop += obj.offsetTop		}	}	return [curleft,curtop];}function display_adding_div(obj,id) {	if (obj) {		var spec_objs = obj.getElementsByTagName("img");		var img_obj = spec_objs[0];		if (document.getElementById("productsContent_"+id)) {			img_obj = document.getElementById("productsContent_"+id);		}				//OLD STYLE FOR DISPLAYING POP-UP LAYER		/*var coor = findPos(img_obj);		//set coordinat for adding layer		if (document.getElementById("adding_layer")) {			var obj_display = document.getElementById("adding_layer");			if (browser == 'Internet Explorer'){				//alert("Change");				hideSelects('hidden');			}			if (obj_display.style.display == "block") {				obj_display.style.display = "none";				obj_display.innerHTML = holder;			}			if (document.getElementById("productsContent_"+id)) {				coor[0] = coor[0] + (parseInt(document.getElementById("productsContent_"+id).offsetWidth) - 400) - 2;				coor[1] = coor[1] + (parseInt(document.getElementById("productsContent_"+id).offsetHeight) - 100) - 2;				//alert("Div: "+coor[0]+"  "+coor[1]);			}			else {				//we are on a product page based on add to cart image button				coor[0] = coor[0] + (parseInt(img_obj.width) - 345);				coor[1] = coor[1] - 1;				//alert("image: "+img_obj.width+" - "+img_obj.height);			}			showOverlay();			obj_display.style.left = coor[0]+"px";			obj_display.style.top = coor[1]+"px";			obj_display.style.display = "block";		}		*/				//NEW STYLE    	centerDiv('adding_layer', 100, 400); 			}	}function update_full_cart() {	if (document.getElementById("FloatingLayer") || document.getElementById("FloatingLayerShoppingCart")) {		if (document.getElementById("FloatingLayer")) var obj = document.getElementById("FloatingLayer");		if (document.getElementById("FloatingLayerShoppingCart")) var obj = document.getElementById("FloatingLayerShoppingCart");		//gather all input/select boxes:		var inps = obj.getElementsByTagName("input");		var sel = obj.getElementsByTagName("select");		//prep post string:		var updateStr = "";		var selStr = "";		var radStr = "";		if (inps.length>0) {			for(i=0; i<=inps.length-1;i++) {//alert(inps[i].name+": "+inps[i].value);				if (inps[i].type == "text") {					updateStr += inps[i].name+"="+encodeURIComponent(inps[i].value);				}				else if (inps[i].type == "radio") {					if (inps[i].name == "shipping" && inps[i].checked==true) updateStr += inps[i].name+"="+encodeURIComponent(inps[i].value);				}				if (i<inps.length-1) updateStr += "&";			}			//select here			if (sel.length>0) {				for(i=0; i<=sel.length-1;i++) {					selStr += sel[i].name+"="+encodeURIComponent(sel[i].value);					if (i<sel.length-1) selStr += "&";				}			}		}		if (updateStr != "") {			//do post here			if (selStr != "") updateStr+="&"+selStr;			//alert(updateStr);			post_full_cart('update_full_cart.php', updateStr);		}	}	else {		alert("nothing to update");	}}//var http_request_post_post = false;//var http_request_post = false;function post_full_cart(url, parameters) {	http_request_post = false;	if (window.XMLHttpRequest) { // Mozilla, Safari,...		http_request_post = new XMLHttpRequest();		if (http_request_post.overrideMimeType) {			http_request_post.overrideMimeType('text/html');		}	} else if (window.ActiveXObject) { // IE	 try {		http_request_post = new ActiveXObject("Msxml2.XMLHTTP");	 } catch (e) {		try {		   http_request_post = new ActiveXObject("Microsoft.XMLHTTP");		} catch (e) {}	 }	}  if (!http_request_post) {	 alert('Cannot create XMLHTTP instance');	 return false;  }    http_request_post.onreadystatechange = return_post;  http_request_post.open('POST', url, true);  http_request_post.setRequestHeader("Content-type", "application/x-www-form-urlencoded");  http_request_post.setRequestHeader("Content-length", parameters.length);  http_request_post.setRequestHeader("Connection", "close");  http_request_post.send(parameters);}function return_post() {   //alert(http_request_post.status);  if (http_request_post.readyState == 4) {	 if (http_request_post.status == 200) {		result = http_request_post.responseText;		document.getElementById('mini_cart').innerHTML = result;	 } else {		alert('There was a problem with the request.');	 }  }}function reveal_coupon() {	//alert(document.getElementById("coupon_holder_div").style.display);	if (document.getElementById("coupon_holder_div2")) {		document.getElementById("coupon_holder_div1").style.display = "block";		document.getElementById("coupon_holder_div2").style.display = "block";		//hide click here:		document.getElementById("coupon_reveal_span").style.display = "none";	}}//Shopping cart tablevar shoppingCartTable;var shoppingCartTableBody;function init_shoppingcart_table() {    shippingTable = document.getElementById("shopping_cart_table");    shippingTableBody = shippingTable.tBodies[0];}function insertTableRow_shoppingcart(where,cell1,cell2,type) {	//alert(where);	var newRow = shoppingCartTableBody.insertRow(where);	var newCell;	newCell = newRow.insertCell(0);	newCell.innerHTML = cell1;	newCell.className = "checkoutCell";	newCell.valign="middle";	//alert(cell1);	//add message place for member here	var newCell;	newCell = newRow.insertCell(1);	newCell.innerHTML="&nbsp;";		var newCell;	newCell = newRow.insertCell(2);	newCell.innerHTML=cell2;	newCell.className = "checkoutCell";		var newCell;	newCell = newRow.insertCell(3);	newCell.innerHTML="&nbsp;";	}function setRow(){ 	var theRow = document.getElementById("coupon_reveal_span").parentNode;	//alert(theRow.nodeName); 	while(theRow && theRow.nodeName!="TR"){		theRow = theRow.parentNode;	}	if(theRow.nodeName=="TR"){		//theBtn.form.rowID.value = 		//alert(theRow.rowIndex);		reveal_coupon(theRow.rowIndex);	}}function image_swap(id) {	var image_to_swap = "alt_image_replacement_"+id;	if (document.getElementById('image_display') &&  document.getElementById(image_to_swap)) {		document.getElementById('image_display').innerHTML = document.getElementById(image_to_swap).innerHTML;	}}function image_swap_out() {	if (document.getElementById('image_display') &&  document.getElementById('image_original')) {		document.getElementById('image_display').innerHTML = document.getElementById('image_original').innerHTML;	}}function thumb_swap(id) {	var org_image = "productIndImage_div_"+id;	var alt_image = "productIndImageAlt_div_"+id;		if (document.getElementById(org_image) &&  document.getElementById(alt_image)) {		if (document.getElementById(org_image).style.display == "block") {			document.getElementById(alt_image).style.display = "block"; 					document.getElementById(org_image).style.display = "none"; 		} else {			document.getElementById(org_image).style.display = "block"; 					document.getElementById(alt_image).style.display = "none"; 						}	}}function cat_replace_drop() {	if (document.getElementById('category_select')) {		var id = document.getElementById('category_select').value;		cat_replace(id);	}}function cat_replace(id) {	//CHECK FOR CATEGORY	//alert('category: '+all_products.category.id);	//alert(id);	if (!holder_json["holder"]["product_"+id]) {		//PRODUCT INFO NOT IN ARRAY, GET IT		var url = "filebin/ajax/php/getProductData.php?id="+id;		var xml = new JKL.ParseXML(url);		var data = xml.parse();		var product_get = data.instance;		if (product_get) {			var temp = product_get;			holder_json["holder"]["product_"+id] = temp;		}	}	//alert(holder_json["holder"]["product_"+id]["id"]);	// GET PRODUCT DATA	if (holder_json["holder"]["product_"+id]) {					//CHANGE NAME		if (document.getElementById('product_name')) {			document.getElementById('product_name').innerHTML = "<h1>"+holder_json["holder"]["product_"+id]["name"]+"</h1>";		}				//CHANGE ORIGINAL IMAGE		if (document.getElementById('image_original')) {			document.getElementById('image_original').innerHTML = holder_json["holder"]["product_"+id]["image"];		}		//CHANGE DISPLAY IMAGE		if (document.getElementById('image_display')) {			document.getElementById('image_display').innerHTML = holder_json["holder"]["product_"+id]["image"];		}				//CHANGE DISPLAY IMAGE		if (document.getElementById('product_alt_images')) {			document.getElementById('product_alt_images').innerHTML = holder_json["holder"]["product_"+id]["alts"];		}						//CHANGE HTML DATA		if (document.getElementById('product_html')) {			document.getElementById('product_html').innerHTML = holder_json["holder"]["product_"+id]["product_data"];		}						//CHANGE PRODUCT DESCRIPTION		//if (document.getElementById('product_description') && holder_json["holder"]["product_"+id]["product_description"]) {		//	document.getElementById('product_description').innerHTML = holder_json["holder"]["product_"+id]["product_description"];		//}					//CHANGE PURCHASING INFO		if (document.getElementById('product_purchasing')) {			document.getElementById('product_purchasing').innerHTML = holder_json["holder"]["product_"+id]["purchasing"];		}		//CHANGE COMPANION IMAGES		if (document.getElementById('product_companions')) {			document.getElementById('product_companions').innerHTML = holder_json["holder"]["product_"+id]["companion"];		}				//SET DROPDOWN TO MATCH SELECTED PICK		if (document.getElementById('category_select')) {			document.getElementById('category_select').value = id;		}		}}function change_loc(selected_loc) {	if (selected_loc != "") {			var url = "filebin/ajax/php/getLocation.php?action=step1&selected_loc="+selected_loc;		var xml = new JKL.ParseXML(url);		var data = xml.parse();		var response_div = data.instance.response_div;		var return_data = data.instance.content;		if (document.getElementById(response_div)) {			document.getElementById(response_div).innerHTML = return_data;		}		}	}function change_loc_new(selected_loc) {	//if (selected_loc.value != "") {			var url = "filebin/ajax/php/getLocation.php?action=step1&selected_loc="+selected_loc.value;		var xml = new JKL.ParseXML(url);		var data = xml.parse();		var response_div = data.instance.response_div;		var return_data = data.instance.content;		if (document.getElementById(response_div)) {			document.getElementById(response_div).innerHTML = return_data;		}		//}	}function change_zip() {	if (document.getElementById('zip')) {		var selected_zip = document.getElementById('zip').value;		var selected_country = document.getElementById('get_ship_country').value;		var url = "filebin/ajax/php/getLocation.php?action=stepUS&selected_country="+selected_country+"&selected_zip="+selected_zip;		var xml = new JKL.ParseXML(url);		var data = xml.parse();		var response_div = data.instance.response_div;		var return_data = data.instance.content;		if (document.getElementById(response_div)) {			document.getElementById(response_div).innerHTML = return_data;		}		}	}/*function change_zip_old() {	var more = "action=zip&zip="+document.getElementById("zip").value;	//setTimeout("sendRequest('"+more+"', 'mini_cart')",100);	sendRequest(more,'mini_cart');}*/function change_province() {	if (document.getElementById('province')) {		var selected_province = document.getElementById('province').value;		var url = "filebin/ajax/php/getLocation.php?action=stepCanada&selected_province="+selected_province;		var xml = new JKL.ParseXML(url);		var data = xml.parse();		var response_div = data.instance.response_div;		var return_data = data.instance.content;		if (document.getElementById(response_div)) {			document.getElementById(response_div).innerHTML = return_data;		}		}	}function show_pop(type) {	if (document.getElementById('new_pop')) {			var url = "filebin/ajax/php/newPop.php?type="+type;		var xml = new JKL.ParseXML(url);		var data = xml.parse();		if (data.result) {			if (document.getElementById('new_pop_content')) {				document.getElementById('new_pop_content').innerHTML = data.result;				centerDiv('new_pop', 100, 440); 				}		}	}}function toggle_clubCart() {	if (document.getElementById('clubBMV_cart_bottom') && document.getElementById('clubBMV_opener')) {		if (document.getElementById('clubBMV_cart_bottom').style.display == 'none') {			document.getElementById('clubBMV_cart_bottom').style.display = 'block';			document.getElementById('clubBMV_opener').innerHTML = "(<a href='#' onclick='toggle_clubCart(); return false;'>close -</a>)";		} else {			document.getElementById('clubBMV_cart_bottom').style.display = 'none';					document.getElementById('clubBMV_opener').innerHTML = "(<a href='#' onclick='toggle_clubCart(); return false;'>learn more +</a>)";		}	}}function page_onload() {	page_loaded = true;	}/* FUNCTIONS FOR PRODUCT FILTER */function filterResults(id) {	if (document.getElementById("setDiv")) {		document.getElementById("setDiv").innerHTML = "";	}	if (document.getElementById("displayDiv")) {		document.getElementById("displayDiv").style.display = "block";		document.getElementById("displayDiv").innerHTML = "Loading...";	}	if (document.getElementById("searchProductsDiv")) {		document.getElementById("searchProductsDiv").innerHTML = "";	}	if (document.getElementById("filterDiv")) {		document.getElementById("filterDiv").innerHTML = "<div style='padding: 10px'>Loading...</div>";	}	setTimeout("filterResultsAction('"+id+"')",100);}function filterResultsAction(id) {	var url = "filebin/ajax/php/filterResults.php";	var query = "id="+id+"&products="+product_string; //PRODUCT STRING SET AS JS VARIABLE	var xml = new JKL.ParseXML(url, query);	var data = xml.parse();	if (data.instance) {		var new_set = data.instance.setOut;		var new_display = data.instance.display;		var new_filter = data.instance.filter;		var new_products = data.instance.products;		if (new_set.replace(/\s+/g, "") != "" && document.getElementById("setDiv")) {			document.getElementById("setDiv").style.display = "block";			document.getElementById("setDiv").innerHTML = new_set;		} else if (document.getElementById("setDiv")) {			document.getElementById("setDiv").style.display = "none";			}		if (new_display != "" && document.getElementById("displayDiv")) {			document.getElementById("displayDiv").style.display = "block";			document.getElementById("displayDiv").innerHTML = new_display;		} else if (document.getElementById("displayDiv")) {			document.getElementById("displayDiv").style.display = "none";			}		if (new_products && document.getElementById("searchProductsDiv")) {			document.getElementById("searchProductsDiv").innerHTML = new_products;		}		if (new_filter && document.getElementById("filterDiv")) {			document.getElementById("filterDiv").innerHTML = new_filter;		}				//UPDATE PRODUCTS TO USE		//alert(data.instance.updated_products);		product_string = data.instance.updated_products;					}	}function clearFilter(id) {	if (document.getElementById("setDiv")) {		document.getElementById("setDiv").innerHTML = "";	}	if (document.getElementById("displayDiv")) {		document.getElementById("displayDiv").style.display = "block";		document.getElementById("displayDiv").innerHTML = "Loading...";	}	if (document.getElementById("searchProductsDiv")) {		document.getElementById("searchProductsDiv").innerHTML = "";	}	if (document.getElementById("filterDiv")) {		document.getElementById("filterDiv").innerHTML = "<div style='padding: 10px'>Loading...</div>";	}	setTimeout("clearFilterAction('"+id+"')",100);}function clearFilterAction(id) {	var url = "filebin/ajax/php/clearFilter.php?clear_id="+id;	var xml = new JKL.ParseXML(url);	var data = xml.parse();	var new_set = data.instance.setOut;	var new_display = data.instance.display;	var new_filter = data.instance.filter;	var new_products = data.instance.products;	if (new_set.replace(/\s+/g, "") != "" && document.getElementById("setDiv")) {		document.getElementById("setDiv").style.display = "block";		document.getElementById("setDiv").innerHTML = new_set;	} else if (document.getElementById("setDiv")) {		document.getElementById("setDiv").style.display = "none";		}	if (new_display.replace(/\s+/g, "") != "" && document.getElementById("displayDiv")) {		document.getElementById("displayDiv").style.display = "block";		document.getElementById("displayDiv").innerHTML = new_display;	} else if (document.getElementById("displayDiv")) {		document.getElementById("displayDiv").style.display = "none";		}	if (new_products && document.getElementById("searchProductsDiv")) {		document.getElementById("searchProductsDiv").innerHTML = new_products;	}	if (new_filter && document.getElementById("filterDiv")) {		document.getElementById("filterDiv").innerHTML = new_filter;	}		//UPDATE PRODUCTS TO USE	//alert(data.instance.updated_products);	product_string = data.instance.updated_products;		}function filterSort() {	var sort = document.getElementById("narrowSorter").value;	if (document.getElementById("setDiv")) {		document.getElementById("setDiv").innerHTML = "";	}	if (document.getElementById("displayDiv")) {		document.getElementById("displayDiv").style.display = "block";		document.getElementById("displayDiv").innerHTML = "Loading...";	}	if (document.getElementById("searchProductsDiv")) {		document.getElementById("searchProductsDiv").innerHTML = "";	}	if (document.getElementById("filterDiv")) {		document.getElementById("filterDiv").innerHTML = "<div style='padding: 10px'>Loading...</div>";	}	setTimeout("filterSortAction('"+sort+"')",100);}function filterSortSewCool() {	var sort = document.getElementById("narrowSorter").value;	if (document.getElementById("searchProductsDiv")) {		document.getElementById("searchProductsDiv").innerHTML = "<div style='padding: 10px 0px 0px 0px;'>Loading...</div>";	}	setTimeout("filterSortAction('"+sort+"')",100);}function filterSortAction(sort) {	var url = "filebin/ajax/php/filterSort.php";	var query = "products="+product_string+"&sort="+sort;	var xml = new JKL.ParseXML(url, query);	var data = xml.parse();	var new_set = data.instance.setOut;	var new_display = data.instance.display;	var new_filter = data.instance.filter;	var new_products = data.instance.products;	if (new_set.replace(/\s+/g, "") != "" && document.getElementById("setDiv")) {		document.getElementById("setDiv").style.display = "block";		document.getElementById("setDiv").innerHTML = new_set;	} else if (document.getElementById("setDiv")) {		document.getElementById("setDiv").style.display = "none";		}	if (new_display.replace(/\s+/g, "") != "" && document.getElementById("displayDiv")) {		document.getElementById("displayDiv").style.display = "block";		document.getElementById("displayDiv").innerHTML = new_display;	} else if (document.getElementById("displayDiv")) {		document.getElementById("displayDiv").style.display = "none";		}	//alert(document.getElementById("searchProductsDiv"));	if (new_products && document.getElementById("searchProductsDiv")) {		document.getElementById("searchProductsDiv").innerHTML = new_products;	}	if (new_filter && document.getElementById("filterDiv")) {		document.getElementById("filterDiv").innerHTML = new_filter;	}}function toggleFilters(id, count, parent_name) {	var hiddenDiv = "extra_filters_"+id;	var linkDiv = "extra_link_"+id;		//USE JQUERY TO HIDE/SHOW EXTRA LINKS	if (document.getElementById(hiddenDiv) && document.getElementById(linkDiv)) {		$("#"+hiddenDiv).slideToggle("fast");	}		//UPDATE TEXT	if (document.getElementById(hiddenDiv).style.height == "1px") {		document.getElementById(linkDiv).innerHTML = "<a href='#' onclick='toggleFilters(\""+id+"\", \""+count+"\", \""+parent_name+"\"); return false;'>Hide "+parseInt(count - 6)+" extra "+parent_name+"</a>";	} else {		document.getElementById(linkDiv).innerHTML = "<a href='#' onclick='toggleFilters(\""+id+"\", \""+count+"\", \""+parent_name+"\"); return false;'>Show all "+count+" "+parent_name+"</a>";			}}function add_catalog() {	//let's get selected ids:	var getvars_arr = Array();	var z= 0;	$("#productsHolder input[type=checkbox]").each(function() {		if (this.checked) {			getvars_arr[z] = this.value;			z++;		}	});	var getvars = getvars_arr.join(",");	if (getvars=="") {		alert("Please, select catalogs you want to purchase...");	} else {		//proceed to do some stuff		getvars = "action=add_catalog&product_ids="+getvars+"&url="+location.href;		load_cart_catalog(getvars);	}	return false;	}function load_cart_catalog(getvars) {	$.ajax({		type: "GET",		url: "filebin/ajax/php/add_catalog.php",		data: getvars,		dataType: "json",		success: function(data) {			//add loop thriugh data			if (data) {				//if (data.mini_cart) $("#mini_cart").html(data.mini_cart);				//if (data.cart_total) $("#cart_total").html(data.cart_total);				//if (data.adding_layer) $("#adding_layer").html(data.adding_layer);				var alert_content = "";				$.each(data, function(div, content) {         			//alert(i + " " + n); 					if ($("#"+div) && div!="alert") $("#"+div).html(content);					if (div=="alert") alert_content += content+"\n";				});				//spit out alert:				if (alert_content != "") alert(alert_content);				centerDiv('adding_layer', 100, 400);			}		}	});	return false;}addOnloadEvent(page_onload);