
	/**
	 * Copyright 2008 Mark. Sydney :: www.marksydney.com :: All Rights Reserved *
	 */
	
	//son of suckerfish dropdown menu 
	//IE fix to combat the fact there is no support for the :hover psuedo class
	sfHover = function() {
		var sfEls = document.getElementById("nav").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}
	if (window.attachEvent) window.attachEvent("onload", sfHover);
	
	function openWindow( tURL, tWidth, tHeight )
	{
		var tName = Math.ceil(Math.random()*100);
		window.open(tURL, tName, "width=" + tWidth + ",height=" + tHeight + ",scrollbars=yes" );
	}
	
    // function to make columns height equal
    function equalHeight(group) {
        tallest = 0;
        group.each(function() {
            thisHeight = $(this).height();
            if(thisHeight > tallest) {
                tallest = thisHeight;
            }
        });
        group.height(tallest);
    }	

	function showSurvey(url)
	{
		var evt = null, 
		elm = null; 
		
		if(document.getElementById) {
			elm = document.getElementById('btn_survey'); 
		}
		if(document.createEvent) {
			evt = document.createEvent('MouseEvents'); 
		}
		if(elm && elm.dispatchEvent && evt && evt.initMouseEvent) {
			evt.initMouseEvent( 
				'click', 
				true,     // Click events bubble 
				true,     // and they can be cancelled 
				document.defaultView,  // Use the default view 
				1,        // Just a single click 
				0,        // Don't bother with co-ordinates 
				0, 
				0, 
				0, 
				false,    // Don't apply any key modifiers 
				false, 
				false, 
				false, 
				0,        // 0 - left, 1 - middle, 2 - right 
				null);    // Click events don't have any targets other than 
			// the recipient of the click 
			elm.dispatchEvent(evt); 
		}
		else
		{
			exitSurvey(url);
		}
	} 
	
	function exitSurvey(url)
	{
		var tName = "survey";
		tSurveyWindow = window.open(url, tName, "width=" + 850 + ",height=" + 500 + ",scrollbars=yes" );
		
		if (tSurveyWindow) {
			tSurveyWindow.blur();
		}
		window.focus();
	}

// Replace any submit buttons with properly styled links
$('form input.replace-with-link').each(function(){
	var t = $(this),
		id = t.attr('id'),
		tab = t.attr('tabindex'),
		link = $('<a href="#"/>')
			.text(t.val())
			.click(function(e){
				e.preventDefault();
				$(this).parents('form').eq(0).submit();
			})
			.insertAfter(t);
	if (id) {
		link.attr('id', id);
	}
	if (tab) {
		link.attr('tabindex', tab);
	}
	t.attr('id', id + '-replaced').hide();
});

if($('#select-archive').length > 0){
	$('#select-archive').change(function(){
		var href = location.href,
			regex = /([\?&])archive=(\d{4}-\d{2})/;
		if (regex.test(href)) {
			href = href.replace(regex, '$1archive=' + $(this).val());
		} else {
			href += href.indexOf('?') > -1 ? '&' : '?';
			href += 'archive=' + $(this).val();
		}
		location.href = href;
	});
}

$(document).ready(function(){
    // make snippets height equal
    equalHeight($('.row-news, .biz-tv')); 
});