﻿$(document).ready(function(){  
    //$('body').html().replace('http://rao-esv.ru', 'http://www.rao-esv.ru')

	$("select").autowidth();
    
    $('a[rel*=facebox]').facebox();   
    
	// chart
	/*
    $('#chart').width($('#chartbox').width()-60);
	$('#chart').visualize();
	
	$(window).bind("resize", function(){
		$('#chart').width($('#chartbox').width()-60);
		$('.visualize').remove();
		$('#chart').visualize();
	 });
	 */
	
	// clock
	/*
    var newtime = new Date();
    var time1 = onmoscow(newtime);
    var time2 = pHours(time1, 7);
    viewclock("moscow",time1);
    viewclock("other",time2);
    */

    $('#print_page').click(function() {
        window.print();
    });
    
	var height = $(document).height();
	$("#Lock").css({"height" : height + "px"});
	
	$(window).bind("resize", function(){
		var height = $(document).height();
		$("#Lock").css({"height" : height + "px"});
	});
	 
	$(window).scroll(function(){
		var height = $(document).height();
		$("#Lock").css({"height" : height + "px"});
	});
	
    // show/hide map
	$('#linkmap').click(function() {
        $('#Lock').show();
        $('#Nav').hide();
        $("#actionmap div").css("z-index", "10");
        $('#hidetext').show();
    });	
    
    $('#unlinkmap').click(function() {
        $('#Lock').hide();
        $('#Nav').show();
        $("#actionmap div").css("z-index", "2");
        $('#hidetext').hide();
    });
    
    // video player
    flowplayer("a.player", "/media/plugins/flowplayer-3.2.5.swf");
    
	$().piroBox_ext({
	    piro_speed : 700,
		bg_alpha : 0.5,
		piro_scroll : true
	});
	
	// change image 
	$("#style1").bind("click", function() {
	      $("#changestyle").attr("src","/files/style/big/1.jpg");
	      $.cookie('image', '1.jpg', { expires: 7, path: '/' });
	});	
	$("#style2").bind("click", function() {
	      $("#changestyle").attr("src","/files/style/big/2.jpg");
	      $.cookie('image', '2.jpg', { expires: 7, path: '/'});
	});	
	$("#style3").bind("click", function() {
	      $("#changestyle").attr("src","/files/style/big/3.jpg");
	      $.cookie('image', '3.jpg', { expires: 7, path: '/'});
	});
	$("#style4").bind("click", function() {
	      $("#changestyle").attr("src","/files/style/big/4.jpg");
	      $.cookie('image', '4.jpg', { expires: 7, path: '/'});
	});
	$("#style5").bind("click", function() {
	      $("#changestyle").attr("src","/files/style/big/5.jpg");
	      $.cookie('image', '5.jpg', { expires: 7, path: '/'});
	});	  
	$("#style6").bind("click", function() {
	      $("#changestyle").attr("src","/files/style/big/6.jpg");
	      $.cookie('image', '6.jpg', { expires: 7, path: '/'});
	});
	$("#style7").bind("click", function() {
	      $("#changestyle").attr("src","/files/style/big/7.jpg");
	      $.cookie('image', '7.jpg', { expires: 7, path: '/'});
	});			    
	    	 
});

