var option = {
  x:      1,
  y:      1,
  radius: 1,
  color:  "#FFFFFF"
}
var hns = {
  x:      1,
  y:      1,
  radius: 3,
  color:  "#000000"
}
  // activate vector fonts
  Cufon.replace('#menu a',{fontFamily: 'Franklin',fontSize: '14px',hover: {textShadow:'1px 1px #ffffff'}});
		$(document).ready(function(){
      // top title margin
      if(!($.browser.msie && $.browser.version=='6.0')){
        $('#content *:first').css('marginTop',0);
        $('#content *:last').css('marginBottom',0);
      }
      // others
      $(".news_list h3").css("textAlign","left");
      $(".news_list").each(function(){
      $(this).replaceWith('<div class=n3_bg3><div class=n3_bg1><div class=n3_bg2>'+$(this).html()+'</div></div></div>');
      });
    });

    // навигация по этажам
    function floornav(floorid){
    // preload images     //$.preloadImages('/img/floors/'+floorid+'_0.png');
      $(".floorlist a").each(function(){
        var id = $(this).attr("id").substring(1);
        $.preloadImages("/img/floors/"+floorid+"_"+id+".png");
      });
    // floor navigation
      listdiv = $(".floorlist").html();
      if($.browser.opera) $(".floorlist a").css("margin","2px 0");
       // bg
      	$(".floorbg").css('backgroundImage', 'url(/img/floors/'+floorid+'_bg.png)');
       // each area
        // onmouse
        $("area").hover(function(){
          var id = $(this).attr("href").substring(3); hid=id;
          var point = $(this).attr("coords");var pp=explode(',',point);var linkname = $(this).attr("title");
          $(".floorbg").css('backgroundImage', 'url(/img/floors/'+floorid+'_bg.png)');
          $(".floormap").css('backgroundImage', 'url(/img/floors/'+floorid+'_'+hid+'.png)');//$("#h"+id).css('fontWeight','bold');
          $(".floormap").pngFix(); //alert('url(img/floors/1_'+hid+'.png)');
          if($.browser.msie){
            htmlt = $("#h"+hid).text();
            $("#h"+id).textShadow({x:0,y:0,radius:5,color:"#FEFF00"});
            }else{
            $("#h"+id).css('textShadow','0 0 5px #FEFF00');}
          $("#h"+hid).css('color','#090909');
          $(".flname").css('left',pp[0]);
          $(".flname").css('top',pp[1]);
          $(".flname").html('<span>&nbsp;'+linkname+'&nbsp;</span>');
          $(".flname").textShadow({x:1,y:1,radius:3,color:"#000000"});
          $(".flname span").css('backgroundColor','#D5181C');
          //var id = $(this).attr("href").substring(3);
          //var thlink = $("#h"+id).attr("href");alert(thlink);
        },function(){
          $(".floormap").css('backgroundImage', 'none');
          $(".floorlist a").css('fontWeight','normal');
          $("#h"+hid).css('color','#6e6e6e');
          if($.browser.msie){$("#h"+hid).html(htmlt);
            }else{$("#h"+hid).css('textShadow','0 0 0 #000000');}
          $(".flname").text("");
        });
        // onclick
        $("area").click(function(){
          var id = $(this).attr("href").substring(3);
          var thlink = $("#h"+id).attr("href");//alert(thlink);
          window.location = thlink;
          return false;
          });
       // list
        /*$(".floorlist a").hover(function(){
          var id = $(this).attr("id"); //alert(id);
          var id = id.substring(1); hid=id;
          var point = $("#a"+hid).attr("coords");var pp=explode(',',point);var linkname = $("#a"+hid).attr("title");
          $("#h"+hid).css('color','#090909');
          if($.browser.msie){
            htmlt = $("#h"+id).html();
            $("#h"+hid).textShadow({x:0,y:0,radius:5,color:"#FEFF00"});
          }else{$("#h"+hid).css('textShadow','0px 0px 5px #FEFF00');}
          $(".floormap").css('backgroundImage', 'url(/img/floors/'+floorid+'_'+id+'.png)');//$("#h"+id).css('fontWeight','bold');
          $(".flname").css('left',pp[0]);
          $(".flname").css('top',pp[1]);
          $(".flname").html('<span>&nbsp;'+linkname+'&nbsp;</span>');
          $(".flname").textShadow({x:1,y:1,radius:3,color:"#000000"});
          $(".flname span").css('backgroundColor','#D5181C');
        },function(){
          $("#h"+hid).css('color','#6e6e6e');
          $(".floormap").css('backgroundImage', 'none');
          $(".floorlist a").css('fontWeight','normal');
          if($.browser.msie){
            //$(".floorlist").html(listdiv);
            $("#h"+hid).html(htmlt);}else{}//$("#h"+hid).css('textShadow','0 0 0 #000000');
          $(".flname").text("");
        });*/
    // print numbers
    $("area").each(function(){
      var id = $(this).attr("href").substring(3); hid=id;
      var point = $(this).attr("coords");
      var pp=explode(',',point);
      var xc = $(this).attr("xc");
      var yc = $(this).attr("yc");
      if($.browser.msie) yc=yc-10;
      var thlink = $("#h"+id).attr("href");//alert(thlink);
      ptext='<a href="'+thlink+'">'+id+'</a>';
      $(".floormap").append("<div id=pavn"+id+" class=pavn>"+ptext+"</div>");
//      $("#pavn"+id).textShadow({x:0,y:0,radius:4,color:"#ffffff"});
//      $("#pavn"+id).css('left',xc);
//      $("#pavn"+id).css('top',yc);
//      $("#pavn"+id).css('opacity','0');  ,opacity:100
      $("#pavn"+id).animate({left:xc,top:yc},3000);
      $(".pavn a").textShadow({x:0,y:0,radius:3,color:"#ffffff"});
    });
       // printed numbers
        $(".pavn a").hover(function(){
         var id=$(this).html();
         var linkname = $("#a"+id).attr("title");
         $("#h"+id).css('color','#090909');
         $(".floormap").css('backgroundImage', 'url(/img/floors/'+floorid+'_'+id+'.png)');
         $(".flname").html('<span>&nbsp;'+linkname+'&nbsp;</span>');
         $(".flname span").css('backgroundColor','#8C1012');  //    #E8810F
        },function(){
         $("#h"+id).css('color','#6e6e6e');
         $(".floormap").css('backgroundImage', 'none');
         $(".flname").html();
        });
    }
/*    function CpOver(id){
          hid=id;
          $(".floormap").css('backgroundImage', 'url(img/floors/1_'+id+'.png)');//$("#h"+id).css('fontWeight','bold');
          if($.browser.msie){
            htmlt = $("#h"+id).html();
            $("#h"+id).textShadow({x:0,y:0,radius:5,color:"#FEFF00"});
          }else{$("#h"+id).css('text-shadow','0px 0px 5px ##FEFF00');}
    }
    function CpOut(hid){
          $(".floormap").css('backgroundImage', 'none');
          $(".floorlist a").css('fontWeight','normal');
          if($.browser.msie){
            $(".floorlist").html(listdiv);
            $("#h"+id).html(htmlt);
          }else{$("#h"+hid).css('textShadow','0 0 0 #000');}
    }*/
/* определим функцию обработки ошибок */
	//function onErrorHandler(msg, url, lno)  {return true;}
	//window.onerror = onErrorHandler;

// прочие функции
  // php analogs
function explode( delimiter, string ) { // Split a string by string  +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) +   improved by: kenneth +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
	var emptyArray = { 0: '' };
	if ( arguments.length != 2
		|| typeof arguments[0] == 'undefined'
		|| typeof arguments[1] == 'undefined' )
	{ return null;}
	if ( delimiter === ''
		|| delimiter === false
		|| delimiter === null )
	{ return false;}
	if ( typeof delimiter == 'function'
		|| typeof delimiter == 'object'
		|| typeof string == 'function'
		|| typeof string == 'object' )
	{ return emptyArray;}
	if ( delimiter === true ) { delimiter = '1';}
	return string.toString().split ( delimiter.toString() );
}
  // for jQuery
 jQuery.preloadImages = function() {
    jQuery.each (arguments,function (e) {
        jQuery("<img>").attr("src", this);
    });
 }

