jQuery.noConflict();
jQuery(document).ready(function() {

	jQuery('.content_navi a,.content a').each(function(index) {

		jQuery(this).attr("href", jQuery(this).attr("href") + "#top");
	});

	jQuery('body').bgStretcher({
		images : ['fileadmin/images/body_bg.jpg'],
		imageWidth : 1299,
		imageHeight : 1057,
		slideShow : false
	});

	jQuery('.news_list ul').jcarousel({
		scroll : 1,
		easing : "swing",
		animation : 1500,
		vertical : true
	});


	

	jQuery(".news_detail span:first").show();
	jQuery('.news_list ul li').click(function() {

		jQuery(".news_detail span.item_detail").hide();
		jQuery("." + jQuery(this).attr("id") + "_text").fadeIn();
		jQuery('.scroll_wrap_1').jScrollPane({showArrows : true});
		
	});
	
	jQuery('.scroll_wrap_1').jScrollPane({showArrows : true});
	/*
	 * Slider
	 */
	var count = jQuery(".slider .csc-default").size();
	var size = (count * 265);
	jQuery(".wrap").css("width", size);

	jQuery('.slider').jScrollPane({
		showArrows : true
	});
	
	jQuery('.scroll_wrap').jScrollPane({showArrows : true});

	jQuery('.spalten').jScrollPane({showArrows : true});

	/*
	 * Fancybox fÃ¼r Imagefilm
	 */
	jQuery("a.fancyvideo").fancybox({
		'transitionIn' : 'elastic',
		'transitionOut' : 'elastic',
		'type' : 'iframe',
		'padding' : '0',
		'autoDimensions' : false,
		'width' : 320,
		'height' : 240,
		'scrolling' : 'no'
	});

	jQuery("a.lightbox").fancybox();

	jQuery('#powermaildiv_uid35 input').click(function() {
		jQuery.ajax({
			url : getBaseURL() + "/fileadmin/php/functions.php",
			type : "GET",
			data : {
				mode : "nein"
			},
			dataType : 'text',
			async : false,
			success : function(data, status) {

			}
		});
		
		location.href="index.php?id=38";
		
		//history.back();
	});
	
	jQuery('#powermaildiv_uid33 input').click(function() {
		location.href="index.php?id=38";
	});
	var temp_id = jQuery("fieldset.tx-powermail-pi1_fieldset").attr("id");
	if(temp_id) {
		jQuery(".tx_powermail_pi1_submitmultiple_forward").attr("id", temp_id);
	}

	/*
	 * Umfrage
	 */

	jQuery("input#tx-powermail-pi1_fieldset_3").click(function() {
		jQuery.ajax({
			url : getBaseURL() + "/fileadmin/php/functions.php",
			type : "GET",
			data : {
				mode : "ja"
			},
			dataType : 'text',
			async : false,
			success : function(data, status) {

			}
		});
	});
	
	
	/*
	 * Umfrageergebnis bestimmen
	 */
	jQuery.ajax({
			url : getBaseURL() + "/fileadmin/php/functions.php",
			type : "GET",
			data : {
				mode : "get"
			},
			dataType : 'text',
			async : false,
			success : function(data, status) {
				jQuery(".umfrage").text(data);
			}
		});
	
	
});
function getBaseURL() {
	var url = location.href;
	// entire url including querystring - also: window.location.href;
	var baseURL = url.substring(0, url.indexOf('/', 14));

	if(baseURL.indexOf('http://localhost') != -1) {
		// Base Url for localhost
		var url = location.href;
		// window.location.href;
		var pathname = location.pathname;
		// window.location.pathname;
		var index1 = url.indexOf(pathname);
		var index2 = url.indexOf("/", index1 + 1);
		var baseLocalUrl = url.substr(0, index2);

		return baseLocalUrl + "/";
	} else {
		// Root Url for domain name
		return baseURL + "/";
	}
}
