<!--//
function randomNumber (m,n)
{
  m = parseInt(m);
  n = parseInt(n);
  return Math.floor( Math.random() * (n - m + 1) ) + m;
}
function cart(anchor) 
{
	w = window.open(anchor,'','height=250,width=270,title=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1');
	w.focus();
} 

function winop(imgurl, width, height)
{
    title = "window";
    im = window.open('', 'win','top=40,left=40,width='+width+',height='+height+', scrollbars=no, menu=no,status=no,resizable=no');
    im.focus();
    im.document.open ("text/html");
    im.document.write ('<html><title>'+title+'</title><body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 bgcolor=#ffffff><table width=100% height=100% border=0 cellpadding=0 cellspacing=0><tr><td align=center><img src='+imgurl+' width='+width+' height='+height+'></td></tr></table></body></html>');
    im.document.close ();
}

var tabOpened = 1;

function switchTabs(id, link)
{
	
	if (tabOpened != id)
	{
		$("#tab"+tabOpened).removeClass("active");
	
		$('#v'+tabOpened).css('display','none');
		
		$('#v'+id).css('display','block');
		$('#tab'+id).addClass('active');
	}
	
	tabOpened = id;
}
function addToCart(id,price)
{
	$.getJSON("/ajax.php?rnd="+randomNumber(10000,90000), { action: "addcart", id: id, price: price, qty: 1}, function(data) {			
		$("#cartmessage"+id).html(data.error);
		$("#cartmessage"+id).fadeIn("slow");
		setTimeout('$("#cartmessage'+id+'").fadeOut("slow");',2000);
		
		$("#cart-qty").text(data.qty);
		$("#cart-price").text(data.price);
	});

	return false;
}
function cart_delete(form, id)
{
	form.elements['delete'].value = id;
	form.elements['action'].value = 'delete';
	form.submit();
}
// -->

