
if (! ('console' in window) || !('firebug' in console)) {
    var names = ['log', 'debug', 'info', 'warn', 'error', 'assert', 'dir', 'dirxml', 'group', 'groupEnd', 'time', 'timeEnd', 'count', 'trace', 'profile', 'profileEnd'];
    window.console = {};
    for (var i = 0; i < names.length; ++i) window.console[names[i]] = function() {};
}

function editorInitAbs(type,e_mode,ta_name) {
    switch (type) {
        case "full":
            pins = "style,layer,table,advhr,advimage,advlink,noneditable,visualchars,nonbreaking,xhtmlxtras,template,paste,directionality,fullscreen,preview,filemanager",
            tab1 = "bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,bullist,numlist,separator,ltr,rtl,separator,link,unlink,image";
            tab2 = "redo,undo,separator,fontselect,fontsizeselect,formatselect,forecolor,separator,table,col_after,col_before,row_after,row_before,delete_col,delete_row,row_props,cell_props";
            tab3 = "hr,removeformat,separator,sub,sup,separator,charmap,pasteword,expers_mess";
        break;
        case "base":
            pins = "style,layer,advlink,visualchars,nonbreaking,paste,directionality,fullscreen,preview,filemanager",
            tab1 = "bold,italic,underline,undo,redo,link,unlink,separator,image,separator,fontselect";
            tab2 = "";
            tab3 = "";
        break;
        case "simple":
            pins = "style,layer,advlink,visualchars,nonbreaking,paste,directionality,fullscreen,preview",
            tab1 = "bold,italic,underline,undo,redo,link,unlink";
            tab2 = "";
            tab3 = "";
        break;   
    }
    
    tinyMCE.init({
            mode : ""+e_mode+"",
            elements : ""+ta_name+"",
            theme : "advanced",
            //plugins : "zoom,flash",
            plugins : "style,layer,table,advhr,advimage,advlink,noneditable,visualchars,nonbreaking,xhtmlxtras,template,paste,directionality,fullscreen,preview,expers_mess,filemanager",
            theme_advanced_buttons1 : ""+tab1+"",
            theme_advanced_buttons2 : ""+tab2+"",
            theme_advanced_buttons3 : tab3,
            theme_advanced_toolbar_location : "top",
            theme_advanced_toolbar_align : "left",
            theme_advanced_path_location : "bottom",
            extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|style],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style],object[align|width|height],param[name|value],embed[src|type|wmode|width|height]",
            language : "hu",
            relative_urls:false,
        remove_script_host : false,
        convert_urls : false            
    });     
}

    function mxDataTable(params)
    {
        var defaultParams = {
                tableSelector:  "", 
                qData:          {"qr" : ""},
                sAjaxSource:    "/dt.php",
                aaSorting:      ""
        };

        if ( params ) { 
            $.extend( defaultParams, params );
        }
        
        params = defaultParams;
        console.log(params);
        return $(params.tableSelector).dataTable({
            bJQueryUI: true
            ,sPaginationType: "full_numbers"
            ,iDisplayLength: 10
            ,bProcessing: true
            ,bServerSide: true
            ,bStateSave: true
            ,sAjaxSource: params.sAjaxSource             
            ,aaSorting: params.aaSorting
            ,oLanguage: {
             sUrl: "/js/DataTables/jquery.dataTables.hu.json"
            }
            ,qData: params.qData
            ,fnServerData: function ( sSource, aoData, fnCallback ) {
                console.log(this.dataTableSettings[0].oInit.qData);
                $.each(this.dataTableSettings[0].oInit.qData, function(index, val)
                {
                   if(val instanceof jQuery)
                   {
                       aoData.push( { "name": index, "value": $(val).val() } );
                   }
                   else if(val.transform != undefined)
                   {
                       aoData.push( { "name": index, "value": val.transform(val.data) } );
                   }
                   else
                   {
                    aoData.push( { "name": index, "value": val } );
                   }
                });
            //aoData.push( { "name": "qr", "value": params.tableName } );
            $.getJSON( sSource, aoData, function (json) { 
                fnCallback(json);
            } );
            }             
        });    
    }    
 
 
$(document).ready(function () {
	$('#basic-modal input.basic, #basic-modal a.basic').click(function (e) {
		e.preventDefault();
		$('#basic-modal-content').modal();
	});
    $(".printPage").click(function(e) {
        e.preventDefault();
        window.print();
    });
    $(".button_ok").click(function() {
        $(this).parents('form:first').submit();
    });

    $(".sure").click(function(e) {
        if(!confirm("Biztos benne?")) e.preventDefault();
    });

    $(".button").button();

});
