var id;
var info;
var basket;
var prod;
var p_name;
var quantity;
var sess_id;
var price;
var date;
var curPos;
	
	function setProduct( pid, pname, _sess_id, _price, _date)
{
	if (document.documentElement)
		if (document.documentElement.scrollTop) 
			curPos = document.documentElement.scrollTop+200;
		else
			curPos = 200;
	$('e').style.display = 'block';

	if (navigator.appName != "Microsoft Internet Explorer") 
		$('e').style.top = curPos+'px';
	else
		$('e').style.top = curPos;

	$('e').innerHTML = "<img src=\"../images/messagebox_info.png\" align=\"left\"><div id=\"prod\"></div><br><center>Quantity: <input type=text value=\"1\" id=quantity style=\"width:30px;\"> </center><br><div align=\"right\"><input type=button value=\"Add\" onclick=\"basketAdd();\"><input type=button value=\"Cancel\" onclick=\"document.getElementById(\'e\').style.display = \'none\';\">";
	
	prod = document.getElementById('prod');
	quantity = document.getElementById('quantity');
	sess_id = _sess_id;
	price = _price;
	date = _date;
	id = pid;
	p_name = pname;
	prod.innerHTML = "Product : "+p_name+" .<br>";
}
	function basketAdd()
{
	LoadData('basket','?mode=shop&exec=Add&arguments[id]='+sess_id+'&data=Basket&arguments[product_id]='+id+'&arguments[quantity]='+quantity.value+'&arguments[product_name]='+p_name+'&arguments[price]='+price+'&arguments[date_product_added]='+date);
	$('e').innerHTML = p_name+" added to shopping cart.";
	setTimeout("$('e').style.display = 'none';",1500);
}
function loadPhoto(image)
{
	$('e').style.display = 'block';
	$('e').src = '../product_photo/photo/'+image;
}
function setCatPromo(mode, box, id)
{
  promo = (box.checked) ? '1' : '0';
	LoadData('inframe','?mode='+mode+'&exec=Update&arguments[id]='+id+'&data=Product&arguments[on_catalog_promotion]='+promo, true);
}
function setDepPromo(mode, box, id)
{
  promo = (box.checked) ? '1' : '0';
	LoadData('inframe','?mode='+mode+'&exec=Update&arguments[id]='+id+'&data=Product&arguments[on_department_promotion]='+promo, true);
}
function setBestBuy(mode, box, id)
{
  promo = (box.checked) ? '1' : '0';
	LoadData('inframe','?mode='+mode+'&exec=Update&arguments[id]='+id+'&data=Product&arguments[best_buy]='+promo, true);
}
function setNew(mode, box, id)
{
  promo = (box.checked) ? '1' : '0';
	LoadData('inframe','?mode='+mode+'&exec=Update&arguments[id]='+id+'&data=Product&arguments[new]='+promo, true);
}
function setAvailable(mode, Data, id, img)
{
	$('e').style.display = 'block';
	//frame = document.getElementById('inframe');
myString = new String(img.src);
 rExp = /error.png/gi;
	if (myString.search(rExp) > 0 ) {
		promo = '1';
		img.src = 'images/clean.png';
	}
	else {
		promo = '0';
		img.src = 'images/error.png';
	}
	LoadData('inframe','?mode='+mode+'&exec=Update&arguments[id]='+id+'&data='+Data+'&arguments[is_active]='+promo);
	setTimeout("$('e').style.display = 'none';",1250);
}