//handle pop up windows
function P7_infopop(a) { //v1.0 by PVII
 document.p7tutpop = window.open(a,'theInfo','toolbar=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,top=0,left=0,height=590,width=800');
 document.p7tutpop.focus();
}

function log(s)
{
/*
	if( true ) return;
	var l = document.getElementById( "log" );
	if( !l ) {
		return;
	}
	l.value += "\n" + s;
*/
}
/* 
  ------------------------------------------------
  PopMenu Magic menu scripts
  Copyright (c) 2004-2005 Project Seven Development
  www.projectseven.com
  Version: 1.0.2
  ------------------------------------------------
*/

var allMenus = new Array();

function P7_PMclr() {
	for( var i=0; i<allMenus.length; ++i ) {
		allMenus[i].P7_PMclr();
	}
}

function CssMenu() {
	allMenus.push( this );
}

function P7_setPM(){ //v1.0 by PVII-www.projectseven.com
 var i,d='',h="<sty"+"le type=\"text/css\">",tA=navigator.userAgent.toLowerCase();if(window.opera){
 if(tA.indexOf("opera 5")>-1||tA.indexOf("opera 6")>-1){return;}}if(document.getElementById){
 for(i=1;i<20;i++){d+='ul ';h+="\n.p7PMnav "+d+"{position:absolute;left:-9000px;}";}
 document.write(h+"\n<"+"/sty"+"le>");}} P7_setPM();

CssMenu.prototype.hookupHovers = function()
{
 	this.p7PMct=new Array;
 	tD=document.getElementById(this.p7PMp[5]);
 	if(tD){
		tA=tD.getElementsByTagName('A');
		for(i=0;i<tA.length;i++){
	 		tA[i].p7PMcl=this.p7PMct.length;
	 		this.p7PMct[this.p7PMct.length]=tA[i];
	 		g=tA[i].parentNode.getElementsByTagName("UL");
	 		tA[i].p7PMsub=(g)?g[0]:false;
	 		
	 		ev=tA[i].getAttribute("onmouseover");
	 		if(!ev||ev=='undefined'){
	 			tA[i].onmouseover=function(){
	 				self.P7_PMtrig(this);
	 			};
	 		}
	 		ev=tA[i].getAttribute("onfocus");
	 		if(!ev||ev=='undefined'){
	 			tA[i].onfocus=function(){
	 				self.P7_PMtrig(this);
	 			};
	 		}
	 		
	 		if(tA[i].p7PMsub){
	 			pp=tA[i].parentNode;
	 			lvl=0;
	 			while(pp){
	 				if(pp.tagName&&(pp.tagName=="UL" || pp.tagName=="TABLE")){
	 					lvl++;
	 				}
	 				if( pp.tagName && pp.tagName == "TABLE" )
	 					break;
	 				pp=pp.parentNode;
	 			}
	 			tA[i].p7PMlv=lvl;
	 		}
	 	} 
	 	var self = this; 
	 	tD.onmouseout=function(evt){ 
	 		self.P7_PMclose(evt, self.p7PMp[5]); 
	 	}; 
	 	this.P7_PMopen(this.p7PMp[5]);
 	}
};

CssMenu.prototype.format = function()
{
	var m = document.getElementById( this.menuId );
	if( !m ) {
		return;
	}
	
	if( m.className != "p7PMnavH" ) {
		this.hookupHovers();
		return;
	}
	
	var pp = m.parentNode;
	while( !pp.nodeName || "div" != pp.nodeName.toLowerCase() ) {
		pp = pp.parentNode;
	}
	var p = pp.parentNode;
	//pp.style.display = 'none';
	
	var s = this;
	setTimeout( function() {
		var w = p.offsetWidth;
		pp.style.width = w + 'px';
		p.style.width = w + 'px';
		p.style.overflowX = 'hidden';
		pp.style.display = 'block';
	
		var tr = null;
		var tds = m.getElementsByTagName("td");
		var lastGoodInd = 0;
		for( var i=0; i<tds.length; ++i ) {
			if( tr == null ) {
				tr = tds[i].parentNode;
			}
			if( tds[i].className && tds[i].className.indexOf( "spacer" ) != -1 ) {
				continue;
			}
			if( tds[i].offsetLeft + tds[i].offsetWidth > w ) {
				if( tds[i].className && tds[i].className == "p7PMHspacerCell" ) {
					lastGoodInd = i-1;
				}
				else {
					lastGoodInd = i-2;
				}
				break;
			}
		}
		
		if( lastGoodInd > 0 ) {
			var ul = document.createElement( "ul" );
			ul.className = "p7PMhide";
			var divs = m.getElementsByTagName( "div" );
			for( var i=lastGoodInd; i<divs.length; ++i ) {
				if( divs[i].className && divs[i].className.indexOf( "spacer" ) != -1 ) {
					continue;
				}
				var li = document.createElement( "li" );
				if( i == lastGoodInd ) {
					li.className = "p7PMnavH-firstSubMenuItem";
				}
				while( divs[i].firstChild ) {
					li.appendChild( divs[i].firstChild );
				}
				ul.appendChild( li );
			}
			
			for( var i = tds.length-1; i>=lastGoodInd; --i ) {
				tds[i].parentNode.removeChild( tds[i] );
			}
			
			var moreTd = document.createElement( "td" );
			//moreTd.setAttribute( "valign", "top" );
			var moreDiv = document.createElement( "div" );
			var moreA = document.createElement( "a" );
			moreA.href = "#";
			moreA.className = "p7PMtrg";
			moreA.innerHTML = "More...";
			moreDiv.appendChild( moreA );
			moreDiv.appendChild( ul );
			moreTd.appendChild( moreDiv );
			tr.appendChild( moreTd );
		}
		p.style.overflowX = '';
		s.hookupHovers();
	}, 200 );
};


function nullFunc()
{
	return false;
}

CssMenu.prototype.P7_initPM = function(){ //v1.0 by PVII-www.projectseven.com
	var self = this;
	
 var i,g,tD,tA,tU,pp,lvl,tn=navigator.userAgent.toLowerCase(); 
 if(window.opera){
 	if(tn.indexOf("opera 5")>-1||tn.indexOf("opera 6")>-1){
 		return;
 	}
 }
 else if(!document.getElementById){
 	return;
 }
 this.p7PMp=arguments; 
 this.menuId = this.p7PMp[5]; 
 
 this.format();
 
};
CssMenu.prototype.P7_PMtrig = function(a){ //v1.0 by PVII-www.projectseven.com
	
	var b,t;
	if(document.p7PMt){
		clearTimeout(document.p7PMt);
	}
	document.p7PMa=1;

	var self = this;
	if( a.p7PMsub ) {
		document.p7PMt = setTimeout( function() {
			self.P7_PMshow(a.p7PMcl);
		}, 100 );
	}
	else {
		document.p7PMt = setTimeout( function() {
			self.P7_PMtg(a.p7PMcl);
		}, 100 );
	}
	/*
	b=(a.p7PMsub)?'P7_PMshow(':'P7_PMtg(';
	t='document.p7PMt=setTimeout("'+b+a.p7PMcl+')",160)';
	eval (t);
	*/
};
CssMenu.prototype.P7_PMshow = function(a,bp){ //v1.0.2 by PVII-www.projectseven.com
 	var u,lv,oft,ofr,uw,uh,pp,aw,ah,adj,mR,mT,wW=0,wH,w1,w2,w3,sct,pw,lc,pwv,xx=0,yy=0,wP=true;
 	var iem=(navigator.appVersion.indexOf("MSIE 5")>-1)?true:false,dce=document.documentElement,dby=document.body;
 	document.p7PMa=1;
 	if(!bp){
 		this.P7_PMtg(a);
 	}
 	u=this.p7PMct[a].p7PMsub;
 	if(u.p7pmax&&u.p7pmax==1){
 		return;
 	}
 	u.p7pmax=1;
 	lv=(this.p7PMp[0]==1&&this.p7PMct[a].p7PMlv==1)?true:false;
 	
 	this.p7PMct[a].className=this.p7PMct[a].className.replace("p7PMtrg","p7PMon");
 	oft=parseInt(this.p7PMp[3]);
 	ofr=parseInt(this.p7PMp[4]);
 	uw=u.offsetWidth;
 	uh=u.offsetHeight;
 	pp=this.p7PMct[a];
 	aw=pp.offsetWidth;
 	ah=pp.offsetHeight;
 	
 	while(pp)
 	{
 		xx+=(pp.offsetLeft)?pp.offsetLeft:0;
	 	yy+=(pp.offsetTop)?pp.offsetTop:0;
	 	if(window.opera||navigator.userAgent.indexOf("Safari")>-1){
	 		if(this.p7PMct[a].p7PMlv!=1&&pp.nodeName=="BODY"){
	 			yy-=(pp.offsetTop)?pp.offsetTop:0;
	 		}
	 	}
	 	pp=pp.offsetParent;
 	}
 	
 	
 	if(iem&&navigator.userAgent.indexOf("Mac")>-1){
 		yy+=parseInt(dby.currentStyle.marginTop);
 	}
 	adj=parseInt((aw*ofr)/100);
 	mR=(lv)?0:aw-adj;
 	adj=parseInt((ah*oft)/100);
 	mT=(lv)?0:(ah-adj)*-1;
 	w3=dby.parentNode.scrollLeft;
 	if(!w3)
 	{
 		w3=dby.scrollLeft;
 	}
 	w3=(w3)?w3:0;
 	if(dce&&dce.clientWidth)
 	{
 		wW=dce.clientWidth+w3;
 	}
 	else if(dby)
 	{
 		wW=dby.clientWidth+w3;
 	}
 	if(!wW)
 	{
 		wW=0;wP=false;
 	}
 	wH=window.innerHeight;
 	if(!wH)
 	{
 		wH=dce.clientHeight;
 		if(!wH||wH<=0)
 		{
 			wH=dby.clientHeight;
		}
	}
	sct=dby.parentNode.scrollTop;
	if(!sct)
	{
		sct=dby.scrollTop;
		if(!sct)
		{
			sct=window.scrollY?window.scrollY:0;
		}
	}
	pw=xx+mR+uw;
	if(pw>wW&&wP)
	{
		mR=uw*-1;mR+=10;
		if(lv)
		{
			mR=(wW-xx)-uw-10;
		}
	}
	lc=xx+mR;
	if(lc<0)
	{
		mR=xx*-1;
	}
	pw=yy+uh+ah+mT-sct;
	pwv=wH-pw;
 
	if(pwv<0)
	{
		mT+=pwv;
		if(uh>wH)
		{
			mT=(yy+ah-sct)*-1;
		}
	}
	u.style.marginLeft=mR+'px';
	u.style.marginTop=mT+'px';
 
	if(this.p7PMp[2]==1)
	{
		if(!iem)
		{
			this.P7_PManim(a,20);
		}
	}
	u.className="p7PMshow";
	u.style.zIndex = 2000;
	clearSelectsFor( u );
};

CssMenu.prototype.P7_PMhide = function(u){ //v1.0 by PVII-www.projectseven.com
 
 	var restore = false;
 	if( u.className == "p7PMshow" ) {
 		restore = true;
 	}
 	var i,tt,ua;u.p7pmax=0;u.className="p7PMhide";ua=u.parentNode.firstChild; 
 
 	while( ua && ua.nodeType != 1 ) {
 		ua = ua.nextSibling;
 	}
 	if( ua ) {
	 	ua.className=ua.className.replace("p7PMon","p7PMtrg");
 	}
 	if( restore ) {
 		restoreSelectsFor( u );
 	}
};
CssMenu.prototype.P7_PMtg = function(a,b){ //v532 alpha by PVII-www.projectseven.com
 	var i,u,tA,tU,pp;
 	tA=this.p7PMct[a];
 	pp=tA.parentNode;
 	while(pp){
 		if(pp.tagName=="UL" /* modified */ || pp.tagName == "TABLE"){
 			break;
 		}
 		pp=pp.parentNode;
 	}
 	if(pp){
 		tU=pp.getElementsByTagName("UL");
 		for(i=tU.length-1;i>-1;i--){
 			if(b!=1&&tA.p7PMsub==tU[i]){
 				continue;
 			}
 			else{
 				this.P7_PMhide(tU[i]);
 			}
 		}
 	}
};
CssMenu.prototype.P7_PMclose = function(evt,menuId){ //v1.0 by PVII-www.projectseven.com
	var self = this;
 var pp,st,tS,m=true;evt=(evt)?evt:((event)?event:null);st=document.p7PMa;if(st!=-1){if(evt){
 tS=(evt.relatedTarget)?evt.relatedTarget:evt.toElement; if(tS){pp=tS.parentNode;while(pp){if(pp&&pp.id&&pp.className=="p7PMnav"){m=false;
 document.p7PMa=1;break;}pp=pp.parentNode;}}if(m){document.p7PMa=-1;if(document.p7PMt){clearTimeout(document.p7PMt);}
 document.p7PMt=setTimeout( function() { P7_PMclr() },360);}}}
};
CssMenu.prototype.P7_PMclr = function(){ //v1.0 by PVII-www.projectseven.com
 var i,tU,tUU;document.p7PMa=-1;tU=document.getElementById(this.menuId);if(tU){tUU=tU.getElementsByTagName("UL");if(tUU){
 for(i=tUU.length-1;i>-1;i--){this.P7_PMhide(tUU[i]);}}}
};
CssMenu.prototype.P7_PManim = function(a,st){ //v1.0 by PVII-www.projectseven.com
 var g=this.p7PMct[a].p7PMsub,sp=30,inc=20;st=(st>=100)?100:st;g.style.fontSize=st+"%";if(st<100){st+=inc;
 var self = this;
 setTimeout( function() { self.P7_PManim(a,st); },sp);}
 growSelectsShieldFor( g );
 g.style.zIndex = 200;
};
CssMenu.prototype.P7_PMmark = function(){document.p7PMop=arguments;}
CssMenu.prototype.P7_PMopen = function(menuId){ //v1.0 by PVII-www.projectseven.com
 var i,x,tA,op,pp,wH,tA,aU,r1,k=-1,kk=-1,mt=new Array(1,'','');
 if(document.p7PMop){
 	mt=document.p7PMop;
 }
 op=mt[0];if(op<1){
 	return;
 }
 tA=document.getElementById(menuId).getElementsByTagName("A");
 wH=window.location.href;
 r1=/index\.[\S]*/i;
 for(i=0;i<tA.length;i++){
 	if(tA[i].href){
 		aU=tA[i].href.replace(r1,'');
 		if(op>0){
 			if(tA[i].href==wH /*||aU==wH*/){
 				k=i;kk=-1;break;
 			}
 		}
 		if(op==2){
 			if(tA[i].firstChild){
 				if(tA[i].firstChild.nodeValue==mt[1]){
 					kk=i;
 				}
 			}
 		}
 		if(op==3 && tA[i].href.indexOf(mt[1])>-1){
 			kk=i;
 		}
 		if(op==4){
 			for(x=1;x<mt.length;x+=2){
 				if(wH.indexOf(mt[x])>-1){
 					if(tA[i].firstChild&&tA[i].firstChild.data){
 						if(tA[i].firstChild.data==mt[x+1]){
 							kk=i;break;
 						}
 					}
 				}
 			}
 		}
 	}
 }
 k=(kk>k)?kk:k;
 
 if(k>-1){
 	pp=tA[k].parentNode;
 	while(pp){
 		if(pp.nodeName=="DIV"){
 			pp.firstChild.className="p7PMmark"+" "+pp.firstChild.className;
 		}
 		pp=pp.parentNode;
 	}
 }
 if(kk>-1){
 	document.p7PMad=1;
 }
 this.P7_PMadma(menuId);
 this.P7_PMadmb(menuId);
};
CssMenu.prototype.P7_PMadma = function(menuId){ //v1.0 by PVII-www.projectseven.com
 var s,ss,i,j,a,g,b,c,d,t,h,tA,b,tP,r1,r2,tI,bA,aA,tB=new Array(),bC='',x=0,ur=1,mt=document.p7PMad;g=document.getElementById(menuId);
 b=document.getElementById("pmmcrumb");if(g&&b){c=b.getElementsByTagName("A");if(c&&c[0]){tP=c[0].parentNode.childNodes;r1=/<a/i;r2=/\/a>/i;
 tI=c[0].parentNode.innerHTML;j=tI.search(r1);bA=tI.substring(0,j);j=tI.search(r2);aA=tI.substring(j+3);bC+=(bA)?bA:'';s=(aA)?aA:' &gt ';
 if(!c[0].id||c[0].id!="pmmcn"){if(c[0].href!=window.location.href){tB[0]=c[0];x++;ur=2;}}tA=g.getElementsByTagName("A");for(i=0;i<tA.length;i++){
 if(tA[i].className.indexOf("p7PMmark")>-1){tB[x]=tA[i];x++;}}for(i=0;i<tB.length;i++){ss=(i>0)?s:'';a=(i==tB.length-1)?0:1;
 d=(i==0&&c[0].id)?'id="'+c[0].id+'" ':' ';t=tB[i].firstChild.nodeValue;if(a==1||mt==1||x<ur){bC+=ss+'<a '+d+'hr'+'ef="'+tB[i].href+'">'+t+'</a>';
 }else{bC+=ss+t;}}if(mt==1||i<ur){ss=(i>0)?s:'';bC+=ss+document.title;}c[0].parentNode.innerHTML=bC;}}
};
CssMenu.prototype.P7_PMadmb = function(menuId){ //v1.0 by PVII-www.projectseven.com
 var h='',g,i,tA,b,m=false;g=document.getElementById(menuId);b=document.getElementById("pmmnext");if(g&&b){tA=g.getElementsByTagName("A");
 for(i=tA.length-1;i>-1;i--){if(tA[i].className.indexOf("p7PMmark")>-1){m=true;break;}}if(m){if(i<tA.length-1){i++;}else{i=0;}
 while(tA[i].href==window.location.href+"#"||tA[i].href=="javascript:;"){i++;if(i>tA.length-1){
 i=0;break;}}b.href=tA[i].href;b.innerHTML=tA[i].firstChild.nodeValue;}}	
};
