jQuery.noConflict();

function associate_this_page_with(assocLanguage,pageURL){
  jQuery(document).ready(function(){
	var tcontainer = jQuery('#translation');
	var link = '<a href="' + pageURL + '">' + ((assocLanguage == 'en') ? 'This article in English' : 'Este articulo en Espa&ntilde;ol' ) + '</a>&nbsp;&nbsp;&nbsp;';
	tcontainer.append(link);
	setTimeout(function(){
	tcontainer.slideDown("slow");
	tcontainer.fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500);
},1000);

  });
}

jQuery(document).ready(function(){
        removeClickability();
        removeBorder();
        if(jQuery('#print-link')){
          var printEl = jQuery('#print-link');
          printEl.click(function(event){
              window.print();
          });
        }
       /* if(jQuery('div.content div.feed-item-list')){
          jQuery('div.content div.feed-item-list').cycle({ 
              fx:     'scrollRight',
              pause: 1,
              timeout: 6000
          });
        }
*/
        jQuery('#meta-2 ul li:last').css({display: 'none'});
});

function removeBorder(){
	jQuery('.contentRightColumn div.content:last').css({borderStyle : 'none'});
}

function removeClickability(){
	jQuery('#nav').find('li.level1 a').mouseover(function(){
		var linkText = jQuery(this).text();
		if(linkText.match(/^(take action|tips|know the)/i)){
			jQuery(this).replaceWith('<div>' + linkText + '</div>');
		}
	});
}

function open_image_manager(){
	var el = document.getElementById('sub-images');
	if(el.style.display == 'none'){
		el.style.display = '';
	} else {
		el.style.display = 'none';
	}
}

function create_synopsis(textToSummarize){
	var output = ((textToSummarize.length) > 300) ? (textToSummarize.substring(0,textToSummarize.indexOf(" ",280)) + '. . .' ) : textToSummarize;
	document.write(output);
}


sfHover = function() {
	var sfEls = document.getElementById("global-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"), "");
		}
	}
}
// IE-only method of attaching an event to window loading.
if (window.attachEvent) window.attachEvent("onload", sfHover);
