/*********************************************** * Pausing updown message scroller- © Dynamic Drive DHTML code library (www.dynamicdrive.com) * This notice MUST stay intact for legal use * Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code ***********************************************/ //configure the below five variables to change the style of the scroller var scrollerdelay='4000'; //delay between msg scrolls. 3000=3 seconds. var scrollerwidth='210px;'; var scrollerheight='173px'; var scrollerbgcolor='white'; //set below to '' if you don't wish to use a background image var scrollerbackground=''; var messages = new Array() var tmpString = ''; var linkheight = parseInt(scrollerheight/3); var ie=document.all; var dom=document.getElementById; messages[0] = "<"+"p class='rlinks'><"+"a class='bttma2' target='_blank' href='/pdf/Sportsarticle2008.pdf'><"+"span class = 'newsTicker1'> Read about probiotics, exercise and immune function. <"+"/span><"+"/a><"+"/p>"; messages[1] = "<"+"p class='rlinks'><"+"a class='bttma2' href='/default.asp/s=145/p=145/Probiotics_in_healthcare'><"+"span class = 'newsTicker1'> Learn about probiotics in primary healthcare <"+"/span><"+"/a><"+"/p>"; messages[2] = "<"+"p class='rlinks'><"+"a class='bttma2' href='default.asp/s=146/p=159/Yakult_Symposia'><"+"span class = 'newsTicker1'> Yakult UK Symposium October 12th 2010 <"+"/span><"+"/a><"+"/p>"; stateChanged() ///////Do not edit pass this line/////////////////////// var x = 11 //if (messages.length>2) //i=2; //else i=0; function loadlinks(div){ for(a=0;a <= messages.length-1; a++) { div.innerHTML = div.innerHTML + messages[a]; } //div.innerHTML = div.innerHTML + messages[0]; //div.innerHTML = div.innerHTML + messages[1]; //div.innerHTML = div.innerHTML + messages[2]; tdiv=eval(div); setTimeout("movediv(tdiv)",scrollerdelay); } function movediv(whichdiv){ tdiv=eval(whichdiv); if (x >=0){ tdiv.style.top=parseInt(tdiv.style.top)-5+"px"; x--; setTimeout("movediv(tdiv)",30); }else{ x = 11; checkmove(tdiv); } } function checkmove(whichdiv){ tdiv=eval(whichdiv); if (parseInt(tdiv.style.top)<=((tdiv.offsetHeight-200)*-1)) { tdiv.style.top=0+"px"; setTimeout("movediv(tdiv)",scrollerdelay); } else { setTimeout("movediv(tdiv)",scrollerdelay); } } function move(whichdiv){ tdiv=eval(whichdiv); if (parseInt(tdiv.style.top)>0 && parseInt(tdiv.style.top)<=5){ tdiv.style.top=0+"px"; setTimeout("move(tdiv)",scrollerdelay); setTimeout("move2(second2_obj)",scrollerdelay); return; } if (parseInt(tdiv.style.top)>=((tdiv.offsetHeight*-1)/3)){ tdiv.style.top=parseInt(tdiv.style.top)-5+"px"; setTimeout("move(tdiv)",30); }else{ scrollerdelay = "5000" tdiv.style.top=parseInt(scrollerheight)+"px"; tdiv.innerHTML=messages[i]+messages[i+1]+messages[i+2]; if (i==messages.length-2) i=0; else i = i +2 }; } function move2(whichdiv){ tdiv2=eval(whichdiv); if (parseInt(tdiv2.style.top)>0 && parseInt(tdiv2.style.top)<=5){ tdiv2.style.top=0+"px"; setTimeout("move2(tdiv2)",scrollerdelay); setTimeout("move(first2_obj)",scrollerdelay); return; } if (parseInt(tdiv2.style.top)>=((tdiv2.offsetHeight*-1)/3)){ tdiv2.style.top=parseInt(tdiv2.style.top)-5+"px"; setTimeout("move2(second2_obj)",30); }else{ tdiv2.style.top=parseInt(scrollerheight)+"px"; tdiv2.innerHTML=messages[i]+messages[i+1]+messages[i+2]; if (i==messages.length-2) i=0; else i = i +2 }; } function startscroll(){ first2_obj=ie? first2 : document.getElementById("first2"); loadlinks(first2_obj); //second2_obj=ie? second2 : document.getElementById("second2"); //move(first2_obj); //second2_obj.style.top=scrollerheight; //second2_obj.style.visibility='visible'; } function start123() { xmlHttp=GetXmlHttpObject(); if (xmlHttp==null) { alert ("Your browser does not support AJAX!"); return; } var url="ajax/new2.asp"; xmlHttp.onreadystatechange=stateChanged; xmlHttp.open("GET",url,true); xmlHttp.send(null); } function stateChanged() { //if (xmlHttp.readyState==4) //{ //alert("if " + xmlHttp.readyState); //tmpString=xmlHttp.responseText; //messages = tmpString.split("||"); if (ie||dom){ maindiv = document.getElementById("main2"); //maindiv.innerHTML = "<"+"div style='position:absolute;width:"+scrollerwidth+";height:"+scrollerheight+";clip:rect(0 "+scrollerwidth+" "+scrollerheight+" 0);left:0px;top:0px; font-size: 1em;'>"; maindiv.innerHTML = "<"+"div id='first2' style='position:absolute;width:"+scrollerwidth+";left:0px;top:1px;'>"; //maindiv.innerHTML = maindiv.innerHTML + messages[0]; //maindiv.innerHTML = maindiv.innerHTML + messages[1]; maindiv.innerHTML = maindiv.innerHTML + "<"+"/div>"; //maindiv.innerHTML = maindiv.innerHTML + "<"+"div id='second2' style='position:absolute;width:"+scrollerwidth+";left:0px;top:0px; visibility:hidden;'>"; //maindiv.innerHTML = maindiv.innerHTML + messages[dyndetermine=(messages.length==1)? 0 : 2]; //maindiv.innerHTML = maindiv.innerHTML + messages[dyndetermine=(messages.length==1)? 0 : 3]; //maindiv.innerHTML = maindiv.innerHTML + "<"+"/div>"; //maindiv.innerHTML = maindiv.innerHTML + "<"+"/div>"; } if (window.addEventListener) window.addEventListener("load", startscroll, false); else if (window.attachEvent) window.attachEvent("onload", startscroll); else if (ie||dom) window.onload=startscroll; //}else{ //alert("else " + xmlHttp.readyState); //} } function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; }