function showContent(){
	$("#accordion").fadeIn();
	$('#artikelresultat').fadeIn();
}
 //In Zukunft denkbar, ein Checkup, ob History-Button beuntz worden ist: googleit->simple-ajax-website-jquery
//Hash-Check -> open model details
function checkHash(){
	
	var hashString1	=	self.document.location.hash.substring(1).split('content_');
	var hashString	=	hashString1[1];

	if(hashString){
		var y			=	document.getElementById('content_'+hashString).getAttributeNode('onclick').value.split("'");
		var trToActive	=	$('.artikelNrCheck:contains('+hashString+')').parent();
		$(trToActive).addClass('active');
		$('#contentplace_'+hashString).find('td.first').load('/ajax/prod_modelle.php?prodTitle='+y[3]+'&modID='+y[5]+'&art=normal', function(data){
			$(".zubehoere").accordion({active: false, collapsible: true, autoHeight: false, navigation: true });
			$(".produktebild").colorbox();
			});
		$('#contentplace_'+hashString).toggle($('#contentplace_'+hashString).css('display') == 'none');
		$('html,body').animate({scrollTop: $('#contentplace_'+hashString).offset().top},'slow');
	}
}


function checkTableCols() {
	var hidebr = 0;
	var hideho = 0;
	var hideti = 0;
	var countModelle = $("#countModelle").val();
	if($("#artikelresultat td.artikelNrEmpty").size() == countModelle){
		$("#artikelresultat td.artikelNrEmpty, #artikelNrHead").hide();
	}
	if($("#artikelresultat td.prodTypEmpty").size() == countModelle){
		$("#artikelresultat td.prodTypEmpty, #prodTypHead").hide();
	}
	if($("#artikelresultat td.breiteEmpty").size() == countModelle){
		$("#artikelresultat td.breiteEmpty, #breiteHead").hide();
		var hidebr = 1;
	}
	if($("#artikelresultat td.hoeheEmpty").size() == countModelle){
		$("#artikelresultat td.hoeheEmpty, #hoeheHead").hide();
		var hideho = 1;
	}
	if($("#artikelresultat td.tiefeEmpty").size() == countModelle){
		$("#artikelresultat td.tiefeEmpty, #tiefeHead").hide();
		var hideti = 1;
	}
	if($("#artikelresultat td.gewichtEmpty").size() == countModelle){
		$("#artikelresultat td.gewichtEmpty, #gewichtHead").hide();
	}
	if($("#artikelresultat td.tuereEmpty").size() == countModelle){
		$("#artikelresultat td.tuereEmpty, #tuereHead").hide();
	}
	if($("#artikelresultat td.laengeEmpty").size() == countModelle){
		$("#artikelresultat td.laengeEmpty, #laengeHead").hide();
	}
	if($("#artikelresultat td.durchmesserEmpty").size() == countModelle){
		$("#artikelresultat td.durchmesserEmpty, #durchmesserHead").hide();
	}
	if($("#artikelresultat td.materialEmpty").size() == countModelle){
		$("#artikelresultat td.materialEmpty, #materialHead").hide();
	}
	if($("#artikelresultat td.befEmpty").size() == countModelle){
		$("#artikelresultat td.befEmpty, #befHead").hide();
	}
	if($("#artikelresultat td.eurEmpty").size() == countModelle){
		$("#artikelresultat td.eurEmpty, #eurHead").hide();
	}
	if($("#artikelresultat td.chfEmpty").size() == countModelle){
		$("#artikelresultat td.chfEmpty, #chfHead").hide();
	}
	if(hidebr+hideho+hideti == 3){
		$("#artikelsuche, #artikelsuche2, .result_titel, #artikelsuche_agent").hide();
	} else {
		$("#artikelsuche, #artikelsuche2, .result_titel, #artikelsuche_agent").fadeIn();
	}
	if(hidebr == 1){
		$("#artikelsuche_breite, #artikelsuche2, #artikelsuche_agent").hide();
	}
	if(hideho == 1){
		$("#artikelsuche_hoehe, #artikelsuche2").hide();
	}
	if(hideti == 1){
		$("#artikelsuche_tiefe, #artikelsuche2").hide();
	}
}

function changeValue() {
	var inputValue = $('#livesearchUebersicht').delay(100).val();
	var linkResult = "include/livesearch.php?art=uebersicht&q=" + encodeURIComponent(inputValue);

	if((inputValue != '')&&(inputValue != ' ')){
		$('#LSShadowUebersicht').load(linkResult);
		$('#LSResultUebersicht').show(100);
	} else {
		$('#LSShadowUebersicht').load(linkResult);
		$('#LSResultUebersicht').hide(100);
	}
}

function disableEnterKey(e)
{
     var key;

     if(window.event)
          key = window.event.keyCode;     //IE
     else
          key = e.which;     //firefox

     if(key == 13)
          return false;
     else
          return true;
}

function checksubhnav (){
	var countAll = $("#sub_hnav2 li a").size();
	var countEmpty = $("#sub_hnav2 li a:empty").size();
	if (countAll == countEmpty) {
		$("#sub_hnav2").hide();
	}
	checkTableCols();
}

function getModellInfo(artid, pkat, modid, art){
	if(art == 'normal'){
		var thiis = '#content_'+artid;
		$('.result_table').find('tr').removeClass('active');
		$('.result_table tr.contentplaces').css({display: 'none'});
		$(this).toggleClass('active');$(thiis).parent().parent().addClass('active');
		$('#contentplace_'+artid).find('td.first').load('/ajax/prod_modelle.php?prodTitle='+pkat+'&modID='+modid+'&art=normal', function(data){
			$(".zubehoere").accordion({active: false, collapsible: true, autoHeight: false, navigation: true });
			$(".produktebild").colorbox();
			});
		$('#contentplacez_'+artid).find('td.first').load('/ajax/prod_modelle.php?prodTitle='+pkat+'&modID='+modid+'&art=zub', function(data){
			$(".zubehoere").accordion({active: false, collapsible: true, autoHeight: false, navigation: true });
			$(".produktebild").colorbox();
			});
		$('#contentplace_'+artid).toggle($('#contentplace_'+artid).css('display') == 'none');
	} else {
	}
}

function changeLink(url, produkt) {

	var text1 = document.getElementById('ind_breite').value;
	var text2 = document.getElementById('ind_hoehe').value;
	var text3 = document.getElementById('ind_tiefe').value;

	document.getElementById("ind_anfrage").href = url+'&f7=Individuelle Produkt-Anfrage&f8='+produkt+': Breite - '+text1+'mm., Höhe - '+text2+'mm., Tiefe - '+text3+'mm.';  
}

// Login
function redirect() {
	var url1	=	document.location.href.split("#");
	var url		=	url1[0];
	var hash	=	self.document.location.hash;
	
	var check	=	url.indexOf("?");
	var check2	=	url.indexOf("logout=successful");
	
	if (check == '-1' && check2 == '-1'){
		document.location.href = url + '?login=successful' + hash;
	} else if(check == '-1' && check2 != '-1'){
		var url		=	url.replace('logout', 'login');
		document.location.href = url + hash;
	} else if(check != '-1' && check2 != '-1'){
		var url		=	url.replace('logout', 'login');
		document.location.href = url + hash;
	} else if(check != '-1' && check2 == '-1'){
		document.location.href = url + '&login=successful' + hash;
	}
}

function login() {
	var user = $('#user').val();
	var password = $('#password').val();
	
	$('#login_error').html('').show();
	$('#login_error').html('<img src="/img/loader.gif" alt="Wait..."> <span style="color:#000;">überprüfen...</span>');
	$('#submit').attr('disabled', 'disabled');
	
	$.get('/ajax/login.php?password='+password+'&user='+user, {"password": password, "user": user}, function(data) {
		var text	= data.split('###');
		var check	= text[0];
		var respond	= text[1];

		if (check == '1') {
			$('#login_error').html(respond).addClass('success');
			window.setTimeout("redirect()", 2000);
		} else {
			$('#login_error').html(respond).addClass('error');
			$('#submit').removeAttr("disabled");
		}
	});
}

function newsletter() {
	var email = $('#nl_email').val();
	
	$('#nl_error').html('').show();
	$('#nl_error').html('<img src="/img/loader.gif" alt="Wait..."> <span style="color:#000;">überprüfen...</span>');
	$('#nl_submit').attr('disabled', 'disabled');
	
	$.get('/ajax/newsletter.php', {"email": email}, function(data) {
		var text	= data.split('###');
		var check	= text[0];
		var respond	= text[1];

		if (check == '1') {
			$('#nl_error').html(respond).addClass('success');
			window.setTimeout("$.colorbox.close()", 2000);
		} else {
			$('#nl_error').html(respond).addClass('error');
			$('#nl_submit').removeAttr("disabled");
		}
	});
}

// AUSLANDVERTRETUNGEN - ADRESSEN-INFORMATIONEN WECHSELN
function innerAddress(land){
	if(land == 'DE'){
		$('#slider').animate({marginLeft: '-312px', opacity: '0'}, 200, function(){
		$('#secondTd').html('<p style="border-bottom: 1px solid #e9e9e9; margin: 6px 6px 10px 4px; height: 60px; overflow: hidden; padding: 15px 0pt 15px 25px;"><img class="vt_img" src="../data/lt_wysiwyg_media/Auslandvertretungen/eckert_und_graf_gmbh.gif" alt="" style="max-width:240px;max-height:72px;"></p><p style="padding-left: 30px; height: 200px;">Eckert &amp; Graf GmbH<br> Zollstrasse 7<br> D-78239 Rielasingen<br> <br> Telefon:  +49 (0) 7731/59 07-0<br> Telefax:  +49 (0) 7731/59 07-10<br> E-Mail: <a href="mailto:info@eckert-graf.de">info@eckert-graf.de</a><br> <br> Homepage: <a href="http://www.eckert-graf.de" target="_blank">www.eckert-graf.de</a><br> Karte / Routenplaner: <a href="http://maps.google.ch/maps?q=Eckert+%26+Graf+GmbH+Zollstrasse+7+D-78239+Rielasingen&amp;hl=de&amp;cd=1&amp;ei=iA2WS_7YFsuFjAfEhOzqCw&amp;sll=47.712533,8.822424&amp;sspn=0.006295,0.006295&amp;ie=UTF8&amp;view=map&amp;cid=16710773065986296182&amp;ved=0CBgQpQY&amp;hq=Eckert+%26+Graf+GmbH+Zollstrasse+7+D-78239+Rielasingen&amp;hnear=&amp;ll=47.713458,8.822429&amp;spn=0.009558,0.027874&amp;t=h&amp;z=16&amp;iwloc=A" target="_blank">Google Maps</a></p>');});
		$('.allCountries').removeClass('highlight');$('#DE').addClass('highlight');$('#slider').show('200').animate({marginLeft: '0', opacity: '1'}, 200);
	}
	else if(land == 'FR'){
		$('#slider').animate({marginLeft: '-312px', opacity: '0'}, 200, function(){
		$('#secondTd').html('<p style="border-bottom: 1px solid #e9e9e9; margin: 6px 6px 10px 4px; height: 60px; overflow: hidden; padding: 15px 0pt 15px 25px;"><img class="vt_img" src="../data/lt_wysiwyg_media/Auslandvertretungen/leclerc.jpg" alt="" style="max-width:240px;max-height:72px;"></p><p style="padding-left: 30px; height: 200px;">SNTH Herz Com, Clark Masts France<br>ZA - 5 rue des crocs<br> La Grande Paroisse - BP 40010<br> F-77871 MONTEREAU CEDEX<br> <br> Telefon:  +33 (0) 160575065<br> Telefax:  +33 (0) 160575073<br> E-Mail: <a href="mailto:snth@wanadoo.fr">snth@wanadoo.fr</a><br> <br> Homepage: <a href="http://www.antennes-leclerc.fr/">www.antennes-leclerc.fr</a><br> Karte / Routenplaner: <a href="http://maps.google.ch/maps?q=Antennes+Leclerc+77873+MONTEREAU&amp;hl=de&amp;cd=1&amp;ei=fw6WS5CICMiROMDg4dEL&amp;sll=48.385598,2.924736&amp;sspn=0.006295,0.069951&amp;ie=UTF8&amp;view=map&amp;cid=2970130765390863915&amp;ved=0CBcQpQY&amp;hq=Antennes+Leclerc+77873+MONTEREAU&amp;hnear=&amp;ll=48.386611,2.924745&amp;spn=0.009434,0.027874&amp;t=h&amp;z=16&amp;iwloc=A" target="_blank">Google Maps</a></p>');});
		$('.allCountries').removeClass('highlight');$('#FR').addClass('highlight');$('#slider').show('200').animate({marginLeft: '0', opacity: '1'}, 200);
	}
	else if(land == 'NL'){
		$('#slider').animate({marginLeft: '-312px', opacity: '0'}, 200, function(){
		$('#secondTd').html('<p style="border-bottom: 1px solid #e9e9e9; margin: 6px 6px 10px 4px; height: 60px; overflow: hidden; padding: 15px 0pt 15px 25px;"><img class="vt_img" src="../data/lt_wysiwyg_media/Auslandvertretungen/Hirschmann_BeldenBrand.jpg" alt="" style="max-width:240px;max-height:72px;"></p><p style="padding-left: 30px; height: 200px;">Hirschmann electronica Nederland B.V., Richard<br> Pampuslaan 170 (In de buurt)<br> NL-1382 JS  Weesp<br> <br> Telefon:  +31 (0) 294462537<br> Telefax:  +31 (0) 294480639<br> E-Mail: <a href="mailto:hirschmann@hirschmann.nl">hirschmann@hirschmann.nl</a><br> <br> Homepage: <a href="http://www.hirschmann.nl/" target="_blank">www.hirschmann.nl</a><br> Karte / Routenplaner: <a href="http://maps.google.ch/maps?q=Hirschmann+electronica+Nederland+B.V.+Richard+Pampuslaan+170+NL-1382+JS++Weesp&amp;hl=de&amp;cd=1&amp;ei=5A6WS_aSBJCnOI_SqOkL&amp;sll=52.200289,5.101255&amp;sspn=0.274761,0.183192&amp;ie=UTF8&amp;view=map&amp;cid=4562992305501889925&amp;ved=0CBkQpQY&amp;hq=Hirschmann+electronica+Nederland+B.V.+Richard+Pampuslaan+170+NL-1382+JS++Weesp&amp;hnear=&amp;ll=52.315707,5.024915&amp;spn=0.008684,0.027874&amp;t=h&amp;z=16&amp;iwloc=A" target="_blank">Google Maps</a></p>');});
		$('.allCountries').removeClass('highlight');$('#NL').addClass('highlight');$('#slider').show('200').animate({marginLeft: '0', opacity: '1'}, 200);
	}
	else if(land == 'AU'){
		$('#slider').animate({marginLeft: '-312px', opacity: '0'}, 200, function(){
		$('#secondTd').html('<p style="border-bottom: 1px solid #e9e9e9; margin: 6px 6px 10px 4px; height: 60px; overflow: hidden; padding: 0px 0 30px 25px;"><img class="vt_img" src="../data/lt_wysiwyg_media/Auslandvertretungen/TFK-Austria.jpg" alt="" style="max-width:240px;max-height:72px;"></p><p style="padding-left: 30px; height: 200px;">TFK Handelsges.m.b.H.<br> Landesstrasse 1<br> A - 5302 Henndorf<br> <br> Telefon:  +43 (0) 6214 6895 0<br> Telefax:  +43 (0) 6214 6872 <br>E-Mail: <a href="mailto:partner@tfk-austria.at">partner@tfk-austria.at<br></a> <br> Homepage: <a href="http://www.tfk-austria.at/" target="_blank">www.tfk-austria.at</a><br> Karte / Routenplaner: <a href="http://maps.google.ch/maps?q=TFK+Handelsges.m.b.H.+Landesstrasse+1+A+-+5302+Henndorf&amp;hl=de&amp;cd=1&amp;ei=qgyWS5zXHeXMjAffuKjTCw&amp;sll=47.892649,13.18145&amp;sspn=0.015432,0.063421&amp;ie=UTF8&amp;view=map&amp;cid=9774765272245135123&amp;ved=0CBYQpQY&amp;hq=TFK+Handelsges.m.b.H.+Landesstrasse+1+A+-+5302+Henndorf&amp;hnear=&amp;ll=47.893485,13.181448&amp;spn=0.009884,0.027874&amp;t=h&amp;z=16&amp;iwloc=A" target="_blank">Google Maps</a></p>');});
		$('.allCountries').removeClass('highlight');$('#AU').addClass('highlight');$('#slider').show('200').animate({marginLeft: '0', opacity: '1'}, 200);
	}
	else if(land == 'PO'){
		$('#slider').animate({marginLeft: '-312px', opacity: '0'}, 200, function(){
		$('#secondTd').html('<p style="border-bottom: 1px solid #e9e9e9; margin: 6px 6px 10px 4px; height: 60px; overflow: hidden; padding: 15px 0pt 15px 25px;"><img style="max-width:240px;max-height:72px;" alt="" src="http://www.letrona.pl/media/letrona_logo.png" class="vt_img"></p><p style="padding-left: 30px; height: 200px;">Letrona Polska Sp. z.o.o<br>ul. Wieniawskiego 18<br>PL-41-506 Chorz&oacute;w<br><br>Telefon:  +48 32 246 00 50<br>Telefax:  +48 32 246 00 55<br><br>Homepage: <a href="http://www.letrona.pl/" target="_blank">www.letrona.pl</a><br></p>');});
		$('.allCountries').removeClass('highlight');$('#PO').addClass('highlight');$('#slider').show('200').animate({marginLeft: '0', opacity: '1'}, 200);
	}
	else {
		$('#secondTd').html('');
	}
}

// REFERENZEN - ADRESSEN-INFORMATIONEN UND LOGO WECHSELN
function innerReferenz(id){
		var projectBoxContent	=	$(id).find('span').html();
		var logo_placer_cont	=	$(id).html();
		var logo_placer_content	=	logo_placer_cont.replace("_small", "");
		$('.allReferenzen').removeClass('activeReferenz');
		$(id).addClass('activeReferenz');
		$('#projectBox #content_change .goforit').fadeOut();
		$('#projectBox #content_change').fadeOut(function(){$('#projectBox #content_change').replaceWith("<span style=\"display: inline;\" id=\"content_change\">"+projectBoxContent+"</span>").fadeIn('100')});
		$('#logo_placer').html(logo_placer_content);
		$('#projectBox #content_change .goforit').fadeIn('100');
}

function toggleHist(id){
	var id_detail_row = '#'+id+'_detail';
	if (id == '2009'){
		$(id_detail_row).toggle();
	}
}



// E-Mail Stuff
function email(address) {
	var addressDecoded = Base64.decode(address);
	location.href = "mailto:"+addressDecoded;
}

var Base64 = {

	// private property
	_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",

	// public method for encoding
	encode : function (input) {
		var output = "";
		var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
		var i = 0;

		input = Base64._utf8_encode(input);

		while (i < input.length) {

			chr1 = input.charCodeAt(i++);
			chr2 = input.charCodeAt(i++);
			chr3 = input.charCodeAt(i++);

			enc1 = chr1 >> 2;
			enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
			enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
			enc4 = chr3 & 63;

			if (isNaN(chr2)) {
				enc3 = enc4 = 64;
			} else if (isNaN(chr3)) {
				enc4 = 64;
			}

			output = output +
			this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
			this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);

		}

		return output;
	},

	// public method for decoding
	decode : function (input) {
		var output = "";
		var chr1, chr2, chr3;
		var enc1, enc2, enc3, enc4;
		var i = 0;

		input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

		while (i < input.length) {

			enc1 = this._keyStr.indexOf(input.charAt(i++));
			enc2 = this._keyStr.indexOf(input.charAt(i++));
			enc3 = this._keyStr.indexOf(input.charAt(i++));
			enc4 = this._keyStr.indexOf(input.charAt(i++));

			chr1 = (enc1 << 2) | (enc2 >> 4);
			chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
			chr3 = ((enc3 & 3) << 6) | enc4;

			output = output + String.fromCharCode(chr1);

			if (enc3 != 64) {
				output = output + String.fromCharCode(chr2);
			}
			if (enc4 != 64) {
				output = output + String.fromCharCode(chr3);
			}

		}

		output = Base64._utf8_decode(output);

		return output;

	},

	// private method for UTF-8 encoding
	_utf8_encode : function (string) {
		string = string.replace(/\r\n/g,"\n");
		var utftext = "";

		for (var n = 0; n < string.length; n++) {

			var c = string.charCodeAt(n);

			if (c < 128) {
				utftext += String.fromCharCode(c);
			}
			else if((c > 127) && (c < 2048)) {
				utftext += String.fromCharCode((c >> 6) | 192);
				utftext += String.fromCharCode((c & 63) | 128);
			}
			else {
				utftext += String.fromCharCode((c >> 12) | 224);
				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
				utftext += String.fromCharCode((c & 63) | 128);
			}

		}

		return utftext;
	},

	// private method for UTF-8 decoding
	_utf8_decode : function (utftext) {
		var string = "";
		var i = 0;
		var c = c1 = c2 = 0;

		while ( i < utftext.length ) {

			c = utftext.charCodeAt(i);

			if (c < 128) {
				string += String.fromCharCode(c);
				i++;
			}
			else if((c > 191) && (c < 224)) {
				c2 = utftext.charCodeAt(i+1);
				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
				i += 2;
			}
			else {
				c2 = utftext.charCodeAt(i+1);
				c3 = utftext.charCodeAt(i+2);
				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
				i += 3;
			}

		}

		return string;
	}

}

