jQuery(document).ready(function(){
	var docHeight = jQuery(document).height();
	
	jQuery('ul.modeldrop, ul#modeldrop').each(function(e){
		jQuery(this).parent().parent().not('#hdersection').css({'z-index':'999'});
		
		jQuery(this).hover(
			function(){
				jQuery(this).children().children('dl').show();
				jQuery(this).children().children().children('dl').show();
				jQuery(this).parent('.ViewModel').parent('#proCatinarea').css({'z-index':'3000'});
				
				if(jQuery('#ModelLanding').children('.ViewModel').length != 1){
					jQuery(this).parent('.ViewModel').css({'z-index':'3000'});
				}
				
				
				if(jQuery.browser.msie){
					jQuery(this).parent('.ViewModel').parent('#proCatinarea').css({'zoom':'100%'});
				}
				
				//toggle dropdown to display on top of the select if it is longer than the page
				
				if(jQuery('#proCatinarea').length == 1){
					if(jQuery.browser.msie){
						var docHeightChange = (jQuery(document).height())-30;	
					} else {
						var docHeightChange = (jQuery(document).height())-16;
					}
					
					if(docHeightChange > docHeight){
						var ddHeight = jQuery(this).children('li').children('dl').height();
						jQuery(this).children('li').children('dl').css({
							'top':'-'+(ddHeight+6)+'px',
							'border-top':'1px solid #E2E3EA',
							'border-bottom':'none'
						});
					}
				
				}
			},
			function(){
				jQuery(this).children().children('dl').hide();
				jQuery(this).children().children().children('dl').hide();
				jQuery(this).parent('.ViewModel').parent('#proCatinarea').css({'z-index':'999'});
				
				if(jQuery('#ModelLanding').children('.ViewModel').length != 1){
					jQuery(this).parent('.ViewModel').css({'z-index':'1'});
				}				
				
				if(jQuery.browser.msie){
					jQuery(this).parent('.ViewModel').parent('#proCatinarea').css({'zoom':'0'});
				}
				
				var docHeight = jQuery(document).height();
				
				jQuery(this).children('li').children('dl').css({
					'top':'17px',
					'border-top':'none',
					'border-bottom':'1px solid #E2E3EA'
				});
			}
		)
	});
	
	if(jQuery.browser.msie){
		if((jQuery('#hubPageBanner').length == 1) || (jQuery('#sectionh').length == 1)){
			setTimeout(function(){
				jQuery('#procatimgname').addClass('hubpageProcatImg');
				jQuery('.procatselection ul#modeldrop dl').css({'width':'160px'});
			},500);
		}
		
		if(jQuery('.procatselection .ViewModel').length == 1){
			setTimeout(function(){
				jQuery('.procatselection .ViewModel').css({'float':'right'});
			},1000);
		}
		
		jQuery('.ViewModel').parent().parent().parent().css({'zoom':'100%'});
	}
});