/**
 * Description: Customized JavaScript Document for JavaScript.
 * Version: 1.0
 * Author: Peter Rozek
 * Tags: DPL, Palettenlogistik
 *
 * @version			1.0
 * @lastmodified	$Date: 2010-10-01 10:26:40 +0200 (fr,  Oktober 2010)$
 * @type			function.js
*/


// JavaScript Document customized for print
function smartPrintPage() {
	document.write(  "<a href=\"#\" onclick=\"window.print();return false;\" class=\"icon_print\">Seite drucken<\/a>" );
}

/**
 * Javascript snippes aus Einfuehrung in WAI ARIA (http://www.hessendscher.de/wai-aria/) 
 * Date: 2009-04-09 15:11:35 -0500 (Thu, 09 April 2009)
 */
function addARIARole(strID, strRole)
{
    // Find the element to add a role property to
    var objElement = document.getElementById(strID);

    if (objElement)
    {
        // Add the role property to the element
        objElement.setAttribute('role', strRole);
    }
}
function setupARIA()
{
    // Add ARIA roles to the document
    addARIARole('header', 'banner');
    addARIARole('content', 'main');
    addARIARole('floatcontent', 'main');
    addARIARole('metanav', 'navigation');
    addARIARole('mainmenu', 'navigation');
    addARIARole('subnavigation', 'navigation');
    addARIARole('subcontent', 'complementary');
    addARIARole('footer', 'contentinfo');
}

window.onload = setupARIA;

/**
 * jQuery Plugins
 * Date: 2010-12-19 15:11:35 -0500 (Su, 29 Dezember 2010)
 */

jQuery(document).ready(function($){

	// Images Slider Homepage
	$('#slider').cycle({
		fx: 'fade',
		speed: 2000,
		timeout: 6000
	});
	
	// jQuery Settings Fancybox
	$("a.lightbox").fancybox({
		'autoScale' : false,
		'overlayShow'	: true,
		'overlayOpacity' : 0.5,
		'overlayColor' : '#aaa',
		'titlePosition'	: 'inside',
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic'
	});
	
	// Settings the elements for jQuery Carousel Homepage
	$(".teasergroup ul").attr('id','mycarousel');
  	$(".teasergroup").find("ul").addClass("jcarousel-skin");

	function mycarousel_initCallback(carousel)
	{
	    // Disable autoscrolling if the user clicks the prev or next button.
	    carousel.buttonNext.bind('click', function() {
	        carousel.startAuto(0);
	    });
	
	    carousel.buttonPrev.bind('click', function() {
	        carousel.startAuto(0);
	    });
	
	    // Pause autoscrolling if the user moves with the cursor over the clip.
	    carousel.clip.hover(function() {
	        carousel.stopAuto();
	    }, function() {
	        carousel.startAuto();
	    });
	};

    jQuery('#mycarousel').jcarousel({
        scroll: 1,       
        auto: 4,
        wrap: 'both',
        animation: 1000,
        initCallback: mycarousel_initCallback
    });
    
    // Settings hover functions main navigation
    $(".li-up").find("ul").addClass("menu_body");
	$("#nav ul li").hover(function(){
		$(this)
			.find('ul.menu_body')
			.stop(true, true)
			.slideDown('fast');
	}, function() {
		$(this)
			.find('ul.menu_body')
			.stop(true, true)
			.slideUp('fast');
	});
	
	// settings height for doorpageteaser
	$('.teasergroup .col').syncHeight();
	
	// customized form elememts, Kundenformular
	$(".csc-frame-frame1").find('.csc-mailform-field').eq(17).addClass('group');
	$(".csc-frame-frame1").find('.csc-mailform-field').eq(18).addClass('groupr');
	$(".csc-frame-frame1").find('.csc-mailform-field').eq(19).addClass('label');
	
	// customized form elememts, lieferantenformular
	$(".csc-frame-frame2").find('.csc-mailform-field').eq(9).addClass('group');
	$(".csc-frame-frame2").find('.csc-mailform-field').eq(10).addClass('groupr');
	$(".csc-frame-frame2").find('.csc-mailform-field').eq(11).addClass('label');
	
	$(".csc-frame-frame2").find('.csc-mailform-field').eq(12).addClass('group');
	$(".csc-frame-frame2").find('.csc-mailform-field').eq(13).addClass('groupr');
	$(".csc-frame-frame2").find('.csc-mailform-field').eq(14).addClass('label');
	
	$(".csc-frame-frame2").find('.csc-mailform-field').eq(15).addClass('group');
	$(".csc-frame-frame2").find('.csc-mailform-field').eq(16).addClass('groupr');
	$(".csc-frame-frame2").find('.csc-mailform-field').eq(17).addClass('label');

	$(".csc-frame-frame2").find('.csc-mailform-field').eq(20).addClass('group');
	$(".csc-frame-frame2").find('.csc-mailform-field').eq(21).addClass('groupr');
	$(".csc-frame-frame2").find('.csc-mailform-field').eq(22).addClass('label');
	
	$(".csc-frame-frame2").find('.csc-mailform-field').eq(23).addClass('group');
	$(".csc-frame-frame2").find('.csc-mailform-field').eq(24).addClass('groupr');
	$(".csc-frame-frame2").find('.csc-mailform-field').eq(25).addClass('label');
	
	$(".csc-frame-frame2").find('.csc-mailform-field').eq(28).addClass('group');
	$(".csc-frame-frame2").find('.csc-mailform-field').eq(29).addClass('groupr');
	$(".csc-frame-frame2").find('.csc-mailform-field').eq(30).addClass('label');
	
	$(".csc-frame-frame2").find('.csc-mailform-field').eq(31).addClass('group');
	$(".csc-frame-frame2").find('.csc-mailform-field').eq(32).addClass('groupr');
	$(".csc-frame-frame2").find('.csc-mailform-field').eq(33).addClass('label');	
	
});


