var athl = {}; 	/// global obj                                  
	// Free Global Vars to avoid Conflicts
	jq = jQuery.noConflict(true); // Remap $ and free jQuery  
 
	// used language
	/*athl.lang = 'de';*/
    
    	// language strings: DE
	athl.de = {};
	athl.de.searchValue = "Produktsuche...";    
	
	// language strings IT
	athl.it = {};
	athl.it.searchValue = "Ricerca prodotti...";  
	
	// language strings FR
	athl.fr = {};
	athl.fr.searchValue = "Recherche Produits...";
	
	athl.searchNoClose = false;  
	
	athl.headerHeight = 79;
	athl.mainHeight = 378;
	athl.teaserHeight = 150;
	athl.subheaderHeight = 123;
	athl.subheaderHeightIE = 103;
	
	
	athl.subheaderHeightIE
	athl.subheaderHeight;
	athl.realHeight;
	athl.realMainHeight;
	athl.adjustHeight;
	
	athl.bodyHeight = athl.headerHeight + athl.mainHeight  + athl.teaserHeight; 
	athl.msie = jq.browser.msie;      // Internet Explorer Win / Mac
		
jq(window).load(function(){




	athl.getHeight(); // Get height of Window
	
	jq('#turntable').show().hide();
	
	jq('#search input#s').val(searchValueText);   
	
	jq('#search input').click( function(){
		if (this.value == searchValueText ) this.value = '';
		jq('#searchPlace').show(200);
		athl.searchNoClose = true;  
	});
	
	jq('#search input').blur( function(){
		if (this.value == '') this.value = searchValueText;
	});
	
	/*jq('#search input').val(athl.getLang('searchValue'));   
	
	jq('#search input').click( function(){
		if (this.value == athl.getLang('searchValue') ) this.value = '';
		jq('#searchPlace').show(200);
		athl.searchNoClose = true;  
	});  
	
	jq('#search input').blur( function(){
		if (this.value == '') this.value = athl.getLang('searchValue');
	});*/
	
	jq('#searchPlace .close').click( function(){
		jq('#searchPlace').hide(200);         
	});
	
	jq('#my_athleticum a:not(.active) img').mouseover( function () {
    	athl.switchMyAthleticum();
	}).mouseout	( function () {
	    athl.switchMyAthleticum();
	});
	
	jq('#nav_language a:not(.active) img').mouseover( function () {
    	athl.switchLang( jq(this) );
	});
	
	jq('#nav_language a:not(.active) img').mouseout( function () {
	    athl.switchLang( jq(this) );
	});
	
	jq('#nav_language a:not(.active) img').mouseover( function () {
		jq(this).attr("src",jq(this).attr("src").replace(/.jpg/,'_on.jpg'));
	});
	
	jq('#nav_language a:not(.active) img').mouseout( function () {
		jq(this).attr("src",jq(this).attr("src").replace(/_on.jpg/,'.jpg'));
	});
	
	jq('body').click( function(){
		athl.searchClose(); 
	});
	
	jq('#searchPlace').click( function(){
		athl.searchNoClose = true;  
	});
	
    	jq('#turntableSmall').click( function(){ 	
		athl.turntable();  
	});  
	
	jq('.athl-jq-print').click( function(){ 	
		window.print();
	});
	
	if(athl.adjustHeight) athl.heightAjust();     
	
	jq("#table_kataloge a:not([href*='beratung'])").click(function() {
		athl.trackingPixel('http://altfarm.mediaplex.com/ad/bk/15103-101035-3840-0?click_katalog=1&amp;mpuid=');
	});
	
});

jq(window).load(function(){
if(athl.adjustHeight) athl.heightAjust();     

});
	athl.searchClose = function () {
	if( !athl.searchNoClose ) jq('#searchPlace').hide(200);
	athl.searchNoClose = false;	
	}
 
	athl.getLang = function (string){
	return eval('athl.' + athl.lang + '.' + string)
	};

	athl.switchMyAthleticum = function () {
	var jqt = jq('#my_athleticum a:not(.active) img');
	if ( jqt.attr('src') != 'fileadmin/templates/css/img/my_athleticum.gif' ) jqt.attr('src', 'fileadmin/templates/css/img/my_athleticum.gif');
	else jqt.attr('src', 'fileadmin/templates/css/img/my_athleticum_on.gif');	
	}   


	athl.switchLang = function ( jqt ) {  
	switch ( jqt.attr('src') ) {
    	case  '../css/img/lang_de.jpg':
      		jqt.attr('src', '../css/img/lang_de_on.jpg');
		break;
		case  '../css/img/lang_de_on.jpg':
	      	jqt.attr('src', '../css/img/lang_de.jpg');
		break;
		case  '../css/img/lang_fr.jpg':
      		jqt.attr('src', '../css/img/lang_fr_on.jpg');
		break;
		case  '../css/img/lang_fr_on.jpg':
	      	jqt.attr('src', '../css/img/lang_fr.jpg');
		break;
		case  '../css/img/lang_it.jpg':
      		jqt.attr('src', '../css/img/lang_it_on.jpg');
		break;
		case  '../css/img/lang_it_on.jpg':
	      	jqt.attr('src', '../css/img/lang_it.jpg');
		break;        
		}
	}

	athl.heightAjust = function(){ 
	//alert("athl.realHeight: " + athl.realHeight + " \nathl.bodyHeight:  " + athl.bodyHeight + "\nathl.realMainHeight: " + athl.realMainHeight + "\nathl.adjustHeight: " + athl.adjustHeight);
	if( athl.realMainHeight < athl.bodyHeight){
		if(athl.msie) {   	
			jq('.sub #main').css('height', athl.realHeight - athl.headerHeight);
			jq('.home #main').css('height', athl.adjustHeight -38); /*rzg 10.12.2008  -30 hinzugefügt wegen dem newsticker, damits kein scrollbar gibt weil falsche höhe*/
			jq('.sub #maincontent').css('height', (athl.realHeight - athl.headerHeight - athl.subheaderHeight) );
			//hier
		}
		
		
		jq('.sub #main').css('minHeight', athl.realHeight - athl.headerHeight);
		jq('.home #main').css('minHeight', athl.adjustHeight - 38); /*rzg 10.12.2008  -30 hinzugefügt wegen dem newsticker, damits kein scrollbar gibt weil falsche höhe*/
		jq('.sub #maincontent').css('minHeight', athl.realHeight - athl.headerHeight - athl.subheaderHeight);
		
		}

	} 

	athl.getHeight = function (){   
	if( parseInt(jq('div#main').css('height'))) athl.realMainHeight = parseInt(jq('div#main').css('height'));
	else athl.realMainHeight = document.getElementById('main').offsetHeight;
	
	     
	if (window.innerHeight) athl.realHeight = window.innerHeight;
	else if (document.documentElement && document.documentElement.clientHeight) athl.realHeight = document.documentElement.clientHeight;
	else if (document.body) athl.realHeight = document.body.clientHeight; 

  	if (athl.realHeight > athl.bodyHeight) athl.adjustHeight = athl.mainHeight + (athl.realHeight - athl.bodyHeight)
  	else if( athl.adjustHeight ) athl.adjustHeight = athl.mainHeight; // Value has been set bevor and is now minimum value
	}                            
    
	athl.turntable = function( action ){
	if(action == 'show'){
		jq('#turntable').show();
	} else if( action == 'hide'){
		jq('#turntable').hide();
	} else {
		if(jq('#turntable').css('display') == 'none') jq('#turntable').show();   
		else jq('#turntable').hide();  
		}                              
	}
	
	athl.trackingPixel = function(URL) {
		var AdRnd = Math.floor(Math.random()*99999999999);
		var AdUrl = URL + AdRnd;

		var imgDiv = document.createElement('div');
		imgDiv.setAttribute("style", "display:none; position:absolute;");
		imgDiv.innerHTML = '<img src="' + AdUrl + '" width="1" height="1" border="0">';
		document.body.appendChild(imgDiv);
	}

	jq(window).resize(function(){ 
		athl.getHeight();
		athl.heightAjust();
	}); 



