// event listener on
function addEvent(elm, evType, fn, useCapture){
	if (elm.addEventListener){
	elm.addEventListener(evType, fn, useCapture);
	return true;
	}else if (elm.attachEvent){
	var r = elm.attachEvent('on' + evType, fn);
	return r;
	}else{elm['on' + evType] = fn}
}
// event listener off
// tabs function on 
function Tabs(ulId, divId, activeN, resWidth){
	var UL,DIV,T = this;
	
	this.show = function(n){
		hideAll();
		getChildren(DIV)[n].style.display="block";
		var c = getChildren(UL);
		c[n].className="active"+(n==0?"Left":((n==c.length-1)?"":""));
	}
	
	function hideAll(){
		var ulc = getChildren(UL);
		var divc = getChildren(DIV);
		for(var i=0;i<ulc.length;i++){
			if(i==0) {ulc[i].className="aLeft"}
			else{ulc[i].className=""}
			divc[i].style.display="none";
		}
	}
	
	function getChildren(o){
		var arr=[], c = o.childNodes;
		for(var i=0;i<c.length;i++) if(c[i].tagName) arr.push(c[i]);
		return arr;
	}
	
	function init(){
		UL = document.getElementById(ulId);
		DIV = document.getElementById(divId);
		if(!UL || !DIV) return;
		var fix=0,i,li = getChildren(UL),w = Math.ceil(UL.offsetWidth/li.length), f = UL.offsetWidth%li.length;
		
		for(i=0;i<li.length;i++){
			li[i].onclick = new Function("this.tabs.show("+i+")");
			li[i].tabs = T;
			fix = (i==li.length-1)?f:0;
			if(f==0) fix+=1;
			if(resWidth){li[i].style.width=(w + fix)+"px"}
		}
		T.show(activeN||0)
	}
	init();
}
// tabs function off
// widget scroll on
jQuery.noConflict();
function ScrollFadeWidget(slideContainerId, itemListContainerId, prevBtnId, nextBtnId, fakeLayerId,slideDuration, autoSlideDuration, hoverDuration){
jQuery(function( $ ){
	$.easing.easeOutQuart = function (x, t, b, c, d) {
		return -c * ((t=t/d-1)*t*t*t - 1) + b;
	};
	$(document).ready(function(){
		var menuTimeout = null;
		
		$('#'+slideContainerId).serialScroll({
				items:'li',
				prev:'#'+prevBtnId,
				next:'#'+nextBtnId,
				axis:'x',
				offset:0,
				start:0,
				duration:slideDuration,
				force:true,
				stop:true,
				lock:false,
				cycle:true,
				easing:'easeOutQuart'
		});
		$("#"+slideContainerId+" ul").width($("#"+slideContainerId+" ul li").length * $("#"+slideContainerId).width());
		$("#"+itemListContainerId+" ul li").each(function(i){
			this.relativeTo = $("#"+slideContainerId+" ul li").eq(i);
			this.index = i;
		});

		$("#"+prevBtnId).click(function(){
			setActiveItem(getActiveIndex());
			restartAutoScrollTimer();
		});
		$("#"+nextBtnId).click(function(){
			setActiveItem(getActiveIndex());
			restartAutoScrollTimer();
		});

		function setActiveItem(i){
			$("#"+itemListContainerId+" ul li").removeClass("active");
			$("#"+itemListContainerId+" ul").find("li:eq("+i+")").addClass("active");
		}
		
		function getActiveIndex(){
			return $("#"+slideContainerId).attr("activeItemIndex");
		}
		
		$("#"+itemListContainerId+" ul li").mouseover(function(){
			_this = this;
			menuTimeout = setTimeout(function(){
				$("#"+fakeLayerId).html($("#"+slideContainerId+" ul li").eq(getActiveIndex()).html());
				$("#"+fakeLayerId).css("display","block");
				setActiveItem(_this.index);
				$("#"+slideContainerId).scrollTo(_this.relativeTo, 0, {
					axis:'x',
					offset:0,
					duration:1
				}).trigger('notify.serialScroll',[_this.index]);
				$("#"+fakeLayerId).fadeOut("normal");
				restartAutoScrollTimer();
			},hoverDuration);
		});

		$("#"+itemListContainerId+" ul li").mouseout(function(){
			clearTimeout(menuTimeout);
		});
		
		var autoScrollTimer = null;
		
		function restartAutoScrollTimer(){
			clearTimeout(autoScrollTimer);
			autoScrollTimer = setTimeout(function(){$("#"+nextBtnId).click(); restartAutoScrollTimer()}, autoSlideDuration);		
		}
		restartAutoScrollTimer();
	});
});

}
// widget scroll off

// accordeon on
function Accordeon(listId, plusImg, minusImg){
	var LIST_CONTAINER;
	
	function init(){
		LIST_CONTAINER = document.getElementById(listId);
		if(!LIST_CONTAINER) return;
		hideAll();
		var dt = getDTs();
		selectItem(dt[0]);
		setHandlers();
	}
	
	function selectItem(dt){
		var btn = getToggleButton(dt);
		btn.opened = true;
		btn.getElementsByTagName("IMG")[0].src = minusImg;
		show(getDD(dt));
		dt.className="active";
	}
	
	function getToggleButton(dt){
		var a = dt.getElementsByTagName("A");
		for(var i=0;i<a.length;i++) if(a[i].className == "iconM") return a[i];
	}
	
	function getDD(dt){
		var o = dt.nextSibling;
		while(!o.tagName) o=o.nextSibling;
		return o;
	}
	
	function show(o){o.style.display = "block"}
	
	function hide(o){o.style.display = "none"}
	
	function hideAll(){
		var dt = getDTs();
		for(var i=0;i<dt.length;i++){
			var btn = getToggleButton(dt[i]);
			btn.opened = false;
			btn.index = i;
			btn.getElementsByTagName("IMG")[0].src = plusImg;
			dt[i].className="";
			hide(getDD(dt[i]));
		}
	}
	
	function setHandlers(){
		var dt = getDTs();
		for(var i=0;i<dt.length;i++){
			getToggleButton(dt[i]).onclick=toggleItem;
		}
	}
	
	function toggleItem(){
		hideAll();
		selectItem(this.parentNode);
		return false;
	}
		
	function getDTs(){return LIST_CONTAINER.getElementsByTagName("DT")}
	
	init();
}
// accordeon off
// ticker on
function Ticker(id, backId, fwId, typeTimeout, pauseTimeout)
{
	var headlines=document.getElementById(id).getElementsByTagName('li');
	for(var i=0;i<headlines.length;i++) hideHeadline(i);
    var links=document.getElementById(id).getElementsByTagName('a');
	for(var i=0;i<links.length;i++) links[i].originalText = links[i].innerHTML;
	var forward= document.getElementById(fwId);
	var back= document.getElementById(backId);
	var timeOut, startTimeOut;
	var count=0;
	var currentHeadline='';
	var linkedList=[];
	var nextLetter=0;
	var semiColonYet=true;
   
    forward.onclick=function(){tickerPause(1)}
    back.onclick=function(){tickerPause(-1)}

    startTicking();
	
	function startTicking(){
  	nextLetter=0;
	  currentHeadline=links[count].originalText;
	  setInnerText('');
		showHeadline(count);
		timeOut = setInterval (tick, typeTimeout);
	}
	
	function tick(){
		if(currentHeadline.length>=nextLetter){
    	setInnerText(currentHeadline.substring(0,nextLetter));
			nextLetter++;
    }else{
      nextLetter=0;
      clearInterval(timeOut);
      startTimeOut=window.setTimeout(pauseThenTick, pauseTimeout);
    }
	}
	
	function pauseThenTick(){
    clearTimeout(startTimeOut);
   	hideHeadline(count);
		if(count<headlines.length-1){
			count++;
    }else{
    	count=0;
    }
		startTicking();
	}

  function tickerPause(direction){
  	hideHeadline(count);
    if(direction==0 && timeOut!=false){
			clearInterval(timeOut);
			clearTimeout(startTimeOut);
		  timeOut=false;
		  showHeadline(count);
		}else{
			clearInterval(timeOut);
			clearTimeout(startTimeOut);
      if(direction==0) count++;
      count = getMovedIndex(count,direction);
      startTicking();
		}
  }
    
  function setInnerText(value){links[count].innerHTML=value}
    
  function hideHeadline(index){headlines[index].style.display="none"}
	
  function showHeadline(index){headlines[index].style.display="block"}
    
  function getMovedIndex(currentIndex, direction){
  	var nextIndex=currentIndex+direction;
    if(nextIndex>=headlines.length){   
    	nextIndex=0;
		}else if(nextIndex<0){
      nextIndex=headlines.length-1;
		}  
		return nextIndex;  
  }
}
// ticker off

function showComment(id){
	var react = document.getElementById(id);
	if (react.style.display == "none") {react.style.display = "block"}
	else {react.style.display = "none"}
}

var Effect = {
  _elementDoesNotExistError: {
    name: 'ElementDoesNotExistError',
    message: 'The specified DOM element does not exist, but is required for this effect to operate'
  },
  tagifyText: function(element) {
    if(typeof Builder == 'undefined')
      throw("Effect.tagifyText requires including script.aculo.us' builder.js library");
      
    var tagifyStyle = 'position:relative';
    if(/MSIE/.test(navigator.userAgent) && !window.opera) tagifyStyle += ';zoom:1';
    
    element = $(element);
    $A(element.childNodes).each( function(child) {
      if(child.nodeType==3) {
        child.nodeValue.toArray().each( function(character) {
          element.insertBefore(
            Builder.node('span',{style: tagifyStyle},
              character == ' ' ? String.fromCharCode(160) : character), 
              child);
        });
        Element.remove(child);
      }
    });
  },
  multiple: function(element, effect) {
    var elements;
    if(((typeof element == 'object') || 
        (typeof element == 'function')) && 
       (element.length))
      elements = element;
    else
      elements = $(element).childNodes;
      
    var options = Object.extend({
      speed: 0.1,
      delay: 0.0
    }, arguments[2] || {});
    var masterDelay = options.delay;

    $A(elements).each( function(element, index) {
      new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay }));
    });
  },
  PAIRS: {
    'slide':  ['SlideDown','SlideUp'],
    'blind':  ['BlindDown','BlindUp'],
    'appear': ['Appear','Fade']
  },
  toggle: function(element, effect) {
    element = $(element);
    effect = (effect || 'appear').toLowerCase();
    var options = Object.extend({
      queue: { position:'end', scope:(element.id || 'global'), limit: 1 }
    }, arguments[2] || {});
    Effect[element.visible() ? 
      Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options);
  }
};
/* transitions */
Effect.Transitions = {
  linear: Prototype.K,
  sinoidal: function(pos) {
    return (-Math.cos(pos*Math.PI)/2) + 0.5;
  },
  reverse: function(pos) {
    return 1-pos;
  },
  flicker: function(pos) {
    return ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4;
  },
  wobble: function(pos) {
    return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5;
  },
  pulse: function(pos, pulses) { 
    pulses = pulses || 5; 
    return (
      Math.round((pos % (1/pulses)) * pulses) == 0 ? 
            ((pos * pulses * 2) - Math.floor(pos * pulses * 2)) : 
        1 - ((pos * pulses * 2) - Math.floor(pos * pulses * 2))
      );
  },
  none: function(pos) {
    return 0;
  },
  full: function(pos) {
    return 1;
  }
};
/* core effects */
/* effect on */
Effect.ScopedQueue = Class.create();
Object.extend(Object.extend(Effect.ScopedQueue.prototype, Enumerable), {
  initialize: function() {
    this.effects  = [];
    this.interval = null;
  },
  _each: function(iterator) {
    this.effects._each(iterator);
  },
  add: function(effect) {
    var timestamp = new Date().getTime();
    
    var position = (typeof effect.options.queue == 'string') ? 
      effect.options.queue : effect.options.queue.position;
    
    switch(position) {
      case 'front':
        // move unstarted effects after this effect  
        this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) {
            e.startOn  += effect.finishOn;
            e.finishOn += effect.finishOn;
          });
        break;
      case 'with-last':
        timestamp = this.effects.pluck('startOn').max() || timestamp;
        break;
      case 'end':
        // start effect after last queued effect has finished
        timestamp = this.effects.pluck('finishOn').max() || timestamp;
        break;
    }
    
    effect.startOn  += timestamp;
    effect.finishOn += timestamp;

    if(!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit))
      this.effects.push(effect);
    
    if(!this.interval) 
      this.interval = setInterval(this.loop.bind(this), 15);
  },
  remove: function(effect) {
    this.effects = this.effects.reject(function(e) { return e==effect });
    if(this.effects.length == 0) {
      clearInterval(this.interval);
      this.interval = null;
    }
  },
  loop: function() {
    var timePos = new Date().getTime();
    for(var i=0, len=this.effects.length;i<len;i++) 
      if(this.effects[i]) this.effects[i].loop(timePos);
  }
});

Effect.Base = function() {};
Effect.Base.prototype = {
  position: null,
  start: function(options) {
    this.options      = Object.extend(Object.extend({},Effect.DefaultOptions), options || {});
    this.currentFrame = 0;
    this.state        = 'idle';
    this.startOn      = this.options.delay*1000;
    this.finishOn     = this.startOn + (this.options.duration*1000);
    this.event('beforeStart');
    if(!this.options.sync)
      Effect.Queues.get(typeof this.options.queue == 'string' ? 
        'global' : this.options.queue.scope).add(this);
  },
  loop: function(timePos) {
    if(timePos >= this.startOn) {
      if(timePos >= this.finishOn) {
        this.render(1.0);
        this.cancel();
        this.event('beforeFinish');
        if(this.finish) this.finish(); 
        this.event('afterFinish');
        return;  
      }
      var pos   = (timePos - this.startOn) / (this.finishOn - this.startOn);
      var frame = Math.round(pos * this.options.fps * this.options.duration);
      if(frame > this.currentFrame) {
        this.render(pos);
        this.currentFrame = frame;
      }
    }
  },
  render: function(pos) {
    if(this.state == 'idle') {
      this.state = 'running';
      this.event('beforeSetup');
      if(this.setup) this.setup();
      this.event('afterSetup');
    }
    if(this.state == 'running') {
      if(this.options.transition) pos = this.options.transition(pos);
      pos *= (this.options.to-this.options.from);
      pos += this.options.from;
      this.position = pos;
      this.event('beforeUpdate');
      if(this.update) this.update(pos);
      this.event('afterUpdate');
    }
  },
  cancel: function() {
    if(!this.options.sync)
      Effect.Queues.get(typeof this.options.queue == 'string' ? 
        'global' : this.options.queue.scope).remove(this);
    this.state = 'finished';
  },
  event: function(eventName) {
    if(this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this);
    if(this.options[eventName]) this.options[eventName](this);
  },
  inspect: function() {
    var data = $H();
    for(property in this)
      if(typeof this[property] != 'function') data[property] = this[property];
    return '#<Effect:' + data.inspect() + ',options:' + $H(this.options).inspect() + '>';
  }
}

Effect.Queues = {
  instances: $H(),
  get: function(queueName) {
    if(typeof queueName != 'string') return queueName;
    
    if(!this.instances[queueName])
      this.instances[queueName] = new Effect.ScopedQueue();
      
    return this.instances[queueName];
  }
}

Effect.Queue = Effect.Queues.get('global');
Effect.DefaultOptions = {
  transition: Effect.Transitions.sinoidal,
  duration:   1.0,   // seconds
  fps:        60.0,  // max. 60fps due to Effect.Queue implementation
  sync:       false, // true for combining
  from:       0.0,
  to:         1.0,
  delay:      0.0,
  queue:      'parallel'
}


Effect.Move = Class.create();
Object.extend(Object.extend(Effect.Move.prototype, Effect.Base.prototype), {
  initialize: function(element) {
    this.element = $(element);
    if(!this.element) throw(Effect._elementDoesNotExistError);
    var options = Object.extend({
      x:    0,
      y:    0,
      mode: 'relative'
    }, arguments[1] || {});
    this.start(options);
  },
  setup: function() {
    // Bug in Opera: Opera returns the "real" position of a static element or
    // relative element that does not have top/left explicitly set.
    // ==> Always set top and left for position relative elements in your stylesheets 
    // (to 0 if you do not need them) 
    this.element.makePositioned();
    this.originalLeft = parseFloat(this.element.getStyle('left') || '0');
    this.originalTop  = parseFloat(this.element.getStyle('top')  || '0');
    if(this.options.mode == 'absolute') {
      // absolute movement, so we need to calc deltaX and deltaY
      this.options.x = this.options.x - this.originalLeft;
      this.options.y = this.options.y - this.originalTop;
    }
  },
  update: function(position) {
    this.element.setStyle({
      left: Math.round(this.options.x  * position + this.originalLeft) + 'px',
      top:  Math.round(this.options.y  * position + this.originalTop)  + 'px'
    });
  }
});
/* for backwards compatibility */
Effect.MoveBy = function(element, toTop, toLeft) {
  return new Effect.Move(element, 
    Object.extend({ x: toLeft, y: toTop }, arguments[3] || {}));
};
/* effect off */

/* scroll on */
function ScrollControl(btnId, contentId, aDot, dDot, ajaxDivId){

 /* main scroll on (domestic & intl) */
 var cnnMpVpCurPage = 1;
 var cnnMpVpLock = false;
 var BTNCONTAINER, ULCONTAINER, AJAXDIV, NUM, BTNL, BTNR;
 var T = this;
 this.activeDot = aDot;
 this.deactiveDot = dDot;
 function init(){
  BTNCONTAINER = document.getElementById(btnId);
  ULCONTAINER = document.getElementById(contentId);
  if(!BTNCONTAINER || !ULCONTAINER) return;
  BTNL = BTNCONTAINER.parentNode.getElementsByTagName("A")[0];
  BTNR = BTNCONTAINER.parentNode.getElementsByTagName("A")[1];
  BTNR.scrollControl = BTNL.scrollControl = T;
  BTNL.onclick = function(){this.scrollControl.cnnMpVpPrev(this)}
  BTNR.onclick = function(){this.scrollControl.cnnMpVpNext(this)}
  ULCONTAINER = ULCONTAINER.getElementsByTagName("DIV")[0];
  var w=0,uls = getCh(ULCONTAINER);
  NUM = uls.length;
  for(var i=0;i<NUM;i++){
   var a = document.createElement("A");
   a.href="#";
   a.innerHTML = i==0?'<img src="'+T.activeDot+'" alt=""/>':'<img src="'+T.deactiveDot+'" onmouseover="this.src=\''+T.activeDot+'\'" onmouseout="this.src=\''+T.deactiveDot+'\'" alt="" />';
   a.onclick = new Function("this.scrollControl.cnnMpVpPage("+(i+1)+",this);return false");
   a.scrollControl = T;
   BTNCONTAINER.appendChild(a);
   w += uls[i].offsetWidth;
  }
  ULCONTAINER.style.width = w + "px";
  a = ULCONTAINER.getElementsByTagName("A");
  for(var i=0;i<a.length;i++){
	a[i].onclick=function(){return ajaxDivUpdate(this);}
  }
  
  cnnMpVpUpdateBtns();
 }

 init();
	
	function ajaxDivUpdate(a){
		AJAXDIV = document.getElementById(ajaxDivId);
		if(!AJAXDIV) return true;
		clearTDClasses(ULCONTAINER);
		a.parentNode.className="active";
		AJAXDIV.innerHTML="Loading...";
		new Ajax(a.href, function(txt){AJAXDIV.innerHTML=txt}).send();
		return false;
	}
	
	function clearTDClasses(o){
		var td = o.getElementsByTagName("TD");
		for(var i=0;i<td.length;i++) td[i].className="";
	}
	
	function getCh(o){
		var arr=[];
		var ch = o.childNodes;
		for(var i=0;i<ch.length;i++) if(ch[i].tagName) arr.push(ch[i]);
		return arr;
	}
	
	function cnnMpVpBlur( lnk ) {
		try {
			lnk.blur();
		} catch(e) {};
	}
	
	/*
	 * cnnMpVpNext() and cnnMpVpPrev()
	 * are called from previous and next buttons
	 */
	function cnnMpVpNext( lnk ) {
		cnnMpVpBlur( lnk );
		if((cnnMpVpCurPage < NUM)&&(!cnnMpVpLock)) {
			cnnMpVpSlideLeft();
		}
	}
	this.cnnMpVpNext = cnnMpVpNext;
	
	function cnnMpVpPrev( lnk ) {
		cnnMpVpBlur( lnk );
		if((cnnMpVpCurPage > 1)&&(!cnnMpVpLock)) {
			cnnMpVpSlideRight();
		}
	}
	this.cnnMpVpPrev = cnnMpVpPrev;
	/*
	 * cnnMpVpPage( intPage )
	 * called from clicking on gray dot icon
	 */
	function cnnMpVpPage( intPage, lnk ) {
		if(intPage==cnnMpVpCurPage) return false;
		cnnMpVpBlur( lnk );
		if((cnnMpVpCurPage != intPage)&&(!cnnMpVpLock)) {
			if(cnnMpVpCurPage < intPage) {
				if((intPage - cnnMpVpCurPage) > 1) {
					cnnMpVpSlideDoubleLeft(intPage - cnnMpVpCurPage);
				}
				else {
					cnnMpVpSlideLeft();
				}
			}
			else {
				if((cnnMpVpCurPage - intPage) > 1) {
					cnnMpVpSlideDoubleRight(cnnMpVpCurPage - intPage);
				}
				else {
					cnnMpVpSlideRight();
				}
			}
		}
	}
	this.cnnMpVpPage = cnnMpVpPage;
	
	function cnnLockMpVp( intDur ) {
		var cnnLockDur = intDur * 100;
		cnnMpVpLock = true;
		setTimeout(function() { cnnMpVpLock = false; },cnnLockDur);
	}
	this.cnnLockMpVp = cnnLockMpVp;
	
	function cnnMpVpSlideLeft(id) {
		cnnLockMpVp(3);
		var w = ULCONTAINER.parentNode.offsetWidth;
		new Effect.MoveBy( ULCONTAINER, 0, -w , {duration: 0.3} );
		cnnMpVpCurPage++;
		cnnMpVpMoveDot();
		cnnMpVpUpdateBtns();
	}
	this.cnnMpVpSlideLeft = cnnMpVpSlideLeft;

	function cnnMpVpSlideDoubleLeft(n) {
		cnnLockMpVp(3*n);
		var w = ULCONTAINER.parentNode.offsetWidth;
		new Effect.MoveBy( ULCONTAINER, 0, -w*n , {duration: 0.6} );
		cnnMpVpCurPage+=n;
		cnnMpVpMoveDot();
		cnnMpVpUpdateBtns();
	}
	this.cnnMpVpSlideDoubleLeft = cnnMpVpSlideDoubleLeft;
	
	function cnnMpVpSlideRight() {
		cnnLockMpVp(3);
		var w = ULCONTAINER.parentNode.offsetWidth;
		new Effect.MoveBy( ULCONTAINER, 0, w , {duration: 0.3} );
		cnnMpVpCurPage--;
		cnnMpVpMoveDot();
		cnnMpVpUpdateBtns();
	}
	this.cnnMpVpSlideRight = cnnMpVpSlideRight;

	function cnnMpVpSlideDoubleRight(n) {
		cnnLockMpVp(3*n);
		var w = ULCONTAINER.parentNode.offsetWidth;
		new Effect.MoveBy( ULCONTAINER, 0, w*n , {duration: 0.6} );
		cnnMpVpCurPage-=n;
		cnnMpVpMoveDot();
		cnnMpVpUpdateBtns();
	}
	this.cnnMpVpSlideDoubleRight =cnnMpVpSlideDoubleRight;

	function cnnMpVpMoveDot() {
		for(i=0;i<NUM;i++) {
			var b = BTNCONTAINER.childNodes[i].getElementsByTagName("IMG")[0];
			b.src = T.deactiveDot;
			b.onmouseover = function() {this.src = T.activeDot;}
			b.onmouseout = function() {this.src = T.deactiveDot;}
		}
		b = BTNCONTAINER.childNodes[cnnMpVpCurPage-1];
		b.getElementsByTagName("IMG")[0].src = T.activeDot;
		b.getElementsByTagName("IMG")[0].onmouseover = function() {}
		b.getElementsByTagName("IMG")[0].onmouseout = function() {}
	}
	this.cnnMpVpMoveDot= cnnMpVpMoveDot;
	
	function cnnMpVpUpdateBtns() {
		if(cnnMpVpCurPage > 1) {
			BTNL.style.cursor ='pointer';
			BTNL.className = '';
		}
		else {
			BTNL.style.cursor ='default';
			BTNL.className = 'disabled';
		}

		if(cnnMpVpCurPage < NUM) {
			BTNR.style.cursor ='pointer';
			BTNR.className = '';
		}
		else {
			BTNR.style.cursor ='default';
			BTNR.className = 'disabled';
		}
	}
	this.cnnMpVpUpdateBtns = cnnMpVpUpdateBtns;
	/* main scroll off */
}
/* scroll off */

/* divide ul on */
function divideUls(){
  var c = 0;
  var uls = document.body.getElementsByTagName("UL");
  for(var i=0;i<uls.length;i++){
   if(uls[i].className=="twoColums" && uls[i].id.indexOf(String("__dividedUL_"+c))!=0){
    c++;
    divideList(uls[i],2,String("__dividedUL_"+c));
   }
  }
}

function divideList(parentId,n,prefix){
 var counter=1;
 var tag=(typeof parentId=="object")?parentId:document.getElementById(parentId);
 var ch = getChildren(tag);
 if(tag.tagName=="DL") assignSubChildren(ch);
 for(var x=n;x>1;x--){
  var arrA = getChildren(tag);
  var newTag = document.createElement(tag.tagName);
  newTag.className = tag.className;
  var dividedListnum = Math.ceil(arrA.length/x);
  newTag.id = prefix+counter;
  if(tag.nextSibling) tag.parentNode.insertBefore(newTag,tag.nextSibling);
  else tag.parentNode.appendChild(newTag);
  for(i=dividedListnum;i<arrA.length;i++){
   var newChild = arrA[i].cloneNode(true);
   appendNewChild(newTag.id,newChild);
  }
  for(var j=arrA.length-1;j>=dividedListnum;j--){
   if(arrA[j].removeNode) arrA[j].removeNode(true);
   else if(arrA[j].parentNode.removeChild) arrA[j].parentNode.removeChild(arrA[j]);
  }
  tag = document.getElementById(newTag.id);
  counter++;
 }
 if(tag.tagName=="DL") appendSubChildren(n,prefix);
}

function getChildren(o){
 if(o.tagName=="UL") return o.getElementsByTagName("LI");
 else if(o.tagName=="DL") return o.getElementsByTagName("DT");
}

function assignSubChildren(dtArr){
  var resArr = [];
  for(var i=0;i<dtArr.length;i++){
   var ddArr = [];
   dtArr[i].setAttribute("__index__",String(i))
   var dd = dtArr[i].nextSibling;
   while(dd){
    if(dd.tagName){
     ddArr[ddArr.length] = dd;
    }
    dd = dd.nextSibling;
    if(dd && dd.tagName && dd.tagName=="DT") break;
   }
   resArr[resArr.length] = [String(i),ddArr];
  }
  window.tempNodesArray = resArr;
}

function appendNewChild(newTagId,o){
 if(o.tagName=="LI") document.getElementById(newTagId).appendChild(o);
 else if(o.tagName=="DT"){
  document.getElementById(newTagId).appendChild(o);
 }
}

function appendSubChildren(n,prefix){
 for(var z=1;z<n;z++){
  var dl = document.getElementById(prefix+z);
  var dtChildren = dl.getElementsByTagName("DT");
  for(var v=0;v<dtChildren.length;v++){
   for(var i=0;i<window.tempNodesArray.length;i++){
    if(window.tempNodesArray[i][0]==dtChildren[v].getAttribute("__index__")){
     for(var j=0;j<window.tempNodesArray[i][1].length;j++){
      var cloneDD = window.tempNodesArray[i][1][j].cloneNode(true);
      if(window.tempNodesArray[i][1][j].removeNode) window.tempNodesArray[i][1][j].removeNode(true);
      else if(window.tempNodesArray[i][1][j].parentNode.removeChild) window.tempNodesArray[i][1][j].parentNode.removeChild(window.tempNodesArray[i][1][j]);
      if(dtChildren[v+1]){
       dl.insertBefore(cloneDD,dtChildren[v+1]);
      }else{
       dl.appendChild(cloneDD);
      }
     }
     break;
    }
   }
  }
 }
}

function printen() {
	rPopup = window;
	rPopup.open("printen.html","");
}

/**
 * reflection.js v1.9
 * http://cow.neondragon.net/stuff/reflection/
 * Freely distributable under MIT-style license.
 */
 
/* From prototype.js */
if (!document.myGetElementsByClassName) {
	document.myGetElementsByClassName = function(className) {
		var children = document.getElementsByTagName('*') || document.all;
		var elements = new Array();
	  
		for (var i = 0; i < children.length; i++) {
			var child = children[i];
			var classNames = child.className.split(' ');
			for (var j = 0; j < classNames.length; j++) {
				if (classNames[j] == className) {
					elements.push(child);
					break;
				}
			}
		}
		return elements;
	}
}

var Reflection = {
	defaultHeight : 0.15,
	defaultOpacity: 0.35,
	
	add: function(image, options) {
		Reflection.remove(image);
		
		doptions = { "height" : Reflection.defaultHeight, "opacity" : Reflection.defaultOpacity }
		if (options) {
			for (var i in doptions) {
				if (!options[i]) {
					options[i] = doptions[i];
				}
			}
		} else {
			options = doptions;
		}
	
		try {
			var d = document.createElement('div');
			var p = image;
			
			var classes = p.className.split(' ');
			var newClasses = '';
			for (j=0;j<classes.length;j++) {
				if (classes[j] != "reflect") {
					if (newClasses) {
						newClasses += ' '
					}
					
					newClasses += classes[j];
				}
			}

			var reflectionHeight = Math.floor(p.height*options['height']);
			var divHeight = Math.floor(p.height*(1+options['height']));
			
			var reflectionWidth = p.width;
			
			if (document.all && !window.opera) {
				/* Fix hyperlinks */
                if(p.parentElement.tagName == 'A') {
	                var d = document.createElement('a');
	                d.href = p.parentElement.href;
                }  
                    
				/* Copy original image's classes & styles to div */
				d.className = newClasses;
				p.className = 'reflected';
				
				d.style.cssText = p.style.cssText;
				//p.style.cssText = 'vertical-align: bottom';
			
				var reflection = document.createElement('img');
				reflection.src = p.src;
				reflection.className = 'reflectImg';
				reflection.style.width = reflectionWidth+'px';
				//reflection.style.display = 'block';
				reflection.style.height = p.height+"px";
				reflection.style.top = ((p.height+3)+'px');
				
				reflection.style.marginBottom = "-"+(p.height-reflectionHeight)+'px';
				reflection.style.filter = 'flipv progid:DXImageTransform.Microsoft.Alpha(opacity='+(options['opacity']*100)+', style=1, finishOpacity=0, startx=0, starty=0, finishx=0, finishy='+(options['height']*100)+')';
				
				d.style.width = reflectionWidth+'px';
				d.style.height = divHeight+'px';
				p.parentNode.replaceChild(d, p);
				
				d.appendChild(p);
				d.appendChild(reflection);
			} else {
				var canvas = document.createElement('canvas');
				if (canvas.getContext) {
					/* Copy original image's classes & styles to div */
					d.className = newClasses;
					p.className = 'reflected';
					
					d.style.cssText = p.style.cssText;
					//p.style.cssText = 'vertical-align: bottom';
			
					var context = canvas.getContext("2d");
				
					canvas.className = 'reflectImg';
					canvas.style.height = reflectionHeight+'px';
					canvas.style.width = reflectionWidth+'px';
					canvas.height = reflectionHeight;
					canvas.width = reflectionWidth;
					canvas.style.top = ((p.height+3)+'px');
					d.style.width = reflectionWidth+'px';
					p.parentNode.replaceChild(d, p);
					
					d.appendChild(p);
					d.appendChild(canvas);
					
					context.save();
					
					context.translate(0,image.height-1);
					context.scale(1,-1);
					
					context.drawImage(image, 0, 0, reflectionWidth, image.height);
	
					context.restore();
					
					context.globalCompositeOperation = "destination-out";
					var gradient = context.createLinearGradient(0, 0, 0, reflectionHeight);
					
					gradient.addColorStop(1, "rgba(255, 255, 255, 1.0)");
					gradient.addColorStop(0, "rgba(255, 255, 255, "+(1-options['opacity'])+")");
		
					context.fillStyle = gradient;
					if (navigator.appVersion.indexOf('WebKit') != -1) {
						context.fill();
					} else {
						context.fillRect(0, 0, reflectionWidth, reflectionHeight*2);
					}
				}
			}
		} catch (e) {
	    }
	},
	
	remove : function(image) {
		if (image.className == "reflected") {
			image.className = image.parentNode.className;
			image.parentNode.parentNode.replaceChild(image, image.parentNode);
		}
	}
}

function addReflections() {
	var rimages = document.myGetElementsByClassName('reflect');
	for (i=0;i<rimages.length;i++) {
		var rheight = null;
		var ropacity = null;
		
		var classes = rimages[i].className.split(' ');
		for (j=0;j<classes.length;j++) {
			if (classes[j].indexOf("rheight") == 0) {
				var rheight = classes[j].substring(7)/100;
			} else if (classes[j].indexOf("ropacity") == 0) {
				var ropacity = classes[j].substring(8)/100;
			}
		}
		
		Reflection.add(rimages[i], { height: rheight, opacity : ropacity});
	}
}



addEvent(window, "load", function(){
	if(document.getElementById("ticker"))	{new Ticker('ticker','ticker-back','ticker-forward', 100, 2500)}
}, false);
addEvent(window, "load", function(){new Tabs("tLinkTabs", "tLinkTabsContainer",0)}, false);
addEvent(window, "load", function(){addReflections()}, false);

