	var last="ind_1";	
                
	function clickButton() 	
	{ 
		if (event.keyCode == 13) 
		{ 
		    var login = document.getElementById("header_tbx_login");
	        var pass = document.getElementById("header_tbx_pass");
    		var but1 = document.getElementById("header_imgbtn_in");
    		
		    if (login!=null && pass!=null && but1!=null)
		    {
		        try
		        {
		            if (login.value!="" || pass.value!="")
		            {
		                but1.click();
		                return false;
		            }
		        }
		        catch (err) {}
		    }
		    
	        var search = document.getElementById("search_ascx_txtBoxSrch");
		    var but2 = document.getElementById("search_ascx_ibSearch");
	        if (search!=null && but2!=null)
	        {
	            try
	            {
	                if (search.value!="")
	                {
	                    but2.click();
	                    return false;
	                }
	            }
	            catch (err) {}
	        }
		}
	}
	
function changePic(id) {
		if(last != null)
		document.getElementById(last).src = "images/blue_dot.gif";
		last = id;	
		document.getElementById(last).src = "images/orange_dot1.gif";
	}


function ShowHideColumn(){
     elem=document.getElementById("PromptControl_hidehint");
     elem1=document.getElementById("PromptControl_showhint");

     state=elem.style.display;
     //alert(state);
          if(!state){
          elem.style.display="none";
                elem1.style.display="";

          }else{
          elem.style.display="";
                elem1.style.display="none";
          }
     }
function ShowHideSearch(){
     s=document.getElementById("hidesearch");
     s1=document.getElementById("showsearch");

     state=s.style.display;
     //alert(state);
          if(!state){
          s.style.display="none";
                s1.style.display="";

          }else{
          s.style.display="";
                s1.style.display="none";
          }
     }
 
function ShowHideFilters()
{
    l=document.getElementById("novinki_td_extended");
    s=document.getElementById("novinki_td_simple");
    t=document.getElementById("novinki_hfFilterType");
    state=l.style.display;
    
    day_begin=document.getElementById("novinki_ddl_day_begin");
    short_day_begin=document.getElementById("novinki_ddl_short_day_begin");
    day_end=document.getElementById("novinki_ddl_day_end");
    short_day_end=document.getElementById("novinki_ddl_short_day_end");
    
    bb=document.getElementById("novinki_ddl_month_begin");
    be=document.getElementById("novinki_ddl_short_month_begin");
    eb=document.getElementById("novinki_ddl_month_end");
    ee=document.getElementById("novinki_ddl_short_month_end");
    
    year_begin=document.getElementById("novinki_ddl_year_begin");
    short_year_begin=document.getElementById("novinki_ddl_short_year_begin");
    year_end=document.getElementById("novinki_ddl_year_end");
    short_year_end=document.getElementById("novinki_ddl_short_year_end");
    
    if(!state)
    {
        l.style.display="none";
        s.style.display="";
        t.value = "Short"
        
        short_day_begin.options[day_begin.selectedIndex].selected = true;
        short_day_end.options[day_end.selectedIndex].selected = true;
        
        be.options[bb.selectedIndex].selected = true;
        ee.options[eb.selectedIndex].selected = true;
        
        short_year_begin.options[year_begin.selectedIndex].selected = true;
        short_year_end.options[year_end.selectedIndex].selected = true;
    }
    else
    {
        l.style.display="";
        s.style.display="none";
        t.value = "Extended";
        
        day_begin.options[short_day_begin.selectedIndex].selected = true;
        day_end.options[short_day_end.selectedIndex].selected = true;
        
        bb.options[be.selectedIndex].selected = true;
        eb.options[ee.selectedIndex].selected = true;
        
        year_begin.options[short_year_begin.selectedIndex].selected = true;
        year_end.options[short_year_end.selectedIndex].selected = true;
    }
}

function MonthChange(part, d_month, d_day)
{
    nmonth=parseInt(document.getElementById(d_month).value)-1;
    nday=document.getElementById(d_day).value;
    
    var daycount = new Array();
    daycount[12] = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
    
    if(part=="begin")
    {
        //document.write(part + " | " + nmonth + " | " + nday + " | " + daycount[12][nmonth].toString());
        ddl_day = document.getElementById('novinki_ddl_day_begin');
        ddl_short_day = document.getElementById('novinki_ddl_short_day_begin');
        elem_len=parseInt(ddl_day.options.length);
        for (k=0;k<elem_len;k++)
        {
            ddl_day.remove(0);
            ddl_short_day.remove(0);
        }
        for(k=1;k<=daycount[12][nmonth];k++)
        {
            oOption = document.createElement("OPTION");
            oOption.value= k.toString();
            oOption.text = k.toString();
            ddl_day.add(oOption);
            
            oOption = document.createElement("OPTION");
            oOption.value= k.toString();
            oOption.text = k.toString();
            ddl_short_day.add(oOption);
        }
        if(parseInt(nday)<=daycount[12][nmonth])
        {
            ddl_day.options[(parseInt(nday)-1)].selected=true;
            ddl_short_day.options[(parseInt(nday)-1)].selected=true;
        }
        else
        {
            ddl_day.options[(daycount[12][nmonth]-1)].selected=true;
            ddl_short_day.options[(daycount[12][nmonth]-1)].selected=true;
        }
    }
    else if(part=="end")
    {
        //document.write(part + " | " + nmonth + " | " + nday + " | " + daycount[12][nmonth].toString());
        ddl_day = document.getElementById('novinki_ddl_day_end');
        ddl_short_day = document.getElementById('novinki_ddl_short_day_end');
        elem_len=parseInt(ddl_day.options.length);
        for (k=0;k<elem_len;k++)
        {
            ddl_day.remove(0);
            ddl_short_day.remove(0);
        }
        for(k=1;k<=daycount[12][nmonth];k++)
        {
            oOption = document.createElement("OPTION");
            oOption.value= k.toString();
            oOption.text = k.toString();
            ddl_day.add(oOption);
            
            oOption = document.createElement("OPTION");
            oOption.value= k.toString();
            oOption.text = k.toString();
            ddl_short_day.add(oOption);
        }
        if(parseInt(nday)<=daycount[12][nmonth])
        {
            ddl_day.options[(parseInt(nday)-1)].selected=true;
            ddl_short_day.options[(parseInt(nday)-1)].selected=true;
        }
        else
        {
            ddl_day.options[(daycount[12][nmonth]-1)].selected=true;
            ddl_short_day.options[(daycount[12][nmonth]-1)].selected=true;
        }
    }
}
     
function ShowHideFilter()
{
     f=document.getElementById("novinki_ext");
     f1=document.getElementById("novinki_simple");
     b=document.getElementById("FilterButton");
     t=document.getElementById("novinki_hfFilterType");
     state=f.style.display;
      
      if(!state)
      {
            f.style.display="none";
            f1.style.display="";
            b.src="./images/extended_filter.gif";
            t.value="Simple";
      }
      else
      {
            f.style.display="";
            f1.style.display="none";
            b.src="./images/simple_filter.gif";
            t.value="Ext";
      }
}

function ShowHide10(cult){
     s=document.getElementById("HeadlinerTop10");
     s1=document.getElementById("HeadlinerTop5");
     b=document.getElementById("show5vs10");

     state=s.style.display;
          if(!state){
          s.style.display="none";
          s1.style.display="";
          b.src = "images/show_10_"+cult+".gif";

          }else{
          s.style.display="";
          s1.style.display="none";
          b.src = "images/show_5_"+cult+".gif";
          }
     }

function ShowHide10_2(cult){
     s=document.getElementById("tab10_2");
     s1=document.getElementById("tab5_2");
     b=document.getElementById("img5vs10_2");

     state=s.style.display;
          if(!state){
          s.style.display="none";
          s1.style.display="";
          b.src = "images/show_10_"+cult+".gif";

          }else{
          s.style.display="";
          s1.style.display="none";
          b.src = "images/show_5_"+cult+".gif";
          }
     }
     
function HelpWin(lang, code) 
{
   var newWindow = open("helpwin.aspx?lang="+lang+"&code="+code, "Window", "left=30,top=120,scrollbars=yes,resizable=no,width=400,height=220");
   /*var newWindow = showModalDialog("helpwin.aspx?lang="+lang+"&code="+code, "", "dialogHeight:9cm;dialogWidth:14cm;help:no");*/
}

function Help(lang, code) 
{
   var newWindow = open("helpwin.aspx?lang="+lang+"&code="+code, "Window", "left=30,top=120,scrollbars=yes,resizable=no,width=800,height=440");
   /*var newWindow = showModalDialog("helpwin.aspx?lang="+lang+"&code="+code, "", "dialogHeight:9cm;dialogWidth:14cm;help:no");*/
}

/*
///////////////////////////////////////////////////////////////////////////////
//подставляем в фильтр по дате в "Новинках" в поле "dayFrom" нужное значение
*/
function DateFromChanged(daysSelectObj, monthOptionElement)
{
    var previousDay = daysSelectObj.options[daysSelectObj.selectedIndex].value;
    var daysInMonth = parseInt(monthOptionElement.value%100);
       
    var oChild 
    for(i = daysSelectObj.children.length - 1; i  >= 0; i --)
    {
        oChild=daysSelectObj.children(i);
        daysSelectObj.removeChild(oChild);
    }
   
  var oOption; 
  for(i = 1; i <= daysInMonth; i ++)
  {
        oOption = document.createElement("OPTION");
        oOption.text = i.toString();
        oOption.value = i.toString();
        daysSelectObj.add(oOption);
   }
  
  if(parseInt(daysInMonth) < parseInt(previousDay))
    daysSelectObj.selectedIndex = daysInMonth - 1;
  else
    daysSelectObj.selectedIndex = previousDay - 1;
    //document.write(previousDay);
}

/*
///////////////////////////////////////////////////////////////////////////////
//подставляем в фильтр по дате в "Новинках" в поле "dayTo" нужное значение
*/
function DateToChanged(daysSelectObj, monthOptionElement)
{
    var previousDay = daysSelectObj.options[daysSelectObj.selectedIndex].value;
    var daysInMonth = parseInt(monthOptionElement.value%100);
    
    var oChild 
    for(i = daysSelectObj.children.length - 1; i  >= 0; i --)
    {
        oChild=daysSelectObj.children(i);
        daysSelectObj.removeChild(oChild);
    }
   
  var oOption; 
  for(i = 1; i <= daysInMonth; i ++)
  {
        oOption = document.createElement("OPTION");
        oOption.text = i.toString();
        oOption.value = i.toString();
        daysSelectObj.add(oOption);
   }
  
  if(parseInt(daysInMonth) < parseInt(previousDay))
    daysSelectObj.selectedIndex = daysInMonth - 1;
  else
    daysSelectObj.selectedIndex = previousDay - 1;
}

function CheckTbl(id, check)
{
     if (document.getElementById(id))
     {
          var chels = document.getElementById(id).getElementsByTagName('INPUT');
          if (chels) for (var i = 0; i < chels.length; i++)
               if (chels[i].type == "checkbox")
                    chels[i].checked = check;
     }
}

function OnLoad()
{
    /////////////////////////////////////////////////////////
    //обрабатываем фильтр дат в "Новинках"
    var days = 30;
    var dayFromE = null;
    var dayFromS = null;
    
    var coll = document.all.tags("SELECT");
    if (coll != null)
    {
        for (i = 0; i < coll.length; i++)
            if(coll[i].id.indexOf("dayFromE") != -1)
            {
                dayFromE = coll[i];
                var oChild;
                for(j = coll[i].children.length - 1; j  >= 0; j --)
               {
                    oChild = coll[i].children(j);
                    coll[i].removeChild(oChild);
               }
            }
            else
                if(coll[i].id.indexOf("dayFromS") != -1)
                {
                    dayFromS = coll[i];
                    var oChild;
                    for(j = coll[i].children.length - 1; j  >= 0; j --)
                    {
                        oChild = coll[i].children(j);
                        coll[i].removeChild(oChild);
                    }
                }
            else
                if(coll[i].id.indexOf("monthFrom") != -1)
               {
                    //document.write(coll[i].selectedIndex);
                    days = parseInt((coll[i].options[coll[i].selectedIndex]).value%100);
               }
    }
   
    Now = new Date();
   
    if(dayFromE != null)
    {
        var oOption;
        for(i = 1; i <= days; i ++)
        {
            oOption = document.createElement("OPTION");
            oOption.text = i.toString();
            oOption.value = i.toString();
            dayFromE.add(oOption);
        }
        dayFromE.selectedIndex = Now.getDate() - 1;
    }
    if(dayFromS != null)
    {
        var oOption;
        for(i = 1; i <= days; i ++)
        {
            oOption = document.createElement("OPTION");
            oOption.text = i.toString();
            oOption.value = i.toString();
            dayFromS.add(oOption);
        }
        dayFromS.selectedIndex = Now.getDate() - 1;
    }
    ///////////////////////////////////////////////////////// 
}

// функция спрашивает перезагружать страницу или нет
function question(sms)
{
    var s=window.confirm(sms);
    if (s) 
    {
        return true;
    }
    else
    {
        return false;
    }
}