 // HTML 5 Elemente für ältere Browser erstellen
 document.createElement('header');
 document.createElement('hgroup');
 document.createElement('nav');
 document.createElement('menu');
 document.createElement('section');
 document.createElement('article');
 document.createElement('aside');
 document.createElement('footer');

    Array.prototype.max=function()
    {
      return(this.sort(function(a,b){ return b-a;})[0]);
    }



// wenn document vollständig geladen
$(document).ready(function() {



	/*	*	*	*	* FORM			+	+	+	+	*/

	$('.csc-mailform-field').append('<div style="clear:both"></div>');

	$('label').each(function(){

		$(this).html('<span>'+ $(this).html()+'</span>');
	});

	$('.csc-mailform-submit').parent().replaceWith('<div class="csc-mailform-field anmelden"><a href="javascript:document.getElementById(\'mailform\').submit();"></a><input style="display:none" type="submit" /></div>');

	$('#mailform textarea').text($('#mailform textarea').prev('label').text()).prev('label').hide();



	/*	*	*	*	* Nivo Slider	+	+	+	+	*/



    $('.nivoslide').nivoSlider({
        effect:'random', //Specify sets like: 'fold,fade,sliceDown'
        slices:15,
        animSpeed:500, //Slide transition speed
        pauseTime:20000,
        startSlide:0, //Set starting Slide (0 index)
        directionNav:false, //Next & Prev
        directionNavHide:false, //Only show on hover
        controlNav:false, //1,2,3...
        controlNavThumbs:false, //Use thumbnails for Control Nav
        controlNavThumbsFromRel:false, //Use image rel for thumbs
        controlNavThumbsSearch: '.jpg', //Replace this with...
        controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
        keyboardNav:false, //Use left & right arrows
        pauseOnHover:false, //Stop animation while hovering
        manualAdvance:false, //Force manual transitions
        captionOpacity:0.8, //Universal caption opacity
        beforeChange: function(){},
        afterChange: function(){},
        slideshowEnd: function(){}, //Triggers after all slides have been shown
        lastSlide: function(){}, //Triggers when last slide is shown
        afterLoad: function(){} //Triggers when slider has loaded

    });









/*	*	*	*	* SUCHFELD	+	+	+	+	*/

$('#suchfeld').focusin(function(){
	$(this).val('');
});




/*  +  +  +  +  HEADER Scroller  +  +  +  +  */



//$('#headerbg').attr('src', $('.scrollable .items .item:eq(0) h3 a').attr('rel'));

$('.scrollable .items .item h3 a').each(function(){

	$('#headerbg').append('<img style="z-index:0" src="'+ $(this).attr('rel') +'" />')
})
//$('#headerbg').append('<img src="" />');



// ?berpr?fung ob es sich um eine Newsseite handelt.
if($('.news-single-item h1').length > 0){



	// Inhalt der H1 speichern
	var txt_h1Text = $('.news-single-item h1:eq(0)').text();

	// Alle Items duchlaufen
	$('.scrollable .item').each(function(index, value){

		if( $('h3 a' ,this).text() == txt_h1Text){

			confNewsJumper = index;

			// variable um ersten durchlauf zu ermitteln
			var boolStart = true;

		}

	});



}

if(typeof(boolStart) != 'boolean'){

	boolStart = false;
}


// scroller erstellen
var horizontal = $(".scrollable").scrollable({
				onSeek:function(){
					//alert(this.getIndex());

					var gIndex = this.getIndex();

					steuerer.now = gIndex;

					// beim ersten Durchlauf soll nicht gesteuert werden.
					if(boolStart != true){
						steuerer.control();
					}else{
						boolStart = false;
					}




					// copyright test im header anzeigen
					gIndex = gIndex+1;
					var copyright = $('.scrollable .items .item:eq('+ gIndex +')  span.copyright').html();
					$('header div.copyright span').html(copyright);

				},/*
				onBeforeSeek:function(){
					//alert(this.getIndex());

					var img = $('.scrollable .items .item').eq(this.getIndex()).attr('img')
					alert(this.getIndex());

					$('#headerbg').attr('src', img)
				},*/
				speed:1000,
				easing: 'swing',
				circular: true})
				.navigator("#scrollableMenue").autoscroll({interval: 7000});



// events deaktivieren, damit slider nicht wieder losl?uft
$('#scrollableMenue li').unbind();
$(".scrollable").unbind();
$("#scrollableMenue").unbind();
$("#scrollableMenuTools .prev, #scrollableMenuTools .next").unbind('mouseenter').unbind('mouseout').unbind('mouseleave').unbind('mouseover');

// pause-button aktivieren
window.api = horizontal.data("scrollable");
horizontal.eq(0).data("scrollable").focus();


					var copyright = $('.scrollable .items .item:eq(0)  span.copyright').html();
					$('header div.copyright span').html(copyright);



if(typeof(confNewsJumper) == 'number'){
horizontal.eq(0).data("scrollable").seekTo(confNewsJumper);

horizontal.data("scrollable").stop();
}else{

	confNewsJumper= 0;
}



 // BG SCROLLER

//Objekt f?r die Steuerung
steuerer = new Object;

$('#headerbg').nivoSlider({
    effect:'fade', //Specify sets like: 'fold,fade,sliceDown'
    slices:15,
    animSpeed:500, //Slide transition speed
    pauseTime:999999,
    startSlide:confNewsJumper, //Set starting Slide (0 index)
    directionNav:false, //Next & Prev
    directionNavHide:false, //Only show on hover
    controlNav:false, //1,2,3...
    controlNavThumbs:false, //Use thumbnails for Control Nav
    controlNavThumbsFromRel:false, //Use image rel for thumbs
    controlNavThumbsSearch: '.jpg', //Replace this with...
    controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
    keyboardNav:false, //Use left & right arrows
    pauseOnHover:false, //Stop animation while hovering
    manualAdvance:false, //Force manual transitions
    captionOpacity:0.8, //Universal caption opacity
    beforeChange: function(){},
    afterChange: function(){},
    slideshowEnd: function(){}, //Triggers after all slides have been shown
    lastSlide: function(){}, //Triggers when last slide is shown
    afterLoad: function(){}, //Triggers when slider has loaded
	steuerung:steuerer
})



/*  +  +  +  +  Countdown  +  +  +  +  */

countdownDate = new Date(2011, 7-1, 8, 15);

var now = new Date();

if (now.getDay() == 5 && now.getHours() >= 18 && now.getMinutes() > 0) {
	countdownDate = new Date(2011, 7-1, 8, 19);
} else if (now.getDay() == 5 && now.getHours() >= 22 && now.getMinutes() > 0) {
	countdownDate = new Date(2011, 7-1, 9, 15);
} else if (now.getDay() == 6 && now.getHours() >= 18 && now.getMinutes() > 0) {
	countdownDate = new Date(2011, 7-1, 9, 19);
} else if (now.getDay() == 6 && now.getHours() >= 22 && now.getMinutes() > 0) {
	countdownDate = new Date(2011, 7-1, 10, 15);
} else if (now.getDay() == 0 && now.getHours() >= 18 && now.getMinutes() > 0) {
	countdownDate = new Date(2011, 7-1, 10, 19);
} else if (now.getDay() == 0 && now.getHours() >= 22 && now.getMinutes() > 0) {
	countdownDate = new Date(2011, 7-1, 11, 15);
} else if (now.getDay() == 1 && now.getHours() >= 18 && now.getMinutes() > 0) {
	countdownDate = new Date(2011, 7-1, 11, 19);
} else if (now.getDay() == 1 && now.getHours() >= 22 && now.getMinutes() > 0) {
	countdownDate = new Date(2011, 7-1, 12, 15);
} else if (now.getDay() == 2 && now.getHours() >= 18 && now.getMinutes() > 0) {
	countdownDate = new Date(2011, 7-1, 12, 19);
} else if (now.getDay() == 2 && now.getHours() >= 22 && now.getMinutes() > 0) {
	countdownDate = new Date(2011, 7-1, 13, 15);
} else if (now.getDay() == 3 && now.getHours() >= 18 && now.getMinutes() > 0) {
	countdownDate = new Date(2011, 7-1, 13, 19);
} else if (now.getDay() == 3 && now.getHours() >= 22 && now.getMinutes() > 0) {
	countdownDate = new Date(2011, 7-1, 15, 15);
} else if (now.getDay() == 5 && now.getHours() >= 18 && now.getMinutes() > 0) {
	countdownDate = new Date(2011, 7-1, 15, 19);
} else if (now.getDay() == 5 && now.getHours() >= 22 && now.getMinutes() > 0) {
	countdownDate = new Date(2011, 7-1, 16, 15);
} else if (now.getDay() == 6 && now.getHours() > 18 && now.getMinutes() > 0) {
	countdownDate = new Date(2011, 7-1, 16, 19);
}




$('.content.nextgames').countdown({until: countdownDate,format: 'MDHMS'});

   // Alle Menüpunkte auf Variable legen
 navigationnodes = document.getElementById('hauptmenue').childNodes;


 // Alle Menüpunkte durchlaufen und textnodes löschen -> wegen FF - inline-block bug
   for(var i = 0; i < navigationnodes.length;i++){
     // überprüfung ob es sich um einen textnode handelt
    if(navigationnodes[i].nodeType == 3){
       // textnode löschen
       document.getElementById('hauptmenue').removeChild(navigationnodes[i]);
     }
   }



 // Bilder vor und nach A-Tag im Menü erstellen

   var noactive = $(navigationnodes).hasClass('active');



 for(var i = 0; i < navigationnodes.length;i++){
   // Bilder vor und nach dem Link einfügen
   if($(navigationnodes[i]).hasClass('active')){

         navigationnodes[i].innerHTML = '<img width="13" height="26" border="0" style="display:block; margin:0;padding:0;border:none; float:left"  src="fileadmin/templates/images/design/nav/active_left.png" />' + navigationnodes[i].innerHTML +'<img width="16" height="26" border="0"  style="display:block; margin:0;padding:0;border:none; float:left"  src="fileadmin/templates/images/design/nav/active_right.png" /> ';
         $(navigationnodes[i]).children('a.hauptlink').css('backgroundImage','url("fileadmin/templates/images/design/nav/active_mitte.png")');


   }else{
	   if(i == 0 &&noactive == false){
		   navigationnodes[i].className += ' active';

		   navigationnodes[i].innerHTML = '<img width="13" height="26" border="0" style="display:block; margin:0;padding:0;border:none; float:left"  src="fileadmin/templates/images/design/nav/active_left.png" />' + navigationnodes[i].innerHTML +'<img width="16" height="26" border="0"  style="display:block; margin:0;padding:0;border:none; float:left"  src="fileadmin/templates/images/design/nav/active_right.png" /> ';
	         $(navigationnodes[i]).children('a.hauptlink').css('backgroundImage','url("fileadmin/templates/images/design/nav/active_mitte.png")');
	   }else{
	   navigationnodes[i].innerHTML = '<img width="13" height="26" border="0" style="display:block; margin:0;padding:0;border:none; float:left"  src="fileadmin/templates/images/design/nav/link_left.png" />' + navigationnodes[i].innerHTML +'<img width="16" height="26" border="0"  style="display:block; margin:0;padding:0;border:none; float:left"  src="fileadmin/templates/images/design/nav/link_right.png" /> ';
	   }

   }


 }




 var breitealt = 0;

// Positionierung der Menüpunkte verändern -> damit diese Überlappen + positionierung der Submenüs
  rightposI = 0;
   for(var i = navigationnodes.length; i > 0;i--){
    // verschiebung berechnen
    rightpos =-32 +(rightposI*10);

  //  rightpos =-10 +(rightposI*14);
    // verschieben
    navigationnodes[i-1].style.left = rightpos+'px';

    position = (breitealt)*-1 + rightpos;
    //alert(position);


    if(i == navigationnodes.length){

        if(navigationnodes[i-1].getElementsByTagName('div')[0])navigationnodes[i-1].getElementsByTagName('div')[0].style.right = '-32px';

    }else{
          if(navigationnodes[i-1].getElementsByTagName('div')[0])navigationnodes[i-1].getElementsByTagName('div')[0].style.right = position+'px';

    }
    breitealt += navigationnodes[i-1].getElementsByTagName('a')[0].clientWidth + 29;

    rightposI ++;


   }

 // clear:both ins submenü einfügen

 $('div.submenue div.inner').append($(' <div style="clear:both"></div>'));



// Mouseover für Hauptmenü
$("#hauptmenue li.hauptlink").bind("mouseenter",function(){

  $(this).children('img:first').attr("src", 'fileadmin/templates/images/design/nav/hover_left.png');
  $(this).children('img:last').attr("src", 'fileadmin/templates/images/design/nav/hover_right.png');
  $(this).children('a:first').css('background-image', "url('fileadmin/templates/images/design/nav/hover_mitte.png')");
  //$('#datumssplash').hide();
  $(this).children('.submenue').fadeIn();

    }).bind("mouseleave",function(){

      // überprüfen ob menüpunkt active ist:

      if($(this).hasClass('active')){
        // wen link die klasse active enthält
        $(this).children('img:first').attr("src", 'fileadmin/templates/images/design/nav/active_left.png');
        $(this).children('img:last').attr("src", 'fileadmin/templates/images/design/nav/active_right.png');
        $(this).children('a:first').css('background-image', "url('fileadmin/templates/images/design/nav/active_mitte.png')");
      }else{
        // wenn es sich um einen normalen link handelt
        $(this).children('img:first').attr("src", 'fileadmin/templates/images/design/nav/link_left.png');
        $(this).children('img:last').attr("src", 'fileadmin/templates/images/design/nav/link_right.png');
        $(this).children('a:first').css('background-image', "url('fileadmin/templates/images/design/nav/link_mitte.png')");
      }
      // Submenü ausblenden
      $(this).children('.submenue').fadeOut();

      // splash anzeigen
      //$('#datumssplash').show();


    });

// titel in das Submenü einfügen
$("#hauptmenue li.hauptlink div.submenue").each(function(){
  $(this).append('<h2>'+ $(this).parent().children('a').html() +'</h2>');
});


// Letzter eintrag im Submen? ohne border-bottom

$('header nav #hauptmenue li div ul.submenue li:last-child').css('border-bottom','none');


// tabs

  // Tabs zuweisen
  $("ul.css-tabs").tabs("div.panes > div");

  // Positionierung der Beschriftung : vertical-align:center
  $('ul.css-tabs li a span').each(function(){
    var hoehespan = $(this).height();
    var position =  (32 - hoehespan)/2;
    $(this).css('top', position + 'px');
  });

  $('ul.css-tabs li a').corner('cc:#fff top 9px');

});






/*
* ROSTER
 */

function showPlayer($nr, $name, $age, $height, $weight, $team, $success, $action_url,EL,$position, $checkname) {

        if($weight > 0){
            $('.playerweight').show();
        }else{
            $('.playerweight').hide();
        }


        if($height > 0){
            $('.playerheight').show();
        }else{
            $('.playerheight').hide();
        }

        if($success == ''){
            $('.playersuccess').hide();
        }else{
            $('.playersuccess').show();
        }

        $('#playername').html($name);
		
		if (parseInt($nr) > 0) {
			$('#playernr').html("#" + $nr);
		} else {
			$('#playernr').html($nr);
		}
		
        $('#playerpos').html($position);

        $('#playerage').html($age);
        $('#playerheight').html( $height + ' cm');
        $('#playerweight').html($weight + ' kg');
        $('#playerteam').html($team);
        $('#playersuccess').html($success);

        var description = EL.getElementsByTagName('td')[3].innerHTML;

        if(description.length < 1){
            $('#playerdesc').hide();
        }
        else{
            $('#playerdesc').show();
            $('#playerdescription').html(EL.getElementsByTagName('td')[3].innerHTML);
        }

        $('#playerportrait').attr('src', $('td.description', $(EL)).attr('rel'));



        if($action_url.length >0){
            $('#playeraction').show();
            $('#playeraction').attr('src',$action_url);
        }
        else{
            $('#playeraction').hide();
        }

		playerStats($checkname);
        $('#playerdetail').slideDown();
		$('html, body').animate({scrollTop:0}, 'fast');


}
function playerStats($checkname,season,tag,attr)
{
    $.ajax({
        type: "GET",
	url: "/fileadmin/content/statistik/CONF.XML",
	dataType: "xml",
	success: function(xml) {
	 var player = $(xml).find('player[checkname="' + $checkname + '"]');

                    if(player.length == 1){
						$tmp = '';
						if (parseInt($(player).find('punt').attr('no')) >= 0) {
							var keys = new Array("No.", "Yards", "Long", "Blocked", "Touchback", "Fair catch", "50 +", "Inside 20");
							var values = new Array(
								$(player).find('punt').attr('no')		,
								$(player).find('punt').attr('yds')		,
								$(player).find('punt').attr('long')		,
								$(player).find('punt').attr('blkd')		,
								$(player).find('punt').attr('tb')		,
								$(player).find('punt').attr('fc')		,
								$(player).find('punt').attr('plus50')		,
								$(player).find('punt').attr('inside20')
							);

							$tmp += renderTable('Punting', keys, values);
						}

						if (parseInt($(player).find('ko').attr('no')) >= 0) {
							var keys = new Array("No.", "Yards", "Out of bounds", "Touchback");
							var values = new Array(
								$(player).find('ko').attr('no')		,
								$(player).find('ko').attr('yds')		,
								$(player).find('ko').attr('ob')		,
								$(player).find('ko').attr('tb')
							);

							$tmp += renderTable('Kickoff', keys, values);
						}

						if (parseInt($(player).find('fg').attr('att')) >= 0) {
							var keys = new Array("Att.", "Made", "Long", "Blocked");
							var values = new Array(
								$(player).find('fg').attr('att')		,
								$(player).find('fg').attr('made')		,
								$(player).find('fg').attr('long')		,
								$(player).find('fg').attr('blkd')
							);

							$tmp += renderTable('Field Goals', keys, values);
						}

						if (parseInt($(player).find('pat').attr('kickatt')) >= 0) {
							var keys = new Array("Att.", "Made");
							var values = new Array(
								$(player).find('pat').attr('kickatt')		,
								$(player).find('pat').attr('kickmade')
							);

							$tmp += renderTable('PAT', keys, values);
						}

						if (parseInt($(player).find('rush').attr('att')) >= 0) {
							var keys = new Array("Att.", "Gain", "Lost", "Yards", "TD", "Long");
							var values = new Array(
								$(player).find('rush').attr('att')		,
								$(player).find('rush').attr('gain')		,
								$(player).find('rush').attr('loss')		,
								$(player).find('rush').attr('yds')		,
								$(player).find('rush').attr('td')		,
								$(player).find('rush').attr('long')
							);

							$tmp += renderTable('Rushing', keys, values);
						}

						if (parseInt($(player).find('rcv').attr('no')) >= 0) {
							var keys = new Array("No", "Yds", "TD", "Long");
							var values = new Array(
								$(player).find('rcv').attr('no')		,
								$(player).find('rcv').attr('yds')		,
								$(player).find('rcv').attr('td')		,
								$(player).find('rcv').attr('long')
							);

							$tmp += renderTable('Rushing', keys, values);
						}

						if (parseInt($(player).find('pass').attr('att')) >= 0) {
							var keys = new Array("Att.", "Comp", "Yards", "TD", "Int", "Long", "Sacked", "Yards sacked");
							var values = new Array(
								$(player).find('pass').attr('att')		,
								$(player).find('pass').attr('comp')		,
								$(player).find('pass').attr('yds')		,
								$(player).find('pass').attr('td')		,
								$(player).find('pass').attr('int')		,
								$(player).find('pass').attr('long'),
								$(player).find('pass').attr('sacks'),
								$(player).find('pass').attr('sackyds')
							);

							$tmp += renderTable('Passing', keys, values);
						}

						if ($(player).find('defense').length == 1) {
							var keys = new Array("Tack UA", "Tack Ass.", "TFL UA", "TFL Ass.", "TFL Yds.", "Break UP", "QB Hurries", "Blocked", "Sack UA", "Sack Ass.", "Sack Yds");
							var values = new Array(
								$(player).find('defense').attr('tackua'),
								$(player).find('defense').attr('tacka'),
								$(player).find('defense').attr('tflua'),
								$(player).find('defense').attr('tfla'),
								$(player).find('defense').attr('tflyds'),
								$(player).find('defense').attr('brup'),
								$(player).find('defense').attr('qbh'),
								$(player).find('defense').attr('blkd'),
								$(player).find('defense').attr('sackua'),
								$(player).find('defense').attr('sacka'),
								$(player).find('defense').attr('sackyds')
							);

							$tmp += renderTable('Defense', keys, values);
						}


						$tmp += renderReturns('Interception returns', 'ir', $(player));
						$tmp += renderReturns('Fumble returns', 'fr', $(player));
						$tmp += renderReturns('Punt returns', 'pr', $(player));
						$tmp += renderReturns('Kickoff returns', 'kr', $(player));

						if (parseInt($(player).find('scoring').attr('td')) >= 0
							|| parseInt($(player).find('scoring').attr('fg')) >= 0
							|| parseInt($(player).find('scoring').attr('patkick')) >= 0
							|| parseInt($(player).find('scoring').attr('patrush')) >= 0
							|| parseInt($(player).find('scoring').attr('saf')) >= 0
						) {
							var keys = new Array("TD", "FG", "Conversion", "PAT", "Safety", "Total points");
							var values = new Array();
							values[0] = parseInt($(player).find('scoring').attr('td')) >= 0 ? parseInt($(player).find('scoring').attr('td')) : 0;
							values[1] = parseInt($(player).find('scoring').attr('fg')) >= 0 ? parseInt($(player).find('scoring').attr('fg')) : 0;
							values[2] = parseInt($(player).find('scoring').attr('patrush')) >= 0 ? parseInt($(player).find('scoring').attr('patrush')) : 0;
							values[3] = parseInt($(player).find('scoring').attr('patkick')) >= 0 ? parseInt($(player).find('scoring').attr('patkick')) : 0;
							values[4] = parseInt($(player).find('scoring').attr('saf')) >= 0 ? parseInt($(player).find('scoring').attr('saf')) : 0;
							values[5] = values[0] * 6 + values[1] * 3 + values[2] * 2 + values[3] + values[4] * 2;
							$tmp += renderTable('Scoring', keys, values);
						}
						$('#playerStats').html($tmp);
                    }
					else {
							$('#playerStats').html('');
					}
					

	}
});
}

function renderReturns (title, type, $player) {
	$tmp = '';

	if ($player.find(type).length == 1) {
		var keys = new Array("No.", "Yds", "TD", "Long");
		var values = new Array(
			$player.find(type).attr('no'),
			$player.find(type).attr('yds'),
			$player.find(type).attr('td'),
			$player.find(type).attr('long')
		);

		$tmp += renderTable(title, keys, values);
	}

	return $tmp;
}

function renderTable($title,$keys, $values) {
	$tmp
	$tmp = '<table><tbody>';

	$tmp += '<tr><th class="title">' + $title + '</th>';
	for (i = 0; i < $keys.length; i++) {
		$tmp += '<th>' + $keys[i] + '</th>';
	}
	$tmp += '<tr>';
	$tmp += '<tr><td>&nbsp;</td>';
	for (i = 0; i < $values.length; i++) {
		if ($values[i] == null || $values[i] == '') {
			$tmp += '<td>0</td>';
		} else {
			$tmp += '<td>' + $values[i] + '</td>';
		}
	}
	$tmp += '<tr>';
	$tmp += '</tbody></table>';

	return $tmp;
}
$(document).ready(function(){
	var rosterheader = $('.rosterheader');
    if(rosterheader.length>0){
		$('.rosterheader').css('background-image', 'url('+$('.rosterheader').attr('rel')+')');
	} else {
		
	}
	
    var rosterboxen = $('.rosterbox');
    if(rosterboxen.length>0){

        playerStats();

      $('#playerdetail').hide();
        rosterboxen.each(function(i,el){
            elClass = $('h2',el).text();
            elClass = elClass.split(' ');
            elClass = elClass.join('');
            elClass = elClass.split(',');
            elClass = elClass.join('');
            elClass = elClass.toLowerCase();
            $(el).addClass(elClass);

        })

      $('<div class="rosterbox defenseoffense">'
        + '<a href="#" class="defense">DEFENSE</a>'
        + '<div class="spielfeld"></div>'
        + '<a href="#" class="offense">OFFENSE</a>'
        + '</div>').insertBefore($('.rosterbox.coaches '))


        $('<div style="clear:both"></div>').insertBefore($('.rosterbox.specialteams'));
        $('<div style="clear:both"></div>').insertBefore($('.rosterbox.qbrunningbacks'));



    var player = [ 'O_L_WR', 'O_L_T','O_L_G','O_M_C','O_M_QB','O_M_FB','O_M_HB','O_R_G','O_R_T','O_R_TE','O_R_WR','D_L_CB','D_L_LB','D_L_DE',
                   'D_L_FS','D_M_LB','D_M_DT','D_MR_LB','D_MR_DE','D_R_SS','D_R_LB','D_R_CB']

    for(var i = 0; i < player.length;i++)
    {
        $('.rosterbox.defenseoffense .spielfeld').append($('<a href="#" class="player '+ player[i] +'" >'+ player[i] +'</a>'));
    }


   $('.defense').click(function(){
       return false
   })

      $('.offense').click(function(){
       return false
   })

 /* BOXEN Mouseover */
   $('.defensebackfield').mouseover(function(){
       $('.D_L_CB,.D_R_CB,.D_L_FS,.D_R_SS').addClass('highlight');
   }).mouseout(function(){
       $('.D_L_CB,.D_R_CB,.D_L_FS,.D_R_SS').removeClass('highlight');
   })

   $('.D_L_CB,.D_R_CB,.D_L_FS,.D_R_SS').mouseover(function(){
        $('.defensebackfield').addClass('highlight');
   }).mouseout(function(){
       $('.defensebackfield').removeClass('highlight');
   })
   //////////////////////
   $('.linebacker').mouseover(function(){
    $('.D_L_LB ,.D_M_LB,.D_MR_LB,.D_R_LB').addClass('highlight');
   }).mouseout(function(){
    $('.D_L_LB ,.D_M_LB,.D_MR_LB,.D_R_LB').removeClass('highlight');
   })

       $('.D_L_LB ,.D_M_LB,.D_MR_LB,.D_R_LB').mouseover(function(){
            $('.linebacker').addClass('highlight');
       }).mouseout(function(){
           $('.linebacker').removeClass('highlight');
       })
   //////////////////////
   $('.defenseline').mouseover(function(){
    $('.D_L_DE ,.D_MR_DE,.D_M_DT').addClass('highlight');
   }).mouseout(function(){
    $('.D_L_DE ,.D_MR_DE,.D_M_DT').removeClass('highlight');
   });

       $('.D_L_DE ,.D_MR_DE,.D_M_DT').mouseover(function(){
            $('.defenseline').addClass('highlight');
       }).mouseout(function(){
           $('.defenseline').removeClass('highlight');
       })
   /////////////////////////
   $('.qbrunningbacks').mouseover(function(){
      $('.O_M_QB,.O_M_FB,.O_M_HB').addClass('highlight');
   }).mouseout(function(){
        $('.O_M_QB,.O_M_FB,.O_M_HB').removeClass('highlight');
   })

       $('.O_M_QB,.O_M_FB,.O_M_HB').mouseover(function(){
            $('.qbrunningbacks').addClass('highlight');
       }).mouseout(function(){
           $('.qbrunningbacks').removeClass('highlight');
       })

   //////////////////////////

   $('.rosterbox.receiver').mouseover(function(){
      $('.O_L_WR,.O_R_WR,.O_R_TE').addClass('highlight');
   }).mouseout(function(){
        $('.O_L_WR,.O_R_WR,.O_R_TE').removeClass('highlight');
   })
       $('.O_L_WR,.O_R_WR,.O_R_TE').mouseover(function(){
            $('.rosterbox.receiver').addClass('highlight');
       }).mouseout(function(){
           $('.rosterbox.receiver').removeClass('highlight');
       })
  //////////////////////////////

   $('.rosterbox.offenseline').mouseover(function(){
      $('.O_L_T , .O_R_T, .O_L_G,.O_R_G,.O_M_C').addClass('highlight');
   }).mouseout(function(){
        $('.O_L_T , .O_R_T, .O_L_G,.O_R_G,.O_M_C').removeClass('highlight');
   })
       $('.O_L_T , .O_R_T, .O_L_G,.O_R_G,.O_M_C').mouseover(function(){
            $('.rosterbox.offenseline').addClass('highlight');
       }).mouseout(function(){
           $('.rosterbox.offenseline').removeClass('highlight');
       })



   /* Player mouseover */

   $('tr:even', $('.rosterbox')).css('background-color','#d3d6d7');
   $('.rosterheader').css('background-image', 'url('+$('.rosterheader').attr('rel')+')');

$('#playerdetail .close').click(function(){
    $('#playerdetail').hide();

    return false;
})

 $('.rosterheader').css('background-image', 'url('+$('.rosterheader').attr('rel')+')');



$('.spielfeld').click(function(){
    return false;
})


    /* höhe der boxen anpassen */



    var h =[$('.rosterbox.defensebackfield').height(),$('.rosterbox.linebacker').height(),$('.rosterbox.defenseline').height()];
    h = h.max();
    $('.rosterbox.defensebackfield,.rosterbox.linebacker,.rosterbox.defenseline').css('height', h+'px');

    var h =[$('.rosterbox.qbrunningbacks').height(),$('.rosterbox.receiver').height(),$('.rosterbox.offenseline').height()];
    h = h.max();
    $('.rosterbox.qbrunningbacks,.rosterbox.receiver,.rosterbox.offenseline').css('height', h+'px');


    var h =[$('.rosterbox.specialteams').height(),$('.rosterbox.coaches').height()];
    h = h.max();

    if(h < $('.spielfeld').height()){
      h = $('.spielfeld').height()-7;
    }

    $('.rosterbox.specialteams,.rosterbox.coaches ').css('height', h + 'px');








  }

  /*
  var h =[$('.game section.links').height(),$('.game section.mitte').height(),$('.game section.rechts').height()];

	h = h.max();
  	$('.game section.links, .game section.mitte, .game section.rechts').css('height', h+'px');

  	var h =[$('.game .table_rushing_bro').height(),$('.game .table_rushing_vik').height()];
	h = h.max();
	$('.game .table_rushing_bro, .game .table_rushing_vik').css('height', h+'px');

	var h =[$('.game .table_passing_bro').height(),$('.game .table_passing_vik').height()];
	h = h.max();
	$('.game .table_passing_bro, .game .table_passing_vik').css('height', h+'px');

	var h =[$('.game .table_receiving_bro').height(),$('.game .table_receiving_vik').height()];
	h = h.max();
	$('.game .table_receiving_bro, .game .table_receiving_vik').css('height', h+'px');

	var h =[$('.game .table_punting_bro').height(),$('.game .table_punting_vik').height()];
	h = h.max();
	$('.game .table_punting_bro, .game .table_punting_vik').css('height', h+'px');

	var h =[$('.game .table_allreturns_bro').height(),$('.game .table_allreturns_vik').height()];
	h = h.max();
	$('.game .table_allreturns_bro, .game .table_allreturns_vik').css('height', h+'px');

	var h =[$('.game .table_kickoffs_bro').height(),$('.game .table_kickoffs_vik').height()];
	h = h.max();
	$('.game .table_kickoffs_bro, .game .table_kickoffs_vik').css('height', h+'px');

	var h =[$('.game .table_particip_report_bro').height(),$('.game .table_particip_report_vik').height()];
	h = h.max();
	$('.game .table_particip_report_bro, .game .table_particip_report_vik').css('height', h+'px');

	var h =[$('.game .table_drive_chart_bro').height(),$('.game .table_drive_chart_vik').height()];
	h = h.max();
	$('.game .table_drive_chart_bro, .game .table_drive_chart_vik').css('height', h+'px');
	*/




})


