var imgbar_state=0,imgbar_savedheight=0,imgbar_savedwidth=0,imgbar_savedlogopos=0,imgbar_hlogo=52,imgbar_ylogo=4,imgbar_ytext=12,imgbar_slidesteps=15;wrapper_savedwidth=0;photo_savedwidth=0;photocaption_savedwidth=0;caption_calc=0;

function nextRandomImageBar(){
    document.getElementById("shg_imagebar").style.backgroundImage="url("+shg_rootpath+"virtual_tour/"+shg_imagebars[Math.floor(Math.random()*(shg_imagebars.length-1+0.5))]+"imagebar.jpg)"
    InitializeTimer()
}

function getWindowHeight(){
    var a=0;
    if(typeof window.innerHeight=="number")a=window.innerHeight;
    else if(document.documentElement&&document.documentElement.clientHeight)a=document.documentElement.clientHeight;
    else if(document.body&&document.body.clientHeight)a=document.body.clientHeight;
    return a
}

function oc(a){
    for(var b={},c=0;c<a.length;c++)b[a[c]]="";
    return b
}

function showFlash(){
    StopTheClock()
    
    var a=String(document.getElementById("shg_imagebar").style.backgroundImage),b=a.indexOf("virtual_tour/")+13,c=a.indexOf("imagebar.jpg");
    
    a=a.slice(b,c);
    a='<iframe id="iframeview" src="'+(shg_rootpath+"index.php?target=virtual_tour/"+(a+"demo.html")+"&shglogo=false")+'" name="Bildframe'+a+'" width="100%" height="100%" scrolling="no" marginheight="0" marginwidth="0" frameborder="0" style="z-Index:101"><p style="padding:10%;"></iframe>';
    document.getElementById("shg_imagebar").innerHTML=a
}

function hideFlash(){
    InitializeTimer()
    document.getElementById("shg_imagebar").innerHTML=""
}

function imgbar_getspace(){
    var a=getWindowHeight(),b=document.getElementById("shg_imagebar").offsetTop,c=imgbar_hlogo+imgbar_ylogo;
    if(c<16)c=16;
    a=a*0.8;
//    a=a-b-c;
//    a=a-b;
    if(a<imgbar_savedheight)a=imgbar_savedheight;
    return a
}

function incHeightImageBar(){
    if(imgbar_state==0){
        imgbar_state=1;
        wrapper_savedwidth=document.getElementById("wrapper").offsetWidth;
        photo_savedwidth=document.getElementById("photo_on_header_go").offsetWidth - 40; // 40 is the defined padding in the css
        photocaption_savedwidth=document.getElementById("photo_on_header_caption").offsetWidth;
        imgbar_savedheight=document.getElementById("shg_imagebar").offsetHeight;
        imgbar_savedwidth=document.getElementById("shg_imagebar").offsetWidth;
        document.getElementById("top").style.display="none"; 
        document.getElementById("breadcrumb").style.display="none";
        document.getElementById("head_menu_subline").style.display="none"; 
        document.getElementById("shg_showpano").style.display="none";
        document.getElementById("middle_content").style.display="none";
        document.getElementById("left").style.display="none";
        document.getElementById("footer").style.display="none";
        document.getElementById("wrapper").style.width=90+"%";    
        document.getElementById("photo_on_header_go").style.width=95+"%";
        caption_calc=document.getElementById("photo_on_header_go").offsetWidth;
        document.getElementById("photo_on_header_go").style.width=(caption_calc-40)+"px";
        document.getElementById("photo_on_header_caption").style.width=caption_calc+"px";
        imgbar_savedlogopos=document.getElementById("shg_imagebar").offsetTop+imgbar_savedheight-document.getElementById("shg_logo").offsetTop
    }
    var a=document.getElementById("shg_imagebar").offsetTop,b=imgbar_getspace(),c=parseInt(document.getElementById("shg_imagebar").offsetHeight,10),d=b/imgbar_slidesteps;
    if(c<b){
        c+=d;
        if(c>b)c=b;         
        document.getElementById("photo_on_header_go").style.height=c+"px";
        document.getElementById("shg_imagebar").style.height=c+"px";
        document.getElementById("shg_imagebar").style.width=100+"%";
//        document.getElementById("shg_imagebar").style.position="relative";
//        document.getElementById("shg_imagebar").style.width=90+"%";
//        document.getElementById("shg_imagebar").style.clear="both";
//        document.getElementById("shg_imagebar").style.left="-"+50+"%";
//        document.getElementById("shg_logo").style.top=a+c+imgbar_ylogo+"px";
        if(c>=b){
//            document.getElementById("shg_hidepano").style.top=a+c+imgbar_ytext+"px";
            document.getElementById("shg_hidepano").style.display="inline";  
            imgbar_state=2;setTimeout("showFlash()",1)
        } else setTimeout("incHeightImageBar()",1)
    } else {
        c+=d;         
        if(c>b)c=b;         
        document.getElementById("shg_imagebar").style.height=c+"px";
        document.getElementById("shg_imagebar").style.width=100+"%";
        document.getElementById("photo_on_header_go").style.height=c+"px";
//        document.getElementById("shg_logo").style.top=a+c+imgbar_ylogo+"px";
        if(c>=b){
//            document.getElementById("shg_hidepano").style.top=a+c+imgbar_ytext+"px";
            document.getElementById("shg_hidepano").style.display="inline";  
            imgbar_state=2;setTimeout("showFlash()",1)
        } else setTimeout("incHeightImageBar()",1)
    }
}

function decHeightImageBar(){
    if(imgbar_state==2){
        imgbar_state=1;
        hideFlash();
        document.getElementById("shg_hidepano").style.display="none"
    }
    var a=document.getElementById("shg_imagebar").offsetTop,b=imgbar_getspace(),c=parseInt(document.getElementById("shg_imagebar").offsetHeight,10);
    b=b/imgbar_slidesteps;
    if(c>imgbar_savedheight){
        c-=b;
        if(c<imgbar_savedheight+1)c=imgbar_savedheight;
        document.getElementById("wrapper").style.width=wrapper_savedwidth+"px"; 
        document.getElementById("shg_imagebar").style.height=c+"px";
        document.getElementById("photo_on_header_go").style.width=photo_savedwidth+"px";
        document.getElementById("photo_on_header_caption").style.width=photocaption_savedwidth+"px";
        document.getElementById("photo_on_header_go").style.height=c+"px";
        document.getElementById("shg_imagebar").style.position="static";
        document.getElementById("shg_imagebar").style.width=imgbar_savedwidth+"px";
        document.getElementById("shg_logo").style.top=a+c-imgbar_savedlogopos+"px";
        if(c-imgbar_savedheight<1){
            document.getElementById("shg_showpano").style.display="inline"; 
//            document.getElementById("shg_showpano").style.display="inline";
            document.getElementById("top").style.display="inline";
            document.getElementById("breadcrumb").style.display="inherit";
            document.getElementById("head_menu_subline").style.display="inline";
            document.getElementById("middle_content").style.display="inline";
            document.getElementById("left").style.display="inline";
            document.getElementById("footer").style.display="inline";
            imgbar_state=0
        } else setTimeout("decHeightImageBar()",1)
    }
}

function showImagebarPano(){
    imgbar_state==0&&incHeightImageBar()
}

function hideImagebarPano(){
    imgbar_state==2&&decHeightImageBar()
}

function resizeImagebarpano(){
    if(imgbar_state==2){
        var a=document.getElementById("shg_imagebar").offsetTop,b=imgbar_getspace();
        document.getElementById("shg_imagebar").style.height=b+"px";
        document.getElementById("shg_logo").style.top=a+b+imgbar_ylogo+"px";
        document.getElementById("shg_hidepano").style.top=a+b+imgbar_ytext+"px";
        if(document.getElementById("iframeview"))document.getElementById("iframeview").style.height=b+"px"
    }
    return true
}

var imagebar_touch_x=0,imagebar_touch_y=0;

function imagebar_onTouchStart(a){
    a.preventDefault();
    imagebar_touch_x=a.changedTouches[0].pageX;
    imagebar_touch_y=a.changedTouches[0].pageY
}

function imagebar_onTouchMove(a){
    a.preventDefault()
}

function imagebar_onTouchEnd(a){
    var b=a.changedTouches[0].pageX-imagebar_touch_x;
    if(a.changedTouches[0].pageY-imagebar_touch_y>100){
        a.preventDefault();
        showImagebarPano()
    } else if(b<-100||b>100){
        a.preventDefault();
        nextRandomImageBar()
    }
}

function touch_inits(){
    var a=navigator.platform.toLowerCase();
    if(a.indexOf("iphone")>=0||a.indexOf("ipod")>=0||a.indexOf("ipad")>=0)try{
        var b=document.getElementById("shg_imagebar");
        if(b){
            b.addEventListener("touchstart",imagebar_onTouchStart,true);
            b.addEventListener("touchmove",imagebar_onTouchMove,true);
            b.addEventListener("touchend",imagebar_onTouchEnd,true)
        }
    }
    catch(c){}
}
window.onload=touch_inits;
window.onresize=resizeImagebarpano;

var df,rf=false,na=navigator.userAgent,dt=document,op=(na.indexOf('Opera')!=-1),dm=(dt.getElementById)?true:false,ie5x=(dt.all&&dm),mci=(na.indexOf('Mac')!=-1);
df=((ie5x||op)&&mci);
shg_decide();
function shg_decide(){if(df){return;}else{rf=true;}}
if(rf){
function shg_initADP(){bdf=0;
// *** Begin advanced user scripting area ***
   htmlstring=""
   new shgadp("tooltips",htmlstring,"");
// *** End advanced user scripting area ***
}
if(window.attachEvent){window.attachEvent('onload', shg_initADP);}
else
{if(typeof window.onload == 'function'){
    var preADP = window.onload;
    window.onload = function(){preADP();
    shg_initADP();}}
    else{window.onload = shg_initADP;}}
}


var df,rf=false,na=navigator.userAgent,dt=document,op=(na.indexOf('Opera')!=-1),dm=(dt.getElementById)?true:false,ie5x=(dt.all&&dm),mci=(na.indexOf('Mac')!=-1);
df=((ie5x||op)&&mci);
shg_decide();
function shg_decide(){if(df){return;}else{rf=true;}}
if(rf){
var drs=0,moving=0,resizing=0,shf,dsh,bdf=0,sht=0,slt=0,ba5=0,pla,nd9,absl=1,ism3=0;
var fia=0,foa=100,fis=15,fii=2,fos=5,foi=2,ddp=0,bp3=0,dis=15,sis=10,sp7=0,fp5=0,fo4=0,tid1,tid2,tid3,tid4,isc,cth,ctw;
var lhg=0,dmt=document,nbl='none',ibl='block',nvi='hidden',ivi='visible',sct,isScri,na=navigator.userAgent;

function shg_de7(id){return dmt.getElementById(id)}var w37=(shg_de7)?true:false, mie=(w37 && dmt.all)?true:false, ns=(w37 && !dmt.all)?true:false, op=(na.indexOf('Opera')!=-1);
if(op){var otmp=na.indexOf("Opera")+6;
opv=parseInt(na.charAt(otmp));
var op9=(opv==9)?true:false;}
if(mie){mtmp=na.split("MSIE");
miv=parseFloat(mtmp[1]);
var ieh=(miv>=5.5)?true:false;
var ie7p=(miv>=7)?true:false;}
window.onerror=function(){return true};
var adpuids=[],adppla=[],adpscr=[],xpos=[],ypos=[],pwidth=[],pheight=[],cpadg=[],bwhg=[],tbwg=[],delX=[],delY=[];
var goex=0,exof=15,adppdel=250;
var bwh=1,bc7="#022f5a",it9=0,tc2="#0F0F0F",tc3="#C0C0C0",ib8="#ffffff";
var is6=1,shs=3,sc5="",ir9=0,cc6=0,im5=0,cnm=0;
var oo7=0,issp=0,plt=0;
var isScr=0,pla=0,bng=0;
adpx=50;
adpy=50;
adpw=300;
adph=40;
isex=0;
var MovexDiff=0,MoveyDiff=0,ResizexDiff=0,ResizeyDiff=0,z_index=10000,Mousex=0,Mousey=0;

function shg_miebody(){return (dmt.compatMode && dmt.compatMode=="CSS1Compat")? dmt.documentElement:dmt.body}if(dmt.compatMode=='CSS1Compat')sct=true;
else sct=false;

function shg_soh(id,bon,voh){if(ush)shg_de7(id+'_ash').style.display=bon;
shg_de7(id+'_adpB').style.display=bon;
if(is6)shg_de7(id+'_adpS').style.display=bon;
if(ir9)shg_de7(id+'_rsize').style.display=bon;
shg_de7(id+'_close').style.display=bon;
shg_de7(id+'_adpC').style.display=bon;
shg_de7(id+'_adpT').style.display=bon;
shg_de7(id+'_adpB').style.visibility=voh;
if(is6)shg_de7(id+'_adpS').style.visibility=voh;
if(ir9)shg_de7(id+'_rsize').style.visibility=voh;
shg_de7(id+'_close').style.visibility=voh;
shg_de7(id+'_adpC').style.visibility=voh;
shg_de7(id+'_adpT').style.visibility=voh;}

function shgadpHide(id){clearTimeout(dsh);
clearTimeout(tid3);
clearTimeout(tid4);
if(typeof adpOnHide!='undefined')adpOnHide(id);
shg_soh(id,nbl,nvi);}

function shg_adpShow(id){if(absl&&!drs&&!ism3)setTimeout("shg_adpLocation('"+id+"',xpos['"+id+"'],ypos['"+id+"'])",150);
dsh=setTimeout("shg_soh('"+id+"',ibl,ivi)",250);
if(mie){shg_de7(id+'_adpB').style.filter= "alpha(opacity=100)";
if(!op)shg_de7(id+'_adpB').style.removeAttribute('filter');
shg_de7(id+'_adpS').style.filter="alpha(opacity=30)";}
else{shg_de7(id+'_adpB').style.MozOpacity=1;shg_de7(id+'_adpS').style.MozOpacity=0.3;}}

function shg_gsp(){sht=(mie)?shg_miebody().scrollTop:window.pageYOffset;
slt=(mie)?shg_miebody().scrollLeft:window.pageXOffset;
return sht,slt;}

function shg_adpLocation(id,x,y,m,evt){ism3=m;xpos[id]=x;ypos[id]=y;
if(m){Mousex=(mie)?event.clientX+shg_miebody().scrollLeft:evt.pageX;
Mousey=(mie)?event.clientY+shg_miebody().scrollTop:evt.pageY;
x=x+Mousex;
y=y+Mousey;
xpos[id]=x;
ypos[id]=y;}
else{shg_gsp();
if(mie&&(!ie7p||!sct)&&!op||isScr==0){x+=slt;
y+=sht;}}
shg_de7(id+'_adpS').style.left=(x+shs)+'px';
shg_de7(id+'_adpS').style.top=(y+shs)+'px';
shg_de7(id+'_adpB').style.left=x+'px';
shg_de7(id+'_adpB').style.top=y+'px';
if(ush)shg_de7(id+'_ash').style.top=y+'px';
if(ush)shg_de7(id+'_ash').style.left=x+'px';}

function shg_addRszEv(f){var pre=window.onresize;
if (typeof window.onresize!='function'){window.onresize = f;}
else{window.onresize=function(){if(pre){pre();}f();}}}

function shg_addScrEv(f){var pre=window.onscroll;
if (typeof window.onscroll!='function'){window.onscroll = f;}
else{window.onscroll=function(){if(pre){pre();}
f();}}}

function shg_adpDropin(id){var tod;
drs=1;
clearInterval(ddp);
if(tod)clearTimeout(tod);
tod=setTimeout("shg_indl('"+ id + "')",200);}

function shg_indl(id){var oa=pheight[id]+(2*bwhg[id]+2*tbwg[id]);
nd9=0;
ba5=40;
ddp=setInterval("shg_dropdown('"+ id +"','"+ oa +"')",dis);}

function shg_dropdown(id,oa){clearInterval(bp3);
var iess=(mie&&(!ie7p||!sct)&&!op||isScr==0);
shg_gsp();
if(nd9==0){var delta=ypos[id]-10*Math.floor(ypos[id]/10);
if(ush)shg_de7(id+'_ash').style.top=((iess)?sht:0)-100-delta-(10*Math.round(parseInt(oa)/10))+'px';
shg_de7(id+'_adpB').style.top=((iess)?sht:0)-100+delta-(10*Math.round(parseInt(oa)/10))+'px';
shg_de7(id+'_adpS').style.top=((iess)?sht:0)-100+delta-(10*Math.round(parseInt(oa)/10))+shs+'px';
nd9+=1;}
if(parseInt(shg_de7(id+'_adpB').style.top)<ypos[id]+delY[id]+((iess)?sht:0)){if(ush)shg_de7(id+'_ash').style.top=parseInt(shg_de7(id+'_adpB').style.top)+10+'px';
shg_de7(id+'_adpB').style.top=parseInt(shg_de7(id+'_adpB').style.top)+10+'px';
shg_de7(id+'_adpS').style.top=parseInt(shg_de7(id+'_adpS').style.top)+10+'px';
if(ush)shg_de7(id+'_ash').style.left=xpos[id]+delX[id]+'px';
shg_de7(id+'_adpB').style.left=xpos[id]+delX[id]+'px';
shg_de7(id+'_adpS').style.left=xpos[id]+delX[id]+shs+'px';}
else{drs=2;
clearInterval(ddp);
if(bng){bp3=setInterval("shg_bouncedown('"+ id +"')",50);}
else{if(isScr)adpScroll(id,pla,1);}}}

function shg_bouncedown(id){if(ush)shg_de7(id+'_ash').style.top=parseInt(shg_de7(id+'_adpB').style.top)-ba5+'px';
shg_de7(id+'_adpB').style.top=parseInt(shg_de7(id+'_adpB').style.top)-ba5+'px';
shg_de7(id+'_adpS').style.top=parseInt(shg_de7(id+'_adpS').style.top)-ba5+'px';
if(ba5<0) ba5+=10;
ba5=ba5*-1;
if(ba5==0){clearInterval(bp3);
if(isScr)adpScroll(id,pla,1);}}

function shg_adpSlidein(id){var tos;
drs=1;
clearInterval(sp7);
if(tos)clearTimeout(tos);
tos=setTimeout("shg_slin('"+ id + "')",200);}

function shg_adpSlideout(id){var tos;
drs=1;
clearInterval(sp7);
if(tos)clearTimeout(tos);
tos=setTimeout("shg_slout('"+ id + "')",200);}

function shg_adpSlideup(id){var tos;
drs=1;
clearInterval(sp7);
if(tos)clearTimeout(tos);
tos=setTimeout("shg_slup('"+ id + "')",200);}

function shg_slin(id){var delta=xpos[id]-10*Math.floor(xpos[id]/10);
var oa=-10*Math.round((pwidth[id]+(2*bwhg[id]+2*tbwg[id]))/10)+delta;
if(ush)shg_de7(id+'_ash').style.left=(oa-100)+'px';
shg_de7(id+'_adpB').style.left=(oa-100)+'px';
shg_de7(id+'_adpS').style.left=(oa-100+shs)+'px';
sp7=setInterval("shg_slide('"+ id +"',1)",sis);}

function shg_slout(id){shg_wh5();
sp7=setInterval("shg_slide('"+ id +"',2)",sis);}

function shg_slup(id){shg_wh5();
shg_gsp();
var iess=(mie&&(!ie7p||!sct)&&!op||isScr==0);
var delta=ypos[id]-10*Math.floor(ypos[id]/10);
var oa=pht+pheight[id]+(2*bwhg[id]+2*tbwg[id]);
if(ush)shg_de7(id+'_ash').style.top=(oa-100)+'px';
shg_de7(id+'_adpB').style.top=((iess)?sht:0)+100+delta+(10*Math.round(parseInt(oa)/10))+'px';
shg_de7(id+'_adpS').style.top=((iess)?sht:0)+100+delta+(10*Math.round(parseInt(oa)/10))+shs+'px';
sp7=setInterval("shg_slide('"+ id +"',3)",sis);}

function shg_slide(id,n){shg_gsp();
var iess=(mie&&(!ie7p||!sct)&&!op||isScr==0);
var lim;
if(n==1)lim=xpos[id]+slt+delX[id]-10;
if(n==2)lim=pwh+100;
if(n==3)lim=ypos[id]+((iess)?sht:0)+delY[id];
if(n==1 || n==2){if(parseInt(shg_de7(id+'_adpB').style.left)<=lim){if(ush)shg_de7(id+'_ash').style.left=parseInt(shg_de7(id+'_adpB').style.left)+10+'px';
shg_de7(id+'_adpB').style.left=parseInt(shg_de7(id+'_adpB').style.left)+10+'px';
shg_de7(id+'_adpS').style.left=parseInt(shg_de7(id+'_adpS').style.left)+10+'px';
if(ush)shg_de7(id+'_ash').style.top=(iess)?sht:0+ypos[id]+delY[id]+'px';
shg_de7(id+'_adpB').style.top=((iess)?sht:0)+ypos[id]+delY[id]+'px';
shg_de7(id+'_adpS').style.top=((iess)?sht:0)+ypos[id]+delY[id]+shs+'px';}
else{drs=2;
if(isScr)adpScroll(id,pla,1);
clearInterval(sp7);   
if(n==2){shgadpHide(id);
shg_de7(id+'_adpB').style.left=xpos[id]+'px';
shg_de7(id+'_adpS').style.left=xpos[id]+shs+'px';}}}
if(n==3){if(parseInt(shg_de7(id+'_adpB').style.top)>lim){if(ush)shg_de7(id+'_ash').style.top=parseInt(shg_de7(id+'_adpB').style.top)-10+'px';
shg_de7(id+'_adpB').style.top=parseInt(shg_de7(id+'_adpB').style.top)-10+'px';
shg_de7(id+'_adpS').style.top=parseInt(shg_de7(id+'_adpS').style.top)-10+'px';
if(ush)shg_de7(id+'_ash').style.left=xpos[id]+delX[id]+'px';
shg_de7(id+'_adpB').style.left=xpos[id]+delX[id]+'px';
shg_de7(id+'_adpS').style.left=xpos[id]+delX[id]+shs+'px';}
else{drs=2;
if(isScr)adpScroll(id,pla,1);
clearInterval(sp7);}}}

function shg_adpFadein(id){clearInterval(fp5);
clearInterval(fo4);
fia=0;
shg_adpShow(id);
if(mie){shg_de7(id+'_adpB').style.filter= "alpha(opacity=0)";
shg_de7(id+'_adpS').style.filter="alpha(opacity=0)";}
else{shg_de7(id+'_adpB').style.MozOpacity=0;
shg_de7(id+'_adpS').style.MozOpacity=0;}
fp5=setInterval("shg_fadein('"+ id +"')",fis);}

function shg_fadein(id){fia+=fii;
if(fia <=99){if(mie){shg_de7(id+'_adpB').style.filter="alpha(opacity="+fia+")";
shg_de7(id+'_adpS').style.filter="alpha(opacity="+3*fia/10+")";}
else{shg_de7(id+'_adpB').style.MozOpacity=fia/100;
shg_de7(id+'_adpS').style.MozOpacity=3*fia/1000;}}
else{clearInterval(fp5);}}

function shg_adpFadeout(id){clearInterval(fo4);
clearInterval(fp5);
foa=99;
shg_adpShow(id);
if(mie){shg_de7(id+'_adpB').style.filter= "alpha(opacity=100)";
shg_de7(id+'_adpS').style.filter="alpha(opacity=30)";}
else{shg_de7(id+'_adpB').style.MozOpacity=0.99;
shg_de7(id+'_adpS').style.MozOpacity=0.3;}
fo4=setInterval("shg_fadeout('"+ id +"')",fos);}

function shg_fadeout(id){foa -=foi;
if(foa >=1){if(mie){shg_de7(id+'_adpB').style.filter="alpha(opacity="+foa+")";
shg_de7(id+'_adpS').style.filter="alpha(opacity="+3*foa/10+")";}
else{shg_de7(id+'_adpB').style.MozOpacity=foa/100;
shg_de7(id+'_adpS').style.MozOpacity=3*foa/1000;}}
else{shgadpHide(id);
clearInterval(fo4);}}

function shg_adpContent(id,text){shg_de7(id+'_adpC').innerHTML=text;}

function shg_adpTitle(id,tCol,ttCol,tStr){var nT='<span id="'+id+'_shg_adpTitle" style="white-space:nowrap;padding: 1px 0px 0px 3px;width:100%;position:absolute;left:0px;height:20px;">';
nT+=tStr;
nT+="</span>";
shg_de7(id + '_adpT').innerHTML=nT;
shg_de7(id + '_shg_adpTitle').style.color=ttCol;
shg_de7(id + '_shg_adpTitle').style.backgroundColor=tCol;}

function shg_adpSize(id,w,h){if(w<mnw||h<mnh)return;
shg_de7(id+'_adpB').style.width=w+2*bwhg[id]+'px';
shg_de7(id+'_adpB').style.height=h+2*bwhg[id]+'px';
shg_de7(id+'_adpS').style.width=w+2*bwhg[id]+'px';
shg_de7(id+'_adpS').style.height=h+2*bwhg[id]+'px';
shg_de7(id+'_adpT').style.width=w-((!op9&&mie&&!sct)?0:0)+'px';
shg_de7(id+'_adpC').style.width=w-((!op9&&mie&&!sct)?0:2*cpadg[id])+'px';
shg_de7(id+'_adpC').style.height=h-tsp-((!op9&&mie&&!sct)?0:2*cpadg[id])+'px';
if(ir9)shg_de7(id+'_rsize').style.left=w+2*bwhg[id]-9+'px';
if(ir9)shg_de7(id+'_rsize').style.top=h+2*bwhg[id]-9+'px';
shg_de7(id+'_close').style.left=w+bwhg[id]-20+'px';
if(ush)shg_de7(id+'_ash').style.width=w+2*bwhg[id]+shs+'px';
if(ush)shg_de7(id+'_ash').style.height=h+2*bwhg[id]+shs+'px';
pwidth[id]=w;
pheight[id]=h;}

function shg_adpExit(id,e){if(e)isex=1;
else isex=0;}

function shg_wh5(){if(self.innerHeight){pht=self.innerHeight;
pwh=self.innerWidth;}
else if(dmt.documentElement && sct){pht=dmt.documentElement.clientHeight;
pwh=dmt.documentElement.clientWidth;}
else if(document.body){pht=dmt.body.offsetHeight;
pwh=dmt.body.offsetWidth;}}

function shg_adpPlace(id,p,fw){setTimeout("shg_adppl('"+id+"','"+p+"','"+fw+"')",adppdel);}

function shg_adppl(id,p,fw){shg_gsp();
shg_sth(id,p);
if(fw==1)ctw=0;
if(fw==2){ctw=0;
cth=0;}
shg_rsz(id,p,fw);
shg_adpLocation(id,ctw,cth);
xpos[id]=ctw;
ypos[id]=cth;}

function shg_rsz(id,p,fw,e){if(fw!=0){  pwidth[id]=pwh-((mie)?(sct)?0:21:17)-2*bwhg[id]-2*tbwg[id];
if(fw==2)pheight[id]=pht-((mie)?(sct)?0:4:0)-2*bwhg[id]-2*tbwg[id];  
shg_adpSize(id,pwidth[id],pheight[id]);}
shg_addRszEv(function(){shg_doRszadp(id,p,fw,e);})}

function shg_doRszadp(id,p,fw,e){shg_wh5();
shg_gsp();
delY[id]=0;
delX[id]=0;
if(fw!=0){  pwidth[id]=pwh-((mie)?(sct)?0:21:17)-2*bwhg[id]-2*tbwg[id];
if(fw==2)pheight[id]=pht-((mie)?(sct)?0:4:0)-2*bwhg[id]-2*tbwg[id];  
shg_adpSize(id,pwidth[id],pheight[id]);}
shg_sth(id,p);
cth=Math.floor(cth);
ctw=Math.floor(ctw);
shg_adpLocation(id,ctw,cth,0,e);}

function shg_sth(id,p){shg_wh5();
if(p==0){cth=ypos[id];
ctw=xpos[id];}
if(p==1){cth=(pht/2)-((mie)?(sct)?0:2:0)-((pheight[id]+2*bwhg[id]+2*tbwg[id])/2);
ctw=(pwh/2)-((mie)?(sct)?0:10:8)-((pwidth[id]+2*bwhg[id]+2*tbwg[id])/2);}
if(p==2){cth=(pht)-((mie)?(sct)?0:4:0)-((pheight[id]+2*bwhg[id]));
ctw=(pwh/2)-((mie)?(sct)?0:10:8)-((pwidth[id]+2*bwhg[id])/2);}
if(p==3){cth=(pht/2)-((mie)?(sct)?0:2:0)-((pheight[id]+2*bwhg[id]+2*tbwg[id])/2);
ctw=0;}
if(p==4){cth=(pht/2)-((mie)?(sct)?0:2:0)-((pheight[id]+2*bwhg[id]+2*tbwg[id])/2);
ctw=(pwh)-((mie)?(sct)?0:22:18)-((pwidth[id]+2*bwhg[id]+2*tbwg[id]));}
if(p==5){cth=0;
ctw=(pwh/2)-((mie)?(sct)?0:10:8)-((pwidth[id]+2*bwhg[id]+2*tbwg[id])/2);}
if(p==6){cth=0;
ctw=0;}
if(p==7){cth=(pht)-((mie)?(sct)?0:4:0)-((pheight[id]+2*bwhg[id]));
ctw=0;}
if(p==8){cth=(pht)-((mie)?(sct)?0:4:0)-((pheight[id]+2*bwhg[id]));
ctw=(pwh)-((mie)?(sct)?0:22:18)-((pwidth[id]+2*bwhg[id]+2*tbwg[id]));}
if(p==9){cth=0;
ctw=(pwh)-((mie)?(sct)?0:22:18)-((pwidth[id]+2*bwhg[id]+2*tbwg[id]));}
cth=Math.floor(cth);
ctw=Math.floor(ctw);}

function shg_adpN(id,x,y,w,h,bgColour){var adiv=dmt.createElement('div');
adiv.setAttribute('id',id);
adiv.style.backgroundColor=bgColour;
adiv.style.display='none';
adiv.style.padding='0px 0px 0px 0px';
if(id.indexOf('adpB')!=-1 || id.indexOf('adpS')!=-1){  if(isScr==1 && ( (ie7p && sct) || !mie)){    adiv.style.position='fixed';  }
else{    adiv.style.position='absolute';  }}
else{  adiv.style.position='absolute';}
adiv.style.left=x+'px';
adiv.style.top=y+'px';
adiv.style.width=w+'px';
adiv.style.height=h+'px';
return adiv;}

function shgadp(adpid,text,titletext){mnh=50;
mnw=50;
mxp=15;
mxb=15;
mxt=5;
if8=" 10pt Arial";
it3="#022f5a";
shf=0;
cpad=3;
tbw=3;
is7= 0 ;
pcc= 0 ;
tro= 5 ;
tra= 6 ;
rn= 1 ;
ifr= 0 ;
fw7=0;
adpw=Math.max(adpw,mnw);
adph=Math.max(adph,mnh);
cpad=Math.min(cpad,mxp);
tbw=Math.min(tbw,mxt);
tbw=0;
adpuids[adpuids.length]=adpid;
uid=adpid;
adppla[adppla.length]=pla;
adpscr[adpscr.length]=isScr;
bwhg[adpid]=Math.min(bwh,mxb);
cpadg[adpid]=cpad;
tbwg[adpid]=tbw;
xpos[adpid]=adpx;
ypos[adpid]=adpy;
pwidth[adpid]=adpw;
pheight[adpid]=adph;
delX[adpid]=0;
delY[adpid]=0;
ush=(ifr&&ieh&&!op);
if(it9)tsp=20;
else tsp=0;
if(!w37)return;
if(Math.floor(Math.random()*rn)!=0)return isc=1;
alc=window.location.href;
if(issp){var sp=rca(adpid+'_sp');
if(sp) return isc=1;
else mca(adpid+'_sp',true,plt);}
if(oo7)if(ac1(adpid))return isc=1;
if(ush){var ash=new adpiF(adpid+'_ash',xpos[adpid],ypos[adpid],adpw+2*bwhg[adpid]+shs+((mie)?2*tbw:0),adph+2*bwhg[adpid]+shs+((mie)?2*tbw:0));
ash.style.zIndex=++z_index;}
var adpS=new shg_adpN(adpid+'_adpS',xpos[adpid]+shs,ypos[adpid]+shs,adpw+2*bwhg[adpid]+2*tbw,adph+2*bwhg[adpid]+2*tbw,sc5);
adpS.style.zIndex=++z_index;
if(mie)adpS.style.filter="alpha(opacity=30)";
else adpS.style.MozOpacity=.3;
var adpB=new shg_adpN(adpid+'_adpB',xpos[adpid],ypos[adpid],adpw+2*bwhg[adpid],adph+2*bwhg[adpid],bc7);
adpB.style.zIndex=++z_index;
var adpT=new shg_adpN(adpid+'_adpT',bwhg[adpid],bwhg[adpid],adpw,20,tc3);
adpT.style.overflow="visible";
adpT.style.font="bold 9pt Tahoma";
adpT.style.color=tc2;
adpT.innerHTML='<span id="'+adpid+'_shg_adpTitle" style="white-space:nowrap;padding: 1px 0px 0px 3px;width:100%;position:absolute;left:0px;height:20px;">'+titletext+'</span>';
if(it9){var adpC=new shg_adpN(adpid+'_adpC',bwhg[adpid],bwhg[adpid]+20,adpw-((mie&&!sct&&!op9)?0:2*cpad),adph-lhg-20-((mie&&!sct&&!op9)?0:2*cpad),ib8);}
else{adpT.style.height="0px";
var adpC=new shg_adpN(adpid+'_adpC',bwhg[adpid],bwhg[adpid],adpw-((mie&&!sct&&!op9)?0:2*cpad),adph-lhg-((mie&&!sct&&!op9)?0:2*cpad),ib8);}
adpC.style.borderColor="";
adpC.style.borderStyle="inset";
adpC.style.borderWidth="0px";
if(is7){adpC.style.overflow="hidden";}
else{adpC.style.overflow="auto";}
adpC.style.padding=cpad+'px';
adpC.style.font=if8;
adpC.style.color=it3;
var rsize=new shg_adpN(adpid+'_rsize',adpw+2*bwhg[adpid]-9,adph+2*bwhg[adpid]-9,9,9,'');
var close=new shg_adpN(adpid+'_close',adpw+bwhg[adpid]-20,bwhg[adpid],20,20,'');
if(!mie)adpC.innerHTML=text;
adpB.appendChild(close);
if(ir9)adpB.appendChild(rsize);
adpB.appendChild(adpT);
adpB.appendChild(adpC);
if(ush)dmt.body.appendChild(ash);
dmt.body.appendChild(adpB);
dmt.body.appendChild(adpS);
if(mie)adpC.innerHTML=text;
if(ir9){rsize.style.background = 'url("resize.gif") no-repeat';
rsize.style.cursor='NW-resize';
rsize.style.zIndex=++z_index;}
if(cc6){close.style.background = 'url("close.gif") no-repeat';
close.style.cursor=(mie)?'hand':'pointer';
close.style.zIndex=++z_index;}
rEl=shg_de7(adpid+'_rsize');
tEl=shg_de7(adpid+'_adpT');
cEl=shg_de7(adpid+'_adpC');
if(ir9)rEl.adpid=adpid;
tEl.adpid=adpid;
cEl.adpid=adpid;
if(isex==1){if(mie){setTimeout('dmt.attachEvent("onmousemove",mouseexit);',1000);}
else{setTimeout('document.addEventListener("mousemove",mouseexit,true);',1000);}}
if(ir9)if(ir9)rEl.onmousedown=amre;
if(im5){tEl.style.cursor='move';
tEl.onmousedown=amre;
if(cnm){cEl.style.cursor='move';
cEl.onmousedown=amre;}}
shg_de7(adpid+'_close').onclick=new Function("shgadpHide('"+ adpid +"');");
if(isScr && mie)adpScroll(adpid,pla,1);
if(pla!=0)shg_adpPlace(adpid,pla,fw7);}

function shg_adpTimer(id,fid1,fid2,fid3,fid4,int1,int2){id="'" + id + "'";
clearTimeout(tid1);
clearTimeout(tid2);
clearTimeout(tid3);
clearTimeout(tid4);
tstr1='' + fid1 + '(' + id + ')';
tstr2='' + fid2 + '(' + id + ')';
tstr3='' + fid3 + '(' + id + ')';
tstr4='' + fid4 + '(' + id + ')';
tid1=setTimeout(tstr1,1000*int1);
tid2=setTimeout(tstr2,1000*int1);
tid3=setTimeout(tstr3,1000*(int1+int2));
tid4=setTimeout(tstr4,1000*(int1+int2));}

function shgadpTooltip(id,tid,w,h,adpOffX,adpOffY,adptContent,adpCol,adpFade,event){mnh=20;
shg_adpLocation(id,adpOffX,adpOffY,1,event);
shg_adpSize(id,w,h);
shg_adpContent(id,adptContent);
shg_de7(id+'_adpC').style.backgroundColor=adpCol;
if(adpFade){shg_adpFadein(id);
shg_de7(tid).onmouseout=function(){shg_adpFadeout(id);}}
else{shg_adpShow(id);
shg_de7(tid).onmouseout=function(){shgadpHide(id);}}};
}
