		/**
		* Locates embedded links in the tradmark and footnote values and makes them HTML hyperlinks.
		*/
		function IBMPressRoomHyperlinkURLs () {
			var divEls = document.getElementsByTagName('div');
			for (var i = 0; i < divEls.length; i++) {
				var divEl = divEls.item(i);
				if (divEl.getAttribute('id') != null && (divEl.getAttribute('id').search('div_trademark') != -1 || divEl.getAttribute('id').search('div_footnotes') != -1 || divEl.getAttribute('id').search('div_legal') != -1)) {
					var content = divEl.innerHTML; 
					content = content.replace(/https?:\/\/[\w\.\/\=\?\-\~\!\@\#\$\&\;]*/gi, function(str) {var re=/ibm.com/; var chr='<br />';var output = '';if (str.length > 60){for (var j=0; j<str.length; j++) {	if (j>0 && j%60 == 0){ output += chr;}output += str.charAt(j);}}else{output=str;}if(re.test(str)){return '<a href="' + str + '" title="' + str + '" target="0">' + output + '</a>';}else{return '<span class="nowrap"><a href="' + str + '" title="' + str + '" target="0">' + output + '</a></span>';}});
					divEl.innerHTML = content; 
				}
			}
		} 
		
function IBMPressRoomFunctionLoad(func, el) {
	if (typeof func != "function") {
		return;
	}
	if (document.getElementById(el)) {
		func();
	} else {
		window.setTimeout(function () {IBMPressRoomFunctionLoad(func, el);}, 100);
	}
}

var currentpage = location.href;	
if(currentpage.indexOf("resources.wss") > -1) {
	IBMPressRoomFunctionLoad(IBMPressRoomSortTrigger,"block-z");
}
if(currentpage.indexOf("contacts.wss") > -1) {
	IBMPressRoomFunctionLoad(IBMPressRoomContactsRegionSortTrigger,"ibm-footer");
}

function IBMPressRoomContactsRegionSortTrigger() {
	var test = document.getElementById("ibm-footer");
	if (!test) {
		setTimeout(IBMPressRoomContactsRegionSortTrigger, 200);
		return;
	}
	
	var regionsExists = document.getElementById("region-tables");
	
	if (regionsExists ) {
   		IBMPressRoomContactsRegionSort();
		IBMPressRoomRepositionContactsRegion();
		IBMPressRoomDrawHr();
	}
}

	/**
	 * Build the array from region coverage ids.
	 */
	var regionArr = new Array();
	function IBMPressRoomContactsRegionSort() {
	//alert("In IBMPressRoomContactsRegionSort");	
		for (var i = 0; i < document.getElementsByTagName('span').length; i++) {
			var span = document.getElementsByTagName('span').item(i);
			if (span.getAttribute('id') != null && span.getAttribute('id').search('region-coverage-') != -1) {
				var regionId = span.getAttribute('id');
				regionId = regionId.substring(16,regionId.length);
				
				var region = new Object();
				region.id = regionId;
				region.name = span.innerHTML;
				region.sortName = IBMPressRoomUnAccent(region.name);
				region.toString = function () {return this.name};
				
				//alert(region.id);
				//alert(region.name);
				
				var temp = new Array();
				temp[0] = region;				
				regionArr = regionArr.concat(temp);
			}
			
		}
		
		regionArr.sort(IBMPressRoomSortCountryNames);
		//alert(regionArr.join('\n'));
}

	/**
	 * Reposition the region tables based on sorted coverage
	 */
		function IBMPressRoomRepositionContactsRegion() {
		//alert("In IBMPressRoomRepositionContactsRegion"); 
		var rDiv = document.getElementById("region-tables");

		for (var i = 0; i < regionArr.length; i++) {

			var region = regionArr[i];
			//alert(region.id);
			var rtable = document.getElementById("region-table-" + region.id);
			var newTable = rtable.cloneNode(true);
			newTable.id = 'r-tb-' + region.id;
			rDiv.appendChild(newTable);

			/*if(i < regionArr.length -1){
			var rule = document.createElement('div');
			rule.className = 'ibm-rule';
			rule.innerHTML = '<hr />';
			rDiv.appendChild(rule);
			}*/
			//rtable.parentNode.removeChild(rtable.nextSibling.nextSibling);
			rtable.parentNode.removeChild(rtable);
			} 
			}
		/*
		* This function will redraw the horizontal rules after everything is repositioned and sorted
		*added Nov 10, 2008
		*author: Michael Lawson
		*/
		function IBMPressRoomDrawHr()
		{
			/*var rDiv = document.getElementById("region-tables");
			var hrArr = new Array();
			hrArr = rDiv.getElementsByTagName("div");
			
			for(var i = 0; i < hrArr.length - 1; i++)
			{
				hrArr.item(i).innerHTML = hrArr.item(i).innerHTML.concat("<span class='ibm-rule'><hr /></div>");	
			}*/
			
			jQuery('#region-tables > div:not(:last)').after('<div class="ibm-rule"><hr /></div>');
			
		}
	
function IBMPressRoomSortTrigger() {
	var test = document.getElementById("block-z");
	if (!test) {
		setTimeout(IBMPressRoomSortTrigger, 200);
		return;
	}
   	IBMPressRoomSortCountries();
	IBMPressRoomRepositionCountries();
}

	var countryArr = new Array();
	var cntryAlpha = new Array();
	var alphabets =["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"];
	
	/**
	 * Build the array from spans which are properly id'd.
	 */
	function IBMPressRoomSortCountries() {
	//alert("In IBMPressRoomSortCountries");	
		for (var i = 0; i < document.getElementsByTagName('a').length; i++) {
			var a = document.getElementsByTagName('a').item(i);
			if (a.getAttribute('id') != null && a.getAttribute('id').search('country-') != -1) {
				//alert(a);
				var country = new Object();
				var temp = new Array();
				country.a = a;
				country.id = a.getAttribute('id');
				country.name = a.innerHTML;
				country.toString = function () {return this.name + ' ' + this.a};
				country.sortName = IBMPressRoomUnAccent(country.name);
				temp[0] = country;
				countryArr = countryArr.concat(temp);
			}
		}
		
		countryArr.sort(IBMPressRoomSortCountryNames);
		//alert(countryArr.join('\n'));
	}
	
	/**
	 * For each lowercase first letter of the "name" field, make an addition to the corresponding letter div's innerHTML
	 */
	function IBMPressRoomRepositionCountries() {
		// Loop through the countries
		var prevLetter = 'a';
		var tableToAdd = new Object();
		var tb = new Object();
		var cs = 'class';
		var browser =navigator.userAgent.toLowerCase();
		var is_ie  = browser.indexOf('msie') != -1 && browser.indexOf('opera') == -1;
		if (is_ie) {cs = 'className';}
		
		for (var i = 0; i < countryArr.length; i++) {
			var country = countryArr[i];
			var temp = new Array();
			var firstLetter = country.sortName.toLocaleLowerCase().substring(0, 1);
						
			if (prevLetter != firstLetter) {
				//letter table complete
				tableToAdd.appendChild(tb);	
				prevLetter = firstLetter;
			}
					
			if(!(IBMPressRoomArrayContains(cntryAlpha,firstLetter))){
				//New next letter - push to array, get letter table
				temp[0] = firstLetter;
				cntryAlpha = cntryAlpha.concat(temp);
				//cntryAlpha.push(firstLetter);				
				tableToAdd = document.getElementById('tb-'+firstLetter);
				tb = document.createElement("div");
				
			}
			
			IBMPressRoomRemoveIdFromDOM('tr-'+country.id);
			
			//Michael Lawson Nov 4, 2008
			//changed to accomodate v16
			
			//var trToAdd1 = document.createElement("tr");
			//trToAdd1.setAttribute(cs, "bullet-list");
		
			//var tdToAddc1 = document.createElement("td");
			//tdToAddc1.setAttribute(cs, "bbl");
	
			//var tdToAddc2 = new Object(); //= document.createElement("li");
			//tdToAddc2.innerHTML = '<a href="' + country.a + '">' + country.name + '</a>';
			listItem = document.createElement("li");
			
			listItem.innerHTML = '<a class="ibm-feature-link" href="' + country.a + '">' + country.name + '</a>';
			//trToAdd1.appendChild(tdToAddc1);
			//trToAdd1.appendChild(tdToAddc2);
		
			tb.appendChild(listItem);
			
			
			
		}
		//closing last table
		tableToAdd.appendChild(tb);
				
		//hide and show alphabet links and blocks
		for (var j = 0; j < alphabets.length; j++) { 
			var a = document.getElementById('letter-'+alphabets[j]);
			var b = a.parentNode;
			b.removeChild(a);	
			if(!(IBMPressRoomArrayContains(cntryAlpha,alphabets[j]))){
				b.innerHTML += "<span class='ibm-no-anchor'>" + alphabets[j].toUpperCase() + "</span>";
			}else {
				b.innerHTML += '<a href="#' +  alphabets[j].toUpperCase() +'">' +  alphabets[j].toUpperCase() +'</a>';
			}
		}
		
		jQuery("ul:empty[id^='tb']").remove();
	}
	
	
/**
 * This function removes the parameter whether it's a string or a Node from the DOM.
*/
function IBMPressRoomRemoveIdFromDOM(id) {
	//alert("In removeIdFromDOM ");
		if (typeof(id) == 'object') {
			var node = id;
		} else if (typeof(id) == 'string') {
			var node = document.getElementById(id);
		}
		node.parentNode.removeChild(node);
}	
	
/**
	 * This function removes the parameter whether it's a string or a Node from the DOM.
*/
function IBMPressRoomSortCountryNames(a, b) {
	    var x = a.sortName.toLocaleLowerCase();
	    var y = b.sortName.toLocaleLowerCase();
	    return ((x < y) ? -1 : ((x > y) ? 1 : 0));
}

/**
//map accented characters to their non-accented counterpart
*/
function IBMPressRoomUnAccent(s) {
        s = s.replace(/[\u00c0-\u00c6\u00e0-\u00e6\u0100-\u0105\u01fa-\u01fb]/g, "a");
        s = s.replace(/[\u00c8-\u00cb\u00e8-\u00eb\u0112-\u011b\u018f\u0259]/g, "e");
        s = s.replace(/[\u00cc-\u00cf\u00ec-\u00ef\u0128-\u0131]/g, "i");
        s = s.replace(/[\u00d2-\u00d6\u00d8\u00f0\u00f2-\u00f6\u00f8\u014c-\u0151\u01a0-\u01a1\u01d1-\u01d2\u01fe-\u01ff]/g, "o");
        s = s.replace(/[\u00d9-\u00dc\u00f9-\u00fc\u0168-\u0173\u01d3-\u01dc]/g, "u");
        s = s.replace(/[\u00c6-\u00e6\u01fc-\u01fd]/g, "ae");
        s = s.replace(/[\u00e7\u0106-\u010d]/g, "c");
        s = s.replace(/[\u010e-\u0111\u00d0]/g, "d");
        s = s.replace(/[\u011c-\u0123]/g, "g");
        s = s.replace(/[\u0124-\u0127]/g, "h");
        s = s.replace(/[\u0132-\u0133]/g, "ij");
        s = s.replace(/[\u0134-\u0135]/g, "j");
        s = s.replace(/[\u0136-\u0138]/g, "k");
        s = s.replace(/[\u0139-\u0142]/g, "l");
        s = s.replace(/[\u0143-\u014b\u00f1\u00d1]/g, "n");
        s = s.replace(/[\u0152-\u0153]/g, "oe");
        s = s.replace(/[\u0154-\u0159]/g, "r");
        s = s.replace(/[\u015a-\u0161\u00df]/g, "s");
        s = s.replace(/[\u0162-\u0167]/g, "t");
        s = s.replace(/[\u0174-\u0175]/g, "w");
        s = s.replace(/[\u0176-\u0178\u00fd\u00ff\u00dd]/g, "y");
        s = s.replace(/[\u0179-\u017e]/g, "z");
	
		return s;
}

/**
//check if array contains element
*/
function IBMPressRoomArrayContains(arr, element)
{
     for (var i = 0; i < arr.length; i++) 
     {
       if (arr[i] == element) 
       {
           return true;
       }
    }
   return false;
}

//window pop-up
function IBMPressRoomOpenPopup (url,width,height,type) {
	var popupWin;
		
	var browserVersion = parseInt(jQuery.browser.version);
	var isNetscape = (navigator.userAgent.toLowerCase().indexOf("netscape") != -1)

	if ((jQuery.browser.msie && browserVersion >= 6 && !isNetscape) )
	{
		if (type == 'download-video') {	height = height + 15;}
	}		
	
	if (!popupWin || popupWin.closed) {
			popupWin = open(
				url,
				'help',
				"width="+width+",height="+height+",scrollbars=no,resizable=yes"
			);
			popupWin.focus();
	} else if (popupWin || !popupWin.closed) {
			popupWin.focus();
	}
}


function openPopup (url) {
		var popupWin;
		if (!popupWin || popupWin.closed) {
			popupWin = open(
				url,
				'help',
				"width=500,height=460,scrollbars=yes,resizable=yes"
			);
			popupWin.focus();
		} else if (popupWin || !popupWin.closed) {
			popupWin.focus();
		}
}


function IBMPressRoomExitPopup() {
var popupWin;
var URL = new String(document.URL);
//alert("URL is" + URL);
var index = URL.search(/\link=/);
if (index !== -1) {
destURL = new String(URL.slice(index+5));//CDT
//destURL = new String(URL.slice(index+4));//production and BS
//alert ("index is " + index);
//alert ("destURL " + destURL);
opener.location.href=destURL;
}

self.close() 

}
