/**
 * copyright 2008 blinkx inc.
 * please keep this header intact to use the blinkx Red Label search
 */
function blinkxHostedSearch_rewriteUrl(formElem) {
	var val = '';
	var blinkxUserId = '';
	var children = formElem.childNodes;
	for (i=0; i<children.length; i++) {
		if (children[i].nodeType == 1) {
			if (children[i].name == 'blinkxUserId') {
				blinkxUserId = children[i].value;
			}
			if (children[i].getAttribute('name') == 'search') {
				val = children[i].value;
			}
		}
	}
	if (val.length > 0) {
		window.location='http://www.blinkx.com/redlabel/'+blinkxUserId+'/videos/'+val;
	}
	else {
		window.location='http://www.blinkx.com';
	}
}
