
function popup(url)
{
	//get widths and heights of the visitors screen
	var leftPos = (screen.width - 400) / 2;
	var topPos = (screen.height - 400) / 2;

	newWindow = window.open(url,'popup','location=no, status=no, resizable=yes, scrollbars=yes, width=400, height=400, top=' + topPos + ', left=' + leftPos);
	newWindow.window.focus();
}

function post_total(post,total)
{
	document.getElementById('cp').innerHTML = post;
	document.getElementById('ct').innerHTML = total;
}

function remove_address(submitted)
{
	document.forms['listForm'].elements['remove'].value = submitted;
	document.forms['listForm'].submit();
}

function remove_form(submitted)
{
	document.forms['editcart'].elements['remove'].value = submitted;
	document.forms['editcart'].submit();
}

function update_cart()
{
	document.forms['editcart'].submit();
}

function changeSideimage()
{
	var oldHTML = document.getElementById('sideimage').innerHTML;
	var newHTML = oldHTML.replace(/(<!--|-->)/g, "");
	document.getElementById('sideimage').innerHTML = newHTML;
}

function mainImage(src)
{
	var newsrc = src.replace(/thum/, 'main');
	document.getElementById('main_image').src = newsrc;
}

// show/hide tabs

	var tabs=new Array('tab1','tab2','tab3');
	
	function showhidetab(id){
		hidealltabs();
		showdiv(id);
	}
	
	function hidealltabs(){
		//loop through the array and hide each element by id
		for (var i=0;i<tabs.length;i++){
			hidediv(tabs[i]);
		}		  
	}
	
	function hidediv(id) {
		document.getElementById(id).style.display = 'none';
		var tabbutton = id + 'b';
		document.getElementById(tabbutton).className = '';
	}
	
	function showdiv(id) {
		document.getElementById(id).style.display = 'block';
		var tabbutton = id + 'b';
		document.getElementById(tabbutton).className = 'on';
	}


