function selectRedirect(form) {
	var jumper;
	if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1) {
		jumper = document.forms["jumpform"];
	}
	else {
		jumper = document.jumpform;
	}
	var auction_id = jumper.auction_id[jumper.auction_id.selectedIndex].value;
	if (auction_id != '-1') {
		jumper.submit();
	} else {
		alert('Please choose an auction first');
	}

}

function selectRedirect2(form) {
	var jumper = form;
	jumper.submit();
}

function popup(width,height,url) {
	var scrolls = "no";
	if (screen.width < width || screen.height < height) {
		width = screen.width * 0.90;
		height = screen.height * 0.90;
		scrolls = "yes";
	}
	window.open(url,"pictures", "width=" + width + ",height=" + height + ",toolbar=no,menubar=0,resizable=yes,status=0,location=no,directories=0,scrollbars=yes,header=no");
}

function closewindow() {
	window.close();
}

function focuswindow() {
	window.focus()
}


function checker(checker, form, prefix) {
	var formC = document.getElementById(form);
	if (!checker) {
		alert("checker checkbox does not exist");
		return;
	}
	if (checker.type != 'checkbox') {
		alert("checker checkbox id is not a checkbox");
		return;
	}
	if (!formC) {
		alert("form does not exist");
		return;
	}
	
	//alert('checking');
	var formElems = formC.getElementsByTagName('input');
	if (formElems) {
		for (var i = 0; i < formElems.length; i++) {
			var e = formElems[i];
			//alert('input: ' + e.name);
			if (canCheckCheckBox(e, prefix)) {
				e.checked = checker.checked;
			}
		}
	}
}

function canCheckCheckBox(e, prefix) {
	
	if (e != checker && e.type == 'checkbox' && e.disabled != true) {
		if (prefix) {
	  		if ( startsWith(e.name, prefix) ) {
	  			return true;
	  		}
	  	} else {
	  		// no prefix checking
	  		return true;
	  	}
	}

	return false;
}

function startsWith(value, prefix) {
	if (value && prefix) {
	    if (value.length >= prefix.length) {
			var vPrefix = value.substring(0,prefix.length).toLowerCase();
			//alert(vPrefix + "==" + prefix + ":" + (vPrefix == prefix));
			return (vPrefix == prefix);
		}
	}
	return false;
}




