
//SCRIPT PER MENU A TENDINA

//Contents for menu 1
var menu1=new Array()
menu1[0]='<a href="Calendar.asp">2011 Calendar</a>'
menu1[1]='<a href="Calendar.asp#Event01">Rallye Automobile Monte-Carlo</a>'
menu1[2]='<a href="Calendar.asp#Event02">Rally Internacional de Curitiba</a>'
menu1[3]='<a href="Calendar.asp#Event03">Rally Argentina</a>'
menu1[4]='<a href="Calendar.asp#Event04">Rally Islas Canarias</a>'
menu1[5]='<a href="Calendar.asp#Event05">Rally d\'Italia Sardegna</a>'
menu1[6]='<a href="Calendar.asp#Event06">Geko Ypres Rally</a>'
menu1[7]='<a href="Calendar.asp#Event07">Sata Rally Açores</a>'
menu1[8]='<a href="Calendar.asp#Event08">Rali Vinho Madeira</a>'
menu1[9]='<a href="Calendar.asp#Event09">Barum Czech Rally Zlín</a>'
menu1[10]='<a href="Calendar.asp#Event10">Rallye Sanremo</a>'
menu1[11]='<a href="Calendar.asp#Event11">RAC MSA Rally of Scotland</a>'
menu1[12]='<a href="Calendar.asp#Event11">FxPro Cyprus Rally</a>'


//Contents for menu 2, and so on
var menu2=new Array()
menu2[0]='<a href="Standings_results.asp#IRCDrivers">IRC Drivers results</a>'
menu2[1]='<a href="Standings_results.asp#IRCManufacturers">IRC Manufacturers results</a>'
menu2[2]='<a href="Standings_results.asp#IRC2WDDrivers"><span>IRC 2WD Cup drivers results</span></a>'
menu2[3]='<a href="Standings_results.asp#IRC2WDManufacturers"><span>IRC 2WD Cup Manufacturers results</span></a>'

//var menu3=new Array()
//menu3[0]='<a href="Press_Archive.asp?year=2009">2009 IRC Season</a>'
//menu3[1]='<a href="Press_Archive.asp?year=2008">2008 IRC Press Archive</a>'
//menu3[2]='<a href="Press_Archive.asp?year=2007">2007 IRC Press Archive</a>'

var menu3=new Array()
menu3[0]='<a href="#">2010 Press Kit</a>'
menu3[1]='<a href="media.asp">Newsletters</a>'
menu3[2]='<a href="Press_Archive.asp">Press releases</a>'
menu3[3]='<a href="Archives_2010.asp">Archives 2010</a>'
menu3[4]='<a href="Archives_2009.asp">Archives 2009</a>'
menu3[5]='<a href="Archives_2008.asp">Archives 2008</a>'
menu3[6]='<a href="Archives_2007.asp">Archives 2007</a>'
menu3[7]='<a href="Accreditation.asp">Accreditation</a>'
menu3[8]='<a href="http://irc.dystribute.tv/">Video downloads</a>'

var menuwidth='998' //default menu width
var menubgcolor='#F08D0D'  //menu bgcolor
var disappeardelay=50  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){
	var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
	var parentEl=what.offsetParent;
	while (parentEl!=null){
		totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
		parentEl=parentEl.offsetParent;
	}
	return totaloffset;
}

function showhide(obj, e, visible, hidden, menuwidth){
	if (ie4||ns6)
		dropmenuobj.style.left=dropmenuobj.style.top=-500
	if (menuwidth!=""){
		dropmenuobj.widthobj=dropmenuobj.style
		dropmenuobj.widthobj.width=menuwidth
	}
	if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
		obj.visibility=visible
	else if (e.type=="click")
		obj.visibility=hidden
}

function iecompattest(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
	var edgeoffset=0
	if (whichedge=="rightedge"){
		var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
		dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
		if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
			edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
	}
	else{
		var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
		var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
		dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
		if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
			edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
			if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
				edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
		}
	}
	return edgeoffset
}

function populatemenu(what){
	if (ie4||ns6)
		dropmenuobj.innerHTML=what.join("")
}

function dropdownmenu(obj, e, menucontents, menuwidth){
	if (window.event) event.cancelBubble=true
	else if (e.stopPropagation) e.stopPropagation()
	clearhidemenu()
	dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
	populatemenu(menucontents)
	
	if (ie4||ns6){
		showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
		dropmenuobj.x=getposOffset(obj, "left")
		dropmenuobj.y=getposOffset(obj, "top")
		dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
		dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
	}

	return clickreturnvalue()
}

function clickreturnvalue(){
	if (ie4||ns6) return false
	else return true
}

function contains_ns6(a, b) {
	while (b.parentNode)
		if ((b = b.parentNode) == a)
			return true;
	return false;
}

function dynamichide(e){
	if (ie4&&!dropmenuobj.contains(e.toElement))
	delayhidemenu()
	else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
	delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu

// FUNZIONE GESTIONE FLASH

function BannerTopSWF()
{
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="776" height="113">')
	document.write('<param name="movie" value="Banner-Top.swf" />')
	document.write('<param name="quality" value="high" />')
	document.write('<embed src="Banner-Top.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="776" height="113"></embed>')
	document.write('</object>')
}

function TickerSWF()
{
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="821" height="27">')
	document.write('<param name="movie" value="News_Ticker.swf" />')
	document.write('<param name="wmode" value="transparent">')
	document.write(' <param name="quality" value="high" />')
	document.write('<embed src="News_Ticker.swf" quality="high" wmode="transparent" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="821" height="27"></embed>')
	document.write('</object>')
}

function VideoHome()
{
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="298" height="242">')
	document.write('<param name="movie" value="Video-Home/Video-Home.swf" />')
	document.write('<param name="wmode" value="transparent">')
	document.write(' <param name="quality" value="high" />')
	document.write('<embed wmode="transparent" src="Video-Home/Video-Home.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="298" height="242"></embed>')
	document.write('</object>')
}

function VideoInside()
{
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="160" height="128">')
	document.write('<param name="movie" value="Video-Home/Video-Home.swf" />')
	document.write('<param name="wmode" value="transparent">')
	document.write(' <param name="quality" value="high" />')
	document.write('<embed wmode="transparent" src="Video-Home/Video-Home.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="160" height="128"></embed>')
	document.write('</object>')
}


// SCRIPT TABBER

/*
Yetii - Yetii - Yet (E)Another Tab Interface Implementation
http://www.kminek.pl/lab/yetii/
(c) 2007 Grzegorz Wojcik
It is up to You to leave or remove this copyright notice
---
Slightly modified for IE5.x support by Alessandro Fulciniti - http://www.html.it
*/

function Yetii(obj,active){
    
    this.active = (active) ? active : 1,
    this.timeout = null,
    this.tabclass = 'tab',
    this.activeclass = 'active',
    
    this.getTabs = function(){
 
        var retnode = [];
        var elem = document.getElementById(obj).childNodes;     //modified for IE 5.x support
        for (var i = 0; i < elem.length; i++) {
        if (elem[i].className==this.tabclass) retnode[retnode.length]=elem[i];
        }
    
        return retnode;
    
    },
        
    this.links = document.getElementById(obj+'-nav').getElementsByTagName('a'),
    this.tabs = this.getTabs();
    
    this.show = function(number){
        
        for (var i = 0; i < this.tabs.length; i++) {
        this.tabs[i].style.display = ((i+1)==number) ? 'block' : 'none';
        this.links[i].className = ((i+1)==number) ? this.activeclass : '';
        }
    
    },
    
    this.rotate = function(interval){
    
        this.show(this.active);
        this.active++;
    
        if(this.active > this.tabs.length) this.active = 1;
    
        var self = this;
        this.timeout = setTimeout(function(){self.rotate(interval);}, interval*1000);
    
    },
    
    this.init = function(interval){
    
        this.show(this.active);
        
        var self = this; 
        for (var i = 0; i < this.links.length; i++) {
        this.links[i].customindex = i+1;
        this.links[i].onclick = function(){ if (self.timeout) clearTimeout(self.timeout); self.show(this.customindex); return false; };
        } 
        
        if (interval) this.rotate(interval);
            
    };

};


function OAS_NORMAL(pos) {
	document.write('<a href="'+OAS_url+'click_nx.ads/'+OAS_sitepage+'/1'+OAS_rns+'@'+OAS_listpos+'!'+pos+OAS_query+'" target=new>');document.write('<img src="'+OAS_url+'adstream_nx.ads/'+OAS_sitepage+'/1'+OAS_rns+'@'+OAS_listpos+'!'+pos+OAS_query+'" border=0></a>');
}
function OAS_AD(pos) {
	if(OAS_version>=11) {OAS_RICH(pos);}
	else {OAS_NORMAL(pos);}
}
