$(document).ready(function() {    
  insertCloudControl('get_data_gen.aspx?rq=1');
  jQuery.get("redaktion_ajax.aspx","", function(data) {
		jQuery("#redaktion_content").html(data); 
		attachOver();				
		attachTooltip();		
		$('.mailButton').bind('click', function() { dlgTellAfriend(0, "", this) });
		if(!FlashDetect.installed) {	 
	     $(".ncheck").attr("href", "#");
	     $(".ncheck").click(function() {show_ng_flash_dialog()});
    }
	});   
});

function changePage(pageNo) {    
	jQuery.get("redaktion_ajax.aspx?pageNo=" + pageNo,"", function(data){
		jQuery("#redaktion_content").html(data); 
		attachOver();		
		attachTooltip();
		$('.mailButton').bind('click', function() { dlgTellAfriend(0, "", this) });
		if(!FlashDetect.installed) {	 
	     $(".ncheck").attr("href", "#");
	     $(".ncheck").click(function() {show_ng_flash_dialog()});
    }
		
	});
}

function merkliste() {    
	jQuery.get("merkliste.aspx","", function(data){
		jQuery("#merkliste_content").html(data); 
		});
}

// PROMO ROTATOR 
$(function(){   
	$('#promoImg').cycle({
        fx:     'fade',
        speed:  2000,
        timeout: 5000,       
        pager:  '#promoImgPagingBox',
	     	prev: '#promoImgPrev',
		    next: '#promoImgNext'		
	});
	/* apply class to page numbers */
	$('#promoImgPaging a').each(function(){
		if($(this).attr("class") == ""){
			$(this).addClass('pageNumber');
		};
	 });
	/* append the prev/next buttons */
	$('#promoImgPagingBox').append($('#promoImgPrev')).append($('#promoImgNext'));
	/* color the active link*/

	/* format numbers */
	$('#promoImgPagingBox a').each(function(){
		if($(this).hasClass("pageNumber")){	
			if(parseInt($(this).text()) < 10) {
				$(this).text("0" + $(this).text());	
			}
			if(parseInt($(this).text()) == 1) {
				$(this).addClass("activeSlide");	
			}
		}
	});

	// direct click on page numbers
	$('#promoImgPaging a').click(function(event){
		$(this).siblings('.selected').removeClass('selected');	
		$(this).addClass('selected');
	});
	
});