function infoblock_toggle(div_id){
var icon_id = '#icon_' + div_id;
var title_id = '#title_' + div_id;
var idd = '#' + div_id;
$(idd).slideToggle(600);
if (document.getElementById(div_id).style.display == 'block'){
$.cookie(idd, 'collapsed', {expires: 7, path: '/', domain: 'transelektrokomplekt.by'});
$(icon_id).attr('src', "/_img/icon_expand.gif");
$(title_id).attr('title', "Развернуть инфоблок");
}
else {
$.cookie(idd, 'expanded', {expires: 7, path: '/', domain: 'transelektrokomplekt.by'});
$(icon_id).attr('src', "/_img/icon_collapse.gif");
$(title_id).attr('title', "Свернуть инфоблок");
}
}
function div_toggle(div_id){
var idd = '#' + div_id;
if (document.cookie == "") {
if (document.getElementById(div_id).style.display == 'block'){
$(idd).slideToggle(600);
$.cookie(idd, 'collapsed', {expires: 7, path: '/', domain: 'transelektrokomplekt.by'});
}
else {
$(idd).slideToggle(600);
$.cookie(idd, 'expanded', {expires: 7, path: '/', domain: 'transelektrokomplekt.by'});
}
}
else {
if ($.cookie(idd) == 'collapsed') {
$(idd).slideToggle(600);
$.cookie(idd, 'expanded', {expires: 7, path: '/', domain: 'transelektrokomplekt.by'});
}
else {
$(idd).slideToggle(600);
$.cookie(idd, 'collapsed', {expires: 7, path: '/', domain: 'transelektrokomplekt.by'});
}
}
}
function slideSwitch() {
var $active = $('#fpslideshow div.active');
if ( $active.length == 0 ) $active = $('#fpslideshow div:last');
var $next = $active.next().length ? $active.next()
: $('#fpslideshow div:first');
$active.addClass('last-active');
$next.css({opacity: 0.0})
.addClass('active')
.animate({opacity: 1.0}, 2000, function() {
$active.removeClass('active last-active');
});
}
$(function(){
$("ul.topmenu li").hover(function(){
$(this).addClass("hover");
$('ul:first',this).show();
}, function(){
$(this).removeClass("hover");
$('ul:first',this).hide();
});
$("ul.topmenu li ul li:has(ul)").find("a:first").append('');
});
function fpnews_activate(div_id){
var title_id = '#fpnewstitle' + div_id;
var intro_id = '#fpnewsintro' + div_id;
$('.fpnewsintro').hide();
$('.fpnewstitle').css('background-color','#F0F0F0');
$(title_id).css('background-color','#E0E0E0');
$(intro_id).slideToggle(600);
}
function IsNumeric(sText){
var ValidChars = "0123456789.";
var IsNumber=true;
var Char;
for (i = 0; i < sText.length && IsNumber == true; i++) {
Char = sText.charAt(i);
if (ValidChars.indexOf(Char) == -1) IsNumber = false;
}
return IsNumber;
}
function loadweather(selObj){
if (IsNumeric(selObj.options[selObj.selectedIndex].value)) $('#weather').load('/dynweather/locality-'+selObj.options[selObj.selectedIndex].value+'/');
else return false;
}
function show_mail(username, host) {
document.write('' + username + '@' + host +'');
}
function addbookmark(title,url){
if (window.sidebar) window.sidebar.addPanel(title, url, "");
else if (window.opera && window.print){
var elem = document.createElement('a');
elem.setAttribute('href',url);
elem.setAttribute('title',title);
elem.setAttribute('rel','sidebar');
elem.click();
}
else if(document.all) window.external.AddFavorite(url, title);
}
function setHomepage(url){
if (document.all){document.body.style.behavior='url(#default#homepage)';document.body.setHomePage(url);}
else if (window.sidebar){
if(window.netscape){
try{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");}
catch(e){alert("Для возможности установки домашней страницы, войдите в настройки по адресу about:config и измените переменную signed.applets.codebase_principal_support на true");}
}
var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);
prefs.setCharPref('browser.startup.homepage',url);
}
}
function selstar(val){
for(var x=1;x<=val;x++){
document['ri'+x].src="/_img/star1.gif";
}
}
function unselstar(val){
for(var x=1;x<=val;x++){
document['ri'+x].src="/_img/star0.gif";
}
}
function sendpolldata(form,id) {
var howMany = form.elements.length;
var str = '';
for (count = 0; count < howMany; count++) {
if (form.elements[count].checked == true) {
str = str + "&answer[]=" + form.elements[count].value;
}
}
var url = "/dynpolls/?poll=" + id + str;
$('#polls').load(url);
return false;
}