﻿// JScript File

function CheckFrame()
{
        var frame=document.getElementById("ChildPage");
        frame.Height=900;
        alert(frame.scrollHeight); 
        alert(frame.Height); 
}    


function ValidateDigits(arg1)
{
    var ts  = arg1;
    var TextString = "";
    for (i = 0; i < ts.length; i++) {
           if (ts.substring(i,i+1)>="0" && ts.substring(i,i+1)<="9")
                {
                    TextString=TextString+ts.substring(i,i+1);
                }
    }
    if (TextString.length > 0 && ts.substring(0,1)=="-")
    {
            TextString = "-"+TextString;
    }
    return(TextString);
}
        
 function ltrim( source )
 { 
    var index = 0; 
    while( source.charAt(index) == " " ) index++;
    return source.substr(index); 
 } 
 function rtrim( source )
 {
  var index = source.length - 1; 
  while( source.charAt(index) == " " ) index--; 
  return source.substring(0, index + 1); 
 } 
 
 function trim( source )
 { 
 return ltrim(rtrim(source)); 
 }
 
       function CloseWindow()
       {
         window.close();
         return false;
       }
   
      function checkKey()
   {
     if (window.event.keyCode == 13)
     {
       return false;
     }
     else
      {
        return true;
      }
   }
   
       
   function opWinSelectPublisher(IdGenre,IdSerie,RetElementName)
    {
     
     popupWin=window.open("selector.aspx?IdType=1&IdSerie="+IdSerie.innerText+"&IdGenre="+IdGenre.innerText+
                   "&ToElement="+RetElementName,"WinSelectPublisher",'resizable=no,width=550,height=450');
     try
     {
        popupWin.focus();
     }
     catch(e)
     {}
     return false;
    }  
    
    
   function opWinSelectGenre(IdPublisher,IdSerie,RetElementName)
    {
     popupWin=window.open("selector.aspx?IdType=2&IdSerie="+IdSerie.innerText+"&IdPublisher="+IdPublisher.innerText+
                   "&ToElement="+RetElementName,"WinSelectGenre",'resizable=no,width=550,height=450');
     try
     {
        popupWin.focus();
     }
     catch(e)
     {}
     return false;
    }
   function opWinSelectSerie(IdPublisher,IdGenre,RetElementName)
    {
     popupWin=window.open("selector.aspx?IdType=3&IdPublisher="+IdPublisher.innerText+"&IdGenre="+IdGenre.innerText+
                   "&ToElement="+RetElementName,"WinSelectSerie",'resizable=no,width=550,height=450');
     try
     {
        popupWin.focus();
     }
     catch(e)
     {}
     return false;
    } 
  function ReturnValueToOpenerWindow(RetValue,ElementStr)
   {
    window.opener.document.getElementById(ElementStr).innerText=RetValue.value;
    if (RetValue.value==" Все")
    {
        window.opener.document.getElementById(ElementStr).style.color="#004080";
    }
    else
    {
        window.opener.document.getElementById(ElementStr).style.color="green";
    }
    window.close();
  }
  

