var fuenf=5;
//Box ausblenden
function ausblenden() {
  document.getElementById('box2').innerHTML='';
  void(0);
}


//Merkliste +
function merkadd(lID)  {
ajax.update('/merkadd.php?lID='+lID,'watchlist',1);
$(".watchlist").fadeIn(300),
$('.overlay').css('filter', 'alpha(opacity=75)');
$(".overlay").css('opacity', '0.75');
$(".overlay").css('display', 'block');



void(0);
}

$(document).ready(function() {




$('.closeme, .closeme2').click(function() {
 $('.popup').fadeOut(600);
 $('.overlay').fadeOut(600)
 return false;
 });


function getKey(ev) {
 if (!ev) ev = window.event;
 if ((typeof(ev.which) == "undefined" || (typeof(ev.which) == "number" && ev.which == 0)) && typeof(ev.keyCode) == "number") 
 return ev.keyCode; 
 else 
 return ev.which;
}


document.onkeydown = function(e){
// document.getElementById("abfangen").focus();
 kc = getKey(e);
// alert(kc);
 if(kc==27){
 $('.popup').fadeOut(600);
 $('.overlay').fadeOut(600);
	 
 }
}
 

$(".gal_box_content").mouseover(
function(){ $(".gal_category_articlezoom").fadeOut(100); });

$(".gal_category_article_wrap .article_image").mouseover(
function(){
$(".gal_category_articlezoom").fadeOut(100);
$(this).parent().next(".gal_category_articlezoom").fadeIn(100);
}
);

$(".gal_category_articlezoom").hover(
function(){},function(){
 $(this).fadeOut(100);
}
);


 $(".4popup_1").click(
function(){

 $(".popup_1").fadeIn(300),
$('.overlay').css('filter', 'alpha(opacity=75)');
$(".overlay").css('opacity', '0.75');
$(".overlay").css('display', 'block');

}
);

 $(".4popup_2").click(
function(){

 $(".popup_2").fadeIn(300),
$('.overlay').css('filter', 'alpha(opacity=75)');
$(".overlay").css('opacity', '0.75');
$(".overlay").css('display', 'block');

}
);

$(".4popup_3").click(
function(){

 $(".popup_3").fadeIn(300),
$('.overlay').css('filter', 'alpha(opacity=75)');
$(".overlay").css('opacity', '0.75');
$(".overlay").css('display', 'block');

}
);


$(".4popup_4").click(
function(){

 $(".popup_4").fadeIn(300),
$('.overlay').css('filter', 'alpha(opacity=75)');
$(".overlay").css('opacity', '0.75');
$(".overlay").css('display', 'block');

}
);

$(".4popup_8").click(
function(){

 $(".popup_8").fadeIn(300),
$('.overlay').css('filter', 'alpha(opacity=75)');
$(".overlay").css('opacity', '0.75');
$(".overlay").css('display', 'block');

}
);

$(".overlay1").click(
function(){

 $(".popup_5").fadeIn(300),
$('.overlay').css('filter', 'alpha(opacity=75)');
$(".overlay").css('opacity', '0.75');
$(".overlay").css('display', 'block');

}
);

$(".overlay2").click(
function(){

 $(".popup_6").fadeIn(300),
$('.overlay').css('filter', 'alpha(opacity=75)');
$(".overlay").css('opacity', '0.75');
$(".overlay").css('display', 'block');

}
);

$(".overlay3").click(
function(){

 $(".popup_7").fadeIn(300),
$('.overlay').css('filter', 'alpha(opacity=75)');
$(".overlay").css('opacity', '0.75');
$(".overlay").css('display', 'block');

}
);

$(".overlay4").click(
function(){
 $(".popup_9").fadeIn(300),
$('.overlay').css('filter', 'alpha(opacity=75)');
$(".overlay").css('opacity', '0.75');
$(".overlay").css('display', 'block');

}
);

$(".overlay5").click(
function(){
 $(".popup_10").fadeIn(300),
$('.overlay').css('filter', 'alpha(opacity=75)');
$(".overlay").css('opacity', '0.75');
$(".overlay").css('display', 'block');

}
);



$(".agbpopup").click(
function(){

 $(".agbpopup1").fadeIn(300),
$('.overlay').css('filter', 'alpha(opacity=75)');
$(".overlay").css('opacity', '0.75');
$(".overlay").css('display', 'block');

}
);



$(".versandpopup").click(
function(){

 $(".versandpopup1").fadeIn(300),
$('.overlay').css('filter', 'alpha(opacity=75)');
$(".overlay").css('opacity', '0.75');
$(".overlay").css('display', 'block');

}
);



$(".bestellpopup").click(
function(){

 $(".bestellpopup1").fadeIn(300),
$('.overlay').css('filter', 'alpha(opacity=75)');
$(".overlay").css('opacity', '0.75');
$(".overlay").css('display', 'block');
}
);




$(".zoomtrigger").mouseover(
function(){

 $(this).find(".zoom").fadeIn(100);
}
);
$(".zoom").hover(
function(){},function(){
 $(this).fadeOut(100);
}
);




$(".gal_headfacebook").hover(
function(){
 $(".gal_headfacebook .facebookover").fadeIn(100);
},
function(){
 $(".gal_headfacebook .facebookover").fadeOut(300);
}


);



$(".stern").click(function(){
 $(this).prevAll(".stern").addClass("sterna");
 $(this).nextAll(".stern").removeClass("sterna");
 $(this).addClass("sterna");
 document.getElementById('bewertung').value =$(".sterna:last").html();
}
);
$(".stern").hover(
function(){
 $(".bewert a").css("opacity","1");

},
function(){

 $(".bewert a").css("opacity","0.8");
}


);



$(".gal_category_sort").toggle(function(){ $(".gal_category_filter").css('display','block').stop().animate( { opacity:1},150); },
 function(){ $(".gal_category_filter").css('display','block').stop().animate( { opacity:0},150); } );

/*
 $(".topmenu").hover(
 function () {
 //animate padding:0 ist nur für ein "abbrechbares" delay zuständig
	$(this).find('div').stop().animate({ padding:0 }, 50, function(){ $(this).animate({ width: '125px',height: '125px', marginTop:'0px',marginLeft:'0px' }, 300 ) } ); 
 	$(this).find('img:first').css('zIndex', '1000').stop().animate({ margin:0 }, 50, function(){ $(this).animate({ width: '125px',height: '125px'}, 300 ) } ); 
    $(this).find('.submenu').stop().css('left','0px').animate({ overflow:'normal' }, 250, function() { $(this).animate({ opacity:'1' }, 300 ) } );
 }, 
 function () {
	$(this).find('.submenu').stop().animate({ opacity: 0 }, 150, function() { $(this).css('left','-3000px')} ); //ausblenden und breite=0 (macht sonst andere mouseover kaputt!)
 $(this).find('img:first').css('zIndex','0').stop().animate({ width: '95px', height: '95px' }, 300, function() {} ); //größe herstellen
	$(this).find('div').stop().animate({ width: '95px',height: '95px', marginTop:'15px',marginLeft:'15px' }, 300); //größe & abstände herstellen
 });
});
*/	


 $(".topmenu").hover(
 function () {
 //animate padding:0 ist nur für ein "abbrechbares" delay zuständig
	$(this).find('div').stop().animate({ padding:0 }, 50, function(){ $(this).animate({ width: '125px',height: '125px', marginTop:'0px',marginLeft:'0px' }, 300 ) } ); 
 	$(this).find('img:first').css('zIndex', '1000').stop().animate({ margin:0 }, 50, function(){ $(this).animate({ width: '125px',height: '125px'}, 300 ) } ); 
    $(this).find('.submenu').stop().css('left','-2000px').animate({ marginTop:'0' }, ($(this).find('.submenu').hasClass('submenu8')?600000:1000), function() { $(this).css('left','0px').animate({ opacity:'1' }, 300 ) } );
 }, 
 function () {
	$(this).find('.submenu').stop().animate({ opacity: 0 }, 150, function() { $(this).css('left','-3000px')} ); //ausblenden und breite=0 (macht sonst andere mouseover kaputt!)
 $(this).find('img:first').css('zIndex','0').stop().animate({ width: '95px', height: '95px' }, 300, function() {} ); //größe herstellen
	$(this).find('div').stop().animate({ width: '95px',height: '95px', marginTop:'15px',marginLeft:'15px' }, 300); //größe & abstände herstellen
 });
});


		

 $(document).ready(function(){
 $("#slider").easySlider({
 auto: true,
 continuous: true,
 numeric: true,
 pause: 7000,
 speed: 500
 });
 });




 Cufon('ol#controls li a', {
 color: '-linear-gradient(#fff, 0.1=#fff, 0.8=#ccc, #ccc)',
 textShadow: '1px 1px rgba(51, 51, 51, 0.9)'
 });
 Cufon('.btn.green', {
 color: '-linear-gradient(#fff, 0.1=#fff, 0.8=#ccc, #ccc)',
 textShadow: '1px 1px rgba(51, 51, 51, 0.9)',
 hover: {
 color: '-linear-gradient(#fff, #fff)'
 }
 });
 Cufon('.btn.greens', {
 color: '-linear-gradient(#fff, 0.1=#fff, 0.8=#ccc, #ccc)',
 textShadow: '1px 1px rgba(51, 51, 51, 0.9)',
 hover: {
 color: '-linear-gradient(#fff, #fff)'
 }
 });
 Cufon('.admin_edit h1 ol', {
 color: '-linear-gradient(#fff, 0.1=#fff, 0.8=#ccc, #ccc)',
 textShadow: '1px 1px rgba(51, 51, 51, 0.9)',
 hover: {
 color: '-linear-gradient(#fff, #fff)'
 }
 });
 Cufon('.popup h1', {
 color: '-linear-gradient(#8bcc1d, 0.1=#8bcc1d, 0.8=#68a216, #68a216)',
 textShadow: '1px 1px rgba(51, 51, 51, 0.9)',
 hover: {
 color: '-linear-gradient(#fff, #fff)'
 }
 });
 
  Cufon('.popup #rot h1', {
 color: '-linear-gradient(#cc0000, 0.1=#cc0000, 0.8=#ff0000, #ff0000)',
 textShadow: '1px 1px rgba(51, 51, 51, 0.9)',
 hover: {
 color: '-linear-gradient(#fff, #fff)'
 }
 });
 
 Cufon('.gal_vorteilpreis h3, .halfright h3, .halfleft h3', {
 color: '-linear-gradient(#8bcc1d, 0.1=#8bcc1d, 0.8=#68a216, #68a216)',
 textShadow: '1px 1px rgba(51, 51, 51, 0.9)'
 });
 Cufon('.btn.std', {
 color: '-linear-gradient(#333, 0.1=#333, 0.8=#757575, #757575)',
 hover: {
 color: '-linear-gradient(#333, black)'
 }
 });
 Cufon('.gesamtsumme ', {
 color: '-linear-gradient(#8bcc1d, 0.1=#8bcc1d, 0.8=#68a216, #68a216)',
 textShadow: '1px 1px rgba(51, 51, 51, 0.9)'
 });



$(function() {
 //scrollpane parts
 var scrollPane = $( ".scroll-pane" ),
 scrollContent = $( ".scroll-content" );

 //build slider
 var scrollbar = $( ".scroll-bar" ).slider({
 slide: function( event, ui ) {
 if ( scrollContent.width() > scrollPane.width() ) {
 scrollContent.css( "margin-left", Math.round(
 ui.value / 100 * ( scrollPane.width() - scrollContent.width() )
 ) + "px" );
 } else {
 scrollContent.css( "margin-left", 0 );
 }
 }
 });

 //append icon to handle
 var handleHelper = scrollbar.find( ".ui-slider-handle" )
 .mousedown(function() {
 scrollbar.width( handleHelper.width() );
 })
 .mouseup(function() {
 scrollbar.width( "100%" );
 })
 .append( "<span class='ui-icon ui-icon-grip-dotted-vertical'></span>" )
 .wrap( "<div class='ui-handle-helper-parent'></div>" ).parent();

 //change overflow to hidden now that slider handles the scrolling
 scrollPane.css( "overflow", "hidden" );

 //size scrollbar and handle proportionally to scroll distance
 function sizeScrollbar() {
 var remainder = scrollContent.width() - scrollPane.width();
 var proportion = remainder / scrollContent.width();
 var handleSize = scrollPane.width() - ( proportion * scrollPane.width() );
 scrollbar.find( ".ui-slider-handle" ).css({
 width: handleSize,
 "margin-left": -handleSize / 2
 });
 handleHelper.width( "" ).width( scrollbar.width() - handleSize );
 }

 //reset slider value based on scroll content position
 function resetValue() {
 var remainder = scrollPane.width() - scrollContent.width();
 var leftVal = scrollContent.css( "margin-left" ) === "auto" ? 0 :
 parseInt( scrollContent.css( "margin-left" ) );
 var percentage = Math.round( leftVal / remainder * 100 );
 scrollbar.slider( "value", percentage );
 }

 //if the slider is 100% and window gets larger, reveal content
 function reflowContent() {
 var showing = scrollContent.width() + parseInt( scrollContent.css( "margin-left" ), 10 );
 var gap = scrollPane.width() - showing;
 if ( gap > 0 ) {
 scrollContent.css( "margin-left", parseInt( scrollContent.css( "margin-left" ), 10 ) + gap );
 }
 }

 //change handle position on window resize
 $( window ).resize(function() {
 resetValue();
 sizeScrollbar();
 reflowContent();
 });
 //init scrollbar size
 setTimeout( sizeScrollbar, 10 );//safari wants a timeout
 });
