var lastCartDiv = null;

function showAjaxAni(id){
	document.getElementById(id).innerHTML = '<img src="fileadmin/images/spinner.gif" border="0" />';
}

function updateCart(){
	document.forms['cart-form'].submit();
}

function removeFromCart(prod_id){
	document.forms['cart-form']['tx_fornaraproducts_pi1[remove_prod_id]'].value = prod_id;
	//alert(document.forms['cart-form']['tx_fornaraproducts_pi1[remove_prod_id]'].value);
	document.forms['cart-form'].submit();
}

function showAmountForm(){
	showHideElement('add_item_container','show');
}

function closeIt(divID){
	showHideElement(divID,'hide');
}

function showAmountForm_2(num){
	if (lastCartDiv != null) showHideElement(lastCartDiv,'hide');
	showHideElement('add_item_container_' + num,'show');
	lastCartDiv = 'add_item_container_' + num;
}

function showHideElement(id,sh) {
	setElementStyle(id,'display',(sh == 'show') ? 'block' : 'none');
	setElementStyle(id,'visibility',(sh == 'show') ? 'visible' : 'hidden');
} 

function setElementStyle(id,style,value) {
	var obj = document.getElementById(id);
	if (!obj) return;
	//alert(style+'/'+value);
	obj.style[style] = value;
} 

function toggle_visibility(id) { 
	var e = document.getElementById(id);
	if(e != null) { if(e.style.display == 'none') { e.style.display = 'block'; }
	else { e.style.display = 'none'; } 
	}
}

function insertFlash(swf, w, h, flashvars, version, bgcolor, wmode, swfname, codebase){
 	if (flashvars == undefined) flashvars = "";
 	if (version == undefined) version = "8";
 	if (bgcolor == undefined) bgcolor = "#ffffff";
 	if (wmode == undefined) wmode = "window";
 	if (swfname == undefined) swfname = "movie";
 	if (codebase == undefined) codebase = "true";
 	var base_1 = "";
 	var base_2 = "";
 	if (codebase == "true"){
		base_1 = '<param name="base" value="." />';
		base_2 = 'base="."';
  	}
 	var embedStr = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + version + ',0,0,0" width="' + w + '" height="' + h + '" id="' + swfname + '" align="middle"><param name="wmode" value="' + wmode + '" /><param name="flashVars" value="' + flashvars + '" />' + base_1 + '<param name="allowFullScreen" value="true" /><param name="scale" value="noscale" /><param name="salign" value="TL" /><param name="allowScriptAccess" value="always" /><param name="movie" value="' + swf + '" /><param name="quality" value="high" /><param name="bgcolor" value="' + bgcolor + '" /><EMBED src="' + swf + '" quality=high bgcolor="' + bgcolor + '"  WIDTH="' + w + '" HEIGHT="' + h + '" NAME="' + swfname + '" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" scale="noscale" salign="TL" allowFullScreen="true" allowScriptAccess="true" ' + base_2 + ' flashVars="' + flashvars + '" wmode="' + wmode + '"><\/EMBED><\/OBJECT>';
	document.write(embedStr);
}


