$(document).ready(
  function(){
    $(".auf_karte").click(
  function(){

  $("#openerng")
    .html('<iframe width="430" scrolling="no" height="330" frameborder="0" src="http://maps.google.de/maps?f=q&amp;source=s_q&amp;hl=de&amp;geocode=&amp;q='+$(this).attr("rel")+'&amp;ie=UTF8&amp;hq=&amp;hnear='+$(this).attr("rel")+'&amp;z=14&amp;iwloc=A&amp;output=embed" marginwidth="0" marginheight="0"></iframe>').dialog({
      modal : true,
      width: 455,
      height : 400,
      title : $(this).attr("href")
    });
  return false;    
  }
);
    $('#orange').cycle({
		fx: 'fadeZoom'
	});
	
   $("#orange img").click(
    function(){
   
      if($(this).attr("rel")!="home"){
        location.href=$(this).attr("rel");
      }else{
        $("#orange").remove();
      }
    }
   );
 
    
    $('#bilder_start').cycle({
		fx: 'fadeZoom',
		speed:  1000,
    timeout:  8000  
	});
	
   $("#bilder_start img").click(
    function(){
      if($(this).attr("rel")!="home"){
        location.href=$(this).attr("rel");
      }else{
        $("#orangen").remove();
      }
    }
   );

/*   
  $("#grossbild").click(function(){
    $("#openerng")
    .html('<img id="opener_bild_klick" src="http://www.nordgesichter.com/'+$(this).attr("src")+'" />')
    .dialog({
      modal : true,
      padding : 20,
      width : 470,
      height : 470,
      show : 'blind',
      hide : 'explode',
      title : $(this).closest("form").find(".main b:eq(0)").html()
    })
  });
  $(".i_open").click(function(){
    $("#openerng")
    .html('<img id="opener_bild_klick" src="http://www.nordgesichter.com/'+$(this).attr("rel")+'" />')
    .dialog({
      modal : true,
      padding : 20,
      width : 470,
      height : 470,
      show : 'blind',
      hide : 'explode',
      title : $(this).closest("form").find(".main b:eq(0)").html()
    })
  }); */
/* $(".i_open").hover(
  function(){
      $("#grossbild").attr("src",$(this).attr("rel"));
  }
 );  */
 $("#opener_bild_klick").live("click",function(){
  $("#openerng").dialog("close");
 });
 
 $("#sidebar a").each(
  function(){
    if( $(this).html() == "NEU" || $(this).html() == "<b>NEU</b>"){
      $(this).css({
        color : "#2DB34A",
        fontWeight : "bold"
      });
    } 
    if( $(this).html() == "FUNDGRUBE" || $(this).html() == "<b>FUNDGRUBE</b>"){
      $(this).css({
        color : "#FF0000",
        fontWeight : "bold"
      });
    }
     if( $(this).html() == "WINTERSALE" || $(this).html() == "<b>WINTERSALE</b>"){
      $(this).css({
        color : "#FF0000",
        fontWeight : "bold"
      });
    }
  }
 );
 $(".button").button();
$("#link_wk").click(
  function(){
    $("#openerng")
    .html( '<table width="100%">'+$("#wk").html()+'</table>' )
    .dialog({
      modal : true,
      title : "Ihr Warenkorb",
      width: 400,
      height : 400,
      buttons : {
        "Warenkorb bearbeiten" : function(){
          window.location.href="http://"+window.location.hostname+"/shopping_cart.php";
        },
        "zur Kasse" : function(){
            window.location.href="http://"+window.location.hostname+"/checkout_shipping.php";
        }
      }
    });
    return false;
  }
);
 $("#versandkosten_klick").click(
  function(){
    
    $("#openerng")
    .load($(this).attr("href") + " #ajaxcont")
    .dialog({
      modal : true,
      title : "Versandkosten",
      width : 600,
      buttons : {
        "schließen" : function(){
          $(this).dialog("close");
        }
      }    
    });
    return false;
  }
 );
 
  $("#tabelle_klick").click(
  function(){
    
    $("#openerng")
    .load($(this).attr("href") + " .main")
    .dialog({
      modal : true,
      title : "Größentabelle",
      width : 600,
      buttons : {
        "schließen" : function(){
          $(this).dialog("close");
        }
      }    
    });
    return false;
  }
 );
  /* 
 $(".i_open").hover(
  function(){
    $('#zoombild').attr("href", $(this).attr("rel") );

  }
 );

    
 $(".i_open").click(
  function(){
    $('#zoombild')
    .attr("href", $(this).attr("rel") );
    }
 ); */
 
  $('#zoombild').jqzoom({
            xOffset:135,  
            yOffset:0,
            zoomWidth: 330,  
            zoomHeight: 417,  
            position:'right'  
  });  
 
// ende document ready 
 });

