	var profiles =
	{
		radio: {
			height:400,
			width:820,
			status:1
		},
		video: {
			height:460,
			width:995,
			status:1
		},
		singleaudio: {
			height:110,
			width:380,
			status:1
		},
		singlevideo: {
			height:273,
			width:378,
			status:1
		},
		podcast: {
			height:40,
			width:320,
			center:1,
			createnew:0
		}
	}



	jQuery(function() {
		
		//	visibility toggler
		jQuery('a.toggle').click(function() {
			if (jQuery('#'+jQuery(this).attr('rel')).is(':visible')) {
				jQuery('#'+jQuery(this).attr('rel')).fadeOut(100);
			} else {
				jQuery('#'+jQuery(this).attr('rel')).fadeIn(300);
			}
			return false;
		});
		
		//	dropdowns in IE6
		jQuery('#zones > ul > li > ul:visible').hide();
		
		jQuery('#zones > ul > li.dropdown').hover(function() {
			jQuery(this).children().show();
		}, function() {
			jQuery('#zones > ul > li > ul:visible').hide();
		});
	
	
		// Accordion
		jQuery("dl.accordion dd").addClass("hide");
		jQuery("dl.accordion dd:not(:first)").hide();
	
		jQuery('dl.accordion > dt').click(function() {
			jQuery(this).removeClass('active');
			jQuery(this).next('dd').fadeIn(500).siblings("dd:visible").fadeOut(300).removeclass('active');
			
			jQuery(this).addClass("active");
			jQuery(this).next('dd').addClass("active");
			jQuery(this).siblings("dt").removeClass("active");
		});
	
	
		jQuery('input, textarea').focus(function() {
			jQuery(this).addClass('active');					   
		});
					
		jQuery('input, textarea').blur(function() {
			jQuery(this).removeClass('active');					   
		});
	
	
		// open links with a 'http://' in new window
		var allowedDomains = [
				location.hostname, 
				"radio-canada.ca",
				"cbc.ca",
				"javascript:;",
				"javascript:PD_prevote4689167(0);"
				
		];
		//, "archives.cbc.ca"
		
		
		jQuery(function() {
			jQuery("a[@href^=http]:not(.pds-vote-button)")
			.filter(function(el){
			for ( var i=0; i < allowedDomains.length; i++ )
				if (this.href.indexOf(allowedDomains[i])>-1 ) return false;
					return true;
			})
			.bind("click", function(){ return !window.open(this.href); });
		});
		
		
		//	popup window listeners
		/*
		if (jQuery(".popupwindow").length>-1) {
			jQuery(".popupwindow").popupwindow(profiles);
		}*/
		
		
		jQuery('.tabs>ul>li>a').click(function(e) {
			e.preventDefault();
			
			var tab_id=jQuery(this).attr('href');
			jQuery(this).parents('.tabs').next('.tab_panels').children('div').hide();
			jQuery(this).parents('.tabs').children().find('li').removeClass('active');
			jQuery(this).parent('li').addClass('active');
			jQuery(tab_id).show();
			
		});
		

	});


/*  -----------------------------------------------------------------------
    Twitter --------------------------------------------------------------- */
	
	(function(jQuery) {
	
		jQuery.fn.getTwitter = function(options) {
			var o = jQuery.extend({}, jQuery.fn.getTwitter.defaults, options);
		
			// hide container element
			jQuery(this).hide();
		
			// add heading to container element
			if (o.showHeading) {
				jQuery(this).append('<h2>'+o.headingText+'</h2>');
			}
	
			// add twitter list to container element
			jQuery(this).append('<ul id="twitter_update_list"><li></li></ul>');
	
			// hide twitter list
			jQuery("ul#twitter_update_list").hide();
	
			// add preLoader to container element
			var pl = jQuery('<p id="'+o.preloaderId+'">'+o.loaderText+'</p>');
			jQuery(this).append(pl);
	
			// add Twitter profile link to container element
			if (o.showProfileLink) {
				jQuery(this).append('<a id="profileLink" href="http://twitter.com/'+o.userName+'">http://twitter.com/'+o.userName+'</a>');
			}
	
			// show container element
			jQuery(this).show();
		
			jQuery.getScript("http://twitter.com/javascripts/blogger.js");
			jQuery.getScript("http://twitter.com/statuses/user_timeline/"+o.userName+".json?callback=twitterCallback2&count="+o.numTweets, function() {
				// remove preLoader from container element
				jQuery(pl).remove();
	
				// show twitter list
				if (o.slideIn) {
					jQuery("ul#twitter_update_list").slideDown(1000);
				}
				else {
					jQuery("ul#twitter_update_list").show();
				}
	
				// give first list item a special class
				jQuery("ul#twitter_update_list li:first").addClass("firstTweet");
	
				// give last list item a special class
				jQuery("ul#twitter_update_list li:last").addClass("lastTweet");
			});
		};
	
		// plugin defaults
		jQuery.fn.getTwitter.defaults = {
			userName: null,
			numTweets: 5,
			preloaderId: "preloader",
			loaderText: "Loading tweets...",
			slideIn: false,
			showHeading: true,
			headingText: "Latest Tweets",
			showProfileLink: true
		};
	})(jQuery);	









	//popup window
	jQuery.fn.popupwindow = function(p) {
	
		var profiles = p || {};
	
		return this.each(function(index){
			var settings, parameters, mysettings, b, a, winObj;
			
			// for overrideing the default settings
			mysettings = (jQuery(this).attr("rel") || "").split(",");
	
			
			settings = {
				height:600, // sets the height in pixels of the window.
				width:600, // sets the width in pixels of the window.
				toolbar:0, // determines whether a toolbar (includes the forward and back buttons) is displayed {1 (YES) or 0 (NO)}.
				scrollbars:0, // determines whether scrollbars appear on the window {1 (YES) or 0 (NO)}.
				status:0, // whether a status line appears at the bottom of the window {1 (YES) or 0 (NO)}.
				resizable:1, // whether the window can be resized {1 (YES) or 0 (NO)}. Can also be overloaded using resizable.
				left:0, // left position when the window appears.
				top:0, // top position when the window appears.
				center:0, // should we center the window? {1 (YES) or 0 (NO)}. overrides top and left
				createnew:1, // should we create a new window for each occurance {1 (YES) or 0 (NO)}.
				location:0, // determines whether the address bar is displayed {1 (YES) or 0 (NO)}.
				menubar:0, // determines whether the menu bar is displayed {1 (YES) or 0 (NO)}.
				onUnload:null // function to call when the window is closed
			};
	
			// if mysettings length is 1 and not a value pair then assume it is a profile declaration
			// and see if the profile settings exists
	
			if(mysettings.length == 1 && mysettings[0].split(":").length == 1)
			{
				a = mysettings[0];
				// see if a profile has been defined
				if(typeof profiles[a] != "undefined")
				{
					settings = jQuery.extend(settings, profiles[a]);
				}
			}
			else
			{
				// overrides the settings with parameter passed in using the rel tag.
				for(var i=0; i < mysettings.length; i++)
				{
					b = mysettings[i].split(":");
					if(typeof settings[b[0]] != "undefined" && b.length == 2)
					{
						settings[b[0]] = b[1];
					}
				}
			}
	
			// center the window
			if (settings.center == 1)
			{
				settings.top = (screen.height-(settings.height + 110))/2;
				settings.left = (screen.width-settings.width)/2;
			}
			
			parameters = "location=" + settings.location + ",menubar=" + settings.menubar + ",height=" + settings.height + ",width=" + settings.width + ",toolbar=" + settings.toolbar + ",scrollbars=" + settings.scrollbars  + ",status=" + settings.status + ",resizable=" + settings.resizable + ",left=" + settings.left  + ",screenX=" + settings.left + ",top=" + settings.top  + ",screenY=" + settings.top;
			
			jQuery(this).bind("click", function(){
				var name = settings.createnew ? "PopUpWindow" + index : "PopUpWindow";
				winObj = window.open(this.href, name, parameters);
				
				if (settings.onUnload) {
					// Incremental check for window status
					// Attaching directly to window.onunlaod event causes invoke when document within window is reloaded
					// (i.e. an inner refresh)
					unloadInterval = setInterval(function() {
						if (!winObj || winObj.closed) {
							clearInterval(unloadInterval);	
							settings.onUnload.call(jQuery(this));
						}
					},500);
				}
				
				winObj.focus();
				
				return false;
			});
		});
	
	};
	

/*	jquery fader plugin 
	jonathan derouchie 2009
	----------------------------------------	*/
	
	(function($){
		$.fn.fader = function(options){
	
			return this.each(function() {
				var $this = $(this), 
				defaults = {
					fade_in: 0, 
					fade_out: 0, 
					fade_time: 2500
				},
				settings = $.extend({}, defaults, options);
				
				setInterval(function() {
					if(($this).children(':visible').is(':last-child')) {
						$this.children(':visible').fadeOut(settings.fade_out,function() {
							$this.children(':first').fadeIn(settings.fade_in);});
					} else {
						$this.children(':visible').fadeOut(settings.fade_out,function() { 
							$(this).next().fadeIn(settings.fade_in); });
					}
				}, settings.fade_time);
			});
		};
	})(jQuery);
	
