function $Q(v) { return(document.getElementById(v)); }
function $S(v) { return($Q(v).style); }
function $V(v) { return($Q(v).value); }
function $SV(v) { return $Q(v).options[$Q(v).selectedIndex].value; }
function A(v) { console.log('Alert: ', v); }
function tog_img(x, i_1, i_2) { $Q(x).src = $Q(x).src.match(i_1) ||  $Q(x).src == i_1 ? i_2 : i_1; }
function tog_vis(x, on_only) { $S(x).display = $S(x).display == 'none' || !$S(x).display || on_only ? 'block' : 'none'; }

// for IE
if (document.getElementsByClassName == undefined) {
	document.getElementsByClassName = function(className) {
		var hasClassName = new RegExp("(?:^|\\s)" + className + "(?:$|\\s)");
		var allElements = document.getElementsByTagName("*");
		var results = [];

		var element;
		for (var i = 0; (element = allElements[i]) != null; i++) {
			var elementClass = element.className;
			if (elementClass && elementClass.indexOf(className) != -1 && hasClassName.test(elementClass))
				results.push(element);
		}

		return results;
	}
}

// jxs - a minimal ajax library.
// http://www.openjs.com/scripts/jx/#jxs
//
// using it to make ajax POSTs
jx={getHTTPObject:function(){var A=false;if(typeof ActiveXObject!="undefined"){try{A=new ActiveXObject("Msxml2.XMLHTTP")}catch(C){try{A=new ActiveXObject("Microsoft.XMLHTTP")}catch(B){A=false}}}else{if(window.XMLHttpRequest){try{A=new XMLHttpRequest()}catch(C){A=false}}}return A},load:function(url,callback,format,method,opt){var http=this.init();if(!http||!url){return }if(http.overrideMimeType){http.overrideMimeType("text/xml")}if(!method){method="GET"}if(!format){format="text"}if(!opt){opt={}}format=format.toLowerCase();method=method.toUpperCase();var now="uid="+new Date().getTime();url+=(url.indexOf("?")+1)?"&":"?";url+=now;var parameters=null;if(method=="POST"){var parts=url.split("?");url=parts[0];parameters=parts[1]}http.open(method,url,true);if(method=="POST"){http.setRequestHeader("Content-type","application/x-www-form-urlencoded");http.setRequestHeader("Content-length",parameters.length);http.setRequestHeader("Connection","close")}var ths=this;if(opt.handler){http.onreadystatechange=function(){opt.handler(http)}}else{http.onreadystatechange=function(){if(http.readyState==4){if(http.status==200){var result="";if(http.responseText){result=http.responseText}if(format.charAt(0)=="j"){result=result.replace(/[\n\r]/g,"");result=eval("("+result+")")}else{if(format.charAt(0)=="x"){result=http.responseXML}}if(callback){callback(result)}}else{if(opt.loadingIndicator){document.getElementsByTagName("body")[0].removeChild(opt.loadingIndicator)}if(opt.loading){document.getElementById(opt.loading).style.display="none"}if(error){error(http.status)}}}}}http.send(parameters)},bind:function(A){var C={"url":"","onSuccess":false,"onError":false,"format":"text","method":"GET","update":"","loading":"","loadingIndicator":""};for(var B in C){if(A[B]){C[B]=A[B]}}if(!C.url){return }var D=false;if(C.loadingIndicator){D=document.createElement("div");D.setAttribute("style","position:absolute;top:0px;left:0px;");D.setAttribute("class","loading-indicator");D.innerHTML=C.loadingIndicator;document.getElementsByTagName("body")[0].appendChild(D);this.opt.loadingIndicator=D}if(C.loading){document.getElementById(C.loading).style.display="block"}this.load(C.url,function(E){if(C.onSuccess){C.onSuccess(E)}if(C.update){document.getElementById(C.update).innerHTML=E}if(D){document.getElementsByTagName("body")[0].removeChild(D)}if(C.loading){document.getElementById(C.loading).style.display="none"}},C.format,C.method,C)},init:function(){return this.getHTTPObject()}}

// ued_encode() will take an array as its argument and return the data encoded in UED format - as a string.
// http://www.openjs.com/scripts/data/ued_url_encoded_data/
function ued_encode(d,e){var a="";typeof e=="undefined"&&(e="");if(typeof d=="object"){a=[];for(key in d){var b=d[key],c=key;e&&(c=e+"["+key+"]");if(typeof b=="object")if(b.length)for(var f=0;f<b.length;f++)a.push(c+"[]="+ued_encode(b[f],c));else a.push(ued_encode(b,c));else a.push(c+"="+encodeURIComponent(b))}a=a.join("&")}else a=encodeURIComponent(d);return a};

function IsNumeric(input) {
   return (input - 0) == input && input !== '';
}

// A namespace for custom qubixcart js.
// Eventually all our functions should be in here.
var qc = {};

function list_search() {
	var n = trim($Q('list_name').value);
	if (!trim($Q('list_email').value)) {
		if (n == '') {
			alert("Please enter at least 2 characters of the name or an email address.");
			return false;
		} else if (n == 'enter name') {
			alert("Please enter at least 2 characters of the name or an email address.");
			return false;
		} else if (n.length < 2) {
			alert("Please enter at least 2 characters of the name.");
			return false;
		} else return true;
	} else return true;
}

function trim(s) {
	s = s.replace(/^\s+/,'');
	s = s.replace(/\s+$/,'');
	return(s);
}

function ajax_get(url, div, action) {
	if (window.XMLHttpRequest)
	   var xhr = new XMLHttpRequest();
	else if (window.ActiveXObject)
	   var xhr = new ActiveXObject("Microsoft.XMLHTTP");

	xhr.open("GET", url);
	xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
	xhr.setRequestHeader('If-Modified-Since', 'Sat, 1 Jan 2000 00:00:00 GMT');
	xhr.onreadystatechange = function () {
    	if (xhr.readyState == 4) {
    		if ($Q(div)) {
    			if ($S(div).display == 'none')
    				$S(div).display = '';
    	    	$Q(div).innerHTML = xhr.responseText;
    	    } else if (div == 1)
    	    	eval(xhr.responseText);

			if (action)
				action(xhr.responseText);
    	}
    }
   	xhr.send(null);
   	return xhr;
}

function number_format(n) {
	if (isNaN(n)) n = "0";
	s = (n == (n = Math.abs(n)));
	n = Math.floor(n*100+0.50000000001);
	d = n%100;
	n = Math.floor(n/100).toString();
	if (d < 10) d = "0" + d;
	for (var i = 0; i < Math.floor((n.length-(1+i))/3); i++)
		n = n.substring(0,n.length-(4*i+3))+','+
	n.substring(n.length-(4*i+3));
	return ((s?'':'-') + n + '.' + d);
}

function only_numbers(field) {
	var n = Number($Q(field).innerHTML.replace(/[^0-9.]/g, ""));
	return isNaN(n)?0:n;
}

function clear_value(field) {
	if (field.value == field.defaultValue)
		field.style.color = field.value = '';
}

function add_wishlist() {
	add_cart();
	if ($Q('wishlist').value == 0) {
		$S('display_list').display = 'block';
		$Q('wishlist').value = $Q('wish_list').value;
	} else {
		if (add_cart()) $Q('add_form').submit();
	}
}

function cart_add_wishlist(id) {
	if ($Q('wishlist'+id).value == 0) {
		$S('display_list'+id).display = 'block';
		$Q('wishlist'+id).value = $Q('wish_list'+id).value;
	} else {
		$Q('add_form_'+id).submit();
	}
}

function add_cart() {
	error = 0;
	if ($Q('prod_vars')) {
		var a = $V('prod_vars').split('|');
		var r = $V('prod_req').split('|');
		for (var i in r) {
			if ($Q('var_'+a[i]) && !$V('var_'+a[i])) {
 				$S('choose_error_'+a[i]).display = 'block';
 				error = 1;
			} else if ($Q('choose_error_'+a[i]))
				$S('choose_error_'+a[i]).display = 'none';
		}
	}
	if ($V('prod_qty') < 1) {
		$S('qty_error').display = 'block';
		error = 1;
	} else
		$S('qty_error').display = 'none';
	return error ? false : true;
}

function select_var(js) {
	var a = $V('prod_vars').split('|');
	var r = $V('prod_req').split('|');
	var v = new Array();
	var x = 0;
	for (var i in a)
		if ($Q('var_' + a[i]) && $V('var_' + a[i]).length)
			v[x++] = $V('var_' + a[i]);

	if (!js)
		for (var i in r) {
			if ($Q('var_' + a[i]) && !$V('var_' + a[i]))
				$S('choose_error_' + a[i]).display = 'block';
			else if ($Q('choose_error_' + a[i]))
				$S('choose_error_' + a[i]).display = 'none';
		}

	if (window.XMLHttpRequest)
		var xhr = new XMLHttpRequest();
	else if (window.ActiveXObject)
		var xhr = new ActiveXObject("Microsoft.XMLHTTP");

	xhr.open("GET", '/qjax.php?v=' + v.join(':').replace(/\:$/,""));
	xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
	xhr.setRequestHeader('If-Modified-Since', 'Sat, 1 Jan 2000 00:00:00 GMT');
	xhr.onreadystatechange = function () {
    	if (xhr.readyState == 4) {
			var y = xhr.responseText.split('|');
			if (y.length > 1) {
				if ($Q('price_block')) $Q('price_block').className = 'show';
				if ($Q('price_base')) $Q('price_base').className = 'hide';
				if ($Q('product_stock')) $Q('product_stock').innerHTML = y[0];
				if ($Q('product_msrp')) $Q('product_msrp').innerHTML = "<strike>"+y[1]+"</strike>";
				if ($Q('product_price')) $Q('product_price').innerHTML = y[2];
				if ($Q('product_save')) $Q('product_save').innerHTML = y[3];	
				if ($Q('product_caption')) $Q('product_caption').innerHTML = '';
				if ($Q('product_image')) $Q('product_image').src = '/q_images/inv/m/' + (y[4].length ? y[4] : $V('prod_image'));
				if ($Q('stock_error')) $S('stock_error').display = 'none';
			} else {
				if ($Q('price_block')) $Q('price_block').className = 'hide';
				if ($Q('price_base')) $Q('price_base').className = 'show';
				if ($Q('stock_error')) $S('stock_error').display = '';
				if ($Q('product_stock')) $Q('product_stock').innerHTML = 'Please select another option.';
				if ($Q('product_caption')) $Q('product_caption').innerHTML = '';				
				if ($Q('product_image')) $Q('product_image').src = '/q_images/inv/m/' + $V('prod_image');
			}
		}
    }
   	xhr.send(null);
}

function shipping_totalr() {
	if (typeof st_xhr == 'undefined' || !st_xhr || st_xhr.readyState == 4) $Q('total_v').innerHTML = number_format(only_numbers('subtotal_v') + only_numbers('tax_v') + only_numbers('ship_v'));
	else setTimeout("shipping_totalr();", 10);
}

function shipping_optionr(option) {
	if (option == "api_load") shipping_zipr();
	if ($Q('ship_state')) {
		ajax_get('/qjax.php?a=ship&d=1&s=1&c=' + $V('ship_country') + '&o=' + option, 'ship_v');
		st_xhr = ajax_get('/qjax.php?a=ship&d=1&t=1&c=' + $V('ship_country') + '&st=' + $V('ship_state'), 'tax_v');
		shipping_totalr();
	} else if ($Q('ship_zip')) {
		$Q('ship_v').innerHTML = '<i>Loading..</i>';
		ajax_get('/qjax.php?a=ship&d=1&s=1&o='+escape(option)+'&c='+$V('ship_country')+'&z='+$V('ship_zip'), 'ship_v', shipping_totalr);
		$S('shipping_option').display = 'block';
	}
}

function shipping_api_total(x) {
	ajax_get('/qjax.php?a=ship&d=1&s=1&c='+$V('ship_country')+'&z='+$V('ship_zip'), 'ship_v');
	st_xhr = ajax_get('/qjax.php?a=ship&d=1&t=1&c='+$V('ship_country')+'&z='+$V('ship_zip'), 'tax_v');
	shipping_totalr();
}

function shipping_zipr() {
	if ($Q('ship_zip')) {
		if (($V('ship_country') == 'US' && !isNaN($V('ship_zip')) && $V('ship_zip').length == 5) || $V('ship_zip').length > 5) {
			ajax_get('/qjax.php?a=ship&d=1&s=1&l=1&c='+$V('ship_country')+'&z='+$V('ship_zip'), 'shipping_option', shipping_api_total)
			$Q('shipping_option').innerHTML = '<i>Loading..</i>';
			$Q('ship_v').innerHTML = $Q('tax_v').innerHTML = '<small>Enter your location</small>';
			$S('shipping_option').display = 'block';
		} else $S('shipping_option').display = 'block';
	}
}

function shipping_stater(option) {
	if ($Q('ship_state')) {
		ajax_get('/qjax.php?a=ship&d=1&s=1&c='+$V('ship_country')+'&o='+$V('ship_opt_us')+'&st='+$V('ship_state'), 'ship_v');
		st_xhr = ajax_get('/qjax.php?a=ship&d=1&t=1&c='+$V('ship_country')+'&st='+$V('ship_state'), 'tax_v');
		$S('shipping_option').display = 'block';
		shipping_totalr();	
	}
}

function shipping_api_country(country) {
	if (country == "US" || country == "CA") {
		$S('shipping_option').display = 'none';
		$S('shipping_zip').display = 'block';
	} else {
		$Q('shipping_option').innerHTML = '<i>Loading..</i>';
		$S('shipping_option').display = 'block';
		ajax_get('/qjax.php?a=ship&d=1&s=1&l=1&c='+country, 'shipping_option', shipping_api_total)
		$S('shipping_zip').display = 'none';
	}
}

function shipping_country(country) {
	$S('shipping_option').display = 'block';
	if (country == "US") {
		$S('shipping_state').display = 'block';
	} else {
		$S('shipping_state').display = 'none';
	}
	ajax_get('/qjax.php?a=ship&c='+$V('ship_country'), 'ship_option');
	ajax_get('/qjax.php?a=ship&d=1&s=1&c='+$V('ship_country'), 'ship_v');
	st_xhr = ajax_get('/qjax.php?a=ship&d=1&t=1&c='+$V('ship_country')+'&st='+$V('ship_state'), 'tax_v');
	shipping_totalr();
}

function checkout_country(country, sb) {
	if (country == "US") {
		$S('us_fields_'+sb).display = 'block';
		$S('int_fields_'+sb).display = 'none';
	} else {
		$S('us_fields_'+sb).display = 'none';
		$S('int_fields_'+sb).display = 'block';
	}
}

function checkout_shipping(v, x) {
	if (v == 1) {
		if (x) $S('shipping_form').display = 'block';
		else $S('shipping_form').display = 'none';
		$S('shipping_no_gift').display = 'none';
		$S('shipping_yes_gift').display = 'block';
	} else if (v == 2) {
		$S('shipping_form').display = 'none';
	} else {
		$S('shipping_form').display = 'block';
		$S('shipping_no_gift').display = 'block';
		$S('shipping_yes_gift').display = 'none';
	}
}

function light_div(path, w, h) {
	var objOverlay = $Q('overlay');
	var objLightbox = $Q('lightbox');
	var objGhey = $Q('lightboxDiv');

	var arrayPageSize = getPageSize();
	var arrayPageScroll = getPageScroll();

	objOverlay.style.height = (arrayPageSize[1] + 'px');
	objOverlay.style.display = 'block';
	ajax_get(path, 'lightboxDiv');
	
	if ($Q('loadingImage')) { $S('loadingImage').display = 'none'; }
	if ($Q('lightboxDetails')) {	$S('lightboxDetails').display = 'none'; }
	if ($Q('lightboxImage')) { $S('lightboxImage').display = 'none'; }
	
	if (navigator.appVersion.indexOf("MSIE")!=-1) pause(250);
	
	var lightboxTop = arrayPageScroll[1] + ((arrayPageSize[3] - 35 - h) / 2);
	var lightboxLeft = ((arrayPageSize[0] - 20 - w) / 2);

	objLightbox.style.top = (lightboxTop < 0) ? "0px" : lightboxTop + "px";
	objLightbox.style.left = (lightboxLeft < 0) ? "0px" : lightboxLeft + "px";

	objGhey.style.width = w + 'px';
//	objGhey.style.height = h + 'px';
	
	objLightbox.style.display = 'block';
	$S('lightboxDiv').display = 'block';
}

function email_product() {
	var error = 0;
	var ereg = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
	if (!$V('friend_email').match(ereg)) {
		error = $Q('email_error').innerHTML = '<b>Error:</b> Your friend\'s email appears invalid!';
		tog_vis('email_error', 1);
	} else if (!$V('your_email').match(ereg)) {
		error = $Q('email_error').innerHTML = '<b>Error:</b> Your email appears invalid!';
		tog_vis('email_error', 1);
	} else if ($V('your_name').length < 2) {
		error = $Q('email_error').innerHTML = '<b>Error:</b> You must enter YOUR name!';
		tog_vis('email_error', 1);
	} else if ($V('captcha').length < 2) {
		error = $Q('email_error').innerHTML = '<b>Error:</b> Please enter your verification word!';
		tog_vis('email_error', 1);
	}
	scroll(0,0);
	if (!error)	{
		ajax_get('/modules/email.php?p='+$V('product')+'&friend_name='+$V('friend_name')+'&friend_email='+$V('friend_email')+'&your_name='+$V('your_name')+'&your_email='+$V('your_email')+'&message='+$V('message')+'&captcha='+$V('captcha'), 'lightboxDiv');
	}
	return false;
}

function star_hover(n) {
	for (i=1; i<=n; i++) {
		$Q('rating-'+i).className = 'star-rating star-rating-hover';
	}

	for (; i<=5; i++) {
		$Q('rating-'+i).className = 'star-rating';
	}
}

function star_hover_out() {
	var val = parseInt($V('star-val'));
	for (i=1; i<=val; i++) {
		$Q('rating-'+i).className = 'star-rating star-rating-on';
	}
	for (; i<=5; i++) {
		$Q('rating-'+i).className = 'star-rating';
	}
}

function star_click(n) {
	$Q('star-val').value = n;
	for (i=1; i<=n; i++) {
		$Q('rating-'+i).className = 'star-rating star-rating-on';
	}
}

qc.update_cart_qty = function(n) {
	if ($Q('cart_qty') != null) {
		$Q('cart_qty').innerHTML = n;
	}

	var n_n = parseInt(n);
	if (n_n > 0 &&
		$Q('empty-cart-text') != null &&
		$Q('full-cart-text') != null
	) {
		$Q('empty-cart-text').className = 'hide';
		$Q('full-cart-text').className = 'show-inline';
	} else if (n_n <= 0 &&
		$Q('empty-cart-text') != null &&
		$Q('full-cart-text') != null
	) {
		$Q('empty-cart-text').className = 'show-inline';
		$Q('full-cart-text').className = 'hide';
	}

	// if this was the last item in the cart and we're
	// updating it's quantity to zero, then show the
	// 'Currently no items in your cart' message.
	if (n_n <= 0
			&& $('td.cart_qty').length <= 1
	) {
		$('form[action=cart.php]')[0].style.display = 'none';
		$Q('no-items-in-cart-msg').style.display = 'block';
	}
};


qc.update_cart_total = function(n) {
	if ($Q('cart_total') != null) {
		$Q('cart_total').innerHTML = number_format(n);
	}
	if ($Q('subtotal_v') != null) {
		$Q('subtotal_v').innerHTML = '<strong>$' + number_format(n) + '</strong>';
	}
};

function ajax_add_to_cart (site_url, qty, product_id, price, product_href) {
	var d = {
			'ajax' : 1,
			'method' : 'add_to_cart',
			'qty' : qty,
			'product' : product_id
	};

	var post_data = ued_encode(d);
	jx.load(site_url + '/cart.php?' + post_data,
		function(resp) {
			resp = eval( '(' + resp + ')' );
			resp['product_id'] = product_id;

			if (typeof resp['v_error'] != 'undefined'
					|| typeof resp['qty_error'] != 'undefined'
					|| typeof resp['s_error'] != 'undefined'
			) {
				if (typeof(qc.add_to_cart_callback) != 'undefined') {
					qc.add_to_cart_callback(resp);
				}
				window.location = product_href;
			} else {
				if (typeof(qc.add_to_cart_callback) != 'undefined') {
					qc.add_to_cart_callback(resp);
				}
				if (IsNumeric(resp['total_qty'])) {
					qc.update_cart_qty( resp['total_qty'] );
				}
				if (IsNumeric(resp['total_price'])) {
					qc.update_cart_total( resp['total_price'] );
				}
			}
		},
		'text', 'post');
}

function ajax_add_to_cart_with_variations (site_url, qty, product_id, price, vars_obj) {
	var d = {
			'ajax' : 1,
			'method' : 'add_to_cart',
			'qty' : qty,
			'product' : product_id,
			'var' : vars_obj
	};

	var post_data = ued_encode(d);
	jx.load(site_url + '/cart.php?' + post_data,
		function(resp) {
			resp = eval( '(' + resp + ')' );
			resp['product_id'] = product_id;

			if (typeof resp['v_error'] != 'undefined'
					|| typeof resp['qty_error'] != 'undefined'
					|| typeof resp['s_error'] != 'undefined'
			) {
				if (typeof(qc.add_to_cart_callback) != 'undefined') {
					qc.add_to_cart_callback(resp);
				}
			} else {
				if (typeof(qc.add_to_cart_callback) != 'undefined') {
					qc.add_to_cart_callback(resp);
				}
				if (IsNumeric(resp['total_qty'])) {
					qc.update_cart_qty( resp['total_qty'] );
				}
				if (IsNumeric(resp['total_price'])) {
					qc.update_cart_total( resp['total_price'] );
				}
			}
		},
		'text', 'post');
}

function ajax_update_cart (site_url, product_ids) {
	var product_qty_map = {};
	for (var i=0; i < product_ids.length; i++) {
		var id = product_ids[i];
		if ($Q('qty-'+id) != null) {
			product_qty_map[id] = parseInt($V('qty-'+id));
		}
	}

	var d = {
			'ajax' : 1,
			'method' : 'update_cart',
			'qty': product_qty_map
	};

	var post_data = ued_encode(d);

	jx.load(site_url + '/cart.php?' + post_data,
		function(resp) {
			resp = eval( '(' + resp + ')' );
			resp['product_ids'] = product_ids;

			if (typeof(qc.update_cart_callback) != 'undefined') {
				qc.update_cart_callback(resp);
			}

			// Adjust quantities and totals
			for (var i=0; i < resp['items'].length; i++) {
				var id = resp['items'][i]['id'];
				var qty = resp['items'][i]['qty'];
				var price = resp['items'][i]['price'];

				$Q('qty-'+id).value = qty;
				$Q('cart_subtot_'+id).innerHTML = '$' + number_format(qty * price) + '&nbsp;&nbsp;';
			}

			// Remove if necessary
			for (var i=0; i < product_ids.length; i++) {
				var id = product_ids[i]
				if ($Q('qty-'+id) != null && $V('qty-'+id) == 0) {
					if ($Q('cart_row_id_'+id) != null) {
						var el = document.getElementById('cart_row_id_'+id);
						var remElement = (el.parentNode).removeChild(el);
					}
				}
			}

			qc.update_cart_qty( resp['total_qty'] );
			qc.update_cart_total( resp['total_price'] );
			shipping_totalr();
		},
		'text', 'post');
}

/* Switch to ajax input buttons with javascript.
 * This way, if javascript isn't available, the normal
 * input buttons will be remain unchanged.
 */
function enable_ajax_add_to_cart() {
	// for product page
	if ($Q('add_button') != null &&
			$Q('add_button_ajax') != null
	) {
		$Q('add_button').style.display = 'none';
		$Q('add_button_ajax').style.display = 'inline';
	} else {
		var products = document.getElementsByClassName('product_box');

		var i;
		for (i = 0; i < products.length; i++) {
			if (products[i]
					.querySelector('.cat_add_button') != null
					&&
					products[i]
							.querySelector('.cat_add_button_ajax') != null
			) {
				products[i]
						.querySelector('.cat_add_button')
						.style.display = 'none';
				products[i]
						.querySelector('.cat_add_button_ajax')
						.style.display = 'inline';
			}
		}
	}
}

function enable_ajax_update_cart() {
	if ($Q('cart_update') != null &&
			$Q('cart_update_ajax') != null
	) {
		$Q('cart_update').style.display = 'none';
		$Q('cart_update_ajax').style.display = 'inline';
	}
}

qc.fill_variations_obj = function(pid) {
	for (key in  eval('product_' + pid + '_vars')) {
		eval('product_' + pid + '_vars')[key] = $V('var_' + key);
	}
}

