var isIE7 = false; if ($.browser.msie && parseFloat($.browser.version.substr(0,3)) < "8") { isIE7 = true; }
var isIE6 = false; if ($.browser.msie && parseFloat($.browser.version.substr(0,3)) < "7") { isIE6 = true; isIE7 = false; }
//var $ = jQuery.noConflict();  
$(document).ready(function(){
	/* --- Scroll To Top --- */
	$('.toplink').click(function(){
		$('html, body').animate({scrollTop: '0px'}, {duration: ( $(window).scrollTop() / 2 ), easing:'swing', queue:false});
		return false;
	});
	
	/* --- Formularfelder Formatieren --- */
	$("fieldset .formidable-rdrstd-rdtwrap:nth-child(odd)").addClass("formidable-rdrstd-rdtwrap_odd");
	$("fieldset .formidable-rdrstd-rdtwrap:nth-child(even)").addClass("formidable-rdrstd-rdtwrap_even");
	
	$("table:not('.contenttable') tr:nth-child(odd)").addClass("row_odd");
	$("table:not('.contenttable') tr:nth-child(even)").addClass("row_even");

	/* --- MAINNAVI --- */
	$(function(){
		var iTimeoutRes;
		var activeEl;
		
		$('#navi_main li.mainsub').hover(
			function(){
				var el = $(this),
					p = el.parent(),
					mainsub_content = jQuery('.mainsub_content'),
					el_mainsub_content = el.children('.mainsub_content')
				;
				
				//erstmal alle evtl. noch sichtbaren Elemente ausblenden
				// solange es nicht das gleiche aktive element ist
				if(activeEl !== el.attr('class')) {
					mainsub_content.stop(true, true);
					mainsub_content.hide();
					activeEl = el.attr('class');
				}
				//und ihnen die Klasse für aktiv entziehen
				mainsub_content.removeClass('activeHover');
				//noch den timeout löschen da wir einen neuen hoverin
				//haben und damit alle hoverouts abgebrochen werden müssen
				clearTimeout(iTimeoutRes);
				// Einblenden
				el_mainsub_content.slideDown();
				//damit wir wissen dass es ein aktives Element gibt
				el_mainsub_content.addClass('activeHover');
				
			} ,
			function(){
				// Ausblenden
				var el = $(this),
					p = el.parent(),
					el_mainsub_content = el.children('.mainsub_content')
				;
				// slideUp erst nach 1 Sek.
				iTimeoutRes = setTimeout( function(){
						// nur ausblenden wenn das element noch aktiv ist
						if(el_mainsub_content.hasClass('activeHover')){
							el_mainsub_content.slideUp();
							el_mainsub_content.removeClass('activeHover');
						}
					}, 
					1000
				);
			}
		);
		
		$('.linkbox .startbox').each(
			function(i,o){
				$(o).find('.image a').hover(
						function(){
							navi_main_over('hover-col-'+(i+1));
						},
						function(){
							navi_main_out('hover-col-'+(i+1));
						}
					);
			}
		);
	});// END MAINNAVI
	
	/* --- Zoom --- */
	var sFontSize = $.cookie('sizer');
	setFontSize(sFontSize);
	$('#navi_service .zoom a').removeClass('active');
	$('#navi_service .zoom a.'+sFontSize).addClass('active');
	$('#navi_service .zoom a').click(function(){
		var t = $(this); var size;
		$('#navi_service .zoom a').removeClass('active'); t.addClass('active');
		if (t.hasClass('normal')){ size = 'normal'; }
		else if (t.hasClass('big')){ size = 'big'; }
		else if (t.hasClass('bigger')){ size = 'bigger'; }
		$.cookie('sizer', size, { expires: 14 });
		setFontSize(size);
	});
		
	/* --- Tabs --- */
	initMkTabs($(".mktabs"));
	/* --- Accordion --- */
	$('.accordion').mkaccordion({        
		acchead: 'h3',
		accbody: 'div',
		event: 'click',
		active: 'none',
		collapsible: true,
		closeactive: false,

		accheadaclass:'plusmn',
		accheadatext:'',
		accheadaposition: 'wrap',
		accheadaprevent: true,
		entryIdSelector: '.idfield'
	});
	/* --- mit closeActive true --- */
	$('.accordionCloseActive').mkaccordion({        
		acchead: 'h3',
		accbody: 'div',
		event: 'click',
		active: ':first',
		collapsible: true,
		closeactive: true,

		accheadaclass:'plusmn',
		accheadatext:'',
		accheadaposition: 'wrap',
		accheadaprevent: true
	});

	/* --- ColorPicker --- */
	initColorPicker('.colorpicker');
	
	/* --- Tablesorter --- */
	$(".tablesort").tablesorter();
	
	/* --- check Links and set http:// --- */
	// wird eigentlich nicht mehr benötigt, da in den formularen unbedingt dat http:// mit angegebenw erden muss 
	$('a.cUrl').each(function(i,el){
		var jLink = $(el);
		var jUrl = jLink.attr('href');
		if( jUrl.substr(0,4) == 'www.') { jLink.attr('href', 'http://'+jUrl); }
		jLink.attr('target', '_blank'); // open in new window
	});
	
	hideLastSeparator(false);
	
	/* --- open links with rel="external" in new window --- */
	openExternalLinks();
	//most browsers do not correctly report the referring URL in the request for the new page with window.open
	//$('a[rel=external]').bind('click',function(){ if (!this.href) return true; window.open(this.href); return false; });
	
//	$('form#joboffers .country, form#companysearch .country').val('');
	//initDatePicker($('.datepicker'));
	
	//bind the click event of the status-saved-box so it can be closed when not from a renderlet (then its enough to call the action <onclick>)
	$('.status-saved-box.with-click').bind('click', function() {
			status_off();
		});
	
	/* --- Anzeigenverwaltung, Details --- */
	$('.extend a.extend').click(function(){
		var jLink = $(this);
		var jBox = jLink.parents('.extend').find('.extended');
		if(jBox.length===0) return false;
		if(jBox.is(':visible')){
			// ausblenden
			jBox.slideUp('fast');
			// klassen für den pfeil setzen
			jLink.addClass('arrow-left');
			jLink.removeClass('arrow-down');
		} else {
			jBox.slideDown('middle');
			jLink.removeClass('arrow-left');
			jLink.addClass('arrow-down');
		}
		return false;
	});
	
	var bCheckedAll;
	/* --- Anzeigenverwaltung, alles auswählen --- */
	$('a.choose-all').click(function(){
		if(bCheckedAll === true){
			$('.choose-me').attr("checked","");
			bCheckedAll = false;
		}else{
			$('.choose-me').attr("checked","checked");
			bCheckedAll = true;
		}
	});
	
	$(function(){
		// confirm anzeigen, wenn löschen gewählt.
		$('#managed-do').click(function(){
			if($('#managed-tasks').val() == 'delete') {
				return confirm('Die Anzeigen werden nun unwiederuflich gelöscht!');
			}
		});
	});
	$(function(){
		// fake save button
		var jfakeButton = $('#dSaveButton');
		if(jfakeButton.length > 0) {
			jfakeButton.bind('click', function(){
				status_on(); this.blur();
				window.setTimeout(function(){
						$url = getBaseUrl;
						var href = $('#dCancelButton, #dCancelButtonEdit, .cancelbuttons a').get(0).getAttribute("href");
						if( href.substr(0,window.location.protocol.length) != window.location.protocol)
							href = getBaseUrl() + href;
						window.location.href = href;
					},2000);
				return false;
			});
		}
	});
	$(function(){
		// status-saved-box anzeigen, wenn hash vorhanden
		if (window.location.hash.length) {
			var anchor = window.location.hash.substring(1),
				anchors = anchor.split('#');
			// es könnte mehrere anker für tabs und accordeon geben. also gehen wir alle durch 
			// und stoppen beim ersten treffer
			$.each(anchors, function(index, value) { 
				if(value === 'statusSavedBox') {
					status_on();
					this.blur();
				}
			});
			
		}
	});
	

	$(function(){
		// inboxinfo
		$('.inbox').each(function(i, el) {
			var $box, $info, $field;
			$box = $(el);
			$info = $box.find('.inboxinfo');
			$field = $box.find('.inboxfield');
			if($info.length && $field.length) {
					// positionen auslesen
				var pos = $field.position(),
					// dimensionen auslesen
					dim = {
						'height': $field.height(),
						'outerHeight': $field.outerHeight(),
						'width': $field.width(),
						'outerWidth': $field.outerWidth()
					},
					// padding berechnen
					padding = ((dim.outerHeight-dim.height) / 2)+'px '+((dim.outerWidth-dim.width) / 2)+'px';
				// position übernehmen und anzeigen!
				$info.css({
					'height': dim.height,
					'width': dim.width,
					'top': pos.top,
					'left': pos.left,
					'padding': padding,
					'display': 'block'
				});
				// focus von der info auf das feld weiterleiten
				$info.bind('click', function(){
					$field.focus();
				});
				// info verstecken, wenn das feld den focus erhält
				$field.bind('focus', function(){
					$info.hide();
				});
				// info anzeigen, wenn das feld den focus verliert und leer ist
				$field.bind('blur', function(){
					if($field.val().length === 0) {
						$info.show();
					}
				});
			}
		});
	});
	
});

function getBaseUrl(){
	var baseAddr = '';
	if( document.getElementsByTagName ) {
		var elems = document.getElementsByTagName( 'base' );
		if( elems.length )
			baseAddr = elems[0].href;
	}
	if(baseAddr === '')
		baseAddr = window.location.protocol + '//' + window.location.host;
	return baseAddr;
}

function mkExecFunc(fn, bReady, iTimeout) {
	if(typeof(bReady) == 'undefined') { bReady = true; }
	if(typeof(iTimeout) == 'undefined') { iTimeout = 0; }
	var func = fn;
	if(bReady) { func = function(){ $(document).ready(fn); }; }
	if(iTimeout > 0) { window.setTimeout(func,iTimeout); }
	else { func.call(); }
}
/**
 * JS to set target Attribute for external Links
 * 
 * @param boolean bReady	if True a document ready was wrapped
 * @param integer iTimeout	if Timeout > 0 a setTimeout was wrapped
 * @return void
 */
function openExternalLinks(bReady, iTimeout){
	var fn = function(){
			$('a[rel^=external]').attr('target', '_blank');
		};
	mkExecFunc(fn, bReady, iTimeout);
}
function hideLastSeparator(bReady, iTimeout){
	var fn = function(){
			$('.hidelastseparator .separator:last-child').addClass('hide');
		};
	mkExecFunc(fn, bReady, iTimeout);
}

function syncHeight(el1,el2, bReady, iTimeout, sSelector) {
	var fn = function(){
		//wenn die Elemente in einem Container liegen, der versteckt ist,
		//muss dieser erst eingeblendet werden damit die richtigen Höhen
		//berechnet werden können
		if(typeof(sSelector) !== 'undefined') jQuery(sSelector).show();
		
		if(el1.length === 0 && el2.length === 0) { return ; }
		el1.height('auto'); el2.height('auto');
		var nH = el1.height();
		if(nH < el2.height()) { nH = el2.height(); }
		if(nH === 0) return;//bei Höhe = 0 alles auf auto lassen
		el1.height(nH);
		el2.height(nH);
		
		if(typeof(sSelector) !== 'undefined') jQuery(sSelector).hide();
	};
	mkExecFunc(fn, bReady, iTimeout);
}
function syncsidebar(iTimeout) {
	syncHeight($('#sidebar'), $('#content'), true, iTimeout);
//	return;
//	var jS = $('#sidebar'); //$('#mkresult2');
//	var jC = $('#content'); //$('#mkresult1');
//	jS.height('auto');
//	jC.height('auto');
//	
//	/* such-sidebar hoehe */
//	//@TODO use syncHeight
//	var sh = jS.find('.searchfilter').height() +50;
//	var ch = jC.height() -100;
//	
//	if (sh < ch) jS.height(ch);
//	else jC.height(sh);
//	
//	$('#footer .left .image').addClass('searched');
}

function initDatePickerModalbox() {
	window.setTimeout(function(){initDatePicker($('#tx_ameosformidable_modalboxbox .datepicker'));}, 200);
}
var datePickerCss = false;
function initDatePicker(elements, bReady, iTimeout) {
	var fn = function(){
		if(typeof(elements) == 'undefined') { elements = $('.datepicker'); }
		if(elements.length === 0) { return; }
		if(!datePickerCss) { // include css for datepicker
			Formidable.includeStylesheet(Formidable.path+'../../../fileadmin/templates/css/jquerydatepicker.css');
		}
		datePickerCss = true;
		var options = {
				showOn: 'button',
				buttonImage: 'fileadmin/templates/images/calendar.gif',
				buttonImageOnly: true,
	
				changeMonth: true,
				changeYear: true,
				yearRange: '1900:2020',
				showOtherMonths: true,
				selectOtherMonths: true,
				onSelect: function(dateText, inst) {
						var date = dateText.split('/');
						var $dp = $(this);
						$dp.data('dateday').val(date[1]);
						$dp.data('datemonth').val(date[0]);
						$dp.data('dateyear').val(date[2]);
					}/*  datum beim öffnen setzen,
				beforeShow: function(input, inst) {
						var $dp = $(this);
						var day = $dp.data('dateday').val();
						var month = $dp.data('datemonth').val();
						var year = $dp.data('dateyear').val();
						var date //@TODO: muss noch gesetzt werden!!
						$dp.datepicker( "setDate" , date )
						console.log(input, inst);
					}*/
			};
		elements.each(function(i,o){
			var $obj = $(o);
			var $dp = $('<input type="hidden" class="hide hasdp"></input>');
			$obj.append($dp);
			$dp.data('dateday', $obj.find('.dateday'));
			$dp.data('datemonth', $obj.find('.datemonth'));
			$dp.data('dateyear', $obj.find('.dateyear'));
			$dp.datepicker(options);
			if ($obj.find('.hasError').length) {
				$obj.addClass('hasError');
			}
		});
	};
	mkExecFunc(fn, bReady, iTimeout);
}

function initMkTabs(elements) {
	if(elements.length === 0) { return; }
	elements.mktabs({
		tabhead:'.tabhead',
		entryIdSelector: '.tabidfield'		
	});
}

/* --- ColorPicker --- */
var colorPickerJsLoadad = false;
function initColorPicker(sSelector){
	var el = $(sSelector); 
//	$('.colorpicker-button').unbind('click.colorpicker');
	if(el.length>0) {

	if(!colorPickerJsLoadad){
		$.getScript('fileadmin/templates/js/jscolor/jscolor.js', function(){
			colorPickerJsLoadad = true;
			initColorPicker(sSelector);
		});
		return;
	}
		
		var mPicker = [];
		el.each(function(i,o) {
			if (!$(o).next().is('a.colorpicker-button')) {
				var input = $(o).after('<a href="javascript:void(0);" class="colorpicker-button"></a>');
				var btn = input.next('a');
				mPicker[i] = new jscolor.color(o,{});
				var p = mPicker[i];
				btn.bind('click.colorpicker',function(){
						p.showPicker();
						input.focus();
					});
			}
		});
	}	
}
/* --- Statusmeldung ausblenden --- */
function status_off_timed(selector) {
	setTimeout(function(){ status_off(selector); }, 2000);
}
function status_off(selector) {
	if(typeof(selector) === 'undefined') { selector = ".status-saved-box"; }
	if ($(selector).css("display") === "block") {
		$(selector).slideUp();
	}
}
function status_on() {
	var $box = $(".status-saved-box");
	if($box.length === 0) { return; }
	$box.show(); // box anzeigen
	// timeout nutzen?
	if($box.hasClass('off-timed')){
		status_off_timed();
	}
}
/* --- Telefonvorwahl automatisch ans Land angleichen --- */
function change_phone() {
	var country = $('.country').val();
	$(".phone option[value='"+country+"']").attr("selected","selected");
}
function changephone(field) {
	var country = $('.country'+field).val();
	$(".phone"+field+"' option[value='"+country+"']").attr("selected","selected");
}
/* --- verbleibende Zeichen anzeigen und max auswerten --- */
function count_length(sArea, sCounter, iMax) {
	if(typeof(iMax) == 'undefined') { iMax = 100; }
	var sText = $(sArea).val();
	var iLen = iMax - sText.length;
	if(iLen<0) {
		iLen = 0;
		$(sArea).val(sText.substring(0,iMax));
	}
	$(sCounter).text( iLen );
}
function checkPrevBoxAndSetButtonClass(sBox, sButton, sEmptyClass, sFilledClass, maxEmptyHeight) {
	if(typeof(maxEmptyHeight) == 'undefined') { maxEmptyHeight = 6; }
	if(typeof(sEmptyClass) == 'undefined') { sEmptyClass = 'button-edit-gray'; }
	if(typeof(sFilledClass) == 'undefined') { sFilledClass = 'button-edit'; }

	var oBox = jQuery(sBox);
	if (!oBox.length) { return; }
	if(!oBox.hasClass('noclear')) { oBox.append( $('<div class="clear">') ); }
	var oButton = jQuery(sButton);
	if (!oButton.length) { return; }
		
	var tohide = oBox.find('.formidable-rdrstd-label:visible, .static:visible');
	if(tohide.length) { tohide.hide(); }
	
	if(oBox.height() < maxEmptyHeight || oBox.find(':visible').length === 0) {
		oButton.removeClass(sFilledClass);
		oButton.addClass(sEmptyClass);
	} else {
		oButton.removeClass(sEmptyClass);
		oButton.addClass(sFilledClass);
	}
	if(tohide.length) { tohide.show(); }

}
//move links in Accordeon autside link
function moveAccordeonLinks(header) {
	var el = $(header).find('a.plusmn');
//	$('a.plusmn').each(function(i,el){
		var child = $(el).find('span.mailstatus, span.accprice');
		if(child.length) {
			$(el).parent().before( child );
		}
//	});
}
/* --- Funktion zum Setze der Schriftgröße --- */
function setFontSize(size){
	switch (size) {
	case 'big': // Default auf 12px/16px
		$('body').css({'font-size':'75%','line-height':'133.33%'}); break;
	case 'bigger': // Default auf 14px/18px
		$('body').css({'font-size':'87.5%','line-height':'128.57%'}); break;
	default: // Default auf 11px/15px
		$('body').css({'font-size':'68.75%','line-height':'136.36%'});
	}
} 

$(document).ready(function(){
	var cookiestring = document.cookie;
	if (cookiestring.indexOf("partneroverlay") == -1) {
		$('#partneroverlay').show();
		$('#partnerpopup').show();
	}
	window.setTimeout(closeoverlay,7000);
});

function closeoverlay() {
	$('#partneroverlay').hide();
	$('#partnerpopup').hide();
	var cookiestring = document.cookie;
	if (cookiestring.indexOf("partneroverlay") == -1) {
		// no expire time = until session end 			expires="+a.toGMTString()+"; 
		/*var a = new Date();
		a = new Date(a.getTime() +1000*60*60*3);*/
		document.cookie = "partneroverlay=1; path=/";
		return false;
	}
}

var cValid = {
	//Object with all Items
	oItems: {},
	//jQuery Object (error messages was gernerated in it)
	errorContainer: 'errorContainer',
	// adds a Item to validate
	addItem: function(item, options){
		this.oItems[item] = new this.oItem(item, this, options);
	},
	// validates all items
	validate: function(sItems){
		//TODO: validate only given Items!
		var bError = false;
		for(sItem in this.oItems) {
			var oItem = this.oItems[sItem];
			if(!oItem.handleErrorMsg()) { bError = true; }
		}
		this.handleErrorContainer();
		return !bError;
	},
	// object of a item
	oItem: function(sItem, oParent, oConfig){
		this.oConfig = jQuery.extend({
							errorMessage: 'Error ('+sItem+')'
						}, oConfig);
		this.oConfig.oParent = oParent;
		
		this.sItem = sItem;
		
		this.jInput = null;
		this.jLabel = null;
		this.jError = null;
		
		this.init = function(){
			this.jInput = $('#'+this.sItem+'_input');
			this.jLabel = $('label[for='+this.sItem+'_input]');
			this.jError = $('#'+this.sItem+'_error');
			if(!this.jError.length) {
				this.jError = $('<div>').addClass('error').attr('id',this.sItem+'_error').text( this.oConfig.errorMessage ).hide();
				this.oConfig.oParent.errorContainer.append( this.jError );
			}
		};
		// function to validate a item
		this.isValid = function(){
			if( this.jInput.is('[type=checkbox]') ) {
				return this.jInput.is(':checked');
			}
		};
		// function to handle error messages and gets valid state
		this.handleErrorMsg = function(){
			var bError = this.isValid();
			if(bError) {
				this.jError.hide();
				this.jInput.removeClass('hasError');
				this.jLabel.removeClass('hasError');
				this.jInput.unbind('change.checkErrors');
			} else {
				this.jError.show();
				this.jInput.addClass('hasError');
				this.jLabel.addClass('hasError');
				// init onchange event to disable error
				this.jInput.bind('change.checkErrors', this, this.onChange);
			}
			return bError;
		};
		//just an alias!
		this.handleErrorContainer = function(){
			this.oConfig.oParent.handleErrorContainer();
		};
		// onchange event, to recheck validator
		this.onChange = function(event){
			var oItem = event.data;
			oItem.handleErrorMsg();
			oItem.handleErrorContainer();
		};
		
		//init this item
		this.init();
	},
	// show or hide error container
	handleErrorContainer: function(){
		var bErrors = false;
		this.errorContainer.children().each(function(i,el){
			if($(el).css('display') !== 'none') { bErrors = true; }
		});
		if(bErrors) {
			this.errorContainer.show();
		} else {
			this.errorContainer.hide();
		}
	}
};
if ( typeof(MKTool) != 'object' ) {
	var MKTool = {};
}
MKTool.locks = [];
MKTool.spinner = {
	spinner: null,
	showLoader: function() {
		var vTop = window.pageYOffset || document.documentElement && document.documentElement.scrollTop ||  document.body.scrollTop;
		var spinner = jQuery('<div>')
						.attr('id','tx_mkforms_spinner')
						.css({'position': 'fixed', 'left': '50%', 'top': '50%', 'margin': 0, 'padding': 0, 'z-index': 999999999});
		var spinnerOverlay = jQuery('<div>')
						.attr('id','tx_mkforms_spinner_overlay')
						.css({'position': 'fixed', 'left': 0, 'top': 0, 'margin': 0, 'padding': 0, 'z-index': 99999999, 'opacity':0.6, 'filter': 'progid:DXImageTransform.Microsoft.Alpha(opacity=60)'});
		var spinnerWrap = jQuery('<div>')
						.attr('id','tx_mkforms_spinner_wrap');
		var img = jQuery('<img>')
						.attr('src','typo3conf/ext/mkforms/res/images/loading.gif');
		
		spinner.append(img);
		spinnerWrap.append(spinnerOverlay);
		spinnerWrap.append(spinner);
		
		spinnerOverlay.width( jQuery(document).width() );
		spinnerOverlay.height( jQuery(document).height() );

		this.spinner = spinnerWrap;
		
		jQuery('body').append( spinnerWrap );
		
		spinner.css({'top':vTop + ((jQuery(window).height() - spinner.height()) / 2),'left': (jQuery(window).width() - spinner.width()) / 2});
		
	},
	removeLoader: function(){
		 if(this.spinner !== null) { this.spinner.remove(); }
		 if(typeof(syncSideBar) !== 'undefined' && syncSideBar) {
			 syncsidebar();
		}
	}
};
/**
 * sortier die JobOffers, sodas immer die aktuelle oben steht!
 * 
 * Bsp:
 * <h4 id="joboffer-sorter-01">
 * <!-- ###JOBOFFER_JOBAD_JOBOFFERS### -->
 * <!-- ###JOBOFFER_JOBAD_JOBOFFER### -->
 * <div class="joboffer"><span class="id" style="display:none;">###JOBOFFER_JOBAD_JOBOFFER_JOB_UID###</span><span class="title">###JOBOFFER_JOBAD_JOBOFFER_JOB_TITLE###</span></div>
 * <!-- ###JOBOFFER_JOBAD_JOBOFFER### -->
 * <!-- ###JOBOFFER_JOBAD_JOBOFFERS### -->
 * <script type="text/javascript"> sortJobOffers('joboffer-sorter-01', '###JOBOFFER_JOB_UID###'); </script>
 * </h4>
 */
var sortJobOffers = function(containerId, uid, wrap){
	if(!$('#'+containerId+' .joboffer').length) { return; }
	// wrap um die einzelnen items
	if(typeof(wrap) == 'undefined') { wrap = '|<br/>'; }
	wrap = wrap.split('|');
	//joboffers auslesen
	var oJobOffers = {};
	$('#'+containerId+' .joboffer').each(function(i,o){
		var id = parseInt( $(o).find('.id').text() );
		var text =  $(o).find('.title').html();
		oJobOffers[id] = text;
	});
	//joboffer mit der uid als erstes schreiben
	var sText = wrap[0] + oJobOffers[parseInt(uid)] + wrap[1];
	// die restlichen jobffers schreiben
	for(id in oJobOffers) {
		if(id != uid) { sText+= wrap[0] + oJobOffers[id] + wrap[1]; }
	}
	//container leeren und mit joboffers füllen mit 10ms  Verzögerung, da der Container erst komplett sein muss vor weiteren Aktionen für IE
	$(function() {
		setTimeout(function(){ 
			$('#'+containerId).empty();
			$('#'+containerId).html(sText);
			
			if($('.profil3').length) { // bei jobad design classy die höhen anpassen!
				syncHeight($('.profil3 .leftcol'), $('.profil3 .rightcol'), true, 100);
			}
		},1);
	});

};
function showLetterPage(iPage, sPage1, sPage2) {
	if(typeof(iPage) == 'undefined') { iPage = 1; }
	if(typeof(sPage1) == 'undefined') { sPage1 = '#letter-page-1'; }
	if(typeof(sPage2) == 'undefined') { sPage2 = '#letter-page-2'; }
	var oPager = $('.letterpager');
	switch(iPage){
		case 1:
			$(sPage2).hide();
			$(sPage1).show();
			oPager.find('.prev-page').hide();
			oPager.find('.next-page').show();
			oPager.find('.first-page').hide();
			oPager.find('.firstactive-page').show();
			oPager.find('.lastactive-page').hide();
			oPager.find('.last-page').show();
			break;
		case 2:
			$(sPage1).hide();
			$(sPage2).show();
			oPager.find('.next-page').hide();	
			oPager.find('.prev-page').show();
			oPager.find('.firstactive-page').hide();
			oPager.find('.first-page').show();
			oPager.find('.last-page').hide();
			oPager.find('.lastactive-page').show();
			break;
	}
}
/**
 * @deprecated
 */
function showletterpage1() { showLetterPage(1); }
function showletterpage2() { showLetterPage(2); }

/**
 * @deprecated wird in Suche nicht mehr verwendet
 */
function submitForm(sForm, clear) {
	if(typeof(clear)=='undefined') { clear = false; }
	var oForm = $(sForm);
	if(clear) {
		oForm.find('input[type=text]').val('');
		oForm.find('fieldset input[type=hidden]').val('');
		oForm.find('select').val('');
	}
	oForm.submit();
	return false;
}
