function printPage() {
    window.print();
}


//After how long should the region drop down hide
var regionTimeout = 20000;     
var regionState = false;
var regionTimer;

function regionSelect()
{
    if(regionState == true)
    {
        regionHide();
    }
    else
    {
        regionShow();
        regionTimer = setTimeout('regionHide()',regionTimeout);
    }
}

function regionShow()
{
    if(regionState == true) { return; }
    
    Effect.BlindDown('regionSelect');
    regionState = true;
}

function regionHide()
{
    if(regionState == false) { return; }
    Effect.BlindUp('regionSelect');
    regionState = false;
}



var pausecontent=new Array();

function getCourses(courseUrl,duration,date)
{    
	courseUrl = '/courses/public-courses/';
    if(!duration)   { duration = 'Duration' }
    if(!date)       { date = 'Start Date' }
    
	//var reply = eval('(' + t.responseText + ')');
	var reply = { "courses" :[{ "id":"448", "name":"Le 4 jours : les composantes de l\'excellence industrielle", "duration":"4 Jours", "dates":"13/09/2011" }, { "id":"772", "name":"« top management » : plan industriel et commercial = S&OP", "duration":"2 Jours", "dates":"11/10/2011" }, { "id":"453", "name":"Gestion de la demande", "duration":"2 Jours", "dates":"13/10/2011" }, { "id":"455", "name":"Gestion des achats et approvisionnements", "duration":"2 Jours", "dates":"20/10/2011" }, { "id":"869", "name":"Le 4 jours : les composantes de l\'excellence industrielle", "duration":"4 Jours", "dates":"29/11/2011" }]};

	for(var ii=0; ii<reply.courses.length; ii++)
	{
		console.log(courseUrl);
		
		var htmlLine = "";
		htmlLine = htmlLine + "<p class=\"name\"><a href=\""+courseUrl+reply.courses[ii].id+".html\">"+reply.courses[ii].name+"</a></p>";
		if(reply.courses[ii].duration != "") { htmlLine = htmlLine + "<p class=\"duration\">"+duration+": "+reply.courses[ii].duration+"</p>"; }
		htmlLine = htmlLine + "<p class=\"dates\">"+date+": "+reply.courses[ii].dates+"</p>";
		pausecontent[pausecontent.length] = htmlLine;
	}

	new pausescroller(pausecontent, 'forthcomingCoursesText', 'forthcomingCoursesText', 5000);
}


/*Example message arrays for the two demo scrollers*/

//var pausecontent=new Array()
//pausecontent[0] = '<a href=courses/public_details1.asp?CourseID=315><b><b>product portfolio and lifecycle management</b></a></b><br />Duration: 2 Days<br />Start Date: 09/05/2007';pausecontent[1] = '<a href=courses/public_details1.asp?CourseID=314><b><b>managing demand</b></a></b><br />Duration: 2 Days<br />Start Date: 14/05/2007';pausecontent[2] = '<a href=courses/public_details1.asp?CourseID=313><b><b>advanced supply planning</b></a></b><br />Duration: 2 Days<br />Start Date: 16/05/2007';pausecontent[3] = '<a href=courses/public_details1.asp?CourseID=304><b><b>business excellence - the overview</b></a></b><br />Duration: 3 Days<br />Start Date: 04/06/2007';pausecontent[4] = '<a href=courses/public_details1.asp?CourseID=310><b><b>driving business improvement with agile lean & sigma tools & techniques</b></a></b><br />Duration: 3 Days<br />Start Date: 11/06/2007';pausecontent[5] = '<a href=courses/public_details1.asp?CourseID=303><b><b>business excellence for executives</b></a></b><br />Duration: 2 Days<br />Start Date: 13/06/2007';pausecontent[6] = '<a href=courses/public_details1.asp?CourseID=312><b><b>managing the extended supply chain</b></a></b><br />Duration: 2 Days<br />Start Date: 18/06/2007';pausecontent[7] = '<a href=courses/public_details1.asp?CourseID=309><b><b>integrated business management (S&OP) in practice</b></a></b><br />Duration: 2 Days<br />Start Date: 25/06/2007';



/***********************************************
* Pausing up-down scroller- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

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: 90%" id="'+divId+'1">'+content[0]+'</div><div class="innerDiv" style="position: absolute; width: 90%; visibility: hidden" id="'+divId+'2">'+content[1]+'</div></div>')

$(divId+'1').innerHTML = '';
$(divId+'2').innerHTML = '';

if(!content[0] && !content[1]) { return; }

if(content[0]) { $(divId+'1').innerHTML = content[0]; }

if(content[1]) { $(divId+'2').innerHTML = content[1]; }
else if(content[0]) { $(divId+'2').innerHTML = content[0]; }

var scrollerinstance=this

this.initialize();

//function(){scrollerinstance.initialize()}, false);

/*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+2)){
this.visiblediv.style.top=parseInt(this.visiblediv.style.top)-2+"px"
this.hiddendiv.style.top=parseInt(this.hiddendiv.style.top)-2+"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
}



