$(document).ready(function() {	
	//----------------- HAUPTNAVIGATION -----------------
	$(".lvl_two").hide();
	$(".wrap_lvl_two").hide();
	$("ul#lvl_one li.active .lvl_two").show();	
	$("li.active .wrap_lvl_two").show();
	$("#left_arrow").hide();
	$("#right_arrow").hide();
	timeoutID = 0;			// Variable für "TimeOut" (1,5 sek) vor "mouseleave" um die Navigation etwas benutzerfreundlich zu bekommen
	diff = 0;				// Variable für die slide-differenz (=> um wieviel bei overflow geslidet werden soll)
	rclicked 	= false;	// flag zum handlen der clicks bei overflow (subnavi)
	lclicked 	= true;		// flag zum handlen der clicks bei overflow (subnavi)
	
	// Breite der ul-Liste berechnen (aus Subnavigation)
	ul_width = 0;
	$("li.active .lvl_two li").each(function() {
		ul_width = ul_width + 25 + $(this).width();	
	});
	ul_width = ul_width + 25;
	$("li.active .lvl_two").css("width",ul_width)
	
	// Wenn ul-Liste breiter als Wrap-Container, Arrows anzeigen
	if (ul_width > $(".wrap_lvl_two").width()) {
		$("#right_arrow").show();
		diff = $("li.active .lvl_two").width() - $("li.active .wrap_lvl_two").width();	// var diff neu berechnen
	};
	
	$("ul#lvl_one li").mouseover(function () {
			clearTimeout(timeoutID);					// "mouseleave" der "navbar" verhindern wenn auf die Liste gehovert wird
			$("ul#lvl_one li").removeClass("m_over");	// mouseover-class von allen Punkten entfernen
			$(".lvl_two").hide();						// alle subnavigation ausblenden
			$(".wrap_lvl_two").hide();					// alle wrap-container ausblenden
			$(this).addClass("m_over");					// mouseover-class dem akt. Punkt hinzufügen
			$(this).find(".lvl_two").show();			// akt. subnavigation einblenden
			$(this).find(".wrap_lvl_two").show();		// akt. wrap-container einblenden
			//$("#navbar").addClass("active");	
			
			// Breite der ul-Liste berechnen
			ul_width = 0;
			$(this).find(".lvl_two li").each(function() {
				ul_width = ul_width + 25 + $(this).width();	
			});
			ul_width = ul_width + 25;
			$(this).find(".lvl_two").css("width",ul_width);

			// Wenn ul-Liste breiter als Wrap-Container, Arrows anzeigen
			if (ul_width > $(this).find(".wrap_lvl_two").width()) {
				diff = ul_width - $(this).find(".wrap_lvl_two").width();	// var diff neu berechnen
				if($("#left_arrow").is(":visible") == false){
					$("#right_arrow").show();			// nur wenn "left-arrow" nicht angezeigt wird, "right-arrow" anzeigen
				}
				//$(this).find(".lvl_two").css("left","14px");
			}else{
				$("#left_arrow").hide();
				$("#right_arrow").hide();
				$(".lvl_two").css("left","14px");
				rclicked 	= false;					// flags zurücksetzen
				lclicked 	= true;						// flags zurücksetzen
			}
		}
	);

	$("ul#lvl_one").mouseleave(function () {	
			timeoutID = setTimeout(function() {		
				$(".lvl_two").hide();	
				$(".wrap_lvl_two").hide();
				$("li.active .lvl_two").show();	
				$("li.active .wrap_lvl_two").show();
				$("ul#lvl_one li").removeClass("m_over");			// mouseover-class von allen Punkten entfernen						
				
				// Breite der ul-Liste berechnen
				ul_width = 0;
				$("li.active .lvl_two li").each(function() {
					ul_width = ul_width + 25 + $(this).width();	
				});
				ul_width = ul_width + 25;
				$("li.active .lvl_two").css("width",ul_width)
				
				// Wenn ul-Liste breiter als Wrap-Container, Arrows anzeigen
				if (ul_width > $(".wrap_lvl_two").width()) {
					if($("#left_arrow").is(":visible") == false){
						$("#right_arrow").show();					// nur wenn "left-arrow" nicht angezeigt wird, "right-arrow" anzeigen
					}
					$("li.active .wrap_lvl_two").show();
				}else{
					$(".lvl_two").css("left","14px");
					$("#right_arrow").hide();							
					$("#left_arrow").hide();	
					rclicked 	= false;							// flags zurücksetzen
					lclicked 	= true;								// flags zurücksetzen
				}
			}, 1500);
		}
	);

	$("#navbar").mouseleave(function () {
		timeoutID = setTimeout(function() {		
			$(".lvl_two").hide();
			$(".wrap_lvl_two").hide();
			$("li.active .lvl_two").show();	
			$("li.active .wrap_lvl_two").show();
			$("ul#lvl_one li").removeClass("m_over");				// mouseover-class von allen Punkten entfernen
			
			// Breite der ul-Liste berechnen
			ul_width = 0;
			$("li.active .lvl_two li").each(function() {
				ul_width = ul_width + 25 + $(this).width();	
			});
			ul_width = ul_width + 25;
			$("li.active .lvl_two").css("width",ul_width)
			
			// Wenn ul-Liste breiter als Wrap-Container, Arrows anzeigen
			if (ul_width > $(".wrap_lvl_two").width()) {
				if($("#left_arrow").is(":visible") == false){
					$("#right_arrow").show();						// nur wenn "left-arrow" nicht angezeigt wird, "right-arrow" anzeigen
				}
				$("li.active .wrap_lvl_two").show();
			}else{	
				$(".lvl_two").css("left","14px");
				$("#right_arrow").hide();								 
				$("#left_arrow").hide();
				rclicked 	= false;								// flags zurücksetzen
				lclicked 	= true;									// flags zurücksetzen
			}
		}, 1500);
	});
	//----------------- /HAUPTNAVIGATION -----------------
	
	//----------------- SUBNAVIGATION-OVERFLOW ----------------- 	
	// click "right-arrow"
	$("#right_arrow").click(function(){
		if (rclicked == false) {
			$("#left_arrow").show();
			$(".lvl_two").animate({
				"left": "-="+diff+"px"
			}, "slow");
			// flags setzen u. arrows einstellen			
			rclicked = true;
			lclicked = false;
			$("#right_arrow").hide();
		}
	});
	
	// click "left-arrow"	
	$("#left_arrow").click(function(){
		if (lclicked == false) {
			$(".lvl_two").animate({
				"left": "+="+diff+"px"
			}, "slow");
			// flags setzen u. arrows einstellen
			lclicked = true;
			rclicked = false;
			$("#left_arrow").hide();
			$("#right_arrow").show();		
		}
	});	
	
	// bei "mouseover" über die Pfeile, Timeout abstellen damit nichts ausgeblendet wird!
	$("#left_arrow").mouseover(function () {
		clearTimeout(timeoutID);
	});
	$("#right_arrow").mouseover(function () {
		clearTimeout(timeoutID);
	});	
	//----------------- /SUBNAVIGATION-OVERFLOW -----------------
	
	//----------------- SLIDE-BANNER STARTSEITE -----------------
	try
	{
		$('.image-slideshow').slideshow({
			active_image_width: 700,
			slide_speed: 1200,
			inactive_image_opacity: 0.0,
			on_slide_disable_navi: true,
			auto_slide: true,
			auto_slide_speed: 9500,
			auto_slide_mode: "there-and-back-again",
			pause_slide_on_hover: true
		});		
	}
	catch (err)
	{
		// bei Fehler nicht initialisieren
	};
	// ----------------- /SLIDE-BANNER STARTSEITE -----------------
	
	//----------------- NAVIGATION ZWISCHENTEASER -----------------
	$(".tab_content").hide(); 								// jeden Content ausblenden
	$("ul.nav_teaser li:first").addClass("active").show(); 	// ersten Tab aktivieren
	$(".tab_content:first").show(); 						// ersten Content zeigen

	// On-Click-Event
	$("ul.nav_teaser li").click(function() {

		$("ul.nav_teaser li").removeClass("active"); 		// class "active" entfernen
		$(this).addClass("active"); 						// class "active" an den aktuellen Tab
		$(".tab_content").hide(); 							// jeden Content ausblenden

		var activeTab = $(this).find("a").attr("href"); 	// href-Attribut suchen um aktiven Tab + Content zu finden
		$(activeTab).fadeIn(); 								// Fade in aktiver Content
		return false;
	});
	//----------------- /NAVIGATION ZWISCHENTEASER -----------------
	
	//----------------- TWITTER -----------------
	try
	{
		getTwitters('tweet', { 
			  id: 'MEArbeitgeber', 
			  count: 10, 
			  enableLinks: true, 
			  ignoreReplies: true, 
			  clearContents: true,
			  template: '<div class="tweet_status"><div class="tweet_text"><p>"%text%"</p></div><div class="tweet_time"><a href="http://twitter.com/%user_screen_name%/statuses/%id%/">%time%</a></div></div>'
		});	
	}
	catch (err)
	{
		// bei Fehler nicht initialisieren
	};
	//----------------- /TWITTER ----------------- 
	
	//----------------- BEZIRKSGRUPPEN SIDEBAR-HOVER -----------------
	$("#bezgrp_links li").mouseover(function () {
		m_top = 0;
		switch ($.trim($(this).find("a").html().toUpperCase())){
			case "ULM":
				$("#karte_bezgrp").css("background-position","0px -600px");
			    break;
			case "HEILBRONN/REGION FRANKEN":
				$("#karte_bezgrp").css("background-position","-265px -600px");
		    	break;
			case "FREIBURG":
				$("#karte_bezgrp").css("background-position","-530px -300px");
		    	break;	
			case "BODENSEE-OBERSCHWABEN":
				$("#karte_bezgrp").css("background-position","-795px -300px");
		    	break;
			case "KARLSRUHE":
				$("#karte_bezgrp").css("background-position","0px -300px");
		    	break;
			case "NECKAR-FILS":
				$("#karte_bezgrp").css("background-position","-795px -600px");
		    	break;
			case "REMS-MURR":
				$("#karte_bezgrp").css("background-position","-530px 0px");
		    	break;
			case "REUTLINGEN":
				$("#karte_bezgrp").css("background-position","-795px 0px");
		    	break;
			case "RHEIN-NECKAR":
				$("#karte_bezgrp").css("background-position","-530px -600px");
		    	break;
			case "SCHWARZWALD-HEGAU":
				$("#karte_bezgrp").css("background-position","-1060px 0px");
		    	break;
			case "STUTTGART":
				$("#karte_bezgrp").css("background-position","-1060px -300px");
		    	break;
			case "LUDWIGSBURG":
				$("#karte_bezgrp").css("background-position","-265px -300px");
		    	break;
			case "OSTWÜRTTEMBERG":
				$("#karte_bezgrp").css("background-position","-265px 0px");
		    	break;			    	
			default:
				//$("#karte_bezgrp").css("background-position","0px 0px"); commented wegen flackern
				break;
		};
	});	
	$("#bezgrp_links ul").mouseleave(function () {
			$("#karte_bezgrp").css("background-position","0px 0px");
	});
	//----------------- /BEZIRKSGRUPPEN SIDEBAR-HOVER -----------------
	
	//----------------- BEZIRKSGRUPPEN IMAGEMAP-HOVER -----------------
	$("#map_bezgrp").find("area").mouseover(function(){	
		switch ($.trim($(this).attr("title").toUpperCase())){
			case "ULM":
				$("#hover_container img").css("left","-269px");
				$("#hover_container img").css("top","-235px");
				$("#hover_container").css("width","260px");
				$("#hover_container").css("height","260px");
				$("#hover_container").css("top","355px");
				$("#hover_container").css("left","370px");
				$("#hover_container").show();
				break;
			case "BODENSEE":
				$("#hover_container img").css("left","0px");
				$("#hover_container img").css("top","-235px");
				$("#hover_container").css("width","245px");
				$("#hover_container").css("height","245px");
				$("#hover_container").css("top","470px");
				$("#hover_container").css("left","330px");
				$("#hover_container").show();
				break;
			case "SCHWARZWALD":
				$("#hover_container img").css("left","-770px");
				$("#hover_container img").css("top","-530px");
				$("#hover_container").css("width","330px");
				$("#hover_container").css("height","330px");
				$("#hover_container").css("top","400px");
				$("#hover_container").css("left","98px");
				$("#hover_container").show();
				break;
			case "FREIBURG":
				$("#hover_container img").css("left","0px");
				$("#hover_container img").css("top","-495px");
				$("#hover_container").css("width","385px");
				$("#hover_container").css("height","385px");
				$("#hover_container").css("top","325px");
				$("#hover_container").css("left","0px");
				$("#hover_container").show();
				break;
			case "REUTLINGEN":
				$("#hover_container img").css("left","-410px");
				$("#hover_container img").css("top","-550px");
				$("#hover_container").css("width","340px");
				$("#hover_container").css("height","340px");
				$("#hover_container").css("top","250px");
				$("#hover_container").css("left","165px");
				$("#hover_container").show();
				break;
			case "STUTTGART":
				$("#hover_container img").css("left","-248px");
				$("#hover_container img").css("top","0px");
				$("#hover_container").css("width","230px");
				$("#hover_container").css("height","230px");
				$("#hover_container").css("top","245px");
				$("#hover_container").css("left","258px");
				$("#hover_container").show();
				break;
			case "KARLSRUHE":
				$("#hover_container img").css("left","-530px");
				$("#hover_container img").css("top","-230px");				
				$("#hover_container").css("width","318px");
				$("#hover_container").css("height","318px");
				$("#hover_container").css("top","140px");
				$("#hover_container").css("left","118px");
				$("#hover_container").show();
				break;
			case "OSTWUERTTEMBERG":
				$("#hover_container img").css("left","0px");
				$("#hover_container img").css("top","0px");				
				$("#hover_container").css("width","232px");
				$("#hover_container").css("height","232px");
				$("#hover_container").css("top","255px");
				$("#hover_container").css("left","435px");
				$("#hover_container").show();
				break;
			case "NECKAR_FILS":
				$("#hover_container img").css("left","-710px");
				$("#hover_container img").css("top","0px");
				$("#hover_container").css("width","225px");
				$("#hover_container").css("height","225px");
				$("#hover_container").css("top","270px");
				$("#hover_container").css("left","340px");
				$("#hover_container").show();
				break;
			case "REMS_MURR":
				$("#hover_container img").css("left","-503px");
				$("#hover_container img").css("top","0px");
				$("#hover_container").css("width","200px");
				$("#hover_container").css("height","200px");
				$("#hover_container").css("top","235px");
				$("#hover_container").css("left","368px");
				$("#hover_container").show();
				break;
			case "LUDWIGSBURG":
				$("#hover_container img").css("left","-960px");
				$("#hover_container img").css("top","0px");
				$("#hover_container").css("width","205px");
				$("#hover_container").css("height","205px");
				$("#hover_container").css("top","212px");
				$("#hover_container").css("left","272px");
				$("#hover_container").show();
				break;
			case "HEILBRONN":
				$("#hover_container img").css("left","-1110px");
				$("#hover_container img").css("top","-490px");
				$("#hover_container").css("width","363px");
				$("#hover_container").css("height","365px");
				$("#hover_container").css("top","25px");
				$("#hover_container").css("left","295px");
				$("#hover_container").show();
				break;
			case "RHEIN_NECKAR":
				$("#hover_container img").css("left","-885px");
				$("#hover_container img").css("top","-220px");
				$("#hover_container").css("width","290px");
				$("#hover_container").css("height","290px");
				$("#hover_container").css("top","15px");
				$("#hover_container").css("left","245px");
				$("#hover_container").show();
				break;				
		};
	});
	
	// Container verstecken wenn "mouseleave" der Imagemap-Area
	$("#imap_on_imap").find("area").mouseleave(function(){
		$("#hover_container").hide();
		$("#hover_container a").css("display","none");
	});
	//----------------- /BEZIRKSGRUPPEN IMAGEMAP-HOVER -----------------	
	
	//----------------- BILDERGALERIE -----------------
	try
	{
		var gallery = $('#thumbs').galleriffic({
	        delay:                     3000, // in milliseconds
	        numThumbs:                 6, // The number of thumbnails to show page
	        preloadAhead:              10, // Set to -1 to preload all images
	        enableTopPager:            false,
	        enableBottomPager:         true,
	        maxPagesToShow:            7,  // The maximum number of pages to display in either the top or bottom pager
	        imageContainerSel:         '#slideshow', // The CSS selector for the element within which the main slideshow image should be rendered
	        controlsContainerSel:      '#controls', // The CSS selector for the element within which the slideshow controls should be rendered
	        captionContainerSel:       '#caption', // The CSS selector for the element within which the captions should be rendered
	        loadingContainerSel:       '#loading', // The CSS selector for the element within which should be shown when an image is loading
	        renderSSControls:          true, // Specifies whether the slideshow's Play and Pause links should be rendered
	        renderNavControls:         true, // Specifies whether the slideshow's Next and Previous links should be rendered
	        playLinkText:              'Galerie abspielen',
	        pauseLinkText:             'Galerie anhalten',
	        prevLinkText:              'vorheriges Bild',
	        nextLinkText:              'n&auml;chstes Bild',
	        nextPageLinkText:          'n&auml;chste Seite &rsaquo;',
	        prevPageLinkText:          '&lsaquo; vorherige Seite',
	        enableHistory:             false, // Specifies whether the url's hash and the browser's history cache should update when the current slideshow image changes
	        enableKeyboardNavigation:  true, // Specifies whether keyboard navigation is enabled
	        autoStart:                 false, // Specifies whether the slideshow should be playing or paused when the page first loads
	        syncTransitions:           false, // Specifies whether the out and in transitions occur simultaneously or distinctly
	        defaultTransitionDuration: 1000, // If using the default transitions, specifies the duration of the transitions
	        onSlideChange:             undefined, // accepts a delegate like such: function(prevIndex, nextIndex) { ... }
	        onTransitionOut:           undefined, // accepts a delegate like such: function(slide, caption, isSync, callback) { ... }
	        onTransitionIn:            undefined, // accepts a delegate like such: function(slide, caption, isSync) { ... }
			onPageTransitionOut:       undefined,
			//onPageTransitionIn:        undefined,
			onPageTransitionIn:        function() {
				var prevPageLink = this.find('a.prev').css('display', 'none');
				var nextPageLink = this.find('a.next').css('display', 'none');
				
				if (this.displayedPage > 0)
					prevPageLink.css('display', 'block');

				var lastPage = this.getNumPages() - 1;
				if (this.displayedPage < lastPage)
					nextPageLink.css('display', 'block');

				this.fadeTo('fast', 1.0);
			},
	        onImageAdded:              undefined, // accepts a delegate like such: function(imageData, $li) { ... }
	        onImageRemoved:            undefined  // accepts a delegate like such: function(imageData, $li) { ... }
	    });	
		
		/**************** Event handlers for custom next / prev page links **********************/
		gallery.find('a.prev').click(function(e) {
			gallery.previousPage();
			e.preventDefault();
		});

		gallery.find('a.next').click(function(e) {
			gallery.nextPage();
			e.preventDefault();
		});
	}
	catch (err)
	{
		// bei Fehler nicht initialisieren
	};	
	//----------------- /BILDERGALERIE -----------------	
	
	//----------------- FORMULAR-VALIDIERUNG -----------------
	if( $("#formular_content").length > 0 ) {
		$("[name='_formular']").validate();
	};
	//----------------- /FORMULAR-VALIDIERUNG -----------------
	
	//----------------- MIXED -----------------
	if($("#grab_html").length > 0) {
		grab_html("http://www.arbeitgeber.de/www/arbeitgeber.nsf/ID/ext_argumente?OpenDocument&layout=1","grab_col_left");
		grab_html("http://www.arbeitgeber.de/www/arbeitgeber.nsf/ID/ext_kompakt?OpenDocument&layout=1","grab_col_right");
	};
	// Adresscontent vergrößern, wenn kein Bild ausgewählt ist (Voila bietet keine Funktion!)
	$("#adressliste").find(".adresse_quer").each(function(i) {
		if($(this).find(".medium_left").length == 0) {
			$(this).find(".adressdaten").css("width","100%");
		}
	});
	$("#adressliste").find(".adresse").each(function(i) {
		if($(this).find(".medium_left").length == 0) {
			$(this).find(".adressdaten").css("width","100%");
		}
	});
	if($(".errorpage").length > 0) {
		$(".hide_nav_404").hide();
		$("#right_arrow").hide();
		$("#navbar").hide();
		$("#breadcrump").hide();
		$("#banner").find("img").attr("src",$("#html_head_unid").val() + "banner_error.jpg");
	};
    if(jQuery("#suchfeld").val()!="") {
        jQuery("#suchfeld").css('background-image','none');
    };
	//----------------- /MIXED -----------------

    //----------------- FONTSIZE -----------------
	$('a.big').click(function(){
		$('#main').removeClass("text_dec");
		$('#sidebar').removeClass("text_dec");
		$('#main').addClass("text_inc");
		$('#sidebar').addClass("text_inc");
		return false;
	});
	$('a.normal').click(function(){
		$('#main').removeClass("text_inc");
		$('#main').removeClass("text_dec");
		$('#sidebar').removeClass("text_inc");
		$('#sidebar').removeClass("text_dec");		
		return false;
	});	
	$('a.small').click(function(){
		$('#main').removeClass("text_inc");
		$('#sidebar').removeClass("text_inc");
		$('#main').addClass("text_dec");
		$('#sidebar').addClass("text_dec");
		return false;
	});
    //----------------- /FONTSIZE -----------------		
    
	//----------------- ERW. SUCHE -----------------
	$("#suche_options").mouseleave(function () {
		timeoutID = setTimeout(function() {
			$("#suche_options").hide();
		}, 600);
	});
	//----------------- /ERW. SUCHE -----------------
});
var Browser = {
		  Version: function() {
		    var version = 999; // we assume a sane browser
		    if (navigator.appVersion.indexOf("MSIE") != -1)
		      // bah, IE again, lets downgrade version number
		      version = parseFloat(navigator.appVersion.split("MSIE")[1]);
		    return version;
		  }
		}
//----------------- LEFT COLUMN -----------------
function grab_col_left(o){
	try {
		// Request in hidden-div laden um diesen dann auszulesen
		var resp_body = o.results[0];
		$("#hidden").html("");
		$("#hidden").html(resp_body);
		$("#grab_html .col_left").append('<h3>' + $("#hidden").find("h1").html() + '</h3>');
		$("#grab_html .col_left").append('<ul class="ag_argumente ggroup"></ul>');
		$("#hidden").find(".content li").each(function(){
	    	var link = $(this).find("h3 a").attr('href');
	    	link = link.replace("..","");
	    	if (Browser.Version() < 8) {
	    		link = link.replace("http://"+window.location.hostname+"/swm/web.nsf","");
	    	}
			$("#grab_html .col_left .ag_argumente").append('<li><div class="listitem"><a href="http://www.arbeitgeber.de/www/arbeitgeber.nsf' + link + '" target="_blank">' + $(this).find("h3 a").html() + '</a></div></li>');
	    });
		$("#grab_html .col_left .loading").hide();
	    // Pagination auslesen u. ggf. grabben (von 1 ausgehend, da 0 schon gegrabbt wurde)
		$("#hidden").find(".pager li").each(function(){
	    	if(!$(this).attr("class")) {
	    		var link = $(this).find("a").attr('href');
	    		link = link.replace("..","");
		    	if (Browser.Version() < 8) {
		    		link = link.replace("http://"+window.location.hostname,"");
		    	}
	    		var link_to_grab = 'http://www.arbeitgeber.de' + link;
	    		grab_html(link_to_grab,"grab_col_left_single");
	    	}
	    });
	}
	catch (err) {
		// bei Fehler nichts ausführen - DIV nicht vorhanden
	}
};

// Listeneinträge der gegrabbten Paginations-Seite an die vorh. Liste anhängen
function grab_col_left_single(o){
	try {
		var resp_body = o.results[0];
		$("#hidden").html("");
		$("#hidden").html(resp_body);
		$("#hidden").find(".content li").each(function(){
	    	var link = $(this).find("h3 a").attr('href');
	    	link = link.replace("..","");
	    	if (Browser.Version() < 8) {
	    		link = link.replace("http://"+window.location.hostname+"/swm/web.nsf","");
	    	}
			$("#grab_html .col_left .ag_argumente").append('<li><div class="listitem"><a href="http://www.arbeitgeber.de/www/arbeitgeber.nsf' + link + '" target="_blank">' + $(this).find("h3 a").html() + '</a></div></li>');
	    });
	}
	catch (err) {
		// bei Fehler nichts ausführen - DIV nicht vorhanden
	}
};
//----------------- LEFT COLUMN -----------------

//----------------- RIGHT COLUMN -----------------
function grab_col_right(o){
	try {
		var resp_body = o.results[0];
		$("#hidden").html("");
		$("#hidden").html(resp_body);
		$("#grab_html .col_right .col_content").append('<h3>' + $("#hidden").find("h1").html() + '</h3>');
		$("#grab_html .col_right .col_content").append('<ul class="ag_kompakt ggroup"></ul>');
		$("#hidden").find(".content li").each(function(){
	    	var link = $(this).find("h3 a").attr('href');
	    	link = link.replace("..","");
	    	if (Browser.Version() < 8) {
	    		link = link.replace("http://"+window.location.hostname+"/swm/web.nsf","");
	    	}
			$("#grab_html .col_right .col_content .ag_kompakt").append('<li><div class="listitem"><a href="http://www.arbeitgeber.de/www/arbeitgeber.nsf' + link + '" target="_blank">' + $(this).find("h3 a").html() + '</a></div></li>');
	    });
		$("#grab_html .col_right .loading").hide();
	    // Pagination auslesen u. ggf. grabben (von 1 ausgehend, da 0 schon gegrabbt wurde)
		pag_obj = {};
		$("#hidden").find(".navigator li").each(function(){
			var link = $(this).find("a").attr("href");
    		link = link.replace("..","");
	    	if (Browser.Version() < 8) {
	    		link = link.replace("http://"+window.location.hostname+"/swm/web.nsf","");
	    	}
			link = "http://www.arbeitgeber.de/www/arbeitgeber.nsf" + link;
	    	pag_obj[$(this).find("a").text()] = link;
	    });		
	}
	catch (err) {
		// bei Fehler nichts ausführen - DIV nicht vorhanden
	}
};


// Listeneinträge der gegrabbten Paginations-Seite an die vorh. Liste anhängen
function grab_col_right_single(o){
	try {
		var resp_body = o.results[0];
		$("#hidden").html("");
		$("#hidden").html(resp_body);
		$("#hidden").find(".content li").each(function(){
	    	var link = $(this).find("h3 a").attr('href');
	    	link = link.replace("..","");
	    	if (Browser.Version() < 8) {
	    		link = link.replace("http://"+window.location.hostname+"/swm/web.nsf","");
	    	}
			$("#grab_html .col_right .ag_kompakt").append('<li><div class="listitem"><a href="http://www.arbeitgeber.de/www/arbeitgeber.nsf' + link + '" target="_blank">' + $(this).find("h3 a").html() + '</a></div></li>');
	    });
		$("#grab_html .col_right .loading").hide();
	}
	catch (err) {
		// bei Fehler nichts ausführen - DIV nicht vorhanden
	}
};

// Funktion um den Content zum jeweiligen Buchstaben der Pagination zu laden
function load_cr(ABC){
	if (pag_obj[ABC] != null){
		$("#grab_html .col_right .col_content .ag_kompakt li").each(function(){
			$(this).remove();
		});
		$("#grab_html .col_right .loading").show();
		grab_html(pag_obj[ABC],"grab_col_right_single");
	}
};
//----------------- /RIGHT COLUMN -----------------

//----------------- HTML-GRAB via YQL -----------------	
function grab_html(link,callback) {
	$.getJSON("http://query.yahooapis.com/v1/public/yql?"+
	        "q=select%20*%20from%20html%20where%20url%3D%22"+
	        encodeURIComponent(link)+
	        "%22&format=json'&callback=?",
		function(data){
		  if(data.results[0]){
		    eval(callback + '(data)');
		  } else {
		    console.log("Fehler - Die externen Daten konnten nicht abgerufen werden!");
		  }
		}
	)
};
//----------------- /HTML-GRAB via YQL -----------------
