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

var pausecontent=new Array()
pausecontent[0]='<img src="images/quote3.jpg" width="17" height="14" align="left">The session I chaired was very vibrant and I was struck by the amount of participation, by the quality, not only the number and the speakers. <img src="images/quote3a.jpg" width="17" height="14"><br><br><b>Gulf Environment Forum<br>H.R.H. Prince Abdulaziz Bin Salman Bin Abdulaziz, Assistant Minister for Petroleum Affairs, Ministry of Petroleum and Mineral Resources</b>  '
pausecontent[1]='<img src="images/quote3.jpg" width="17" height="14" align="left">This is a world class gathering. I would like to thank HRH Prince Turki for being the force behind this event, an international event, which has brought experts from all over the world. In my opinion this is a very important gathering. <img src="images/quote3a.jpg" width="17" height="14"><br><b><br>H.H. Prince Bandar Bin Saud Bin Mohammed Al-Saud</b> '
pausecontent[2]='<img src="images/quote3.jpg" width="17" height="14" align="left">It is an extremely important event, firstly because of the quality of the people who are here, several ministers and very important people, not only from Saudi Arabia but from all over the area, the organization is perfect and its not easy with so many people from different areas, it was really excellent. <img src="images/quote3a.jpg" width="17" height="14"><br><b>Edith Cresson, Former French PM</b> '
pausecontent[3]='<img src="images/quote3.jpg" width="17" height="14" align="left">(GEF) is very important for Saudi Arabia and the area as a whole, and its forums like this that allow key stakeholders to share thoughts and participate together and agree on a common view. <img src="images/quote3a.jpg" width="17" height="14"><br><br><b>Louis Hakim, CEO, Philips Middle East</b> '
pausecontent[4]='<img src="images/quote3.jpg" width="17" height="14" align="left">It has been a pleasure to be attending this unique Gulf Environment Forum. The conference was organized in a perfect manor, the participants were extraordinary. Looking forward to the next event! <img src="images/quote3a.jpg" width="17" height="14"><br><br><b>Khalid Bin Mohammed Al Midfa, Chairman & CEO, Gulf International Trading Group</b> '
pausecontent[5]='<img src="images/quote3.jpg" width="17" height="14" align="left">The organization and level of attendance was great, we were very proud and honored to be here. It  was great success for our company, we launched our operation as of today, the prospects are great. <img src="images/quote3a.jpg" width="17" height="14"><br><br><b>Mazen Chebaklo, Business Development Director, Averda</b> '

pausecontent[6]='<img src="images/quote3.jpg" width="17" height="14" align="left">Always a good opportunity to interact with industry counterparts!<img src="images/quote3a.jpg" width="17" height="14"><br><br><b>Marc Granier<br>Vice President<br>Chemicals, ExxonMobil</b>  '
pausecontent[7]='<img src="images/quote3.jpg" width="17" height="14" align="left">One of the best conferences which the Ministry of Petroleum attends to receive updates on industry developments and latest <br>discoveries.<img src="images/quote3a.jpg" width="17" height="14"><br><br><b>Abdulaziz Alhassan<br>Chief Geologist<br>Ministry of Petroleum</b>'
pausecontent[8]='<img src="images/quote3.jpg" width="17" height="14" align="left">It is indeed a good start to have an event that tackles such important issues in the market.<img src="images/quote3a.jpg" width="17" height="14"> <br><br><b>Nasser Abanmi<br>Production Manager<br>SABIC</b>'
pausecontent[9]='<img src="images/quote3.jpg" width="17" height="14" align="left">The conference is an important occasion for us to exchange ideas and information. The topics are very interesting.<img src="images/quote3a.jpg" width="17" height="14"> <br><br><b>Teh-yang Wu<br>Deputy Representative<br>Taipei Economic &amp; Cultural Office</b>'
pausecontent[10]='<img src="images/quote3.jpg" width="17" height="14" align="left">I have admired the excellent organisation of the show, good quality of subjects offered and the knowledge of the speakers.<img src="images/quote3a.jpg" width="17" height="14"> <br><br><b>Ahmad Malas<br>Sr. Commercial Specialist<br>U.S Consulate General</b>'
pausecontent[11]='<img src="images/quote3.jpg" width="17" height="14" align="left">It is a nice forum. Students and academic enrolment from the region of Arab Universities add interesting dimension.<img src="images/quote3a.jpg" width="17" height="14"> <br><br><b>Dr. Bandar Fadhel<br>Chemist<br>Saudi Aramco Oil Company</b>'
pausecontent[12]='<img src="images/quote3.jpg" width="17" height="14" align="left">The show was excellent, many thanks to the organizers.<img src="images/quote3a.jpg" width="17" height="14"> <br><br><b>Ali Fakih<br>Marketing Manager<br>Cable Deport</b>'
pausecontent[13]='<img src="images/quote3.jpg" width="17" height="14" align="left">The conference was useful and proved to be a good networking event for professionals in water and power sectors.<img src="images/quote3a.jpg" width="17" height="14"> <br><br><b>Mahmoud Fallatah<br>Corporate Projects Director<br>National Water Company</b>'
pausecontent[14]='<img src="images/quote3.jpg" width="17" height="14" align="left">It was very nice to be a part of the WEPower 2009 event and we got good response.<img src="images/quote3a.jpg" width="17" height="14"> <br><br><b>Mayank Sarode<br>Sales Manager<br>BNF Technology Inc</b>'
pausecontent[15]='<img src="images/quote3.jpg" width="17" height="14" align="left">The conference exceeded my expectations and I am very glad that I had the opportunity to participate. I look forward to participating in the next conference.<img src="images/quote3a.jpg" width="17" height="14"> <br><br><b>Thomas Topolski<br>Senior Vice President<br>Civil Infrastructure, CH2M HILL</b>'
pausecontent[16]='<img src="images/quote3.jpg" width="17" height="14" align="left">The variety among the audience makes this forum a valuable place to comment on our corporation’s views on global matters.<img src="images/quote3a.jpg" width="17" height="14"> <br><br><b>Marc Granier<br>Vice President<br>Chemicals, ExxonMobil</b>'





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
}
