window.onload = function(e) {
	globalLoad();
};

window.onresize = function(evt) {
	changeScroll();
	
};

function globalLoad() {
	wWidth = 0;
	changeScroll();
		document.getElementById("searchSeeLinkRun").onclick = function(e) {
		this.className = "searchTab searchActive";
		document.getElementById("searchWeb").className = "searchTab searchInactive";
		document.getElementById("cx").value = "partner-pub-0486022967772511:atah0coxx2n";
		document.getElementById("searchEhow").className = "searchTab searchInactive";
	};
	document.getElementById("searchWeb").onclick = function(e) {
		this.className = "searchTab searchActive";
		document.getElementById("searchSeeLinkRun").className = "searchTab searchInactive";
		document.getElementById("cx").value = "partner-pub-0486022967772511:grpwbsqgst7";
		document.getElementById("searchEhow").className = "searchTab searchInactive";
	};
	document.getElementById("searchEhow").onclick = function(e) {
		this.className = "searchTab searchActive";
		document.getElementById("searchSeeLinkRun").className = "searchTab searchInactive";
		document.getElementById("searchWeb").className = "searchTab searchInactive";
		document.getElementById("cx").value = "partner-pub-0486022967772511:2fnwcw5o3o2";
	};
}

function changeScroll() {
	var winW = 640;
	if (parseInt(navigator.appVersion)>3) {
		 if (navigator.appName=="Netscape") {
 			 winW = window.innerWidth;
 		}
 		if (navigator.appName.indexOf("Microsoft")!=-1) {
 			 winW= document.body.offsetWidth;
 		}
	}
	if(wWidth == 0) {wWidth = winW;}
	if(winW < 1450 && winW>1060) {
		window.scrollTo(190,0);
	} else if(winW<=1060 && winW>820) {
		window.scrollTo(190 + 1060 - winW,0);
	} else if(winW<=820) {
		window.scrollTo(405,0);
	}
	wWidth = winW;
}

function customScroll(w) {
	window.pageXOffset?window.pageXOffset = 1250 - w:
	document.documentElement?document.documentElement.scrollLeft = 1250 -w:
	document.body?document.body.scrollLeft = 1250:alert("nope");
}

function f_scrollLeft() {
	return f_filterResults (
		window.pageXOffset ? window.pageXOffset : 0,
		document.documentElement ? document.documentElement.scrollLeft : 0,
		document.body ? document.body.scrollLeft : 0
	);
}
function f_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}
function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}


