var pr_count = 0;
var pr_sec = 3000;
var pr_zindex_base = 10;
var pr_currentObj = 0;
var pr_prevObj = null;
var pr_objects = new Array();
var pr_list_objects = new Array();
var pr_hn = null;
function pr_init(){
var d = window.document;
var tagObj = document.getElementsByTagName("h2");
for(i=0;i<tagObj.length;i++) {
if(tagObj[i].className == "pr_section"){
tagObj[i].style.zIndex = pr_zindex_base - pr_count;
tagObj[i].onmouseover = function(){
pr_pause();
}
tagObj[i].onmouseout = function(){
pr_hn = setTimeout("pr_rotation()",pr_sec);
}
pr_objects.push(tagObj[i]);
if(d.getElementById(tagObj[i].id+"_list")){
pr_list_objects[tagObj[i].id+"_list"] = pr_count;
d.getElementById(tagObj[i].id+"_list").style.cursor = "pointer";
d.getElementById(tagObj[i].id+"_list").onclick = function(){
pr_switch(this);
}
}
pr_count++;
}
}
if(d.getElementById(pr_objects[pr_currentObj].id+"_list"))
d.getElementById(pr_objects[pr_currentObj].id+"_list").className = "pr_list_current";
pr_hn = setTimeout("pr_rotation()",pr_sec);
}
function pr_switch(obj){
var d = window.document;
clearTimeout(pr_hn);
if(d.getElementById(pr_objects[pr_currentObj].id+"_list"))
d.getElementById(pr_objects[pr_currentObj].id+"_list").className = "pr_list_enabled";
pr_currentObj = pr_list_objects[obj.id];
if(d.getElementById(pr_objects[pr_currentObj].id+"_list"))
d.getElementById(pr_objects[pr_currentObj].id+"_list").className = "pr_list_current";
var zIndex_ajust = 0;
while(pr_objects.length > zIndex_ajust){
pr_objects[((pr_currentObj+zIndex_ajust) % pr_objects.length)].style.zIndex = pr_zindex_base - zIndex_ajust;
zIndex_ajust++;
}
pr_hn = setTimeout("pr_rotation()",pr_sec);
}
function pr_pause(){
clearTimeout(pr_hn);
}
function pr_rotation(){
fadeOpacity(pr_objects[pr_currentObj].id,100);
}
function fadeOpacity(objId,opacity){
var d = window.document;
if(opacity > 0){
clearTimeout(pr_hn);
setOpacity(objId,(opacity/100))
setTimeout("fadeOpacity('"+objId+"',"+(opacity-5)+")",10);
}
else {
clearTimeout(pr_hn);
pr_objects[pr_currentObj].style.display = "none";
if(d.getElementById(pr_objects[pr_currentObj].id+"_list"))
d.getElementById(pr_objects[pr_currentObj].id+"_list").className = "pr_list_enabled";
pr_prevObj = pr_currentObj;
pr_currentObj++;
pr_currentObj = pr_currentObj % pr_objects.length;
if(d.getElementById(pr_objects[pr_currentObj].id+"_list"))
d.getElementById(pr_objects[pr_currentObj].id+"_list").className = "pr_list_current";
var zIndex_ajust = 0;
while(pr_objects.length > zIndex_ajust){
pr_objects[((pr_currentObj+zIndex_ajust) % pr_objects.length)].style.zIndex = pr_zindex_base - zIndex_ajust;
zIndex_ajust++;
}
pr_objects[pr_prevObj].style.display = "block";
setOpacity(pr_objects[pr_prevObj].id,1);
pr_hn = setTimeout("pr_rotation()",pr_sec);
}
}
function setOpacity(layName,arg) {
var ua = navigator.userAgent;
if(document.layers){
if(arg > 0)
document.layers[layName].visibility = 'visible';
else if(arg==0)
document.layers[layName].visibility = 'hidden';
}
else if(navigator.appVersion.indexOf("Safari") > -1 || ua.indexOf("Opera") > -1)
document.getElementById(layName).style.opacity = arg;
else if( ua.indexOf('Mac_PowerPC') !=-1 && document.all ){
if(arg > 0)
document.all(layName).style.visibility = 'visible';
else if(arg==0)
document.all(layName).style.visibility = 'hidden';
}
else if(document.all) {
document.all(layName).style.filter="alpha(opacity=0)";
document.all(layName).filters.alpha.Opacity= (arg * 100)
}
else if(ua.indexOf('Gecko')!=-1)
document.getElementById(layName).style.MozOpacity = arg;
}
pr_init();
