function show_single_product(id)
{
var id = id;

	new Ajax.Request('../handler/handler.products.php', {
		method: 'post',parameters: ('function=single_product&product_id='+id).toQueryParams(),onSuccess: function(transport, json){
				if (json) {
					if (json.success == true) {
						eval(transport.responseText);
					}
				}
			},
			onFailure: function(transport) { alert('connection to server failed'); } }
	);
}
function show_multi_products(category)
{
var category = category;

	new Ajax.Request('../handler/handler.products.php', {
		method: 'post',parameters: ('function=multi_products&category='+category).toQueryParams(),onSuccess: function(transport, json){
				if (json) {
					if (json.success == true) {
						eval(transport.responseText);
					}
				}
			},
			onFailure: function(transport) { alert('connection to server failed'); } }
	);
}

function admin_products(admin_function)
{
var admin_function = admin_function;
new Ajax.Request('../handler/handler.products.php', {
		method: 'post',parameters: ('function=admin_products&admin_function='+admin_function).toQueryParams(),onSuccess: function(transport, json){
				if (json) {
					if (json.success == true) {
						eval(transport.responseText);
					}
				}
			},
			onFailure: function(transport) { alert('connection to server failed'); } }
	);
}
function admin(admin_function)
{
var admin_function = admin_function;
new Ajax.Request('../handler/handler.admin.php', {
		method: 'post',parameters: ('admin_function='+admin_function).toQueryParams(),onSuccess: function(transport, json){
				if (json) {
					if (json.success == true) {
						eval(transport.responseText);
					}
				}
			},
			onFailure: function(transport) { alert('connection to server failed'); } }
	);
}
function new_customer()
{
new Ajax.Request('../handler/handler.admin.php', {
		method: 'post',parameters: ('admin_function=new_customer').toQueryParams(),onSuccess: function(transport, json){
				if (json) {
					if (json.success == true) {
						eval(transport.responseText);
					}
				}
			},
			onFailure: function(transport) { alert('connection to server failed'); } }
	);
}
function admin_customer()
{
new Ajax.Request('../handler/handler.admin.php', {
		method: 'post',parameters: ('admin_function=admin_customer').toQueryParams(),onSuccess: function(transport, json){
				if (json) {
					if (json.success == true) {
						eval(transport.responseText);
					}
				}
			},
			onFailure: function(transport) { alert('connection to server failed'); } }
	);
}
function add_customer(company,office_address,office_zipcode,office_city,office_country,customer_org,storage_address,storage_zipcode,storage_city,storage_country,contact1,contact1_phone,contact1_email,contact2,contact2_phone,contact2_email,chain_of_stores,discount,free_text)
{
var company = document.getElementById(company).value;
var office_address = document.getElementById(office_address).value;
var office_zipcode = document.getElementById(office_zipcode).value;
var office_city = document.getElementById(office_city).value;
var office_country = document.getElementById(office_country).value;
var customer_org = document.getElementById(customer_org).value;
var storage_address = document.getElementById(storage_address).value;
var storage_zipcode = document.getElementById(storage_zipcode).value;
var storage_city = document.getElementById(storage_city).value;
var storage_country = document.getElementById(storage_country).value;
var contact1 = document.getElementById(contact1).value;
var contact1_phone = document.getElementById(contact1_phone).value;
var contact1_email = document.getElementById(contact1_email).value;
var contact2 = document.getElementById(contact2).value;
var contact2_phone = document.getElementById(contact2_phone).value;
var contact2_email = document.getElementById(contact2_email).value;
var chain_of_stores = document.getElementById(chain_of_stores).value;
var discount = document.getElementById(discount).value;
var free_text = document.getElementById(free_text).value;

new Ajax.Request('../handler/handler.admin.php', {
		method: 'post',parameters: ('admin_function=add_customer&company='+company+'&office_address='+office_address+'&office_zipcode='+office_zipcode+'&office_city='+office_city+'&office_country='+office_country+'&customer_org='+customer_org+'&storage_address='+storage_address+'&storage_zipcode='+storage_zipcode+'&storage_city='+storage_city+'&storage_country='+storage_country+'&contact1='+contact1+'&contact1_phone='+contact1_phone+'&contact1_email='+contact1_email+'&contact2='+contact2+'&contact2_phone='+contact2_phone+'&contact2_email='+contact2_email+'&chain_of_stores='+chain_of_stores+'&discount='+discount+'&free_text='+free_text).toQueryParams(),onSuccess: function(transport, json){
				if (json) {
					if (json.success == true) {
						eval(transport.responseText);
					}
				}
			},
			onFailure: function(transport) { alert('connection to server failed'); } }
	);
}
function customer_details(customer_id)
{
var customer_id = document.getElementById(customer_id).value;
new Ajax.Request('../handler/handler.admin.php', {
		method: 'post',parameters: ('admin_function=show_customer_details&customer_id='+customer_id).toQueryParams(),onSuccess: function(transport, json){
				if (json) {
					if (json.success == true) {
						eval(transport.responseText);
					}
				}
			},
			onFailure: function(transport) { alert('connection to server failed'); } }
	);
}
function storage_item(storage_function)
{
var storage_function = storage_function;

new Ajax.Request('../handler/handler.admin.php', {
		method: 'post',parameters: ('admin_function=storage&storage_function='+storage_function).toQueryParams(),onSuccess: function(transport, json){
				if (json) {
					if (json.success == true) {
						eval(transport.responseText);
					}
				}
			},
			onFailure: function(transport) { alert('connection to server failed'); } }
	);
}
function storage_details(product_id)
{
var product_id = document.getElementById(product_id).value;

new Ajax.Request('../handler/handler.admin.php', {
		method: 'post',parameters: ('admin_function=storage_item&product_id='+product_id).toQueryParams(),onSuccess: function(transport, json){
				if (json) {
					if (json.success == true) {
						eval(transport.responseText);
					}
				}
			},
			onFailure: function(transport) { alert('connection to server failed'); } }
	);
}
function add_storage(product_id,nr_of_items)
{
var product_id = document.getElementById(product_id).value;
var nr_of_items = document.getElementById(nr_of_items).value;

new Ajax.Request('../handler/handler.admin.php', {
		method: 'post',parameters: ('admin_function=add_storage&product_id='+product_id+'&nr_of_items='+nr_of_items).toQueryParams(),onSuccess: function(transport, json){
				if (json) {
					if (json.success == true) {
						eval(transport.responseText);
					}
				}
			},
			onFailure: function(transport) { alert('connection to server failed'); } }
	);
}
function remove_storage(product_id,nr_of_items)
{
var product_id = document.getElementById(product_id).value;
var nr_of_items = document.getElementById(nr_of_items).value;

new Ajax.Request('../handler/handler.admin.php', {
		method: 'post',parameters: ('admin_function=remove_storage&product_id='+product_id+'&nr_of_items='+nr_of_items).toQueryParams(),onSuccess: function(transport, json){
				if (json) {
					if (json.success == true) {
						eval(transport.responseText);
					}
				}
			},
			onFailure: function(transport) { alert('connection to server failed'); } }
	);
}

function add_product(product_name,product_nr,product_image_name,product_image_alt_text,quantity,product_info_text,product_ean_code)
{
	var product_name = document.getElementById(product_name).value;
	var product_nr = document.getElementById(product_nr).value;
	var product_image_name = document.getElementById(product_image_name).value;
	var product_image_alt_text = document.getElementById(product_image_alt_text).value;
	var quantity = document.getElementById(quantity).value;
	var product_info_text = document.getElementById(product_info_text).value;
	var product_ean_code = document.getElementById(product_ean_code).value;
	
	new Ajax.Request('../handler/handler.admin.php', {
		method: 'post',parameters: ('admin_function=add_product&product_name='+product_name+'&product_nr='+product_nr+'&product_image_name='+product_image_name+'&product_image_alt_text='+product_image_alt_text+'&quantity='+quantity+'&product_info_text='+product_info_text+'&product_ean_code='+product_ean_code).toQueryParams(),onSuccess: function(transport, json){
				if (json) {
					if (json.success == true) {
						eval(transport.responseText);
					}
				}
			},
			onFailure: function(transport) { alert('connection to server failed'); } }
	);
}
function new_order()
{
new Ajax.Request('../handler/handler.admin.php', {
		method: 'post',parameters: ('admin_function=new_order').toQueryParams(),onSuccess: function(transport, json){
				if (json) {
					if (json.success == true) {
						eval(transport.responseText);
					}
				}
			},
			onFailure: function(transport) { alert('connection to server failed'); } }
	);
}
function popUp()
{
testwindow= window.open ("/images/products/mjukisdjur_hund_223.jpg", "mywindow",
    "width=500,height=500");
testwindow.moveTo(100,100);

}	

function getMailLink(linkelement) {
  var username = 'info';
  var domain = 'hugme';
  var countrycode = 'se'
 
  linkelement.href='m'+'a'+'i'+'l'+'t'+'o:'+username+'@'+domain+'.'+countrycode;
}
