(function($) {
$.fn.hoverIntent = function(f, g) {
    var cfg = { sensitivity: 7, interval: 100, timeout: 0 }; cfg = $.extend(cfg, g ? { over: f, out: g} : f); var cX, cY, pX, pY; var track = function(ev) { cX = ev.pageX; cY = ev.pageY; }; var compare = function(ev, ob) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); if ((Math.abs(pX - cX) + Math.abs(pY - cY)) < cfg.sensitivity) { $(ob).unbind("mousemove", track); ob.hoverIntent_s = 1; return cfg.over.apply(ob, [ev]); } else { pX = cX; pY = cY; ob.hoverIntent_t = setTimeout(function() { compare(ev, ob); }, cfg.interval); } }; var delay = function(ev, ob) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); ob.hoverIntent_s = 0; return cfg.out.apply(ob, [ev]); }; var handleHover = function(e) {
        var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget; while (p && p != this) { try { p = p.parentNode; } catch (e) { p = this; } }
        if (p == this) { return false; }
        var ev = jQuery.extend({}, e); var ob = this; if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }
        if (e.type == "mouseover") { pX = ev.pageX; pY = ev.pageY; $(ob).bind("mousemove", track); if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout(function() { compare(ev, ob); }, cfg.interval); } } else { $(ob).unbind("mousemove", track); if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout(function() { delay(ev, ob); }, cfg.timeout); } } 
    }; return this.mouseover(handleHover).mouseout(handleHover);
};
})(jQuery);

var URI = function(uri) {
this.uri = uri; this.scheme = null; this.host = null; this.username = null; this.password = null; this.port = 0; this.path = null; this.query = null; this.fragment = null; this.variables = {}; this.ports = { 'ftp': 21, 'ssh': 22, 'telnet': 23, 'smtp': 25, 'http': 80, 'https': 443 }; var re = new RegExp("([-+a-zA-Z0-9]+)://" + "((.[^:]*):?(.*)?@)?" + "(.[^:/]*)" + ":?([0-9]{1,6})?" + "(/.[^?#]*)" + "[?]?(.[^#]*)?" + "#?(.*)?"); var m; if (this.uri && (m = re.exec(this.uri))) {
    this.scheme = m[1] && m[1].toLowerCase(); this.username = m[3]; this.password = m[4]; this.host = m[5] && m[5].toLowerCase(); this.port = m[6] && parseInt(m[6]) || 0; this.path = m[7] || "/"; this.query = m[8]; this.fragment = m[9]; if (this.port == 0 && this.scheme)
        this.port = this.ports[this.scheme]; if (this.query && this.query.length) { var q = this.query.split('&'); for (var i = 0; i < q.length; i++) { var p = q[i].split('='); this.variables[unescape(p[0])] = p.length > 1 ? unescape(p[1]) : null; } } 
} 
}; URI.prototype = { queryString: function() {
var tmp = []; for (var name in this.variables)
    tmp.push(escape(name) + "=" + escape(this.variables[name])); return tmp.length && tmp.join("&") || null;
}, toString: function()
{ var s = "", q = null; if (this.scheme) s = this.scheme + "://"; if (this.username) s += this.username; if (this.username && this.password) s += ":"; if (this.password) s += this.password; if (this.username) s += "@"; if (this.host) s += this.host; if (!this.isDefaultPort()) s += ":" + this.port; if (this.path) s += this.path; if (q = this.queryString()) s += "?" + q; if (this.fragment) s += "#" + this.fragment; return s; }, isDefaultPort: function() {
if (!this.port) return true; for (var scheme in this.ports) {
    if (scheme == this.scheme && this.port != this.ports[scheme])
        return false;
}
return true;
} 
};

; (function($) {
$.fn.media = function(options, f1, f2) {
    if (options == 'undo') {
        return this.each(function() {
            var $this = $(this); var html = $this.data('media.origHTML'); if (html)
                $this.replaceWith(html);
        });
    }
    return this.each(function() {
        if (typeof options == 'function') { f2 = f1; f1 = options; options = {}; }
        var o = getSettings(this, options); if (typeof f1 == 'function') f1(this, o); var r = getTypesRegExp(); var m = r.exec(o.src.toLowerCase()) || ['']; o.type ? m[0] = o.type : m.shift(); for (var i = 0; i < m.length; i++) {
            fn = m[i].toLowerCase(); if (isDigit(fn[0])) fn = 'fn' + fn; if (!$.fn.media[fn])
                continue; var player = $.fn.media[fn + '_player']; if (!o.params) o.params = {}; if (player) { var num = player.autoplayAttr == 'autostart'; o.params[player.autoplayAttr || 'autoplay'] = num ? (o.autoplay ? 1 : 0) : o.autoplay ? true : false; }
            var $div = $.fn.media[fn](this, o); $div.css('backgroundColor', o.bgColor).width(o.width); if (o.canUndo) { var $temp = $('<div></div>').append(this); $div.data('media.origHTML', $temp.html()); }
            if (typeof f2 == 'function') f2(this, $div[0], o, player.name); break;
        } 
    });
}; $.fn.media.mapFormat = function(format, player) { if (!format || !player || !$.fn.media.defaults.players[player]) return; format = format.toLowerCase(); if (isDigit(format[0])) format = 'fn' + format; $.fn.media[format] = $.fn.media[player]; $.fn.media[format + '_player'] = $.fn.media.defaults.players[player]; }; $.fn.media.defaults = { standards: false, canUndo: true, width: 400, height: 400, autoplay: 0, bgColor: '#ffffff', params: { wmode: 'transparent' }, attrs: {}, flvKeyName: 'file', flashvars: {}, flashVersion: '7', expressInstaller: null, flvPlayer: 'mediaplayer.swf', mp3Player: 'mediaplayer.swf', silverlight: { inplaceInstallPrompt: 'true', isWindowless: 'true', framerate: '24', version: '0.9', onError: null, onLoad: null, initParams: null, userContext: null} }; $.fn.media.defaults.players = { flash: { name: 'flash', title: 'Flash', types: 'flv,mp3,swf', mimetype: 'application/x-shockwave-flash', pluginspage: 'http://www.adobe.com/go/getflashplayer', ieAttrs: { classid: 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000', type: 'application/x-oleobject', codebase: 'http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + $.fn.media.defaults.flashVersion} }, quicktime: { name: 'quicktime', title: 'QuickTime', mimetype: 'video/quicktime', pluginspage: 'http://www.apple.com/quicktime/download/', types: 'aif,aiff,aac,au,bmp,gsm,mov,mid,midi,mpg,mpeg,mp4,m4a,psd,qt,qtif,qif,qti,snd,tif,tiff,wav,3g2,3gp', ieAttrs: { classid: 'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B', codebase: 'http://www.apple.com/qtactivex/qtplugin.cab'} }, realplayer: { name: 'real', title: 'RealPlayer', types: 'ra,ram,rm,rpm,rv,smi,smil', mimetype: 'audio/x-pn-realaudio-plugin', pluginspage: 'http://www.real.com/player/', autoplayAttr: 'autostart', ieAttrs: { classid: 'clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA'} }, winmedia: { name: 'winmedia', title: 'Windows Media', types: 'asx,asf,avi,wma,wmv', mimetype: $.browser.mozilla && isFirefoxWMPPluginInstalled() ? 'application/x-ms-wmp' : 'application/x-mplayer2', pluginspage: 'http://www.microsoft.com/Windows/MediaPlayer/', autoplayAttr: 'autostart', oUrl: 'url', ieAttrs: { classid: 'clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6', type: 'application/x-oleobject'} }, iframe: { name: 'iframe', types: 'html,pdf' }, silverlight: { name: 'silverlight', types: 'xaml'} }; function isFirefoxWMPPluginInstalled() {
    var plugs = navigator.plugins; for (var i = 0; i < plugs.length; i++) {
        var plugin = plugs[i]; if (plugin['filename'] == 'np-mswmp.dll')
            return true;
    }
    return false;
}
var counter = 1; for (var player in $.fn.media.defaults.players) { var types = $.fn.media.defaults.players[player].types; $.each(types.split(','), function(i, o) { if (isDigit(o[0])) o = 'fn' + o; $.fn.media[o] = $.fn.media[player] = getGenerator(player); $.fn.media[o + '_player'] = $.fn.media.defaults.players[player]; }); }; function getTypesRegExp() { var types = ''; for (var player in $.fn.media.defaults.players) { if (types.length) types += ','; types += $.fn.media.defaults.players[player].types; }; return new RegExp('\\.(' + types.replace(/,/ig, '|') + ')\\b'); }; function getGenerator(player) { return function(el, options) { return generate(el, options, player); }; }; function isDigit(c) { return '0123456789'.indexOf(c) > -1; }; function getSettings(el, options) { options = options || {}; var $el = $(el); var cls = el.className || ''; var meta = $.metadata ? $el.metadata() : $.meta ? $el.data() : {}; meta = meta || {}; var w = meta.width || parseInt(((cls.match(/w:(\d+)/) || [])[1] || 0)); var h = meta.height || parseInt(((cls.match(/h:(\d+)/) || [])[1] || 0)); if (w) meta.width = w; if (h) meta.height = h; if (cls) meta.cls = cls; var a = $.fn.media.defaults; var b = options; var c = meta; var p = { params: { bgColor: options.bgColor || $.fn.media.defaults.bgColor} }; var opts = $.extend({}, a, b, c); $.each(['attrs', 'params', 'flashvars', 'silverlight'], function(i, o) { opts[o] = $.extend({}, p[o] || {}, a[o] || {}, b[o] || {}, c[o] || {}); }); if (typeof opts.caption == 'undefined') opts.caption = $el.text(); opts.src = opts.src || $el.attr('href') || $el.attr('src') || 'unknown'; return opts; }; $.fn.media.swf = function(el, opts) {
    if (!window.SWFObject && !window.swfobject) {
        if (opts.flashvars) {
            var a = []; for (var f in opts.flashvars)
                a.push(f + '=' + opts.flashvars[f]); if (!opts.params) opts.params = {}; opts.params.flashvars = a.join('&');
        }
        return generate(el, opts, 'flash');
    }
    var id = el.id ? (' id="' + el.id + '"') : ''; var cls = opts.cls ? (' class="' + opts.cls + '"') : ''; var $div = $('<div' + id + cls + '>'); if (window.swfobject) { $(el).after($div).appendTo($div); if (!el.id) el.id = 'movie_player_' + counter++; swfobject.embedSWF(opts.src, el.id, opts.width, opts.height, opts.flashVersion, opts.expressInstaller, opts.flashvars, opts.params, opts.attrs); }
    else {
        $(el).after($div).remove(); var so = new SWFObject(opts.src, 'movie_player_' + counter++, opts.width, opts.height, opts.flashVersion, opts.bgColor); if (opts.expressInstaller) so.useExpressInstall(opts.expressInstaller); for (var p in opts.params)
            if (p != 'bgColor') so.addParam(p, opts.params[p]); for (var f in opts.flashvars)
            so.addVariable(f, opts.flashvars[f]); so.write($div[0]);
    }
    if (opts.caption) $('<div>').appendTo($div).html(opts.caption); return $div;
}; $.fn.media.flv = $.fn.media.mp3 = function(el, opts) { var src = opts.src; var player = /\.mp3\b/i.test(src) ? $.fn.media.defaults.mp3Player : $.fn.media.defaults.flvPlayer; var key = opts.flvKeyName; src = encodeURIComponent(src); opts.src = player; opts.src = opts.src + '?' + key + '=' + (src); var srcObj = {}; srcObj[key] = src; opts.flashvars = $.extend({}, srcObj, opts.flashvars); return $.fn.media.swf(el, opts); }; $.fn.media.xaml = function(el, opts) {
    if (!window.Sys || !window.Sys.Silverlight) { if ($.fn.media.xaml.warning) return; $.fn.media.xaml.warning = 1; return; }
    var props = { width: opts.width, height: opts.height, background: opts.bgColor, inplaceInstallPrompt: opts.silverlight.inplaceInstallPrompt, isWindowless: opts.silverlight.isWindowless, framerate: opts.silverlight.framerate, version: opts.silverlight.version }; var events = { onError: opts.silverlight.onError, onLoad: opts.silverlight.onLoad }; var id1 = el.id ? (' id="' + el.id + '"') : ''; var id2 = opts.id || 'AG' + counter++; var cls = opts.cls ? (' class="' + opts.cls + '"') : ''; var $div = $('<div' + id1 + cls + '>'); $(el).after($div).remove(); Sys.Silverlight.createObjectEx({ source: opts.src, initParams: opts.silverlight.initParams, userContext: opts.silverlight.userContext, id: id2, parentElement: $div[0], properties: props, events: events }); if (opts.caption) $('<div>').appendTo($div).html(opts.caption); return $div;
}; function generate(el, opts, player) {
    var $el = $(el); var o = $.fn.media.defaults.players[player]; if (player == 'iframe') { var o = $('<iframe' + ' width="' + opts.width + '" height="' + opts.height + '" >'); o.attr('src', opts.src); o.css('backgroundColor', o.bgColor); }
    else if ($.browser.msie) {
        var a = ['<object width="' + opts.width + '" height="' + opts.height + '" ']; for (var key in opts.attrs)
            a.push(key + '="' + opts.attrs[key] + '" '); for (var key in o.ieAttrs || {}) {
            var v = o.ieAttrs[key]; if (key == 'codebase' && window.location.protocol == 'https:')
                v = v.replace('http', 'https'); a.push(key + '="' + v + '" ');
        }
        a.push('></ob' + 'ject' + '>'); var p = ['<param name="' + (o.oUrl || 'src') + '" value="' + opts.src + '">']; for (var key in opts.params)
            p.push('<param name="' + key + '" value="' + opts.params[key] + '">'); var o = document.createElement(a.join('')); for (var i = 0; i < p.length; i++)
            o.appendChild(document.createElement(p[i]));
    }
    else if (o.standards) {
        var a = ['<object type="' + o.mimetype + '" width="' + opts.width + '" height="' + opts.height + '"']; if (opts.src) a.push(' data="' + opts.src + '" '); a.push('>'); a.push('<param name="' + (o.oUrl || 'src') + '" value="' + opts.src + '">'); for (var key in opts.params) {
            if (key == 'wmode' && player != 'flash')
                continue; a.push('<param name="' + key + '" value="' + opts.params[key] + '">');
        }
        a.push('<div><p><strong>' + o.title + ' Required</strong></p><p>' + o.title + ' is required to view this media. <a href="' + o.pluginspage + '">Download Here</a>.</p></div>'); a.push('</ob' + 'ject' + '>');
    }
    else {
        var a = ['<embed width="' + opts.width + '" height="' + opts.height + '" style="display:block"']; if (opts.src) a.push(' src="' + opts.src + '" '); for (var key in opts.attrs)
            a.push(key + '="' + opts.attrs[key] + '" '); for (var key in o.eAttrs || {})
            a.push(key + '="' + o.eAttrs[key] + '" '); for (var key in opts.params) {
            if (key == 'wmode' && player != 'flash')
                continue; a.push(key + '="' + opts.params[key] + '" ');
        }
        a.push('></em' + 'bed' + '>');
    }
    var id = el.id ? (' id="' + el.id + '"') : ''; var cls = opts.cls ? (' class="' + opts.cls + '"') : ''; var $div = $('<div' + id + cls + '>'); $el.after($div).remove(); ($.browser.msie || player == 'iframe') ? $div.append(o) : $div.html(a.join('')); if (opts.caption) $('<div>').appendTo($div).html(opts.caption); return $div;
};
})(jQuery);

; (function() {
var $$; $$ = jQuery.fn.flash = function(htmlOptions, pluginOptions, replace, update) {
    var block = replace || $$.replace; pluginOptions = $$.copy($$.pluginOptions, pluginOptions); if (!$$.hasFlash(pluginOptions.version)) { if (pluginOptions.expressInstall && $$.hasFlash(6, 0, 65)) { var expressInstallOptions = { flashvars: { MMredirectURL: location, MMplayerType: 'PlugIn', MMdoctitle: jQuery('title').text()} }; } else if (pluginOptions.update) { block = update || $$.update; } else { return this; } }
    htmlOptions = $$.copy($$.htmlOptions, expressInstallOptions, htmlOptions); return this.each(function() { block.call(this, $$.copy(htmlOptions)); });
}; $$.copy = function() {
    var options = {}, flashvars = {}; for (var i = 0; i < arguments.length; i++) { var arg = arguments[i]; if (arg == undefined) continue; jQuery.extend(options, arg); if (arg.flashvars == undefined) continue; jQuery.extend(flashvars, arg.flashvars); }
    options.flashvars = flashvars; return options;
}; $$.hasFlash = function() {
    if (/hasFlash\=true/.test(location)) return true; if (/hasFlash\=false/.test(location)) return false; var pv = $$.hasFlash.playerVersion().match(/\d+/g); var rv = String([arguments[0], arguments[1], arguments[2]]).match(/\d+/g) || String($$.pluginOptions.version).match(/\d+/g); for (var i = 0; i < 3; i++) { pv[i] = parseInt(pv[i] || 0); rv[i] = parseInt(rv[i] || 0); if (pv[i] < rv[i]) return false; if (pv[i] > rv[i]) return true; }
    return true;
}; $$.hasFlash.playerVersion = function() {
    try {
        try {
            var axo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6'); try { axo.AllowScriptAccess = 'always'; }
            catch (e) { return '6,0,0'; } 
        } catch (e) { }
        return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').replace(/\D+/g, ',').match(/^,?(.+),?$/)[1];
    } catch (e) { try { if (navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin) { return (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g, ",").match(/^,?(.+),?$/)[1]; } } catch (e) { } }
    return '0,0,0';
}; $$.htmlOptions = { height: 240, flashvars: {}, pluginspage: 'http://www.adobe.com/go/getflashplayer', src: '#', type: 'application/x-shockwave-flash', width: 320 }; $$.pluginOptions = { expressInstall: false, update: true, version: '6.0.65' }; $$.replace = function(htmlOptions) { this.innerHTML = '<div class="alt">' + this.innerHTML + '</div>'; jQuery(this).addClass('flash-replaced').prepend($$.transform(htmlOptions)); }; $$.update = function(htmlOptions) { var url = String(location).split('?'); url.splice(1, 0, '?hasFlash=true&'); url = url.join(''); var msg = '<p>This content requires the Flash Player. <a href="http://www.adobe.com/go/getflashplayer">Download Flash Player</a>. Already have Flash Player? <a href="' + url + '">Click here.</a></p>'; this.innerHTML = '<span class="alt">' + this.innerHTML + '</span>'; jQuery(this).addClass('flash-update').prepend(msg); }; function toAttributeString() {
    var s = ''; for (var key in this)
        if (typeof this[key] != 'function')
        s += key + '="' + this[key] + '" '; return s;
}; function toFlashvarsString() {
    var s = ''; for (var key in this)
        if (typeof this[key] != 'function')
        s += key + '=' + encodeURIComponent(this[key]) + '&'; return s.replace(/&$/, '');
}; $$.transform = function(htmlOptions) { htmlOptions.toString = toAttributeString; if (htmlOptions.flashvars) htmlOptions.flashvars.toString = toFlashvarsString; return '<embed ' + String(htmlOptions) + '/>'; }; if (window.attachEvent) { window.attachEvent("onbeforeunload", function() { __flash_unloadHandler = function() { }; __flash_savedUnloadHandler = function() { }; }); } 
})();

(function($, window) {
var 
defaults = { transition: "elastic", speed: 300, width: false, initialWidth: "600", innerWidth: false, maxWidth: false, height: false, initialHeight: "450", innerHeight: false, maxHeight: false, scalePhotos: true, scrolling: true, inline: false, html: false, iframe: false, photo: false, href: false, title: false, rel: false, opacity: 0.9, preloading: true, current: "image {current} of {total}", previous: "previous", next: "next", close: "close", open: false, loop: true, slideshow: false, slideshowAuto: true, slideshowSpeed: 2500, slideshowStart: "start slideshow", slideshowStop: "stop slideshow", onOpen: false, onLoad: false, onComplete: false, onCleanup: false, onClosed: false, overlayClose: true, escKey: true, arrowKey: true }, colorbox = 'colorbox', prefix = 'cbox', event_open = prefix + '_open', event_load = prefix + '_load', event_complete = prefix + '_complete', event_cleanup = prefix + '_cleanup', event_closed = prefix + '_closed', isIE = $.browser.msie && !$.support.opacity, isIE6 = isIE && $.browser.version < 7, event_ie6 = prefix + '_IE6', $overlay, $box, $wrap, $content, $topBorder, $leftBorder, $rightBorder, $bottomBorder, $related, $window, $loaded, $loadingBay, $loadingOverlay, $title, $current, $slideshow, $next, $prev, $close, interfaceHeight, interfaceWidth, loadedHeight, loadedWidth, element, bookmark, index, settings, open, active, publicMethod, boxElement = prefix + 'Element'; function $div(id, css) { id = id ? ' id="' + prefix + id + '"' : ''; css = css ? ' style="' + css + '"' : ''; return $('<div' + id + css + '/>'); }
function setSize(size, dimension) { dimension = dimension === 'x' ? $window.width() : $window.height(); return (typeof size === 'string') ? Math.round((size.match(/%/) ? (dimension / 100) * parseInt(size, 10) : parseInt(size, 10))) : size; }
function isImage(url) { url = $.isFunction(url) ? url.call(element) : url; return settings.photo || url.match(/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i); }
function process() {
    for (var i in settings) { if ($.isFunction(settings[i]) && i.substring(0, 2) !== 'on') { settings[i] = settings[i].call(element); } }
    settings.rel = settings.rel || element.rel || 'nofollow'; settings.href = settings.href || $(element).attr('href'); settings.title = settings.title || element.title;
}
function launch(elem) {
    element = elem; settings = $.extend({}, $(element).data(colorbox)); process(); if (settings.rel !== 'nofollow') { $related = $('.' + boxElement).filter(function() { var relRelated = $(this).data(colorbox).rel || this.rel; return (relRelated === settings.rel); }); index = $related.index(element); if (index === -1) { $related = $related.add(element); index = $related.length - 1; } } else { $related = $(element); index = 0; }
    if (!open) {
        open = active = true; bookmark = element; try { bookmark.blur(); } catch (e) { }
        $.event.trigger(event_open); if (settings.onOpen) { settings.onOpen.call(element); }
        $overlay.css({ "opacity": +settings.opacity, "cursor": settings.overlayClose ? "pointer" : "auto" }).show(); settings.w = setSize(settings.initialWidth, 'x'); settings.h = setSize(settings.initialHeight, 'y'); publicMethod.position(0); if (isIE6) { $window.bind('resize.' + event_ie6 + ' scroll.' + event_ie6, function() { $overlay.css({ width: $window.width(), height: $window.height(), top: $window.scrollTop(), left: $window.scrollLeft() }); }).trigger('scroll.' + event_ie6); } 
    }
    $current.add($prev).add($next).add($slideshow).add($title).hide(); $close.html(settings.close).show(); publicMethod.slideshow(); publicMethod.load();
}
publicMethod = $.fn[colorbox] = $[colorbox] = function(options, callback) {
    var $this = this; if (!$this[0] && $this.selector) { return $this; }
    options = options || {}; if (callback) { options.onComplete = callback; }
    if (!$this[0] || $this.selector === undefined) { $this = $('<a/>'); options.open = true; }
    $this.each(function() { $(this).data(colorbox, $.extend({}, $(this).data(colorbox) || defaults, options)).addClass(boxElement); }); if (options.open) { launch($this[0]); }
    return $this;
}; publicMethod.init = function() {
    $window = $(window); $box = $div().attr({ id: colorbox, 'class': isIE ? prefix + 'IE' : '' }); $overlay = $div("Overlay", isIE6 ? 'position:absolute' : '').hide(); $wrap = $div("Wrapper"); $content = $div("Content").append($loaded = $div("LoadedContent", 'width:0; height:0'), $loadingOverlay = $div("LoadingOverlay").add($div("LoadingGraphic")), $title = $div("Title"), $current = $div("Current"), $next = $div("Next"), $prev = $div("Previous"), $slideshow = $div("Slideshow"), $close = $div("Close")); $wrap.append($div().append($div("TopLeft"), $topBorder = $div("TopCenter"), $div("TopRight")), $div().append($leftBorder = $div("MiddleLeft"), $content, $rightBorder = $div("MiddleRight")), $div().append($div("BottomLeft"), $bottomBorder = $div("BottomCenter"), $div("BottomRight"))).children().children().css({ 'float': 'left' }); $loadingBay = $div(false, 'position:absolute; width:9999px; visibility:hidden; display:none'); $('body').prepend($overlay, $box.append($wrap, $loadingBay)); $content.children().hover(function() { $(this).addClass('hover'); }, function() { $(this).removeClass('hover'); }).addClass('hover'); interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(true) - $content.height(); interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(true) - $content.width(); loadedHeight = $loaded.outerHeight(true); loadedWidth = $loaded.outerWidth(true); $box.css({ "padding-bottom": interfaceHeight, "padding-right": interfaceWidth }).hide(); $next.click(publicMethod.next); $prev.click(publicMethod.prev); $close.click(publicMethod.close); $content.children().removeClass('hover'); $('.' + boxElement).live('click', function(e) { if ((e.button !== 0 && typeof e.button !== 'undefined') || e.ctrlKey || e.shiftKey || e.altKey) { return true; } else { launch(this); return false; } }); $overlay.click(function() { if (settings.overlayClose) { publicMethod.close(); } }); $(document).bind("keydown", function(e) {
        if (open && settings.escKey && e.keyCode === 27) { e.preventDefault(); publicMethod.close(); }
        if (open && settings.arrowKey && !active && $related[1]) { if (e.keyCode === 37 && (index || settings.loop)) { e.preventDefault(); $prev.click(); } else if (e.keyCode === 39 && (index < $related.length - 1 || settings.loop)) { e.preventDefault(); $next.click(); } } 
    });
}; publicMethod.remove = function() { $box.add($overlay).remove(); $('.' + boxElement).die('click').removeData(colorbox).removeClass(boxElement); }; publicMethod.position = function(speed, loadedCallback) {
    var 
animate_speed, posTop = Math.max($window.height() - settings.h - loadedHeight - interfaceHeight, 0) / 2 + $window.scrollTop(), posLeft = Math.max($window.width() - settings.w - loadedWidth - interfaceWidth, 0) / 2 + $window.scrollLeft(); animate_speed = ($box.width() === settings.w + loadedWidth && $box.height() === settings.h + loadedHeight) ? 0 : speed; $wrap[0].style.width = $wrap[0].style.height = "9999px"; function modalDimensions(that) { $topBorder[0].style.width = $bottomBorder[0].style.width = $content[0].style.width = that.style.width; $loadingOverlay[0].style.height = $loadingOverlay[1].style.height = $content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = that.style.height; }
    $box.dequeue().animate({ width: settings.w + loadedWidth, height: settings.h + loadedHeight, top: posTop, left: posLeft }, { duration: animate_speed, complete: function() { modalDimensions(this); active = false; $wrap[0].style.width = (settings.w + loadedWidth + interfaceWidth) + "px"; $wrap[0].style.height = (settings.h + loadedHeight + interfaceHeight) + "px"; if (loadedCallback) { loadedCallback(); } }, step: function() { modalDimensions(this); } });
}; publicMethod.resize = function(options) {
    if (open) {
        options = options || {}; var isIE6 = $.browser.msie && $.browser.version.substr(0, 1) < 7; if (options.width) { settings.w = setSize(options.width, 'x') - loadedWidth - interfaceWidth; }
        if (options.innerWidth) { settings.w = setSize(options.innerWidth, 'x'); }
        if (!options.innerWidth && !options.width) {
            var $child = $loaded.wrapInner("<div style='overflow:auto'></div>").children(); if (isIE6)
            { settings.w = $child.width() + 1; }
            else
            { settings.w = $child.width(); }
            $child.replaceWith($child.children());
        }
        $loaded.css({ width: settings.w }); if (options.height) { settings.h = setSize(options.height, 'y') - loadedHeight - interfaceHeight; }
        if (options.innerHeight) { settings.h = setSize(options.innerHeight, 'y'); }
        if (!options.innerHeight && !options.height) {
            var $child = $loaded.wrapInner("<div style='overflow:auto'></div>").children(); if (isIE6)
            { settings.h = $child.height() + 1; }
            else
            { settings.h = $child.height(); }
            $child.replaceWith($child.children());
        }
        $loaded.css({ height: settings.h }); publicMethod.position(settings.transition === "none" ? 0 : settings.speed);
    } 
}; publicMethod.prep = function(object) {
    if (!open) { return; }
    var photo, speed = settings.transition === "none" ? 0 : settings.speed; $window.unbind('resize.' + prefix); $loaded.remove(); $loaded = $div('LoadedContent').html(object); function getWidth() { settings.w = settings.w || $loaded.width(); settings.w = settings.mw && settings.mw < settings.w ? settings.mw : settings.w; return settings.w; }
    function getHeight() { settings.h = settings.h || $loaded.height(); settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h; return settings.h; }
    $loaded.hide().appendTo($loadingBay.show()).css({ width: getWidth(), overflow: settings.scrolling ? 'auto' : 'hidden' }).css({ height: getHeight() }).prependTo($content); $loadingBay.hide(); $('#' + prefix + 'Photo').css({ cssFloat: 'none' }); if (isIE6) { $('select').not($box.find('select')).filter(function() { return this.style.visibility !== 'hidden'; }).css({ 'visibility': 'hidden' }).one(event_cleanup, function() { this.style.visibility = 'inherit'; }); }
    function setPosition(s) {
        var prev, prevSrc, next, nextSrc, total = $related.length, loop = settings.loop; publicMethod.position(s, function() {
            function defilter() { if (isIE) { $box[0].style.removeAttribute("filter"); } }
            if (!open) { return; }
            if (isIE) { if (photo) { $loaded.fadeIn(100); } }
            if (settings.iframe) { $("<iframe frameborder=0" + (settings.scrolling ? "" : " scrolling='no'") + (isIE ? " allowtransparency='true'" : '') + "/>").attr({ src: settings.href, name: new Date().getTime() }).appendTo($loaded); }
            $loaded.show(); $title.show().html(settings.title); if (total > 1) {
                $current.html(settings.current.replace(/\{current\}/, index + 1).replace(/\{total\}/, total)).show(); $next[(loop || index < total - 1) ? "show" : "hide"]().html(settings.next); $prev[(loop || index) ? "show" : "hide"]().html(settings.previous); prev = index ? $related[index - 1] : $related[total - 1]; next = index < total - 1 ? $related[index + 1] : $related[0]; if (settings.slideshow) { $slideshow.show(); if (index === total - 1 && !loop && $box.is('.' + prefix + 'Slideshow_on')) { $slideshow.click(); } }
                if (settings.preloading) {
                    nextSrc = $(next).data(colorbox).href || next.href; prevSrc = $(prev).data(colorbox).href || prev.href; if (isImage(nextSrc)) { $('<img/>')[0].src = nextSrc; }
                    if (isImage(prevSrc)) { $('<img/>')[0].src = prevSrc; } 
                } 
            }
            $loadingOverlay.hide(); if (settings.transition === 'fade') { $box.fadeTo(speed, 1, function() { defilter(); }); } else { defilter(); }
            $window.bind('resize.' + prefix, function() { publicMethod.position(0); }); $.event.trigger(event_complete); if (settings.onComplete) { settings.onComplete.call(element); } 
        });
    }
    if (settings.transition === 'fade') { $box.fadeTo(speed, 0, function() { setPosition(0); }); } else { setPosition(speed); } 
}; publicMethod.load = function() {
    var href, img, setResize, prep = publicMethod.prep; active = true; element = $related[index]; settings = $.extend({}, $(element).data(colorbox)); process(); $.event.trigger(event_load); if (settings.onLoad) { settings.onLoad.call(element); }
    settings.h = settings.height ? setSize(settings.height, 'y') - loadedHeight - interfaceHeight : settings.innerHeight && setSize(settings.innerHeight, 'y'); settings.w = settings.width ? setSize(settings.width, 'x') - loadedWidth - interfaceWidth : settings.innerWidth && setSize(settings.innerWidth, 'x'); settings.mw = settings.w; settings.mh = settings.h; if (settings.maxWidth) { settings.mw = setSize(settings.maxWidth, 'x') - loadedWidth - interfaceWidth; settings.mw = settings.w && settings.w < settings.mw ? settings.w : settings.mw; }
    if (settings.maxHeight) { settings.mh = setSize(settings.maxHeight, 'y') - loadedHeight - interfaceHeight; settings.mh = settings.h && settings.h < settings.mh ? settings.h : settings.mh; }
    href = settings.href; $loadingOverlay.show(); if (settings.inline) { $div('InlineTemp').hide().insertBefore($(href)[0]).bind(event_load + ' ' + event_cleanup, function() { $(this).replaceWith($loaded.children()); }); prep($(href)); } else if (settings.iframe) { prep(" "); } else if (settings.html) { prep(settings.html); } else if (isImage(href)) {
        img = new Image(); img.onload = function() {
            var percent; img.onload = null; img.id = prefix + 'Photo'; $(img).css({ margin: 'auto', border: 'none', display: 'block', cssFloat: 'left' }); if (settings.scalePhotos) {
                setResize = function() { img.height -= img.height * percent; img.width -= img.width * percent; }; if (settings.mw && img.width > settings.mw) { percent = (img.width - settings.mw) / img.width; setResize(); }
                if (settings.mh && img.height > settings.mh) { percent = (img.height - settings.mh) / img.height; setResize(); } 
            }
            if (settings.h) { img.style.marginTop = Math.max(settings.h - img.height, 0) / 2 + 'px'; }
            setTimeout(function() { prep(img); }, 1); if ($related[1] && (index < $related.length - 1 || settings.loop)) { $(img).css({ cursor: 'pointer' }).click(publicMethod.next); }
            if (isIE) { img.style.msInterpolationMode = 'bicubic'; } 
        }; img.src = href;
    } else { $div().appendTo($loadingBay).load(href, function(data, status, xhr) { prep(status === 'error' ? 'Request unsuccessful: ' + xhr.statusText : this); }); } 
}; publicMethod.next = function() { if (!active) { index = index < $related.length - 1 ? index + 1 : 0; publicMethod.load(); } }; publicMethod.prev = function() { if (!active) { index = index ? index - 1 : $related.length - 1; publicMethod.load(); } }; publicMethod.slideshow = function() {
    var stop, timeOut, className = prefix + 'Slideshow_'; $slideshow.bind(event_closed, function() { $slideshow.unbind(); clearTimeout(timeOut); $box.removeClass(className + "off " + className + "on"); }); function start() { $slideshow.text(settings.slideshowStop).bind(event_complete, function() { timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed); }).bind(event_load, function() { clearTimeout(timeOut); }).one("click", function() { stop(); }); $box.removeClass(className + "off").addClass(className + "on"); }
    stop = function() { clearTimeout(timeOut); $slideshow.text(settings.slideshowStart).unbind(event_complete + ' ' + event_load).one("click", function() { start(); timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed); }); $box.removeClass(className + "on").addClass(className + "off"); }; if (settings.slideshow && $related[1]) { if (settings.slideshowAuto) { start(); } else { stop(); } } 
}; publicMethod.close = function() {
    if (open) {
            $('#flashControlContainer').replaceWith('');
        open = false; $.event.trigger(event_cleanup); if (settings.onCleanup) { settings.onCleanup.call(element); }
        $window.unbind('.' + prefix + ' .' + event_ie6); $overlay.fadeTo('fast', 0); $box.stop().fadeTo('fast', 0, function() {
            $box.find('iframe').attr('src', 'about:blank'); $loaded.remove(); $box.add($overlay).css({ 'opacity': 1, cursor: 'auto' }).hide(); try { bookmark.focus(); } catch (e) { }
            setTimeout(function() { $.event.trigger(event_closed); if (settings.onClosed) { settings.onClosed.call(element); } }, 1);
        });
    } 
}; publicMethod.element = function() { return $(element); }; publicMethod.settings = defaults; $(publicMethod.init);
} (jQuery, this));


$(function() {backToUnsubscribeMethod('.backToUnsubscribe'); callRssTrackMethod('.rssTrackForWT'); makeLargeClickArea('.newsItem'); makeHoverBox('.tnHoverInfo', true, false); makeHoverBox('.wmLocationInfo', false, true); makeSlideMenu('#shareLinksButton', '#shareLinks'); makeExpandableList('.elOverview', '.elDetail'); 
makeAccordian('.#quickLinksSide .quickLinks>ul>li>a', '.qlList ul'); makeRadioExpandableList('.expandingList', 'radioGroup00', '.subOptions'); initPopUps(); initTextareaCounter('.fTextArea', '.charCounter'); makeScroller('#timelineNav ul', '#timelineNav .prevNav', '#timelineNav .nextNav', '#tnCurrent'); makeScroller('.imageScroller ul', '.imageScroller .prevNav', '.imageScroller .nextNav'); makeScroller('#brandsSelector ul', '#brandsSelector .prevNav', '#brandsSelector .nextNav'); makeCarousel('.brandsContainer', '#brandsSelector ul a', 'selectedBrand'); makeCarousel('#newsSelectorContainer', '#newsSelectorArticlesList ul a', 'selectedNewsItem', 'selected'); makeCarousel('#pressReleaseDetails', '#paginatorOne a.num', 'selected', 'selected'); makeCollapsibleTree('#siteMap', '.parent', function(item) { item.parents('.siteMapRow').find('dd').setToEqualHeight(); }); makeLinkNavigators('#paginatorOne li:has(a.num)', '.selected', '#paginatorOne .back', '#paginatorOne .next'); makeDefaultTextSwap('.swapDefault'); makeRadioIconCheck('.fRadio.withIcon'); makeNavQuickLink('#pageContentTools .iconShare', '#shareLinksSide'); makeNavQuickLink('#pageContentTools .iconDownload', '#downloads'); centerChild('#brandsSelector ul'); });$(window).load(function() { try { $('.mainColHalf .container').setToEqualHeight(); $('#templateTwoCol .featuresRow .container').setToEqualHeight(); $('.centerColHalf .container').setToEqualHeight(); $('.firstRow .centerColHalf .container').setToEqualHeight(); $('.secondRow .centerColHalf .container').setToEqualHeight(); $('.contentIntroForm:not(.unBalanced) .container').setToEqualHeight(); } catch (Error) { } });  function initPopUps() { $('#help').click(function() { $('#whatAreThese').show(); return false; }); $('.showPopUp').click(function() { $('.showVideo').show(); return false; }); $('.sendToFriendPopUp').click(function() { $('#prSendToFriend').show(); return false; }); $('.subscribePopUp').click(function() { $('#prSubscribe').show(); return false; }); $('.relatedImages').click(function() { $('#relatedImages').show(); return false; }); $('.enlargeImage').click(function() { $('#recipeZoom').show(); return false; }); $('.recipeCard').click(function() { $('#recipeCard').show(); return false; }); $('.recipeCardSend').click(function() { $('#recipeCardSend').show(); return false; }); $('.recipeCardRate').click(function() { $('#recipeCardRate').show(); return false; }); $('.showVideoPub').click(function() { $('.multimedia').show(); return false; }); $('.cRecipe').click(function() { $('#recipeSearchCard').show(); return false; }); $('.cGlossary').click(function() { $('#recipeSearchCard').show(); return false; }); $('.viewData').click(function() { $('#csvKpiData').show(); return false; }); $('.showContactCard').click(function() { $('#relatedContacts').show(); return false; }); $('.showChemicalCard').click(function() { $('#chemicalCard').show(); return false; }); $('.showMeasurementCard').click(function() { $('#measurementCard').show(); return false; }); $('#helpFooter').click(function() { $('#whatAreThese').show(); return false; }); $('.popUpBox .closeBox,.popUpBox .close,.popUpBox .pubFade,.surveyNo').click(function() { $(this).closest('.popUpBox').hide().children().hide().show(); return false; }); $('a.ajaxPopup').live('click', function() { $('.popUpBox').addClass('loading').show().find('.pubContent').hide().load($(this).attr('href') + ' .pubContent >*', function() { $('.popUpBox').removeClass('loading').find('.pubContent').slideDown(); }); return false; }); }
function makeHoverBox(box, separate, hideOthers) {
var myChild; $('a:has(' + box + ')').hover(function() {
    myChild = $(this).children(box); if (separate) myChild.appendTo('body').css({ position: 'absolute', left: $(this).offset().left + 'px', top: $(this).offset().top + $(this).outerHeight() + 10 + 'px' })
    myChild.show(); if (hideOthers) $('a:has(' + box + ')').not(this).hide();
}, function() {
    if (separate) myChild.css({ left: '', top: '', zIndex: 200 }).appendTo(this)
    myChild.hide(); if (hideOthers) $('a:has(' + box + ')').not(this).show();
});
}
function makeRadioIconCheck(e) {
$(e).click(function() {
    $(e).siblings('label').removeClass('checked'); if ($(this).attr('checked'))
        $(this).siblings('label').addClass('checked'); else
        $(this).siblings('label').removeClass('checked');
});
}
function backToUnsubscribeMethod(e) { $(e).click(function() { window.history.back(); });}

function callRssTrackMethod(e) { $(e).click(function() { dcsMultiTrack('DCS.dcsuri', this.nameProp, 'WT.ti', this.outerText, 'WT.rss_ev', 's','WT.rss_f', this.outerText, 'WT.dl', '10');return true; }); }

function makeLargeClickArea(e) { $(e).click(function() { document.location = $(this).find('a:first').attr('href'); return false; }); }

function makeAccordian(a, c) {
$(c).hide(); $(a).click(function() {
    var s = $(this).parent().find(c); if (s.is(':visible')) { s.slideUp(); $(this).parent().removeClass('selected'); }
    else { s.slideDown(); $(this).parent().addClass('selected'); }
    return false;
});
}
function makeExpandableList(o, d) {
$(d).hide(); $(o).click(function() {
    $('li.selected:has(' + o + ')').find(d).slideUp(); if (!$(this).parent().hasClass('selected')) { $(this).siblings(d).slideDown().parent().addClass('selected'); }
    else { $(this).parent().removeClass('selected'); }
    $(this).parent().siblings().removeClass('selected'); return false;
});
}
function makeRadioExpandableList(container, group, sub) {
$(':radio[name=' + group + ']').click(function() {
    $(':radio[name=' + group + ']').each(function() {
        if ($(this).attr('checked')) { $(this).parents(container).find(sub).slideDown().find(':radio:first').attr('checked', true); }
        else { $(this).parents(container).find(sub).slideUp().find(':radio').attr('checked', false); } 
    });
}).filter(':checked').triggerHandler('click');
}
function makeSlideMenu(b, c) { $(c).hide(); $(b).click(function() { $(c).slideDown(); return false; }); $(c + ' .closeBox').click(function() { $(c).slideUp(); return false; }); }
function makeNavQuickLink(link, target) { $(link).click(function() { $(target).css({ position: 'absolute', left: $("#pageContentTools .iconDownload").position().left + 'px', top: $(link).position().top + 'px' }).slideDown(); $(this).blur(); return false; }); $(target).hide().find('.closeBox').click(function() { $(this).closest(target).slideUp(); return false; }); }
function initTextareaCounter(container, chars) {
$(container).each(function() {
    var maxChars = $(this).find(chars).text() * 1; $(this).find('textarea').bind('keyup blur', function() {
        if ($(this).val().length > maxChars) { $(this).val($(this).val().substring(0, maxChars)) }
        $(this).parents(container).find(chars).text(maxChars - $(this).val().length).parent().removeClass('fErrorMessage').addClass(((maxChars - $(this).val().length) < 0 ? 'fErrorMessage' : ''));
    }).blur();
});
}
function makeScroller(scroller, left, right, current) {
if ($(scroller).length == 0) return; var index = 0; var step = 1; var speed = 200; var width = $(scroller).outerWidth(); var childWidths = $(scroller).childWidths(); $(scroller).css({ width: childWidths + 'px' }); var scrollWrapper = $('<div></div>').css({ display: 'block', position: 'relative', width: width + 'px', height: $(scroller).outerHeight() + 4 + 'px', float: $(scroller).css('float'), overflow: 'hidden' }); $(scroller).wrap(scrollWrapper); if (childWidths <= width) { $(left).add(right).addClass('hidden'); return; }
var checkDisabled = function() {
    if (index == 0) { $(left).addClass('disabled'); }
    else { $(left).removeClass('disabled'); }
    if ($(scroller).width() - $(scroller).parent().scrollLeft() <= $(scroller).parent().width()) { $(right).addClass('disabled'); }
    else { $(right).removeClass('disabled'); } 
}; checkDisabled(); $(left).click(function() {
    if ($(scroller).children().eq(index - step).position()) { $(scroller).parent().animate({ scrollLeft: $(scroller).children().eq(index -= step).position().left }, speed, 'swing', checkDisabled); }
    return false;
}); $(right).click(function() {
    if ($(scroller).width() - $(scroller).parent().scrollLeft() > $(scroller).parent().width()) { if ($(scroller).children().eq(index + step).position()) { $(scroller).parent().animate({ scrollLeft: $(scroller).children().eq(index += step).position().left }, speed, 'swing', checkDisabled); } }
    return false;
}); if (current != undefined) { while (($(current).position().left + $(current).width()) > (width + $(scroller).parent().scrollLeft())) { $(scroller).parent().scrollLeft($(scroller).children().eq(index += step).position().left); checkDisabled(); } } 
}
function makeCarousel(container, links, activeClass, linkActiveClass) {

$(container).scrollTop(0); $(container).css({ position: 'relative' }).find('>*').css({ position: 'absolute', top: '0px' }); $(links).click(function() {
    var id = $(this).attr('hash'); if (!id) return false; 
    
  $.each( ['newsItem0','newsItem1','newsItem2','newsItem3','newsItem4'], function(i, l){ 
  if ($("#" + l) != undefined && $("#" + l).find('span')!= undefined && $("#" + l).find('span').length != 0)
   {
	 	if ($("#" + l).find('span:last') != undefined && $("#" + l).find('span:last')[0].innerHTML != '')
        {
          $("#" + l).find('span:first')[0].innerHTML = $("#" + l).find('span:last')[0].innerHTML;
          $("#" + l).find('span:last')[0].innerHTML = '';
        }
    }
  });

    
    if ($(id).hasClass(activeClass)) { var link = $(id).find('a:first').click(); return false; }
    $(this).blur()
    if (linkActiveClass)
        $(this).parent().addClass(linkActiveClass).siblings().removeClass(linkActiveClass); else
        $(this).parent().fadeTo('fast', .3).siblings().fadeTo('fast', 1); $(id).siblings().not('.' + activeClass).hide(); var old = $(container).find('.' + activeClass).removeClass(activeClass).css({ zIndex: 99 }); $(id).css({ zIndex: 100 }).addClass(activeClass).fadeIn(function() {
        try {
        $(id).get(0).style.removeAttribute('filter');
        } 
        catch(Error){} old.hide(); }); return false;
}); var defLink; if (location.hash) { defLink = $(links).filter('[href=' + location.hash + ']'); }
if (!defLink) defLink = $(links).eq(0); $(container).find('.' + activeClass).removeClass(activeClass); defLink.triggerHandler('click');
}
function makeLinkNavigators(links, selected, back, forward) {
links = $(links); $(back).click(function() {
    if (links.filter(selected).length > 0)
        $(links[(links.index(links.filter(selected)) + links.length - 1) % links.length]).find('a').click(); return false;
}); $(forward).click(function() {
    if (links.filter(selected).length > 0)
        $(links[(links.index(links.filter(selected)) + 1) % links.length]).find('a').click(); return false;
});
}
function makeCollapsibleTree(container, selector, callBack) {
$(container).find(selector).prepend('<a class="expandCollapse" href="#"> </a>')
$(container).find('ul ul').hide(); $(container).find(selector).addClass('collapsed'); $(container).find('.expandCollapse').click(function() {
    var item = $(this).blur().parent(); if (item.hasClass('collapsed')) { item.removeClass('collapsed'); item.children('ul').show(); }
    else { item.addClass('collapsed'); item.children('ul').hide(); }
    if (typeof callBack == 'function') callBack(item); return false;
});
}
function makeDefaultTextSwap(field) {
if ($(field).length == 0) return; $(field).data('defaultText', $(field).val()).focus(function() {
    $(this).css({ color: '#000' }); if ($(this).val() == $(this).data('defaultText'))
        $(this).val('');
}).blur(function() { if ($(this).val() == '' || $(this).val() == $(this).data('defaultText')) { $(this).css({ color: '#777' }); $(this).val($(this).data('defaultText')); } }).triggerHandler('blur');
}
function centerChild(item) {
item = $(item); if (item.outerWidth() < item.parent().width())
    item.css('marginLeft', (item.parent().width() - item.outerWidth()) / 2);
}
$.fn.extend({ 'childWidths': function() { var width = 0; $(this).children().each(function() { width += $(this).outerWidth(true); }); return width; }, 'setToEqualHeight': function() { this.css({ minHeight: 0 }); var maxHeight = 0; this.each(function() { maxHeight = Math.max(maxHeight, $(this).height()); }); return this.css({ minHeight: maxHeight + 'px' }); } });

function GetQueryStringValue(querystring) {
qstr = window.location.search.substring(1); qvalue = qstr.split("&"); for (i = 0; i < qvalue.length; i++) {
    valueofqstr = qvalue[i].split("="); if (valueofqstr[0] == querystring)
    { return "&" + querystring + "=" + valueofqstr[1]; } 
}
return '';
}
function IsDisclaimerRead(source, arguments)
{ arguments.IsValid = $('.fCheckBox')[0].childNodes[0].checked; }
function MenuLoad(loadobj, val, forpage) {
if (confirm('Do you really want to load data from Video News Manager Services ?')) {
    if (confirm('Loading data cannot be canceled once it has been started. Proceed ?'))
    { loadobj.location = forpage + "?val=" + val; } 
} 
}
function MenuPublish(publishobj, val, forpage) {
if (confirm('Do you really want to publish VNM data ?')) {
    if (confirm('Publishing cannot be canceled once it has been started. Proceed ?'))
    { publishobj.location = forpage + "?val=" + val; } 
} 
}
function EnableBottomDiv(obj) {
if (document.getElementById(obj.id.replace('div1', 'div1_bottom')) != null)
{ document.getElementById(obj.id.replace('div1', 'div1_bottom')).style.display = 'block'; document.getElementById(obj.id.replace('div1', 'div1_bottom')).style.visibility = 'visible'; } 
}
function DisableBottomDiv(obj) {
if (document.getElementById(obj.id.replace('div1', 'div1_bottom')) != null)
{ document.getElementById(obj.id.replace('div1', 'div1_bottom')).style.display = 'none'; document.getElementById(obj.id.replace('div1', 'div1_bottom')).style.visibility = 'hidden'; } 
}
function GotoPosition(id, id2, b) {
var flagInstance = document.getElementById(id2); var instance = document.getElementById(id); if (instance != null) {
    if (flagInstance.value == '1')
    { instance.GotoPosition(b); } 
} 
}

function VideoPopupHelper() {
this.KeyList = new Array(); this.VideoDefinitionList = new Array(); this.MarkerInstances = new Array(); this.ItemCount = 0; this.AddPopupDef = function(key, videoPlayerItemDefinition) { this.KeyList[this.ItemCount] = key; this.VideoDefinitionList[this.ItemCount] = videoPlayerItemDefinition; this.ItemCount++; }
this.GetItem = function(guid) {
    for (var i = 0; i < this.VideoDefinitionList.length; i++) {
        if (guid == this.VideoDefinitionList[i].GUID)
        { return this.VideoDefinitionList[i]; } 
    }
    return null;
} 
}
var videoItems = new VideoPopupHelper();

document.write("<style type='text/css'> "); document.write("#rspopup {margin: 3px; font-size: 12px; font-family: Arial; width: 160px; border-top: 1px solid #a4cbff; }"); document.write("#rspopup a { display:block; width:161px;color: black; text-decoration: none; } "); document.write("#rspopup ul { margin: 0px;  } #rspopup li { list-style-type:none; margin:  0px; padding: 0px; padding-left: 2px; padding-top: 2px; } "); document.write("#rspopup li.head {  width:160px;font-weight: 600;  text-align:left;  text-decoration:none;  background:#ffffff;  color:#000;  padding:0.25em;  margin-left:1px;  } "); document.write("#rspopup .act { font-weight:bold; color:#000; } "); document.write("#rspopup ul { margin: 0px; padding: 0px; } #rspopup a, #rspopup a:visited { background:#ffffff; color:#000; display:block; width:160px;  border:2px solid #a4cbff;  text-align:left;  text-decoration:none;  padding:0.25em;  } #rspopup a:hover { background-color: #a4cbff; }"); document.write("#rspopup a.actlink {  color:#000; background-image: url('http://media.readspeaker.com/images/enterprise/default/check.png'); background-repeat: no-repeat; background-position: 98% 3px; } "); document.write("#bottomlinks { font-family:Arial;color:#333;font-size:11px; } #bottomlinks a {color:black;text-decoration : none;padding : 2px;} #bottomlinks a:hover {color:black;text-decoration : none;padding : 2px;background-color: #a4cbff; }"); document.write("</style>"); var defaultvalue = "wordsent"; var defaultsurvive = 360000000; document.write("<style type='text/css'>"); document.write(" .sync_word_highlighted { background-color: #a4cbff; }"); document.write(" .sync_sent_highlighted { background-color: #beffd6; }"); document.write("</style>"); var readid = null; var restorehtml = null; var newhtml = ""; var oldwordhl = null; var oldsenthl = null; var player = ""; function rshlsetContent(thecontent) { newhtml += thecontent; }
function rshlsetId(theid) { readid = theid; }
function rshlinit() {
var x = null; if (readid != null) { x = document.getElementById(readid); }
if (x != null) { restorehtml = x.innerHTML; x.innerHTML = newhtml; newhtml = ""; } 
}
function rshltidy() {
var x = null; if (readid != null) { x = document.getElementById(readid); }
if (x != null && restorehtml != null) { x.innerHTML = restorehtml; restorehtml = null; readid = null; } 
}
function rshlexit() { closepage(player); }
function rshlsync(type, id) {
var newEl = document.getElementById("sync" + id); if (newEl && newEl.className == "sync_sent") {
    if (oldsenthl) { oldsenthl.className = 'sync_sent'; }
    oldsenthl = newEl; newEl.className = 'sync_sent_highlighted';
}
else if (newEl && newEl.className == "sync_word") {
    if (oldwordhl) { oldwordhl.className = 'sync_word'; }
    oldwordhl = newEl; newEl.className = 'sync_word_highlighted';
} 
}
function readpage(rscall, playerid) {
player = playerid; var thesync = loadSettings("ReadSpeakerHL"); if (thesync == "")
    thesync = defaultvalue; var audioformat = "mp3"; if (thesync != 'none')
    audioformat = "mp3"; 
    origrscall = rscall; 
    rscall = rscall + "&audioformat=" + audioformat + "&sync=" + thesync; 
    newrscall = escape(rscall); 
    the_player = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' style='height:30px; width:110px;'>"; 
    the_player += "<param name='movie' value='/SiteCollectionDocuments/CSS/readSpeaker.swf?" + audioformat + "=" + newrscall + "&autoplay=1&rskin=simple&text_play=Play&text_pause=Pause&text_stop=Stop&text_vol=Volume'>"; 
    the_player += "<param name='quality' value='high'><param name='autostart' value='false'>"; 
    the_player += "<param name='allowScriptAccess' value='always'><param name='bgcolor' value='#FFFFFF'>"; 
    the_player += "<param name='loop' value='false'>"; 
    the_player += "<embed src='/SiteCollectionDocuments/CSS/readSpeaker.swf?" + audioformat + "=" + newrscall + "&autoplay=1&rskin=simple&text_play=Play&text_pause=Pause&text_stop=Stop&text_vol=Volume'"; 
    the_player += " allowScriptAccess='always' quality='high' autostart='false' bgcolor='#FFFFFF' style='height:30px; width:110px;' loop='false' type='application/x-shockwave-flash'"; 
    the_player += " pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' swliveconnect='true'>"; the_player += "</embed></object>"; 
    var x = document.getElementById(playerid); 
    if (x) { x.innerHTML = the_player; } 
}
function closepage(playerid) {
var x = document.getElementById(playerid); if (x) { x.innerHTML = ''; }
rshltidy();
}
function saveSettings(name, content, lifetime) {
lifetime = parseInt(eval(lifetime)); if (lifetime + "" == "NaN") { tmpdate = ""; }
else { var thedate = new Date(); thedate.setTime(thedate.getTime() + lifetime); thedate = thedate.toGMTString(); tmpdate = "; expires=" + thedate; }
document.cookie = name + "=" + escape(content) + tmpdate;
}
function loadSettings(ckname) {
ckarr = document.cookie; cks = ckarr.split("; "); for (i = 0; i < cks.length; i++) { cknameval = cks[i].split("="); if (cknameval[0] == ckname) { return unescape(cknameval[1]); } }
return "";
}
function setstyle(style) {
saveSettings("ReadSpeakerHL", style, defaultsurvive); var x = document.getElementById('controls'); if (x != null)
    x.innerHTML = "";
}
function showcontrols(rscall, playerid) {
var x = document.getElementById('controls'); if (x != null && x.innerHTML != "") { x.innerHTML = ""; return false; }
var thevalue = loadSettings("ReadSpeakerHL"); if (thevalue == "")
    thevalue = defaultvalue; thestring = "<div id='rspopup'><ul><li class='head'>Highlighting Options</li>"; thestring += "<li class="; if (thevalue == "wordsent") thestring += "'act'"; thestring += "><a href='#' onclick='setstyle(\"wordsent\");closepage(\"" + playerid + "\");readpage(\"" + rscall + "\",\"" + playerid + "\");return false;'"; if (thevalue == "wordsent") thestring += "class='actlink'"; thestring += ">Word and Sentence</a></li>"; thestring += "<li class="; if (thevalue == "sent") thestring += "'act'"; thestring += "><a href='#' onclick='setstyle(\"sent\");closepage(\"" + playerid + "\");readpage(\"" + rscall + "\",\"" + playerid + "\");return false;'"; if (thevalue == "sent") thestring += "class='actlink'"; thestring += ">Sentence only</a></li>"; thestring += "<li class="; if (thevalue == "word") thestring += "act"; thestring += "><a href='#' onclick='setstyle(\"word\");closepage(\"" + playerid + "\");readpage(\"" + rscall + "\",\"" + playerid + "\");return false;'"; if (thevalue == "word") thestring += "class='actlink'"; thestring += ">Word only</a></li>"; thestring += "<li class="; if (thevalue == "none") thestring += "act"; thestring += "><a href='#' onclick='setstyle(\"none\");closepage(\"" + playerid + "\");readpage(\"" + rscall + "\",\"" + playerid + "\");return false;'"; if (thevalue == "none") thestring += "class='actlink'"; thestring += ">No Highlighting</a></li></ul></div>"; var x = document.getElementById('controls'); if (x != null)
    x.innerHTML = thestring;
}

$(function() {
if ($('.dvReadSpeaker').length == 1) { readpage($('#hdReadSpeaker').val(), "readspeakerContainer"); }
makeRadioExpandableList('.expandingList', 'radioGroup00', '.subOptions'); preparePresentationTypeControl("input[name='radioGroup01']", "input[name='radioGroup001']"); prepareMediaDocumentControl("input[name='fRadionGroup04']", "input[name='fRadionGroup05']"); $(".historyBar li:first").addClass("timeNavFirst"); $(".historyBar li:last").addClass("timeNavLast"); $(".yearNav li:first").addClass("ynFirst"); $(".yearNav li:last").addClass("ynLast"); $(".featureBoxList  li:first").addClass("fbListFirst"); $(".featureBoxList  li:last").addClass("fbListLast"); $(".committeesList li:first-child").addClass("first"); $(".committeesList li:last-child").addClass("last"); if ($(".selected").prev().hasClass('eventYear')) { $(".selected").prev().addClass('prevToSelected'); }
$('.tandcError').hide(); $(".fCheckBox").click(function() {
    var statusOfCheckBox = $('.fCheckBox')[0].firstChild.checked; if (statusOfCheckBox)
        $('.tandcError').hide(); else
        $('.tandcError').show();
}); $(".submitClass").click(function() {
    var statusOfCheckBox = $('.fCheckBox')[0].firstChild.checked; if (statusOfCheckBox)
        $('.tandcError').hide(); else { $('.tandcError').show(); return false; }
}); $(".backtoeventlist").click(function() { window.history.back(); }); $(".PRSignUp").click(function() {
    if ($('input[type=checkbox]:checked').length > 0) { $('#chkError').text(""); }
    else { $('#chkError').text("Please check alleast one language"); return false; }
}); $(".surveySubmit").click(function() {
    if ($('input[name=radioGroupSurvey]:checked').val())
        return true; else
        return false;
}); $(".languageChk").click(function() {
    if ($('input[type=checkbox]:checked').length > 0) { $('#chkError').text(""); }
    else { $('#chkError').text("Please check alleast one language"); }
}); if ($(".chkEvent").find('input[type=checkbox]:checked').length > 0) { $('.chkEventError').text(""); }
else { $('.chkEventError').text("Please select at least one in Media and Investor"); }
function checkEvents() {
    if ($(".chkEvent").find('input[type=checkbox]:checked').length > 0) { $('.chkEventError').text(""); }
    else { $('.chkEventError').text("Please select at least one in Media and Investor"); }
}
$(".chkEvent").find('input[type=checkbox]').change(checkEvents); $(".chkEvent").find('input[type=checkbox]').click(checkEvents); $('.showWhatAreThesePopUp').click(function() { var href = $(this).attr('href'); $('.pubContent').load(href + ' #whataretheseContainer'); }); 

// Feature Story Video Scripts Start

$('.selectedNewsItemText').click(function() {
 document.location = $(this).find('a:first').attr('href'); 
 return false;
});

$('#playFeatureStory').live("click",function() {
$(this)[0].parentNode.parentNode.getElementsByTagName('span')[1].innerHTML = "<A id=playFeatureStory href='" + $     (this)[0].href + "'>" +  $(this)[0].innerHTML + "</a>";
$('#playFeatureStory').load($(this).attr('href'),
function(responseText) {

});return false;
}); 

// Feature Story Video Scripts End

try {

    $('.videoPopup').colorbox({ href: function() { var href = $(this).attr('href'); var guid = href.split('guid='); return "~/VideoPopup.ashx?guid=" + guid[1]; }, title: function() {
        var title = $(this).attr('title'); if (title.length > 30)
            title = title.substring(0, 27) + '...'; return title;
    },height:"420px", width:"416px", scrolling:false
    });
} catch (err) { } $('.ajaxPopup').click(function() { $('.showKPIData').show(); var href = $(this).attr('href'); $('.pubContainerKPI h3 span').text(""); $('.pubContentKPIPopup').text(""); $('.pubContainerKPI h3 span').load(href + ' #mainCol .content h1', function() { var titleText = $('.pubContainerKPI h3 span').text(); $('.pubContainerKPI h3 span').html(titleText); }); $('.pubContentKPIPopup').load(href + ' .pubContentKPI'); loadKPIContent(href); return false; }); $('.relatedImagesAjaxPopup').click(function() {
    $('.relatedImagesPopupBox').show(); relatedImagesAjaxPopup = $(this)[0]; title = this.ownerDocument.title; if (title == "Management") { ImageTotalCount = $(this).parent().find('.relatedImagesAjaxPopup').length; }
    else { ImageTotalCount = $(this).parent().find('.relatedImagesAjaxPopup').length; }

    ImagePresentCount = $(this).attr('id');

    var href = relatedImagesAjaxPopup.href; $('#spnPopupTitle')[0].innerHTML = $(this).attr('alt'); $('#relatedImages .pubContent .pubImageShow').load(href + ' #pageContentBlock .container .pubContent .pubImageShow',
    function() {
        $('.number')[0].innerHTML = ImagePresentCount + " of " + ImageTotalCount;
        var nextPicture = $(relatedImagesAjaxPopup).next(".relatedImagesAjaxPopup")[0];
        var prevPicture = $(relatedImagesAjaxPopup).prev(".relatedImagesAjaxPopup")[0];
        if (prevPicture == null) { AddClassForFirstPrev(); }
        else { $('#relatedImages .pubContent .pubImageShow .prevNav a').click(PrevHrefEvent); }
        if (title == "Management") {
            if (nextPicture == null) { AddClassForNextNav(); }
            else { $('#relatedImages .pubContent .pubImageShow .nextNav a').click(NextHrefEvent); }
        }
        else {
            if (nextPicture == null) { AddClassForNextNav(); }
            else { $('#relatedImages .pubContent .pubImageShow .nextNav a').click(NextHrefEvent); }
        }
    }); return false;
});
$('.pictureBoxPopup').click(function() {
    $('.relatedImagesPopupBox').show();
    relatedImagesAjaxPopup = $(this)[0];
    ImageTotalCount = $('.pictureBoxPopup').length;
    ImagePresentCount = $(this).attr('id');

    var href = $(this).attr('href');
    // Set the title of the popup box
    $('#spnPopupTitle')[0].innerHTML = $(this).attr('alt');
    var nextPicture = getNextSibling($(relatedImagesAjaxPopup)[0].parentNode); //.siblings();  //next(".pictureBoxPopup")[0];
    var prevPicture = getPrevSibling($(relatedImagesAjaxPopup)[0].parentNode); //.siblings();  //.prev(".pictureBoxPopup")[0];
    var countLi = 0;

    $('#relatedImages .pubContent .pubImageShow').load(href + ' #pageContentBlock .container .pubContent .pubImageShow',
    function() {
        $('.number')[0].innerHTML = ImagePresentCount + " of " + ImageTotalCount;
        if (prevPicture == null) {
            AddClassForFirstPrev();
        }
        else { $('#relatedImages .pubContent .pubImageShow .prevNav a').click(PrevHrefEventForNavImages); }
        if (nextPicture == null) {

            AddClassForNextNav();
        }
        else { $('#relatedImages .pubContent .pubImageShow .nextNav a').click(NextHrefEventNavImages); }
    });
    return false;
}); var relatedImagesAjaxPopup = null; var ImageTotalCount = null; var ImagePresentCount = null; var title = null; function PrevHrefEvent() {
    var PrevHref = null; var prevPicture = $(relatedImagesAjaxPopup).prev(".relatedImagesAjaxPopup")[0]; if (prevPicture != null) { $('#spnPopupTitle')[0].innerHTML = prevPicture.getAttribute('alt'); PrevHref = prevPicture.href; relatedImagesAjaxPopup = prevPicture; }
    if (PrevHref != null) {
        if ($(relatedImagesAjaxPopup).prev(".relatedImagesAjaxPopup")[0] != null) { ImagePresentCount = ImagePresentCount - 1; $('#relatedImages .pubContent .pubImageShow').load(PrevHref + ' #pageContentBlock .container .pubContent .pubImageShow', function() { $('#relatedImages .pubContent .pubImageShow .nextNav a').click(NextHrefEvent); $('#relatedImages .pubContent .pubImageShow .prevNav a').click(PrevHrefEvent); $('.number')[0].innerHTML = ImagePresentCount + " of " + ImageTotalCount; }); }
        else { ImagePresentCount = ImagePresentCount - 1; $('#relatedImages .pubContent .pubImageShow').load(PrevHref + ' #pageContentBlock .container .pubContent .pubImageShow', function() { AddClassForFirstPrev(); $('#relatedImages .pubContent .pubImageShow .nextNav a').click(NextHrefEvent); $('#relatedImages .pubContent .pubImageShow .prevNav a').click(PrevHrefEvent); AddClassForFirstPrev(); $('.number')[0].innerHTML = ImagePresentCount + " of " + ImageTotalCount; }); }
    }
    return false;
}

function getNextSibling(startBrother) {
    endBrother = startBrother.nextSibling;
    if (endBrother != null) {
        while (endBrother == null || endBrother.nodeType != 1) {
            if (endBrother != null) {
                endBrother = endBrother.nextSibling;
            }
            else {
                break;
            }
        }
    }
    return endBrother;
}

function getPrevSibling(startBrother) {
    var endBrother = startBrother.previousSibling;
    if (endBrother != null) {
        while (endBrother == null || endBrother.nodeType != 1) {
            if (endBrother != null) {
                endBrother = endBrother.previousSibling;
            }
            else {
                break;
            }
        }
    }

    return endBrother;
}

function getChildNode(node) {
    var childNode = null;

    for (var count = 0; count < node.childNodes.length; count++) {
        if (node.childNodes[count] != null) {
            if (node.childNodes[count].nodeType == 1) {
                childNode = node.childNodes[count];
            }
        }
    }

    return childNode;
}

function NextHrefEvent() {
    var nextPicture = $(relatedImagesAjaxPopup).next(".relatedImagesAjaxPopup")[0]; var NextHref = null; if (nextPicture != null) { $('#spnPopupTitle')[0].innerHTML = nextPicture.getAttribute('alt'); NextHref = nextPicture.href; relatedImagesAjaxPopup = nextPicture; }
    if (NextHref != null) {
        ImagePresentCount = parseInt(ImagePresentCount) + 1; if ($(relatedImagesAjaxPopup).next(".relatedImagesAjaxPopup")[0] != null) { $('#relatedImages .pubContent .pubImageShow').load(NextHref + ' #pageContentBlock .container .pubContent .pubImageShow', function() { $('#relatedImages .pubContent .pubImageShow .nextNav a').click(NextHrefEvent); $('#relatedImages .pubContent .pubImageShow .prevNav a').click(PrevHrefEvent); $('.number')[0].innerHTML = ImagePresentCount + " of " + ImageTotalCount; }); }
        else { $('#relatedImages .pubContent .pubImageShow').load(NextHref + ' #pageContentBlock .container .pubContent .pubImageShow', function() { $('#relatedImages .pubContent .pubImageShow .nextNav a').click(NextHrefEvent); AddClassForNextNav(); $('#relatedImages .pubContent .pubImageShow .prevNav a').click(PrevHrefEvent); $('.number')[0].innerHTML = ImagePresentCount + " of " + ImageTotalCount; }); }
    }
    return false;
}

function PrevHrefEventForNavImages() {
    var PrevHref = null;
    var prevPicture = getPrevSibling(relatedImagesAjaxPopup.parentNode);

    if (prevPicture != null) {
        // Set the title of the popup box
        $('#spnPopupTitle')[0].innerHTML = getChildNode(prevPicture).getAttribute('alt');
        PrevHref = getChildNode(prevPicture).href;
        relatedImagesAjaxPopup = getChildNode(prevPicture);
    }
    if (PrevHref != null) {

        // Get the previous picture
        prevPicture = getPrevSibling(relatedImagesAjaxPopup.parentNode);

        if (prevPicture != null && prevPicture.nodeName == 'LI') {
            ImagePresentCount = ImagePresentCount - 1;
            $('#relatedImages .pubContent .pubImageShow').load(PrevHref + ' #pageContentBlock .container .pubContent .pubImageShow', function() {
                $('#relatedImages .pubContent .pubImageShow .nextNav a').click(NextHrefEventNavImages); $('#relatedImages .pubContent .pubImageShow .prevNav a').click(PrevHrefEventForNavImages);
                $('.number')[0].innerHTML = ImagePresentCount + " of " + ImageTotalCount;
            });
        }
        else {
            ImagePresentCount = ImagePresentCount - 1;
            $('#relatedImages .pubContent .pubImageShow').load(PrevHref + ' #pageContentBlock .container .pubContent .pubImageShow',
         	function() {
         	    $('#relatedImages .pubContent .pubImageShow .nextNav a').click(NextHrefEventNavImages);
         	    $('#relatedImages .pubContent .pubImageShow .prevNav a').click(PrevHrefEventForNavImages);
         	    AddClassForFirstPrev();
         	    $('.number')[0].innerHTML = ImagePresentCount + " of " + ImageTotalCount;
         	});
        }
    }
    return false;
}

function NextHrefEventNavImages() {
    var nextPicture = getNextSibling(relatedImagesAjaxPopup.parentNode);
    var NextHref = null; if (nextPicture != null) {
        // Set the title of the popup box
        $('#spnPopupTitle')[0].innerHTML = getChildNode(nextPicture).getAttribute('alt');
        NextHref = getChildNode(nextPicture).href;
        relatedImagesAjaxPopup = getChildNode(nextPicture);
    }
    if (NextHref != null) {
        ImagePresentCount = parseInt(ImagePresentCount) + 1;
        // Get the next picture
        var nextPictureToShow = getNextSibling(relatedImagesAjaxPopup.parentNode);
        if (nextPictureToShow != null && nextPictureToShow.nodeName == 'LI') {
            $('#relatedImages .pubContent .pubImageShow').load(NextHref + ' #pageContentBlock .container .pubContent .pubImageShow',
        	function() {
        	    $('#relatedImages .pubContent .pubImageShow .nextNav a').click(NextHrefEventNavImages);
        	    $('#relatedImages .pubContent .pubImageShow .prevNav a').click(PrevHrefEventForNavImages);
        	    $('.number')[0].innerHTML = ImagePresentCount + " of " + ImageTotalCount;
        	});
        }
        else {
            $('#relatedImages .pubContent .pubImageShow').load(NextHref + ' #pageContentBlock .container .pubContent .pubImageShow',
        	function() {
        	    $('.number')[0].innerHTML = ImagePresentCount + " of " + ImageTotalCount;
        	    $('#relatedImages .pubContent .pubImageShow .nextNav a').click(NextHrefEventNavImages);
        	    AddClassForNextNav();
        	    $('#relatedImages .pubContent .pubImageShow .prevNav a').click(PrevHrefEventForNavImages);
        	});

        }
    }
    return false;
}

function AddClassForFirstPrev() { $('#relatedImages .pubContent .pubImageShow .prevNav')[0].innerHTML = "<SPAN>Next</SPAN>"; $('#relatedImages .pubContent .pubImageShow .prevNav')[0].title = "You are on the first Page"; }
function AddClassForNextNav() { $('#relatedImages .pubContent .pubImageShow .nextNav')[0].innerHTML = "<SPAN>Next</SPAN>"; $('#relatedImages .pubContent .pubImageShow .nextNav')[0].title = "You are on the last Page"; }
function kpiPreviousClickHandler() { var currentURL = $(this).attr('href'); loadKPIContent(currentURL); return false; }
function kpiNextClickHandler() { var currentURL = $(this).attr('href'); loadKPIContent(currentURL); return false; }
function resetKPIUrls(urlInContext) {
    var currentAnchorInstance = $('.view[href$=' + contextURLKPI + ']'); var prevHREF = $(currentAnchorInstance.parent().parent().parent().parent().parent().prev().children('.elDetail').children('.detailsList').children('.csvActions').children('span')[2]).children('a').attr('href'); var nextHREF = $(currentAnchorInstance.parent().parent().parent().parent().parent().next().children('.elDetail').children('.detailsList').children('.csvActions').children('span')[2]).children('a').attr('href'); if (prevHREF == null) { $('.showKPIData .prevNav').html("<span class='navDirectionName'>Previous</span>"); }
    else { $('.showKPIData .prevNav').html("<a href='#' title='Prev card'><span class='navDirectionName'>Previous</span></a>"); $('.showKPIData .prevNav a').attr("href", prevHREF); }
    if (nextHREF == null) { $('.showKPIData .nextNav').html("<span class='navDirectionName'>Next</span>"); }
    else { $('.showKPIData .nextNav').html("<a href='#' title='Next card'><span class='navDirectionName'>Next</span></a>"); $('.showKPIData .nextNav a').attr("href", nextHREF); }
    $('.showKPIData .prevNav a').live('click', kpiPreviousClickHandler); $('.showKPIData .nextNav a').live('click', kpiNextClickHandler);
}
function loadKPIContent(hrefValue) { contextURLKPI = hrefValue; $('.pubContainerKPI h3 span').load(hrefValue + ' #mainCol .content h1', function() { var titleText = $('.pubContainerKPI h3 span').text(); $('.pubContainerKPI h3 span').html(titleText); }); $('.pubContentKPIPopup').load(hrefValue + ' .pubContentKPI', resetKPIUrls); }
$('.showContactCard').click(function() { var href = $(this).attr('href'); getCurrentContact($(this)); loadContent(href); resetLinks(href); return false; }); $('.showContactCard .prevNav a').click(contactsPreviouClickHandler); function contactsPreviouClickHandler() { var currentURL = $(this).attr('href'); getCurrentContact($(this)); resetLinks(currentURL); loadContent(currentURL); return false; }
$('.showContactCard .nextNav a').click(contactsNextClickHandler); function contactsNextClickHandler() { var currentURL = $(this).attr('href'); getCurrentContact($(this)); resetLinks(currentURL); loadContent(currentURL); return false; }
function resetLinks(urlInContext) {
    var currentAnchorInstance = $('.showContactCard[href$=' + urlInContext + ']'); var prevHREF = currentAnchorInstance.parent().prev().children("a").attr("href"); var nextHREF = currentAnchorInstance.parent().next().children("a").attr("href"); if (prevHREF == null) { $('.prevNav').html("<span class='navDirectionName'></span>"); }
    else { $('.prevNav').html("<a href='#' title='Prev card'><span class='navDirectionName'>Previous</span></a>"); $('.prevNav a').attr("href", prevHREF); $('.prevNav a').bind("click", contactsPreviouClickHandler); }
    if (nextHREF == null) { $('.nextNav').html("<span class='navDirectionName'></span>"); }
    else { $('.nextNav').html("<a href='#' title='Next card'><span class='navDirectionName'>Next</span></a>"); $('.nextNav a').attr("href", nextHREF); $('.nextNav a').bind("click", contactsNextClickHandler); }
}
function getCurrentContact(refValue) {
    var ctr = 1; var currentContact = 1; var totalContacts = 1; $('.showContactCard').each(function() {
        if ($(this).attr('href') == refValue.attr('href')) { currentContact = ctr; }
        totalContacts = ctr; ctr++;
    }); $('.pubContainer h3 span').text("Contact " + currentContact + " of " + totalContacts);
}
function loadContent(hrefValue) { $('.pubInnerContent').load(hrefValue + ' .pubInnerContent'); }
function Cpy2ClB(someText) {
    if (window.clipboardData) { window.clipboardData.setData('Text', someText); }
    else if (window.netscape) { netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard); if (!clip) { return false }; var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable); if (!trans) { return false }; trans.addDataFlavor('text/unicode'); var str = Components.classes['@mozilla.org/supports-string;1'].createInstance(Components.interfaces.nsISupportsString); str.data = someText; trans.setTransferData('text/unicode', str, someText.length * 2); var clipid = Components.interfaces.nsIClipboard; if (!clip) { return false }; clip.setData(trans, null, clipid.kGlobalClipboard); }
    alert('Following info was copied to your clipboard:\n\n' + someText);
}
$("#footer .container ul:first li:first").addClass("footerFirst"); $("#footer .container ul:first li:last").addClass("footerLast"); $("#sNavigation ul li:first").addClass("sNavFirst"); $("#sNavigation ul li:last").addClass("sNavLast"); $(".containerBlock:last").addClass("last"); $("#brandsSelector ul li:first").addClass("bsNavFirst"); $("#brandsSelector ul li:last").addClass("bsNavLast"); $(".containerBlock:last").addClass("last"); $("#bodListing ul li:first").addClass("bodListFirst"); $("#bodListing ul li:last").addClass("bodListLast"); $("#navContainer ul li:first").addClass("pNavFirst"); $("#navContainer ul li:last").addClass("pNavLast"); var $nextElement = $("#pnCurrent").next(); var $prevElement = $("#pnCurrent").prev(); if ($prevElement != null) { $prevElement.addClass("prevToCurrent"); }
if ($nextElement != null) { $nextElement.addClass("nextToCurrent"); }
if ($('.libraryImages').length > 0) { if (jQuery.trim($('.libraryImages')[0].innerHTML) == "") { $('.imagestab').hide(); } }
});                  function Cpy2ClB(someText) {
if (window.clipboardData) { window.clipboardData.setData('Text', someText); }
else if (window.netscape) { netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard); if (!clip) { return false }; var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable); if (!trans) { return false }; trans.addDataFlavor('text/unicode'); var str = Components.classes['@mozilla.org/supports-string;1'].createInstance(Components.interfaces.nsISupportsString); str.data = someText; trans.setTransferData('text/unicode', str, someText.length * 2); var clipid = Components.interfaces.nsIClipboard; if (!clip) { return false }; clip.setData(trans, null, clipid.kGlobalClipboard); }
alert('Following info was copied to your clipboard:\n\n' + someText);
}
function preparePresentationTypeControl(rbPresentationTopic, rbPresentationType) {
var selectedTopic = null; var selectedType = null; var currentURL = window.location.href; var Uri = new URI(currentURL); function GetSelectedValue() {
    selectedTopic = GetPresentationSelectedValue(rbPresentationTopic); selectedType = GetPresentationSelectedValue(rbPresentationType); if (selectedTopic != null)
        Uri.variables["Topic"] = selectedTopic; if (selectedType != null)
        Uri.variables["Type"] = selectedType; window.document.location.href = Uri.toString(); return false;
}
$(rbPresentationTopic).click(GetSelectedValue); $(rbPresentationType).click(GetSelectedValue);
}
function GetPresentationSelectedValue(controlReference) { var selectedTopic = null; $(controlReference).each(function() { if ($(this).is(':checked')) { selectedTopic = $(this).val(); } }); return selectedTopic; }
$(function() {
$(".SignMeUp").click(function() {
    var $Journdiv = $('div#Journdiv'); var $signUpUpdates = $('div#signUpUpdates'); var $signUpUpdatesJourn = $('div#signUpUpdatesJourn'); var $newsletter = $('div#newsletter'); if (this.checked) { $(".divJournalist").css('display', 'block'); $(".signmeUpUpdates").css('display', 'none'); $(".signUpUpdatesJourn").css('display', 'block'); $(".chknewsletter").css('display', 'none'); }
    else { $(".divJournalist").css('display', 'none'); $(".signmeUpUpdates").css('display', 'block'); $(".signUpUpdatesJourn").css('display', 'none'); $(".chknewsletter").css('display', 'block'); } 
}); $(".btnSignMeUp").click(function() {
    var status = true; if ($(".SignMeUp").is(':checked')) {
        if ($("#signUpPR :input:checked").length > 0 || $("#signUpUpdatesJourn :input:checked").length > 0) { $(".errsignup").css('display', 'none'); status = true; }
        else { $(".errsignup").css('display', 'block'); status = false; }
        if ($(".fCountry").val() == "") { $(".errCountry").css('visibility', 'visible'); status = false; }
        if ($(".fPublication").val() == "") { $(".errPublication").css('visibility', 'visible'); status = false; } 
    }
    else {
        if ($("#signUpPR :input:checked").length > 0 || $(".signmeUpUpdates :input:checked").length > 0 || $(".signupnewsletter").is(':checked')) { $(".errsignup").css('display', 'none'); status = true; }
        else { $(".errsignup").css('display', 'block'); status = false; } 
    }
    if (status == false) { return false; } 
});
}); var fcountryFilled = false; var fPublicationFilled = false; $(".fCountry").live('focusout', function() { if ($(".fCountry").val() == "" && fcountryFilled) { $(".errCountry").css('visibility', 'visible'); } else { $(".errCountry").css('visibility', 'hidden'); if ($(".fCountry").val() != "") { fcountryFilled = true; } } }); $(".fPublication").live('focusout', function() { if ($(".fPublication").val() == "" && fPublicationFilled) { $(".errPublication").css('visibility', 'visible'); } else { $(".errPublication").css('visibility', 'hidden'); if ($(".fPublication").val() != "") { fPublicationFilled = true; } } }); function prepareMediaDocumentControl(rbTopic, rbLanguage) {
var selectedTopic = null; var selectedLanguage = null; var currentURL = window.location.href; var Uri = new URI(currentURL); function GetSelectedValue() {
    selectedTopic = GetMediaDocumentSelectedValue(rbTopic); selectedLanguage = GetMediaDocumentSelectedValue(rbLanguage); if (selectedTopic != null)
        Uri.variables["Topic"] = selectedTopic; if (selectedLanguage != null)
        Uri.variables["Language"] = selectedLanguage; window.document.location.href = Uri.toString(); return false;
}
$(rbTopic).click(GetSelectedValue); $(rbLanguage).click(GetSelectedValue);
}
function GetMediaDocumentSelectedValue(controlReference) { var selectedTopic = null; $(controlReference).each(function() { if ($(this).is(':checked')) { selectedTopic = $(this).val(); } }); return selectedTopic; }
function MenuExportForJournUser(exportobj) { if (confirm('Export cannot be canceled once it has been started. Proceed ?')) { exportobj.location = "SignmeupAdmin.axd"; } }
function PerformCheckInAndRefresh() {
if (confirm('Do you want to continue ?')) { var getURL = '/CheckInHandler.ashx?' + arguments[0] + '&' + arguments[1] + '&' + arguments[2]; $.ajax({ url: getURL, cache: false, async: false, success: function(msg) { window.location.href = window.location.href; } }); }
return true;
}
function PerformPendingAndRefresh() {
if (confirm('Do you want to continue ?')) { var getURL = '/PendingHandler.ashx?' + arguments[0] + '&' + arguments[1] + '&' + arguments[2]; $.ajax({ url: getURL, cache: false, async: false, success: function(msg) { window.location.href = window.location.href; } }); }
return true;
}
function PerformApproveAndRefresh() {
if (confirm('Do you want to continue ?')) { var getURL = '/ApproveHandler.ashx?' + arguments[0] + '&' + arguments[1] + '&' + arguments[2]; $.ajax({ url: getURL, cache: false, async: false, success: function(msg) { window.location.href = window.location.href; } }); }
return true;
}
function GoLive() {
if (confirm('This will deploy all non-live approved content to production. Are you sure you want to proceed ?')) { if (confirm('This process is non-reversible, do you really want to continue ?')) { var getURL = '/Deploy.ashx'; $.ajax({ url: getURL, cache: false, async: false, success: function(msg) { window.location.href = window.location.href; } }); } }
return true;
}
function makeRadioExpandableList(container, group, sub) {
$(':radio[name=' + group + ']').click(function() {
    $(':radio[name=' + group + ']').each(function() {
        if ($(this).attr('checked')) {
            if ($(this).parents(container).find(sub).hasClass('eventItemEdit')) { $(this).parents(container).find(sub).slideDown(); }
            else { $(this).parents(container).find(sub).slideDown().find(':radio:first').attr('checked', true); } 
        }
        else { $(this).parents(container).find(sub).slideUp().find(':radio').attr('checked', false); } 
    });
}).filter(':checked').triggerHandler('click');
}
function SetTooltip(toolTip, link) {
for (i = 0; i < document.getElementById('paginatorOne').getElementsByTagName('li').length; i++) { if (document.getElementById('paginatorOne').getElementsByTagName('li')[i].getElementsByTagName('a')[0].className == 'num') { if (document.getElementById('paginatorOne').getElementsByTagName('li')[i].getElementsByTagName('a')[0].title.indexOf('to') < 0) { document.getElementById('paginatorOne').getElementsByTagName('li')[i].getElementsByTagName('a')[0].title = 'go to ' + document.getElementById('paginatorOne').getElementsByTagName('li')[i].getElementsByTagName('a')[0].title; } } }
link.title = toolTip; return false;
}
$(function() { $('#cboxClose').click(function() { $('#flashControlContainer').replaceWith(''); }); });

jQuery.url = function() {
var segments = {}; var parsed = {}; var options = { url: window.location, strictMode: false, key: ["source", "protocol", "authority", "userInfo", "user", "password", "host", "port", "relative", "path", "directory", "file", "query", "anchor"], q: { name: "queryKey", parser: /(?:^|&)([^&=]*)=?([^&]*)/g }, parser: { strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/} }; var parseUri = function() {
    str = decodeURI(options.url); var m = options.parser[options.strictMode ? "strict" : "loose"].exec(str); var uri = {}; var i = 14; while (i--) { uri[options.key[i]] = m[i] || ""; }
    uri[options.q.name] = {}; uri[options.key[12]].replace(options.q.parser, function($0, $1, $2) { if ($1) { uri[options.q.name][$1] = $2; } }); return uri;
}; var key = function(key) {
    if (!parsed.length)
    { setUp(); }
    if (key == "base") {
        if (parsed.port !== null && parsed.port !== "")
        { return parsed.protocol + "://" + parsed.host + ":" + parsed.port + "/"; }
        else
        { return parsed.protocol + "://" + parsed.host + "/"; } 
    }
    return (parsed[key] === "") ? null : parsed[key];
}; var param = function(item) {
    if (!parsed.length)
    { setUp(); }
    return (parsed.queryKey[item] === null) ? null : parsed.queryKey[item];
}; var setUp = function()
{ parsed = parseUri(); getSegments(); }; var getSegments = function()
{ var p = parsed.path; segments = []; segments = parsed.path.length == 1 ? {} : (p.charAt(p.length - 1) == "/" ? p.substring(1, p.length - 1) : path = p.substring(1)).split("/"); }; return { setMode: function(mode)
{ strictMode = mode == "strict" ? true : false; return this; }, setUrl: function(newUri)
{ options.url = newUri === undefined ? window.location : newUri; setUp(); return this; }, segment: function(pos) {
    if (!parsed.length)
    { setUp(); }
    if (pos === undefined)
    { return segments.length; }
    return (segments[pos] === "" || segments[pos] === undefined) ? null : segments[pos];
}, attr: key, param: param
};
} ();


jQuery.fn.extend({ SetSelectedFeaturedStory: function(id, selectedStory) { var dataindex = id.substring(8); $('.SelectedFeaturedStory').addClass('UnselectedFeaturedStory'); $('.SelectedFeaturedStory').removeClass('SelectedFeaturedStory'); var itemIndex = '.ItemIndex' + dataindex; $(itemIndex).removeClass('UnselectedFeaturedStory'); $(itemIndex).addClass('SelectedFeaturedStory'); var item = $('.selected'); item.removeClass('selected'); selectedStory.parent().addClass('selected'); } }); $(function() { $('#shareLinks').hide(); $('#shareLinksButton').click(function() { $('#shareLinks').slideDown(); return false; }); $('#shareLinks .closeBox').click(function() { $('#shareLinks').slideUp(); return false; }); $("#newsSelectorArticlesList ul li:first").addClass("newsFirst"); $("#newsSelectorArticlesList ul li:last").addClass("newsLast"); $('.homeNewsLink').click(function() { $(this).SetSelectedFeaturedStory($(this).context.parentNode.id, $(this)); return false; }); });

var currentSurveyId = ''; var clickRequired = ''; var cookieOptions = {}; cookieOptions.path = '/'; var noThanksCookieName = ''; var closeSurveyCookieName = ''; var currentSurveyClickCountCookieName = ''; function LoadPopUp() {
if (document.getElementById('dvSurveyPopup') != undefined) {
    currentSurveyId = document.getElementById('hdnSelectedSurvey').value; clickRequired = document.getElementById('hdnNumberOfClicks').value; noThanksCookieName = currentSurveyId + 'NoThanks'; closeSurveyCookieName = currentSurveyId + 'CloseSurvey'; currentSurveyClickCountCookieName = currentSurveyId + 'Clicks'; if (getCookie(noThanksCookieName) != null) { HidePopUp(); return; }
    var closeSurveyIds = getCookie(closeSurveyCookieName); if (closeSurveyIds != null) { HidePopUp(); return; }
    var clickCount = ''; if (getCookie(currentSurveyClickCountCookieName) != null) { clickCount = parseInt(getCookie(currentSurveyClickCountCookieName)); clickCount = clickCount - 1; setCookie(currentSurveyClickCountCookieName, clickCount, null, cookieOptions); }
    else { setCookie(currentSurveyClickCountCookieName, clickRequired, null, cookieOptions); clickCount = parseInt(getCookie(currentSurveyClickCountCookieName)); }
    ShowPopUp();
} 
}
function HideSurveyForEver() { SetPermanentCookie(noThanksCookieName, 'NoThanks'); }
function CloseSurvey() { setCookie(closeSurveyCookieName, 'Closed', null, cookieOptions); }
function ShowPopUp() { var clickCount = parseInt(getCookie(currentSurveyClickCountCookieName)); if (clickCount == 0) { var dv = document.getElementById("dvSurveyPopup"); dv.style.display = 'block'; } }
function HidePopUp() { var dv = document.getElementById("dvSurveyPopup"); dv.style.display = 'none'; }
function setCookie(name, value, expires, options) {
if (options === undefined) { options = {}; }
if (expires) { var expires_date = new Date(); expires_date.setDate(expires_date.getDate() + expires); }
document.cookie = name + '=' + escape(value) +
((options.path) ? ';path=' + options.path : '') +
((options.domain) ? ';domain=' + options.domain : '') +
((options.secure) ? ';secure' : '');
}
function SetPermanentCookie(cookieName, value) {
var cookieOptions = {}; cookieOptions.path = '/'; var clickCounterCookieName = cookieName; document.cookie = clickCounterCookieName + '=' + escape(value) +
(';expires=Thu, 01-Jan-2099 00:00:01 GMT') +
((cookieOptions.path) ? ';path=' + cookieOptions.path : '') +
((cookieOptions.domain) ? ';domain=' + cookieOptions.domain : '') +
((cookieOptions.secure) ? ';secure' : '');
}
function getCookie(name) {
var start = document.cookie.indexOf(name + "="); var len = start + name.length + 1; if ((!start) && (name != document.cookie.substring(0, name.length))) { return null; }
if (start == -1) { return null; }
var end = document.cookie.indexOf(';', len); if (end == -1)
    end = document.cookie.length; return unescape(document.cookie.substring(len, end));
}







// These functions are used for listboxes add, remove, removeAll and addAll (start)
    
function clearlistbox(lb)
{//Used to clear of the items in the given listbox.
try
{
    for (var i=lb.options.length-1; i>=0; i--)
    {
        lb.remove(i);
    }
    lb.selectedIndex = -1;
}
catch(e)
{
}
}
function BreakValidation(Action,SelectedValue,lstFrom,lstTo)
{//If user selects "Break" option in the listbox - Handled Here.
try
{
  if(Action == "Add")
  {
      if(SelectedValue == "BREAK")
      {
         var retValue = confirm("Are you sure you want to insert BREAK? This will not show any RightHandFreeText Widget on page.");
         if(retValue)
         {
            RemoveALL(lstFrom,lstTo);
            for(i=0;i<lstFrom.options.length;i++)
            {
                if(lstFrom.options[i].value == "BREAK")
                {
                    var optionText = lstFrom.options[i].text;
                    var optionVal = lstFrom.options[i].value;
                    var objOption = new Option(optionText, optionVal);
                    lstTo.options[lstTo.options.length] = objOption;
                    lstFrom.remove(i);
                    return;
                }
            }
         }
         else
         {
            for(i=0;i<lstTo.options.length;i++)
            {
                if(lstTo.options[i].value == "BREAK")
                {
                    var optionText = lstTo.options[i].text;
                    var optionVal = lstTo.options[i].value;
                    var objOption = new Option(optionText, optionVal);
                    lstFrom.options[lstFrom.options.length] = objOption;
                    lstTo.remove(i);
                    return;
                }
            }
         }
      }
  }
  else if(Action == "AddALL")
  {
    for(i=0;i<lstTo.options.length;i++)
    {
        if(lstTo.options[i].value == "BREAK")
        {
            var optionText = lstTo.options[i].text;
            var optionVal = lstTo.options[i].value;
            var objOption = new Option(optionText, optionVal);
            lstFrom.options[lstFrom.options.length] = objOption;
            lstTo.remove(i);
        }
    }
  }  
}
catch(e)
{
}  
}



    
function Add(lstFrom,lstTo)
{//To add an item from source listbox to destination listbox.
    try
    {
        var selIndex = lstFrom.selectedIndex;
        var optionText = "";
        var optionVal = "";
        var optionIndex = "";
        
        if(lstFrom.selectedIndex == -1)
        {
            alert('Please select atleast one record to Add');
            return false;
        }
        else if(lstTo.innerHTML.indexOf("BREAK") != -1)
        {
            alert('Please remove BREAK from the listbox, then try to add a item.');
            return false;
        }
        else if(lstTo.innerHTML.indexOf(lstFrom.options[selIndex].value) != -1)
        {
            alert('You cannot add duplicate records');
            return  false;
        }
        else 
        {
            optionText = lstFrom.options[selIndex].text;
            optionVal = lstFrom.options[selIndex].value;
            optionIndex = lstTo.options.length;
            objOption = new Option(optionText, optionVal);
            lstTo.options[optionIndex] = objOption;
            lstFrom.remove(selIndex);
        }

        BreakValidation("Add",optionVal,lstFrom,lstTo);
        return true;
    }
    catch(e)
    {
    }
}



function AddALL(lstFrom,lstTo)
{// To add all items from the source listbox to destination listbox.
    try
    {
        var lstFrom = document.getElementById(fromID);
            var lstTo = document.getElementById(toID);
            for(var i=0;i<lstFrom.options.length;i++)
            {
                selIndex = i;   
                var optionText = lstFrom.options[selIndex].text;
                var optionVal = lstFrom.options[selIndex].value;
                var optionIndex = lstTo.options.length;
                var objOption = new Option(optionText, optionVal);
                lstTo.options[optionIndex] = objOption;
            }
            clearlistbox(lstFrom);
            BreakValidation("AddALL","",lstFrom,lstTo);
    }
    catch(e)
    {
    }
}
function Remove(lstFrom,lstTo)
{//To remove an item from the destination listbox and restore to source listbox.
    try
    {
        if(lstTo.selectedIndex == -1)
        {
            alert('Please select atleast one record to Remove');
            return false;
        }
        else if(lstTo.options[lstTo.selectedIndex].value == "")
        {
            alert('Please select a valid one record to Remove');
            return false;
        }
        else
        {
            var selIndex = lstTo.selectedIndex;
            var optionText = lstTo.options[selIndex].text;
            var optionVal = lstTo.options[selIndex].value;
            var optionIndex = lstFrom.options.length;
            var objOption = new Option(optionText, optionVal);
            lstFrom.options[optionIndex] = objOption;
            lstTo.remove(selIndex);
        }
        return true;
     }
    catch(e)
    {
    }
}

function RemoveALL(lstFrom,lstTo)
{// To remove all items from the destination listbox and restore to source listbox.
    try
    {
        for(var i=0;i<lstTo.options.length;i++)
        {
            selIndex = i;
            var optionText = lstTo.options[selIndex].text;
            var optionVal = lstTo.options[selIndex].value;
            var optionIndex = lstFrom.options.length;
            var objOption = new Option(optionText, optionVal);
            lstFrom.options[optionIndex] = objOption;
        }
        clearlistbox(lstTo);
    }
    catch(e)
    {
    }
}


   function SaveInHidden(HiddenFieldID,lstFrom,lstTo)
   {//Retreived all values from the source and the destination listboxs.
       try
       {
            var indicator = "";
            for(i=0;i<lstFrom.options.length;i++)
            {
                document.getElementById(ListboxesDataID).value += lstFrom.options[i].text+"~"+lstFrom.options[i].value+";"
            }
            document.getElementById(ListboxesDataID).value = document.getElementById(ListboxesDataID).value.substring(0,(document.getElementById(ListboxesDataID).value.length-1))+"|";
            
            for(i=0;i<lstTo.options.length;i++)
            {
                indicator = "1";
                document.getElementById(ListboxesDataID).value += lstTo.options[i].text+"~"+lstTo.options[i].value+";";
            }
            if(indicator == "1")
            {
                document.getElementById(ListboxesDataID).value = document.getElementById(ListboxesDataID).value.substring(0,(document.getElementById(ListboxesDataID).value.length-1));
            }
        }
        catch(e)
        {
        }
   } 

// These functions are used for listboxes add, remove, removeAll and addAll (end)


