 
function startUp(){

	setNavigation();

	setLowerNavigation();	

	formFunctions();

	goToPrint();

	 
	 

	if($("#contact").length > 0) {

		showContact();

	}

	if($('.subnavmenu').length>0){

		setBottomNav();

	}

	if($('#findform').length>0){

		//document.forms.findform.reset();

	}

}

//set up header mouseovers on every page

function setNavigation(){	

	//world mpa hover state on/off

	
	//set up global navigation rollovers

    var navRoot;

	var node='';

	var tempClassName='';

	var leftPosition=0;

	var topPosition=0;

    navRoot=$('#alliance_menu');

	$(navRoot).children('li').mouseover(function(){

		tempClassName=this.className;

		if(tempClassName.indexOf('over')==-1){

			$(this).addClass('over');	

			if($(this).children('ul:first').length>0){

				node=$(this).children('ul:first')[0];

				//if its IE > 7 hide select boxes on mouseovers

				 if (navigator.appName == "Microsoft Internet Explorer" && (!window.XMLHttpRequest)){

					leftPosition = 0;

					topPosition = 0;

					hideShowSelectBox(findGlobalPosX(node),findGlobalPosY(node),node.offsetWidth,node.offsetHeight); 

				 }

			}

		}

	}).mouseout(function(){

		$(this).removeClass('over');	

		showAllSelectBoxes();

	});;

	//call function to fire Choose Language mouseover

	showLanguage();

	//set up all button elements to do form submits

	$("button").click(function(){$(this).parent().submit()});

}

//called in setNavigation() to find position of menues and select boxes for IE < 7 show/hide

function findGlobalPosX(obj) {

    var curleft = 0;

    if (obj.offsetParent) {

        while (obj.offsetParent) {

            curleft += obj.offsetLeft;

            obj = obj.offsetParent;

        }

    } else if (obj.x) {

        curleft += obj.x;

    }

    return curleft;

}

//called in setNavigation() to find position of menues and select boxes for IE < 7 show/hide

function findGlobalPosY(obj) {

    var curtop = 0;

    if (obj.offsetParent) {

        while (obj.offsetParent) {

            curtop += obj.offsetTop;

            obj = obj.offsetParent;

        }

        curtop += 1;

    } else if (obj.y) {

        curtop += obj.y;

    }

    return curtop;

}

//function called in setNavigation() to hide/show select boxes

function hideShowSelectBox(menuLeftPos,menuTopPos,menuWidth,menuHeight){	

    for(slectLoop2=0;slectLoop2<document.getElementsByTagName("select").length;slectLoop2++){		

        var tempSelectY = findGlobalPosY(document.getElementsByTagName("select")[slectLoop2]);

        var tempSelectX = findGlobalPosX(document.getElementsByTagName("select")[slectLoop2]);

        var tempSelectWidth = document.getElementsByTagName("select")[slectLoop2].offsetWidth;

        var tempSelectHeight = document.getElementsByTagName("select")[slectLoop2].offsetHeight;

        if((tempSelectY <= menuTopPos + menuHeight && tempSelectY + tempSelectHeight >= menuTopPos ) && ((tempSelectX <= menuLeftPos && menuLeftPos <= (tempSelectWidth + tempSelectX)) || ((menuLeftPos <= tempSelectX) && (menuLeftPos + menuWidth > tempSelectX)))){

            document.getElementsByTagName("select")[slectLoop2].style.visibility = 'hidden';

        }else{

            document.getElementsByTagName("select")[slectLoop2].style.visibility = 'visible';

        }

    }

}

//function called in setNavigation() to show all select boxes when global nav is moused off of

function showAllSelectBoxes(){

	if (navigator.appName == "Microsoft Internet Explorer" && (!window.XMLHttpRequest)){

		for(j=0;j<document.getElementsByTagName("select").length;j++){				

			document.getElementsByTagName("select")[j].style.visibility = 'visible';

		}

	}

}

//function to set up the three-tiered Products and Services menu

function setLowerNavigation(){

	var lowerRoot='';

	var lnode='';

	var targetUL=$('#link_series');

	var ulToLoad;

	var ulNew;

	if($('#link_category>ul>li.selected')){

		ulToLoad=$('#link_category>ul>li.selected').children('ul');

		$(targetUL).empty();

		$(ulToLoad).clone().appendTo($(targetUL));

	}

	lowerRoot = $('#link_category>ul:first');

	for(j=0;j<lowerRoot.children('li').length;j++){

		lnode=lowerRoot.children('li')[j];

		lnode.onmouseover=function(){

			removeStyle();

			$(this).addClass('selected');

			ulNew=$(this).children('ul');

			$(targetUL).empty();

			$(ulNew).clone().appendTo($(targetUL));

		}

	}

}

//this function shows the Languages div in the footer on rollover

function showLanguage(){

	if($("#lang_main").length>0){

		$("#lang_main").mouseover(function(){

			$("#lang_holder").css("display","inline");										   

		}).mouseout(function(){

			$("#lang_holder").css("display","none");	

		});

	}	

}

//function called in setLowerNavigation() to remove all .selected styles from links on new mouseover

function removeStyle(){

	var lowerRoot;

	var lnode;

	if($('#prod_list')){

		lowerRoot = $('#link_category>ul:first');

		for(var j=0;j<lowerRoot.children('li').length;j++){

			lnode=lowerRoot.children('li')[j];

			$(lnode).removeClass('selected');

		}

	}

}

 
