// 
function ShowHideDiv(divname) {
	var curstate = document.getElementById(divname).style.display;
	//alert(curstate);
	if(curstate == "none") {
		document.getElementById(divname).style.display = "";
	} else {
		document.getElementById(divname).style.display = "none";
	}
}

function liquidconfirm(pagelink){
question = confirm("Are you sure you want to delete this? It cant be undone.")
if (question !="0"){
	location = pagelink;
	}
}

function setfieldvalue(thefield,newvalue) {
	document.getElementById(thefield).value = newvalue;
}

// Moves the box object to be centered on current
// viewable area of the page
function center_box(box, width, height)
{
    cleft = has_inner
        ? pageXOffset + 
          (window.innerWidth - width)/2
        : has_element
          ? document.documentElement.scrollLeft + 
            (document.documentElement.clientWidth - width)/2
          : document.body.scrollLeft + 
            (document.body.clientWidth - width)/2;

    ctop = has_inner
        ? pageYOffset + (window.innerHeight - height)/2
        : has_element
          ? document.documentElement.scrollTop + 
            (document.documentElement.clientHeight - height)/2
          : document.body.scrollTop + 
            (document.body.clientHeight - height)/2;

    box.style.left = cleft > 0 ? cleft + 'px' : '0px';
    box.style.top = ctop > 0 ? ctop + 'px' : '0px';
}

// Hides other alone popup boxes that might be displayed
function hide_other_alone(obj)
{
    if (!document.getElementsByTagName)
        return;

    var all_divs = document.body.getElementsByTagName("DIV");

    for (i = 0; i < all_divs.length; i++)
    {
        if (all_divs.item(i).style.position != 'absolute' ||
            all_divs.item(i) == obj ||
            !all_divs.item(i).alonePopupBox)
        {
            continue;
        }

        all_divs.item(i).style.display = 'none';
    }
    return;
}

function aq2_addtocart(id){
	var productid = id;
	var productqty = $('#pqty'+id).val();
	var productsize = $('#poptions'+id).val();
	//alert(productsize);
	// post start
	$.post("droplets/checkout/addtocart.php", 
		{ 	
			productid: productid,
			productqty: productqty,
			productsize: productsize
		},
		function(data){ 
			alert(data); 
		}
	);
	// post end
}
