﻿
//Start fleXcroll using any method you like, prefer to use external scripts to do this,
//This is for easy viewing of the method used to initialize the script.
if (document.getElementById && document.getElementsByTagName) {
if (window.addEventListener) window.addEventListener('load', initScrollBars, false);
else if (window.attachEvent) window.attachEvent('onload', initScrollBars);
}


function initScrollBars() {
CSBfleXcroll('test');
CSBfleXcroll('descrip');
CSBfleXcroll('ScrollBasket');
CSBfleXcroll('ScrollRP');
CSBfleXcroll('general');
}

//Demonstration functions for dynamic changes, not required for running fleXcroll.
function insertRemoveP(reMove) {
var targetEl = document.getElementById('dynamictest');
var scrollDiv = document.getElementById('test1');
if (targetEl == null || scrollDiv == null) return;

if (typeof(targetEl.parS) == 'undefined') targetEl.parS = new Array();
if (!reMove) {
targetEl.parS[targetEl.parS.length] = document.createElement('p');
targetEl.parS[targetEl.parS.length-1].appendChild(document.createTextNode('Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Pellentesque ultrices facilisis risus. Aenean sollicitudin imperdiet justo.'));
targetEl.appendChild(targetEl.parS[targetEl.parS.length-1]);
} else if (targetEl.parS.length > 0) {
targetEl.parS[targetEl.parS.length-1].parentNode.removeChild(targetEl.parS[targetEl.parS.length-1]);
targetEl.parS.length = targetEl.parS.length - 1;
}
//Following is the method to tell fleXcrolled div to update itself.
scrollDiv.scrollUpdate();
}

function makeWideNarrow() {
var targetEl = document.getElementById('dynamictest');
var scrollDiv = document.getElementById('test1');
if (targetEl == null || scrollDiv == null) return;
if (targetEl.parentNode.className=='dynamic') targetEl.parentNode.className = 'fixedsize';
else targetEl.parentNode.className='dynamic';
scrollDiv.scrollUpdate();
}

function cleanTestDiv() {
var targetEl = document.getElementById('dynamictest');
var scrollDiv = document.getElementById('test1');
if (targetEl != null) targetEl.innerHTML = '';
if (typeof(targetEl.parS) != 'undefined') targetEl.parS = new Array();
targetEl.parentNode.className = 'dynamic';
scrollDiv.scrollUpdate();
}

//en basic example external module to control scroll from outside
//NOT required for fleXcroll to run.
function fleXcrollTo(id,x,y) {
	var scrollDiv = document.getElementById(id);
	//Return if the target is not a fleXcrolled div.
	if (scrollDiv == null || !scrollDiv.fleXcroll) return;
	scrollDiv.commitScroll(x,y,true);
	/*
	Following is the method to commit a scroll:
		element.commitScroll(x,y,relative);
	x and y values are horizontal and vertical
	and can be set to false.
	relative can be either true or false. If true,
	x and y is used as relative scrolling.
	Currently these numbers refer to scrollbar position and
	not scrolled content position. With the next updates,
	it will be possible to use units, and it will be possible
	to directly control the scrolled content position.
	*/

}



/*
fleXcroll v1.5.0 Public Version
This license text has to stay intact at all times:
Cross Browser Custom Scroll Bar Script by Hesido.
Public version - Free for non-commercial uses.

This script cannot be used in any commercially built
web sites, or in sites that relates to commercial
activities. 

Derivative works are only allowed for personal uses,
and they cannot be redistributed.
For licensing options:
Contact Emrah BASKAYA @ www.hesido.com

FleXcroll Public Key Code: 20050907122003339
MD5 hash for this license: 9ada3be4d7496200ab2665160807745d

End of license text---
*/

function CSBfleXcroll(targetId){
if(!document.getElementById||document.getElementById(targetId)==null||!document.createElement||navigator.userAgent.indexOf('Safari')!=-1||navigator.vendor=='KDE')return;
var dDiv=document.getElementById(targetId);
var cDiv=createDiv('contentwrapper',true);var mDiv=createDiv('mcontentwrapper',true);
var tDiv=createDiv('scrollwrapper',true);var pDiv=createDiv('copyholder',true);
pDiv.style.border='1px solid transparent';
pDiv.style.visibility='hidden';
copyStyles(
'dDiv','pDiv',false,true,'0px',
['border-left-width','border-right-width','border-top-width','border-bottom-width'],
['borderLeftWidth','borderRightWidth','borderTopWidth','borderBottomWidth']
);
var intlHeight=dDiv.offsetHeight,intlWidth=dDiv.offsetWidth,movedContent;
dDiv.scrollPos=[0,0,0,0];dDiv.pageScroll=[0,0];dDiv.stepScroll=[0,0];

copyStyles(
'dDiv','mDiv',false,true,'0px',
['padding-left','padding-right','padding-top','padding-bottom'],
['paddingLeft','paddingRight','paddingTop','paddingBottom']
);

var postWidth=dDiv.offsetWidth,postHeight=dDiv.offsetHeight,heightLoss=intlHeight-postHeight,widthLoss=intlWidth-postWidth;
dDiv.style.width=intlWidth+'px';dDiv.style.height=intlHeight+'px';
tDiv.style.width=dDiv.offsetWidth+'px';tDiv.style.height=dDiv.offsetHeight+'px';
mDiv.style.width=postWidth+'px';mDiv.style.height=postHeight+'px';
tDiv.style.position='absolute';tDiv.style.top='0px';tDiv.style.left='0px';
movedContent=dDiv.innerHTML;dDiv.innerHTML='';cDiv.innerHTML=movedContent;
dDiv.appendChild(mDiv);dDiv.appendChild(pDiv);mDiv.appendChild(cDiv);
cDiv.style.position='relative';mDiv.style.position='relative';cDiv.style.padding='1px';
cDiv.style.width="100%";//fix IE7Beta2Bug
dDiv.style.overflow='hidden';mDiv.style.overflow='hidden';
mDiv.style.top="0";cDiv.style.top="0";
tDiv.hVspace=tDiv.vHspace=0;

cDiv.getContentWidth=function(){
	var cChilds=cDiv.childNodes,maxCWidth=compPad=0;
	for(var i=0;i<cChilds.length;i++){if(cChilds[i].offsetWidth){maxCWidth=Math.max(cChilds[i].offsetWidth,maxCWidth)}}
	cDiv.contentWidth=maxCWidth+widthLoss;
	cDiv.containerWidth=dDiv.offsetWidth;
	return cDiv.contentWidth;
	};

cDiv.getContentHeight=function(){
	cDiv.contentHeight=cDiv.offsetHeight+heightLoss;
	cDiv.containerHeight=dDiv.offsetHeight;
	return cDiv.contentHeight;
	};

cDiv.getContentWidth();

tDiv.createVScroll=function(){
if((cDiv.getContentHeight()>cDiv.containerHeight-tDiv.vHspace)&&!dDiv.vScroll){
	if(!dDiv.vScroll&&!dDiv.hScroll) dDiv.appendChild(tDiv);
	tDiv.vrt=new Array();var vrT=tDiv.vrt;
	createScrollBars(vrT,'vscroller');
	vrT.barPadding=parseInt(getActiveStyle(vrT.sBar,'padding-top','paddingTop'));
	vrT.sBar.style.padding='0px';vrT.sBar.curPos=0;vrT.sBar.vertical=true;
	prepareScroll(vrT,tDiv.vHspace);tDiv.hVspace=vrT.sDiv.offsetWidth;
	mDiv.style.width=postWidth-tDiv.hVspace+'px';
	cDiv.getContentWidth();cDiv.getContentHeight();
	prepareScroll(vrT,tDiv.vHspace);
	dDiv.vScroll=true;
	cDiv.style.display='none';cDiv.style.display='block';//fix IE display bug
	return true;
	} else return false;
};

tDiv.createHScroll=function(){
if((cDiv.getContentWidth()>cDiv.containerWidth-tDiv.hVspace)&&!dDiv.hScroll){
	if(!dDiv.vScroll&&!dDiv.hScroll) dDiv.appendChild(tDiv);
	tDiv.hrz=new Array();var hrZ=tDiv.hrz;
	createScrollBars(hrZ,'hscroller');
	hrZ.barPadding=parseInt(getActiveStyle(hrZ.sBar,'padding-left','paddingLeft'));
	hrZ.sBar.style.padding='0px';hrZ.sBar.curPos=0;hrZ.sBar.vertical=false;
	if(window.opera) hrZ.sBar.style.position='relative';
	prepareScroll(hrZ,(dDiv.vScroll)?tDiv.hVspace:0);
	tDiv.vHspace=hrZ.sDiv.offsetHeight;
	mDiv.style.height=postHeight-tDiv.vHspace+'px';
	dDiv.hScroll=true;
	hrZ.jBox=createDiv('scrollerjogbox');
	hrZ.jBox.style.display='none';hrZ.jBox.prnt=tDiv;
	tDiv.appendChild(hrZ.jBox);
	hrZ.jBox.onmousedown=function(){
		hrZ.sBar.scrollBoth=true;document.goScroll=hrZ.sBar;hrZ.sBar.clicked=true;
		hrZ.sBar.moved=false;tDiv.vrt.sBar.moved=false;
		dDiv.scrollUpdate();
		addTrigger(document,'selectstart',CSBpreventTselect);
		addTrigger(document,'mousemove',CSBMoveBar);
		addTrigger(document,'mouseup',CSBMouseUp);
		return false;
		};
	if(dDiv.vScroll){
		cDiv.getContentWidth();
		cDiv.getContentHeight();
		prepareScroll(tDiv.vrt,tDiv.vHspace);
		hrZ.jBox.style.display='block';
	}
	if(!dDiv.vScroll&&cDiv.getContentHeight()>cDiv.containerHeight-tDiv.vHspace){
		tDiv.createVScroll();cDiv.getContentWidth();
		prepareScroll(hrZ,tDiv.hVspace);
		hrZ.jBox.style.display='block';
		}
	cDiv.style.display='none';cDiv.style.display='block';//fix IE display bug
	return true;
	} else return false;
};

document.goScroll=null;
tDiv.vScroll=tDiv.createVScroll();
tDiv.hScroll=tDiv.createHScroll();
if(!addCheckTrigger(dDiv,'mousewheel',CSBMouseWheelHandle)||!addCheckTrigger(dDiv,'DOMMouseScroll',CSBMouseWheelHandle)){dDiv.onmousewheel=CSBMouseWheelHandle;}
dDiv.setAttribute('tabIndex','0');

addTrigger(dDiv,'keydown',function(e){
	var keyActList={_37:[-1,0],_38:[0,-1],_39:[1,0],_40:[0,1],_33:[0,'-1p'],_34:[0,'1p']},kA=[0,0];
	if(!e){var e=window.event;};var prK=e.keyCode;
	if(keyActList['_'+prK]){
	for(var i=0;i<2;i++){kA[i]=keyActList['_'+prK][i].toString();
	kA[i]=(kA[i].match(/p$/))?parseInt(kA[i])*dDiv.pageScroll[i]:kA[i]*dDiv.stepScroll[i];}
	dDiv.commitScroll(kA[0],kA[1],true);
	if(e.preventDefault) e.preventDefault();
	return false;}
	});

dDiv.scrollUpdate=function(){
cDiv.style.padding='1px';
var reqH=cDiv.getContentWidth()>cDiv.containerWidth;
var reqV=cDiv.getContentHeight()>cDiv.containerHeight;
cDiv.style.padding='0px';

if(tDiv.vScroll&&reqV){
	tDiv.vrt.sDiv.style.display='block';
	mDiv.style.width=postWidth-tDiv.hVspace+'px';
	dDiv.vScroll=true;
	} else if(tDiv.vScroll){
	tDiv.vrt.sDiv.style.display='none';mDiv.style.width=postWidth+'px';dDiv.vScroll=false;
	tDiv.vrt.sBar.curPos=0;cDiv.style.top='0px';
	if(tDiv.hScroll)tDiv.hrz.jBox.style.display='none';
	} else tDiv.vScroll=tDiv.createVScroll();
if(tDiv.hScroll&&reqH){
	tDiv.hrz.sDiv.style.display='block';
	mDiv.style.height=postHeight-tDiv.vHspace+'px';
	dDiv.hScroll=true;
	if(tDiv.vScroll) tDiv.hrz.jBox.style.display='block';
	} else if(tDiv.hScroll){
	tDiv.hrz.sDiv.style.display='none';mDiv.style.height=postHeight+'px';dDiv.hScroll=false;
	tDiv.hrz.sBar.curPos=0;cDiv.style.left='0px';
	} else tDiv.hScroll=tDiv.createHScroll();

	if((!reqH&&tDiv.hScroll)||(!reqV&&tDiv.hScroll)) tDiv.hrz.jBox.style.display='none';

	if(reqV) updateScroll(tDiv.vrt,(reqH)?tDiv.vHspace:0);
	if(reqH) updateScroll(tDiv.hrz,(reqV)?tDiv.hVspace:0);
	if(reqH&&reqV) updateScroll(tDiv.vrt,(reqH)?tDiv.vHspace:0);
};

dDiv.commitScroll=function(xScr,yScr,relative){
	var returner=[false,false],Bar;
	if(xScr&&dDiv.hScroll){Bar=tDiv.hrz.sBar;if(!relative) xScr+=Bar.minPos;Bar.curPos=(relative)?Bar.curPos+xScr:xScr;Bar.doScrollPos();returner[0]=[Bar.curPos-Bar.minPos,Bar.sRange];}
	if(yScr&&dDiv.vScroll){Bar=tDiv.vrt.sBar;if(!relative) yScr+=Bar.minPos;Bar.curPos=(relative)?Bar.curPos+yScr:yScr;Bar.doScrollPos();returner[1]=[Bar.curPos-Bar.minPos,Bar.sRange];}
	return returner;
};

copyStyles(
'pDiv','dDiv',false,true,'0px',
['border-left-width','border-right-width','border-top-width','border-bottom-width'],
['borderLeftWidth','borderRightWidth','borderTopWidth','borderBottomWidth']
);

cDiv.style.padding='0px';dDiv.removeChild(pDiv);dDiv.fleXcroll=true;

function getActiveStyle(elem,style,stylecc){
if(window.getComputedStyle) return window.getComputedStyle(elem,null).getPropertyValue(style);
if(elem.currentStyle) return eval("elem.currentStyle."+stylecc);
return '';
};
function copyStyles(src,dest,store,replace,replaceStr,sList,camelList){
	for (var i=0;i<sList.length;i++){
		eval(dest+'.style.'+camelList[i]+' = getActiveStyle('+src+',"'+sList[i]+'","'+camelList[i]+'")');
		if(replace) eval(src+'.style.'+camelList[i]+' = "'+replaceStr+'"');
	}
};
function createDiv(typeName,noGenericClass){
var newDiv=document.createElement('div');
newDiv.id=targetId+'_'+typeName;
newDiv.className=(noGenericClass)?typeName:typeName+' scrollgeneric';
return newDiv;
};
function createScrollBars(ary,bse){
ary.sDiv=createDiv(bse+'base');ary.sFDiv=createDiv(bse+'basebeg');
ary.sSDiv=createDiv(bse+'baseend');ary.sBar=createDiv(bse+'bar');
ary.sFBar=createDiv(bse+'barbeg');ary.sSBar=createDiv(bse+'barend');
tDiv.appendChild(ary.sDiv);ary.sDiv.appendChild(ary.sBar);
ary.sDiv.appendChild(ary.sFDiv);ary.sDiv.appendChild(ary.sSDiv);
ary.sBar.appendChild(ary.sFBar);ary.sBar.appendChild(ary.sSBar);
};
function prepareScroll(bAr,reqSpace){
var sDiv=bAr.sDiv,sBar=bAr.sBar,sFDiv=bAr.sFDiv,sFBar=bAr.sFBar,sSDiv=bAr.sSDiv,sSBar=bAr.sSBar;
sBar.minPos=bAr.barPadding;
sBar.ofstParent=sDiv;
sBar.mDiv=mDiv;
sBar.scrlTrgt=cDiv;
updateScroll(bAr,reqSpace,true);

sBar.doScrollPos=function(){
sBar.curPos=(Math.min(Math.max(sBar.curPos,sBar.minPos),sBar.maxPos));
sBar.targetScroll=parseInt(((sBar.curPos-sBar.minPos)/sBar.sRange)*sBar.mxScroll);
if(sBar.vertical){
	sBar.style.top=sBar.curPos+"px";
	sBar.scrlTrgt.style.top=sBar.targetScroll+'px';
	dDiv.scrollPos[1]=sBar.curPos;dDiv.scrollPos[3]=sBar.targetScroll;
	} else {
	sBar.style.left=sBar.curPos+"px";
	sBar.scrlTrgt.style.left=sBar.targetScroll+'px';
	dDiv.scrollPos[0]=sBar.curPos;dDiv.scrollPos[2]=sBar.targetScroll;
	}
};

mDiv.style.zIndex=getActiveStyle(sBar,'z-index','zIndex');
sBar.onmousedown=function(){
	this.clicked=true;document.goScroll=this;this.scrollBoth=false;this.moved=false;
	dDiv.scrollUpdate();
	addTrigger(document,'selectstart',CSBpreventTselect);
	addTrigger(document,'mousemove',CSBMoveBar);
	addTrigger(document,'mouseup',CSBMouseUp);
	return false;
	};
	
sDiv.onmousedown=function(e){
if(!e){var e=window.event;}
if(e.target&&(e.target==sFBar||e.target==sSBar)) return;
if(e.srcElement&&(e.srcElement==sFBar||e.srcElement==sSBar)) return;
var relPos;
var xScrolled=(window.pageXOffset)?window.pageXOffset:(document.documentElement&&document.documentElement.scrollLeft)?document.documentElement.scrollLeft:0;
var yScrolled=(window.pageYOffset)?window.pageYOffset:(document.documentElement&&document.documentElement.scrollTop)?document.documentElement.scrollTop:0;
sBar.mDiv.scrollTop=sBar.mDiv.scrollLeft=0;
CSBFindPos(sBar);
relPos=(sBar.vertical)?e.clientY+yScrolled-sBar.yPos:e.clientX+xScrolled-sBar.xPos;
sBar.curPos=(relPos>0)?sBar.curPos+sBar.pageScroll:sBar.curPos-sBar.pageScroll;
sBar.doScrollPos();
return false;
}
};

function updateScroll(bAr,reqSpace,firstRun){
var sDiv=bAr.sDiv,sBar=bAr.sBar,sFDiv=bAr.sFDiv,sFBar=bAr.sFBar,sSDiv=bAr.sSDiv,sSBar=bAr.sSBar;

if(sBar.vertical){
	sDiv.style.height=(tDiv.offsetHeight-reqSpace)+'px';sDiv.style.left=tDiv.offsetWidth-sDiv.offsetWidth+'px';
	sBar.aSize=Math.max(Math.min(parseInt(cDiv.containerHeight/cDiv.contentHeight*sDiv.offsetHeight),parseInt(sDiv.offsetHeight*0.85)),35);
	sBar.style.height=sBar.aSize+'px';sBar.maxPos=sDiv.offsetHeight-sBar.offsetHeight-bAr.barPadding;
	sBar.curPos=Math.min(Math.max(sBar.minPos,sBar.curPos),sBar.maxPos);
	sBar.style.top=sBar.curPos+'px';sBar.mxScroll=mDiv.offsetHeight-cDiv.contentHeight;
	sBar.sRange=sBar.maxPos-sBar.minPos;
	dDiv.pageScroll[1]=sBar.pageScroll=parseInt(sBar.offsetHeight*0.96);
	dDiv.stepScroll[1]=sBar.stepScroll=Math.min(Math.abs(parseInt((sBar.sRange/sBar.mxScroll)*80)),parseInt(sBar.sRange*0.25));
	sBar.indx=1;cDiv.vBar=sBar;
	sFDiv.style.height=sDiv.offsetHeight-sSDiv.offsetHeight+'px';sFBar.style.height=sBar.offsetHeight-sSBar.offsetHeight+'px';
	sSBar.style.top=sFBar.offsetHeight+'px';sSDiv.style.top=sFDiv.offsetHeight+'px';
} else {
	sDiv.style.width=(tDiv.offsetWidth-reqSpace)+'px';sDiv.style.top=tDiv.offsetHeight-sDiv.offsetHeight+'px';
	sBar.aSize=Math.max(Math.min(parseInt(cDiv.containerWidth/cDiv.contentWidth*sDiv.offsetWidth),parseInt(sDiv.offsetWidth*0.85)),35);
	sBar.style.width=sBar.aSize+'px';sBar.maxPos=sDiv.offsetWidth-sBar.offsetWidth-bAr.barPadding;
	sBar.curPos=Math.min(Math.max(sBar.minPos,sBar.curPos),sBar.maxPos);
	sBar.style.left=sBar.curPos+'px';sBar.mxScroll=mDiv.offsetWidth-cDiv.contentWidth;
	sBar.sRange=sBar.maxPos-sBar.minPos;
	dDiv.pageScroll[0]=sBar.pageScroll=parseInt(sBar.offsetWidth*0.96);
	dDiv.stepScroll[0]=sBar.stepScroll=Math.min(Math.abs(parseInt((sBar.sRange/sBar.mxScroll)*80)),parseInt(sBar.sRange*0.25));
	sBar.indx=0;cDiv.hBar=sBar;
	sFDiv.style.width=sDiv.offsetWidth-sSDiv.offsetWidth+'px';sFBar.style.width=sBar.offsetWidth-sSBar.offsetWidth+'px';
	sSBar.style.left=sFBar.offsetWidth+'px';sSDiv.style.left=sFDiv.offsetWidth+'px';
}
if(!firstRun) sBar.doScrollPos();
cDiv.style.display='none';cDiv.style.display='block';//fix IE display bug
};

addTrigger(window,'load',function(){if(dDiv.fleXcroll) dDiv.scrollUpdate();});
addTrigger(window,'resize',function(){
if(dDiv.refreshTimeout) window.clearTimeout(dDiv.refreshTimeout);
dDiv.refreshTimeout=window.setTimeout(function(){if(dDiv.fleXcroll) dDiv.scrollUpdate();},80);
});

};

function CSBpreventTselect(){return false;};

function CSBMoveBar(e){
if(!e){var e=window.event;}
var FCBar=document.goScroll,moveBar,maxx,xScroll,yScroll;
if(FCBar==null) return;
maxx=(FCBar.scrollBoth)?2:1;
for (var i=0;i<maxx;i++){
	moveBar=(i==1)?FCBar.scrlTrgt.vBar:FCBar;
	if(FCBar.clicked){
		if(!moveBar.moved){
		moveBar.mDiv.scrollTop=0;moveBar.mDiv.scrollLeft=0;
		CSBFindPos(moveBar);CSBFindPos(moveBar.ofstParent);moveBar.pointerOffsetY=e.clientY-moveBar.yPos;
		moveBar.pointerOffsetX=e.clientX-moveBar.xPos;moveBar.inCurPos=moveBar.curPos;moveBar.moved=true;
		}
		moveBar.curPos=(moveBar.vertical)?e.clientY-moveBar.pointerOffsetY-moveBar.ofstParent.yPos:e.clientX-moveBar.pointerOffsetX-moveBar.ofstParent.xPos;
		if(FCBar.scrollBoth) moveBar.curPos=moveBar.curPos+(moveBar.curPos-moveBar.inCurPos);
		moveBar.doScrollPos();
		} else moveBar.moved=false;
	}
};

function CSBMouseUp(){
if(document.goScroll!=null){document.goScroll.clicked=false;}
document.goScroll=null;
removeTrigger(document,'selectstart',CSBpreventTselect);
removeTrigger(document,'mousemove',CSBMoveBar);
removeTrigger(document,'mouseup',CSBMouseUp);
};

function CSBMouseWheelHandle(e){
if(!e) e=window.event;
if(!this.fleXcroll) return;
var scrDv=this,vEdge,hEdge,hoverH=false,delta=0;
hElem=(e.target)?e.target:(e.srcElement)?e.srcElement:this;
if(hElem.id&&hElem.id.match(/_hscroller/)) hoverH=true;
if(e.wheelDelta) delta=-e.wheelDelta;if(e.detail) delta=e.detail;delta=delta<0?-1:+1;
if(scrDv.vScroll&&!hoverH) scrollState=scrDv.commitScroll(false,delta*scrDv.stepScroll[1],true);
vEdge=!scrDv.vScroll||hoverH||(scrDv.vScroll&&((scrollState[1][0]==scrollState[1][1]&&delta>0)||(scrollState[1][0]==0&&delta<0)));
if(scrDv.hScroll&&(!scrDv.vScroll||hoverH)) scrollState=scrDv.commitScroll(delta*scrDv.stepScroll[0],false,true);
hEdge=!scrDv.hScroll||(scrDv.hScroll&&scrDv.vScroll&&vEdge&&!hoverH)||(scrDv.hScroll&&((scrollState[0][0]==scrollState[0][1]&&delta>0)||(scrollState[0][0]==0&&delta<0)));
if(vEdge&&hEdge&&!hoverH) return;
if(e.preventDefault) e.preventDefault();
return false;
};

function addTrigger(elm,eventname,func){if(!addCheckTrigger(elm,eventname,func)&&elm.attachEvent) elm.attachEvent('on'+eventname,func);};
function addCheckTrigger(elm,eventname,func){if(elm.addEventListener){elm.addEventListener(eventname,func,false);return true;} else return false;};
function removeTrigger(elm,eventname,func){if(!removeCheckTrigger(elm,eventname,func)&&elm.detachEvent) elm.detachEvent('on'+eventname,func);};
function removeCheckTrigger(elm,eventname,func){if(elm.removeEventListener){elm.removeEventListener(eventname,func,false);return true;} else return false;};

function CSBFindPos(elem){ 
//function modified from firetree.net
var obj=elem,curleft=curtop=0;
if(obj.offsetParent){
	while(obj){curleft+=obj.offsetLeft;curtop+=obj.offsetTop;obj=obj.offsetParent;}
	}
else if(obj.x){curleft+=obj.x;curtop+=obj.y;}
elem.xPos=curleft;elem.yPos=curtop;
};

