$('html').keypress(function(event) {
    //alert(event.which+$(event.target).context.tagName);
    var ele=$(event.target).context.tagName;
    if (ele!="INPUT" && ele!="TEXTAREA") {
        switch(event.which){
          case 49:
            document.location.href='?id=27';
            break;
          case 50:
            $("#ws_content").attr("tabindex",-1).focus();
            break;
          case 51:
            //3
            break;
          case 52:
            $("#ws_suche_input_input").attr("tabindex",-1).focus();
            break;
          case 53:
            //5
            break;
          case 54:
            $("#ws_menu").attr("tabindex",-1).focus();
            break;
          case 57:
            document.location.href='?id=42';
            break;
          case 48:
            document.location.href='?id=40';
            break;
        }
    }

});


function ajaxcall(id,menuele,mode,control_mode){
    $.ajax({
        type: "POST",
        url: "/index.php",
        data: ({
            id: id,
            mode: 'ajax',
            control_mode: control_mode

        }),
        success: function(html){
            $("#ws_submenu").html(html);
            if(control_mode==1){
                clear_editmenus();
                createEditable();
            }
        }
    });

}
function setmetatags(id){
  $.ajax({
                type: "POST",
                url: "/ws_php/get_metatags.php",
                data: ({
                    id: id,
                }),
                success: function(r){
                    eval('var json='+r+';');
                    if(!document.all)$('title').html('Agentur Wicher - '+json.Name);
                    //console.log($('meta').length);
                    /*$('meta').each(function(){
                        console.log($(this).attr('name'));
                        switch($(this).attr('name')){
                            case 'description':
                                if(json.Description!='')$(this).attr('content',json.Description);
                                break;
                            case 'keywords':
                                if(json.Keywords!='')$(this).attr('content',json.Keywords);
                                break;
                            case 'Generator':
                                if(json.Generator!='')$(this).attr('content',json.Generator);
                                break;
                            case 'ContentLanguage':
                                $(this).attr('content',json.ContentLanguage);
                                break;
                        }
                    });*/


                }
            });
}
function ajaxsearchcall(search,menuele,mode,control_mode){
  if(mode=='main')
    $.ajax({
        type: "POST",
        url: "/index.php",
        data: ({
            mode: 'ajax',
            target: 'submenu',
            control_mode: control_mode

        }),
        success: function(html){
            $("#ws_submenu").html(html);
            if(control_mode==1){
                clear_editmenus();
                createEditable();
            }
        }
    });
  $.ajax({
    type: "POST",
    url: "/index.php",
    data: ({
        search: search,
        mode: 'ajax',
        target: 'content',
        control_mode: control_mode

    }),
    success: function(html){
        $("#ws_content").html(html);
        if($('div.rotator1').length==0){
            if(typeof(rot) !== 'undefined' && rot != null){}else{
              rot=setInterval('rotate()',3000);
            }
        }
        if(control_mode==1){
                clear_editmenus();
                createEditable();
            }
    }
  });
  set_menu(menuele,mode);
}
