﻿/*	--------------------------------------
	Alexander von Humboldt-Stiftung
*/

$(document).ready(function() {

	/* enable clicable elements */
	
	$("div.clickable, ul.clickable li").livequery(function() {
		$(this).mouseover(function() {
			$(this).addClass('chover');
		});
		$(this).mouseout(function() {
			$(this).removeClass('chover');
		});
		
		$(this).click(function() {
			$(this).find("a:first").attr("href", function () {
				thref = this.href;
				ttrgt = this.target;
				if(ttrgt) {
					window.open ( thref ,'new' ); 
				} else {
					window.location = thref;
				}
			});
		});
	});


	/* Filetype-links */
	/* external links */
	/* $('p a[target]').addClass( 'arrownewwin' ) ; */	
	
	//Apply CSS class to all A links that end in .pdf
	$("p a[href$='.pdf']").addClass("arrowdownload");
            
	//Apply CSS class to all A links that start with http://
	$("p a[href^='http://']").addClass("arrownewwin");

	//Remove CSS class to all A links that start with http://www.humboldt-foundation.de
	/* $("p a[href^='http://www.humboldt-foundation.de']").removeClass("arrownewwin"); */

	//Apply CSS class to all A links that start with mailto:
	/* $("a[href^='mailto:']").addClass("Mail"); */

	
	/* enable tabs */
	$(".tabs > ul").tabs({ fx: { opacity: 'toggle', duration: 'fast' } });

	/* enable shadowbox */
	var options = {
		loadingImage: '/dmrsc/img/loading.gif',
		flvPlayer: '/dmrsc/js/mediaplayer.swf',
		initialHeight: '240',
		initialWidht: '320',
		overlayColor: '#00693B'
    };
    Shadowbox.init(options);
    
    /* enable panels */
	$('.panel').livequery(function(){
		$(this).slidePanel({
			/* role:'accordion' */
		});
	});

	/*enable image rotation */
	$('#rotate').cycle({ 
		fx: 'fade',
		speed: 3000,
		continuous: true
	});

	/* defuscate e-Mail-Addresses */

	$('#content p, #content table:not(.picture) td, ul:not(.ui-tabs-nav)').livequery(function(){
		$(this).defuscate();
	});
	
	/*
	$('p').defuscate({link: false});
	*/

	/* add print-functionality */
	/*
	$("#printlink").append("<a href='javascript:window.print()'><img src='/dmrsc/img/print.gif' alt='Seite drucken' />Drucken</a>");
	*/
	
	/* enable popup-window */
	/*
	$('a.openwin').click(function(){
		var whref = this.href;
		var wname = this.name;
		var wopti = this.rel;
		window.open(whref,wname,wopti);
		return false;
	});
	*/
	
});

function gotopage(liste) {
	var index = liste.options.selectedIndex;
	if (index == 0) return null;
	var auswahl = liste.options[index];
	var text = auswahl.text;
	var value = auswahl.value;
	location.href=value;
}