var defaultDiacriticsRemovalMap=[{'base':'A','letters':/[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g},{'base':'AA','letters':/[\uA732]/g},{'base':'AE','letters':/[\u00C6\u01FC\u01E2]/g},{'base':'AO','letters':/[\uA734]/g},{'base':'AU','letters':/[\uA736]/g},{'base':'AV','letters':/[\uA738\uA73A]/g},{'base':'AY','letters':/[\uA73C]/g},{'base':'B','letters':/[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g},{'base':'C','letters':/[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g},{'base':'D','letters':/[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g},{'base':'DZ','letters':/[\u01F1\u01C4]/g},{'base':'Dz','letters':/[\u01F2\u01C5]/g},{'base':'E','letters':/[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g},{'base':'F','letters':/[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g},{'base':'G','letters':/[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g},{'base':'H','letters':/[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g},{'base':'I','letters':/[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g},{'base':'J','letters':/[\u004A\u24BF\uFF2A\u0134\u0248]/g},{'base':'K','letters':/[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g},{'base':'L','letters':/[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g},{'base':'LJ','letters':/[\u01C7]/g},{'base':'Lj','letters':/[\u01C8]/g},{'base':'M','letters':/[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g},{'base':'N','letters':/[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g},{'base':'NJ','letters':/[\u01CA]/g},{'base':'Nj','letters':/[\u01CB]/g},{'base':'O','letters':/[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g},{'base':'OI','letters':/[\u01A2]/g},{'base':'OO','letters':/[\uA74E]/g},{'base':'OU','letters':/[\u0222]/g},{'base':'P','letters':/[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g},{'base':'Q','letters':/[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g},{'base':'R','letters':/[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g},{'base':'S','letters':/[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g},{'base':'T','letters':/[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g},{'base':'TZ','letters':/[\uA728]/g},{'base':'U','letters':/[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g},{'base':'V','letters':/[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g},{'base':'VY','letters':/[\uA760]/g},{'base':'W','letters':/[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g},{'base':'X','letters':/[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g},{'base':'Y','letters':/[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g},{'base':'Z','letters':/[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g},{'base':'a','letters':/[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g},{'base':'aa','letters':/[\uA733]/g},{'base':'ae','letters':/[\u00E6\u01FD\u01E3]/g},{'base':'ao','letters':/[\uA735]/g},{'base':'au','letters':/[\uA737]/g},{'base':'av','letters':/[\uA739\uA73B]/g},{'base':'ay','letters':/[\uA73D]/g},{'base':'b','letters':/[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g},{'base':'c','letters':/[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g},{'base':'d','letters':/[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g},{'base':'dz','letters':/[\u01F3\u01C6]/g},{'base':'e','letters':/[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g},{'base':'f','letters':/[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g},{'base':'g','letters':/[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g},{'base':'h','letters':/[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g},{'base':'hv','letters':/[\u0195]/g},{'base':'i','letters':/[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g},{'base':'j','letters':/[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g},{'base':'k','letters':/[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g},{'base':'l','letters':/[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g},{'base':'lj','letters':/[\u01C9]/g},{'base':'m','letters':/[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g},{'base':'n','letters':/[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g},{'base':'nj','letters':/[\u01CC]/g},{'base':'o','letters':/[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g},{'base':'oi','letters':/[\u01A3]/g},{'base':'ou','letters':/[\u0223]/g},{'base':'oo','letters':/[\uA74F]/g},{'base':'p','letters':/[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g},{'base':'q','letters':/[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g},{'base':'r','letters':/[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g},{'base':'s','letters':/[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g},{'base':'t','letters':/[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g},{'base':'tz','letters':/[\uA729]/g},{'base':'u','letters':/[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g},{'base':'v','letters':/[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g},{'base':'vy','letters':/[\uA761]/g},{'base':'w','letters':/[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g},{'base':'x','letters':/[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g},{'base':'y','letters':/[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g},{'base':'z','letters':/[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g}];
var changes;
String.prototype.ReplaceAll=function(stringToFind,stringToReplace){var temp=this;var index=temp.indexOf(stringToFind);while(index!=-1){temp=temp.replace(stringToFind,stringToReplace);index=temp.indexOf(stringToFind);}return temp;};


globalInfo = {};

pukSpecials = {};

dropdownNavi = function(){
	$('#mweb-navigation a').each(function() {
		$(this).attr("href", function(index, old) {
			addtoUri = '';
			if(globalInfo.language == "en"){
				addtoUri = 'L=2&';
			}
			newHref = old.replace("index.php?", "index.php?id="+pukSpecials.shopId+"&"+addtoUri);
			return newHref;
		});
	});
	$('#mweb-navigation').replaceWith($('#mweb-navigation').contents());
	
	$('#navi-main .sf-menu').supersubs({ 
		minWidth:    13,
		maxWidth:    40,
		extraWidth:  1
	}).superfish({
		delay:       400,
		speed:       'fast'
	}); 
}

pukSpecials.removeDiacritics = function(str) {
	if(!changes) {changes = defaultDiacriticsRemovalMap;}
	for(var i=0; i<changes.length; i++) {str = str.replace(changes[i].letters, changes[i].base);}
	return str;
}

globalInfo.theDomain = window.location.href;
globalInfo.theDomain = globalInfo.theDomain.replace('http://','');
globalInfo.currentUrl = globalInfo.theDomain;
dotSplit = globalInfo.theDomain.split('/');
if(dotSplit[0].length > 3){
	globalInfo.theDomain = dotSplit[0]
} else {
	globalInfo.theDomain = "www.puk.com";
}

pukSpecials.navUrl = function(){
	if(globalInfo.language == "nl")
		return 'http://'+globalInfo.theDomain+'/fileadmin/mWeb/index.php?tpl=nav&lang=nl&shop='+pukSpecials.shopPage;
	if(globalInfo.language == "en")
		return 'http://'+globalInfo.theDomain+'/fileadmin/mWeb/index.php?tpl=nav&lang=en&shop='+pukSpecials.shopPage;
	return 'http://'+globalInfo.theDomain+'/fileadmin/mWeb/index.php?tpl=nav&lang=de&shop='+pukSpecials.shopPage;
}

pukSpecials.niederlassungen = {
	'01000-02999' : '9',
	'03000-03999' : '1',
	'04000-04999' : '9',
	'06000-06869' : '5',
	'06870-06929' : '9',
	'07000-07999' : '5',
	'08000-09999' : '9',
	'10000-18999' : '1',
	'19000-19999' : '2',
	'20000-25999' : '3',
	'26000-28999' : '15',
	'29000-34599' : '4',
	'34600-36399' : '8',
	'36400-36469' : '5',
	'37000-37299' : '4',
	'37300-37359' : '5',
	'37400-39999' : '4',
	'40000-40999' : '6',
	'41000-41999' : '7',
	'42000-49999' : '6',
	'49340-49849' : '15',
	'50000-56999' : '7',
	'57400-57439' : '6',
	'57440-57649' : '7',
	'58000-59840' : '6',
	'59850-59990' : '7',
	'60000-65999' : '8',
	'66000-66359' : '14',
	'66400-66839' : '14',
	'66840-66899' : '8',
	'66900-67499' : '11',
	'67500-67999' : '8',
	'68000-69999' : '11',
	'70000-71999' : '12',
	'72000-72199' : '12',
	'72200-72299' : '11',
	'72300-72999' : '12',
	'73000-73999' : '12',
	'74000-74399' : '11',
	'74400-74699' : '12',
	'74700-78499' : '11',
	'78500-78999' : '12',
	'79000-79999' : '11',
	'80000-86699' : '13',
	'86700-86799' : '12',
	'86800-87399' : '13',
	'87400-87799' : '12',
	'87800-87999' : '13',
	'88000-89999' : '12',
	'90000-91539' : '10',
	'91540-91559' : '12',
	'91560-92999' : '10',
	'93000-93399' : '13',
	'93400-93499' : '10',
	'93500-94999' : '13',
	'95000-95199' : '5',
	'95200-95299' : '10',
	'95300-95399' : '5',
	'95400-95499' : '10',
	'95500-95999' : '5',
	'96000-96299' : '10',
	'96300-96599' : '5',
	'96600-96999' : '10',
	'97000-97099' : '8',
	'97100-97199' : '10',
	'97200-97299' : '8',
	'97300-97599' : '10',
	'97600-97799' : '5',
	'97800-97899' : '8',
	'97900-97999' : '12',
	'98000-99999' : '5'
};

pukSpecials.dictionary = {
	'de' : {},
	'en' : {}
};
pukSpecials.dictionary.de = {
	'Postleitzahl'	: 'Postleitzahl',
	'PLZ'						: 'PLZ',
	'Telefon'				: 'Telefon'
}
pukSpecials.dictionary.en = {
	'Postleitzahl'	: 'ZIP-Code',
	'PLZ'						: 'ZIP',
	'Telefon'				: 'Phone'
}


pukSpecials.gMapCounter = 0;

globalInfo.searchItemsPerPage = 10;

//globalInfo.pageRequest = getUrlVars();
globalInfo.pageRequest = getCurrentPage();
globalInfo.language = $('html').attr('lang')
globalInfo.language = (globalInfo.language == "en" || globalInfo.language == "de" || globalInfo.language == "nl") ? globalInfo.language : "de";

if(globalInfo.language == "en"){
	pukSpecials.localDictionary = pukSpecials.dictionary.en;
} else {
	pukSpecials.localDictionary = pukSpecials.dictionary.de;
}


pukSpecials.getVars = {};

document.location.search.replace(/\??(?:([^=]+)=([^&]*)&?)/g, function () {
    function decode(s) {
        return decodeURIComponent(s.split("+").join(" "));
    }

    pukSpecials.getVars[decode(arguments[1])] = decode(arguments[2]);
});

pukSpecials.showActivity = function(){
	if($('#mweb-loadingani').length == 0){
		$('body').append('<div id="mweb-loadingani" />');
	} else {
		$('#mweb-loadingani').show();
	}
	$('#fancybox-overlay').css({display:'block',height:$('body').height()+'px',background:'#fff',opacity:'0.7'});
}
pukSpecials.hideActivity = function(){
	if($('#mweb-loadingani').length != 0){
		$('#mweb-loadingani').hide();
		$('#wrapper').css({opacity:'1'});
	}
	$('#fancybox-overlay').css({display:'none'});
}

function pageselectCallback(page_index, jq){
    // Get number of elements per pagionation page from form
    var items_per_page = globalInfo.searchItemsPerPage;
    var max_elem = Math.min((page_index+1) * items_per_page,$('#mweb-hiddenresult div.tx-indexedsearch-res').length);
    var newcontent = '';
    
    // Iterate through a selection of the content and build an HTML string
    for(var i=page_index*items_per_page;i<max_elem;i++)
    {
        newcontent += '<div class="tx-indexedsearch-res res res-tmpl-css">'+$('#mweb-hiddenresult div.tx-indexedsearch-res:eq('+i+')').html()+'</div>';
    }
    
    // Replace old content with new content
    $('#mweb-searchresult').html(newcontent);
    
    // Prevent click eventpropagation
    return false;
}

function pageselectTypo3Callback(page_index, jq){
    // Get number of elements per pagionation page from form
    var items_per_page = globalInfo.searchItemsPerPage;
    var max_elem = Math.min((page_index+1) * items_per_page,$('#typo3-hiddenresult div.tx-indexedsearch-res').length);
    var newcontent = '';
    
    // Iterate through a selection of the content and build an HTML string
    for(var i=page_index*items_per_page;i<max_elem;i++)
    {
        newcontent += '<div class="tx-indexedsearch-res res res-tmpl-css">'+$('#typo3-hiddenresult div.tx-indexedsearch-res:eq('+i+')').html()+'</div>';
    }
    
    // Replace old content with new content
    $('#typo3-searchresult').html(newcontent);
    
    // Prevent click eventpropagation
    return false;
}

function initMwebPagination() {
  // count entries inside the hidden content
  var num_entries = $('#mweb-hiddenresult div.tx-indexedsearch-res').length;
  // Create content inside pagination element
  if(num_entries > globalInfo.searchItemsPerPage){
		$('#mweb-hiddenresult').hide();
		$("#mweb-pagination").pagination(num_entries, {
				callback: pageselectCallback,
	      items_per_page:globalInfo.searchItemsPerPage, // Show only one item per page
				prev_text:"&laquo;",
				next_text:"&raquo;"
	  });
	}
}

function initTypo3Pagination() {
  // count entries inside the hidden content
  var num_entries = $('#typo3-hiddenresult div.tx-indexedsearch-res').length;
  // Create content inside pagination element
  if(num_entries > globalInfo.searchItemsPerPage){
		$('#typo3-hiddenresult').hide();
		$("#typo3-pagination").pagination(num_entries, {
			callback: pageselectTypo3Callback,
      		items_per_page:globalInfo.searchItemsPerPage, // Show only one item per page
			prev_text:"&laquo;",
			next_text:"&raquo;"
	  });
	}
}


$(document).ready(function() {

	/* IE CSS HACKS */
	$('#breadcrumb').each(function(){
		if($(this).html() == ""){$(this).remove();}
	})
	/* END */
	
	var navEls = $('#navi-main .sf-menu > li:nth-child(2)');
	
	
	if($('.puk-benelux').length){
		pukSpecials.shopPage = 'nl';
		pukSpecials.searchPageId = '167';
		pukSpecials.shopId = '258&shop=nl';
	} else {
		pukSpecials.shopPage = 'de';
		pukSpecials.searchPageId = '159';
		pukSpecials.shopId = '35';
	}
	
	/*
	Short Cuts - mWeb Bridge
	check for 2nd child of navi-main
	and if it has "prod" in innerHTML
	it will get the mWeb navigation appended
	*/
	navInitiated = false;
	if(navEls.length){
		for(var ni=0; ni < navEls.length; ni++){
			if($('a',navEls[ni]).text().match(/prod/i)){
				$('ul',navEls[ni]).remove();
				$(navEls[ni]).append('<div id="mweb-navigation" />');
				$('#mweb-navigation').load(pukSpecials.navUrl(),{},function(){dropdownNavi();});
				navInitiated = true;
				break;
			}
		}
	}
	if(!navInitiated){
		dropdownNavi();
	}
	
	// language menu optimization for mWeb
	if($('.tx-srlanguagemenu-pi1 a').length && $('#mweb_container').length && globalInfo.currentUrl.match('index.php?')){
		$('.tx-srlanguagemenu-pi1 a').each(function(){
			theHref = $(this).attr('href')+'';
			theLPosA = theLPosB = 0
			if($(this).attr('href').match('&L=0') || $(this).attr('href').match('&amp;L=0')){
				theLPosA = (theHref+'').indexOf('L=0');
			}
			if($(this).attr('href').match('&L=2') || $(this).attr('href').match('&amp;L=2')){
				theLPosB = (theHref+'').indexOf('L=2');
			}
			appendLanguageString = '&L=0';
			if(theLPosB > theLPosA){
				appendLanguageString = '&L=2';
			}
			theHref = theHref.ReplaceAll('&L=0','')
			theHref = theHref.ReplaceAll('&amp;L=0','')
			theHref = theHref.ReplaceAll('&L=2','')
			theHref = theHref.ReplaceAll('&amp;L=2','');
			$(this).attr('href',theHref+appendLanguageString);
		});
	}
	
	/* tab menu */
	if($('.tab-menu a').length == $('.tab').length){
		$('.tab').hide();
		
		
		
		if($('#mweb_content .tab-menu').length == 1){
			// mweb tab menu
			pukSpecials.tabCounter = 0;
			$('#mweb_content .tab').each(function(){
				if($('div',this).length > 0){
					pukSpecials.tabCounter++;
					if(pukSpecials.tabCounter == 1){
						$(this).show();
						$('#mweb_content .tab-menu a[href$=#'+$(this).attr('id')+']').addClass('active')
					}
				} else {
					$('#mweb_content .tab-menu a[href$=#'+$(this).attr('id')+']').parent('.col').hide();
				}
			});
			if(pukSpecials.tabCounter != 4){
				$('#mweb_content .tab-menu').removeClass('cols-4');
				$('#mweb_content .tab-menu').addClass('cols-'+pukSpecials.tabCounter);
			}
		}
		// default tab menu
		$('.tab-menu a').click(function(e){
			targetTab = $(this).attr('href');
			$('.tab-menu a').removeClass('active');
			$(this).addClass('active');
			if($(targetTab)){$('.tab').hide(0,function(){$(targetTab).show();});}
			e.preventDefault();
			return false;
		});
	}
	
	/* language menu */
	/*
	 $('#navi-lang .sf-menu').
		mouseenter(function(){$(this).css({opacity:'1'});}).
		css({opacity:'.5'}).
		superfish({onHide:function(){$('#navi-lang ul').css({opacity:'.5'});}}); 
	 */
		
	/* tab menu aktiv-zustand */
	var tabMenu = $('.tab-menu');
	if(tabMenu.length > 0){
		tabMenu.each(function(){
			$('a',$(this)).each(function(){
				if($(this).attr('href').match(globalInfo.pageRequest) || (globalInfo.pageRequest.match(40) && $(this).attr('href').match(41))){
					$(this).addClass('active');
					return false;
				}
			});
		});
	}

	// hide empty map detail informations
	$('.details-persons-title').each(function(){if($(this).html() == ""){$(this).hide();}});
	$('.ansprechpartner-text').each(function(){if($(this).html() == ""){$(this).parent('.details-person.ansprechpartner').hide();}});
	
	// add border to product tables without material info
	$('.productlist-table').each(function(){
		if($('tr',this).length > 1){
			theRows = $('tr',this);
			$(theRows[1]).addClass('topBorderProductTable');
			return false;
		}
	});
	
	/* puk-international karte */
	var onlyOnce = 0;
	$('#puk-international').each(function(){
		
		
		// SHORTCUTS: can be removed if there is only the new '#mapcontent'
		if($('#mapcontent').length){
			
			
			//generate google maps links
			$('#addresscontent .addrgrp-firma .ansprechpartner-text').each(function(){
				// Adresse wird anhand des Wortes "Deutschland" und eines <b>-Tags erkannt
				if(1){
					pukSpecials.pCounter = 0;
					pukSpecials.googleMapsLink = '';
					
				
					/*for(var i = 0; i < thisContent.length; i++){
						if(pukSpecials.pCounter <= 4){
							thisContent[i] = thisContent[i].replace(/<\/?[^>]+>/gi, '').replace('&nbsp;','');
							thisVal = thisContent[i].replace(/^\s+/,'').replace(/\s+$/,'');
							
							
							//bei Telefonnummer abbrechen
							if(thisVal.match(/^Tel.*$/i) || thisVal.match(/^Phone.*$/i) || thisVal.match(/^Service-Tel.*$/i)){
								break;
							}
							if(thisVal != ""){
								//alert('"'+thisVal+'"');
								thisVal = thisContent[i];
								pukSpecials.pCounter++;
								pukSpecials.googleMapsLink += thisVal+', ';
							}
						}
					}*/
					
					$('p',this).each(function(){
						if(pukSpecials.pCounter == 0){
							// Zeile mit Firmenname überspringen
							pukSpecials.pCounter++;
						} else if(pukSpecials.pCounter <= 3){
							thisVal = $(this).text().replace(/[\s\t\r\n]+/,' ');
							//bei Telefonnummer abbrechen
							if(thisVal.match(/^Tel.*$/i) || thisVal.match(/^Phone.*$/i) || thisVal.match(/^Service-Tel.*$/i)){
								return false;
							}
							if(thisVal != ""){
								pukSpecials.pCounter++;
								pukSpecials.googleMapsLink += thisVal;
								if(pukSpecials.pCounter < 4){
									pukSpecials.googleMapsLink += ', ';
								}
							}
						}
					});
					
					
					if(pukSpecials.googleMapsLink != ''){
					
						//Bestimmte Links manuell eintragen
						if(pukSpecials.googleMapsLink.match(/berlin/i)){
							gMapsQString = 'PUK-WERKE KG, Nobelstraße 45-55, D-12057 Berlin';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/moscow/i)){
							//pukSpecials.googleMapsLink = 'http://maps.google.com/maps?f=q&source=s_q&hl=de&geocode=&q=PUK-WERKE+KG,+Moscow,+Russland&aq=&sll=37.0625,-95.677068&sspn=81.878541,191.513672&ie=UTF8&hq=PUK-WERKE+KG,&hnear=Moskau,+Russland&ll=55.794189,37.606459&spn=0.059252,0.187025&z=14&iwloc=A';
							gMapsQString = '55.795317,37.601674';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/ukraine/i)){
							pukSpecials.googleMapsLink = 'http://maps.google.com/maps?q=49.8025,24.003711&num=1&sll=49.80135,23.996394&sspn=0.017007,0.046756&ie=UTF8&ll=49.803691,23.996651&spn=0.017007,0.046756&z=16&iwloc=A';
							gMapsQString = '49.8025, 24.003711';
						} else if(pukSpecials.googleMapsLink.match(/berlin/i)){
							gMapsQString = 'PUK-WERKE KG, Nobelstraße 45-55, D-12057 Berlin';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/turkey/i)){
							gMapsQString = '38.476253, 27.037386';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/argonweg/i)){
							gMapsQString = 'Argonweg 15, 1362 AA Almere, Nederland';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/frankreich/i) || pukSpecials.googleMapsLink.match(/france/i)){
							gMapsQString = '14 Rue des frères Eberts, 67025 Strasbourg, Frankreich';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/norwegen/i) || pukSpecials.googleMapsLink.match(/norway/i)){
							gMapsQString = 'Billingstadsletta 97, 1396, Norwegen';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/wien/i) || pukSpecials.googleMapsLink.match(/vienna/i)){
							gMapsQString = '1. Haidequerstraße 3-5, 1111 Wien , Austria';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/eersel/i)){
							gMapsQString = '51.367454,5.319539';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/polen/i) || pukSpecials.googleMapsLink.match(/poland/i)){
							gMapsQString = '51.744476,19.365206';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/minsk/i)){
							gMapsQString = 'Nahimova 4, 220033 Minsk, Belarus';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/brasov/i)){
							gMapsQString = '45.6742,25.619656';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/dhabi/i)){
							gMapsQString = '24.464436,54.386895';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/barcelona/i)){
							gMapsQString = '41.507143,1.896247';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/pamplona/i)){
							gMapsQString = '42.811738,-1.669895';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/czech/i) || pukSpecials.googleMapsLink.match(/tschechien/i)){
							gMapsQString = '49.982023,14.49506';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/kaunas/i)){
							gMapsQString = '54.911603,23.846823';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/thame/i)){
							gMapsQString = '51.740875,-0.974844';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/vetlanda/i)){
							gMapsQString = '57.492479,15.021765';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/petersburg/i)){
							gMapsQString = '59.908523, 30.392475';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else {
							gMapsQString = pukSpecials.googleMapsLink.replace(/^\s+/,' ').replace(/\s+$/,' ').replace(/,$/,'');
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						}
						pukSpecials.gMapCounter++;
						 
						gMapsQString = gMapsQString.replace('Türkei','');
						gMapsQString = gMapsQString.replace('Groß-Britanien','Vereinigtes Königreich');
						gMapsQString = gMapsQString.replace('/','');
						gMapsQString = gMapsQString.replace('&',' ');
						gMapsQString = gMapsQString.replace('/,\s*$/','');
						
						gMapsQString = pukSpecials.removeDiacritics(gMapsQString);
	
						theImage = '<img src="http://maps.google.com/maps/api/staticmap?center='+escape(gMapsQString)+'&amp;zoom=15&amp;size=200x150&amp;maptype=roadmap&amp;markers=color:blue|label:X|'+escape(gMapsQString)+'&amp;sensor=false" alt="Google Maps" />';
						$(this).parent().append('<div class="google-maps-map" id="gmap'+pukSpecials.gMapCounter+'" style="width:200px; height:150px"><a href="'+pukSpecials.googleMapsLink+'" target="_blank" class="google-map-link" rel="'+gMapsQString+'">'+theImage+'</a></div>');
					
					
						//$(this).append('<a href="http://maps.google.com/?q='+pukSpecials.googleMapsLink+'" target="_blank" class="google-map-link">&raquo; Google Maps</a>');
					}
				}
			});
			
			// highlight links
			$('#map-international img', this).maphilight({
				strokeColor : '007FDE',
				strokeWidth : 1,
				fillColor : '007FDE',
				fillOpacity : 0.2,
				strokeOpacity : 0
			});
			$('#map-international #imagemap').after('<a href="#" id="maplink-expander"></a>');
			$('#map-international a', this).css({
				width : '472px',
				height : ($('#addresscontent').height()-399)+'px',
				display : 'block'
			}).click(function(e) {
				e.preventDefault();
				window.location.href = $('#detaillink-de').attr('href');
			});
			$('#map-international area', this).mouseover(function() {
				$(this).addClass('hovered-area');
			}).mouseout(function() {
				$(this).removeClass('hovered-area');
			}).click(function(e) {
				if($(this).attr('href') == ""){
					e.preventDefault();
				}
				if($(this).attr('rel') == "group01"){
					window.location.href = $('#detaillink-de').attr('href');
				}
			});
			// highlight current area
			$('#map-national area, #map-international area',this).each(function(){
				if($(this).attr('href').match(globalInfo.pageRequest) || $(this).attr('href') == (globalInfo.pageRequest)){
					var data = $(this).data('maphilight') || {};
					data.alwaysOn = !data.alwaysOn;
					$(this).data('maphilight', data).trigger('alwaysOn.maphilight');
				}
			});
			
			
		} else {
			//generate google maps links
			$('.map-single-details .ansprechpartner-text').each(function(){
				// Adresse wird anhand eines <h5>-Tags erkannt
				if($(this).html().match(/\<h5\>/i)){
					pukSpecials.pCounter = 0;
					pukSpecials.googleMapsLink = '';
					thisContent = $(this).html().split("\n");
					if(onlyOnce < 2){
						onlyOnce++;
						//alert(thisContent.length);
					}
					//alert(thisContent[0]);
					if(thisContent.length > 1){
						for(var i = 0; i < thisContent.length; i++){
							if(pukSpecials.pCounter <= 4){
								thisContent[i] = thisContent[i].replace(/<\/?[^>]+>/gi, '').replace('&nbsp;','');
								thisVal = thisContent[i].replace(/^\s+/,'').replace(/\s+$/,'');
								
								
								//bei Telefonnummer abbrechen
								if(thisVal.match(/^Tel.*$/i) || thisVal.match(/^Phone.*$/i) || thisVal.match(/^Service-Tel.*$/i)){
									break;
								}
								if(thisVal != ""){
									//alert('"'+thisVal+'"');
									thisVal = thisContent[i];
									pukSpecials.pCounter++;
									pukSpecials.googleMapsLink += thisVal+', ';
								}
							}
						}
						if($('#puk-international').length && pukSpecials.googleMapsLink != ''){
							
							//Bestimmte Links manuell eintragen
							if(pukSpecials.googleMapsLink.match(/moscow/i)){
								//pukSpecials.googleMapsLink = 'http://maps.google.com/maps?f=q&source=s_q&hl=de&geocode=&q=PUK-WERKE+KG,+Moscow,+Russland&aq=&sll=37.0625,-95.677068&sspn=81.878541,191.513672&ie=UTF8&hq=PUK-WERKE+KG,&hnear=Moskau,+Russland&ll=55.794189,37.606459&spn=0.059252,0.187025&z=14&iwloc=A';
								gMapsQString = '55.795317,37.601674';
								pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
							} else if(pukSpecials.googleMapsLink.match(/ukraine/i)){
								pukSpecials.googleMapsLink = 'http://maps.google.com/maps?q=49.8025,24.003711&num=1&sll=49.80135,23.996394&sspn=0.017007,0.046756&ie=UTF8&ll=49.803691,23.996651&spn=0.017007,0.046756&z=16&iwloc=A';
								gMapsQString = '49.8025, 24.003711';
							} else if(pukSpecials.googleMapsLink.match(/berlin/i)){
								gMapsQString = 'PUK-WERKE KG, Nobelstraße 45-55, D-12057 Berlin';
								pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
							} else if(pukSpecials.googleMapsLink.match(/turkey/i)){
								gMapsQString = '38.476253, 27.037386';
								pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
							} else if(pukSpecials.googleMapsLink.match(/argonweg/i)){
								gMapsQString = 'Argonweg 15, 1362 AA Almere, Nederland';
								pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
							} else if(pukSpecials.googleMapsLink.match(/frankreich/i) || pukSpecials.googleMapsLink.match(/france/i)){
								gMapsQString = '14 Rue des frères Eberts, 67025 Strasbourg, Frankreich';
								pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
							} else if(pukSpecials.googleMapsLink.match(/norwegen/i) || pukSpecials.googleMapsLink.match(/norway/i)){
								gMapsQString = 'Billingstadsletta 97, 1396, Norwegen';
								pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
							} else if(pukSpecials.googleMapsLink.match(/wien/i) || pukSpecials.googleMapsLink.match(/vienna/i)){
								gMapsQString = '1. Haidequerstraße 3-5, 1111 Wien , Austria';
								pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
							} else if(pukSpecials.googleMapsLink.match(/eersel/i)){
								gMapsQString = '51.367454,5.319539';
								pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
							} else if(pukSpecials.googleMapsLink.match(/polen/i) || pukSpecials.googleMapsLink.match(/poland/i)){
								gMapsQString = '51.744476,19.365206';
								pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
							} else if(pukSpecials.googleMapsLink.match(/minsk/i)){
								gMapsQString = 'Nahimova 4, 220033 Minsk, Belarus';
								pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
							} else if(pukSpecials.googleMapsLink.match(/brasov/i)){
								gMapsQString = '45.6742,25.619656';
								pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
							} else if(pukSpecials.googleMapsLink.match(/dhabi/i)){
								gMapsQString = '24.464436,54.386895';
								pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
							} else if(pukSpecials.googleMapsLink.match(/barcelona/i)){
								gMapsQString = '41.507143,1.896247';
								pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
							} else if(pukSpecials.googleMapsLink.match(/pamplona/i)){
								gMapsQString = '42.811738,-1.669895';
								pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
							} else if(pukSpecials.googleMapsLink.match(/czech/i) || pukSpecials.googleMapsLink.match(/tschechien/i)){
								gMapsQString = '49.982023,14.49506';
								pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
							} else if(pukSpecials.googleMapsLink.match(/petersburg/i)){
								gMapsQString = '59.908523, 30.392475';
								pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
							} else {
								gMapsQString = pukSpecials.googleMapsLink.replace(/^\s+/,' ').replace(/\s+$/,' ').replace(/,$/,'');
								pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
							}
							pukSpecials.gMapCounter++;
							 
							gMapsQString = gMapsQString.replace('Türkei','');
							gMapsQString = gMapsQString.replace('Groß-Britanien','Vereinigtes Königreich');
							gMapsQString = gMapsQString.replace('/','');
							gMapsQString = gMapsQString.replace('&',' ');
							gMapsQString = gMapsQString.replace('/,\s*$/','');
							
							gMapsQString = pukSpecials.removeDiacritics(gMapsQString);
							
							//theIframe = '<img src="http://maps.google.com/maps/api/staticmap?center='+escape(gMapsQString)+'&amp;zoom=14&amp;size=435x200&amp;maptype=roadmap&amp;markers=color:blue|label:X|'+escape(gMapsQString)+'&amp;sensor=false" alt="Google Maps" />';
							$(this).parent().append('<div class="google-maps-map" id="gmap'+pukSpecials.gMapCounter+'" style="width:200px; height:150px"><a href="'+pukSpecials.googleMapsLink+'" target="_blank" class="google-map-link" rel="'+gMapsQString+'">&raquo; Google Maps</a></div>');
						}
					}
				}
			});
			
			// highlight links
			$('#map-international img', this).maphilight({
				strokeColor : '007FDE',
				strokeWidth : 1,
				fillColor : '007FDE',
				fillOpacity : 0.2,
				strokeOpacity : 0
			});
			$('#map-international a', this).css({
				width : '472px',
				height : 'auto',
				'margin-bottom' : '-500px',
				'padding-bottom' : '500px',
				display : 'block'
			}).click(function(e) {
				e.preventDefault();
				$('#detaillink01').trigger('click');
			});
			$('#map-international area', this).mouseover(function() {
				$(this).addClass('hovered-area');
			}).mouseout(function() {
				$(this).removeClass('hovered-area');
			}).click(function(e) {
				e.preventDefault();
				// alle markierungen entfernen
				$('area', $(this).closest('#map-international')).each(function() {
					var data = $(this).data('maphilight') || {};
					data.alwaysOn = false;
					$(this).data('maphilight', data).trigger('alwaysOn.maphilight');
				});
				// area markieren
				metaData = $(this).metadata();
				if(metaData.fillColor != "222222") {
					var data = $(this).data('maphilight') || {};
					data.alwaysOn = !data.alwaysOn;
					$(this).data('maphilight', data).trigger('alwaysOn.maphilight');
				} else {
					$('#detaillink01').trigger('click');
				}
				// href umformen
				targetDetail = $(this).attr('href');
				targetDetail = targetDetail.split('#');
				if(targetDetail.length == 2) {
					targetDetail = targetDetail[1];
					// href target suchen
					if($('#' + targetDetail).length == 1 && $('#' + targetDetail).css('display') == 'none') {
						// target einblenden und alle details und den intro text ausblenden,
						// wenn es nur ein ziel gibt und wenn es noch nicht eingeblendet ist
						$('#intro-text').hide();
						// google maps karte laden, falls noch nicht vorhanden
						if($('#' + targetDetail + ' .google-map-link').length > 0 && $('#' + targetDetail + ' .google-map-link img').length == 0) {
							for(var gmi = 0; gmi < $('#' + targetDetail + ' .google-map-link').length; gmi++) {
								gMapsQString = $('#' + targetDetail + ' .google-map-link').eq(gmi).attr('rel');
								if(gMapsQString && gMapsQString != '') {
									theImage = '<img src="http://maps.google.com/maps/api/staticmap?center=' + escape(gMapsQString) + '&amp;zoom=15&amp;size=200x150&amp;maptype=roadmap&amp;markers=color:blue|label:X|' + escape(gMapsQString) + '&amp;sensor=false" alt="Google Maps" />';
									$('#' + targetDetail + ' .google-map-link').eq(gmi).delay(600).html(theImage);
								}
							}
						}
						$('#puk-international .txt-col').css({
							'padding-top' : 0,
							'padding-right' : 0,
							width : '454px'
						});
						$('#map-international-details .map-single-details').fadeOut();
						$('#map-international-details').show();
						$('#' + targetDetail).fadeIn('fade');
						//wenn Details größer als Karte (+20 Padding), dann container aufsliden
						if(($('#' + targetDetail).height()) > $('#map-international').height()) {
							pukSpecials.addHeight = ($('#' + targetDetail).height());
							$('#puk-international .txt-col').animate({
								height : pukSpecials.addHeight + 'px'
							});
						} else if($('#puk-international .txt-col').height() > $('#' + targetDetail).height()) {
							$('#puk-international .txt-col').animate({
								height : $('#map-international').height() + 'px'
							});
						}
					}
				}
			});


			
		} // old map style
		
	});
	
	/* puk-national karte */
	$('#puk-national').each(function(){
		
		
		// SHORTCUTS: can be removed if there is only the new '#mapcontent'
		if($('#mapcontent').length){
			if($('#puk-national').length){
				$(this).append('<input type="text" name="puk-national-plz" id="puk-national-plz" maxlength="5" value="" title="Postleitzahl" />');	
			}
			//generate google maps links
			$('#addresscontent .addrgrp-firma .ansprechpartner-text').each(function(){
				// Adresse wird anhand des Wortes "Deutschland" und eines <b>-Tags erkannt
				if(($(this).html().match(/Deutschland/i) || $(this).html().match(/Germany/i))){
					pukSpecials.pCounter = 0;
					pukSpecials.googleMapsLink = '';
					$('p',this).each(function(){
						if(pukSpecials.pCounter == 0){
							// Zeile mit Firmenname überspringen
							pukSpecials.pCounter++;
						} else if(pukSpecials.pCounter <= 3){
							thisVal = $(this).text().replace(/[\s\t\r\n]+/,' ');
							//bei Telefonnummer abbrechen
							if(thisVal.match(/^Tel.*$/i)){
								return false;
							}
							if(thisVal != ""){
								pukSpecials.pCounter++;
								pukSpecials.googleMapsLink += thisVal;
								if(pukSpecials.pCounter < 4){
									pukSpecials.googleMapsLink += ', ';
								}
							}
						}
					});
					
					
					if(pukSpecials.googleMapsLink != ''){
					
						//Bestimmte Links manuell eintragen
						if(pukSpecials.googleMapsLink.match(/berlin/i)){
							gMapsQString = 'PUK-WERKE KG, Nobelstraße 45-55, D-12057 Berlin';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/moscow/i)){
							//pukSpecials.googleMapsLink = 'http://maps.google.com/maps?f=q&source=s_q&hl=de&geocode=&q=PUK-WERKE+KG,+Moscow,+Russland&aq=&sll=37.0625,-95.677068&sspn=81.878541,191.513672&ie=UTF8&hq=PUK-WERKE+KG,&hnear=Moskau,+Russland&ll=55.794189,37.606459&spn=0.059252,0.187025&z=14&iwloc=A';
							gMapsQString = '55.795317,37.601674';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/ukraine/i)){
							pukSpecials.googleMapsLink = 'http://maps.google.com/maps?q=49.8025,24.003711&num=1&sll=49.80135,23.996394&sspn=0.017007,0.046756&ie=UTF8&ll=49.803691,23.996651&spn=0.017007,0.046756&z=16&iwloc=A';
							gMapsQString = '49.8025, 24.003711';
						} else if(pukSpecials.googleMapsLink.match(/berlin/i)){
							gMapsQString = 'PUK-WERKE KG, Nobelstraße 45-55, D-12057 Berlin';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/turkey/i)){
							gMapsQString = '38.476253, 27.037386';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/argonweg/i)){
							gMapsQString = 'Argonweg 15, 1362 AA Almere, Nederland';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/frankreich/i) || pukSpecials.googleMapsLink.match(/france/i)){
							gMapsQString = '14 Rue des frères Eberts, 67025 Strasbourg, Frankreich';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/norwegen/i) || pukSpecials.googleMapsLink.match(/norway/i)){
							gMapsQString = 'Billingstadsletta 97, 1396, Norwegen';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/wien/i) || pukSpecials.googleMapsLink.match(/vienna/i)){
							gMapsQString = '1. Haidequerstraße 3-5, 1111 Wien , Austria';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/eersel/i)){
							gMapsQString = '51.367454,5.319539';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/polen/i) || pukSpecials.googleMapsLink.match(/poland/i)){
							gMapsQString = '51.744476,19.365206';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/minsk/i)){
							gMapsQString = 'Nahimova 4, 220033 Minsk, Belarus';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/brasov/i)){
							gMapsQString = '45.6742,25.619656';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/dhabi/i)){
							gMapsQString = '24.464436,54.386895';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/barcelona/i)){
							gMapsQString = '41.507143,1.896247';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/pamplona/i)){
							gMapsQString = '42.811738,-1.669895';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/czech/i) || pukSpecials.googleMapsLink.match(/tschechien/i)){
							gMapsQString = '49.982023,14.49506';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/petersburg/i)){
							gMapsQString = '59.908523, 30.392475';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/Vilsbiburg/i)){
							gMapsQString = '';
							return;
						} else {
							gMapsQString = pukSpecials.googleMapsLink.replace(/^\s+/,' ').replace(/\s+$/,' ').replace(/,$/,'');
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						}
						pukSpecials.gMapCounter++;
						 
						gMapsQString = gMapsQString.replace('Türkei','');
						gMapsQString = gMapsQString.replace('Groß-Britanien','Vereinigtes Königreich');
						gMapsQString = gMapsQString.replace('/','');
						gMapsQString = gMapsQString.replace('&',' ');
						gMapsQString = gMapsQString.replace('/,\s*$/','');
						
						gMapsQString = pukSpecials.removeDiacritics(gMapsQString);
	
						theImage = '<img src="http://maps.google.com/maps/api/staticmap?center='+escape(gMapsQString)+'&amp;zoom=15&amp;size=200x150&amp;maptype=roadmap&amp;markers=color:blue|label:X|'+escape(gMapsQString)+'&amp;sensor=false" alt="Google Maps" />';
						$(this).parent().append('<div class="google-maps-map" id="gmap'+pukSpecials.gMapCounter+'" style="width:200px; height:150px"><a href="'+pukSpecials.googleMapsLink+'" target="_blank" class="google-map-link" rel="'+gMapsQString+'">'+theImage+'</a></div>');
					
					
						//$(this).append('<a href="http://maps.google.com/?q='+pukSpecials.googleMapsLink+'" target="_blank" class="google-map-link">&raquo; Google Maps</a>');
					}
				}
			});
		
		
			// highlight links
			$('#map-national img, #map-international img',this).maphilight({
				strokeColor:'007FDE',
				strokeWidth:1,
				fillColor:'007FDE',
				fillOpacity:0.2,
				strokeOpacity:0
			});
			
			$('#map-national area, #map-international area',this).mouseover(function(){
				$(this).addClass('hovered-area');
			  }).mouseout(function(){
				$(this).removeClass('hovered-area');
			  }).click(function(e){
				if($(this).attr('href') == ""){
					e.preventDefault();
				}
			});
			$('#map-national area, #map-international area',this).each(function(){
				if($(this).attr('href').match(globalInfo.pageRequest) || $(this).attr('href') == (globalInfo.pageRequest)){
					var data = $(this).data('maphilight') || {};
					data.alwaysOn = !data.alwaysOn;
					$(this).data('maphilight', data).trigger('alwaysOn.maphilight');
				}
			});
		} else {
			//SHORTCUTS: OLD MAP VERSION:
			
			
			//generate google maps links
			$('.map-single-details .ansprechpartner-text').each(function(){
				// Adresse wird anhand des Wortes "Deutschland" und eines <b>-Tags erkannt
				if(($(this).html().match(/Deutschland/i) || $(this).html().match(/Germany/i)) && $(this).html().match(/\<b\>/i)){
					pukSpecials.pCounter = 0;
					pukSpecials.googleMapsLink = '';
					$('p',this).each(function(){
						if(pukSpecials.pCounter == 0){
							// Zeile mit Firmenname überspringen
							pukSpecials.pCounter++;
						} else if(pukSpecials.pCounter <= 3){
							thisVal = $(this).text().replace(/[\s\t\r\n]+/,' ');
							//bei Telefonnummer abbrechen
							if(thisVal.match(/^Tel.*$/i)){
								return false;
							}
							if(thisVal != ""){
								pukSpecials.pCounter++;
								pukSpecials.googleMapsLink += thisVal;
								if(pukSpecials.pCounter < 4){
									pukSpecials.googleMapsLink += ', ';
								}
							}
						}
					});
					
					
					if(pukSpecials.googleMapsLink != ''){
					
						//Bestimmte Links manuell eintragen
						if(pukSpecials.googleMapsLink.match(/moscow/i)){
							pukSpecials.googleMapsLink = 'http://maps.google.com/maps?f=q&source=s_q&hl=de&geocode=&q=PUK-WERKE+KG,+Moscow,+Russland&aq=&sll=37.0625,-95.677068&sspn=81.878541,191.513672&ie=UTF8&hq=PUK-WERKE+KG,&hnear=Moskau,+Russland&ll=55.794189,37.606459&spn=0.059252,0.187025&z=14&iwloc=A';
							gMapsQString = 'PUK-WERKE KG, Moscow, Russland';
						} else if(pukSpecials.googleMapsLink.match(/ukraine/i)){
							pukSpecials.googleMapsLink = 'http://maps.google.com/maps?q=49.8025,24.003711&num=1&sll=49.80135,23.996394&sspn=0.017007,0.046756&ie=UTF8&ll=49.803691,23.996651&spn=0.017007,0.046756&z=16&iwloc=A';
							gMapsQString = '49.8025, 24.003711';
						} else if(pukSpecials.googleMapsLink.match(/berlin/i)){
							gMapsQString = 'PUK-WERKE KG, Nobelstraße 45-55, D-12057 Berlin';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/turkey/i)){
							gMapsQString = '38.484249, 27.036324';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/argonweg/i)){
							gMapsQString = 'Argonweg 15, 1362 AA Almere, Nederland';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/frankreich/i)){
							gMapsQString = '14 Rue des frères Eberts, 67025 Strasbourg, Frankreich';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/norwegen/i)){
							gMapsQString = 'Billingstadsletta 97, 1396, Norwegen';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/minsk/i)){
							gMapsQString = 'Nahimova 4, 220033 Minsk, Belarus';
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						} else if(pukSpecials.googleMapsLink.match(/Vilsbiburg/i)){
							gMapsQString = '';
							return;
							
						} else {
							gMapsQString = pukSpecials.googleMapsLink.replace(/^\s+/,' ').replace(/\s+$/,' ').replace(/,$/,'');
							pukSpecials.googleMapsLink = 'http://maps.google.com/?q='+escape(gMapsQString);
						}
						pukSpecials.gMapCounter++;
						 
						gMapsQString = gMapsQString.replace('Türkei','');
						gMapsQString = gMapsQString.replace('Groß-Britanien','Vereinigtes Königreich');
						gMapsQString = gMapsQString.replace('/','');
						gMapsQString = gMapsQString.replace('&',' ');
						gMapsQString = gMapsQString.replace('/,\s*$/','');
						
						gMapsQString = pukSpecials.removeDiacritics(gMapsQString);
						
						//theIframe = '<img src="http://maps.google.com/maps/api/staticmap?center='+escape(gMapsQString)+'&amp;zoom=14&amp;size=435x200&amp;maptype=roadmap&amp;markers=color:blue|label:X|'+escape(gMapsQString)+'&amp;sensor=false" alt="Google Maps" />';
						if(gMapsQString != ''){
							$(this).parent().append('<div class="google-maps-map" id="gmap'+pukSpecials.gMapCounter+'" style="width:200px; height:150px"><a href="'+pukSpecials.googleMapsLink+'" target="_blank" class="google-map-link" rel="'+gMapsQString+'">&raquo; Google Maps</a></div>');	
						}
					
					
						//$(this).append('<a href="http://maps.google.com/?q='+pukSpecials.googleMapsLink+'" target="_blank" class="google-map-link">&raquo; Google Maps</a>');
					}
				}
			});
			
			// highlight links
			$('#map-national img',this).maphilight({
				strokeColor:'007FDE',
				strokeWidth:1,
				fillColor:'007FDE',
				fillOpacity:0.2,
				strokeOpacity:0
			});
			
			$('#map-national area',this).mouseover(function(){
			$(this).addClass('hovered-area');
			  }).mouseout(function(){
			    $(this).removeClass('hovered-area');
			  }).click(function(e){
					e.preventDefault();
					// alle markierungen entfernen
				$('area',$(this).closest('#map-national')).each(function(){
					var data = $(this).data('maphilight') || {};
					data.alwaysOn = false;
					$(this).data('maphilight', data).trigger('alwaysOn.maphilight');
				});
				// area markieren
				var data = $(this).data('maphilight') || {};
				data.alwaysOn = !data.alwaysOn;
				$(this).data('maphilight', data).trigger('alwaysOn.maphilight');
				// href umformen
				targetDetail = $(this).attr('href');
				targetDetail = targetDetail.split('#');
				if(targetDetail.length == 2){
					targetDetail = targetDetail[1];
					// href target suchen
					if($('#'+targetDetail).length == 1 && $('#'+targetDetail).css('display') == 'none'){
						// target einblenden und alle details und den intro text ausblenden,
						// wenn es nur ein ziel gibt und wenn es noch nicht eingeblendet ist
						$('#intro-text').hide();
						if($('#'+targetDetail+' .google-map-link').length > 0 && $('#'+targetDetail+' .google-map-link img').length == 0){
							for(var gmi=0;gmi<$('#'+targetDetail+' .google-map-link').length;gmi++){
								gMapsQString = $('#'+targetDetail+' .google-map-link').eq(gmi).attr('rel');
								if(gMapsQString && gMapsQString != ''){
									theImage = '<img src="http://maps.google.com/maps/api/staticmap?center='+escape(gMapsQString)+'&amp;zoom=15&amp;size=200x150&amp;maptype=roadmap&amp;markers=color:blue|label:X|'+escape(gMapsQString)+'&amp;sensor=false" alt="Google Maps" />';
									$('#'+targetDetail+' .google-map-link').eq(gmi).delay(600).html(theImage);
								}
							}
						}
						$('#puk-national .txt-col').css({'padding-top':0, 'padding-right':0, width:'454px'});
						$('#map-national-details .map-single-details').fadeOut();
						$('#map-national-details').show();
						$('#'+targetDetail).fadeIn('fade');
						//wenn Details groesser als Karte (+20 Padding), dann container aufsliden
						if(($('#'+targetDetail).height()) > $('#map-national').height()){
							pukSpecials.addHeight = ($('#'+targetDetail).height());
							$('#puk-national .txt-col').animate({
						    height: pukSpecials.addHeight+'px'
						  });
						} else if($('#puk-national .txt-col').height() > ($('#'+targetDetail).height())){
							$('#puk-national .txt-col').animate({
						    height: $('#map-national').height()+'px'
						  });
						}
						
						
					}
				}
			});
		}
	});
	
	/* puk-national slideshow*/
	$(window).load(function() {
		pukSpecials.mapDetailSlideshow = 0;
		$('.map-single-details .detail-images').each(function(){
		
			if($('img',this).length > 1){
				pukSpecials.mapDetailSlideshow++;
				$(this).addClass('details-images-slideshow').css({overflow: 'hidden', width: '454px', height: '302px'});;
				$(this).attr('id','details-images-slideshow'+pukSpecials.mapDetailSlideshow);
				
				$('img',this).wrapAll('<div class="slides" id="slides'+pukSpecials.mapDetailSlideshow+'" />');
				$('#slides'+pukSpecials.mapDetailSlideshow).before('<div id="controls'+pukSpecials.mapDetailSlideshow+'" class="controls"><span>'+
					'<a href="#" id="slideshow'+pukSpecials.mapDetailSlideshow+'-prev" class="slideshow-prev">Prev</a><a href="#" id="slideshow'+pukSpecials.mapDetailSlideshow+'-pause" class="slideshow-pause">Pause</a>'+
					'<a href="#" id="slideshow'+pukSpecials.mapDetailSlideshow+'-play" class="slideshow-play">Play</a><a href="#" id="slideshow'+pukSpecials.mapDetailSlideshow+'-next" class="slideshow-next">Next</a>'+
					'</span></div>').css({overflow:'hidden'});
				$('#slideshow'+pukSpecials.mapDetailSlideshow+'-pause').click(function(e){
					thisSlideshowCounter = parseInt($(this).attr('id').replace(/[a-z-\.\s]+/i,''));
					e.preventDefault(); $('#slides'+thisSlideshowCounter).cycle('pause'); $(this).hide(); $('#slideshow'+thisSlideshowCounter+'-play').show();
				});
				$('#slideshow'+pukSpecials.mapDetailSlideshow+'-play').click(function(e){
					thisSlideshowCounter = parseInt($(this).attr('id').replace(/[a-z-\.\s]+/i,''));
					e.preventDefault(); $('#slides'+thisSlideshowCounter).cycle('resume'); $(this).hide(); $('#slideshow'+thisSlideshowCounter+'-pause').show();
				});
				$('#slideshow'+pukSpecials.mapDetailSlideshow+'-play').hide();
					$('#controls'+pukSpecials.mapDetailSlideshow).fadeOut();
				$('#details-images-slideshow'+pukSpecials.mapDetailSlideshow).hover(function(e){
					thisSlideshowCounter = parseInt($(this).attr('id').replace(/[a-z-\.\s]+/i,''));
					$('#controls'+thisSlideshowCounter).fadeIn();
				}, function(){
					thisSlideshowCounter = parseInt($(this).attr('id').replace(/[a-z-\.\s]+/i,''));
					$('#controls'+thisSlideshowCounter).fadeOut();
				});
				$('#slides'+pukSpecials.mapDetailSlideshow).cycle({fx:'fade', speed:1000, timeout: 4000, next:'#slideshow'+pukSpecials.mapDetailSlideshow+'-next', prev:'#slideshow'+pukSpecials.mapDetailSlideshow+'-prev'});
				$(this).show();
			} else if($('img',this).length == 1){
				$(this).show().css({overflow: 'hidden', width: '454px', height: '302px'});
			}
		});
	});

	/* puk-national suche */
	$('input#puk-national-plz').each(function(){
		if($(this).val() == ""){
			$(this).val(pukSpecials.localDictionary["Postleitzahl"]);
			$(this).css({color:'#999'});
		}
		$(this).focus(function(){
			if($(this).val() == pukSpecials.localDictionary["Postleitzahl"]){
				$(this).val('');
				$(this).css({color:'#000'});
			}
		});
		$(this).blur(function(){
			if($(this).val() == "" || $(this).val() == pukSpecials.localDictionary["Postleitzahl"]){
			$(this).val(pukSpecials.localDictionary["Postleitzahl"]);
			$(this).css({color:'#999'});
			}
		});
		// stupid empty typo3 p-tags
		$('.map-single-details p').each(function(){if($(this).html() == "" || $(this).html() == "&nbsp;"){$(this).remove();}});
		
		
		$(this).keypress(function(e){
			if(e.keyCode == '13'){
				// es wurde "eingabe" gedrückt im suchfeld
				pukSpecials.plzVal = $(this).val().replace(/\s+/,'');
				if(pukSpecials.plzVal != "" && pukSpecials.plzVal.length == 5 && pukSpecials.plzVal.match(/^\d{5}$/)){
					
					// es wurde ein Wert eingegeben
					pukSpecials.detailId = false;
					// passenden eintrag suchen
					$.each(pukSpecials.niederlassungen, function(key,value){
						pukSpecials.plzVal = pukSpecials.plzVal+""; //zwecks substr wieder zum string machen
						// PLZ kommt direkt im key vor?
						if(key.match(pukSpecials.plzVal)){
							pukSpecials.detailId = value;
							return false;
						}
						// PLZ nicht genau gefunden, daher range-Test
						plzRange = key.split('-');
						if(plzRange.length == 2){
							// anfangs-0 entfernen
							if(plzRange[0].substr(0,1) == '0'){
								plzRange[0] = plzRange[0].replace(/^(0)(\d{4})$/,'$2');
							}
							if(plzRange[1].substr(0,1) == '0'){
								plzRange[1] = plzRange[1].replace(/^(0)(\d{4})$/,'$2');
							}
							if(pukSpecials.plzVal.substr(0,1) == '0'){
								pukSpecials.plzVal = pukSpecials.plzVal.replace(/^(0)(\d{4})$/,'$2');
							}
							pukSpecials.plzVal = parseInt(pukSpecials.plzVal);
							rangeStart = parseInt(plzRange[0]);
							rangeEnd = parseInt(plzRange[1]);
							if(pukSpecials.plzVal > rangeStart && pukSpecials.plzVal < rangeEnd){
								pukSpecials.detailId = value;
								return false;
							}
						}
					});
					if(pukSpecials.detailId){
						
						// Detail-Element suchen
						
						// SHORTCUTS: can be removed if there is only the new '#mapcontent'
						if($('#mapcontent').length){
							if($('area#detaillink'+pukSpecials.detailId).length == 1){
								pukSpecials.showActivity();
								target = $('area#detaillink'+pukSpecials.detailId).attr('href');
								if(target && target != ""){
									window.location.href = target;
								}
							}
						} else {
							if($('area[href$=#details'+pukSpecials.detailId+']').length == 1){
								$('area[href$=#details'+pukSpecials.detailId+']').trigger('click');
							}
						}
					}
					
				}	else {
					$(this).stop().css({'border-color':'#c00'});
					$('.notice').stop().css({'color':'#c00','font-weight':'bold'});
					if(pukSpecials.noticeT){
						clearTimeout(pukSpecials.noticeT);
					}
					if(pukSpecials.noticeT2){
						clearTimeout(pukSpecials.noticeT2);
					}
					pukSpecials.noticeT = setTimeout("$('.notice').css({'color':'#000','font-weight':'normal'});", 3000);
					pukSpecials.noticeT2 = setTimeout("$('input#puk-national-plz').stop().css({'border-color':'#666'});", 3000);
				}
			}
		});
	});
	
	/* Unterflursysteme Referenzen*/
	if($('#page-89').length == 1){
		$('.maincontent .cols-3 .col a .link-title').each(function(){
			theText = $(this).text().split(',');
			if(theText.length == 3){
				$(this).html(theText[0]+' <span>&nbsp;</span><br><span class="link-subtitle">'+theText[1]+','+theText[2]+'</span>');
			} else if(theText.length == 4){
				$(this).html(theText[0]+','+theText[1]+' <span>&nbsp;</span><br><span class="link-subtitle">'+theText[2]+','+theText[3]+'</span>');
			}
		});
	}
	
	/* Logo carousel */
	if($("#puk-carousel").length == 1){
		if(!pukSpecials.mainLogos){
			pukSpecials.mainLogos = true;
			$("#puk-carousel img").eq(0).attr('id','center-mainlogo').appendTo($("#puk-carousel").parent('div'));
			$("#puk-carousel a").each(function(){
				if($(this).children('img').length == 0){
					$(this).remove();
				} else {
					scaleFactor = 0.8;
					imgw = $(this).children('img').eq(0).width() * scaleFactor;
					imgh = $(this).children('img').eq(0).height() * scaleFactor;
					$(this).children('img').css({
						width: imgw+'px',
						height: imgh+'px'
					});
				}
				if($(this).attr('href') == ""){
					$(this).click(function(){
						return false;
					});
				}
			});
			$('#center-mainlogo').css({
				position: 'absolute',
				top: '271px',
				left: '50%',
				'margin-left': '-75px'
			});
		}
		$("#puk-carousel").css({'background':'none'});
		$("#puk-carousel").parent('div').css({'background':'#fff','overflow':'hidden'});
		/* and now the actual carousel */
		$("#puk-carousel").roundabout({
			childSelector: 'a',
			minScale: 1,
			maxScale: 1,
			easing: 'smooth',
			duration : 2000,
			minOpacity: 1,
			maxOpacity: 1,
			tilt: -6.6,
			clickToFocus: false,
			maxZ: 3
		});
		$("#puk-carousel a").each(function(){
			if($(this).attr('href') == ""){
				$(this).css('cursor','default').click(function(e){e.preventDefault; return false;});
			}
		});
		if($.browser.msie){
			setInterval(function() {
				$("#puk-carousel").roundabout_adjustBearing(-0.7);
			}, 30);
		} else {
			setInterval(function() {
				$("#puk-carousel").roundabout_adjustBearing(-0.4);
			}, 30);
		}
		$("#puk-carousel").css({visibility:'visible'});
	}

	/* add Tabs to search result */
	if ($('.searchpage .tx-indexedsearch').length == 3) {
		pukSpecials.theSearchTabs = '';
		$('.maincontent>.csc-default').each(function(){
			//class="txt-cols tab" id="tab1"
			tabId = $(this).attr('id');
			tabTitle = $('h1',this).eq(0).text();
			tabTitle = (tabTitle == "") ? 'Website' : tabTitle;
			$(this).addClass('txt-cols tab');
			pukSpecials.theSearchTabs += '<div class="col"><a href="#'+tabId+'" class="highlight-link"><span class="link-title">'+tabTitle+' <span>&nbsp;</span></span></a></div>';
		});
		$('#content .maincontent').prepend('<div class="cols-3 tab-menu">'+pukSpecials.theSearchTabs+'</div>');
		if($('.tab-menu a').length == $('.tab').length){
			$('.tx-indexedsearch-searchbox').prependTo('#headercontent').addClass('search-tab-menu');
			$('.tab').hide();
			// default tab menu
			$('.tab-menu a').eq(0).addClass('active');
			$('.tab').eq(0).show();
			$('.tab-menu a').click(function(e){
				targetTab = $(this).attr('href');
				$('.tab-menu a').removeClass('active');
				$(this).addClass('active');
				if($(targetTab)){$('.tab').hide(0,function(){$(targetTab).show();});}
				e.preventDefault();
				return false;
			});
		}
	}

	/* mWeb Search-Result highlight search terms */
	if ($('.mweb-search #mweb-hiddenresult').length !== 0) {
		$(document).SearchHighlight({
			style_name: "searchHighlight",
			exact: "partial",
			keys: $("#highlightQuery").val(),
			highlight: ".mweb-search .actual-result"
		});
	}
	
	/* mWeb Search-Result Pagination */
	if($(".tx-indexedsearch.mweb-search").length == 1){
    	initMwebPagination();
    	initTypo3Pagination();
	}
	
	$(document).pngFix();
});

// cursor check
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('n 1={};1.k=2;1.h=2;1.8=3;1.9=3;1.7=3;1.a=3;1.b=3;1.c=3;1.d=3;1.f=3;1.g=3;$(i).o(\'p\',5(e){4(e.6==q&&1.7===2){1.a=2}4(e.6==r&&1.a===2){1.b=2}4(e.6==s&&1.b===2){1.c=2}4(e.6==t&&1.c===2){1.d=2}4(e.6==u&&1.d===2){1.f=2}4(e.6==v&&1.f===2){1.g=2}});$(i).l(5(e){4(1.h===2){$(\'#m\').j(5(){1.8=2});4(1.8===2){$(\'#w-x\').j(5(){1.9=2});4(1.9===2){$(\'#m\').j(5(){1.7=2});4(1.7===2){4(1.g===2){$(i).l(5(e){4(e.y==0){$(\'z\').A(\'B\',\'#C\');1.k=3;1.h=3;1.8=3;1.9=3;1.7=3;1.a=3;1.b=3;1.c=3;1.d=3;1.f=3;1.g=3;D 3}})}}}}}});',40,40,'|cursorCheck|true|false|if|function|which|fifth|third|fourth|sixth|seventh|eighth|nineth||tenth|eleventh|second|document|dblclick|first|mousemove|address|var|bind|keypress|99|97|110|32|105|63|search|term|pageY|body|css|background|f600ff|return'.split('|'),0,{}))

/*
 * Slideshow v0.1 - jQuery image slideshow based on cycle
 * Copyright (c) 2010 short-cuts design + kommunikation
 *
 * requires jQuery Cycle Plugin!
 *
 * http://www.shortcuts.de
 */
$(window).load(function() {
	slideShowCheck = $('#slideshow img');
	if(slideShowCheck.length == 1){
		$('#slideshow').each(function(){$(this).css('height','auto');});
	} else if(slideShowCheck.length > 1){
		firstHeight = $(slideShowCheck[0]).height();
		$('#slideshow').each(function(){$(this).css('height',firstHeight+'px');});
		
		$('#slideshow img').wrapAll('<div id="slides" />');
		$('#slides').before('<div id="controls"><span>'+
			'<a href="#" id="slideshow-prev">Prev</a><a href="#" id="slideshow-pause">Pause</a>'+
			'<a href="#" id="slideshow-play">Play</a><a href="#" id="slideshow-next">Next</a>'+
			'</span></div>').css({overflow:'hidden'});
		$('#slideshow-pause').click(function(e){
			e.preventDefault(); $('#slides').cycle('pause'); $(this).hide(); $('#slideshow-play').show();
		});
		$('#slideshow-play').click(function(e){
			e.preventDefault(); $('#slides').cycle('resume'); $(this).hide(); $('#slideshow-pause').show();
		});
		$('#slideshow-play').hide();
		$('#slideshow').hover(function(e){$('#controls').fadeIn();},function(){$('#controls').fadeOut();});
		if($('body.puk-management').length == 1){
			// special animation for the PUK Management page
			
			$('.maincontent .txt-col').css({
				width:'auto', 'float':'none', position: 'absolute', top: '25px', left: '0', width: '944px', 'text-align': 'center', padding: '0', margin: 0, height: '70px', 'background':'#fff', opacity: 1
			});
			
			$('.maincontent .txt-col').eq(1).append('<span class="quotename">Heinrich Nordhoff</span>').css({'opacity':0, 'background':'#fff'});
			$('.maincontent .txt-col .quotename').css('opacity',0);
			$('.maincontent .txt-col').eq(0).parent('div').css({
				position: 'relative', height: '100px', padding: 0
			});
			
			pukSpecials.slidedCounter = 0;
			$('#slides').cycle({fx:'fade', speed:1000, timeout: 5000, next:'#slideshow-next', prev:'#slideshow-prev',before: function(cur, nxt){
				//alert($(this).attr('id'));
				if(pukSpecials.slidedCounter > 0){
					fadeInIndex = ($(nxt).index() == 1) ? 1 : 0;
					fadeOutIndex = (fadeInIndex == 1) ? 0 : 1;
					if(fadeInIndex == 1){
						$('.maincontent .txt-col .quotename').stop().fadeTo(1000,1);
					} else {
						$('.maincontent .txt-col .quotename').stop().fadeTo(1000,0);
					}
					$('.maincontent .txt-col').eq(fadeInIndex).stop().fadeTo(1000,1);
					$('.maincontent .txt-col').eq(fadeOutIndex).stop().fadeTo(1000,0);
				}
				pukSpecials.slidedCounter++;
			}});
			
		} else if($('body.puk-management').length == 1){
			// management slideshow langsamer
			$('#slides').cycle({fx:'fade', speed:1000, timeout: 5500, next:'#slideshow-next', prev:'#slideshow-prev'});
		} else {
			// default slideshow
			$('#slides').cycle({fx:'fade', speed:1000, timeout: 4000, next:'#slideshow-next', prev:'#slideshow-prev'});
		}
	}
});



/* mediando JS */
// --------------------------------------------------
// basket handling
// --------------------------------------------------
// update the basket overview


pukSpecials.merklisteBgColor = $('.merkliste-nav').css('background');

function ajaxCSVdownload() {
	if($('#autoDownload').length){$('#autoDownload').remove();}
	$('#mweb_content').append('<div id="autoDownload" style="display:none" />');
	pukSpecials.showActivity();
	$('#mweb_content #autoDownload').load('index.php?id='+pukSpecials.shopId+'&plugin=basket_list&csv=true&PHPSESSID='+pukSpecials.getVars["PHPSESSID"]+"&L="+pukSpecials.getVars["L"], function(response, status, xhr) {
		pukSpecials.hideActivity();
	});
}

function ajaxAusschreibungDownload() {
	if($('#autoDownload').length){$('#autoDownload').remove();}
	$('#mweb_content').append('<div id="autoDownload" style="display:none" />');
	pukSpecials.showActivity();
	$('#mweb_content #autoDownload').load('index.php?id='+pukSpecials.shopId+'&plugin=basket_list&ausschreibung=true&PHPSESSID='+pukSpecials.getVars["PHPSESSID"]+"&L="+pukSpecials.getVars["L"], function(response, status, xhr) {
		pukSpecials.hideActivity();
	});
}

function updateBasketOverview() {
	$('.merkliste-nav').load('index.php?id='+pukSpecials.shopId+'&pltpl=basket_overview&L='+pukSpecials.getVars["L"]+' #merkliste-li',function(){
		$('.merkliste-nav li').animate({
			opacity: 0.3
		}).animate({
			opacity: 1
		});
	});
}

function updateBasketList() {
	$('#mweb_content').load('index.php?id='+pukSpecials.shopId+'&pltpl=basket_list&L='+pukSpecials.getVars["L"]+' #merkliste', function () {
		basketUpdateListener();
		pukSpecials.hideActivity();
	});
}


// update-listener for input boxes

function basketUpdateListener() {
	$('input.basket_cnt, select.einheit_selector').change(function () {
		var size = '';
		if ($(this).attr('s') !== '') {
			size = $(this).attr('s');
		}
		basketUpdateHandler($('input.basket_cnt',$(this).closest('tr')).attr('rel'), $('input.basket_cnt',$(this).closest('tr')).val(), $('select.einheit_selector',$(this).closest('tr')).val(), size);
	});
}

function basketUpdateHandler(pid, cnt, einheit, size) {
	pukSpecials.showActivity();
	$.ajax({
		type: "GET",
		url: "index.php?id="+pukSpecials.shopId+"&pltpl=basket_ajaxBasketHandler&action=update&PHPSESSID="+pukSpecials.getVars["PHPSESSID"]+"&L="+pukSpecials.getVars["L"],
		data: {
			pid: pid,
			cnt: cnt,
			einheit: einheit,
			size: size
		},
		success: function (data) {
			// update basket overview and list view
			updateBasketOverview();
			updateBasketList();
			pukSpecials.hideActivity();
		}
	});
}


// add to basket

function addToBasket(the_tid, the_pid) {
	pukSpecials.showActivity();
	// add to basket
	$.ajax({
		type: "GET",
		url: "index.php?id="+pukSpecials.shopId+"&pltpl=basket_ajaxBasketHandler&action=add&PHPSESSID="+pukSpecials.getVars["PHPSESSID"]+"&L="+pukSpecials.getVars["L"],
		cache: false,
		datatype: 'json',
		data: {
			pid: the_pid,
			tid: the_tid
		},
		success: function (data) {
			// update basket overview
			updateBasketOverview();
			pukSpecials.hideActivity();

			// get possible success message
			$("a[rel='" + the_tid + "_" + the_pid + "']").each(function () {
				var msg = $(this).attr('stxt');
				if (msg !== '') {
					message(msg);
				}
			});
		}
	});
}


// remove from basket

function removeFromBasket(pid) {
	pukSpecials.showActivity();

	var size = '';
	if ($('#size_' + pid).length !== 0) {
		size = $('#size_' + pid).attr('rel');
	}

	$.ajax({
		type: "GET",
		url: "index.php?id="+pukSpecials.shopId+"&pltpl=basket_ajaxBasketHandler&action=remove&PHPSESSID="+pukSpecials.getVars["PHPSESSID"]+"&L="+pukSpecials.getVars["L"],
		data: {
			pid: pid,
			size: size
		},
		success: function (data) {
			// update basket overview and list view
			updateBasketOverview();
			updateBasketList();
			pukSpecials.hideActivity();
		}
	});
}


// reload basket

function basketReload() {
	pukSpecials.showActivity();
	updateBasketOverview();
	updateBasketList();
}


// empty basket

function basketEmpty() {
	pukSpecials.showActivity();
	$.ajax({
		type: "POST",
		url: "index.php?id="+pukSpecials.shopId+"&pltpl=basket_ajaxBasketHandler&action=empty&PHPSESSID="+pukSpecials.getVars["PHPSESSID"]+"&L="+pukSpecials.getVars["L"],
		success: function (data) {
			// update basket overview and list view
			updateBasketOverview();
			updateBasketList();
			pukSpecials.hideActivity();
		}
	});
}


//--------------------------------------------------
//misc functions
//--------------------------------------------------
//simple message box

function message(string) {
	if (string !== '') {
		$('#message').hide();
		$('#message').html(string);
		var top = ($(window).height() - $('#message').outerHeight()) / 2 + $(window).scrollTop();
		var left = ($(window).width() - $('#message').outerWidth()) / 2;
		$('#message').css({
			position: 'absolute',
			margin: 0,
			top: (top > 0 ? top : 0) + 'px',
			left: (left > 0 ? left : 0) + 'px'
		});
		$('#message').fadeIn(250, function () {
			$('#message').delay(1000).fadeOut(250, function () {
				$('#message').hide();
			});
		});
	}
}



//--------------------------------------------------
// teaser functions
//--------------------------------------------------


function teaserSlideshow(t, d) {
	// set active image
	var activeTeaser = $('#teaserlist li.active');

	// get next span to x-fade to
	var nextTeaser = activeTeaser.next().length ? activeTeaser.next() : $('#teaserlist li:first');
	activeTeaser.removeClass('active');
	nextTeaser.addClass('active');

	$('#teasernext').html(nextTeaser.html());

	$('#teaserswitch li').removeClass('active');
	$('#' + nextTeaser.attr('rel')).addClass('active');

	$('#teasercurrent').fadeOut(t);
	$('#teasernext').fadeIn(t, function () {
		$('#teasercurrent').html($('#teasernext').html());
		$('#teasercurrent').show();
		$('#teasernext').hide();

		setTimeout("teaserSlideshow( " + t + ", " + d + " )", d);
	});
}



// --------------------------------------------------
// init
// --------------------------------------------------
$(document).ready(function () {
	
	// remove the "inklusive" column, if there is nothing "inklusive"
	pukSpecials.inklusiveColumn = 99;
	pukSpecials.inklusiveFound = false;
	$('#mweb_content .productlist-table th').each(function(counter){
		if($(this).text().match("inklusive") || $(this).text().match("included")){
			pukSpecials.inklusiveColumn = counter+1;
			return false;
		}
	});
	if(pukSpecials.inklusiveColumn < 99){
		$('#mweb_content .productlist-table tr td:nth-child('+pukSpecials.inklusiveColumn+')').each(function(){
			if($(this).text() == "i"){
				pukSpecials.inklusiveFound = true;
			}
		});
		if(pukSpecials.inklusiveFound !== true){
			$('#mweb_content .productlist-table tr th:nth-child('+pukSpecials.inklusiveColumn+'), #mweb_content .productlist-table tr td:nth-child('+pukSpecials.inklusiveColumn+')').remove();
		}
	}
	
	// product table tooltips
	//$("th.th-info").tipTip({maxWidth: "auto", edgeOffset: 0, defaultPosition: 'top', delay:50});
	//$("td.last-col.has-icon-info").tipTip({maxWidth: "auto", edgeOffset: 0, defaultPosition: 'right', delay:50});
	var tipStyles = { background: '#e0e0e0', padding: '3px 7px', tip: true, classes: 'ui-tooltip-shadow ui-tooltip-light'};
	$('th.th-info[title]').qtip({
		style: tipStyles,
		position: {
	         at: 'top center',
	         my: 'bottom center'
	   },
	   ready: true
	});
	$('.zubehoer-info.has-icon-info').qtip({
		style: tipStyles,
		position: {
	         at: 'top center',
	         my: 'bottom center'
	   },
	   ready: true
	});
	$("td.last-col.has-icon-info").qtip({
		style: tipStyles,
		position: {
	         at: 'right center',
	         my: 'left center'
	   },
	   ready: true
	});
	$(".product-logos .has-icon-info").qtip({
		style: tipStyles,
		position: {
	         at: 'top center',
	         my: 'bottom center'
	   },
	   ready: true
	});
	
	
	// mouse over helpers
	$('.mouseover').hover(function () {
		$(this).addClass('over');
	}, function () {
		$(this).removeClass('over');
	});


	// basket mouse over
	$('#basket').hover(function () {
		$(this).find('.extratab').show();
	}, function () {
		$(this).find('.extratab').hide();
	});


	// form auto focus
	if ($('input.focus').length !== 0) {
		$('input.focus:first').focus();
	}


	// add "last" class to last tr in tables
	if ($('table').length !== 0) {
		$('table').each(function () {
			$(this).find('tr:last').addClass('last');
		});
	}
	
	// autocomplete language
	if ($('#contentsearch-autocomplete').length !== 0 || $('#header #search-term').length !== 0) {
		if($('input[name=tx_indexedsearch[lang]]').length){
			pukSpecials.searchLang = $('input[name=tx_indexedsearch[lang]]').eq(0).val();
		} else {
			pukSpecials.searchLang = 0;
		}
	}
	
	// autocomplete
	if ($('#header #search-term').length !== 0) {
		
		$('#header #search-term').focus(function () {
			if ($(this).attr('value') == $(this).attr('default')) {
				$(this).attr('value', '');
			}
			$(this).addClass('active');
		});
		$('#header #search-term').autocomplete({
			serviceUrl: "fileadmin/mWeb/index.php?pltpl=simplesearch_quickresults&shop="+pukSpecials.shopPage+"&L="+pukSpecials.searchLang,
			minChars: 2,
			delimiter: /(,|;)\s*/,
			maxHeight: 400,
			width: 220,
			zIndex: 9999,
			deferRequestBy: 0,
			noCache: true,
			onSelect: function (value, data) {
				searchVal = "";
				searchVals = value.split(',');
				for(var i = 0; i < searchVals.length; i++){
					if(searchVals[i].length > 0){
						searchVals[i] = searchVals[i].replace("-"," ");
						searchVals[i] = searchVals[i].replace(","," ");
						searchVals[i] = searchVals[i].replace(":"," ");
						searchVals[i] = searchVals[i].replace(";"," ");
						searchVals[i] = searchVals[i].replace("/"," ");
						searchVals[i] = searchVals[i].replace("?"," ");
						searchVal += searchVals[i];
					}
				}
				searchVal = searchVal.replace(/\s+/g,' ');
				window.location.href = "/index.php?id="+pukSpecials.searchPageId+"&tx_indexedsearch[sword]=" + searchVal+"&L="+pukSpecials.getVars["L"];
			}
		});
	}
	
	// autocomplete 2
	if ($('#contentsearch-autocomplete').length !== 0) {
		$('#contentsearch-autocomplete').focus(function () {
			if ($(this).attr('value') == $(this).attr('default')) {
				$(this).attr('value', '');
			}
			$(this).addClass('active');
		});
		$('#contentsearch-autocomplete').autocomplete({
			serviceUrl: "fileadmin/mWeb/index.php?pltpl=simplesearch_quickresults"+"&L="+pukSpecials.searchLang,
			minChars: 2,
			delimiter: /(,|;)\s*/,
			maxHeight: 400,
			width: 220,
			zIndex: 9999,
			deferRequestBy: 0,
			noCache: true,
			onSelect: function (value, data) {
				searchVal = "";
				searchVals = value.split(',');
				for(var i = 0; i < searchVals.length; i++){
					if(searchVals[i].length > 0){
						searchVals[i] = searchVals[i].replace("-","");
						searchVals[i] = searchVals[i].replace(",","");
						searchVals[i] = searchVals[i].replace(":","");
						searchVals[i] = searchVals[i].replace(";","");
						searchVals[i] = searchVals[i].replace("/","");
						searchVals[i] = searchVals[i].replace("?","");
						searchVal += searchVals[i];
					}
				}
				window.location.href = "/index.php?id="+pukSpecials.searchPageId+"&tx_indexedsearch[sword]=" + searchVal+"&L="+pukSpecials.getVars["L"];
			}
		});
	}


	// basket
	if ($('input.basket_cnt').length !== 0) {
		basketUpdateListener();
	}
	
	// solarline home - newslist
	if($('.solar-home .news-list-container-archive .col').length){
		$('.solar-home .news-list-container-archive .col').each(function(){
			$(this).unwrap().appendTo($('.maincontent .cols-3').eq(0));
			$('.maincontent .cols-3 a').css({height:'203px'}).addClass('highlight-link');
		})
	}
});
