function show_block(element, action)
{
	document.getElementById(element).style.display = action;
}

function visible_block(element, action)
{
    document.getElementById(element).style.visibility = action;
}

function showmenu()
{
	if(document.getElementById('m').style.display == 'none')
	{
		show_block('m', 'block');
		show_block('w', 'none');
	}
	else
	{
		show_block('m', 'none');
		show_block('w', 'block');
	}
}

function SetBg(tdself, element)
{
	document.getElementById("r"+element).style.backgroundColor = "#111111";
    visible_block(element, 'visible');
}

function SetBg2(tdself, element)
{
	document.getElementById("r"+element).style.backgroundColor = "";
    visible_block(element, 'hidden');
}

function goToStyle(d)
{
   var url = document.getElementById(d).options[document.getElementById(d).selectedIndex].value;
   window.location = url;
}


function recalculateCart(item_id)
{
	var quantity = '';
	if(item_id != '')
	{
		var quantity = document.getElementById('quantity'+item_id).value;
	}

	var delivery = document.getElementById('delivery').value;
    var coupon   = document.getElementById('coupon').value;
    var lang   = document.getElementById('lang').value;
    xajax_recalculateCart(item_id, quantity, delivery, coupon, lang);
}


function newwin(url, width, height)
{
	var pic = document.getElementById('pic').innerHTML;
	window.open(url+pic, 'newWnd1','width='+width+',height='+height+',toolbar=0,status=0,scrollbars=1,resizable=1,left=0, top=0');
}

function deleteFromCart(item)
{
	var delivery = document.getElementById('delivery').value;
    var coupon   = document.getElementById('coupon').value;
    var lang   = document.getElementById('lang').value;
	xajax_deleteFromCart(item, delivery, coupon, lang);
}

function copy_address()
{
    if(document.wp['data[billing][same_address]'].checked == true)
    {
		document.wp['data[billing][country]'].value = document.wp['data[shipping][country]'].value;
		document.wp['data[billing][address]'].value = document.wp['data[shipping][address]'].value;
		document.wp['data[billing][postcode]'].value = document.wp['data[shipping][postcode]'].value;
		document.wp['data[billing][tel]'].value = document.wp['data[shipping][tel]'].value;
		document.wp['data[billing][fax]'].value = document.wp['data[shipping][fax]'].value;
		document.wp['data[billing][email]'].value = document.wp['data[shipping][email]'].value;
	}
	else
	{
        document.wp['data[billing][country]'].value = document.wp['data[shipping][country]'].value;
		document.wp['data[billing][address]'].value = "";
		document.wp['data[billing][postcode]'].value = "";
		document.wp['data[billing][tel]'].value = "";
		document.wp['data[billing][fax]'].value = "";
		document.wp['data[billing][email]'].value = "";
	}
}

function refresh_code(code)
{
    xajax_captcha(code);
}
