	var status; 
	function shopSetting(isLoggedIn){
		status = isLoggedIn;
		if(isLoggedIn != 1)
		{
			jQuery(".shop-product-small ul").each(function(){
				jQuery(this).remove();
			});
			
			jQuery(".showLoggedIn").remove();
		}else
		{
			jQuery(".showLoggedout").remove();
		}
		
		//related products
		/*if(jQuery("#displayAs").hasClass("relProd"))
		{
			jQuery(".shop-product-small ul").each(function(){
						jQuery(this).remove();
			});
		}*/
		
		//review
		if(jQuery(".showReview").html() == "")
		{
			jQuery(".showReview").remove();
			
		}else{
			jQuery(".showNoReview").remove();
		}
		
		jQuery(".breadcrumbs a:last").css("font-weight","bold");
		
		jQuery(".shop-product-small li.attr").each(function(){
			if(jQuery(this).text()==''){
			jQuery(this).remove();
		}
	});
		
	}
	
	function AddToCart(j, w, t, B, l) {
        var h = w;
        var q = "";
        var f = document.getElementById("Units_" + w);
        var A = readCookie("CartID");
        var v = document.getElementById("Grouping_" + w);
        var F = document.getElementById("Related_" + w);
        var e = document.getElementById("catProdTd_" + w);
        var n = document.getElementById("catProdAttributes_" + w);
        var u = document.getElementById("catProdAttributes2_" + w);
        var s = document.getElementById("catProdInstructions_" + w);
        var c = "";
        var p = new Array();
        var C = false;
        var a = false;
        var m;
        var g = 0;
        var E;
        var d = true;
        if (f) {
            m = f.value;
            if (m < 0) {
                alert(OshopLang.RemoveError);
                return false
            }
        } else {
            m = 1
        }
        if (A == null || A == "") {
            A = -1
        }
        E = document.getElementById("catCartSummary");
        if (v) {
            if (v.nodeName == "SELECT") {
                h = v.value
            } else {
                var r = v.getElementsByTagName("input");
                for (var z = 0; z < r.length; z++) {
                    if (r[z].checked) {
                        h = r[z].value;
                        break
                    }
                }
            }
        } //end if
        if (F) {
            q = GetCheckListValue(F);
            if (q.length > 0) {
                g = q.split(",").length
            }
        }
        if (s) {
            c = s.value
        }
        if (n) {
            var o = n.getElementsByTagName("select");
            if (o) {
                if (c.length > 0) {
                    c += ";"
                }
                for (var z = 0; z < o.length; z++) {
                    if (o[z].value.length > 0) {
                        c += o[z].value + ";"
                    }
                }
            }
        } //end if
        if (u) {
            var D = 0;
            var o = u.getElementsByTagName("select");
            var y;
            var x;
            var k = "";
            if (o) {
                for (var z = 0; z < o.length; z++) {
                    if (o[z].value.length > 0) {
                        p[D] = o[z].value + "|1";
                        D++
                    } else {
                        if (o[z].getAttribute("mandatory")) {
                            alert(Oshoplang.ChooseAttribute);
                            return
                        }
                    }
                }
            }
            var o = u.getElementsByTagName("input");
            if (o) {
                for (var z = 0; z < o.length; z++) {
                    if (o[z].type == "checkbox" || o[z].type == "radio") {
                        if (k != o[z].getAttribute("name")) {
                            if (z > 0 && !x && o[z - 1].getAttribute("mandatory")) {
                                alert(Oshoplang.ChooseAttribute);
                                return
                            }
                            x = false
                        }
                        if (o[z].checked) {
                            p[D] = o[z].id + "|1";
                            D++;
                            x = true
                        }
                        k = o[z].getAttribute("name")
                    } else {
                        if (o[z].value.length > 0) {
                            p[D] = o[z].id + "|" + o[z].value;
                            D++;
                            x = true
                        } else {
                            if (o[z].getAttribute("mandatory")) {
                                alert(Oshoplang.ChooseAttribute);
                                return
                            }
                        }
                    }
                }
                if (o.length > 0 && (o[o.length - 1].type == "checkbox" || o[o.length - 1].type == "radio")) {
                    if (!x && o[z - 1].getAttribute("mandatory")) {
                        alert(Oshoplang.ChooseAttribute);
                        return
                    }
                }
            }
        }
        if (E) {
            if (E.getAttribute("Vertical") == "True") {
                C = true
            }
            if (E.getAttribute("Quote") == "True") {
                a = true
            }
        }
        var b = CMS.CatalogueRetrieve.ServerSideAddItemToOrder(A, j, h, m, q, p, c, C, B, a, t, d);
        if (b.value[4]) {
            g = b.value[4]
        }
        createCookie("CartID", b.value[0], 2);
        if (E) {
			
            E.innerHTML = b.value[2]
			
        }
        switch (b.value[1]) {
        case 0:
            if (!l) {
                if (e) {
					
                    e.innerHTML = b.value[3];
                    ProcessJS(e)
                }
                alert(g + Oshoplang.Added)
                
            } else {
                document.location = "/OrderRetrievev2.aspx?CatalogueID=" + j
            }
            break;
        case 1:
            alert(Oshoplang.OutOfStock);
            break;
        case 2:
            if (!l) {
                if (e) {
                    e.innerHTML = b.value[3];
                    ProcessJS(e)
                }
                alert(g + Oshoplang.PreOrder)
            } else {
                document.location = "/OrderRetrievev2.aspx?CatalogueID=" + j
            }
            break;
        case 3:
            alert(Oshoplang.MinLimit);
            break;
        case 4:
            alert(Oshoplang.MaxLimit);
            break
        }
        if (typeof AddProductExtras == "function") {
            AddProductExtras(j, h, b.value[1])
        }
		
		shopSetting(status);
    }
	
	function UpdateItemQuantity(d, i, f, e, j, l, g) {
        var b;
        var h;
        var a = false;
        var m = false;
        var k = true;
        b = document.getElementById("catCartDetails");
        h = document.getElementById("catCartSummary");
        if (h) {
            if (h.getAttribute("Vertical") == "True") {
                a = true
            }
            if (h.getAttribute("Quote") == "True") {
                m = true
            }
        }
        if (!IsNumeric(d)) {
            alert(Oshoplang.InvalidQuantity);
            return false
        }
        if (b) {
            var c;
            c = CMS.OrderRetrievev2.ServerSideUpdateItemQuanity(i, f, e, j, d, l, g, a, m, k);
            switch (c.value[0]) {
            case 0:
            case 2:
                b.innerHTML = c.value[1];
                if (h) {
                    h.innerHTML = c.value[2];	
                }
                break;
            case 1:
                alert(Oshoplang.OutOfStock);
                return;
            case 3:
                alert(Oshoplang.MinLimit);
                break;
            case 4:
                alert(Oshoplang.MaxLimit);
                break;
            case -1:
			    
				//shopping cart is empty
                b.innerHTML = c.value[1];
				
                if (h) {
				
                    h.innerHTML = c.value[2]
					
                }
                alert(Oshoplang.CartEmpty);
                break
            }
        }
        if (typeof UpdateProductExtras == "function") {
            UpdateProductExtras(f, e, c.value[0])
        }
		
	}
	


