function getLocation(){
	return window.location.toString();
}
function parseGet(){
	var couples=window.location.search.substr(1).split('&');
	var res=new Array();
	var couple=new Array();
	for (var i=0;i<couples.length;i++){
		couple=couples[i].split('=');
		res[couple[0]]=couple[1];
	}
	return res;
}
function mailto(adresse){
	window.location='mailto:'+adresse;
}
function getBookmarks(id){
	return getCookie('fb_bookmarks_'+id);
}
function setBookmarks(data,id){
	date=new Date;
	date.setFullYear(date.getFullYear()+10);
	setCookie('fb_bookmarks_'+id, data,date,'/');
}
function getCookieVal(offset)
{
	var endstr=document.cookie.indexOf(";", offset);
	if (endstr==-1){
		endstr=document.cookie.length;
	}
	return unescape(document.cookie.substring(offset, endstr));
}
function getCookie(nom)
{
	var arg=nom+"=";
	var alen=arg.length;
	var clen=document.cookie.length;
	var i=0;
	while (i<clen){
		var j=i+alen;
		if (document.cookie.substring(i, j)==arg){
			return getCookieVal(j);
		}
		i=document.cookie.indexOf(" ",i)+1;
		if (i==0){
			break;
		}
	}
	return null;
}
function setCookie(nom, valeur)
{
	var argv=setCookie.arguments;
	var argc=setCookie.arguments.length;
	var expires=(argc > 2) ? argv[2] : null;
	var path=(argc > 3) ? argv[3] : null;
	var domain=(argc > 4) ? argv[4] : null;
	var secure=(argc > 5) ? argv[5] : false;
	document.cookie=nom+"="+escape(valeur)+
	((expires==null) ? "" : ("; expires="+expires.toGMTString()))+
	((path==null) ? "" : ("; path="+path))+
	((domain==null) ? "" : ("; domain="+domain))+
	((secure==true) ? "; secure" : "");
}
function addThis(x){
	addthis_offset_left=parseFloat(x);
	addthis_open(document.getElementById('addThisBt'), '', '[URL]', '[TITLE]');
}
function handleWheel(delta){
	try{
		document.getElementById('fluidbook').mouseWheel(delta);
	}catch(e){

	}
}

function testIpadIphone(){
	var ua=navigator.userAgent;

	if(ua.search(/iphone/i)>-1 || ua.search(/ipad/i)>-1 || ua.search(/android/i)>-1){
		window.location='data/document.pdf';
	}
}

function wheel(event){
        var delta = 0;
        if (!event) /* For IE. */
                event = window.event;
        if (event.wheelDelta) { /* IE/Opera. */
                delta = event.wheelDelta/120;
                /** In Opera 9, delta differs in sign as compared to IE.
                 */
                if (window.opera)
                        delta = -delta;
        } else if (event.detail) { /** Mozilla case. */
                /** In Mozilla, sign of delta is different than in IE.
                 * Also, delta is multiple of 3.
                 */
                delta = -event.detail/3;
        }
        /** If delta is nonzero, handle it.
         * Basically, delta is now positive if wheel was scrolled up,
         * and negative, if wheel was scrolled down.
         */
        if (delta){
        	handleWheel(delta);
		}
        /** Prevent default actions caused by mouse wheel.
         * That might be ugly, but we handle scrolls somehow
         * anyway, so don't bother here..
         */
        if (event.preventDefault){
        	event.preventDefault();
        }
		event.returnValue = false;
	}

/** Initialization code.
 * If you use your own event management code, change it as required.
 */
if (window.addEventListener){
        /** DOMMouseScroll is for mozilla. */
        window.addEventListener('DOMMouseScroll', wheel, false);
    }
/** IE/Opera. */
window.onmousewheel = document.onmousewheel = wheel;
