/***************************************************************
*	DW_Theme_1 Javascripts  
***************************************************************/

/***************************************************************
*
*	script for customized pulldown
*
***************************************************************/
	function JumpToIt(list) {
	    var newPage = list.options[list.selectedIndex].value
	    if (newPage != "None") {
	        location.href=newPage
	    }
	}


/***************************************************************
*
*	jQuery Section
*
***************************************************************/

		
		
	jQuery(document).ready(function() { 
		
		
/***************************************************************
*	extends the more-tag with nofollow attribute
***************************************************************/		
		jQuery('.more-link').attr('rel', 'nofollow');
		
		
/***************************************************************
*	this function centers pictures in flickr-plugin bigger 
*	than 85px height and width and open them in a 
*	blank window
***************************************************************/		
	if(jQuery('body').css('direction') == 'rtl'){

		jQuery('#flickr img').each(function(index){
			  if(jQuery(this).innerHeight() > 85 || jQuery(this).innerWidth() > 85) {
				  jQuery(this).css('top', -(jQuery(this).innerHeight() - 85)/2.0);
				  jQuery(this).css('left', (jQuery(this).innerWidth() - 85)/2.0);
			  }
		});
		
	}else{
		
		jQuery('#flickr img').each(function(index){
			  if(jQuery(this).innerHeight() > 85 || jQuery(this).innerWidth() > 85) {
				  jQuery(this).css('top', -(jQuery(this).innerHeight() - 85)/2.0);
				  jQuery(this).css('left', -(jQuery(this).innerWidth() - 85)/2.0);
			  }
		});
	
	};

		jQuery('#flickr a').attr('target', '_blank');


/***************************************************************
*	this section sets the right dimension of embedded
*	videos in the sidebar
***************************************************************/		
		jQuery('#sidebar .widget_text object').attr({width : '268', height : '176'});
		jQuery('#sidebar .widget_text embed').attr({width : '268', height : '176'});

		
/***************************************************************
 *	section checkes if scrolllinks for subnavigation
 *	exists, and change them if it is a RTL site
 ***************************************************************/	
		var siteDirection = jQuery('body').css('direction');
//		alert(siteDirection);
		
		if(siteDirection == 'rtl'){
			
			if(jQuery('.subnavBar .left img').length > 0){
				var arrLeftLTR = jQuery('.subnavBar .left img').attr('src');
				var arrLeftRTL = arrLeftLTR.replace(/arrowLeft/, "arrowRight");
//				alert(arrLeftRTL);
				jQuery('.subnavBar .left img').attr('src', arrLeftRTL);
			}
			
			if(jQuery('.subnavBar .right img').length > 0){
				var arrRightLTR = jQuery('.subnavBar .right img').attr('src');
				var arrRightRTL = arrRightLTR.replace(/arrowRight/, "arrowLeft");
//				alert(arrRightLTR);
				jQuery('.subnavBar .right img').attr('src', arrRightRTL);
			}	
			
		};
		
/***************************************************************
*	this section works in overview sides and take the
*	first picture in the content(but not sb-pics and 
*	gallery-pics), brings it as the very-first element 
*	and gives a left-orientated css-class. enter more 
*	blog-ids to the IF-statement to display RTL blogs
*	correct
***************************************************************/		
//		jQuery('#main .singleBlock .entry').each(function(){
//			var firstImage = jQuery(this).find('img:first:not(.social_img,.ngg-galleryoverview img)');
//			jQuery(this).prepend(firstImage);	
//			if (siteDirection == 'rtl'){
//				jQuery(firstImage).removeClass();
//				jQuery(firstImage).addClass('alignright');
//			}else{
//				jQuery(firstImage).removeClass();
//				jQuery(firstImage).addClass('alignleft');
//			}
//		});
		

/***************************************************************
*	section takes pictures embedded with FCKeditor
*	sets clases for alignment and removes the align-attr.
***************************************************************/		
//		jQuery('.single .entry img[align=right]').addClass('alignright');
//		jQuery('.single .entry img[align=right]').removeAttr('align');
//		jQuery('.single .entry img[align=left]').addClass('alignleft');
//		jQuery('.single .entry img[align=left]').removeAttr('align');
//		geändert damit auch bilder auf übersichtsseiten reagieren
		jQuery('.entry img[align=right]').addClass('alignright');
		jQuery('.entry img[align=right]').removeAttr('align');
		jQuery('.entry img[align=left]').addClass('alignleft');
		jQuery('.entry img[align=left]').removeAttr('align');
		jQuery('.entry img[align=center]').addClass('aligncenter');
		jQuery('.entry img[align=center]').removeAttr('align');

		
/***************************************************************
*	this section sets the target-attribute of rss-links
*	to '_blank'
***************************************************************/		
		jQuery('#sidebar .widget_rss a').attr({target : '_blank'});
		

/***************************************************************
*	this section sets the target-attribute of embedded
*	google-maps 	to '_blank'
***************************************************************/		
		jQuery('#main .entry a[href*=maps.google]').attr({target : '_blank'});

		
/***************************************************************
*	this section terminates footer bloglistentries to 7
***************************************************************/		
//		jQuery('#footer .secondList .listEntry:gt(6)').css('display', 'none');
				

/***************************************************************
*	crops the "switch to mobil site"-link from below the
*	footer and appends it into the 4. footer-link-list 
***************************************************************/		
		var mobilLink = jQuery('#footer ~ p').html();
		jQuery('#footer ~ p').remove();
		jQuery('#footerContent .forthList').append('<li class="listEntry">' + mobilLink + '</li>');	


/***************************************************************
*	sets the computered width of the BG-element of 
*	light-blue headlines in overview-pages
***************************************************************/		
//		jQuery('#main .singleBlock h2 a').each(function(){
//			var newWidth = jQuery(this).innerWidth();
//			jQuery(this).parent('h2').css('width', newWidth);
//		});


/***************************************************************
*	sets the computered width of the BG-element of 
*	light-blue headlines in detail-pages
***************************************************************/		
//		var newWidth = jQuery('div.single h2 a').innerWidth();
//		jQuery('div.single h2').css('width', newWidth);


/***************************************************************
*	this gives audio-title a-elements additional classes
*	depending on playerposition
***************************************************************/		
		jQuery('#main a[hrefjQuery=.mp3]').addClass('inlineTitle');
		jQuery('#main a[hrefjQuery=.mp3][title]').removeClass('inlineTitle').addClass('lineTitle');
	

		
		
/***************************************************************
*	hides preliminaried link for mobilepages
***************************************************************/		
		jQuery('li.listEntry:contains(null)').css('display', 'none');
		

		
		
		
	});		// ende document.ready	



	
