 jQuery.noConflict();
//(function($) { /* some code that uses $ */ })(jQuery)

/* called immediately after loading*/
var isIE6 = jQuery.browser.msie && jQuery.browser.version == "6.0"
var isIE7 = jQuery.browser.msie && jQuery.browser.version == "7.0"
var isIE8 = jQuery.browser.msie && jQuery.browser.version == "8.0"

jQuery(window).bind('load', function() {adjustTopMenuPopupItemsPositions(); positionTopMenuArrows();positionTopMenuArrowsForHomepage();});
jQuery(window).bind('resize', function() {adjustTopMenuPopupItemsPositions();});



/* functions */
function adjustTopMenuPopupItemsPositions(){		
	jQuery('body div').each(function() {	
 		s = jQuery(this);					
		if ((s.attr("id")+"").indexOf("Menu") > -1) {						
			if (s.parents().size() == 4 && isIE6){				
				s.css({marginLeft: (jQuery(s.parents()[3]).width()/*html element*/ -jQuery('#header').width()/*header elment - positioned absolute*/ )/2 +"px"});				
			}else if (s.parents().size() == 2){			
				s.css({marginLeft: (jQuery(s.parents()[1]).width()/*html element*/ -jQuery('#header').width()/*header elment - positioned absolute*/ )/2 +"px"});							
			}
			
		}
	});  

}

function positionTopMenuArrows(){
	jQuery('ul#nav li div a.with_submenu ').each(function() {								
		s = jQuery(this);			
		x = s.width()+5;		
		//s.style.backgroundPosition = x+"px 34px";		
		s.css({backgroundPosition : x+"px 34px"});
		//alert(s.style.backgroundImage);
	});  

}

function positionTopMenuArrowsForHomepage(){
	jQuery('ul#nav_2 li div a.with_submenu ').each(function() {						
		s = jQuery(this);			
		x = s.width()+5;
		//s.style.backgroundPosition = x+"px 34px";		
		s.css({backgroundPosition : x+"px 34px"});
		
		//alert(s.style.backgroundImage);
	});  

}


// Different stuff on load
jQuery(document).ready(function(){

  // set odd/even class for zebra tables
  jQuery('table.zebra tr:odd').addClass('odd');
  
  // remove empty sidebar
  if (jQuery('#sidebar').children().length == 0) {
    jQuery('#sidebar').remove();
    jQuery('#content').addClass('full_content');
  }  
  
  
});

