function printWindow(){
   bV = parseInt(navigator.appVersion)
   if (bV >= 4) window.print()
}

function runSlideShow(){
	blendimage('splashimage','blendimage', preLoad[jss].src,CrossFadeDuration);
	
	jss = jss + 1;
	if (jss > (pss)) 
		jss=1;

	tss = setTimeout('runSlideShow()', SlideShowSpeed);
}

function runSlideShows(){

	if (document.all){
		document.images.PictureBox.style.filter="blendTrans(duration=3)";
		document.images.PictureBox.style.filter="blendTrans(duration=2)";
		document.images.PictureBox.filters.blendTrans.Apply();
	}
		
	document.images.PictureBox.src = preLoad[jss].src;

	if (document.all) 
		document.images.PictureBox.filters.blendTrans.Play();

	jss = jss + 1;

	if (jss > (pss)) 
		jss=1;

	tss = setTimeout('runSlideShow()', SlideShowSpeed);
}

function imageFadeOut(img) 
{
  if ( document.all) 
  {
    img.opacity = 100;
    setOpacity(img.name, -10, 100);
  }
}

function imageFadeIn(img) 
{
  if ( document.all) 
  {
    img.opacity = 0;
    setOpacity(img.name, 10, 100);
  }
}

function setOpacity (imgName, step, delay) 
{
  var img = document.images[imgName];
  img.opacity += step;
  if (document.all) img.style.filter = 'alpha(opacity = ' + img.opacity + ')'; 
  if (step > 0 && img.opacity < 100 || step < 0 && img.opacity > 0)
    setTimeout('setOpacity("' + img.name + '",' + step + ', ' + delay + ')', delay);
} 

function opacity(id, opacStart, opacEnd, millisec) {
	//speed for each frame
	var speed = Math.round(millisec / 100);
	var timer = 0;

	//determine the direction for the blending, if start and end are the same nothing happens
	if(opacStart > opacEnd) {
		for(i = opacStart; i >= opacEnd; i--) {
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}
	} else if(opacStart < opacEnd) {
		for(i = opacStart; i <= opacEnd; i++)
			{
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}
	}
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
	var object = document.getElementById(id).style; 
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + opacity + ")";
}

function shiftOpacity(id, millisec) {
	//if an element is invisible, make it visible, else make it ivisible
	if(document.getElementById(id).style.opacity == 0) {
		opacity(id, 0, 100, millisec);
	} else {
		opacity(id, 100, 0, millisec);
	}
}

function blendimage(divid, imageid, imagefile, millisec) {
	var speed = Math.round(millisec / 100);
	var timer = 0;
	
	//set the current image as background
	document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")";
	
	//make image transparent
	changeOpac(0, imageid);
	
	//make new image
	document.getElementById(imageid).src = imagefile;

	//fade in image
	for(i = 0; i <= 100; i++) {
		setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed));
		timer++;
	}
}

function currentOpac(id, opacEnd, millisec) {
	//standard opacity is 100
	var currentOpac = 100;
	
	//if the element has an opacity set, get it
	if(document.getElementById(id).style.opacity < 100) {
		currentOpac = document.getElementById(id).style.opacity * 100;
	}

	//call for the function that changes the opacity
	opacity(id, currentOpac, opacEnd, millisec)
}

function bookmarkpage() 
{
  if (document.all) 
  {
    window.external.AddFavorite(location.href, document.title);
  }
}

/**************************************************
 * dom-drag.js
 * 09.25.2001
 * www.youngpup.net
 **************************************************/
var MyJSSscrollerHASDragging = true;

function BrowserCheck() {
var b = navigator.appName;
if (b == "Netscape") this.b = "NS";
else if (b == "Microsoft Internet Explorer") this.b = "IE";
else this.b = b;
this.v = parseInt(navigator.appVersion);
this.NS = (this.b == "NS" && this.v>=4);
this.NS4 = (this.b == "NS" && this.v == 4);
this.NS5 = (this.b == "NS" && this.v == 5);
this.IE = (this.b == "IE" && this.v>=4);
this.IE4 = (navigator.userAgent.indexOf('MSIE 4')>0);
this.IE5 = (navigator.userAgent.indexOf('MSIE 5')>0);
this.Opera = (navigator.appName=='Opera');
if (this.IE5 || this.NS5) this.VER5 = true;
if (this.IE4 || this.NS4) this.VER4 = true;
this.OLD = (! this.VER5 && ! this.VER4) ? true : false;
this.min = (this.NS||this.IE);
}
is = new BrowserCheck();

if (is.NS) {
	document.captureEvents(Event.MOUSEMOVE);
}

var zindexcount=0; 
 
 
var Drag = {
	obj : null,

	init : function(o, oRoot, minX, maxX, minY, maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper)
	{
		o.onmousedown	= Drag.start;

		o.hmode			= bSwapHorzRef ? false : true ;
		o.vmode			= bSwapVertRef ? false : true ;

		o.root = oRoot && oRoot != null ? oRoot : o ;

		if (o.hmode  && isNaN(parseInt(o.root.style.left  ))) o.root.style.left   = "0px";
		if (o.vmode  && isNaN(parseInt(o.root.style.top   ))) o.root.style.top    = "0px";
		if (!o.hmode && isNaN(parseInt(o.root.style.right ))) o.root.style.right  = "0px";
		if (!o.vmode && isNaN(parseInt(o.root.style.bottom))) o.root.style.bottom = "0px";

		o.minX	= typeof minX != 'undefined' ? minX : null;
		o.minY	= typeof minY != 'undefined' ? minY : null;
		o.maxX	= typeof maxX != 'undefined' ? maxX : null;
		o.maxY	= typeof maxY != 'undefined' ? maxY : null;

		o.xMapper = fXMapper ? fXMapper : null;
		o.yMapper = fYMapper ? fYMapper : null;

		o.root.onDragStart	= new Function();
		o.root.onDragEnd	= new Function();
		o.root.onDrag		= new Function();
		o.root.onmouseover = function() {
		zindexcount = zindexcount+100;
		this.style.zIndex = zindexcount;
		}
	},

	start : function(e)
	{
		if(is.IE) {
		eveniment = window.event;
		} else {
		eveniment = e;
		}
		
		if(is.IE){
		elementul = eveniment.srcElement;
		}else{
		elementul = eveniment.target;
		}

		if (elementul.tagName == 'A' || elementul.tagName == 'INPUT') {
			return false;
		}
		
		

		var o = Drag.obj = this;

		
		e = Drag.fixE(e);
		var y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);
		var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
		o.root.onDragStart(x, y);

		o.lastMouseX	= e.clientX;
		o.lastMouseY	= e.clientY;

		if (o.hmode) {
			if (o.minX != null)	o.minMouseX	= e.clientX - x + o.minX;
			if (o.maxX != null)	o.maxMouseX	= o.minMouseX + o.maxX - o.minX;
		} else {
			if (o.minX != null) o.maxMouseX = -o.minX + e.clientX + x;
			if (o.maxX != null) o.minMouseX = -o.maxX + e.clientX + x;
		}

		if (o.vmode) {
			if (o.minY != null)	o.minMouseY	= e.clientY - y + o.minY;
			if (o.maxY != null)	o.maxMouseY	= o.minMouseY + o.maxY - o.minY;
		} else {
			if (o.minY != null) o.maxMouseY = -o.minY + e.clientY + y;
			if (o.maxY != null) o.minMouseY = -o.maxY + e.clientY + y;
		}

		document.onmousemove	= Drag.drag;
		document.onmouseup		= Drag.end;

		return false;
	},

	drag : function(e) {
		e = Drag.fixE(e);
		var o = Drag.obj;

		var ey	= e.clientY;
		var ex	= e.clientX;
		var y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);
		var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
		var nx, ny;

		if (o.minX != null) ex = o.hmode ? Math.max(ex, o.minMouseX) : Math.min(ex, o.maxMouseX);
		if (o.maxX != null) ex = o.hmode ? Math.min(ex, o.maxMouseX) : Math.max(ex, o.minMouseX);
		if (o.minY != null) ey = o.vmode ? Math.max(ey, o.minMouseY) : Math.min(ey, o.maxMouseY);
		if (o.maxY != null) ey = o.vmode ? Math.min(ey, o.maxMouseY) : Math.max(ey, o.minMouseY);

		nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1));
		ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1));

		if (o.xMapper)		nx = o.xMapper(y)
		else if (o.yMapper)	ny = o.yMapper(x)

		Drag.obj.root.style[o.hmode ? "left" : "right"] = nx + "px";
		Drag.obj.root.style[o.vmode ? "top" : "bottom"] = ny + "px";
		Drag.obj.lastMouseX	= ex;
		Drag.obj.lastMouseY	= ey;

		
		Drag.obj.root.onDrag(nx, ny, Drag.obj);
		return false;
	},

	end : function()
	{
		document.onmousemove = null;
		document.onmouseup   = null;
		Drag.obj.root.onDragEnd(	parseInt(Drag.obj.root.style[Drag.obj.hmode ? "left" : "right"]), 
									parseInt(Drag.obj.root.style[Drag.obj.vmode ? "top" : "bottom"]), Drag.obj);
		Drag.obj = null;
	},

	fixE : function(e)
	{
		if (typeof e == 'undefined') e = window.event;
		if (typeof e.layerX == 'undefined') e.layerX = e.offsetX;
		if (typeof e.layerY == 'undefined') e.layerY = e.offsetY;
		return e;
	}
};

var MyJSSscrollerHASDragging = false;

var MyJSScrollerHandler = {
	scrollers : [],
	intvals : [],
	
	initByClassName : function(className) {
		i = this.scrollers.length;
		document.getElementsByClassName(className).each(function(node) {
			var orient, dir, speed;
			MyJSScrollerHandler.scrollers[i] = new MyJSScroller(node, i, orient, dir, speed);
			i++;
		});
	},
	
	attachMouseWheel : function(el, index) {
		if (window.addEventListener)
		        /** DOMMouseScroll is for mozilla. */
		       el.addEventListener('DOMMouseScroll', function(event){MyJSScrollerHandler.wheel(event, index);}, false);
		/** IE/Opera. */
			el.onmousewheel = function(event){MyJSScrollerHandler.wheel(event, index);};
	},
		
	handleWheelMovement : function(delta, index) {
		MyJSScrollerHandler.scrollers[index].move(-(delta*10));
	},
	
	wheel : function(event, index){
	        var delta = 0;
	        if (!event) /* For IE. */
	                event = window.event;
	        if (event.wheelDelta) { /* IE/Opera. */
	                delta = event.wheelDelta/120;
	                if (window.opera)
	                        delta = -delta;
	        } else if (event.detail) { /** Mozilla case. */
	                delta = -event.detail/3;
	        }
	        if (delta)
	                MyJSScrollerHandler.handleWheelMovement(delta, index);
	        if (event.preventDefault)
	                event.preventDefault();
		event.returnValue = false;
	}
};


function MyJSScroller(node, index,  orient, dir, speed) {
	
	if (MyJSScrollerHandler.scrollers[index]) {
		return false;
	}
	

	if (node.getAttribute('myjsscroller') == 'true') {
		return false;
	}
	
	node.setAttribute('myjsscroller', 'true');
	
	this.pausePoints = [];
	this.pauseTimer = 0;
	this.node = node;
	this.index = index;
	this.orient = orient || node.getAttribute('orientation');
	this.dir = dir || node.getAttribute('direction');
	spd = speed || node.getAttribute('scrollspeed');
	if (!spd) {
		spd = 20;
	}
	
	this.speed = 1000/spd;
	wraper = document.createElement('DIV');
	//wraper.style.border = '1px solid red';
	wraper.style.height = '100%';
	node.style.overflow = 'hidden';
	wraper.style.overflow = 'hidden';
	
	wraper.style.position = 'relative';
	wraper.style.top = '0px';
	wraper.style.left = '0px';
	this.wraper = wraper;
	movingWraper = document.createElement('DIV');
	if (this.orient == 'horizontal') {
		movingWraper.style.whiteSpace = 'nowrap';
	}
	
	//movingWraper.style.border = '1px solid blue';
	movingWraper.style.position='absolute';
	this.movingWraper = movingWraper;
	wraper.appendChild(movingWraper);
	movingWraper.innerHTML = node.innerHTML;
	node.innerHTML = '';
	node.appendChild(wraper);
	this.w = movingWraper.offsetWidth;
	this.h = movingWraper.offsetHeight;
	
	if (this.orient != 'horizontal' && this.dir == 'down') {
		this.movingWraper.style.top = -this.h+'px';
	}
	
	
	if (MyJSSscrollerHASDragging) {
		if (this.orient == 'horizontal') {
	 		drg = Drag.init(movingWraper, null, -this.w, this.w, 0, 0);
		} else {
	 		drg = Drag.init(movingWraper, null, 0, 0, -this.h, this.h);
		}
	}
	
	
	
	
	for (var i = 0 ; i < movingWraper.childNodes.length ; i++) {
		ch = movingWraper.childNodes[i];
		if (ch.className == 'scrollpauser') {
			
			
			if (ch.getAttribute('scrollhide') == "1") {
				ch.style.visibility = 'hidden';
				ch.style.display ='inline';
				ch.style.margin = '0px';
				ch.style.border = '0px';
			}
			if (ch.getAttribute('scrolldelay') > 0) {
				delay = ch.getAttribute('scrolldelay');
			} else {
				delay = 2000;			
			}
			this.pausePoints.push([ch.offsetTop, ch.offsetLeft, delay]);
		}
	}
	
	
	
	
	movingWraper.onDragStart = function(x,y) {
		MyJSScrollerHandler.scrollers[index].dragged = true;
		MyJSScrollerHandler.scrollers[index].pause();
	}
	movingWraper.onDragEnd = function() {
		MyJSScrollerHandler.scrollers[index].dragged = false;
		MyJSScrollerHandler.scrollers[index].resume();
	}
	
	
	node.onmouseover = function() {
		MyJSScrollerHandler.scrollers[index].pause();
	}
	node.onmouseout = function() {
		if (!MyJSScrollerHandler.scrollers[index].dragged) {
			MyJSScrollerHandler.scrollers[index].resume();
		}
	}
	MyJSScrollerHandler.attachMouseWheel(node, index);
	
	this.start();
	
}

MyJSScroller.prototype.start = function() {
	
	if (!MyJSScrollerHandler.intvals[this.index]) {
		MyJSScrollerHandler.intvals[this.index] = window.setInterval('MyJSScrollerHandler.scrollers[\''+this.index+'\'].move()', this.speed);
	}
}

MyJSScroller.prototype.move = function(delta) {
	
	mw = this.movingWraper;
	slf = this;
	
	if (!delta) {
			delta = 1
		}
		
	if (this.orient == 'horizontal') {
		if (this.dir != "right") {
			if (mw.offsetLeft < -this.w) {
				mw.style.left = this.wraper.offsetWidth+'px';
			} else {
			 	mw.style.left = (mw.offsetLeft-delta)+'px';
			}
		} else {
			if (mw.offsetLeft > this.wraper.offsetWidth) {
				mw.style.left = -mw.offsetWidth+'px';
			} else {
			 	mw.style.left = (mw.offsetLeft+delta)+'px';
			}
		}
	} else {
		if (this.dir != "down") {
			if (mw.offsetTop > -this.h) {
			
				//pausers
				this.pausePoints.each(function(point){
					if (-point[0] == mw.offsetTop) {
						slf.pause();
						window.setTimeout('MyJSScrollerHandler.scrollers[\''+slf.index+'\'].start()', point[2]);
					}
				});
				
				mw.style.top = (mw.offsetTop-delta)+'px';
				
			} else {
			 	mw.style.top = this.wraper.offsetHeight+'px';
			}
		} else {
			if (-mw.offsetTop+this.wraper.offsetHeight > 0) {
				mw.style.top = (mw.offsetTop+delta)+'px';
			} else {
			 	mw.style.top = -mw.offsetHeight+'px';
			}
		}
	}
}

MyJSScroller.prototype.pause = function() {
	window.clearInterval(MyJSScrollerHandler.intvals[this.index]);
	MyJSScrollerHandler.intvals[this.index] = false;
}

MyJSScroller.prototype.resume = function() {
	this.start();
}

//window.onload = function() {MyJSScrollerHandler.initByClassName('scrollable');}

