function hideExpand(id) {
	if( document.getElementById("content_"+id).style.display == 'none' ) {
		document.getElementById("img_" + id).src="/images/expanded_arrow.gif";
		document.getElementById("content_" + id).style.display='block';
	} else {
		document.getElementById("img_" + id).src="/images/collapsed_arrow.gif";
		document.getElementById("content_" + id).style.display='none';
	}
}

function printProductExpose() {

	var printFrame;

	var printDiv = document.getElementById("contentArea");

	if ( printDiv )
	{
		if ( isMSIE() ) {
			printFrame = document.printFrame;
		} else {
			printFrame = window.frames['printFrame'];
		}

		printable = printFrame.document.getElementById("printable");
		printable.innerHTML = printDiv.innerHTML;
		printFrame.document.getElementById("print_base_content").innerHTML=printFrame.document.getElementById("base_data").innerHTML;
		printFrame.document.getElementById("base_data").innerHTML="";
		var imgs = printFrame.document.getElementsByTagName("img");
		var toRemove = new Array();
		
		for( var i = 0; i < imgs.length; i++ )  {
		    if( imgs[i].id.indexOf("img_") != -1 ) {
		    	toRemove.push(imgs[i]);
		    }
		}

		for(var i = 0; i < toRemove.length; i++) {
			toRemove[i].parentNode.removeChild(toRemove[i]);
		}
		
		printFrame.focus();
		printFrame.print();
	} else {
		alert("Div with ID '" + divId + "' is not known");
	}

    return false;
}

function noSpam( m, label ) {
	m = m.replace("=abc=","@");
	label = label.replace("=abc=","@");
	document.write( String.fromCharCode(60) + "a href=\"mailto: " + m +  "\"" + String.fromCharCode(62) + label + String.fromCharCode(60) + "/a" + String.fromCharCode(62) );
}

function printContent() {
	var printFrame;

	var printDiv = document.getElementById("contentArea");

	if ( printDiv )
	{
		if ( isMSIE() ) {
			printFrame = document.printFrame;
		} else {
			printFrame = window.frames['printFrame'];
		}

		printable = printFrame.document.getElementById("printable");
		printable.innerHTML = printDiv.innerHTML;
		
		printFrame.focus();
		printFrame.print();
	} else {
		alert("Div with ID '" + divId + "' is not known");
	}

    return false;
	
}

function isMSIE()
{
        return navigator.appName.match(/microsoft/ig);
}

function switchLanguage(lang) {
    if( location.href.match(/usedLanguage=\w*/) ) {
        location.href = location.href.replace(/usedLanguage=\w*/,'usedLanguage='+lang);
    } else {
	if( location.href.indexOf("?")==-1 ) {
	    location.href = location.href + '?usedLanguage=' + lang;
        } else {
            location.href = location.href + '&usedLanguage=' + lang;
        }
        
    }
}

function restrictSamples( orderType ) {
	var radioGroup = document.forms[0].orderAmount;
	var isDisabled = true;
	var radioStyle = 'none';

	if ( orderType == 'bestellanfrage' ) {
		isDisabled = false;
		radioStyle = 'table-cell';
	}

	for (i=0; i < radioGroup.length; i++ ) {
		radioGroup[i].disabled = isDisabled;
	}

	document.getElementById('sampleAmountLabel').style.display = radioStyle;
	document.getElementById('sampleAmount').style.display = radioStyle;
	document.getElementById('TransportEtikett').style.display = radioStyle;
}
