
frm = document.forms["search"];

shape   = new Array();

function GoShape(id,name) {
	var doc = document.getElementById((name + id));
	if (shape.length > 0) {
		var flag = 1;
		for (var i=0; i<shape.length; i++) {
			if (shape[i] == id) {
				shape[i]  = '';
				flag = 0;
			}
		}
		if (flag) {
			shape[shape.length] = id;
		}
	} else {
		shape[0] = id;
	}
	doc.className = (doc.className == '') ? 'slc' : '';
	var tmp = new Array();
	var c   = 0;
	for (var i=0; i<shape.length; i++) {
		if (shape[i] != '') {
			tmp[c] = shape[i];
			c++;
		}
	}
	shape = tmp;
	frm.elements[name].value = shape.join("|");
}

function GoSearch() {
	var paramwin = 'resizable=1,scrollbars=1,status=1,location=0,toolbar=0,menubar=0';
	frm.elements["price"].value = frm.elements["price_str"].value + "|" + frm.elements["price_end"].value;
	remote=window.open('', 'search', paramwin);
	if (remote != null) {
		if (remote.opener == null) remote.opener = self;
	}
	frm.submit();
}

function GoPrevSearch() {
	alert("frm");
	alert("frm="+frm);
	frm.elements["sdir"].value = "b";
	GoSearch();
}


total = 1;
function GoTotal(id,name) {
	document.getElementById((name + total)).className = '';
	document.getElementById((name + id)).className = 'slc';
	total = id;
	frm.elements[name].value = total;
}

function MathingPair() {
	if (frm.elements["mat"].value > 0) {			// if already checked as matching pair
		GoTotal('1','prio');
		frm.elements["mat"].value  = 0;
		document.getElementById('matching').className = "";
		document.getElementById('matchingbotton').className = "keepOf";
	} else {										// if still not matching pair
		GoTotal('2','prio');
		frm.elements["mat"].value  = 1;
		document.getElementById('matching').className = "collapsed";
		document.getElementById('matchingbotton').className = "keepOn";
	}
}

