﻿$(document).ready(function(){

    if ($.browser.opera){
	$('#soe_top').css('margin-left', '-2px');
    }

    var id = "<!--###UID###--> <!--###UID###-->";

    if ((id == "1")||(id == "38")||(id == "6")||(id == "7")||(id == "8")||(id == "36")||(id == "37")||(id == "43")||(id == "2")||(id == "35")||(id == "12")||(id == "14")) {
        $("#left").css("background-image", "url(fileadmin/template/pics/main_left_back1.jpg)");
    }
    if ((id == "5")||(id == "15")||(id == "16")||(id == "17")||(id == "39")) {
        $("#left").css("background-image", "url(fileadmin/template/pics/main_left_back2.jpg)");
    }
    if ((id == "4")||(id == "18")||(id == "19")||(id == "20")||(id == "21")||(id == "22")||(id == "23")||(id == "25")||(id == "26")||(id == "40")) {
        $("#left").css("background-image", "url(fileadmin/template/pics/main_left_back3.jpg)");
    }
    if ((id == "3")||(id == "27")||(id == "28")||(id == "29")||(id == "30")||(id == "31")||(id == "32")||(id == "33")||(id == "34")||(id == "41")) {
        $("#left").css("background-image", "url(fileadmin/template/pics/main_left_back4.jpg)");
    }
    if ((id == "9")||(id == "10")||(id == "11")||(id == "13")||(id == "42")) {
        $("#left").css("background-image", "url(fileadmin/template/pics/main_left_back5.jpg)");
    }

   $('.news-latest-container').serialScroll({
		items:'div',
		duration:4000,
		force:true,
		axis:'y',
		lazy:false,
		interval:3,
		step:3
	});

    $("#sliding1").slidingPanels();

$(".col_about").click(function(){
	window.open("http://www.soe.com.ua/pro-kompaniju.html", "_self");
});
    $(".col_keriv").click(function(){
    	window.open("http://www.soe.com.ua/pro-kompaniju/kerivnictvo.html", "_self");
    });
    $(".col_history").click(function(){
    	window.open("http://www.soe.com.ua/pro-kompaniju/istorija-kompaniji.html", "_self");
    });
    $(".col_scenter").click(function(){
    	window.open("http://www.soe.com.ua/spozhivacham/servisnii-centr.html", "_self");
    });
    $(".col_emergency").click(function(){
    	window.open("http://www.soe.com.ua/pro-kompaniju/shvidka-dopomoga.html", "_self");
    });
    $(".col_hotline").click(function(){
    	window.open("http://www.soe.com.ua/spozhivacham/garjacha-linija.html", "_self");
    });
    $(".col_museum").click(function(){
    	window.open("http://www.soe.com.ua/pro-kompaniju/muzei.html", "_self");
    });

$(".col_pokaz").click(function(){
    window.open("http://www.soe.com.ua/investoram/pokazniki.html", "_self");
});
    $(".col_vyrob").click(function(){
    	window.open("http://www.soe.com.ua/investoram/pokazniki/virobnicha-dijalnist.html", "_self");
    });
    $(".col_ekonom").click(function(){
    	window.open("http://www.soe.com.ua/investoram/pokazniki/ekonomichni-pokazniki.html", "_self");
    });
    $(".col_buhg").click(function(){
    	window.open("http://www.soe.com.ua/investoram/pokazniki/bukhgalterska-zvitnist.html", "_self");
    });

$(".col_press").click(function(){
    window.open("http://www.soe.com.ua/pres-centr.html", "_self");
});
    $(".col_newssoe").click(function(){
    	window.open("http://www.soe.com.ua/pres-centr/novini-sumioblenergo.html", "_self");
    });
    $(".col_newspek").click(function(){
    	window.open("http://www.soe.com.ua/pres-centr/novini-energetiki.html", "_self");
    });
    $(".col_analitik").click(function(){
    	window.open("http://www.soe.com.ua/pres-centr/analitichni-ogljadi.html", "_self");
    });
    $(".col_smi").click(function(){
    	window.open("http://www.soe.com.ua/pres-centr/publikaciji-v-zmi.html", "_self");
    });
    $(".col_gazeta").click(function(){
    	window.open("http://www.soe.com.ua/pres-centr/gazeta-energetik.html", "_self");
    });
    $(".col_users").click(function(){
        window.open("http://www.soe.com.ua/spozhivacham.html", "_self");
    });
    $(".col_law").click(function(){
    	window.open("http://www.soe.com.ua/pres-centr/oficiini-dokumenti.html", "_self");
    });
    $(".col_rule").click(function(){
    	window.open("http://www.soe.com.ua/spozhivacham/pravila-koristuvannja.html", "_self");
    });
    $(".col_pobut").click(function(){
    	window.open("http://www.soe.com.ua/spozhivacham/pobutovim.html", "_self");
    });
    $(".col_prom").click(function(){
    	window.open("http://www.soe.com.ua/spozhivacham/promislovim.html", "_self");
    });
    $(".col_tarif").click(function(){
    	window.open("http://www.soe.com.ua/spozhivacham/tarifi.html", "_self");
    });

$(".col_invest").click(function(){
    window.open("http://www.soe.com.ua/investoram.html", "_self");
});

    $(".col_oblast").click(function(){
    	window.open("http://www.soe.com.ua/investoram/sumska-oblast.html", "_self");
    });
    $(".col_reestr").click(function(){
    	window.open("http://www.soe.com.ua/investoram/rejestrator.html", "_self");
    });
    $(".col_audit").click(function(){
    	window.open("http://www.soe.com.ua/investoram/pro-auditoriv.html", "_self");
    });

    $(".col_person").click(function(){
    	window.open("http://www.soe.com.ua/pro-kompaniju/personal.html", "_self");
    });
    $(".col_feedback").click(function(){
    	window.open("http://www.soe.com.ua/no_cache/spozhivacham/zvorotnii-zvjazok.html", "_self");
    });


    $(".col_personal").click(function(){
    	window.open("http://www.soe.com.ua/pro-kompaniju/personal/nashi-spivrobitniki.html", "_self");
    });
    $(".col_strategy").click(function(){
    	window.open("http://www.soe.com.ua/pro-kompaniju/personal/strategija-rozvitku.html", "_self");
    });
    $(".col_vacancy").click(function(){
    	window.open("http://www.soe.com.ua/no_cache/pro-kompaniju/personal/nashi-vakansiji.html", "_self");
    });

    $(".col_emitent").click(function(){
    	window.open("http://www.soe.com.ua/investoram/akcioneram.html", "_self");
    });



$(".col_about_ru").click(function(){
	window.open("http://www.soe.com.ua/rus/o-kompanii.html", "_self");
});
    $(".col_keriv_ru").click(function(){
    	window.open("http://www.soe.com.ua/rus/o-kompanii/rukovodstvo.html", "_self");
    });

    $(".col_history_ru").click(function(){
    	window.open("http://www.soe.com.ua/rus/o-kompanii/istorija-kompanii.html", "_self");
    });
    $(".col_scenter_ru").click(function(){
    	window.open("http://www.soe.com.ua/rus/potrebiteljam/servisnyi-centr.html", "_self");
    });
    $(".col_hotline_ru").click(function(){
    	window.open("http://www.soe.com.ua/rus/potrebiteljam/gorjachaja-linija.html", "_self");
    });

$(".col_pokaz_ru").click(function(){
    window.open("http://www.soe.com.ua/rus/investoram/pokazateli.html", "_self");
});
    $(".col_vyrob_ru").click(function(){
    	window.open("http://www.soe.com.ua/rus/investoram/pokazateli/proizvodstvennaja-dejatelnost.html", "_self");
    });
    $(".col_ekonom_ru").click(function(){
    	window.open("http://www.soe.com.ua/rus/investoram/pokazateli/ehkonomicheskie-pokazateli.html", "_self");
    });
    $(".col_buhg_ru").click(function(){
    	window.open("http://www.soe.com.ua/rus/investoram/pokazateli/bukhgalterskaja-otchetnost.html", "_self");
    });

    $(".col_users_ru").click(function(){
        window.open("http://www.soe.com.ua/rus/potrebiteljam.html", "_self");
    });

$(".col_invest_ru").click(function(){
    window.open("http://www.soe.com.ua/rus/investoram.html", "_self");
});

    $(".col_oblast_ru").click(function(){
    	window.open("http://www.soe.com.ua/rus/investoram/sumskaja-oblast.html", "_self");
    });
    $(".col_reestr_ru").click(function(){
    	window.open("http://www.soe.com.ua/rus/investoram/registrator.html", "_self");
    });
    $(".col_audit_ru").click(function(){
    	window.open("http://www.soe.com.ua/rus/investoram/pro-auditorov.html", "_self");
    });

    $(".col_person_ru").click(function(){
    	window.open("http://www.soe.com.ua/rus/o-kompanii/personal.html", "_self");
    });
    $(".col_feedback_ru").click(function(){
    	window.open("http://www.soe.com.ua/no_cache/rus/potrebiteljam/obratnaja-svjaz.html", "_self");
    });


    $(".col_personal_ru").click(function(){
    	window.open("http://www.soe.com.ua/rus/o-kompanii/personal/nashi-sotrudniki.html", "_self");
    });
    $(".col_strategy_ru").click(function(){
    	window.open("http://www.soe.com.ua/rus/o-kompanii/personal/strategija-razvitija.html", "_self");
    });

    $(".col_emitent_ru").click(function(){
    	window.open("http://www.soe.com.ua/rus/investoram/akcioneram.html", "_self");
    });




    $(".col_about_en").click(function(){
	window.open("http://www.soe.com.ua/eng/about-the-company.html", "_self");
    });
    $(".col_keriv_en").click(function(){
    	window.open("http://www.soe.com.ua/eng/about-the-company/directorate.html", "_self");
    });

    $(".col_history_en").click(function(){
    	window.open("http://www.soe.com.ua/eng/about-the-company/history-of-the-company.html", "_self");
    });
    $(".col_pokaz_en").click(function(){
        window.open("http://www.soe.com.ua/eng/for-investors/performance-characteristics.html", "_self");
    });
    $(".col_vyrob_en").click(function(){
    	window.open("http://www.soe.com.ua/eng/for-investors/performance-characteristics/production-activity.html", "_self");
    });
    $(".col_ekonom_en").click(function(){
    	window.open("http://www.soe.com.ua/eng/for-investors/performance-characteristics/economic-indices.html", "_self");
    });
    $(".col_buhg_en").click(function(){
    	window.open("http://www.soe.com.ua/eng/for-investors/performance-characteristics/accounting-reports.html", "_self");
    });
    $(".col_users_en").click(function(){
        window.open("http://www.soe.com.ua/eng/for-consumers.html", "_self");
    });
    $(".col_invest_en").click(function(){
        window.open("http://www.soe.com.ua/eng/for-investors.html", "_self");
    });
    $(".col_reestr_en").click(function(){
    	window.open("http://www.soe.com.ua/eng/for-investors/registrator-of-the-company.html", "_self");
    });
    $(".col_audit_en").click(function(){
    	window.open("http://www.soe.com.ua/eng/for-investors/about-the-auditors.html", "_self");
    });
    $(".col_person_en").click(function(){
    	window.open("http://www.soe.com.ua/eng/about-the-company/personnel.html", "_self");
    });
    $(".col_personal_en").click(function(){
    	window.open("http://www.soe.com.ua/eng/about-the-company/personnel/our-stuff.html", "_self");
    });
    $(".col_strategy_en").click(function(){
    	window.open("http://www.soe.com.ua/eng/about-the-company/personnel/strategy-of-development.html", "_self");
    });
    $(".col_emitent_en").click(function(){
    	window.open("http://www.soe.com.ua/eng/for-investors/for-stockholders.html", "_self");
    });




    $("#toggle1").click(function(){
        $("#hidetoggle1").toggle("slow");
    });
    $("#toggle2").click(function(){
        $("#hidetoggle2").toggle("slow");
    });
    $("#toggle3").click(function(){
        $("#hidetoggle3").toggle("slow");
    });
    $("#toggle4").click(function(){
        $("#hidetoggle4").toggle("slow");
    });
    $("#toggle5").click(function(){
        $("#hidetoggle5").toggle("slow");
    });
    $("#toggle6").click(function(){
        $("#hidetoggle6").toggle("slow");
    });
    $("#toggle7").click(function(){
        $("#hidetoggle7").toggle("slow");
    });
    $("#toggle8").click(function(){
        $("#hidetoggle8").toggle("slow");
    });
    $("#toggle9").click(function(){
        $("#hidetoggle9").toggle("slow");
    });
    $("#toggle10").click(function(){
        $("#hidetoggle10").toggle("slow");
    });


    $("#toggle11").click(function(){
        $("#hidetoggle11").toggle("slow");
    });
    $("#toggle12").click(function(){
        $("#hidetoggle12").toggle("slow");
    });
    $("#toggle13").click(function(){
        $("#hidetoggle13").toggle("slow");
    });
    $("#toggle14").click(function(){
        $("#hidetoggle14").toggle("slow");
    });
    $("#toggle15").click(function(){
        $("#hidetoggle15").toggle("slow");
    });
    $("#toggle16").click(function(){
        $("#hidetoggle16").toggle("slow");
    });
    $("#toggle17").click(function(){
        $("#hidetoggle17").toggle("slow");
    });
    $("#toggle18").click(function(){
        $("#hidetoggle18").toggle("slow");
    });
    $("#toggle19").click(function(){
        $("#hidetoggle19").toggle("slow");
    });
    $("#toggle20").click(function(){
        $("#hidetoggle20").toggle("slow");
    });
    $("#toggle21").click(function(){
        $("#hidetoggle21").toggle("slow");
    });
    $("#toggle22").click(function(){
        $("#hidetoggle22").toggle("slow");
    });
    $("#toggle23").click(function(){
        $("#hidetoggle23").toggle("slow");
    });
    $("#toggle24").click(function(){
        $("#hidetoggle24").toggle("slow");
    });
    $("#toggle25").click(function(){
        $("#hidetoggle25").toggle("slow");
    });
    $("#toggle26").click(function(){
        $("#hidetoggle26").toggle("slow");
    });
    $("#toggle27").click(function(){
        $("#hidetoggle27").toggle("slow");
    });
    $("#toggle28").click(function(){
        $("#hidetoggle28").toggle("slow");
    });
    $("#toggle29").click(function(){
        $("#hidetoggle29").toggle("slow");
    });
    $("#toggle30").click(function(){
        $("#hidetoggle30").toggle("slow");
    });
    $("#toggle31").click(function(){
        $("#hidetoggle31").toggle("slow");
    });
    $("#toggle32").click(function(){
        $("#hidetoggle32").toggle("slow");
    });
    $("#toggle33").click(function(){
        $("#hidetoggle33").toggle("slow");
    });
    $("#toggle34").click(function(){
        $("#hidetoggle34").toggle("slow");
    });
    $("#toggle35").click(function(){
        $("#hidetoggle35").toggle("slow");
    });
    $("#toggle36").click(function(){
        $("#hidetoggle36").toggle("slow");
    });
    $("#toggle37").click(function(){
        $("#hidetoggle37").toggle("slow");
    });
    $("#toggle38").click(function(){
        $("#hidetoggle38").toggle("slow");
    });
    $("#toggle39").click(function(){
        $("#hidetoggle39").toggle("slow");
    });
    $("#toggle40").click(function(){
        $("#hidetoggle40").toggle("slow");
    });
    $("#toggle41").click(function(){
        $("#hidetoggle41").toggle("slow");
    });
    $("#toggle42").click(function(){
        $("#hidetoggle42").toggle("slow");
    });
    $("#toggle43").click(function(){
        $("#hidetoggle43").toggle("slow");
    });
    $("#toggle44").click(function(){
        $("#hidetoggle44").toggle("slow");
    });
    $("#toggle45").click(function(){
        $("#hidetoggle45").toggle("slow");
    });
    $("#toggle46").click(function(){
        $("#hidetoggle46").toggle("slow");
    });
    $("#toggle47").click(function(){
        $("#hidetoggle47").toggle("slow");
    });
    $("#toggle48").click(function(){
        $("#hidetoggle48").toggle("slow");
    });
    $("#toggle49").click(function(){
        $("#hidetoggle49").toggle("slow");
    });
    $("#toggle50").click(function(){
        $("#hidetoggle50").toggle("slow");
    });
    $("#toggle51").click(function(){
        $("#hidetoggle51").toggle("slow");
    });
    $("#toggle52").click(function(){
        $("#hidetoggle52").toggle("slow");
    });
    $("#toggle53").click(function(){
        $("#hidetoggle53").toggle("slow");
    });
    $("#toggle54").click(function(){
        $("#hidetoggle54").toggle("slow");
    });
    $("#toggle55").click(function(){
        $("#hidetoggle55").toggle("slow");
    });
    $("#toggle56").click(function(){
        $("#hidetoggle56").toggle("slow");
    });
    $("#toggle57").click(function(){
        $("#hidetoggle57").toggle("slow");
    });
    $("#toggle58").click(function(){
        $("#hidetoggle58").toggle("slow");
    });
    $("#toggle59").click(function(){
        $("#hidetoggle59").toggle("slow");
    });
    $("#toggle60").click(function(){
        $("#hidetoggle60").toggle("slow");
    });
    $("#toggle61").click(function(){
        $("#hidetoggle61").toggle("slow");
    });
    $("#toggle62").click(function(){
        $("#hidetoggle62").toggle("slow");
    });
    $("#toggle63").click(function(){
        $("#hidetoggle63").toggle("slow");
    });
    $("#toggle64").click(function(){
        $("#hidetoggle64").toggle("slow");
    });
    $("#toggle65").click(function(){
        $("#hidetoggle65").toggle("slow");
    });
    $("#toggle66").click(function(){
        $("#hidetoggle66").toggle("slow");
    });
    $("#toggle67").click(function(){
        $("#hidetoggle67").toggle("slow");
    });
    $("#toggle68").click(function(){
        $("#hidetoggle68").toggle("slow");
    });
    $("#toggle69").click(function(){
        $("#hidetoggle69").toggle("slow");
    });
    $("#toggle70").click(function(){
        $("#hidetoggle70").toggle("slow");
    });


$(".col_about").html('<div class="submenu"><a href="pro-kompaniju/istorija-kompaniji.html">Історія компанії</a><br><a href="pro-kompaniju/kerivnictvo.html">Керівництво</a><br><a href="pro-kompaniju/personal.html">Персонал</a><br><a href="pro-kompaniju/muzei.html">Музей</a><br><a href="pro-kompaniju/skhema-elektromerezh.html">Схема електромереж</a><br><a href="pro-kompaniju/kontakti.html">Контакти</a></div>');
$(".col_invest").html('<div class="submenu"><a href="investoram/pokazniki.html">Показники</a><br><a href="investoram/sumska-oblast.html">Сумська область</a><br><a href="investoram/rejestrator.html">Реєстратор компанії</a><br><a href="investoram/pro-auditoriv.html">Про аудиторів</a><br><a href="investoram/akcioneram.html">Акціонерам</a></div>');
$(".col_users").html('<div class="submenu"><a href="spozhivacham/servisnii-centr.html">Сервісний центр</a><br><a href="spozhivacham/garjacha-linija.html">Гаряча лінія</a><br><a href="spozhivacham/tarifi.html">Тарифи</a><br><a href="spozhivacham/zvorotnii-zvjazok.html">Зворотній зв`язок</a><br><a href="mii-rakhunok.html">Мій рахунок</a></div>');
$(".col_press").html('<div class="submenu"><a href="pres-centr/oficiini-dokumenti.html">Офіційні документи</a><br><a href="pres-centr/novini-sumioblenergo.html">Новини Сумиобленерго</a><br><a href="pres-centr/novini-energetiki.html">Новини енергетики</a><br><a href="pres-centr/gazeta-energetik.html">Газета "Енергетик"</a></div>');
$(".col_pokaz").html('<div class="submenu"><a href="investoram/pokazniki/virobnicha-dijalnist.html">Виробничі</a><br><a href="investoram/pokazniki/ekonomichni-pokazniki.html">Економічні</a><br><a href="investoram/pokazniki/bukhgalterska-zvitnist.html">Бухгалтерські</a></div>');

$(".col_about_ru").html('<div class="submenu"><a href="rus/o-kompanii/istorija-kompanii.html">История компании</a><br><a href="rus/o-kompanii/rukovodstvo.html">Руководство</a><br><a href="rus/o-kompanii/personal.html">Персонал</a><br><a href="rus/o-kompanii/skhema-ehlektrosetei.html">Схема электросетей</a><br><a href="rus/o-kompanii/kontakty.html">Контакты</a></div>');
$(".col_invest_ru").html('<div class="submenu"><a href="rus/investoram/pokazateli.html">Показатели</a><br><a href="rus/investoram/sumskaja-oblast.html">Сумская область</a><br><a href="rus/investoram/registrator.html">Регистратор компании</a><br><a href="rus/investoram/pro-auditorov.html">Про аудиторов</a><br><a href="rus/investoram/akcioneram.html">Акционерам</a></div>');
$(".col_users_ru").html('<div class="submenu"><a href="rus/potrebiteljam/servisnyi-centr.html">Сервисный центр</a><br><a href="rus/potrebiteljam/gorjachaja-linija.html">Горячая линия</a><br><a href="rus/potrebiteljam/obratnaja-svjaz.html">Обратная связь</a></div>');
$(".col_pokaz_ru").html('<div class="submenu"><a href="rus/investoram/pokazateli/proizvodstvennaja-dejatelnost.html">Производственные</a><br><a href="rus/investoram/pokazateli/ehkonomicheskie-pokazateli.html">Экономические</a><br><a href="rus/investoram/pokazateli/bukhgalterskaja-otchetnost.html">Бухгалтерские</a></div>');

$(".col_about_en").html('<div class="submenu"><a href="eng/about-the-company/history-of-the-company.html">History of the company</a><br><a href="eng/about-the-company/directorate.html">Directorate</a><br><a href="eng/about-the-company/personnel.html">Personnel</a><br><a href="eng/about-the-company/contacts.html">Contacts</a></div>');
$(".col_invest_en").html('<div class="submenu"><a href="eng/for-investors/performance-characteristics.html">Perform. characteristics</a><br><a href="eng/for-investors/registrator-of-the-company.html">About the registrator</a><br><a href="eng/for-investors/about-the-auditors.html">About the auditors</a><br><a href="eng/for-investors/for-stockholders.html">For stockholders</a></div>');
$(".col_pokaz_en").html('<div class="submenu"><a href="eng/for-investors/performance-characteristics/production-activity.html">Production activity</a><br><a href="eng/for-investors/performance-characteristics/economic-indices.html">Economic indices</a><br><a href="eng/for-investors/performance-characteristics/accounting-reports.html">Accounting reports</a></div>');

$(".submenu").fadeTo(1, 0.0);

$(".col_about").bind("mouseenter",function(){
      $(".col_about .submenu").fadeTo(1000, 0.9);
    }).bind("mouseleave",function(){
      $(".col_about .submenu").fadeTo(200, 0.0);
    });

$(".col_invest").bind("mouseenter",function(){
      $(".col_invest .submenu").fadeTo(1000, 0.9);
    }).bind("mouseleave",function(){
      $(".col_invest .submenu").fadeTo(200, 0.0);
    });

$(".col_users").bind("mouseenter",function(){
      $(".col_users .submenu").fadeTo(1000, 0.9);
    }).bind("mouseleave",function(){
      $(".col_users .submenu").fadeTo(200, 0.0);
    });

$(".col_press").bind("mouseenter",function(){
      $(".col_press .submenu").fadeTo(1000, 0.9);
    }).bind("mouseleave",function(){
      $(".col_press .submenu").fadeTo(200, 0.0);
    });

$(".col_pokaz").bind("mouseenter",function(){
      $(".col_pokaz .submenu").fadeTo(1000, 0.9);
    }).bind("mouseleave",function(){
      $(".col_pokaz .submenu").fadeTo(200, 0.0);
    });

$(".col_about_ru").bind("mouseenter",function(){
      $(".col_about_ru .submenu").fadeTo(1000, 0.9);
    }).bind("mouseleave",function(){
      $(".col_about_ru .submenu").fadeTo(200, 0.0);
    });

$(".col_invest_ru").bind("mouseenter",function(){
      $(".col_invest_ru .submenu").fadeTo(1000, 0.9);
    }).bind("mouseleave",function(){
      $(".col_invest_ru .submenu").fadeTo(200, 0.0);
    });

$(".col_users_ru").bind("mouseenter",function(){
      $(".col_users_ru .submenu").fadeTo(1000, 0.9);
    }).bind("mouseleave",function(){
      $(".col_users_ru .submenu").fadeTo(200, 0.0);
    });

$(".col_pokaz_ru").bind("mouseenter",function(){
      $(".col_pokaz_ru .submenu").fadeTo(1000, 0.9);
    }).bind("mouseleave",function(){
      $(".col_pokaz_ru .submenu").fadeTo(200, 0.0);
    });

$(".col_about_en").bind("mouseenter",function(){
      $(".col_about_en .submenu").fadeTo(1000, 0.9);
    }).bind("mouseleave",function(){
      $(".col_about_en .submenu").fadeTo(200, 0.0);
    });

$(".col_invest_en").bind("mouseenter",function(){
      $(".col_invest_en .submenu").fadeTo(1000, 0.9);
    }).bind("mouseleave",function(){
      $(".col_invest_en .submenu").fadeTo(200, 0.0);
    });

$(".col_pokaz_en").bind("mouseenter",function(){
      $(".col_pokaz_en .submenu").fadeTo(1000, 0.9);
    }).bind("mouseleave",function(){
      $(".col_pokaz_en .submenu").fadeTo(200, 0.0);
    });



$("#print_button").click(function(){
	var toprint = $(".news-single-item").html();
	$("body").prepend('<div class="hidden">'+toprint+'</div>');
	$(".hidden img").hide();
	$(".hidden").jPrint();
});
$(".vac").click(function(){
	$("#vac_subject").attr('value', $("span",this).text());
	$("#hidetoggle1").hide('slow');
	$("#hidetoggle2").hide('slow');
	$("#hidetoggle3").hide('slow');
	$("#hidetoggle4").hide('slow');
});


$("a").each(function(){
	$(this).attr("rel", $(this).attr("title"));
	$(this).attr("title", "");
});


$("a").mouseover(function(e){
	var tiptext = $(this).attr("rel");
	if (tiptext != ""){
	$("#tooltip").css("left", e.pageX+20);
	$("#tooltip").css("top", e.pageY+20);
	$("#tooltip").text(tiptext);
	$("#tooltip").show();
	}
});

$("a").mousemove(function(e){
	$("#tooltip").css("left", e.pageX+20);
	$("#tooltip").css("top", e.pageY+20);
});
$("a").mouseout(function(e){
	$("#tooltip").hide();
});


$("#360submit").click(function(){
	baliv = 0;
	$(".radio").each(function(){
		if ($(this).attr("checked")){
			baliv = baliv*1 + $(this).val()*1;
		}
	});
	$("#baliv").attr('value', baliv);
});


var zoomoptions =
            {
                zoomWidth: 280,
                zoomHeight: 280,
                title: false,
		xOffset: 0
            }

$(".jqzoom").jqzoom(zoomoptions);




/*__________________ for rahunok______________________________________________________________________________*/

$('#form_login').tabs();
$('#form_getpass').tabs();
$('#form_remindpass').tabs();
$('#form_account').tabs();

if ($.cookie('logged')==1){
	$('#form_account').show();
	refreshAccount();
	refreshGrid();
}else{
	$('#form_login').show();
}


$("#ajaxloading").ajaxStart(function(){
	$(".button").hide();
	$(this).show();
});
$("#ajaxloading").ajaxStop(function(){
	$(".button").show();

	if ($('#cookie_payed').text()=='1'){
		$('#button_pay').hide();
		$('#button_kv_print').hide();
	}
	$(this).hide();
});

$('#button_show_form_getpass').click(function(){
	$('#form_login').hide();
	$('#form_getpass').show();
});

$('#button_show_form_getpass2').click(function(){
	$('#form_remindpass').hide();
	$('#form_getpass').show();
});

$('#button_show_form_login').click(function(){
	$('#form_getpass').hide();
	$('#form_login').show();
});
$('#button_show_form_login2').click(function(){
	$('#form_remindpass').hide();
	$('#form_login').show();
});
$('#button_show_form_remindpass').click(function(){
	$('#form_login').hide();
	$('#form_remindpass').show();
});


$('#dialog_login_true').dialog({
	autoOpen: false,
	title: 'Вхід в систему',
	buttons: {
		"Відміна": function() { 
			resetCookies();
			resetStatus();
			$(this).dialog("close");
		},
		"Вхід в систему": function() { 
			$('#form_login').hide();
			$('#button_refresh').click();
			$('#form_account').show();
			refreshGrid();
			$(this).dialog("close");
		}
	}
});

$('#dialog_login_false').dialog({
	autoOpen: false,
	title: 'Вхід в систему',
	buttons: {
		"Закрити": function() { 
			$(this).dialog("close"); 
		}
	}
});

$('#dialog_getpass_false').dialog({
	autoOpen: false,
	title: 'Отримання паролю',
	buttons: {
		"Закрити": function() { 
			$(this).dialog("close"); 
		}
	}
});

$('#dialog_getpass_compete').dialog({
	autoOpen: false,
	title: 'Отримання паролю',
	buttons: {
		"Закрити": function() { 
			$(this).dialog("close");
			$('#button_show_form_login').click();
		}
	}
});

$('#dialog_getpass_notcompete').dialog({
	autoOpen: false,
	title: 'Отримання паролю',
	buttons: {
		"Закрити": function() { 
			$(this).dialog("close");
			$('#dialog_getpass_true').dialog('open');
		}
	}
});

$('#dialog_getpass_true').dialog({
	autoOpen: false,
	title: 'Отримання паролю',
	buttons: {
		"Закрити": function() { 
			$(this).dialog("close"); 
		},
		"Створити пароль": function() { 
			$.ajax({
				url: "ab_php/set_pass.php", 
				data: {ls:$('#input_ls').val(),pass:$('#input_pass_get').val(),email:$('#input_email_get').val(),phone:$('#input_phone_get').val(),coderoe:$('#input_rajon').val()},
				dataType: 'json', 
				success: function(data){
					if (data.result=='true'){
						$('#dialog_login_true').dialog('close');
						$('#dialog_getpass_compete').html('Пароль встановлено. <br />Скористайтесь формою входу.');
						$('#dialog_getpass_compete').dialog('open');
					}else{
						$('#dialog_login_true').dialog('close');
						$('#dialog_getpass_notcompete').html('Помилка. <br />Перевірте правильність введених даних.');
						$('#dialog_getpass_notcompete').dialog('open');
					}
				}
			});
			$(this).dialog("close");
		}
	}
});

$('#dialog_remindpass_false').dialog({
	autoOpen: false,
	title: 'Нагадування паролю',
	buttons: {
		"Закрити": function() { 
			$(this).dialog("close"); 
		}
	}
});

$('#dialog_remindpass_true').dialog({
	autoOpen: false,
	title: 'Нагадування паролю',
	buttons: {
		"Закрити": function() { 
			$(this).dialog("close"); 
		}
	}
});


$('#button_login').click(function(){
	$.ajax({
		url: "ab_php/login.php", 
		data: {email:$('#input_email').val(), pass:$('#input_pass').val()},
		dataType: 'json', 
		success: function(data){
			if (data.result=='true'){
				setCookies(1, data.ls, data.coderoe, '');
				$('#dialog_login_true').html('Абонента ідентифіковано. <br />Ввійти в систему?');
				$('#dialog_login_true').dialog('open');
			}else{
				$('#dialog_login_false').html('Не вірна комбінація Email і паролю. <br />Спробуйте ще раз або <br />нажміть "нагадати" чи "отримати новий" пароль.');
				$('#dialog_login_false').dialog('open');
			}
		}
	});
});


$('#button_getpass').click(function(){
	$.ajax({
		url: "ab_php/get_pass.php", 
		data: {ls:$('#input_ls').val(), unikod:$('#input_unikod').val(), coderoe:$('#input_rajon').val()},
		dataType: 'json', 
		success: function(data){
			if (data.result=='true'){
				$('#dialog_getpass_true').html('Абонента ідентифіковано. <br />Введіть email, мобільний та пароль (всі поля обов`язкові). <p>E-mail <input type="text" id="input_email_get" value="" /></p><p>Пароль <input type="password" id="input_pass_get" value="" /></p><p>Моб. телефон (+38XXXXXXXXXX)<br/>+38<input type="text" id="input_phone_get" value="" /></p>');
				setCookies(0, data.ls,data.coderoe, '');
				$('#dialog_getpass_true').dialog('open');
			}else{
				$('#dialog_getpass_false').html('Комбінацію рахунку і <br />останньої квітанції <br />не знайдено.');
				$('#dialog_getpass_false').dialog('open');
			}
		}
	});
});


$('#button_remindpass').click(function(){
	$.ajax({
		url: "ab_php/remind_pass.php", 
		data: {email:$('#input_email_remind').val()},
		dataType: 'json', 
		success: function(data){
			if (data.result=='true'){
				$('#dialog_remindpass_true').html('Пароль відправлено на <br/>Ваш email (мобільний телефон)');
				$('#dialog_remindpass_true').dialog('open');
			}else{
				$('#dialog_remindpass_false').html('Введений E-mail <br />не існує в базі. Спробуйте ще раз або <br />отримайте новий пароль.');
				$('#dialog_remindpass_false').dialog('open');
			}
		}
	});
});


$('#button_refresh').click(function(){
	refreshAccount();
});

$('#button_refresh_grid').click(function(){
	refreshGrid();
});

$('#button_refresh_chart').click(function(){

});

$('#button_pay').click(function(){
	$('#dialog_pay_form').dialog({
		autoOpen: false,
		title: 'Оплата рахунку',
		buttons: {
			"Закрити": function() { 
				$(this).dialog("close");
			}
		}
	});

	$.ajax({
		url: "ab_php/account_info.php", 
		data: {ls:$.cookie('ls'), coderoe:$.cookie('coderoe')},
		dataType: 'json', 
		success: function(data){
			if (data.result=='true'){
			
				var orderid = data.unikod;
				var totalamount = data.feemon*1+data.pdv*1+data.dolgab*1+data.dolgpdv*1-data.paysub*1-data.ppdvsub*1;
				var purchasedesc = data.fio+' о/р '+data.ls+'. Оплата рахунку за електроенергію за період з '+data.datein+' по '+data.dateout;
				var pay_notice = purchasedesc+'<br/>№ квитанції <b>'+orderid+'</b><br/>Сума до сплати <b>'+totalamount/100+'</b> грн.';
				var add_notice = 'Дані відправляються. <br/>Зачекайте переходу до платіжної системи.';


				var MerchantID = data.midroe;
				var TerminalID = data.tidroe;
				var ServerUPC = 'https://secure.upc.ua/go/enter';


				$('#dialog_pay_form').html(pay_notice+'<form id="pay_form" action="'+ServerUPC+'" method="POST"><input id="Version" type="hidden" name="Version" value="1" readonly><input id="MerchantID" type="hidden" name="MerchantID" value="'+MerchantID+'" readonly><input id="TerminalID" type="hidden" name="TerminalID" value="'+TerminalID+'" readonly><input id="Currency" type="hidden" name="Currency" value="980" readonly><input id="locale" type="hidden" name="locale" value="uk" readonly><input id="SD" type="hidden" name="SD" value="" readonly><input id="PurchaseTime" type="hidden" name="PurchaseTime" value=""  readonly><input id="OrderID" type="hidden" name="OrderID" value="'+orderid+'" readonly><input id="TotalAmount" type="hidden" name="TotalAmount" value="'+totalamount+'" readonly><input id="PurchaseDesc" type="hidden" name="PurchaseDesc" value="'+purchasedesc+'" ><input id="Signature" type="hidden" name="Signature" value="">'+add_notice+'</form>');
				$('#dialog_pay_form').dialog('open');
				$.ajax({
					url: "mii-rakhunok/create_sign.php", 
					data: {MerchantID:$("#MerchantID").val(), TerminalID:$("#TerminalID").val(), PurchaseTime:$("#PurchaseTime").val(), OrderID:$("#OrderID").val(), Currency:$("#Currency").val(), Currency:$("#Currency").val(), TotalAmount:$("#TotalAmount").val()},
					dataType: 'json', 
					success: function(data){
						//alert(data.signature64);
						$("#PurchaseTime").val(data.purchasetime);
						$("#Signature").val(data.signature64);
						$("#pay_form").submit();
					}
				});


			}
		}
	});

});


$('#button_logout').click(function(){
	resetCookies();
	resetAccount();
	$('#form_account').hide();
	$('#form_login').show();
	resetStatus();
});
$('#button_logout_grid').click(function(){
	$('#button_logout').click();
});
$('#button_logout_chart').click(function(){
	$('#button_logout').click();
});



$('#button_kv_print').click(function(){
	window.open("mii-rakhunok/kvitanciya_ex.php", "_blank");
});

$('#button_changepass').click(function(){
	$('#dialog_changepass').html('<p>E-mail <input type="text" id="input_email_change" value="" /></p><p>Пароль <input type="password" id="input_pass_change" value="" /></p><p>Моб. телефон (+38XXXXXXXXXX) <br/>+38<input type="text" id="input_phone_change" value="" /></p>');
	$.ajax({
		url: "ab_php/change_pass.php", 
		data: {ls:$.cookie('ls')},
		dataType: 'json', 
		success: function(data){
			if (data.result=='true'){
				$('#input_email_change').val(data.email);
				$('#input_phone_change').val(data.phone);
				$('#input_pass_change').val(data.pass);
				$('#dialog_changepass').dialog('open');
			}
		}
	});
});

$('#dialog_changepass').dialog({
	autoOpen: false,
	title: 'Редагування даних',
	buttons: {
		"Закрити": function() { 
			$(this).dialog("close"); 
		},
		"Зберегти": function() { 
			$.ajax({
				url: "ab_php/set_pass.php", 
				data: {ls:$.cookie('ls'),pass:$('#input_pass_change').val(),email:$('#input_email_change').val(),phone:$('#input_phone_change').val(),coderoe:$.cookie('coderoe')},
				dataType: 'json', 
				success: function(data){
					if (data.result=='true'){
						$('#dialog_changepass_complete').html('Ваші дані успішно збережено.');
						$('#dialog_changepass_complete').dialog('open');
					}else{
						$('#dialog_changepass_notcomplete').html('Помилка. <br />Перевірте правильність введених даних.');
						$('#dialog_changepass_notcomplete').dialog('open');
					}
				}
			});
			$(this).dialog("close"); 
		}
	}
});

$('#dialog_changepass_complete').dialog({
	autoOpen: false,
	title: 'Редагування даних',
	buttons: {
		"Закрити": function() { 
			$(this).dialog("close"); 
		}
	}
});

$('#dialog_changepass_notcomplete').dialog({
	autoOpen: false,
	title: 'Редагування даних',
	buttons: {
		"Закрити": function() { 
			$(this).dialog("close"); 
			$('#dialog_changepass').dialog('open');
		}
	}
});




function createAddressString(namenp, namestr, dom, korpus, kwart){
	var addr = '';
	if (namenp != '') addr = addr + namenp;
	if (namestr != '') addr = addr + ', ' + namestr;
	if (dom != '') addr = addr + ' ' + dom;
	if (korpus != '') addr = addr + '/' + korpus;
	if (kwart != '') addr = addr + '/' + kwart;
	return(addr);
}
function resetCookies(){
	$.cookie('logged', 0);
	$.cookie('ls', '');
	$.cookie('coderoe', '');
	$.cookie('unikod', '');	
}
function setCookies(logged, ls, coderoe, unikod){
	$.cookie('logged', logged);
	$.cookie('ls', ls);
	$.cookie('coderoe', coderoe);
	$.cookie('unikod', unikod);	
}
function resetStatus(){
	$('#cookie_logged').text('0');
	$('#cookie_ls').text('');
	$('#cookie_fio').text('');
	$('#cookie_address').text('');
	$('#cookie_datein').text('');
	$('#cookie_dateout').text('');
	$('#cookie_pok1').text('');
	$('#cookie_pok2').text('');
	$('#cookie_feekvt').text('');
	$('#cookie_feemon').text('');
	$('#cookie_pdv').text('');	
	$('#cookie_paysub').text('');
	$('#cookie_ppdvsub').text('');
	$('#cookie_kordolg').text('');
	$('#cookie_korpdv').text('');	
	$('#cookie_dolgab').text('');
	$('#cookie_dolgpdv').text('');
	$('#cookie_lgkvt').text('');
	$('#cookie_unikod').text('');
	$('#cookie_pok12').text('');
	$('#cookie_pok22').text('');
	$('#cookie_pok13').text('');
	$('#cookie_pok23').text('');
	$('#cookie_datvyp').text('');
	$('#cookie_datopl').text('');
	$('#cookie_datvykl').text('');
	$('#cookie_payed').text('');
	$('#cookie_coderoe').text('');
	$('#cookie_nameroe').text('');
	$('#cookie_bankroe').text('');
	$('#cookie_mforoe').text('');
	$('#cookie_rakhroe').text('');
	$('#cookie_okudroe').text('');
	$('#cookie_telroe').text('');
	$('#cookie_midroe').text('');
	$('#cookie_tidroe').text('');
}
function refreshStatus(logged,ls,fio,address,datein,dateout,pok1,pok2,feekvt,feemon,pdv,paysub,ppdvsub,kordolg,korpdv,dolgab,dolgpdv,lgkvt,unikod,pok12,pok22,pok13,pok23,datvyp,datopl,datvykl,payed,coderoe,nameroe,bankroe,mforoe,rakhroe,okudroe,telroe,midroe,tidroe){
	$('#cookie_logged').text(logged);
	$('#cookie_ls').text(ls);
	$('#cookie_fio').text(fio);
	$('#cookie_address').text(address);
	$('#cookie_datein').text(datein);
	$('#cookie_dateout').text(dateout);
	$('#cookie_pok1').text(pok1);
	$('#cookie_pok2').text(pok2);
	$('#cookie_feekvt').text(feekvt);
	$('#cookie_feemon').text(feemon);
	$('#cookie_pdv').text(pdv);	
	$('#cookie_paysub').text(paysub);
	$('#cookie_ppdvsub').text(ppdvsub);
	$('#cookie_kordolg').text(kordolg);
	$('#cookie_korpdv').text(korpdv);	
	$('#cookie_dolgab').text(dolgab);
	$('#cookie_dolgpdv').text(dolgpdv);
	$('#cookie_lgkvt').text(lgkvt);
	$('#cookie_unikod').text(unikod);
	$('#cookie_pok12').text(pok12);
	$('#cookie_pok22').text(pok22);
	$('#cookie_pok13').text(pok13);
	$('#cookie_pok23').text(pok23);
	$('#cookie_datvyp').text(datvyp);
	$('#cookie_datopl').text(datopl);
	$('#cookie_datvykl').text(datvykl);
	$('#cookie_payed').text(payed);
	$('#cookie_coderoe').text(coderoe);
	$('#cookie_nameroe').text(nameroe);
	$('#cookie_bankroe').text(bankroe);
	$('#cookie_mforoe').text(mforoe);
	$('#cookie_rakhroe').text(rakhroe);
	$('#cookie_okudroe').text(okudroe);
	$('#cookie_telroe').text(telroe);
	$('#cookie_midroe').text(midroe);
	$('#cookie_tidroe').text(tidroe);
}
function refreshAccount(){
	$.ajax({
		url: "ab_php/account_info.php", 
		data: {ls:$.cookie('ls'), coderoe:$.cookie('coderoe')},
		dataType: 'json', 
		success: function(data){
			if (data.result=='true'){
			setCookies(1, data.ls, data.coderoe, data.unikod);
			refreshStatus(1, data.ls, data.fio, createAddressString(data.namenp, data.namestr, data.dom, data.korpus, data.kwart), data.datein, data.dateout, data.pok1, data.pok2, data.feekvt, data.feemon, data.pdv, data.paysub, data.ppdvsub, data.kordolg, data.korpdv, data.dolgab, data.dolgpdv, data.lgkvt, data.unikod, data.pok12, data.pok22, data.pok13, data.pok23, data.datvyp, data.datopl, data.datvykl, data.payed, data.coderoe, data.nameroe, data.bankroe, data.mforoe, data.rakhroe, data.okudroe, data.telroe, data.midroe, data.tidroe);

			$('#greeting').text('Вітаємо вас, '+$('#cookie_fio').text());
			$('#rahunok_ls').text($('#cookie_ls').text());
			$('#rahunok_fio').text($('#cookie_fio').text());
			$('#rahunok_address').text($('#cookie_address').text());
			$('#rahunok_datein').text($('#cookie_datein').text());
			$('#rahunok_dateout').text($('#cookie_dateout').text());
			$('#rahunok_pok1').text($('#cookie_pok1').text());
			$('#rahunok_pok2').text($('#cookie_pok2').text());
			$('#rahunok_feekvt').text($('#cookie_feekvt').text());
			$('#rahunok_feemon').text($('#cookie_feemon').text()/100);
			$('#rahunok_pdv').text($('#cookie_pdv').text()/100);
			$('#rahunok_paysub').text($('#cookie_paysub').text()/100);
			$('#rahunok_ppdvsub').text($('#cookie_ppdvsub').text()/100);
			$('#rahunok_dolgab').text($('#cookie_dolgab').text()/100);
			$('#rahunok_dolgpdv').text($('#cookie_dolgpdv').text()/100);
			$('#rahunok_suma').text(Math.round(($('#cookie_feemon').text()/100 + $('#cookie_pdv').text()/100 + $('#cookie_dolgab').text()/100 + $('#cookie_dolgpdv').text()/100 - $('#cookie_paysub').text()/100 - $('#cookie_ppdvsub').text()/100)*100)/100);
			$('#rahunok_unikod').text($('#cookie_unikod').text());
			$('#img_barcode').attr('src', 'ab_php/barcode.php?barcode='+$('#cookie_unikod').text());
			$('#rahunok_pok12').text($('#cookie_pok12').text());
			$('#rahunok_pok22').text($('#cookie_pok22').text());
			$('#rahunok_pok13').text($('#cookie_pok13').text());
			$('#rahunok_pok23').text($('#cookie_pok23').text());
			$('#rahunok_datvyp').text($('#cookie_datvyp').text());
			$('#rahunok_datopl').text($('#cookie_datopl').text());
			$('#rahunok_datvykl').text($('#cookie_datvykl').text());
			if ($('#cookie_payed').text()=='1'){
				$('#payment_info').css('background','url(fileadmin/template/pics/payed.gif) no-repeat right bottom');
			}else{
				$('#payment_info').css('background','none');
			}


			}else{

			}
		}
	});
}
function resetAccount(){
	$('#greeting').text('');
	$('#rahunok_ls').text('');
	$('#rahunok_fio').text('');
	$('#rahunok_address').text('');
	$('#rahunok_datein').text('');
	$('#rahunok_dateout').text('');
	$('#rahunok_pok1').text('');
	$('#rahunok_pok2').text('');
	$('#rahunok_feekvt').text('');
	$('#rahunok_feemon').text('');
	$('#rahunok_pdv').text('');
	$('#rahunok_paysub').text('');
	$('#rahunok_ppdvsub').text('');
	$('#rahunok_dolgab').text('');
	$('#rahunok_dolgpdv').text('');
	$('#rahunok_suma').text('');
	$('#rahunok_unikod').text('');
	$('#img_barcode').attr('src', 'ab_php/barcode.php?barcode=0');
	$('#rahunok_pok12').text('');
	$('#rahunok_pok22').text('');
	$('#rahunok_pok13').text('');
	$('#rahunok_pok23').text('');
	$('#rahunok_datvyp').text('');
	$('#rahunok_datopl').text('');
	$('#rahunok_datvykl').text('');
	$('#payment_info').css('background','none');
}
function refreshGrid(){
	$("#account_allkv").jqGrid({
		url:'ab_php/account_allkv.php',
		datatype: "json", 
		colNames:['№ квит.', 'Період з', 'Період дo', 'Спож.', 'Борг', 'Нарах.', 'Cплач.', 'Дата спл'],
		colModel:[ 
			{name:'1',index:'1', width:73, align:"left", sortable:false},
			{name:'2',index:'2', width:57, align:"left", sortable:false},
			{name:'3',index:'3', width:57, align:"left", sortable:false},
			{name:'4',index:'4', width:32, align:"left", sortable:false},
			{name:'5',index:'5', width:35, align:"left", sortable:false},
			{name:'6',index:'6', width:35, align:"left", sortable:false},
			{name:'7',index:'7', width:35, align:"left", sortable:false},
			{name:'8',index:'8', width:57, align:"left", sortable:false}
			],
		rowNum:10,
		rowList:[10,20,30],
		pager: '',
		sortname: '',
		viewrecords: true,
		sortorder: "desc"
	})/*.navGrid("#mypager",{edit:false,add:false,del:false,search:false})*/;
	$("#account_allkv").trigger("reloadGrid");
}

});