//++ 
// include other scripts
//++ 

document.write('<script type="text/javascript" src="'+GE_baselink+'/html_view/scripts_v2/ge_nav.js"></script>');
document.write('<script type="text/javascript" src="'+GE_baselink+'/html_view/scripts_v2/ge_media_overlay.js"></script>');
document.write('<script type="text/javascript" src="'+GE_baselink+'/html_view/scripts/ge_audioPlayer.js"></script>');
document.write('<script type="text/javascript" src="'+GE_baselink+'/html_view/scripts/search_results.js"></script>');


//++ 
// sIFR
//++

var GE_Inspira_Medium_refactor = { src: GE_baselink + '/html_view/flash/GE_Inspira_Medium.swf' };
var GE_Inspira_refactor = { src: GE_baselink + '/html_view/flash/GE_Inspira.swf' };
sIFR.setPrefetchCookie = false;
sIFR.useStyleCheck = true;
sIFR.activate(GE_Inspira_Medium_refactor, GE_Inspira_refactor);
sIFR.replace(GE_Inspira_Medium_refactor, { selector: '.splash_content .page_title', wmode: 'transparent', css: {'.sIFR-root': {'color': '#333333','leading':'-1','font-size':'24px'} } });
sIFR.replace(GE_Inspira_refactor, { selector: '.splash_content p', wmode: 'transparent', css: {'.sIFR-root': {'color': '#505060','leading':'8','font-size':'17px'} } });


//++ 
// print links
//++
GE_Main.mapCSSToFn('print_link',
	function(el) {
      $(el).observe("click", function(e) {
         window.print();
		 e.stop();
      })
	}
);


//++ 
// external linking functionality
//++ 
function GE_makeExternalLink(link) {
	link.writeAttribute('title',link.readAttribute('title')+' (opens in new window)');
	link.observe('click', function(e){
		window.open(this.readAttribute('href'), 'ge_external_link');
		e.stop();
	});
}
//open external links in new window 90% of the size of current window
GE_Main.mapCSSToFn('external_link', GE_makeExternalLink);

// (ryan.rowe@frogdesign.com) class the appropriate external links with the bhv_external class for the function above
GE_Main.addInitFn( function() {

	//if (document.location.href.match("https://")) return;

	var exclude_list = new Array();
	//add to the exclude list below by pushing new strings onto the array
	exclude_list.push("://www.genewscenter.com/");
	exclude_list.push("://ir.10kwizard.com");
	exclude_list.push("://genewscenter.com/");
	exclude_list.push("://www.ge.com/");
	exclude_list.push("://video.google.com/");

	//also part of the exclude list: download links for videos, audio and pdfs
	//exclude_list.push(".pdf");
	exclude_list.push(".m4v");
	exclude_list.push(".flv");
	exclude_list.push(".mp3");
	var elen = exclude_list.length;

	var links = document.links;
	var i = links.length;
	while(i--) {
		var link = $(links[i]);

		var url = link.readAttribute("href");
		if( url.match("://") ){ //only if we match the http(s):// absolute link indicator
			var externalFlag = true; //guilty until proven innocent

			var j = elen;
			while(j--) {
				if(url.match(exclude_list[j])) {
				if(!(url.match(".pdf"))){
				if (!(url.match("ar2007/")))
				if (!(url.match("ecoreport/")))
					{
						var externalFlag = false; //innocent!
						break;
					}
				}
				}

			}

			if(externalFlag) {
				GE_makeExternalLink(link);
			}
		}
		else
			{
				if(url.match(".pdf") || url.match("ar2007/") || url.match("ar2007/"))
					{
					GE_makeExternalLink(link);
					}
			}
	}
});

