/* Tiny Scrolling - a smooth navigation between internal links and their destinations by Marco Rosella - http://www.centralscrutinizer.it/en/design/js-php/tiny-scrolling based on the works by Travis Beckham and Brian McAllister. v0.3 - March 27,2006 add TOP button for H3 and H2 tags + NO add for small screens*/ var topsecondmenu=0; var scrollrun=0;var scrolllastpos=0;
var secondmenuel=null;


function getScrollY() {
  var  scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
   scrOfY = window.pageYOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    scrOfY = document.body.scrollTop;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    scrOfY = document.documentElement.scrollTop;
  }
  return scrOfY;
}


function movemenu() {
if  (scrollrun || iddlescroll() ) return;
if (t=document.documentElement) tops=t.scrollTop; else tops=window.pageYOffset;
secondmenuel.style.top=(topsecondmenu<tops)? (tops)+"px":topsecondmenu+"px";
}

function iddlescroll() {
var p=getScrollY()-scrolllastpos;
scrolllastpos=getScrollY(); 
return (p!=0);
}


var tS={ speed : 50,maxStep: 600,brakeK: 3,hash:null,cB:null,requestedY:0,init: function(){

/* CREATE IFRAME for intro and symptoms under diseases */
function PosY(obj){var curtop = 0;if (obj.offsetParent){while (obj.offsetParent){curtop += obj.offsetTop;obj = obj.offsetParent;}}else if (obj.y)curtop += obj.y;return curtop;}



if (el=document.getElementById("qnav")) {
secondmenuel=document.getElementById("oversecmenu");
if (secondmenuel) {
document.getElementById("secondmenu").innerHTML=el.innerHTML;
document.getElementById("oversecmenu").style.top=topsecondmenu=secondmenuel.offsetTop;

sfEls=document.getElementById("secondmenu").getElementsByTagName("LI");
if (window.attachEvent && (navigator.userAgent.toLowerCase().indexOf("msie 7.")==-1)) hoverfx(sfEls,"sqfhover");
if ((topsecondmenu+400)>PosY(document.getElementById("footer"))) secondmenuel.innerHTML=""; else setInterval ( 'movemenu();', 500 );
}
}



/* size */ 
function f_clientHeight() { return f_filterResults ( window.innerHeight ? window.innerHeight : 0, document.documentElement ? document.documentElement.clientHeight : 0, document.body ? document.body.clientHeight : 0 ); } function f_clientWidth() { return f_filterResults ( window.innerWidth ? window.innerWidth : 0, document.documentElement ? document.documentElement.clientWidth : 0, document.body ? document.body.clientWidth : 0 ); } function f_filterResults(n_win, n_docel, n_body) { var n_result = n_win ? n_win : 0; if (n_docel && (!n_result || (n_result > n_docel))) n_result = n_docel; return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result; }
var wW=f_clientWidth();var wH=f_clientHeight();

//if (PosY(document.getElementById("footer"))<1160) { document.getElementById("secrhsad").style.display="none"; document.getElementById("secrhsad").style.color="white";}

var lnks=document.getElementsByTagName('a');for(var i=0,lnk;lnk=lnks[i];i++){if ((lnk.href && lnk.href.indexOf('#')!= -1  &&(lnk.href.substr(lnk.href.length-1,1)!='#'))&& ( (lnk.pathname == location.pathname)|| ('/'+lnk.pathname == location.pathname))&& (lnk.search == location.search)){lnk.onclick=tS.initScroll;}} },getElementYpos: function(el){ var y=0;while(el.offsetParent){ y += el.offsetTop;el=el.offsetParent;}return y;},getScrollTop: function(){ if(document.all)return (document.documentElement.scrollTop)? document.documentElement.scrollTop : document.body.scrollTop;else return window.pageYOffset;},getWindowHeight: function(){ if (window.innerHeight)return window.innerHeight;if(document.documentElement && document.documentElement.clientHeight)return document.documentElement.clientHeight;},getDocumentHeight: function(){ if (document.height)return document.height;if(document.body.offsetHeight)return document.body.offsetHeight;},initScroll: function(e){ var targ;if (!e)var e=window.event;if (e.target)targ=e.target;else if (e.srcElement)targ=e.srcElement;tS.hash=targ.href.substr(targ.href.indexOf('#')+1,targ.href.length);tS.cB=document.getElementById(tS.hash);if(!tS.cB)return;tS.requestedY=tS.getElementYpos(tS.cB);tS.scroll();return false;},scroll: function(){ scrollrun=1; var top=tS.getScrollTop();if(tS.requestedY > top){var endDistance=Math.round((tS.getDocumentHeight()- (top + tS.getWindowHeight()))/ tS.brakeK);endDistance=Math.min(Math.round((tS.requestedY-top)/ tS.brakeK),endDistance);var offset=Math.max(2,Math.min(endDistance,tS.maxStep));}else{var offset=- Math.min(Math.abs(Math.round((tS.requestedY-top)/ tS.brakeK)),tS.maxStep);}window.scrollTo(0,top + offset);if(Math.abs(top-tS.requestedY)<= 1 || tS.getScrollTop()== top){window.scrollTo(0,tS.requestedY);if(!document.all || window.opera)location.hash=tS.hash;tS.hash=null;scrollrun=0;}else setTimeout(tS.scroll,tS.speed);}};window.onload=function(){tS.init();}

function zoomtable(tab) {
top.TableRef=window.open("", 'ZoomTable', 'scrollbars=1,resizable=1,width="+screen.width+" ,height="+screen.height+"');
top.TableRef.document.writeln('<html><head><title>Table - WrongDiagnosis.com</title></head>'+'<body bgcolor=white onLoad="self.focus()">'+tab.innerHTML+'</body></html>');
}
function MM_jumpMenu(targ,selObj,restore){eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");if (restore) selObj.selectedIndex=0;}
