﻿    
// Open pages in a new window with rel="external"
function externalWindow() { 
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a"); 
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];			
			if (anchor.getAttribute("href") &&
			    anchor.getAttribute("rel") == "external")
			    anchor.target = "_blank";				
	}
} 
window.onload = externalWindow;


// All the mootools events
window.addEvent('domready', function(){ 
   
    if (pluginlist.indexOf("Flash")==-1)
    $$('h2').addClass('show-this') && $$('h3').addClass('show-this');
	
	$$('.rollover').each(function(item) {        
        item.addEvent('mouseover', function() {
            this.addClass('on');
            item.getElement('.main').addClass('on');
        });
        
        item.addEvent('mouseleave', function(){
            this.removeClass('on');
            item.getElement('.main').removeClass('on');
        });
    });
	
	$$('.sub').each(function(item) {        
        item.addEvent('mouseover', function() {
            this.addClass('on');
        });
        
        item.addEvent('mouseleave', function(){
            this.removeClass('on');
        });
    });
    
    $$('div.calendar table.main td li').each(function(item) {
        item.getElement('.more-info').addEvent('mouseover', function(){
            item.getElement('.information').addClass('on');
            $$('div.calendar table.main td li').setStyle('position', 'static');
            item.setStyle('position', 'relative');
        });
        item.addEvent('mouseleave', function(){
            item.getElement('.information').removeClass('on');
        });
    });
    
    $$('div.content div.page div.video span').addEvent('click', function() {
        $$('div.content div.page div.video span').removeClass('on');
        this.addClass('on');
        $$('div.content div.page div.video div.player').empty();
        $$('div.content div.page div.video div.player').setHTML('<br /><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="360" height="290"><param name="movie" value="' + this.getProperty('title') + '" /><param name="wmode" value="transparent" /><object type="application/x-shockwave-flash" data="' + this.getProperty('title') + '" width="360" height="290" wmode="transparent"><p><a href="http://www.adobe.com/products/flashplayer/" target="_blank">Flash Player 9</a> is required to view this video.</p></object></object>');
    });
});
