﻿/// <reference path="../General/general.js" />
/// <reference path="../jquery-1.2.6-vsdoc.js" />
/// <reference path="../jquery-1.2.6.js" />
$.fn.serializeNoViewState = function() {
    return this.find("input,textarea,select,hidden")
               .not("[type=hidden][name^=__]")
               .serialize();
}
function BindList(lbxSelection,list) {
    ClearList(lbxSelection);
    jQuery.each(list, function(field) {
        var y = document.createElement('option');
        y.text = field.text;
        y.value = field.value;
        lbxSelection.appendChild(y, null);
    });
}
function ClearList(lbxSelection) {
 var srcLen = lbxSelection.options.length;
    for (var x = srcLen - 1; x >= 0; x--)
        lbxSelection.options[x] = null;
}

function ShowHides(controls)
{
    jQuery.each(controls, function(field) {
        //alert(controls[field]);
        ShowHide(controls[field]);
    });
}
function ShowHide(control)
{
    //alert(control.id+"-"+control.showhide);
    if(control.showhide=="hide")
     $("#" + control.id).hide();
    else
     $("#" + control.id).show();
    
}
function EnableControls(controls)
{
    jQuery.each(controls, function() {
        EnableControl(this);
    });
}
function EnableControl(control)
{
    //alert(control);
     $("#" + control).removeAttr("disabled");
}
function DisableControls(controls)
{
    jQuery.each(controls, function() {
       DisableControl(this);
    });
}
function DisableControl(control)
{
    //alert(control);
     $("#" + control).attr("disabled","disable");
}
function ShowControls(controls)
{
    jQuery.each(controls, function() {
       ShowControl(this);
    });
}
function ShowControl(control)
{
    //alert(control);
     $("#" + control).show();
}
function ShowValControl(control,value)
{
   // alert(control);
     $("#" + control).val(value);
     $("#" + control).show();
}
function HideControls(controls)
{
    jQuery.each(controls, function() {
       HideControl(this);
    });
}
function HideControl(control)
{
    //alert(control);
     $("#" + control).hide();
}
function BindJList(lbxSelection, list) {
    ClearJList(lbxSelection);
    var index = 0;
    var lhtml = "";
    var dopts = '<option value="">Seçiniz</option>';
    lhtml = lhtml + dopts;
    jQuery.each(list, function() {
       var opts = '<option value="' + list[index].value + '">' + list[index].name + '</option>';
        lhtml += opts;
        index++;
    });
    $(lbxSelection).html(lhtml);
}
function ClearJList(lbxSelection) {
    $(lbxSelection).html(null);
    $(lbxSelection).selectedindex = -1;
}




