﻿

// JScript-Datei
function showModalPopupViaClient() {
    var modalPopupBehavior = $find('programmaticModalPopupBehavior');
    modalPopupBehavior.show();
    return true;
}

function hideModalPopupViaClient() {
    var modalPopupBehavior = $find('programmaticModalPopupBehavior');
    modalPopupBehavior.hide();
}

function EndRequestHandler(sender, args) {
   hideModalPopupViaClient();
}
function load() {
   Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
}

function SubmitForm(event,p1,p2)
{
    if (event.keyCode == 13)
    {
    
        WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(p1, '', true, p2, '', false, true));
    }
}
	
function SelectAllRows(chkMaster)
{
    var ind = 2;
    var _row = document.getElementById('gv_user_ctl0' + ind + '_chk_selected');
    
    
    while(_row != null)
    {
        _row.checked = chkMaster.checked;
        
        HighlightRow(_row);
        
        if(ind < 10)
            _row = document.getElementById('gv_user_ctl0' + ind + '_chk_selected');
        else
            _row = document.getElementById('gv_user_ctl' + ind + '_chk_selected');
        
        ind++;
    }
}   

function SelectAllMessageRows(chkMaster)
{
    var ind = 2;
    var _row = document.getElementById('ctl00_ContentPlaceHolder1_IdUcAdminMessages_gv_user_ctl0' + ind + '_chk_selected');
    
    
    while(_row != null)
    {
        _row.checked = chkMaster.checked;
        
        HighlightRow(_row);
        
        if(ind < 10)
            _row = document.getElementById('ctl00_ContentPlaceHolder1_IdUcAdminMessages_gv_user_ctl0' + ind + '_chk_selected');
        else
            _row = document.getElementById('ctl00_ContentPlaceHolder1_IdUcAdminMessages_gv_user_ctl' + ind + '_chk_selected');
        
        ind++;
    }//ctl00_ContentPlaceHolder1_IdUcArticlePool_gv_view_ctl04_chk_selected
} 

function SelectAllArticleRows(chkMaster)
{
    var ind = 3;
    var _row = document.getElementById('ctl00_ContentPlaceHolder1_IdUcArticlePool_gv_view_ctl0' + ind + '_chk_selected');
    
    
    while(_row != null)
    {
        _row.checked = chkMaster.checked;
        
        HighlightRow(_row);
        
        if(ind < 10)
            _row = document.getElementById('ctl00_ContentPlaceHolder1_IdUcArticlePool_gv_view_ctl0' + ind + '_chk_selected');
        else
            _row = document.getElementById('ctl00_ContentPlaceHolder1_IdUcArticlePool_gv_view_ctl' + ind + '_chk_selected');
        
        ind++;
    }//ctl00_ContentPlaceHolder1_IdUcArticlePool_gv_view_ctl04_chk_selected
}   

function HighlightRow(chkB)
{
    var IsChecked = chkB.checked;           

    if(IsChecked)
      {
      
        chkB.parentNode.parentNode.style.backgroundColor='#228b22'; 

       chkB.parentNode.parentNode.style.color='white';
  }else
  {
       chkB.parentNode.parentNode.style.backgroundColor='white';

       chkB.parentNode.parentNode.style.color='black';
  }
}

function switchVisibility2(val1,val2)
{

    area1 = document.getElementById(val1);
    area2 = document.getElementById(val2);
   
    if(area1.style.display == 'none')
    {
        area1.style.display = '';
        area2.style.display = 'none';
    }
    else
    {
        area1.style.display = 'none';
        area2.style.display = '';
    }
}

function switchVisibility(val1)
{

    area1 = document.getElementById(val1);
   
    if(area1.style.display == 'none')
    {
        area1.style.display = '';
    }
    else
    {
        area1.style.display = 'none';
    }
}

function addEvent(obj, evType, fn){ 
 if (obj.addEventListener){ 
   obj.addEventListener(evType, fn, false); 
   return true; 
 } else if (obj.attachEvent){ 
   var r = obj.attachEvent("on"+evType, fn); 
   return r; 
 } else { 
   return false; 
 } 
}

//addEvent(document, 'submit', showModalPopupViaClient);



