function setHomePage(t) {
	if (t && t.style) {
		t.style.behavior='url(#default#homepage)';
		t.setHomePage('http://www.slider.com/');
	}
}

function setEngineBox(val) {
	var form = document.searchForm;
	form.so.value = val;
	form.submit();
	return false;
}

function findlink(obj) {
	var href = '';
	var target = '';
	var found = false;

	// we are looking for a link (an A tag)
	if( obj.nodeName == 'A') {
		href = obj.href;
		target = obj.target;

		if(href != '') {
			if(target != '') {
				window.open(href, target);
			} else {
				document.location = href;
			}
		}
		// stop the search
		found = true;

	} else {
		if(obj.hasChildNodes()) {
			var i = 0;
			// search the children for a link
			while ( i < obj.childNodes.length && !found ) {
				found = findlink( obj.childNodes[i]);
				i = i + 1;
			}
		}
	}

	return found;
}


function goSetHeight() {
	if (parent == window) {
		return;
	} else {
		parent.setIframeHeight('sponsored_results');
	}
}

function getDocHeight(doc) {
	var docHt = 0, sh, oh;
	if (doc.height) docHt = doc.height;
	else if (doc.body) {
		if (doc.body.scrollHeight) docHt = sh = doc.body.scrollHeight;
		if (doc.body.offsetHeight) docHt = oh = doc.body.offsetHeight;
		if (sh && oh) docHt = Math.max(sh, oh);
	}
	return docHt;
}

function setIframeHeight(iframeName) {
	var iframeWin = window.frames[iframeName];
	var iframeEl = document.getElementById? document.getElementById(iframeName): document.all? document.all[iframeName]: null;
	if ( iframeEl && iframeWin ) {
		iframeEl.style.height = "auto"; // helps resize (for some) if new doc shorter than previous  
		var docHt = getDocHeight(iframeWin.document);
		// need to add to height to be sure it will all show
		if (docHt) iframeEl.style.height = docHt + 30 + "px";
	}
}

function loadIframe(iframeName, url) {
	if ( window.frames[iframeName] ) {
		window.frames[iframeName].location = url;   
		return false;
	}
	else return true;
}

function searchOnChange(button) {
	button.form.s.value = ''; 
	button.form.o.value = '0';
}

function searchSetOffset(form,offset) {
	form.o.value = offset;
	form.submit();
}

function searchSetSite(form,siteurl) {
	form.s.value = siteurl;
	form.submit();
}

function urlCheck(form,str,reqList) {
	for (i=2; i < urlCheck.arguments.length; i+=2) {
		same = urlCheck.arguments[i].split('|');
		if (same.length == 3) {
			if (form[same[1]].value != form[same[2]].value || form[same[1]].value.length < same[0]) {
				alert(str + urlCheck.arguments[i+1]);
				form[urlCheck.arguments[i]].focus();
				return false;
			}
		} 
		if (form[urlCheck.arguments[i]]) {
			box = form[urlCheck.arguments[i]];
			if ( (box.type == 'text' && box.value == '') 
			||(box.type == 'checkbox' && ( ! box.checked )) 
			||(box.type == 'select-one' && box.options[box.selectedIndex].value == 'nil') 
			||(box.type == 'textarea' && box.value == '')) {
				alert(str + urlCheck.arguments[i+1]);
				form[urlCheck.arguments[i]].focus();
				return false;
			}
		}
	}
	return true;    
}


