var menuwidth='230px';
var menubgcolor='#ECF3F9';
var disappeardelay=300;
var hidemenu_onclick="no";
var ie4=document.all;
var ns6=document.getElementById&&!document.all;
var shown=0;

if(ie4||ns6)document.write('<div id="dropmenudiv" style="visibility:hidden;position=absolute;z-index=1;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,langs){
	var langobj;
	if(ie4||ns6)dropmenuobj.style.left=dropmenuobj.style.top=-500;
	if(menuwidth!=""){
		dropmenuobj.widthobj=dropmenuobj.style;
		dropmenuobj.widthobj.width=menuwidth;
	}
	langobj=document.getElementById?document.getElementById("langdiv"):langdiv;
	if(e.type=="click"&&obj.visibility==hidden||e.type=="mouseover"){
		shown=1;
		obj.visibility="visible";
		if(langs==1)langobj.style.visibility="hidden";
		else langobj.style.visibility="visible";
	}else if(e.type=="click"){
		shown=0;
		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 windowedge=ie4&&!window.opera?iecompattest().scrollTop+iecompattest().clientHeight-15:window.pageYOffset+window.innerHeight-18;
		dropmenuobj.contentmeasure=dropmenuobj.offsetHeight;
		if(windowedge-dropmenuobj.y < dropmenuobj.contentmeasure)edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight;
	}
	return edgeoffset;
}

function populatemenu(what){
	if(ie4||ns6)dropmenuobj.innerHTML=what.join("");
}

function dropdownmenu(obj, e, menucontents, menuwidth, langs){
	
	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,langs);
		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(0);
	else if(ns6&&e.currentTarget!= e.relatedTarget&&!contains_ns6(e.currentTarget,e.relatedTarget))delayhidemenu(0);
}

function hidemenu(e){
	langobj=document.getElementById?document.getElementById("langdiv"):langdiv;
	if(typeof dropmenuobj!="undefined"){
		if(ie4||ns6){
			if(e!=1)shown=0;
			dropmenuobj.style.visibility="hidden";
			langobj.style.visibility="visible";
		}
	}
}

function delayhidemenu(i){
	if(ie4||ns6)delayhide=setTimeout("hidemenu("+i+")",disappeardelay);
}

function clearhidemenu(){
	if(typeof delayhide!="undefined")clearTimeout(delayhide);
}

if(hidemenu_onclick=="yes")document.onclick=hidemenu;

//ROLLOVERS
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore(){
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d){
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage(){
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features){
  window.open(theURL,winName,features);
}

function FP_swapImg() {//v1.0
 var doc=document,args=arguments,elm,n; doc.$imgSwaps=new Array(); for(n=2; n<args.length;
 n+=2) { elm=FP_getObjectByID(args[n]); if(elm) { doc.$imgSwaps[doc.$imgSwaps.length]=elm;
 elm.$src=elm.src; elm.src=args[n+1]; } }
}
function FP_getObjectByID(id,o) {//v1.0
 var c,el,els,f,m,n; if(!o)o=document; if(o.getElementById) el=o.getElementById(id);
 else if(o.layers) c=o.layers; else if(o.all) el=o.all[id]; if(el) return el;
 if(o.id==id || o.name==id) return o; if(o.childNodes) c=o.childNodes; if(c)
 for(n=0; n<c.length; n++) { el=FP_getObjectByID(id,c[n]); if(el) return el; }
 f=o.forms; if(f) for(n=0; n<f.length; n++) { els=f[n].elements;
 for(m=0; m<els.length; m++){ el=FP_getObjectByID(id,els[n]); if(el) return el; } }
 return null;
}

function doSplash() { 
  var images = new Array("1a.jpg","1b.jpg","1c.jpg","1d.jpg"); 
  var rand = Math.floor(Math.random()*images.length); 
  document.write("<img src=\"images/"+images[rand]+"\" width=\"570\" height=\"160\" border=\"0\"></a>"); 
}

function OpenBrWindow(theURL,winName,features, myWidth, myHeight, isCenter) { //v3.0
  if(window.screen)if(isCenter)if(isCenter=="true"){
    var myLeft = (screen.width-myWidth)/2;
    var myTop = (screen.height-myHeight)/2;
    features+=(features!='')?',':'';
    features+=',left='+myLeft+',top='+myTop;
  }
  window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
}

//BANNER ROTATOR
function Banner(refreshTime, width, height, altText, start, random){
	this.objName = "bannerAd" + (Banner.count++);
	eval(this.objName + "=this");
	if (!refreshTime) this.refreshTime = 5000; else this.refreshTime = refreshTime*1000;
	if (!width) this.width = 460; else this.width = width;
	if (!height) this.height = 68; else this.height = height;
	if (random == null) this.random = 1; else this.random = random;
	this.altText = altText;
	this.ads = [];
	if (start) this.currentAd = start-1; else start = null;
	this.mySize = 0;

	this.Ad = function(src, href, target, mouseover) {
		var tempImage = new Image();
		tempImage.src = src;
		this.ads[this.mySize] = new Object();
		var ad = this.ads[this.mySize];
		ad.src = src;
		if (typeof(target) == "undefined" || target == null) ad.target = "_self"; else ad.target = target;
		ad.href = href;
		ad.mouseover = mouseover;
		this.mySize++;
	}

	this.link = function(){
		var	ad = this.ads[this.currentAd];
		if (ad.target == "_self"){
			location.href = ad.href;
		}
		else if (ad.target == "_blank" || ad.target == "_new"){
			open(ad.href,this.objName + "Win");
		}
		else top.frames[ad.target].location.href = ad.href;
	}

	this.showStatus = function(){
		var ad = this.ads[this.currentAd];
		if (ad.mouseover) status = ad.mouseover;
		else status = ad.href;
	}

	this.randomAd = function(){
		var n;
		do { n = Math.floor(Math.random() * (this.mySize)); } 
		while(n == this.currentAd);
		this.currentAd = n;
	}

	this.output = function(){
		var tempCode = "";
		if (this.mySize > 1){
			if (this.currentAd == null) this.randomAd();
			if (this.currentAd >= this.mySize) this.currentAd = this.mySize - 1;
			tempCode = '<a href="javascript:'+this.objName+'.link();"';
			tempCode += ' onMouseOver="' + this.objName + '.showStatus(); return true"';
			tempCode += ' onMouseOut="status=\'\';return true">';
			tempCode += '<img src="' + this.ads[this.currentAd].src + '" width="' + this.width;
			tempCode += '" name="' + this.objName + 'Img" height="' + this.height + '" ';
			if (this.altText) tempCode += 'alt="'+this.altText + '" ';
			tempCode += 'border="0" /></a>';
			document.write(tempCode);
			this.nextAd();
		} else document.write("Error: two banners must be defined for the script to work.");
	}

	this.newAd = function(){
		if (!this.random){	
			this.currentAd++;
			if (this.currentAd >= this.mySize)
			   this.currentAd = 0;
		}
		else {
			this.randomAd();
		}
		this.nextAd();
	}

	this.nextAd = function(){
		document.images[this.objName+ 'Img'].src = this.ads[this.currentAd].src;
		setTimeout(this.objName+'.newAd()',this.refreshTime)
	}
}
Banner.count = 0;