/*Example message arrays for the two demo scrollers*/

var pausecontent=new Array()
pausecontent[0]='<center><b><font color="#CC0000">Le Global Finance Center de SKEMA Business School <br>n&acute;est en aucun cas impliqu&eacute; dans une quelconque tombola<br> en C&ocirc;te d&acute;Ivoire ou ailleurs et se r&eacute;serve le droit<br> de poursuivre toute personne ou entit&eacute; d&eacute;tournant son nom </font></b></center>'
pausecontent[1]='<center><i>20-22 mai 2010</i><br /><b><a href="conferences/TUNISIA-Conf.pdf">"Financial crisis and Private capital Outflows: an analysis of expatriated savings"</a></b><br />Sousse, 12eme  Rencontres Euro-M&eacute;diterran&eacute;ennes</center>'
pausecontent[2]='<center><i>27 avril 2010</i><br /><a href="conferences/TUNISIE-2010.pdf">Place financi&egrave;re, risque-pays, et notation d&acute;agences</a><br />Tunis-Forum de l&acute;Economiste Maghr&eacute;bin</center>'
pausecontent[3]='<center><i>19 mars 2010</i><br /><b><a href="conferences/Regulation.pdf">"Crise financi&egrave;re et r&eacute;gulation europ&eacute;enne"</a></b><br />Paris-La D&eacute;fense-PULV</center>'
pausecontent[4]='<center><i>15 juin 2009</i><br /><a href="conferences/RISQUE-PAYS09.pdf">Analyse et Gestion du Risque-Pays</a><br /><b>Michel Henry Bouchet</b></center>'
pausecontent[5]='<center><i>18 March</i><br /><a href="conferences/chine2.pdf"><img src="chine.jpg">China in Globalization : Dynamism and Mutual Dependence</a><br />Suzhou Univ. Business School - <b>Michel Henry Bouchet</b></center>'
pausecontent[6]='<center><i>22 February 2009</i><br /><b><a href="conferences/chine.pdf"><img src="chine.jpg"/>"China and Globalization: crisis and adjustment"</a></b><br />Ceram-Suzhou     -     Bouchet</center>'
pausecontent[7]='<center><i>24 Novembre</i><br /><b>"Seminaire caisse Regionale du Credit Agricole"</b></center>'
pausecontent[8]='<center><i>24 February</i><br />ESC-Universite de la Manouba de Tunis<br /><b>"Combien gerer le risque-pays dans la globalisation"</b></center>'
pausecontent[9]='<center><i>20 March</i><br />Petit dejeuner - Global Finance - Credit agricole<br /><b>"Risque-Pays et strategie internationale"</b></center>'
pausecontent[10]='<center><i>International Week, 14 & 15 February</i><br />Michel Henry Bouchet, University of Westminster, London : <br /><b>"Risks and Opportunities of Global market integration"</b></center>'
pausecontent[11]='<center><i>March 7</i><br />Dr. Sima Motamen: University of Westminster, CERAM,<br /><b>"Emerging market countries access to capital markets"</b></center>'
pausecontent[12]='<center><i> March 20</i><br />Ceram-Expert breakfast<br />Michel Bouchet, Bertrand Groslambert, et Credit Agricole.<br /><b>"Risque-Pays et strategie internationale"</b><br /></center>'




/***********************************************
* Pausing up-down scroller- © Dynamic Drive (www.dynamicdrive.com)
***********************************************/

function pausescroller(content, divId, divClass, delay){
this.content=content //message array content
this.tickerid=divId //ID of ticker div to display information
this.delay=delay //Delay between msg change, in miliseconds.
this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over scroller (and pause it if it is)
this.hiddendivpointer=1 //index of message array for hidden div
document.write('<div id="'+divId+'" class="'+divClass+'" style="position: relative; overflow: hidden"><div class="innerDiv" style="position: absolute; width: 100%" id="'+divId+'1">'+content[0]+'</div><div class="innerDiv" style="position: absolute; width: 100%; visibility: hidden" id="'+divId+'2">'+content[1]+'</div></div>')
var scrollerinstance=this
if (window.addEventListener) //run onload in DOM2 browsers
window.addEventListener("load", function(){scrollerinstance.initialize()}, false)
else if (window.attachEvent) //run onload in IE5.5+
window.attachEvent("onload", function(){scrollerinstance.initialize()})
else if (document.getElementById) //if legacy DOM browsers, just start scroller after 0.5 sec
setTimeout(function(){scrollerinstance.initialize()}, 500)
}

// -------------------------------------------------------------------
// initialize()- Initialize scroller method.
// -Get div objects, set initial positions, start up down animation
// -------------------------------------------------------------------

pausescroller.prototype.initialize=function(){
this.tickerdiv=document.getElementById(this.tickerid)
this.visiblediv=document.getElementById(this.tickerid+"1")
this.hiddendiv=document.getElementById(this.tickerid+"2")
this.visibledivtop=parseInt(pausescroller.getCSSpadding(this.tickerdiv))
//set width of inner DIVs to outer DIV's width minus padding (padding assumed to be top padding x 2)
this.visiblediv.style.width=this.hiddendiv.style.width=this.tickerdiv.offsetWidth-(this.visibledivtop*2)+"px"
this.getinline(this.visiblediv, this.hiddendiv)
this.hiddendiv.style.visibility="visible"
var scrollerinstance=this
document.getElementById(this.tickerid).onmouseover=function(){scrollerinstance.mouseoverBol=1}
document.getElementById(this.tickerid).onmouseout=function(){scrollerinstance.mouseoverBol=0}
if (window.attachEvent) //Clean up loose references in IE
window.attachEvent("onunload", function(){scrollerinstance.tickerdiv.onmouseover=scrollerinstance.tickerdiv.onmouseout=null})
setTimeout(function(){scrollerinstance.animateup()}, this.delay)
}


// -------------------------------------------------------------------
// animateup()- Move the two inner divs of the scroller up and in sync
// -------------------------------------------------------------------

pausescroller.prototype.animateup=function(){
var scrollerinstance=this
if (parseInt(this.hiddendiv.style.top)>(this.visibledivtop+5)){
this.visiblediv.style.top=parseInt(this.visiblediv.style.top)-5+"px"
this.hiddendiv.style.top=parseInt(this.hiddendiv.style.top)-5+"px"
setTimeout(function(){scrollerinstance.animateup()}, 50)
}
else{
this.getinline(this.hiddendiv, this.visiblediv)
this.swapdivs()
setTimeout(function(){scrollerinstance.setmessage()}, this.delay)
}
}

// -------------------------------------------------------------------
// swapdivs()- Swap between which is the visible and which is the hidden div
// -------------------------------------------------------------------

pausescroller.prototype.swapdivs=function(){
var tempcontainer=this.visiblediv
this.visiblediv=this.hiddendiv
this.hiddendiv=tempcontainer
}

pausescroller.prototype.getinline=function(div1, div2){
div1.style.top=this.visibledivtop+"px"
div2.style.top=Math.max(div1.parentNode.offsetHeight, div1.offsetHeight)+"px"
}

// -------------------------------------------------------------------
// setmessage()- Populate the hidden div with the next message before it's visible
// -------------------------------------------------------------------

pausescroller.prototype.setmessage=function(){
var scrollerinstance=this
if (this.mouseoverBol==1) //if mouse is currently over scoller, do nothing (pause it)
setTimeout(function(){scrollerinstance.setmessage()}, 100)
else{
var i=this.hiddendivpointer
var ceiling=this.content.length
this.hiddendivpointer=(i+1>ceiling-1)? 0 : i+1
this.hiddendiv.innerHTML=this.content[this.hiddendivpointer]
this.animateup()
}
}

pausescroller.getCSSpadding=function(tickerobj){ //get CSS padding value, if any
if (tickerobj.currentStyle)
return tickerobj.currentStyle["paddingTop"]
else if (window.getComputedStyle) //if DOM2
return window.getComputedStyle(tickerobj, "").getPropertyValue("padding-top")
else
return 0
}
