var tm;
var blackCut=null;
var geApi=null;
var tourmovie=null;
var tp=null;
var geDControl=null;
var geController=null;
var geList=null;
var hIcon=null;
var cIcon=null;
var sc=null;
var ratec="";
var geoFilter=null;
function scriptInit(){
snConsole=new snConsoleClass();
if(type!=undefined){
switch(type){
case "list":
geList=new SnoovelList();
geList.init();
if(dojo.isIE){
var _1=dojo.byId("list").lastChild;
for(var i=0;i<_1.length;i++){
var _3=_1[i].className;
_1[i].onmouseover=function(){
_1[i].className="hovered";
};
_1[i].onmouseout=function(){
_1[i].className=_3;
};
}
}
break;
default:
geController=new SnoovelManager();
break;
}
}else{
snConsole.debug("No GE will be started");
}
};
function SnoovelManager(){
var _4=null;
var _5=null;
5;
var me=this;
var _7=null;
geApifac=null;
var td;
this.logPlaytime=null;
var _9=null;
try{
dojo.byId("mysnoovellink").value="<iframe src=\"http://www.snoovel.com/mysl/"+TOUR_ID+"/[KEY]\"></iframe>";
}
catch(e){
}
this.loadFinished=function(){
if(tp instanceof geGuidedTourPlayer){
this.start();
}
};
this.getApiFacede=function(){
return geApifac;
};
this.resetTour=function(id){
if(isNaN(parseFloat(id))){
snConsole.debug("resetTour","not a Numer ("+id+")");
}else{
tourdata=undefined;
_data=undefined;
TOUR_ID=id;
this.loadTour();
}
};
var _b=function(_c){
foo=new Array();
for(var i=0;i<_c.length;i++){
if(_c[i].ht==true){
var _e=_c[i];
_e.tatm=_e.tatm.replace(/\\\"/g,"\\\\\\\"");
var _f=dojo.fromJson(_e.tapm);
var _10=dojo.fromJson(_e.taval);
var _11=dojo.fromJson(_e.tatm);
var c=_e.taco;
if(_11.template!=undefined){
c=c.replace(/\$\$template\$\$/,_11.template);
}
for(var j=0;j<_10.length;j++){
var n=_10[j].name;
var v=_10[j].value;
eval("var search =  /\\$\\$"+n+"\\$\\$/g;");
c=c.replace(search,v);
}
ge=geApifac.getGeInstance();
foo[_e.name]=c;
var pm=geApifac.testAddPlacemark("",_e.name,_e.lat,_e.lng,0,geApifac.getGeInstance().ALTITUDE_CLAMP_TO_SEALEVEL,_e.iconurl);
if(_e.iconurl.search(/pushpin/)!=-1){
var ss=pm.getStyleSelector();
var ns=ss.getNormalStyle();
var is=ns.getIconStyle();
is.setScale(0.6);
var hsp=is.getHotSpot();
hsp.set(0.5,ge.UNITS_FRACTION,0,ge.UNITS_FRACTION);
hs=ss.getHighlightStyle();
is=hs.getIconStyle();
is.setScale(0.7);
hsp=is.getHotSpot();
hsp.set(0.5,ge.UNITS_FRACTION,0,ge.UNITS_FRACTION);
}
var _1b=0.003;
plat=new Array(2);
plng=new Array(2);
plat[0]=_e.lat+_1b;
plat[1]=_e.lat-_1b;
plng[0]=_e.lng+_1b;
plng[1]=_e.lng-_1b;
var lod=ge.createLod("");
lod.set(100,-1,0,0);
var _1d=ge.createRegion("");
var box=ge.createLatLonAltBox("");
box.setAltBox(plat[0],plat[1],plng[0],plng[1],0,0,200,ge.ALTITUDE_RELATIVE_TO_GROUND);
_1d.setLod(lod);
_1d.setLatLonAltBox(box);
pm.setRegion(_1d);
google.earth.addEventListener(pm,"click",function(_1f){
var _20=foo[_1f.getCurrentTarget().getName()];
_20=_20.replace(/\\/g,"");
eval(_20);
_1f.preventDefault();
});
}
}
};
this.initPlugin=function(_21){
geApi.initCB(_21);
geApi.enableTerrain(true);
var log=new snPluginLog("todoSession",3,true,geApi.getPlugVersion(),geApi.getApiVersion());
log.sendMessage();
geApi.setBorderLayerVisible(true);
_21.getOptions().setAtmosphereVisibility(false);
_21.getOptions().setAtmosphereVisibility(true);
var ge=_21;
var _24=ge.createScreenOverlay("");
_24.setName("snoovellogo");
_24.setIcon(ge.createIcon(""));
_24.getIcon().setHref("http://"+location.hostname+"/fileadmin/snoovel/gfx/snoovel_logo_weiss.png");
_24.getOverlayXY().setXUnits(ge.UNITS_PIXELS);
_24.getOverlayXY().setYUnits(ge.UNITS_PIXELS);
_24.getOverlayXY().setX(35);
_24.getOverlayXY().setY(13);
ge.getFeatures().appendChild(_24);
geApifac=geApi;
me.loadTour();
try{
if(td.data[0].poilist!=undefined&&td.data[0].poilist.length!=0){
_b(td.data[0].poilist);
}
}
catch(e){
snConsole.debug("Transaction init failed."+e);
}
geDControl.initGeomovieStatistic(td.data[0]);
dojo.addOnUnload(function(){
me.stop();
});
};
this.unloadTour=function(){
};
this.loadTour=function(_25){
switch(TOUR_TYPE){
case "movie":
if(_4==null){
tp=new geGuidedTourPlayer(geApi);
_26();
}
tp.stopMovie();
if(_25==undefined){
_25=TOUR_ID;
}
key=TOUR_KEY;
_4=new geTourMovie(_25,_9,geDControl,this,key);
tp.setMovie(_4);
_4.init();
mediaTabs[0]["visible"]="false";
mediaTabs[1]["initVisibility"]="true";
_27(TOUR_ID);
break;
}
dcMedia=new tabContainer(mediaTabs,"switchMediaTab");
};
this.loggingControl=function(_28,_29){
this.logPlaytime=new snPlaytimeLog(_28,4);
dojo.addOnWindowUnload(this,function(){
this.logPlaytime.sendMessage();
logStack.getInstance().sendStackNow();
snConsole.debug("You are leaving this page, good bye");
});
};
this.init=function(){
_9=new SnoovelCom();
sc=_9;
switch(TOUR_PLAYER){
case 1:
geDControl=new MySlDisplayController();
try{
td=_data;
}
catch(e){
alert("Could not connect to GEODM Server. Please try again later.");
return;
}
if(td.status=="failure"){
if(td.errors[0]=="Requested Movie does not exist"){
alert(td.errors[0]);
}else{
if(td.errors[0]=="Requested Movie is not public"){
alert(td.errors[0]);
}else{
if(td.errors[0]=="Illegal attempt to load tourmovie"){
alert(td.errors[0]);
}else{
alert(i18n.MSG_ERROR_UNKNOWNERROR);
}
}
}
return;
}
geDControl.setGeomovieTitle(td.data[0].name,td.data[0].creator,td.data[0].crdate);
geDControl.init();
break;
default:
case 0:
geDControl=new SnoovelDisplayController();
var _2a=false;
try{
td=_data;
}
catch(e){
_2a=true;
geDControl.init(_2a);
var box=dojo.byId("map3d");
box.style.backgroundColor="#FFCCCC";
box.style.border="#FF0000 1px solid";
box.style.fontWeight="bold";
box.style.textAlign="center";
box.innerHTML="Could not connect to GEODM Server. Please try again later.";
return;
}
if(td.status=="failure"){
_2a=true;
geDControl.init(_2a);
var box=dojo.byId("map3d");
box.style.backgroundColor="#FFCCCC";
box.style.border="#FF0000 1px solid";
box.style.fontWeight="bold";
box.style.textAlign="center";
if(td.errors[0]=="Requested Movie does not exist"){
box.innerHTML=td.errors[0];
}else{
if(td.errors[0]=="Requested Movie is not public"){
box.innerHTML=td.errors[0];
}else{
if(td.errors[0]=="Illegal attempt to load tourmovie"){
box.innerHTML=td.errors[0];
}else{
box.innerHTML=td.errors[0];
}
}
}
return;
}
geDControl.setGeomovieTitle(td.data[0].name,td.data[0].creator,td.data[0].crdate);
try{
if(td.data[0].scenelist[0].cvlist[0].description==""&&td.data[0].scenelist[0].autostartMedium==undefined){
_2a=true;
}
}
catch(e){
}
this.loggingControl("todoSession",td.data[0].name);
geDControl.init(_2a);
break;
}
geDControl.initGeomovieStatistic(td.data[0]);
geApi=new GeEarthApiFacade();
try{
google.earth.createInstance(geEarthDivId,this.initPlugin,geApi.failedCB);
}
catch(e){
snConsole.debug("Exception in Init() of controller Constructing Tumbler "+e);
}
};
this.mute=function(){
flashMoviePlayer.mute();
};
this.volumeUp=function(){
flashMoviePlayer.setVolume(10);
};
this.volumeDown=function(){
flashMoviePlayer.setVolume(-20);
};
this.moveTo=function(i){
scene=_4.setSceneIndex(i);
trans=tp.resetTransition();
if(trans!==false){
geDControl.setDescription(scene.getName(),trans.getDescription());
ge=geApifac.setLookAt(trans.getLookAt());
}
};
this.movefirst=function(){
tp.gotoFirst();
if(!tp.isPlaying()){
tp.setTransitionUI();
}
};
this.moveprev=function(){
_4.decScene();
tp.resetTransition();
if(!tp.isPlaying()){
tp.setTransitionUI();
}
};
this.pause=function(){
tp.pauseMovie();
geApifac.removeWindowEvent();
flashMoviePlayer.pause();
//this.logPlaytime.pause();
};
this.start=function(){
tp.startMovie();
geApifac.addWindowEvent("mousedown",this.callbackGEWindowEvent);
this.logPlaytime.play();
};
this.stop=function(){
if(_4 instanceof geTourMovie){
tp.stopMovie();
geApifac.removeWindowEvent();
flashMoviePlayer.stop();
}
};
this.movenext=function(){
tp.gotoNext();
if(!tp.isPlaying()){
tp.setTransitionUI();
}
};
this.movelast=function(){
tp.gotoLast();
if(!tp.isPlaying()){
tp.setTransitionUI();
}
};
this.callbackGEWindowEvent=function(_2d){
snConsole.debug("Debug me"+_2d.getTimeStamp());
geController.pause();
};
var _26=function(){
dojo.connect(dojo.byId("ge_muteTP"),"onclick",function(){
geController.mute();
var _2e=dojo.byId("ge_muteTP");
if(flashMoviePlayer.isMuted()){
_2e.style.backgroundPosition=getBgImageXPos(_2e)+" 0px";
snConsole.debug("Mute");
}else{
snConsole.debug("unMute");
yPos=dojo.style(_2e,"height");
if(yPos==null){
yPos="25";
}
_2e.style.backgroundPosition=getBgImageXPos(_2e)+" "+yPos+"px";
}
return false;
});
elem=dojo.byId("ge_voldownTP");
addPushButtonBehavior(elem,geController.volumeDown);
elem=dojo.byId("ge_volupTP");
addPushButtonBehavior(elem,geController.volumeUp);
elem=dojo.byId("ge_firstTP");
addPushButtonBehavior(elem,geController.movefirst);
elem=dojo.byId("ge_previousTP");
addPushButtonBehavior(elem,geController.moveprev);
elem=dojo.byId("ge_pauseTP");
dojo.connect(elem,"onclick",function(){
geController.pause();
return false;
});
elem=dojo.byId("ge_playTP");
dojo.connect(elem,"onclick",function(){
geController.start();
return false;
});
elem=dojo.byId("ge_stopTP");
dojo.connect(elem,"onclick",function(){
geController.stop();
return false;
});
elem=dojo.byId("ge_nextTP");
addPushButtonBehavior(elem,geController.movenext);
elem=dojo.byId("ge_lastTP");
addPushButtonBehavior(elem,geController.movelast);
};
var _2f=function(){
elem=dojo.byId("ge_playTP");
dojo.connect(elem,"onclick",function(){
_5.start();
return false;
});
elem=dojo.byId("ge_firstTP");
addPushButtonBehavior(elem,_5.reset);
elem=dojo.byId("ge_pauseTP");
dojo.connect(elem,"onclick",function(){
_5.stop();
return false;
});
elem=dojo.byId("ge_upTP");
addPushButtonBehavior(elem,_5.faster);
elem=dojo.byId("ge_downTP");
addPushButtonBehavior(elem,_5.slower);
};
var _27=function(_30){
var _31=dojo.byId("comment_head");
if(_31==undefined){
return;
}
var cf=dojo.byId("commentform");
cf.reset();
dojo.connect(dojo.byId("submit"),"onclick",function(){
_9.submitCommentForm(cf,_30);
return false;
});
dojo.connect(_31,"onclick",function(){
var _33=dojo.byId("comment_con");
var img=dojo.byId("com_s");
if(_33.style.display=="none"){
_33.style.display="block";
var _35=dojo.byId("com_li");
img.src="fileadmin/snoovel/gfx/open.png";
if(!_35.hasChildNodes()){
_9.getMovieComments(_30);
var li=document.createElement("li");
li.setAttribute("id","com_lo");
li.innerHTML="<img  src=\"fileadmin/snoovel/gfx/loading.gif\" />";
_35.appendChild(li);
}
}else{
_33.style.display="none";
img.src="fileadmin/snoovel/gfx/close.png";
}
});
};
this.init();
};
function SnoovelList(){
var _37=null;
var map;
var _39;
this.init=function(){
_37=new SnoovelCom();
geDControl=new SnoovelDisplayController();
var _3a=null;
var _3b=null;
var _3c=6;
var _3d=1;
var _3e=dojo.byId("counter");
var _3f=dojo.byId("notours");
_3f.innerHTML=_data.items.length+"";
var _40=Math.ceil(_data.items.length/_3c);
var _41=1;
_3e.innerHTML=_41+"/"+_40;
var _42=false;
var _43=[];
var _44;
var _45=function(){
if(!_42){
_3b.start+=_3c;
_41++;
_3a.fetch(_3b);
}
};
var _46=function(){
_3b.start=0;
_41=1;
_3b.sort[0]={attribute:"name",descending:false};
_3b.sort[1]={attribute:"desc",descending:false};
_3a.fetch(_3b);
};
var _47=function(){
_3b.start=0;
_41=1;
_3b.sort[0]={attribute:"date",descending:true};
_3b.sort[1]={attribute:"name",descending:false};
_3a.fetch(_3b);
};
var _48=function(){
_3b.start=0;
_41=1;
_3b.sort[0]={attribute:"user",descending:false};
_3b.sort[1]={attribute:"name",descending:false};
_3a.fetch(_3b);
};
var _49=function(){
_3b.start=0;
_41=1;
_3b.sort[0]={attribute:"counter",descending:true};
_3b.sort[1]={attribute:"name",descending:false};
_3a.fetch(_3b);
};
var _4a=function(){
_3b.start=0;
_41=1;
_3b.sort[0]={attribute:"rating",descending:true};
_3b.sort[1]={attribute:"date",descending:false};
_3a.fetch(_3b);
};
var _4b=function(){
_37.loadLanguages();
dojo.fx.wipeIn({node:"lang",duration:300}).play();
};
var _4c=function(_4d,_4e){
var _4f=dojo.byId("counter");
_40=Math.ceil(_4d.length/_3c);
};
var _50=function(_51){
_3b.start=0;
_41=1;
_3b.query={lang:_51};
_3b.count=1000000;
_3b.onComplete=_4c;
_3a.fetch(_3b);
_3b.count=_3c;
_3b.onComplete=_52;
_3a.fetch(_3b);
};
var _52=function(_53,_54){
_44=_53;
if(_53.length<_3c){
_42=true;
}
if(_41>_40&&_53.length!=0){
_41--;
_54.start-=_3c;
_42=true;
return;
}else{
_42=false;
}
_3e.innerHTML=_41+"/"+_40;
var _55=new GLatLngBounds();
var _56=dojo.byId("result");
for(var i=_56.rows.length;i>0;i--){
try{
map.removeOverlay(_43[i-1]);
}
catch(e){
}
_56.deleteRow(i-1);
}
if(_53.length==0){
var tr=document.createElement("tr");
var td1=document.createElement("td");
td1.style.verticalAlign="top";
td1.innerHTML=i18n.NO_TOURS_FOUND;
tr.appendChild(td1);
_56.appendChild(tr);
}
var i;
for(i=0;i<_53.length;i++){
var tr=document.createElement("tr");
tr.id="listid"+_53[i].uid;
var td1=document.createElement("td");
td1.style.verticalAlign="top";
var d=_53[i].desc+"";
if(d.length>100){
d=d.slice(0,d.slice(0,100).lastIndexOf(" "));
if(d.charAt(d.length-1)!="."){
d+="...";
}
}
var _5b="<p><font style=\"font-weight:bold; color:#0075BB;\">"+_53[i].name;
_5b+="&nbsp;&nbsp;&nbsp;&nbsp;";
var _5c=_53[i].rating[0];
_5b+=geDControl.rateButton(_5c);
_5b+="</font><br/>";
if(d.length>0){
_5b+=d+" - ";
}
_5b+="<i>"+i18n.LIST_VIEWNOWSLOGAN+"</i></p><span class=\"header_small\">"+i18n.LIST_CREATE+" ";
_5b+=dateString(_53[i].date);
_5b+=" "+i18n.LIST_BY+" "+_53[i].user;
_5b+=" "+i18n.LIST_COUNTER+" "+_53[i].counter;
_5b+=" "+i18n.LANG_TITLE+" <img src=\"/fileadmin/snoovel/gfx/flags/"+(_53[i].lang+"").substr(0,2)+".png\" />";
if(_53[i].dist!=undefined){
var _5d=parseInt(_53[i].dist);
if(_5d>1000){
_5d=parseInt(_5d/1000)+"km";
}else{
_5d=_5d+"m";
}
_5b+=" "+_5d;
}
td1.innerHTML=_5b;
tr.appendChild(td1);
_56.appendChild(tr);
var _5e=new GLatLng(_53[i].lat,_53[i].lng);
var opt={icon:cIcon,title:_53[i].name};
var _60=new GMarker(_5e,opt);
var xy=new bean(PLAYER_AIM,_53[i].uid,_60,_53[i].name);
if(_53[i].lat!=null&&_53[i].lng!=null){
map.addOverlay(_60);
_55.extend(_5e);
_43[i]=_60;
GEvent.addListener(_60,"mouseover",dojo.hitch(xy,"highlight"));
GEvent.addListener(_60,"mouseout",dojo.hitch(xy,"lowlight"));
GEvent.addListener(_60,"click",dojo.hitch(xy,"callback"));
dojo.connect(tr,"onmouseover",dojo.hitch(xy,"highlight"));
dojo.connect(tr,"onmouseout",dojo.hitch(xy,"lowlight"));
}
dojo.connect(tr,"onclick",dojo.hitch(xy,"callback"));
}
if(i<6){
for(;i<6;i++){
var tr=document.createElement("tr");
var td1=document.createElement("td");
td1.style.border="0px solid";
td1.style.height="70px";
tr.appendChild(td1);
_56.appendChild(tr);
}
}
map.setZoom(Math.min(map.getBoundsZoomLevel(_55)-1,14));
var _62=(_55.getNorthEast().lat()+_55.getSouthWest().lat())/2;
var _63=(_55.getNorthEast().lng()+_55.getSouthWest().lng())/2;
map.setCenter(new GLatLng(_62,_63));
};
this.unfilterStore=function(){
_3a.revert();
_40=Math.ceil(_data.items.length/_3c);
_41=1;
_3b=_3a.fetch({onComplete:_52,scope:this,start:0,count:_3c,sort:[{attribute:"date",descending:true}],query:{lang:"*"},queryOptions:{ignoreCase:true}});
};
this.filterStore=function(_64,_65){
_3a.revert();
idontcarerequest=_3a.fetch({onComplete:function(_66,req){
var _68=_66.length;
var _69=1;
for(i=0;i<_66.length;i++){
aktPoint=new GLatLng(parseFloat(_66[i].lat),parseFloat(_66[i].lng));
var _6a=_64.distanceFrom(aktPoint);
if(_6a>_65){
_3a.deleteItem(_66[i]);
_68--;
}else{
_3a.setValue(_66[i],"dist",_6a);
}
}
_40=Math.ceil(_68/_3c);
if(_40!=0){
_41=1;
}else{
map.setCenter(_64);
}
_3b=_3a.fetch({onComplete:_52,scope:this,start:0,count:_3c,sort:[{attribute:"dist",descending:false}],query:{lang:"*"},queryOptions:{ignoreCase:true}});
},sort:[{attribute:"date",descending:true},{attribute:"desc",descending:true}],query:{lang:"*"},queryOptions:{ignoreCase:true}});
};
function init(){
var _6b=window.location.protocol;
_6b=_6b+"//"+window.location.host;
service=_6b+"/index.php?id=29&type=4711";
var _6c=service+"&service=movielist";
_3a=new dojo.data.ItemFileWriteStore({data:_data});
dojo.connect(dojo.byId("next"),"onclick",_45);
var _6d=dojo.byId("langs");
dojo.connect(_6d,"onchange",function(){
_50(_6d.value);
});
dojo.connect(dojo.byId("obname"),"onclick",_46);
dojo.connect(dojo.byId("obdate"),"onclick",_47);
dojo.connect(dojo.byId("obuser"),"onclick",_48);
dojo.connect(dojo.byId("obcounter"),"onclick",_49);
dojo.connect(dojo.byId("obrating"),"onclick",_4a);
dojo.connect(dojo.byId("oblang"),"onclick",_4b);
var _6e=function(){
if(_3b.start>0){
_41--;
_3b.start-=_3c;
_3a.fetch(_3b);
}
};
dojo.connect(dojo.byId("prev"),"onclick",_6e);
_3b=_3a.fetch({onComplete:_52,start:0,count:_3c,sort:[{attribute:"date",descending:true},{attribute:"desc",descending:true}],query:{lang:"*"},queryOptions:{ignoreCase:true}});
};
if(GBrowserIsCompatible()){
map=new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(0,0),1);
map.setMapType(G_SATELLITE_MAP);
map.addControl(new GSmallMapControl());
geocoding=new GClientGeocoder();
geoFilter=new geoSearch(this);
}
cIcon=new GIcon();
cIcon.image="http://www.google.com/intl/en_us/mapfiles/ms/micons/blue-dot.png";
cIcon.iconSize=new GSize(32,32);
cIcon.iconAnchor=new GPoint(16,32);
hIcon=new GIcon();
hIcon.image="http://www.google.com/intl/en_us/mapfiles/ms/micons/red-dot.png";
hIcon.iconSize=new GSize(32,32);
hIcon.iconAnchor=new GPoint(16,32);
dojo.addOnLoad(init);
};
this.callbackPublicMovies=function(_6f){
var _70=dojo.fromJson(_6f);
if(_70.status=="success"){
if(Language!=null){
geDControl.showList(_70.data,PLAYER_AIM,map,"&L="+i18n.LANGUAGE_ID);
}else{
geDControl.showList(_70.data,PLAYER_AIM,map);
}
}
};
function bean(_id,_72,_73,_74){
var _75=_id;
var _76=_72;
var _77=_73;
var _78=_74[0];
this.callback=function(){
_78=_78.replace(/ /g,"-");
window.location="index.php?id="+_75+"&tour="+_76+"&L="+i18n.LANGUAGE_ID+"&tourname="+_78;
};
this.highlight=function(){
_77.setImage("http://www.google.com/intl/en_us/mapfiles/ms/micons/red-dot.png");
dojo.byId("listid"+_72).style.backgroundColor="#EEEEEE";
};
this.lowlight=function(){
_77.setImage("http://www.google.com/intl/en_us/mapfiles/ms/micons/blue-dot.png");
dojo.byId("listid"+_72).style.backgroundColor="";
};
};
};


