//** jQuery Scroll to Top Control script- (c) Dynamic Drive DHTML code library: http://www.dynamicdrive.com.
//** Available/ usage terms at http://www.dynamicdrive.com (March 30th, 09')
//** v1.1 (April 7th, 09'):
//** 1) Adds ability to scroll to an absolute position (from top of page) or specific element on the page instead.
//** 2) Fixes scroll animation not working in Opera. 


var dApp=navigator.appName.toLowerCase(),dAgent=navigator.userAgent.toLowerCase(),dOS=navigator.platform.toLowerCase(),w,h,theLeftSmall,theLeftBig,theTop,theLeft,isWindow=false,isLinux=false,isMac=false,isFirefox=false,isSafari=false,isChrome=false;if(dOS.indexOf("win")!=-1)isWindow=true;if(dOS.indexOf("linux")!=-1)isLinux=true;if(dApp.indexOf("microsoft")!=-1){w=document.documentElement.clientWidth;h=document.documentElement.clientHeight}else{w=window.innerWidth;h=window.innerHeight} theLeft=w>=930?(w-930)/2+15:25;if(dApp.indexOf("microsoft")!=-1)theTop=205;if(dAgent.indexOf("firefox")!=-1)isFirefox=true;if(dAgent.indexOf("safari")!=-1)isSafari=true;if(dAgent.indexOf("chrome")!=-1){isSafari=false;isChrome=true}if(dApp.indexOf("netscape")!=-1)if(isFirefox){var dAgentV=dAgent.indexOf("firefox"),theVer=dAgent.substring(dAgentV+8,dAgentV+9);Number(theVer);theTop=200}else theTop=isSafari?200:isChrome?200:220;if(dApp.indexOf("opera")!=-1)theTop=200;theLeftSmall=756+theLeft; theLeftBig=408+theLeft; if(!isLinux){var pagearSmallImg="http://www.govinda.be/afbeeldingen/ratha2.jpg",pagearSmallSwf="http://www.dandavats.com/wp-content/pageear/small.swf",pagearBigImg="http://www.govinda.be/afbeeldingen/rathagroot.jpg",pagearBigSwf="http://www.dandavats.com/wp-content/pageear/large.swf",speedSmall=4,mirror="true",pageearColor="ffffff",jumpTo="http://www.govinda.be/rathayatra2010.html",openLink="new",openOnLoad="false",closeOnLoad=3,setDirection="rt",softFadeIn=0,playSound="false",playOpenSound="false", playCloseSound="false",closeOnClick="false",closeOnClickText="Close",requiredMajorVersion=6,requiredMinorVersion=0,requiredRevision=0,copyright="Webpicasso Media, www.webpicasso.de",thumbWidth=190,thumbHeight=190,bigWidth=500,bigHeight=500,queryParams="pagearSmallImg="+escape(pagearSmallImg);queryParams+="&pagearBigImg="+escape(pagearBigImg);queryParams+="&pageearColor="+pageearColor;queryParams+="&jumpTo="+escape(jumpTo);queryParams+="&openLink="+escape(openLink);queryParams+="&mirror="+escape(mirror); queryParams+="&copyright="+escape(copyright);queryParams+="&speedSmall="+escape(speedSmall);queryParams+="&openOnLoad="+escape(openOnLoad);queryParams+="&closeOnLoad="+escape(closeOnLoad);queryParams+="&setDirection="+escape(setDirection);queryParams+="&softFadeIn="+escape(softFadeIn);queryParams+="&playSound="+escape(playSound);queryParams+="&playOpenSound="+escape(playOpenSound);queryParams+="&playCloseSound="+escape(playCloseSound);queryParams+="&closeOnClick="+escape(closeOnClick);queryParams+= "&closeOnClickText="+escape(utf8encode(closeOnClickText));queryParams+="&lcKey="+escape(Math.random());queryParams+="&bigWidth="+escape(bigWidth);queryParams+="&thumbWidth="+escape(thumbWidth);var openPeel=function(){document.getElementById("bigDiv").style.top="0px";document.getElementById("bigDiv").style[xPos]="0px";document.getElementById("thumbDiv").style.top="-1000px"},closePeel=function(){document.getElementById("thumbDiv").style.top="0px";document.getElementById("bigDiv").style.top="-1000px"}, writeObjects=function(){var a=DetectFlashVer(requiredMajorVersion,requiredMinorVersion,requiredRevision);if(setDirection=="lt"){xPosBig="left:-1000px";xPos="left"}else{xPosBig="right:1000px";xPos="right"}document.write('<div id="bigDiv" style="float:left;position:absolute;width:'+bigWidth+"px;height:"+bigHeight+'px;z-index:9999;right:5px;top:0px;">');a?AC_FL_RunContent("src",pagearBigSwf+"?"+queryParams,"width",bigWidth+10,"height",bigHeight+40,"align","middle","id","bigSwf","quality","high","bgcolor", "#FFFFFF","name","bigSwf","wmode","transparent","scale","noscale","salign","tr","allowScriptAccess","always","type","application/x-shockwave-flash","codebase","http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab","pluginspage","http://www.adobe.com/go/getflashplayer"):document.write("no flash installed");document.write("</div>");document.write('<div id="thumbDiv" style="float:left;position:absolute;width:'+thumbWidth+"px;height:"+thumbHeight+'px;z-index:9999;right:2px;top:0px;">'); a?AC_FL_RunContent("src",pagearSmallSwf+"?"+queryParams,"width",thumbWidth,"height",thumbHeight,"align","middle","id","smallSwf","scale","noscale","quality","high","bgcolor","#FFFFFF","name","bigSwf","wmode","transparent","allowScriptAccess","always","type","application/x-shockwave-flash","codebase","http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab","pluginspage","http://www.adobe.com/go/getflashplayer"):document.write("no flash installed");document.write("</div>");setTimeout('document.getElementById("bigDiv").style.top = "-1000px";', 100)}}function utf8encode(a){a=a.replace(/\r\n/g,"\n");for(var b="",d=0;d<a.length;d++){var c=a.charCodeAt(d);if(c<128)b+=String.fromCharCode(c);else{if(c>127&&c<2048)b+=String.fromCharCode(c>>6|192);else{b+=String.fromCharCode(c>>12|224);b+=String.fromCharCode(c>>6&63|128)}b+=String.fromCharCode(c&63|128)}}return b} var scrolltotop={setting:{startline:100,scrollto:0,scrollduration:1E3,fadeduration:[500,100]},controlHTML:'<img src="up.png" style="width:48px; height:48px" />',controlattrs:{offsetx:5,offsety:5},anchorkeyword:"#top",state:{isvisible:false,shouldvisible:false},scrollup:function(){this.cssfixedsupport||this.$control.css({opacity:0});var a=isNaN(this.setting.scrollto)?this.setting.scrollto:parseInt(this.setting.scrollto);a=typeof a=="string"&&jQuery("#"+a).length==1?jQuery("#"+a).offset().top:0;this.$body.animate({scrollTop:a}, this.setting.scrollduration)},keepfixed:function(){var a=jQuery(window),b=a.scrollLeft()+a.width()-this.$control.width()-this.controlattrs.offsetx;a=a.scrollTop()+a.height()-this.$control.height()-this.controlattrs.offsety;this.$control.css({left:b+"px",top:a+"px"})},togglecontrol:function(){var a=jQuery(window).scrollTop();this.cssfixedsupport||this.keepfixed();this.state.shouldvisible=a>=this.setting.startline?true:false;if(this.state.shouldvisible&&!this.state.isvisible){this.$control.stop().animate({opacity:1}, this.setting.fadeduration[0]);this.state.isvisible=true}else if(this.state.shouldvisible==false&&this.state.isvisible){this.$control.stop().animate({opacity:0},this.setting.fadeduration[1]);this.state.isvisible=false}},init:function(){jQuery(document).ready(function(a){var b=scrolltotop,d=document.all;b.cssfixedsupport=!d||d&&document.compatMode=="CSS1Compat"&&window.XMLHttpRequest;b.$body=window.opera?document.compatMode=="CSS1Compat"?a("html"):a("body"):a("html,body");b.$control=a('<div id="topcontrol">'+ b.controlHTML+"</div>").css({position:b.cssfixedsupport?"fixed":"absolute",bottom:b.controlattrs.offsety,right:b.controlattrs.offsetx,opacity:0,cursor:"pointer"}).attr({title:"Scroll Back to Top"}).click(function(){b.scrollup();return false}).appendTo("body");document.all&&!window.XMLHttpRequest&&b.$control.text()!=""&&b.$control.css({width:b.$control.width()});b.togglecontrol();a('a[href="'+b.anchorkeyword+'"]').click(function(){b.scrollup();return false});a(window).bind("scroll resize",function(){b.togglecontrol()})})}}; scrolltotop.init();
