<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
function GoToURL(sender)
{
	if(sender.value)
		document.location=sender.value;
}
function GetFavorite()
	{
	window.open('/favorite.ashx?title='+document.title+'&path='+location.href,'','','');
	}
function SetCookie (name,value,expires) 
{
  //alert(value);
  var dt = new Date();
  var dtt = "";
  dt.setTime(dt.getTime()+expires*24*60*60*1000);
  dtt = dt.toGMTString();
  document.cookie = name+"="+value+";expires="+dtt+";path=/";
}
function getCookie(name) {
        var prefix = name + "=";
        var cookieStartIndex = document.cookie.indexOf(prefix);
        if (cookieStartIndex == -1)
                return null;
        var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length);
        if (cookieEndIndex == -1)
                cookieEndIndex = document.cookie.length;
        return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex));
        }
function deleteCookie(name) {
        if (getCookie(name)) 
        {
                document.cookie = name + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT;path=/";
        }
}

function Expand_Or_CollapseDiv(sender,divForExpandID,lnkForExpandTextID, hideText, openText)
{
    var divForExpand=document.getElementById(divForExpandID);
    var lnkForExpandText=document.getElementById(lnkForExpandTextID);
    
    if(divForExpand.style.display=='none')
    {
            divForExpand.style.display="block";
        divForExpand.style.visibility="visible";
        if(lnkForExpandTextID)
        {
        lnkForExpandText.innerHTML=hideText;
        lnkForExpandText.style.backgroundImage="url(/i/minus_blue.gif)";
        }
    }
    else
    {
        divForExpand.style.display="none";
        divForExpand.style.visibility="hidden";
        if(lnkForExpandTextID)
        {
        lnkForExpandText.innerHTML=openText;
        lnkForExpandText.style.backgroundImage="url(/i/plus_blue.gif)";
        }
    }
}


function Expand_Or_CollapseDiv(sender,divForExpandID,lnkForExpandTextID, hideText, openText, change_sender)
{
    var divForExpand=document.getElementById(divForExpandID);
    var lnkForExpandText=document.getElementById(lnkForExpandTextID);
    
    if(divForExpand.style.display=='none')
    {
            divForExpand.style.display="block";
        divForExpand.style.visibility="visible";
        if(lnkForExpandTextID)
        {
        lnkForExpandText.innerHTML=hideText;
        lnkForExpandText.style.backgroundImage="url(/i/minus_blue.gif)";
        }
        else if(change_sender)
        {
            sender.style.backgroundImage="url(/i/minus_blue.gif)";
        }
    }
    else
    {
        divForExpand.style.display="none";
        divForExpand.style.visibility="hidden";
        if(lnkForExpandTextID)
        {
        lnkForExpandText.innerHTML=openText;
        lnkForExpandText.style.backgroundImage="url(/i/plus_blue.gif)";
        }
        else if(change_sender)
        {
            sender.style.backgroundImage="url(/i/plus_blue.gif)";
        }
    }
}





function Show_News_TabSheet(sender,NameForShow,NameForHide, tagNameForClassChange)
{
    var divForShow=document.getElementById("div"+NameForShow);
    var tagForShow=document.getElementById(tagNameForClassChange+NameForShow);
    var class_name=sender.className.replace("active","").replace("onhover","").replace("onhover","").replace("onhover","").replace("onhover","").replace("onhover","").replace("onhover","").replace("onhover","").replace("onhover","").replace("onhover","").replace("onhover","").replace("onhover","").replace("onhover","").replace("onhover","").replace("onhover","").replace("onhover","").replace("onhover","").replace("onhover","");
    if(class_name==tagNameForClassChange)
        class_name="";
    if(divForShow)
    {
        if(NameForHide)
        {
            var divForHide=document.getElementById("div"+NameForHide);
            var tagForHide=document.getElementById(tagNameForClassChange+NameForHide);
            divForHide.style.display="none";
            divForShow.style.visibility="hidden";
            tagForHide.className=class_name;
        }
        if(divForShow.style.display=="none")
        {
            divForShow.style.display="block";
            divForShow.style.visibility="visible";
            tagForShow.className=class_name+"active";
        }
        else
        {
            divForShow.style.display="none";
            divForShow.style.visibility="hidden";
            tagForShow.className=class_name;
       }
    }
}

function Show_Categories_TabSheet(sender,NameForShow,NameForHide, tagNameForClassChange)
{
    var divForShow=document.getElementById("div"+NameForShow);
    var tagForShow=document.getElementById(tagNameForClassChange+NameForShow);
    //var class_name=sender.className.replace("active","").replace("onhover","").replace("onhover","").replace("onhover","").replace("onhover","").replace("onhover","").replace("onhover","").replace("onhover","").replace("onhover","").replace("onhover","").replace("onhover","").replace("onhover","").replace("onhover","").replace("onhover","").replace("onhover","").replace("onhover","").replace("onhover","").replace("onhover","");
    //if(class_name==tagNameForClassChange)
    //    class_name="";
    if(divForShow)
    {
        if(NameForHide)
        {
            var divForHide=document.getElementById("div"+NameForHide);
            var tagForHide=document.getElementById(tagNameForClassChange+NameForHide);
            var classForHide = tagForHide.className.replace(" active","");
            divForHide.style.display="none";
            divForShow.style.visibility="hidden";
            tagForHide.className=classForHide;
        }
        if(divForShow.style.display=="none")
        {
            divForShow.style.display="block";
            divForShow.style.visibility="visible";
            tagForShow.className=tagForShow.className + " active";
        }
        else
        {
            divForShow.style.display="none";
            divForShow.style.visibility="hidden";
            tagForShow.className=class_name;
       }
    }
}

function Expand_Or_CollapseTabSheet(sender,otherSenderIDForHide,IDForShow,IDForHide, sndr_css_active, sndr_css_inactive,trgt_css_active, trgt_css_inactive,
    divAdditID, addit_css_inactive, addit_css_active)
{
    var divForExpand=document.getElementById(IDForShow);
    var divForClose=document.getElementById(IDForHide);
    var divAddit=document.getElementById(divAdditID);
     if(divForExpand.style.display=='none')
    {
        divForExpand.style.display="block";
        divForExpand.className=trgt_css_active;
        if(sender)
        {
            sender.className=sndr_css_active;
        }
        var divForClose=document.getElementById(IDForHide);
        var sndrForClose=document.getElementById(otherSenderIDForHide);
        if(divForClose)
        {
        divForClose.className=trgt_css_inactive;
        divForClose.style.display="none";
        }
        if(sndrForClose)
        {
        sndrForClose.className=sndr_css_inactive;
       //alert( sndrForClose.className);
        }
        if(divAddit)
        {
            divAddit.className=addit_css_active;
        }
    }
    else
    {
        divForExpand.style.display="none";
        divForExpand.className=trgt_css_inactive;
        if(sender)
        {
            sender.className=sndr_css_inactive;
        }
        if(divAddit)
        {
            divAddit.className=addit_css_inactive;
        }
    }
   // if(sender!=null)
    //alert(sender.className);
   
}

function Expand_And_CollapseTabSheet(sender,otherSenderIDForHide,IDForShow,IDForHide, sndr_css_active, sndr_css_inactive,trgt_css_active, trgt_css_inactive,
    divAdditID, addit_css_inactive, addit_css_active)
{
    var divForExpand=document.getElementById(IDForShow);
    var divForClose=document.getElementById(IDForHide);
    var divAddit=document.getElementById(divAdditID);
     if(divForExpand.style.display=='none')
    {
        divForExpand.style.display="block";
        divForExpand.className=trgt_css_active;
        if(sender)
        {
            sender.className=sndr_css_active;
        }
        var divForClose=document.getElementById(IDForHide);
        var sndrForClose=document.getElementById(otherSenderIDForHide);
        if(divForClose)
        {
        divForClose.className=trgt_css_inactive;
        divForClose.style.display="none";
        }
        if(sndrForClose)
        {
        sndrForClose.className=sndr_css_inactive;
       //alert( sndrForClose.className);
        }
        if(divAddit)
        {
            divAddit.className=addit_css_active;
        }
    }   
}

//Показ всплывающего div-а
<!--
function ShowDiv(divID)
{
    var div=document.getElementById(divID);
   
    if(div)
    {
     var x1 = (document.all) ? window.event.x + document.body.scrollLeft : undefined;
	var y1 = (document.all) ? window.event.y + document.body.scrollTop : undefined;
	
		div.style.left = (x1 + 20) + "px";
		div.style.top = (y1) + "px";
        div.style.display="block";
        div.style.visibility="visible";
    }
}
function ShowDivWithFocus(divID, inputID)
{
    var div=document.getElementById(divID);
    if(div)
    {
        div.style.display="block";
        div.style.visibility="visible";
        var inpt=document.getElementById(inputID);
        if(inpt)
        inpt.focus();
        
    }
}
function HideDiv(divID)
{
    var div=document.getElementById(divID);
    if(div)
    {
   		
        div.style.display="none";
        div.style.visibility="hidden";
    }
}//-->



var ajaxTargetCtrlID;
function Return_AjaxResult (){

	if(req.readyState == 4){
	
	document.getElementById(ajaxTargetCtrlID).innerHTML = req.responseText;
	//alert(req.responseText);
	delete req;
	req = null;
	}	
	
}
var req;
function connect(url, u_function) 
{
	if(window.XMLHttpRequest)
	{  
		req = new XMLHttpRequest();
		req.onreadystatechange = eval (u_function);
		req.open("GET", url, true); 		
		req.send(null);
	}else if(window.ActiveXObject)
	{
		req = new ActiveXObject("Microsoft.XMLHTTP");
		if(req)
		{
			req.onreadystatechange = eval (u_function);
			req.open("GET", url, true);
			req.send();
		}else
		{
			alert('Не удалось создать экземпляр объекта: ActiveXObject.');
		}
	}
}



function connectWithDivID(url, u_function, divID) 
{
    if(req != null)
    {
        alert('AJAX processing ...');
        return;
    } 
    ajaxTargetCtrlID = divID;
	if(window.XMLHttpRequest)
	{  
		req = new XMLHttpRequest();
		req.onreadystatechange = eval (u_function);
		req.open("GET", url, true); 		
		req.send(null);
	}else if(window.ActiveXObject)
	{
		req = new ActiveXObject("Microsoft.XMLHTTP");
		if(req)
		{
			req.onreadystatechange = eval (u_function);
			req.open("GET", url, true);
			req.send();
		}else
		{
			alert('Не удалось создать экземпляр объекта: ActiveXObject.');
		}
	}
}





// получение коммента для редактирования - (начало)
var ForumEditCommentConnection;
var ForumEditCommentID;
var ForumEditCommentTextAreaID;
var ForumEditCommentInpHiddCurrentID;
function editComment(ID,txtCommentID,inpHiddCurrentUpdateID)
{
    if(ForumEditCommentConnection != null)
    {
        alert('AJAX processing ..., try again');
        return;
    } 
    var url = '/page_modules/get_forum_comment_without_ahchor.ashx?id=' + ID;
    ForumEditCommentID = ID;
    ForumEditCommentTextAreaID = txtCommentID;
    ForumEditCommentInpHiddCurrentID = inpHiddCurrentUpdateID;
	if(window.XMLHttpRequest)
	{  
		ForumEditCommentConnection = new XMLHttpRequest();
		ForumEditCommentConnection.onreadystatechange = eval (ForumCommentReceived);
		ForumEditCommentConnection.open("GET", url, true); 		
		ForumEditCommentConnection.send(null);
	}
	else if(window.ActiveXObject)
	{
		ForumEditCommentConnection = new ActiveXObject("Microsoft.XMLHTTP");
		if(ForumEditCommentConnection)
		{
			ForumEditCommentConnection.onreadystatechange = eval (ForumCommentReceived);
			ForumEditCommentConnection.open("GET", url, true);
			ForumEditCommentConnection.send();
		}
		else
		{
			alert('Не удалось создать экземпляр объекта: ActiveXObject.');
		}
	}
}

function ForumCommentReceived()
{
	if(ForumEditCommentConnection.readyState == 4)
	{
	$("#divAddComment").show();
	
         var txtComment = document.getElementById(ForumEditCommentTextAreaID);
         var inpHiddCurrentUpdate = document.getElementById(ForumEditCommentInpHiddCurrentID);
         txtComment.value = replaceHTMLBRTobn(ForumEditCommentConnection.responseText);
         inpHiddCurrentUpdate.value = ForumEditCommentID;
         setTimeout(function(){document.getElementById(ForumEditCommentTextAreaID).focus()}, 1);
	     //alert(req.responseText);
	     delete ForumEditCommentConnection;
	     ForumEditCommentConnection = null;
	}	
}

function replaceHTMLBRTobn(text)
{
   //     A string containing "\r\n" for non-Unix platforms, or a string containing
   //     "\n" for Unix platforms.
    while(text.indexOf('<br/>') != -1)
    {
        text = text.replace('<br/>' ,'\r\n')
    }
    return text.replace('<br/>' ,'\r\n');    
}
// получение коммента для редактирования - (конец)
function ShowVideo(id, video, imgBig) {
    var flv_data = '<object id="player1" type="application/x-shockwave-flash" data="/flash/player.swf"' +
                'width="576" height="325">' +
                '<param name="movie" value="/flash/player.swf" />' +
                '<param name="allowFullScreen" value="true" />' +
                '<param name="wmode" value="opaque" />' +
                '<param name="FlashVars" value="width=576&height=325&startimage=' + imgBig +
                '&configxml=/flash/player_config.xml&flv=' + video + '" /></object>';
      $("#" + id).html('');
    $("#" + id).html(flv_data);
    $("#" + id).find("object").css("position", "relative");
    
}