function open_print(url){

// on submit or error pages use default print dialog
if (url.search(/submit\/?$/) != -1 || url.search(/error\/?$/) != -1) {
    window.print();
    return;
}

win_name = "Print";
params = "toolbar=no , menubar=no , location=no , scrollbars=yes , resizable=yes , width=850 , height=600";

// if url already contains parameter, user & to separate them
if ((url.search(/\?/)) != -1) {
    url = url + '&printview=true';
} else {
    url = url + '?printview=true';
}

//alert(url);

printwin = window.open(url,win_name,params);

printwin.focus();


} 

function Show(id,area,useToggle) {
    // layer already visible, user tries to switch it on again
    if (current[area] == id && !useToggle) {
        // this makes the effect that the layer disapears again when
        // the users clicks a second time on the same link
        Hide(id,area);
    } else {
        // layer that the user wants to be displayed is not yet visible
        Hide(current[area],area);
        document.getElementById(id).style.display = "block";
        current[area] = id;
    }
}

function Hide(id,area) {
    if (id) {
        document.getElementById(id).style.display = "none";
        current[area] = '';
    }
}

function SelectAll( form ) {
	for (i=0; i<form.elements.length; i++) {
		form.elements[i].checked = 1;
	}
}

// is invoked with onClick => status (checked-flag) has already changed
function ToggleSameDomain( form_name, element_name , id_on , id_off ) {
	element_on  = element_name + "[" + id_on + "]";
	element_off = element_name + "[" + id_off + "]";

	// typical case: box-on is now checked & box-off is also checked => uncheck box-off	(both of them would be checked otherwise)
	if ( document.forms[form_name].elements[element_on].checked && document.forms[form_name].elements[element_off].checked ) {
		document.forms[form_name].elements[element_off].checked=0;
	}
}

function ShowProductFeature(url, selected_item, id, area) {

    // layer already visible, user tries to switch it on again
    if (current[area] == id) {
        // this makes the effect that the layer disapears again when
        // the users clicks a second time on the same link
        Hide(id,area);
    } else {
        // layer that the user wants to be displayed is not yet visible
        Hide(current[area],area);
        document.getElementById(id).style.display = "block";
        current[area] = id;
    }
    
    http_request = false;

    if (window.XMLHttpRequest) { // Mozilla, Safari,...
        http_request = new XMLHttpRequest();
        if (http_request.overrideMimeType) {
            http_request.overrideMimeType('text/xml');
            // zu dieser Zeile siehe weiter unten
        }
    } else if (window.ActiveXObject) { // IE
        try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
        }
    }

    if (!http_request) {
        //alert('Ende :( Kann keine XMLHTTP-Instanz erzeugen');
        return false;
    }
    
    http_request.open('POST', url, true);
    http_request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
    http_request.send('selected_item='+selected_item);
}

/**
  *	toggles the display style attribute of an element with the given id
  * between values 'none' and 'inline'.
  */
function toggleDisplay(id) {
	var element = document.getElementById(id);
	
	if (element.style.display == "none") {
		element.style.display = "inline";
	}
	else {
		element.style.display = "none";
	}
}

function twdCount(field,cntfield,maxlimit) {
    if (field.value.length > maxlimit) {
        field.value = field.value.substring(0, maxlimit);
    } else {
        cntfield.value = maxlimit - field.value.length;
    }
}
