function getPScroll(){
    var yScrolltop;
    var xScrollleft;
    if (self.pageYOffset || self.pageXOffset) {
      yScrolltop = self.pageYOffset;
      xScrollleft = self.pageXOffset;
    } else if(document.documentElement&& document.documentElement.scrollTop
      || document.documentElement.scrollLeft ){   // Explorer 6 Strict
      yScrolltop = document.documentElement.scrollTop;
      xScrollleft = document.documentElement.scrollLeft;
    } else if (document.body) {// all other Explorers
      yScrolltop = document.body.scrollTop;
      xScrollleft = document.body.scrollLeft;
    }
    arrayPageScroll = new Array(xScrollleft,yScrolltop);
    return arrayPageScroll;
  }




$(document).ready(function(){


//$(".accordion2 h3").eq(0).addClass("active");
//$(".accordion2 p").eq(0).show();

$(".accordion2 h3").click(function(){
$(this).next("p").slideToggle("normal")
.siblings("p:visible").slideUp("normal");
$(this).toggleClass("active");
$(this).siblings("h3").removeClass("active");
});

$(document).pngie();

var ch = document.getElementById('main_bg').clientHeight; var wh = window.innerHeight ? window.innerHeight : (document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.offsetHeight); wh = wh-6; if( ch < wh ) {document.getElementById('reimage').height = (document.getElementById('imagetd').clientHeight + wh - ch );}; 

});

$(function() {
$('.gallery').lightBox({
	imageLoading: '/images/lightbox-ico-loading.gif',
	imageBtnClose: '/images/lightbox-btn-close.gif',
	imageBtnPrev: '/images/lightbox-btn-prev.gif',
	imageBtnNext: '/images/lightbox-btn-next.gif',
	overlayOpacity: 0.2
	});
});




function hi_window(page)
        {
        var url=page;
        var settt=window.open( url, "tokarelianwtelecomru" ,"toolbar=no,directories=no,scrollbars=yes,status=yes,resizable=yes,width=600,height=500");
        }

function hi_wi(page)
        {
        var url=page;
        var settt=window.open( url, "tokarelianwtelecomru" ,"toolbar=no,directories=no,scrollbars=no,status=no,resizable=yes,width=240,height=240");
        }

function wcall_onclick(act,cdate,cmonth,cyear,sid, pname, lang) 
	{
	hi_wi("/wcall/?cdate="+(cdate != undefined ? cdate :'')+"&month="+(cmonth != undefined ? cmonth :'')+"&year="+(cyear != undefined ? cyear :'')+"&sid="+(sid != undefined ? sid :'')+"&pname="+pname+"&lang="+lang);
	}

        


function hiza()
        {
        window.open( "/new.htm", "ahis" ,"toolbar=no,directories=no,scrollbars=no,status=no,resizable=no,width=400,height=200");
        }


function tumbpre(ids,met)
        {
if (met==500)
{        
var siz=(ids.src.substring(ids.src.length-7,ids.src.length-4)==200 ? '200':'0');
ids.outerHTML='<IMG vspace=6 vspace=6 ALIGN=TOP ALT=\"Уменьшить\" class=hlan SRC=/tumb/icons/'+ids.id+'500.jpg id=\"'+ids.id+'\" OnClick=\"tumbpre(this,'+siz+');\">';
}
else
{        
var siz=(met==0 ? '':'200');
ids.outerHTML='<IMG vspace=6 vspace=6 ALIGN=absmiddle ALT=\"Увеличить\" class=hlan SRC=/tumb/icons/'+ids.id+siz+'.jpg id=\"'+ids.id+'\" OnClick=\"tumbpre(this,500);\">';}
       }


       function GC(obj)
	{
		if (obj.style.backgroundColor=='')
		{obj.style.backgroundColor='#FFFFCC';}
		else
		{obj.style.backgroundColor='';}
	}

function disp(id_obj)
{
var dsp =document.getElementById(id_obj).style;
var himg =document.getElementById('himg'+id_obj);
dsp.display = (dsp.display != 'block' ? 'block' : 'none');
if (himg!=null){
himg.src = (himg.src.indexOf('gr_pl') != -1 ? himg.src.replace('gr_pl','gr_mn') : himg.src.replace('gr_mn','gr_pl'));
}
}

function disp_inline(id_obj)
{
var dsp =document.getElementById(id_obj).style;
var himg =document.getElementById('himg'+id_obj);
//dsp.className = (dsp.className != 'info_box' ? 'info_box' : 'info_box_n');
if (himg!=null){
himg.src = (himg.src.indexOf('gr_pl') != -1 ? himg.src.replace('gr_pl','gr_mn') : himg.src.replace('gr_mn','gr_pl'));
}
}


function makeRequest(url) 
	{
	document.getElementById('res_div').innerHTML = "проверка технической возможности подключения ADSL на номер"
	var http_request = false;
	if (window.XMLHttpRequest) 
		{ // Mozilla, Safari, ...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) 
			{
			http_request.overrideMimeType('text/html; charset=windows-1251');
			}
		} else if (window.ActiveXObject) 
		{ // IE
		try {
		http_request = new ActiveXObject("Msxml2.XMLHTTP");
			} 
		catch (e) 
			{
			try 
				{
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e) {}
			}
		}

		if (!http_request) 
		{
		alert('Giving up :( Cannot create an XMLHTTP instance');
		return false;
		}
		http_request.onreadystatechange = function() { alertContents(http_request); };
		http_request.open('GET', url, true);
		http_request.send(null);
	}

function alertContents(http_request) 
	{
	if (http_request.readyState == 4) 
		{
		if (http_request.status == 200) 
			{
			document.getElementById('res_div').innerHTML = http_request.responseText;
			} else 
			{
			alert('There was a problem with the request.'+http_request.status);
			}
		}
	}


function nxtl(elm,nexta,cods)
{
	if (navigator.appName=="Microsoft Internet Explorer")
		{
		if (elm.value.length>=elm.maxLength && cods!=8 && cods!=46 && cods!=9 && cods!=16)
			{
			var oForm=elm.form;
			oForm[nexta].focus();
			return false;
			}
		}
}

function gr_icon_(id_icon,act)
{
	var cObs=document.getElementById(id_icon);
	var vAls=cObs.src.substr(cObs.src.indexOf(id_icon)+32,3);
	cObs.src=cObs.src.replace(id_icon+vAls,id_icon+'0'+((vAls==24 || vAls==50) ? vAls/1+1:vAls/1-1));
}


var useRedirect = true; 
// #############################################
// System globals
var flash2Installed = false;
var flash3Installed = false;
var flash4Installed = false;
var flash5Installed = false;
var flash6Installed = false;
var flash7Installed = false;
var maxVersion = 7;
var actualVersion = 0;
var hasRightVersion = false;
var jsVersion = 1.0;

var isIE = ((navigator.appVersion.indexOf("MSIE") != -1) && (navigator.appVersion.indexOf("MSIE") == navigator.appVersion.lastIndexOf("MSIE"))) ? true : false; // true if we're on ie
var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false; // true if we're on windows

function detectSpecialFlash(requiredVersion,flashcode,noflash) {

if (isIE && (navigator.appVersion.indexOf("MSIE 5.") != -1 || navigator.appVersion.indexOf("MSIE 6.") != -1) && !window.opera){
    //alert(navigator.appVersion);
    detectFlash(requiredVersion,flashcode,noflash);
} else document.write(noflash); 

}

function detectFlash(requiredVersion,flashcode,noflash) { 
    
if(isIE && isWin){
    document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
    document.write('on error resume next \n');
    document.write('jsVersion = 1.0 \n');
    document.write('flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
    document.write('flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
    document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
    document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n'); 
    document.write('flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n'); 
    document.write('flash7Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n'); 
    document.write('</SCR' + 'IPT\> \n'); 
}

if (navigator.plugins) {
    // ...then check for flash 2 or flash 3+.
    if (navigator.plugins["Shockwave Flash 2.0"]
    || navigator.plugins["Shockwave Flash"]) {

        var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
        var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
        var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
        flash2Installed = flashVersion == 2; 
        flash3Installed = flashVersion == 3;
        flash4Installed = flashVersion == 4;
        flash5Installed = flashVersion == 5;
        flash6Installed = flashVersion >= 6;
        flash7Installed = flashVersion >= 7;
    }
}

for (var i = 2; i <= maxVersion; i++) { 
    if (eval("flash" + i + "Installed") == true) actualVersion = i;
}

    //alert("version detected: " + actualVersion);
    if (actualVersion < requiredVersion) {
        document.write(noflash);
        return 0;
    }
    else {
        document.write(flashcode);
        return 1;
    }

}
