dojo.require("dojox.widget.FisheyeLite");
dojo.require("dijit.form.TextBox");
dojo.require("dijit.form.Button");
dojo.require("dojox.image.Lightbox");
dojo.require("dojo.cookie");

// Menu-wackeln
dojo.addOnLoad(function(){   
    dojo.query("div.hauptNaviGation").forEach(function(n){
      new dojox.widget.FisheyeLite({
	     properties: {
          height:1.2
        }
	 },n);
    });
});

//Sub Menu-wackeln	
dojo.addOnLoad(function(){   
    dojo.query("div.txtE1").forEach(function(n){
      new dojox.widget.FisheyeLite({
	     properties: {
    	  paddingLeft:1.4
        }
	 },n);
    });
    dojo.query("div.txtE2").forEach(function(n){
          new dojox.widget.FisheyeLite({
    	     properties: {
        	  paddingLeft:1.1
            }
    	 },n);
    });
});

function showVideo(id){
	var iframe;
	iframe = frames[0];
	iframe.location.href = 'http://www.videowerkstatt.net/video/info-tv/showVideo.php?s=1&id='+id;
	setAktuellesVideo(id);
}

function showVideoPopUp(id){
	MM_openBrWindow(	'http://www.videowerkstatt.net/video/info-tv/showVideo.php?id='+id,
						'onlineStream',
						'resizable=yes,width=550,height=700');
}

var aktuellesVideo = -1;

function setAktuellesVideo(id){
	aktuellesVideo = id;
}

function showVideoPopUpAktual(){
	if (aktuellesVideo!=-1){
		showVideoPopUp(aktuellesVideo);
	}
}

var aktShortNews = new Array();
function showShortNewsNr(id, gr){
	
	if (aktShortNews[gr]!=null){
		dojo.removeClass(aktShortNews[gr], ["detailsAktiv"]);
	}
	dojo.addClass(id, ["detailsAktiv"]);
	aktShortNews[gr] = id;
}


dojo.addOnLoad(function(){  
	dojo.query("div.shortNews a").forEach(function(n){
			dojo.connect(n, 'onmouseover', function(e) {
				showShortNewsNr(n.rel, n.rev);       
			});
	});
});


var AktivVideo;
var maxVideoBlocks;
var youCanTimeToggle;
var DebugField;

function showVideoBlock(id){
	var oldBox = dojo.byId("Box"+AktivVideo);
	var oldReiter = dojo.byId("Reiter"+AktivVideo);
	var newBox = dojo.byId("Box"+id);
	var newReiter = dojo.byId("Reiter"+id);
	
	if (newBox!=null){
	    if (oldBox!=null){ 	dojo.removeClass( oldBox,     "VideoPrevAktiv"); }
	    if (oldReiter!=null){	dojo.removeClass( oldReiter , "Aktiv"); }
	    
	    if (newBox!=null){ 	dojo.addClass( newBox ,    "VideoPrevAktiv"); }
	    if (newReiter!=null){	dojo.addClass( newReiter , "Aktiv"); }
	    
	    AktivVideo = id;
	    dojo.cookie("VideoShow", id, {expires: 5} );
	}
}

function toggleVideoBlock(){
      var newVideoBlock = AktivVideo+1;
      if (newVideoBlock >= maxVideoBlocks){ newVideoBlock = 0; }
      if (newVideoBlock < 0){ newVideoBlock = 0; }     
      showVideoBlock(newVideoBlock);
}

function toggleTimeVideoBlock(){
      if (youCanTimeToggle){ toggleVideoBlock();  }
      window.setTimeout("toggleTimeVideoBlock()",10000);
}

dojo.addOnLoad(function(){ 
      AktivVideo = 4;
      AktivVideo = dojo.cookie("VideoShow") -1;
      if (!AktivVideo>0){ AktivVideo = 4; }
      maxVideoBlocks = 5;
      youCanTimeToggle = true;
      toggleTimeVideoBlock(); 
});


//Startseite
dojo.addOnLoad(function(){   
	
	  	dojo.query("td.anleserNews").forEach(function(n){
	    	dojo.connect(n, 'onmouseover', function(e) { dojo.addClass(n, "anleserNewsHover");  });
	    	dojo.connect(n, 'onmouseout', function(e) { dojo.removeClass(n, "anleserNewsHover");  });
	    });
	    
	  	dojo.query("td.anleserMixed").forEach(function(n){
	    	dojo.connect(n, 'onmouseover', function(e) { dojo.addClass(n, "anleserMixedHover");  });
	    	dojo.connect(n, 'onmouseout', function(e) { dojo.removeClass(n, "anleserMixedHover");  });
	    });
	  	
	    dojo.query("td.anleserBusiness").forEach(function(n){
	    	dojo.connect(n, 'onmouseover', function(e) { dojo.addClass(n, "anleserBusinessHover");  });
	    	dojo.connect(n, 'onmouseout', function(e) { dojo.removeClass(n, "anleserBusinessHover");  });
	    });

	    
	    dojo.query("td.anleserDunkelGrau").forEach(function(n){
	    	dojo.connect(n, 'onmouseover', function(e) { dojo.addClass(n, "anleserDunkelGrauHover");  });
	    	dojo.connect(n, 'onmouseout', function(e) { dojo.removeClass(n, "anleserDunkelGrauHover");  });
	    });

	    
	    dojo.query("td.anleserEvents").forEach(function(n){
	    	dojo.connect(n, 'onmouseover', function(e) { dojo.addClass(n, "anleserEventsHover");  });
	    	dojo.connect(n, 'onmouseout', function(e) { dojo.removeClass(n, "anleserEventsHover");  });
	    });
	    
	    dojo.query("td.anleserHellGrau").forEach(function(n){
	    	dojo.connect(n, 'onmouseover', function(e) { dojo.addClass(n, "anleserHellGrauHover");  });
	    	dojo.connect(n, 'onmouseout', function(e) { dojo.removeClass(n, "anleserHellGrauHover");  });
	    });
	    
	    dojo.query("td.anleserMesse").forEach(function(n){
	    	dojo.connect(n, 'onmouseover', function(e) { dojo.addClass(n, "anleserMesseHover");  });
	    	dojo.connect(n, 'onmouseout', function(e) { dojo.removeClass(n, "anleserMesseHover");  });
	    });
	    
	    dojo.query("td.anleserSports").forEach(function(n){
	    	dojo.connect(n, 'onmouseover', function(e) { dojo.addClass(n, "anleserSportsHover");  });
	    	dojo.connect(n, 'onmouseout', function(e) { dojo.removeClass(n, "anleserSportsHover");  });
	    });
	    
	    dojo.query("td.anleserStreams").forEach(function(n){
	    	dojo.connect(n, 'onmouseover', function(e) { dojo.addClass(n, "anleserStreamsHover");  });
	    	dojo.connect(n, 'onmouseout', function(e) { dojo.removeClass(n, "anleserStreamsHover");  });
	    });
	    
	    dojo.query("td.anleserWeiss").forEach(function(n){
	    	dojo.connect(n, 'onmouseover', function(e) { dojo.addClass(n, "anleserWeissHover");  });
	    	dojo.connect(n, 'onmouseout', function(e) { dojo.removeClass(n, "anleserWeissHover");  });
	    });
	    
	    dojo.query("td.anleserWetter").forEach(function(n){
	    	dojo.connect(n, 'onmouseover', function(e) { dojo.addClass(n, "anleserWetterHover");  });
	    	dojo.connect(n, 'onmouseout', function(e) { dojo.removeClass(n, "anleserWetterHover");  });
	    });
    
});





