﻿//$(document).ready(function() {
//    $('#menuitemlist tbody td').click(function(event) {
//        //alert('hej');
//        if ($(this).is('.name'))
//            return;
//        $(this).parent().children().removeClass('sel');
//        $(this).addClass('sel');

//        for (i = 0; i <= 5; i++) {
//            if ($(this).parent().children().eq(i).is('.sel'))
//                if ($(this).parent().attr('id') == -1)
//                    $("#ctl00_ContentPlaceHolder1_NewhidLevel").val(i)
//                else
//                    $("#ctl00_ContentPlaceHolder1_hidLevel" + $(this).parent().attr('id')).val(i)
//        }

//    });
//    $('.switchup').click(function(event) {
//        switchrows($(this).parent().parent(), $(this).parent().parent().prev());
//    });
//    $('.switchdown').click(function(event) {
//        switchrows($(this).parent().parent(), $(this).parent().parent().next());
//    });
//});
//function switchrows(first, second) {    
//    var me = $(this).parent()
//    var values = new Array();
//    var index = $("#ctl00_ContentPlaceHolder1_hidIndex" + first.attr("id")).val()
//    $("#ctl00_ContentPlaceHolder1_hidIndex" + first.attr("id")).val($("#ctl00_ContentPlaceHolder1_hidIndex" + second.attr("id")).val())
//    $("#ctl00_ContentPlaceHolder1_hidIndex" + second.attr("id")).val(index)

//    
//    var id = first.attr("id");
//    first.attr("id", second.attr("id"));
//    second.attr("id", id);
//    if (first.children().length == 8) {
//        for (i = 0; i <= 4; i++) {
//            if (first.children().eq(i).is(".sel"))
//                values[i] = true
//            else
//                values[i] = false

//            if (second.children().eq(i).is(".sel"))
//                first.children().eq(i).addClass('sel');
//            else
//                first.children().eq(i).removeClass('sel');

//            if (values[i])
//                second.children().eq(i).addClass('sel');
//            else
//                second.children().eq(i).removeClass('sel');
//        }

//        for (i = 5; i <= 6; i++) {
//            values[i] = first.children().eq(i).html();
//            first.children().eq(i).html(second.children().eq(i).html());
//            second.children().eq(i).html(values[i]);
//        }
//    }
//    else {
//        for (i = 0; i <= 1; i++) {
//            values[i] = first.children().eq(i).html();
//            first.children().eq(i).html(second.children().eq(i).html());
//            second.children().eq(i).html(values[i]);
//        }
//    }

//}
