var num = new Array();
    num[0] = '๐';
    num[1] = '๑';
    num[2] = '๒';
    num[3] = '๓';
    num[4] = '๔';
    num[5] = '๕';
    num[6] = '๖';
    num[7] = '๗';
    num[8] = '๘';
    num[9] = '๙';

jQuery(document).ready(function($){
    $(".preventDf").live('click',function(event){
        event.preventDefault();
    });

    $("tbody.hilight tr").hover(function(){
        $(this).addClass("emt_hover");
    },function(){
        $(this).removeClass("emt_hover");
    });

    $(".th-input").keyup(function(){
        var text = $(this).val();
        var len = text.length -1;
        var sub = text.substr(len);
        var old = text.substr(0,len);
        if(text == "")
            return;
        if(sub > -1 && sub < 10){
            $(this).val(old+num[sub])
        }
    });
    $("tr.emt_link").hover(function(){
        $(this).addClass("emt_tr_hover");
    },function(){
        $(this).removeClass("emt_tr_hover");
    });
});
function gotopage(url){
    location.href=url;
}
function sendPost (frmId, value, url, target) {
    var html = "";
    if(jQuery("#"+frmId).length == 0)
    {
        jQuery("<form id\""+frmId+"\ method=\"POST\" ></form> ").appendTo("body");
    }
    if(url != "")
    {
        if (jQuery("#"+frmId).length > 0) {
            jQuery("#"+frmId).attr("action",url);
        }
        else {
            jQuery("body").append("<form action=\""+url+"\" id=\""+frmId+"\" method=\"post\" ></form>")
        }
    }
    if (target != "") {
        jQuery("#"+frmId).attr("target",target);
    }
    if (value != "") {
        jQuery.each(value,function(index,value){
            if(jQuery("#"+frmId).find("input:hidden[name='"+index+"']").length == 0)
            {
                html += "<input type='hidden' name='"+index+"' value='"+value+"' id='"+index+"' />";
            }else{
                jQuery("input:hidden[name='"+index+"']").val(value);
            }
            temp = index;
        });
    }
    jQuery("#"+frmId).append(html).trigger("submit");
}
function chkList(flag,tclass)
{
    if(flag == 1)
        jQuery("."+tclass).attr("checked",true);
    else
        jQuery("."+tclass).attr("checked",false);
}
function clearFrm(frm,txtexcept,opt){
    var frmId = "#"+frm;
    jQuery(frmId+" :input").each(function(index){
        if(txtexcept.indexOf(jQuery(this).attr("id")) < 0){
            switch(this.type){
                case "password":
                case "text":
                case "select-one":
                case "textarea":
                case "hidden":
                    jQuery(this).val("");
                    break;
                case "checkbox":
                case "radio":
                    this.checked = false;
            }
        }
    });
    if(opt != ""){
        jQuery.each(opt,function(id,tag){
            jQuery(tag+".#"+id).empty();
        });
    }
}
function confirm_msg(msg,frmId,value,action)
{
    if(confirm(msg))
    {
        sendPost(frmId,value,action);
    }
    else
        return false;
}

function popupWindow(url,name,option)
{
    if(option == "")
        option  = "height=350,width=500";
    var newwindow=window.open(url,name,option);
    if (window.focus) {newwindow.focus()}
    return false;
}