// <!--
function langChk() {
    
	// gets the current page
	var URL = unescape(location.href);
	var url_query = URL.substring(URL.lastIndexOf("?")+1,URL.length);
	
	var currentURLPathname = unescape(location.pathname);
	// alert('currentURLPathname = [' + currentURLPathname  + ']');
	// alert('location.protocol = [' + location.protocol  + ']');

	var LANGID = readCookie('LANGID');	
	// alert('LANGID = [' + LANGID  + ']');
  
	if (null != LANGID & LANGID > 1) {

		switch(LANGID) {
			case '2'  : newURLPathname = '/about/events_2.html?' + url_query; break
			case '3'  : newURLPathname = '/about/events_3.html?' + url_query; break
			case '4'  : newURLPathname = '/about/events_4.html?' + url_query; break
			case '5'  : newURLPathname = '/about/events_5.html?' + url_query; break
			case '6'  : newURLPathname = '/about/events_6.html?' + url_query; break
			case '7'  : newURLPathname = '/about/events_7.html?' + url_query; break
			case '8'  : newURLPathname = '/about/events_8.html?' + url_query; break
			case '9'  : newURLPathname = '/about/events_9.html?' + url_query; break
			case '10' : newURLPathname = '/about/events_10.html?' + url_query; break
		}
		// alert('newURLPathname = [' + newURLPathname  + ']');

		var new_href;
		var ts_amat_br = '/iw-mount/default/main/www.appliedmaterials.com';
		var ts_wa = '/WORKAREA/development';
		var ts_stg = '/STAGING';

		var tst_preview_re = /zz_tst_/i;
		var ts_mount_re = /iw-mount/i;
		if ( currentURLPathname.match(ts_mount_re) ) {
			if ( currentURLPathname.match(ts_wa) ) {
				ts_area = ts_wa;
			}
			if ( currentURLPathname.match(ts_stg) ) {
				ts_area = ts_stg;
			}

			switch(LANGID) {
				case'2'  : tsURLPathname = ts_amat_br + '/China-Chinese-Simplified'   + ts_area + newURLPathname; break
				case'3'  : tsURLPathname = ts_amat_br + '/Europe-English'             + ts_area + newURLPathname; break
				case'4'  : tsURLPathname = ts_amat_br + '/India-English'              + ts_area + newURLPathname; break
				case'5'  : tsURLPathname = ts_amat_br + '/Israel-English'             + ts_area + newURLPathname; break
				case'6'  : tsURLPathname = ts_amat_br + '/Japan-Japanese'             + ts_area + newURLPathname; break
				case'7'  : tsURLPathname = ts_amat_br + '/Korea-Korean'               + ts_area + newURLPathname; break
				case'8'  : tsURLPathname = ts_amat_br + '/Malaysia-English'           + ts_area + newURLPathname; break
				case'9'  : tsURLPathname = ts_amat_br + '/Singapore-English'          + ts_area + newURLPathname; break
				case'10' : tsURLPathname = ts_amat_br + '/Taiwan-Chinese-Traditional' + ts_area + newURLPathname; break
			}
			new_href = location.protocol + '/' + '/' + location.host + tsURLPathname;
		} else {
			new_href = location.protocol + '/' + '/' + location.host + newURLPathname;
		}

		// alert('location.href = [' + location.href  + ']');
		// alert('new_href = [' + new_href  + ']');
		if (location.href != new_href )
		{
			if ( ! currentURLPathname.match(tst_preview_re) )
			{
				location.href = new_href;
				location.replace(new_href);
			}
		}
	}
}
// -->
