// round bottom corners 
DD_roundies.addRule('.hor-round-button-list ul li a', '7px 7px 0 0', true);
DD_roundies.addRule('.round_border_all', '7px 7px 7px 7px', true);
DD_roundies.addRule('.linktotopbutton', '4px', true);
DD_roundies.addRule('.n-prevlink a', '4px', true);
DD_roundies.addRule('.n-nextlink a', '4px', true);
DD_roundies.addRule('.news-single-backlink a', '4px', true);

// jQuery konfilkt mit mootools

var $j = jQuery.noConflict();

// image preloader
jQuery.preloadImages = function()
{
  for(var i = 0; i<arguments.length; i++)
  {
    jQuery("<img>").attr("src", arguments[i]);
  }
}

// sync height and add classes

$j(document).ready(function(){
  
// function construct
function mtechManipulateDom()  {

	var windowwidth = $j(window).width(); // Fensterbreite
	// var minwidth = $j('div.page_margins').css('width'); // 950 px
	// var minwidthvalue = parseFloat(minwidth, 10); // 950
	var page_margins_width = parseFloat(($j('div.page_margins').css('width')), 10); // 950 px
	
	// Hoehe anpassen wenn Fenster hoeher 550px
	var home_left_shadow_width = (windowwidth - page_margins_width) * 0.5;
	//console.log(home_left_shadow_width);
	
    if(windowwidth > page_margins_width) {
		
		$j('div#home_left_shadow').css({
			'position' : 'absolute', 
			'left' : '0',
			'display' : 'block',
			'width' : home_left_shadow_width + 'px'
		});
	} else {
		$j('div#home_left_shadow').css({
			'display' : 'none', 
			'width' : '0'	
		}); 
	}
}; 	
	
	mtechManipulateDom();

	$j(window).resize(function(){ 
		mtechManipulateDom();
	});  	
  



  
  // IMG Preloader
	$j.preloadImages(
		"fileadmin/template/images/img_home_hover.gif",
		"fileadmin/template/images/img_kontakt_hover.gif",
		"fileadmin/template/images/img_sitemap_hover.gif",
		"fileadmin/template/searchbox/bg_go_hover.gif"
	); 
	
	// TOP menu hover
    $j("#img_home img").hover(
      function () {
        $j(this).attr("src","fileadmin/template/images/img_home_hover.gif");
      }, 
      function () {
        $j(this).attr("src","fileadmin/template/images/img_home.gif");
      }
    );
    $j("#img_kontakt img").hover(
      function () {
        $j(this).attr("src","fileadmin/template/images/img_kontakt_hover.gif");
      }, 
      function () {
        $j(this).attr("src","fileadmin/template/images/img_kontakt.gif");
      }
    );	  
    $j("#img_sitemap img").hover(
      function () {
        $j(this).attr("src","fileadmin/template/images/img_sitemap_hover.gif");
      }, 
      function () {
        $j(this).attr("src","fileadmin/template/images/img_sitemap.gif");
      }	  
    );  
  


  $j('.sameheight').syncHeight();
  $j(window).resize(function(){ 
    $j('.sameheight').syncHeight();
  });

	$j('.yellow_corner').children(':first-child').css('margin-top', '0');
	$j('.yellow_corner').children(':first-child').children(':first-child').css('margin-top', '0');
	$j('.yellow_corner').children(':first-child').children(':first-child').children(':first-child').css('margin-top', '0');
	$j('.yellow_corner').children(':first-child').children(':first-child').children(':first-child').children(':first-child').css('margin-top', '0');
	$j('.yellow_corner').children(':first-child').children(':first-child').children(':first-child').children(':first-child').children(':first-child').css('margin-top', '0');
	$j('.yellow_corner').children(':first-child').children(':first-child').children(':first-child').children(':first-child').children(':first-child').children(':first-child').css('margin-top', '0');

	$j('.yellow_corner span.p2, .yellow_corner span.p3').css({'position' : 'relative', 'top' : '-2px'});

	
    // if lt ie8
	/*
	var compatibilitymodemeta = $j("meta[http-equiv^=X-UA-Compatible]").attr("content");
     
	
	if (($j.browser.msie && $j.browser.version.substr(0,1)<7)  ||  (compatibilitymodemeta = "IE=7" )) {

		$j('div.table').wrapAll('<table></table>');
		$j('div.tr').wrapAll('<tr></tr>');
		$j('div.td').wrapAll('<td></td>')
		}
	else {
		return false;
	}
   */
});





