//SHOW AND HIDE ADVANCED SETTINGS
function showAdvancedSettings() {
	document.getElementById("advancedSettings").style.display="block";
}

function hideAdvancedSettings() {
	document.getElementById("advancedSettings").style.display="none";
}

//SHOW AND HIDE ADVANCED DEALER INFO
function showAdvancedDealerInfo(userId) {
	var but2 = "button2";
	var butt = but2+userId;
	document.getElementById(butt).style.display="block";
	
	var but1 = "button1";
	var butt1 = but1+userId;
	document.getElementById(butt1).style.display="none";
	
	var win = "window";
	var wind = win+userId;
	document.getElementById(wind).style.display="block";
}

function hideAdvancedDealerInfo(userId) {
	var but2 = "button2";
	var butt = but2+userId;
	document.getElementById(butt).style.display="none";
	
	var but1 = "button1";
	var butt1 = but1+userId;
	document.getElementById(butt1).style.display="block";
	
	var win = "window";
	var wind = win+userId;
	document.getElementById(wind).style.display="none";
}

//MAKE ORANGE BORDER
function activateBorder(picId) {
	var pic = "pic";
	var pictureId = pic+picId;
	document.getElementById(pictureId).style.borderColor="#F99604";
}

function deactivateBorder(picId) {
	var pic = "pic";
	var pictureId = pic+picId;
	document.getElementById(pictureId).style.borderColor="#cccccc";
}

function showTab1() {
	document.getElementById('long_desc').style.display = 'block';
	document.getElementById('tech_data').style.display = 'none';
	document.getElementById('tab_1').style.color = '#fe6c00';
	document.getElementById('tab_2').style.color = '#6e665b';
	document.getElementById('tab_1').style.height = '22px';
	document.getElementById('tab_2').style.height = '20px';
}

function showTab2() {
	document.getElementById('long_desc').style.display = 'none';
	document.getElementById('tech_data').style.display = 'block';
	document.getElementById('tab_1').style.color = '#6e665b';
	document.getElementById('tab_2').style.color = '#fe6c00';
	document.getElementById('tab_1').style.height = '20px';
	document.getElementById('tab_2').style.height = '22px';
}

function setPrice(fromPieces1, toPieces1, price1, fromPieces2, toPieces2, price2, fromPieces3, toPieces3, price3, artId, itemnr) {
	var amount = document.getElementById('amount').value;
	var price = 'NaN';
	
	if(toPieces3 - amount  >= 0) price = price3;
	if(toPieces2 - amount  >= 0) price = price2;
	if(toPieces1 - amount  >= 0) price = price1;
	
	price_2 = price * amount;
	price_2 = price_2.toFixed(2);
	price_2 = price_2.toString();
	price_2 = price_2.replace(".", ",");
	
	document.getElementById('product_price').innerHTML = price_2 + ' &euro;';
	document.getElementById('warenkorb_button').innerHTML = '<a class="noborder" href="index.php?article_id=' + artId + '&item=' + itemnr + '&cart=1&pcs=' + amount + '"><img alt="In den Warenkorb" src="files/warenkorb_button.jpg" /></a>';
}

function updatePcs(obj, artId, itemnr) {
	var amount = obj.value;
	
	document.getElementById('warenkorb_button').innerHTML = '<a class="noborder" href="index.php?article_id=' + artId + '&item=' + itemnr + '&cart=1&pcs=' + amount + '"><img alt="In den Warenkorb" src="files/warenkorb_button.jpg" /></a>';
}

function toggleShippingBlock(obj) {
	if(obj.checked == true) document.getElementById('ship_ad').style.display = 'none';
	else document.getElementById('ship_ad').style.display = 'block';
}
