function openPopup(URL,WIDTH,HEIGHT){
	if(!WIDTH) WIDTH=600;
	if(!HEIGHT) HEIGHT=600;
	
	WIDTH=600;
	HEIGHT=600;
	popup = window.open(URL,"popup","width="+WIDTH+", height="+HEIGHT+", scrollbars=yes");
}


function write_lieferadresse(form) {
	form.shippingname.value = form.invoicename.value;
	form.shippingaddress.value = form.invoiceaddress.value;
	form.shippingname.value = form.invoicename.value;		
	form.shippingzip.value = form.invoicezip.value;		
	form.shippingcity.value = form.invoicecity.value;		
	form.shippingcountry.value = form.invoicecountry.value;					
}

/////////////////////////////////////////////
//

function showLayer(lyr) {
   makeHistory(lyr);
   document.getElementById(currentLayer).className = 'hide';
   document.getElementById(lyr).className = 'show';
   currentLayer = lyr;
   showTab(lyr.replace("tab","t_"));
}

function showTab(lyr) {
   document.getElementById(currentTab).className = 'taboff';
   document.getElementById(lyr).className = 'tabon';
   currentTab = lyr;
}

function makeHistory(newHash) {
  window.location.hash = "_" + newHash;
  expectedHash = window.location.hash;
  return true;
}

function handleHistory() {
  if ( window.location.hash != expectedHash ) {
    expectedHash = window.location.hash;
    if (expectedHash.match('tab')) showLayer(expectedHash.substring(2));
  }
  return true;
}

function pollHash() {
  handleHistory();
  window.setInterval("handleHistory()", 200);
  return true;
}

function toggleDiv(id) {
/*
	var obj=document.getElementsByTagName("div");
	for(i=0;i<obj.length;i++) {
		if(obj[i].className =="func") {
			obj[i].style.display="none";
		}
	}
*/
	if(document.getElementById(id).style.display == 'none') {
	   document.getElementById(id).style.display = 'block';
	   document.getElementById('head_'+id).className = 'function_cat open';
	} else {
	   document.getElementById(id).style.display = 'none';
	   document.getElementById('head_'+id).className = 'function_cat closed';
	}
}

////////// END Dynamic Tabs /////////
