function ct_send(ct)
{
    document.getElementById('ct').value = ct
    //alert(document.getElementById('ct').value)
    document.form_main.submit()
}
function ow (url, w, h)
{
    var centerWidth = (window.screen.width - w) / 2;
    var centerHeight = (window.screen.height - h) / 2;
    newWindow = window.open(url,"","width=" + w + ",height=" + h + ",toolbar=no,menubar=no,scrollbars=no,status=no,location=no");
    newWindow.moveTo(centerWidth, centerHeight);
    newWindow.blur();
    newWindow.focus();
}

function sleep(milliSeconds)
{
    var startTime = new Date().getTime(); // get the current time
    while (new Date().getTime() < startTime + milliSeconds); // hog cpu
    
}

$(document).ready( function() {
    isIE6 = /msie|MSIE 6/.test(navigator.userAgent)
    if(!isIE6)
        $(document).pngFix();
    
    card_imgs = $('.card_img')
    if(card_imgs.length)
        card_imgs.lightBox(); // Select all links in the page

    yourclass = $('.yourclass')
    if(yourclass.length)
        yourclass.amail('(s)','(d)')


    // Import GET Vars
    document.$_GET = [];
    var urlHalves = String(document.location).split('?');
    if(urlHalves[1]){
       var urlVars = urlHalves[1].split('&');
       for(var i=0; i<=(urlVars.length); i++){
          if(urlVars[i]){
             var urlVarPair = urlVars[i].split('=');
             document.$_GET[urlVarPair[0]] = urlVarPair[1];
          }
       }
    }
    
    /*
        $('.content_113Z h2').click(function() {
            $(this).nextUntil('h2').toggle('slow');
            return false;
        }).nextUntil('h2').hide();
    
        $('.content_113ZZ h2:nth-child(2)').click(function() {
            $(this).nextUntil('h2').toggle('slow');
            return false;
        }).nextUntil('h2').hide();
    */
    
    //alert(document.$_GET['n'])
    
    if(document.$_GET['n'])
    {
        n = parseInt(document.$_GET['n']) - 1
        //alert(n)
        $('.content_113 h2:not(:eq(' + n.toString() + '))').nextUntil('h2').hide()
    }
    $('.content_113 h2').click(function() {
        $(this).nextUntil('h2').toggle('slow');
        return false;
    })    
    //$('.content_113 h2:eq(1)').nextUntil('h2').show()



});

$(document).ready(function() {
    $('.tab_view tbody tr:odd').addClass('trbodyodd');
    $('.tab_view tbody tr:even').addClass('trbody');

    $('.viewRowsTable tbody tr').hover(function() {
            $(this).addClass('sel');                
        }, function() {                
              $(this).removeClass('sel');                
        })

    set_disable()

    $('.viewRowsTable tr')
        .filter(':has(:checkbox:checked)')
        .addClass('trselected')
        .end()
        .click(function(event) {
            $(this).toggleClass('trselected');
            
            if (event.target.type !== 'checkbox') {
                $(':checkbox', this).attr('checked', function() {
                    return !this.checked;
                });
            }
            set_disable()
        })
        
})

function set_disable()
{
    check_cnt = $("#form_main :input:checked").size()
    if(check_cnt == 1)
        $('.check_one').removeAttr("disabled").css("color","#000")
    else
        $('.check_one').attr("disabled","true").css("color","#bbb")

    if(check_cnt > 0)
        $('.check_gt0').removeAttr("disabled").css("color","#000")
    else
        $('.check_gt0').attr("disabled","true").css("color","#bbb")
}

function selectAll(elem)
{
    f = elem.form;
    check_cnt = 0
    for(i=0; f.elements[i]; i++) {
        if(f.elements[i].type == 'checkbox') {
            f.elements[i].checked = elem.checked;
            
            if(f.elements[i].checked) {
                check_cnt++
            } else {
                //check_cnt = 0
            }
        }
    }
    set_disable()
}

$(document).ready(function()
{
    $('#menu li ').hover(  
        //Mouseover, fadeIn the hidden hover class    
        function() {
            $(this).children('ul').fadeIn(100)
            //.css('visibility', 'visible');
        },   
        //Mouseout, fadeOut the hover class  
        function() {  
            $(this).children('ul').fadeOut(100);      
    }).click (function () {  
        //Add selected class if user clicked on it  
        $(this).addClass('selected');  
    });
})

