
//                function realPostBack(eventTarget, eventArgument)
//                {
//                   __doPostBack(eventTarget, eventArgument);
//                }
//  

function pausecomp(millis) 
{
var date = new Date();
var curDate = null;

do { curDate = new Date(); } 
while(curDate-date < millis);
} 
 

var mFCSVR = false;
var mFCSVRV = null;

function MasterFeedColumnServerValidate(source, clientside_arguments)
{
   
     if (mFCSVRV!=clientside_arguments.Value)
     {
        mFCSVR = false;
        mFCSVRV = clientside_arguments.Value;
     }
   
   clientside_arguments.IsValid = mFCSVR;
   
   //var elem = $get('ctl00_contentPlaceHolder_MasterFeedColumnsSetBrowser1_MasterFeedColumnsSetForm_rqName');
   //elem.isvalid = true;
   
   
   ShopSubmitWeb.CustomValidatorsService.MasterFeedColumnValidate(
   clientside_arguments.Value,
 //  function (result){mFCSVR = result;});
   OnSuccessServerValidateCallBack);

//   while(mFCSVR==null)
//   {
//     //pausecomp(500);
//   }
   //clientside_arguments.IsValid = mFCSVR;
   //alert(clientside_arguments.IsValid);
   //return false;
}
function OnSuccessServerValidateCallBack(result)
{
   var elem = $get('ctl00_contentPlaceHolder_MasterFeedColumnsSetBrowser1_MasterFeedColumnsSetForm_rqName');
   elem.isvalid = result;
   if (result == "true")
   {
   elem._behaviors[0]._invalid = false;
   elem._behaviors[0].hide();
    Sys.Debug.trace("result == true" + elem._behaviors[0]._isOpen);
   }
    mFCSVR = result;
   
   
   Sys.Debug.trace("elem.isvalid = " + result);
}

function RadioChecked(group,param)
  {
       { 
          var frm = document.forms[0];
          for (i=0; i < frm.length; i++)
          {
            if (frm.elements[i].type == "radio")
            {
              if (param != frm.elements[i].id && frm.elements[i].name.search(group)!=-1)
              {
                frm.elements[i].checked = false;
              }
            }
          }
      }
  }
  
function RadioUncheck(btn)
{
    var radio = document.getElementById(btn);
    
    if(radio)
    {
        radio.checked = !radio.checked;
    }
}

function SourceColumnsClientMove(events)
{
   
}

function SourceColumnDrop(source, dest, e)
{
    if(grid != null)
    {
        source.TreeView.HtmlElementID = "Grid"; 
        return true;
    }
    return false;
}

function MasterColumnDrop(source, dest, e)
{
    if(grid != null)
    {
        source.TreeView.HtmlElementID = "Grid"; 
        return true;
    }
    return false;
}

function MoveListItem(from,to)
{
    var srcList = document.getElementById(from);
    var tgtList = document.getElementById(to);
    if (srcList && tgtList && srcList.options.selectedIndex>=0)
    {
      var index = srcList.options.selectedIndex;
      var srcOption = srcList.options[index];
      var optionCopy = new Option();
      optionCopy.text = srcOption.text;
      optionCopy.value = srcOption.value;
      srcList.options.remove(index);
      tgtList.options.add(optionCopy);
    }
}
function AddListItem(to,txt)
{
    var txtValue = document.getElementById(txt);
    var tgtList = document.getElementById(to);
    if (txtValue && tgtList && txtValue.value && txtValue.value.length>0)
    {     
      var optionCopy = new Option();
      optionCopy.text = txtValue.value;
      tgtList.options.add(optionCopy);
      txtValue.value = "";
    }
}

showHideTooltip = function () 
{
    var obj = event.srcElement;
    var tooltip = document.getElementById("tooltip");
    if (tooltip)
    {
        with(tooltip) 
        {
            innerHTML = obj.options[obj.selectedIndex].value;
            with(style) 
            {
                if(event.type == "mouseleave") 
                {
                    display = "none";
                }
                else 
                {
                    display = "inline";
                    left = event.x;
                    top = event.y;
                }
            }
        }
    }
    else
    {
    alert("3333");
    }
}
