var create_link_openers = function(){

	var link_data = [
		{link_class:"all-production-link",					width:"863",	height:"296"}, // 2009 News
		{link_class:"xl-movie-link",						width:"760",	height:"465"},
		{link_class:"tpt-link",								width:"680",	height:"519"}, // 2009 News, Home, Exec Summary, Learning Center Pages
		{link_class:"tpt2-link",							width:"820",	height:"222"}, // 2010 News
		{link_class:"visual-time-schedule-link",			width:"1040",	height:"550"}, // 2010 News
		{link_class:"flexible-range-selection-link",		width:"820",	height:"408"}, // 2010 News
		{link_class:"tooltip-based-kpi-summary-link",		width:"552",	height:"375"}, // 2010 News
		{link_class:"tpt-chronological-link",				width:"940",	height:"793"}, // 2009 News
		{link_class:"tpt-grouped-link",						width:"940",	height:"685"}, // 2009 News
		{link_class:"tpt-zoom-in-link",						width:"940",	height:"200"}, // 2009 News
		{link_class:"downtime-analytics-link",				width:"680",	height:"532"}, // 2010 News, Home, Exec Summary, Learning Center Pages
		{link_class:"configurable-reason-codes-link",		width:"610",	height:"420"}, // 2009 News
		{link_class:"barcode-generation-link",				width:"496",	height:"448"}, // 2009 News
		{link_class:"pareto-charts-link",					width:"940",	height:"492"}, // 2009 News
		{link_class:"trend-charts-link",					width:"940",	height:"270"}, // 2009 News
		{link_class:"shift-metrics-link",					width:"600",	height:"456"}, // Home, Exec Summary, Learning Center Pages
		{link_class:"xl-web-interface-link",				width:"680",	height:"601"}, // What's New, Home
		{link_class:"oee-waterfall-link",					width:"920",	height:"240"}, // What's New
		{link_class:"oee-trend-link",						width:"920",	height:"260"}, // What's New
		{link_class:"oee-components-link",					width:"920",	height:"260"}, // What's New
		{link_class:"oee-losses-link",						width:"920",	height:"260"}, // What's New
		{link_class:"mobile-interface-link",				width:"800",	height:"540"}, // 2009 News, Home, Exec Summary, Learning Center Pages
		{link_class:"real-time-visibility-link",			width:"920",	height:"320"}, // Home
		{link_class:"performance-management-tools-link",	width:"840",	height:"520"}, // Home
		{link_class:"reporting-link",						width:"680",	height:"380"}, // Home
		{link_class:"downtime-analytics2-link",				width:"840",	height:"532"}, // Home
		{link_class:"oee-analytics-link",					width:"990",	height:"617"}, // Home
		{link_class:"plant-wide-rollup-link",				width:"931",	height:"342"}, // Home
		{link_class:"real-time-information-link",			width:"850",	height:"601"}, // Home
		{link_class:"job-on-target-link",					width:"730",	height:"270"}, // Home
		{link_class:"setup-take-longer-link",				width:"460",	height:"270"}, // Home
		{link_class:"any-lines-down-link",					width:"971",	height:"280"}, // Home
		{link_class:"plant-floor-scoreboard-link",			width:"760",	height:"450"}, // Home
		{link_class:"win-their-shift-link",					width:"690",	height:"320"}, // Home
		{link_class:"m1000-express-message-editor-link",	width:"640",	height:"490"}, // M1000 Express for Windows
		{link_class:"m1000-express-graphic-editor-link",	width:"686",	height:"531"}, // M1000 Express for Windows
		{link_class:"m1000-express-message-list-link",		width:"606",	height:"421"}, // M1000 Express for Windows
		{link_class:"m1000-express-advanced-tab-link",		width:"685",	height:"531"}, // M1000 Express for Windows
		{link_class:"m1000-express-library-link",			width:"607",	height:"389"}, // M1000 Express for Windows
		{link_class:"m1000-express-engine-link",			width:"640",	height:"333"}, // M1000 Express for Windows
		{link_class:"vdp-2000c-main-window-link",			width:"762",	height:"520"}, // Display-Pro for 2000C Series
		{link_class:"vdp-2000c-review-message-link",		width:"451",	height:"254"}, // Display-Pro for 2000C Series
		{link_class:"vdp-2000c-program-unit-link",			width:"529",	height:"504"}, // Display-Pro for 2000C Series
		{link_class:"vdp-2100-main-window-link",			width:"517",	height:"440"}, // Display-Pro 2100 Programming Utility for 2100C Series
		{link_class:"vdp-2100-send-message-link",			width:"469",	height:"450"}, // Display-Pro 2100 Programming Utility for 2100C Series
		{link_class:"vdp-2100-script-editor-link",			width:"517",	height:"440"}, // Display-Pro 2100 Programming Utility for 2100C Series
		{link_class:"clock-87-main-window-link",			width:"793",	height:"545"}, // Clock 87 Utility for 87/708 Series
		{link_class:"clock-87-options-link",				width:"516",	height:"464"}, // Clock 87 Utility for 87/708 Series
		{link_class:"clock-87-set-time-and-date-link",		width:"509",	height:"463"}, // Clock 87 Utility for 87/708 Series
		{link_class:"87-express-data-acq-single-link",		width:"640",	height:"346"}, // 87 Express Pro Software Application
		{link_class:"87-express-data-acq-all-link",			width:"640",	height:"346"}, // 87 Express Pro Software Application
		{link_class:"87-express-data-dist-single-link",		width:"640",	height:"346"}, // 87 Express Pro Software Application
		{link_class:"87-express-data-dist-all-link",		width:"641",	height:"347"}, // 87 Express Pro Software Application
		{link_class:"87-express-data-export-link",			width:"616",	height:"128"}, // 87 Express Pro Software Application
		{link_class:"oee-website-200-link",					width:"240",	height:"194"}, // Media Kits
		{link_class:"oee-website-300-link",					width:"340",	height:"271"}, // Media Kits
		{link_class:"oee-website-450-link",					width:"490",	height:"386"}, // Media Kits
		{link_class:"oee-pocket-guide-100-link",			width:"140",	height:"262"}, // Media Kits
		{link_class:"oee-pocket-guide-150-link",			width:"190",	height:"373"}, // Media Kits
		{link_class:"oee-pocket-guide-300-link",			width:"340",	height:"706"}, // Media Kits
		{link_class:"fast-guide-to-oee-150-link",			width:"190",	height:"234"}, // Media Kits
		{link_class:"fast-guide-to-oee-300-link",			width:"340",	height:"428"}, // Media Kits
		{link_class:"xl800-32240t-with-background-link",	width:"440",	height:"307"}, // Media Kits
		{link_class:"xl800-32240t-no-background-link",		width:"440",	height:"117"}, // Media Kits
		{link_class:"xl-documentation-center-link",			width:"670",	height:"445"}, // 2007 News
		{link_class:"xl800-animated-large-link",			width:"520",	height:"300"}, // 2010 News
		{link_class:"oee-website-link",						width:"1024",	height:"768"}, // Media Kits
		{link_class:"oee-pocket-guide-link",				width:"1024",	height:"768"}, // Media Kits
		{link_class:"fast-guide-to-oee-link",				width:"1024",	height:"768"}, // Media Kits
		{link_class:"xl-web-server-settings-part-link",		width:"803",	height:"743"}, // 2006 News
		{link_class:"xl-web-server-data-export-link",		width:"1024",	height:"768"}, // 2006 News
		{link_class:"xl-web-server-real-time-shift-link",	width:"600",	height:"456"} // 2006 News
		];

    function addEvent(elm, evType, fn, useCapture)
    {
        if (elm.addEventListener)
        {
            elm.addEventListener(evType, fn, useCapture);
            return true;
        }
        else if (elm.attachEvent)
        {
            var r = elm.attachEvent('on' + evType, fn);
            return r;
        }
        else
        {
            elm['on' + evType] = fn;
            return true;
        }
    }
    
    // get from DHTL Utopia: "Modern Web Design Using JavaScript & DOM"
    function stop_default(e)
    {
        if (e && e.preventDefault)
        {
            e.preventDefault();
            e.stopPropagation();
        }
        else
        {
            window.event.cancelBubble = true;
            window.event.returnValue = false;
        }
    }
   
    function getElementsByClassName(searchClass,node,tag) {
        var classElements = new Array();
        if ( node == null )
            node = document;
        if ( tag == null )
            tag = '*';
        var els = node.getElementsByTagName(tag);
        var elsLen = els.length;
        var pattern = new RegExp("(^|\\\\s)"+searchClass+"(\\\\s|$)");
        for (i = 0, j = 0; i < elsLen; i++) {
            if ( pattern.test(els[i].className) ) {
                classElements[j] = els[i];
                j++;
            }
        }
        return classElements;
    }
    
    function open_window(url,width,height)
    {
        window.open(url,'_blank','width='+width+',height='+height);
    }
        
    return {
        init: function(){
        					
			var make_event_handler = function(link_num, link_url) {
			 	return function(e){
					stop_default(e); open_window(link_url,link_data[link_num].width,link_data[link_num].height);
					};
				};
			for (var j = 0; j < link_data.length; j++) {
	            var links = getElementsByClassName(link_data[j].link_class, document);
	            for (var i = 0; i < links.length; ++i) {
	                var link = links[i];
	                addEvent(link, "click", make_event_handler(j, link.href), true);
	            }
            }
        }
    };
}();
window.onload = create_link_openers.init;
