
function _$(ele) { if ($(ele)) return $(ele).value; }
function _$$(ele,val) {	if ($(ele)) $(ele).value = val;}
function _$$$(ele) { if ($(ele)) return ele.options[ele.selectedIndex].text; }
function hideB(ele) {
	if ($(ele)) { $(ele).setStyles({'display':'none'}); }
	else if (is_array(ele)) { ele.each(function(thisEle) { if ($(thisEle)) { $(thisEle).setStyle('display','none'); }}); }
}

function showB(ele) {
	if ($(ele)) { $(ele).setStyles({'display':'block'}); }
	else if (is_array(ele)) { ele.each(function(thisEle) { if ($(thisEle)) { $(thisEle).setStyle('display','block'); }}); }
}

window.onload = loadWin;
window.onresize = reFF;

function reFF() {
	if (f_clientWidth() < 1100) {
		$('all').style.left = '0';
		$('all').style.marginLeft = '0';
		//$(document.body).style.backgroudColor="#fff";
	} else {
		$('all').style.left = '50%';
		$('all').style.marginLeft = '-545px';
	}
	showB(document.body);
}
	
function loadWin() { 
	reFF();
	if ($('leftMain')) $('leftMain').innerHTML += '<div id="copy">&copy; 2010 Varian, Inc. All rights reserved.</div>';

	if ($('hdrProductsS')) {
		showB('prodMenu');
	} 

	if ($('hdrProductsL')) {
		$('hdrProductsL').addEvent("mouseover",function(){ showB('prodMenu');$('hdrProductsL').set('id','hdrProductsS'); });
		$('hdrProductsL').addEvent("mouseout",function(){ hideB('prodMenu');$('hdrProductsS').set('id','hdrProductsL'); });
	}

	if ($('hdrAdvantagesS')) {
		showB('advMenu');
	} 
	if ($('hdrAdvantagesL')) {
		$('hdrAdvantagesL').addEvent("mouseover",function(){ showB('advMenu');$('hdrAdvantagesL').set('id','hdrAdvantagesS'); });
		$('hdrAdvantagesL').addEvent("mouseout",function(){ hideB('advMenu');$('hdrAdvantagesS').set('id','hdrAdvantagesL'); });
		$('advMenu').addEvent("mouseover",function(){ showB('advMenu');$('hdrAdvantagesL').set('id','hdrAdvantagesS'); });
		$('advMenu').addEvent("mouseout",function(){ hideB('advMenu');$('hdrAdvantagesS').set('id','hdrAdvantagesL'); });
	}

	if ($('hdrApplicationsS')) { 
		showB('appMenu');
	} 

	if ($('hdrApplicationsL')) {
		$('hdrApplicationsL').addEvent("mouseover",function(){ showB('appMenu');$('hdrApplicationsL').set('id','hdrApplicationsS'); });
		$('hdrApplicationsL').addEvent("mouseout",function(){ hideB('appMenu');$('hdrApplicationsS').set('id','hdrApplicationsL'); });
		$('appMenu').addEvent("mouseover",function(){ showB('appMenu');$('hdrApplicationsL').set('id','hdrApplicationsS');  });
		$('appMenu').addEvent("mouseout",function(){ hideB('appMenu');$('hdrApplicationsS').set('id','hdrApplicationsL');  });
	}
}

function is_array(input){    
 	return typeof(input)=='object'&&(input instanceof Array);  
}

function f_clientWidth() {
	return f_filterResults (
		window.innerWidth ? window.innerWidth : 0,
		document.documentElement ? document.documentElement.clientWidth : 0,
		document.body ? document.body.clientWidth : 0
	);
}
function f_clientHeight() {
	return f_filterResults (
		window.innerHeight ? window.innerHeight : 0,
		document.documentElement ? document.documentElement.clientHeight : 0,
		document.body ? document.body.clientHeight : 0
	);
}
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;
}
