function item_box(id) {
	document.getElementById('quickopen').style.display = 'block';
	document.getElementById('quickopen').style.top = yMousePos-200;
	document.getElementById('quickopen').style.left = xMousePos;
	ajax.Server('?a=itemshort&id='+id+'&embed=quickopen');
}

var cancel_hide=0;
function hide_item_box() {
	cancel_hide=0;
	setTimeout('do_hide_item_box()', 500);
}

function do_hide_item_box() {
	if(!cancel_hide) {
		document.getElementById('quickopen').style.display = 'none';
	}
}

function close_item_box() {
	document.getElementById('quickopen').style.display = 'none';
}

function add_to_basket(id) {
	url = '?a=cart/add&id='+id;
	ajax.Server(url);	
	show_cart();
}

function show_cart() {
	url = '?a=cart/show';
	document.location = url;
}

function clear_cart() {
	ajax.Server('?a=cart/clear');
}

function remove(id) {
	ajax.Server('?a=cart/remove&id='+id);
}

function remove_prd_tr(num) {
	var tbody = $("prd_body");
	for(a=0;a<tbody.rows.length;a++) {
		if(tbody.rows[a].id=="prd_tr_"+num)
			tbody.removeChild(tbody.rows[a]);
	}
}

function view_input(obj,id) {
	var source = obj.innerText;
	var evnt = "update_prd_details(this,'"+source+"','"+id+"')";
	obj.outerHTML='<input style="width:38px;height:20px;" type="text" value="'+source+'" onblur="'+evnt+'">';
}

function update_prd_details(obj,source,id) {
	var val = parseFloat(obj.value);
	if(isNaN(val)) {
		alert("Please enter number!");
		val = source;
	}
	var evnt = "view_input(this,'"+id+"')";
	obj.outerHTML = '<span onclick="'+evnt+'">'+val+'</span>';
	ajax.Server('?a=cart/update_prd_details&id='+id+'&val='+val);
}

function craete_order() {
	ajax.Server('?a=cart/craete_order');
}

function order_list(orderby,id,desc){
	var url='?a=navigator/main&id='+id+'&orderby='+orderby+'&j='+nowadays();
	if(desc=='1'){
		url+='&orderdesc=1';
	}
	document.location=url;
}

function move_to_page(page,id,order_by,is_desc){
	var url='?a=navigator/main&id='+id+'&page='+page+'&j='+nowadays()+'&orderby='+order_by;
	if(is_desc=='1'){
		url+='&orderdesc=1';
	}
	document.location=url;
}

function order_result(orderby,s,desc,set) {
	if(!set) {
		var url='?a=navigator/find&search_prd';
	} else {
		var url='?a=navigator/pset&set';
	}
	url += '='+s+'&orderby='+orderby+'&j='+nowadays();
	if(desc=='1'){
		url+='&orderdesc=1';
	}
	document.location=url;
}

function move_to_found_page(page,s,order_by,desc,set){
	if(!set) {
		var url='?a=navigator/find&search_prd';
	} else {
		var url='?a=navigator/pset&set';
	}
	url += '='+s+'&page='+page+'&j='+nowadays()+'&orderby='+order_by;
	if(desc=='1'){
		url+='&orderdesc=1';
	}
	document.location=url;
}