function gid( id ) {
	return document.getElementById( id )
}
function AJAX() {
	this._call = Math.random();
	this._method = "GET";
	this._vars = null;
	if ( window.XMLHttpRequest) { // Mozilla, Safari, etc.
		this._request = new XMLHttpRequest();
	} else if (window.ActiveXObject) { // IE
		try {
			this._request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				this._request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {
        			alert('Failed to create');
			}
		}
	}
}
AJAX.prototype.execute = function(url,parser) {
	var xml = this._request;
	this._call++;
	xml.open(this._method, url, true);
	// xml.setRequestHeader('Content-Type', 'text/xml');
	var readystate = function() {
		try {
			if((xml.readyState == 4) && (xml.status == 200)) {
				parser(xml);
				xml.onreadystatechange = function(){};
				xml = null;
			}
		} catch(e) { /*alert(e);*/ }
	}
	this._request.onreadystatechange = readystate;
	this._request.send(this._vars);
}

function AjaxMiniCartUpdate() {
	var req = new AJAX( false );
	var url = "/checkout/html.php?t=minicart";
	req.execute( url + "&from=" + escape(window.location),
	function( txt ) {
 		try {
			gid("my_shop_cart").innerHTML = txt.responseText;
      		} catch ( e ) {}
	} );

}
function get_cookie_value( name ) {
	if ( document.cookie.indexOf( ";" ) <= 0 ) return "";
	var coo = document.cookie.split(";");
	for ( var i = 0; i < coo.length; i++ ) {
		coo[i] = coo[i].replace( /^\s+/g, "");
		coo[i] = coo[i].replace( /\s+$/g, "");
		var eq = coo[i].indexOf( "=" );
		var cook = coo[i].substr( 0, eq );
		if ( cook == name ) return coo[i].substr( eq + 1);

	}
	return "";
}

