// Load main design image in cashe memory for better visualisation of site  (not work in opera)
image1 = new Image();
image1.src = "../images/background.jpg";
image2 = new Image();
image2.src = "../images/sky.jpg";
image3 = new Image();
image3.src = "../images/house-top.jpg";
image4 = new Image();
image4.src = "../images/house.jpg";
image5 = new Image();
image5.src = "../images/second-nav.jpg";
image6 = new Image();
image6.src = "../images/second-nav-acurrent.jpg";
image7 = new Image();
image7.src = "../images/second-nav-a-hover.jpg";
image8 = new Image();
image8.src = "../images/second-nav-a.jpg";
image9 = new Image();
image9.src = "../images/second-nav-acurrent-hover.jpg";
image10 = new Image();
image10.src = "../images/dbg.jpg";
image11 = new Image();
image11.src = "../images/footer.jpg";
image12 = new Image();
image12.src = "../images/nav-ahover.gif";
image13 = new Image();
image13.src = "../images/nav-a.gif";
image14 = new Image();
image14.src = "../images/arrow-navhover.gif";
image15 = new Image();
image15.src = "../images/arrow-subnavhover.gif";
image16 = new Image();
image16.src = "../images/footer-image.jpg";
image17 = new Image();
image17.src = "../images/arrow-subnav.gif";
image18 = new Image();
image18.src = "../images/arrow-nav.gif";
image19 = new Image();
image19.src = "../images/dotbackground.gif";
image20 = new Image();
image20.src = "../images/nav-sublevel-fon.jpg";
image21 = new Image();
image21.src = "../images/nav-current-ahover.gif";
image22 = new Image();
image22.src = "../images/nav-current-a.gif";
image23 = new Image();
image23.src = "../images/nav3-current-ahover.gif";
image24 = new Image();
image24.src = "../images/sublevel.gif";
image25 = new Image();
image25.src = "../images/totop.gif";
image26 = new Image();
image26.src = "../images/sublevel-a-fon.gif";
image27 = new Image();
image27.src = "../images/icon-news.gif";


// POP-UP OPENER
function MM_openBrWindow(theURL,winName,features, path) { //v2.0

  window.open(theURL,winName,features);
}

function openBrWindow(theURL,winName, width, height) { //v2.0
    sWidth = screen.width;
    sHeight = screen.Height;

    features = "width="+width+",height="+height+",scrollbars=0, status=0"+",left="+(sWidth-width)/2+",top="+(sHeight-height)/2;
    window.open(theURL,winName,features);
}

// TABLE ROLLOVER (news section)
function tableruler(){
 if (document.getElementById && document.createTextNode){
   var tables=document.getElementsByTagName ('table'); 
   for (var i=0;i<tables.length;i++){
    if(tables[i].className=='data'){
     var trs=tables[i].getElementsByTagName('tr'); clName='';
     for(var j=0;j<trs.length;j++){
      if(trs[j].parentNode.nodeName=='TBODY' && trs[j].parentNode.nodeName!='TFOOT'){
       trs[j].onmouseover=function(){clName = this.className; this.className='ruled';return false}
       trs[j].onmouseout=function(){this.className=clName;return false}
     }
    }
   }
  }
 }
}
window.onload=function(){
    tableruler();
} 

// SHOW /  HIDE NAVIGATION SUBLAYER

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

// DIFFERENT CSS FILES FOR DIFFERENT SCREEN RESOLUTION */

if (screen.width<=800)
{
     document.write('<link href=800.css rel=stylesheet type=text/css />');
}
else if (screen.width<=1024)
{
     document.write('<link href=1024.css rel=stylesheet type=text/css />');
}
else if (screen.width<=1152)
{
     document.write('<link href=1152.css rel=stylesheet type=text/css />');
}
else if (screen.width<=1280)
{
     document.write('<link href=1280.css rel=stylesheet type=text/css />');
}
else
{
     document.write('<link href=over1280.css rel=stylesheet type=text/css />');
}


// SIFR - FLASH TEXT
//  sIFR (Scalable Inman Flash Replacement) Version 2.0 Release Candidate 3
//  Copyright 2004 Mike Davidson, Shaun Inman, Tomas Jogin and Mark Wubben
//  This software is licensed under the CC-GNU LGPL <http://creativecommons.org/licenses/LGPL/2.1/>


var hasFlash=function(){
    var a=6;
    if(navigator.appVersion.indexOf("MSIE")!=-1&&navigator.appVersion.indexOf("Windows")>-1){
        document.write('<script language="VBScript"\> \n');
        document.write('on error resume next \n');
        document.write('hasFlash = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & '+a+'))) \n');
        document.write('</script\> \n');
        if(window.hasFlash!=null){  return window.hasFlash;};
    };
    if(navigator.mimeTypes&&navigator.mimeTypes["application/x-shockwave-flash"]&&navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){
        var b=(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]).description;
        var c=parseInt(b.charAt(b.indexOf(".")-1));
        return c>=a;
    };
    return false;
}();
String.prototype.normalize=function(){
    return this.replace(/\s+/g," ");
};
    
if(Array.prototype.push==null){
    Array.prototype.push=function(){
        for(var i=0;i<arguments.length;i++){
            this[this.length]=arguments[i];
        };
        return this.length;
    };
};

if(!Function.prototype.apply){
    Function.prototype.apply=function(d,e){
        var a=[];
        var b,c;
        if(!d)d=window;
        if(!e)e=[];
        for(var i=0;i<e.length;i++){a[i]="e["+i+"]";};c="d.__applyTemp__("+a.join(",")+");";d.__applyTemp__=this;b=eval(c);d.__applyTemp__=null;return b;};
    };
    var parseSelector=function(){
        var a=/^([^#\.>\`]*)(#|\.|\>|\`)(.+)$/;
        function parseSelector(b,c,d){
            b=b.replace(" ","`");
            var e=b.match(a);
            var f,g,h,j;
            var k=[];
            if(e==null){e=[b,b]};
            if(e[1]==""){   e[1]="*"};
            if(d==null){d="`"};
            if(c==null&&(e[2]==null||e[2]!=">")){   c=document;};
            switch(e[2]){
                case "#":j=e[3].match(a);
                if(j==null){    j=[null,e[3]]};f=document.getElementById(j[1]);
                if(f==null||(e[1]!="*"&&f.nodeName.toLowerCase()!=e[1].toLowerCase())){return k;};
                if(j.length==2){k.push(f);return k;};   
                return parseSelector(j[3],f,"#");
                case ".":if(d=="`"){g=l(c,e[1]);}
                else{g=c.childNodes;};
                for(var i=0;i<g.length;i++){
                    f=g[i];
                    if(f.nodeType!=1){continue;};
                    j=e[3].match(a);
                    if(j!=null){
                        if(f.className.match("\\b"+j[1]+"\\b")==null){continue;};h=parseSelector(j[3],f,j[2]);k=k.concat(h);
                    }
                    else if(f.className.match("\\b"+e[3]+"\\b")!=null){k.push(f);};
                };
                return k;
                case ">":if(d=="`"){g=l(c,e[1]);}
                else{g=c.childNodes;};
                for(var i=0;i<g.length;i++){
                    f=g[i];
                    if(f.nodeType!=1){continue;};
                    if(f.nodeName.toLowerCase()!=e[1].toLowerCase()){continue;};    h=parseSelector(e[3],f,">");k=k.concat(h);
                };
                return k;
                case "`":g=l(c,e[1]);
                for(var i=0;i<g.length;i++){f=g[i];h=parseSelector(e[3],f,"`");k=k.concat(h);};
                return k;
                default:g=l(c,e[0]);
                for(var i=0;i<g.length;i++){k.push(g[i]);};
                return k;
            };
        };
        function l(c,m){
            if(m=="*"&&c.all!=null){return c.all;};
            return c.getElementsByTagName(m);
        };
        return parseSelector;
    }();
    function named(oArgs){
        return new named.Arguments(oArgs);
    };
named.Arguments=function named_Arguments(oArgs){
    this.oArgs=oArgs;
};
named.Arguments.prototype.constructor=named.Arguments;
named.extract=function named_extract(a,b){
    var c,d;
    for(var i=0;i<a.length;i++){
        d=a[i];
        if(d!=null&&d.constructor!=null&&d.constructor==named.Arguments){c=a[i].oArgs;break;};
    };
    if(c==null){return};
    for(var e in c){
        if(b[e]!=null){b[e](c[e]);};
    };
    return;
};

var sIFR=function(){
    if(window.hasFlash==false||!document.createElement||!document.getElementById){return false;};
    var a="http://www.w3.org/1999/xhtml";
    var b=false;
    var c=false;var d=[];
    var UA=function(){
        var sUA=navigator.userAgent.toLowerCase();
        var e={bIsWebKit:sUA.indexOf("applewebkit")>-1,bIsKHTML:sUA.indexOf("applewebkit")>-1||sUA.indexOf("konqueror")>-1,bIsOpera:sUA.indexOf("opera")>-1,bIsXML:document.contentType!=null&&document.contentType.indexOf("xml")>-1,bHasTransparentSupport:true};
        e.bIsIE=sUA.indexOf("msie")>-1&&!e.bIsOpera&&!e.bIsKHTML&&!e.bIsGecko;
        e.bIsGecko=!e.bIsKHTML&&navigator.product!=null&&navigator.product.toLowerCase()=="gecko";
        if(e.bIsOpera){e.nOperaVersion=new Number(sUA.match(/.*opera(\s|\/)(\d+\.\d+)/)[2])};
        if(e.bIsGecko){e.nGeckoBuildDate=new Number(sUA.match(/.*gecko\/(\d{8}).*/)[1])};
        if(e.bIsWebKit){e.nWebKitVersion=new Number(sUA.match(/.*applewebkit\/(\d+).*/)[1])};
        if(sUA.match(/.*(windows|mac).*/)==null||(e.bIsOpera==true&&e.nOperaVersion<7.6)||(e.bIsWebKit==true&&e.nWebKitVersion<124)||(e.bIsGecko==true&&e.nGeckoBuildDate<20020523)){
            e.bHasTransparentSupport=false;
        };
        return e;
    }();
    function sIFR(e){
        if((!self.bAutoInit&&(window.event||e)!=null)||!f(e)){return;};b=true;
        for(var i=0;i<d.length;i++){replaceElement.apply(null,d[i]);};d=[];
    };
    var self=sIFR;
    
    function f(e){
        if(c==false||((UA.bIsXML&&UA.bIsGecko||UA.bIsKHTML)&&e==null&&b==false)||document.getElementsByTagName("body").length==0){return false;};return true;
    };
    
    function g(h,j,k,l,m){
        var n="";
        var o=h.firstChild;
        var p,q,r;
        if(l==null){l=0};
        if(m==null){m=""};
        while(o){
            if(o.nodeType==3){
                switch(k){
                    case "lower":n+=o.nodeValue.toLowerCase();
                    break;
                    case "upper":n+=o.nodeValue.toUpperCase();
                    break;
                    default:n+=o.nodeValue;
                };
            }
            else if(o.nodeType==1){
                if(o.nodeName.toLowerCase()=="a"&&!o.getAttribute("href")==false){
                    if(o.getAttribute("target")){m+="&sifr_url_"+l+"_target="+o.getAttribute("target");};
                    m+="&sifr_url_"+l+"="+o.getAttribute("href").replace(/&/g,"%26");
                    n+='<a href="asfunction:_root.launchURL,'+l+'">';
                    l++;
                }
                else if(o.nodeName.toLowerCase()=="br"){n+="<br/>";};
                if(o.hasChildNodes){r=g(o,null,k,l,m);n+=r.n;l=r.l;m=r.m;};
                if(o.nodeName.toLowerCase()=="a"){n+="</a>";};
            };
            p=o;
            o=o.nextSibling;
            if(j!=null){q=p.parentNode.removeChild(p);j.appendChild(q);};
        };
        return{"n":n,"l":l,"m":m};
    };
    
    function s(t){
        if(document.createElementNS&&!UA.bIsOpera){
            return document.createElementNS(a,t);
        }
        else{return document.createElement(t);};
    };
    
    function u(v,w,x){
        var node=s("param");
        node.setAttribute("name",w);
        node.setAttribute("value",x);
        v.appendChild(node);
    };
    
    function replaceElement(y,z,aa,ab,ac,ad,ae,af,ag,ah,ai,k,aj){
        if(!f()){return d.push(arguments);};
        named.extract(arguments,{sSelector:function(value){y=value},sFlashSrc:function(value){z=value},sColor:function(value){aa=value},sLinkColor:function(value){ab=value},sHoverColor:function(value){ac=value},sBgColor:function(value){ad=value},nPaddingTop:function(value){ae=value},nPaddingRight:function(value){af=value},nPaddingBottom:function(value){ag=value},nPaddingLeft:function(value){ah=value},sFlashVars:function(value){ai=value},sCase:function(value){k=value},sWmode:function(value){aj=value}});
        if(ai!=null){ai="&"+ai.normalize();}
        else{ai="";};
        if(ae==null){ae=0};
        if(af==null){af=0};
        if(ag==null){ag=0};
        if(ah==null){ah=0};
        if(aj=="transparent"){
            if(!UA.bHasTransparentSupport){aj="opaque";}
            else{ad="transparent";};
        };
        if(aj==null){aj=""};
        var ak,al,am,an,ao,ap,aq,ar;var as=parseSelector(y);
        if(as.length==0){return false};
        for(var i=0;i<as.length;i++){
            ak=as[i];
            if(ak.className.match(/\bsIFR\-replaced\b/)!=null){continue;};
            al=ak.offsetWidth-ah-af;
            am=ak.offsetHeight-ae-ag;
            ap=s("span");
            ap.className="sIFR-alternate";
            ar=g(ak,ap,k);
            an=ar.n;
            if(UA.bIsIE){
                an=an.replace(new RegExp("%\d{0}","g"),"%25");
            }
            else{
                an=an.replace(new RegExp("%(?!\d)","g"),"%25");
            };
            an=an.replace(/\+/g,"%2B");
            an=an.replace(/&/g,"%26");
            an=an.replace(/\"/g, "%22");
            an=an.normalize();
            ao="txt="+an+ai+"&w="+al+"&h="+am+ar.m;
            if(aa!=null){ao+="&textcolor="+aa};
            if(ab!=null){ao+="&linkcolor="+ab};
            if(ac!=null){ao+="&hovercolor="+ac};
            ak.className=ak.className.normalize()+(ak.className==""?"":" ")+"sIFR-replaced";
            if(UA.bIsOpera){
                if(UA.nOperaVersion<7.60){
                    ak.innerHTML=['<object class="sIFR-flash" type="application/x-shockwave-flash" data="',z,'" quality="best" wmode="',aj,'" bgcolor="',ad,'" flashvars="',ao,'" width="',al,'" height="',am,'"></object>'].join("");
                }
                else{
                    aq=s("object");aq.setAttribute("type","application/x-shockwave-flash");aq.setAttribute("data",z);u(aq,"quality","best");u(aq,"wmode",aj);u(aq,"bgcolor",ad);u(aq,"flashvars",ao);
                };
            }
            else{
                aq=s("embed");aq.setAttribute("src",z);aq.setAttribute("quality","best");aq.setAttribute("flashvars",ao);aq.setAttribute("type","application/x-shockwave-flash");aq.setAttribute("wmode",aj);aq.setAttribute("bgcolor",ad);
            };
            if(!UA.bIsOpera||UA.nOperaVersion>=7.60){
                aq.className="sIFR-flash";aq.setAttribute("width",al);aq.setAttribute("height",am);aq.style.width=al+"px";aq.style.height=am+"px";ak.appendChild(aq);
            };
            ak.appendChild(ap);
            if(UA.bIsKHTML||UA.bIsIE){
                ak.innerHTML+="";
            };
        };
    };
    
    function setup(){
        c=true;
        if(document.documentElement){
            document.documentElement.className=document.documentElement.className.normalize()+(document.documentElement.className==""?"":" ")+"sIFR-hasFlash";
        };
        if(window.attachEvent){
            window.attachEvent("onload",sIFR);
        } 
        else if(document.addEventListener||window.addEventListener){
                if(document.addEventListener){
                    document.addEventListener("load",sIFR,false);
                };
                if(window.addEventListener){
                    window.addEventListener("load",sIFR,false);
                };
            }
            else{
                if(typeof window.onload=="function"){
                    var fOld=window.onload;window.onload=function(){fOld();sIFR();
                };
            }
            else{window.onload=sIFR;}
        ;}
    ;};
    self.UA=UA;self.bAutoInit=true;self.replaceElement=replaceElement;self.setup=setup;return self;
}();

if(sIFR != false){
    sIFR.setup();
};
