/* 
	(c) 2007, Mediaweb Studio 
*/


function get_browser()
{
var bver=null;
if(document.layers)
{bver='nn4';
}
else if(document.all)
{
if(window.opera)
  {bver='opera';
  }
else
  {bver='ie4';
  }
}
else if(document.getElementById)
{
if(navigator.userAgent.indexOf('gecko')>-1)
  {bver='mozilla';
  }
else
  {bver='nn6';
  }
}
if((window.opera)&&((navigator.appVersion.indexOf('MSIE 5.0')>-1)||(parseInt(navigator.appVersion)==6)))
{
bver='opera6';
}
return bver;
}

var BROWSER_ID = get_browser();


function get_document_object(ElName)
{
if((ElName=="")||(ElName==null))
        {return null;
        }
if(ElName.indexOf('-')>-1)
        {return null;
        }
var El;
if((BROWSER_ID=='ie4')||(BROWSER_ID=='opera'))
{
El=eval("document.all."+ElName);
}
else if((BROWSER_ID=='mozilla')||(BROWSER_ID=='nn6'))
{
El=document.getElementById(ElName);
}
else if(BROWSER_ID=='opera6')
{
if(OPERA_AS_IE==false)
{
El=document.getElementById(ElName);
}
else
{
El=eval("document.all."+ElName);
}
}
return El;
}

function replace_tags(STR,STR1,STR2)
{
var rexp,S;
S=STR;
rexp=new RegExp(STR1,"gi");
S=S.replace(rexp,STR2);
return S;
}


function preloadImg(file) {
  img = new Image();
  img.src = file;
}


function change_image(elname, srcname) {
if (srcname=='1') {
  elname.src=replace_tags(elname.src,'\.gif','_over.gif');
}
else {
  elname.src=replace_tags(elname.src,'_over.gif','\.gif');
}
}


function change_image(elname, srcname) {
if (srcname=='1') {
  elname.src=replace_tags(elname.src,'\.gif','_over.gif');
}
else {
  elname.src=replace_tags(elname.src,'_over.gif','\.gif');
}
}

function NewWindow(w,v,s,d)
{
var w_top=screen.height/2;
var w_left=screen.width/2;
if(s>0)
{
w_top=w_top-s/2;
}
if(d>0)
{
w_left=w_left-d/2;
}
eval("window.open('"+v+"','"+w+"','height="+s+",width="+d+",top="+w_top+",left="+w_left+"status=no,location=no,toolbar=no,directories=no,menubar=no,scrollbars=0');");
} 



dropList = function() {
navRoot = document.getElementById("nav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
  if (node.nodeName=="LI"){
    node.onmouseover=function(){
      this.className=this.className.replace("mm-out", "mm-hover");
    }
    node.onmouseout=function(){
      this.className=this.className.replace("mm-hover", "mm-out");
    }
   }
  }
}

//window.onload = dropList;

$(document).ready(function(){

  $('li','#nav').each(function(){
    if(!$(this).is('.active')){
      var parent = this;
     $('a',this).mouseover(function(){
        $('img',parent).css('background-position','left top');
      }).mouseout(function(){
        $('img',parent).css('background-position','right top');
      });
    }
  });
  
});




function insertVideo(videopath){
  var video = '<object type="application/x-shockwave-flash" data="/swf/uflvplayer.swf" width="320" height="240">'
  +'<param name="bgcolor" value="#000000">'
  +'<param name="allowFullScreen" value="true">'
  +'<param name="allowScriptAccess" value="always">'
  +'<param name="movie" value="/swf/uflvplayer.swf">'
  +'<param name="FlashVars" value="way='+videopath+'">'
  +'Установите <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash-плеер</a>'
  +'</object>';
  document.write(video);
}
