function shark_addToCart(product_id,stock_type_id) {
	sealLoad('/_plugins/shark/shark_ajax_addToCart.php?product_id='+product_id+'&stock_type_id='+stock_type_id,shark_updateCart,1500);
}

function shark_updateCart(data) {
	document.getElementById("shark_wrapper").innerHTML = data;
}

function shark_stopPropagation(e) {
	if (!e) e = window.event;
	e.cancelBubble = true;
	if (e.stopPropagation) e.stopPropagation();
}

function shark_playAddAnim(t) {

	newPlus = document.createElement('div');
	
	var now = new Date().getTime() / 1000;
	var unique = 'shark_addIcon_'+parseInt(now);
	
	newPlus.setAttribute('id',unique);
	newPlus.setAttribute('class','shark_addtocarticon');
	
	newPlus.style.top = (getY(t)-20)+'px';
	newPlus.style.left = getX(t)+'px';
	newPlus.style.opacity = 1;
	
	document.body.appendChild(newPlus);
	
	var intervalContainer = setInterval("shark_animate('"+unique+"')",25);
	setTimeout("shark_clearInterval('"+intervalContainer+"', '"+unique+"')",600);
	
}

function shark_animate(id) {
	obj = document.getElementById(id);
	obj.style.top = (getY(obj)-4)+'px';
	obj.style.opacity -= 0.04;
}

function shark_clearInterval(interval, id) {
	obj = document.getElementById(id);
	clearInterval(interval);
	document.body.removeChild(obj);
}


function getY( oElement ) {
	var iReturnValue = 0;
	while( oElement != null ) {
		iReturnValue += oElement.offsetTop;
		oElement = oElement.offsetParent;
	}
	return iReturnValue;
}

function getX( oElement ) {
var iReturnValue = 0;
	while( oElement != null ) {
		iReturnValue += oElement.offsetLeft;
		oElement = oElement.offsetParent;
	}
	return iReturnValue;
}
