
/* 
 ================================================
 PVII Horizontal Accordion Panel scripts
 Copyright (c) 2011 Project Seven Development
 www.projectseven.com
 Version: 1.1.6 -build 28
 ================================================
 
*/

// define the image swap file naming convention

// rollover image for any image in the normal state
var p7HAPMover='_over';

// image for any trigger that has an open panel -no rollover
var p7HAPMopen='_down';

var p7HAPMctl=[],p7HAPMi=false,p7HAPMa=false,p7HAPMadv=[];
function P7_HAPMset(){
	var h,hd,sh='';
	if (!document.getElementById || P7_HAPMgetIEver()==5){
		return;
	}
	sh+='.p7HAPMviewport {position:relative;overflow:hidden;padding:0;margin:0;border:0;}\n';
	sh+='.p7HAPM_trigger_wrapper, .p7HAPM_trigger_wrapper_img {display:block !important;}\n';
	sh+='.p7HAPM_section {position:absolute;}\n';
	if(document.styleSheets){
		h='\n<st' + 'yle type="text/css">\n' + sh + '\n</s' + 'tyle>';
		h+='\n<!--[if IE 8]>\n';
		h+='<st'+'yle>.p7HAPM_panel {position: relative;}</st'+'yle>\n';
		h+='<![endif]-->\n';
		h+='<!--[if IE 6]>\n';
		h+='<st'+'yle>\n';
		h+='.p7HAPM_trigger_wrapper, .p7HAPM_trigger_wrapper_img {position:absolute;top:0;left:0;float:none !important;}\n';
		h+='.p7HAPM_trigger_wrapper_img {width:0px !important;}\n';
		h+='</st'+'yle>\n';
		h+='<![endif]-->\n';
		document.write(h);
	}
	else{
		h=document.createElement('style');
		h.type='text/css';
		h.appendChild(document.createTextNode(sh));
		hd=document.getElementsByTagName('head');
		hd[0].appendChild(h);
	}
}
P7_HAPMset();
function P7_opHAPM(){
	if(!document.getElementById){
		return;
	}
	p7HAPMctl[p7HAPMctl.length]=arguments;
}
function P7_HAPMaddLoad(){
	if(!document.getElementById){
		return;
	}
	if(window.addEventListener){
		document.addEventListener("DOMContentLoaded",P7_initHAPM,false);
		window.addEventListener("load",P7_initHAPM,false);
		window.addEventListener("unload",P7_HAPMrf,false);
		window.addEventListener("resize",P7_HAPMrsz,false);
	}
	else if(window.attachEvent){
		document.write("<script id=p7ie_HAPM defer src=\"//:\"><\/script>");
		document.getElementById("p7ie_HAPM").onreadystatechange=function(){
			if(this.readyState=="complete"){
				if(p7HAPMctl.length>0){
					P7_initHAPM();
				}
			}
		};
		window.attachEvent("onload",P7_initHAPM);
		window.attachEvent("onresize",P7_HAPMrsz);
	}
}
P7_HAPMaddLoad();
function P7_HAPMrf(){
	return;
}
function P7_HAPMcheck(){
	var el,tD,m=false;
	el=document.createElement('div');
	el.setAttribute("id","p7hapm_control");
	el.style.position='absolute';
	el.className='p7HAPMcontrol';
	document.getElementsByTagName('body')[0].appendChild(el);
	tD=document.getElementById('p7hapm_control');
	if(tD.offsetWidth==28){
		m=true;
	}
	document.getElementsByTagName('body')[0].removeChild(tD);
	return m;
}
function P7_initHAPM(){
	var i,j,x,tc,ck=false,tB,tA,tT,vP,p,po;
	if(P7_HAPMgetIEver()==5){
		return;
	}
	if(p7HAPMi){
		return;
	}
	if(!P7_HAPMcheck()){
		setTimeout("P7_initHAPM()",50);
		return;
	}
	p7HAPMi=true;
	p7HAPMctl=p7HAPMctl.reverse();
	document.p7HAPMpreload=[];
	for(i=0;i<p7HAPMctl.length;i++){
		tB=document.getElementById(p7HAPMctl[i][0]);
		vP=document.getElementById(tB.id.replace('_','vp_'));
		if(tB){
			ck=true;
			tB.hapmInit=false;
			tB.p7opt=p7HAPMctl[i];
			if(P7_HAPMisMobile()){
				tB.p7opt[5]=0;
				tB.p7opt[3]=parseInt((tB.p7opt[3]/2),10);
			}
			tB.p7HAPMsect=[];
			tB.p7HAPMtrig=[];
			tB.p7HAPMtrigdv=[];
			tB.p7HAPMcont=[];
			tB.p7HAPMcontc=[];
			tB.hapmCurrentPanel=-1;
			tB.hapmPanelSliderRunning=false;
			tB.hapmFrameRate=4;
			if(tB.p7opt[14]==2&&tB.p7opt[4]>0){
				vP.style.height=tB.p7opt[4]+'px';
				tB.hapmHfinish=tB.p7opt[4];
			}
			tA=tB.getElementsByTagName('A');
			tc=0;
			for(j=0;j<tA.length;j++){
				if(tA[j].id&&tA[j].id.indexOf(tB.id.replace('_','a'))===0){
					tT=document.getElementById(tA[j].id.replace('a','tw'));
					if(tT){
						tA[j].hapmContent=false;
						tB.p7HAPMsect[tc]=document.getElementById(tA[j].id.replace('a','s'));
						tB.p7HAPMtrig[tc]=tA[j];
						tB.p7HAPMtrigdv[tc]=tT;
						tB.p7HAPMtrigdv[tc].hapmTrig=tA[j];
						tB.p7HAPMcont[tc]=document.getElementById(tA[j].id.replace('a','cw'));
						tB.p7HAPMcontc[tc]=document.getElementById(tA[j].id.replace('a','cc'));
						if(tB.p7HAPMcont[tc]&&tB.p7HAPMcontc[tc]){
							tA[j].hapmContent=true;
							tB.p7HAPMcont[tc].hapmDiv=tB.id;
							tB.p7HAPMcont[tc].hapmPanelNum=tc+1;
						}
						tA[j].hapmDiv=tB.id;
						tA[j].hapmPanelNum=tc+1;
						tA[j].hapmState='closed';
						tA[j].parentNode.hapmState='closed';
						tA[j].hasImg=false;
						iM=tA[j].getElementsByTagName("IMG");
						if(iM&&iM[0]){
							sr=iM[0].getAttribute("src");
							swp=tB.p7opt[7];
							x=sr.lastIndexOf(".");
							fnA=sr.substring(0,x);
							fnB='.'+sr.substring(x+1);
							s1=fnA+p7HAPMover+fnB;
							s2=fnA+p7HAPMopen+fnB;
							if(swp==1){
								iM[0].p7imgswap=[sr,s1,s1,s1];
								P7_HAPMpreloader(s1);
							}
							else if(swp==2){
								iM[0].p7imgswap=[sr,s1,s2,s2];
								P7_HAPMpreloader(s1,s2);
							}
							else{
								iM[0].p7imgswap=[sr,sr,sr,sr];
							}
							iM[0].p7state='closed';
							iM[0].mark=false;
							iM[0].rollover=tB.p7opt[8];
							tA[j].hasImg=true;
							if(swp>0){
								iM[0].onmouseover=function(){
									P7_HAPMimovr(this);
								};
								iM[0].onmouseout=function(){
									P7_HAPMimout(this);
								};
								tA[j].onfocus=function(){
									P7_HAPMimovr(this.getElementsByTagName('IMG')[0]);
								};
								tA[j].onblur=function(){
									P7_HAPMimout(this.getElementsByTagName('IMG')[0]);
								};
							}
						}
						if(!tA[j].hasImg){
							P7_HAPMsetTriggerText(tA[j]);
						}
						if(tB.p7opt[5]!=1){
							tA[j].onclick=function(){
								return P7_HAPMclick(this);
							};
							tB.p7HAPMtrigdv[tc].onclick=function(){
								m=P7_HAPMclick(this.hapmTrig,1);
								return P7_HAPMclick(this.hapmTrig,1);
							};
						}
						if(tB.p7opt[5]>0){
							tA[j].onmouseover=function(){
								P7_HAPMclick(this);
							};
							tB.p7HAPMtrigdv[tc].onmouseover=function(){
								if(this.hapmTrig.hapmState!='open'){
									P7_HAPMclick(this.hapmTrig);
								}
							};
						}
						tc++;
						ck=true;
					}
				}
			}
			tB.hapmDefContentPanel=1;
			for(j=0;j<tB.p7HAPMtrig.length;j++){
				if(tB.p7HAPMtrig[j].hapmContent){
					tB.hapmDefContentPanel=j+1;
					break;
				}
			}
			p=tB.p7opt[1];
			if(p==-1){
				p=Math.floor(Math.random()*tB.p7HAPMtrig.length+1);
			}
			p--;
			po=p;
			if(!tB.p7HAPMtrig[p] || !tB.p7HAPMtrig[p].hapmContent){
				p=tB.hapmDefContentPanel-1;
			}
			tB.hapmCurrentPanel=p+1;
			P7_HAPMresizer(tB);
			P7_HAPMopen(tB.p7HAPMtrig[p]);
			if(tB.p7HAPMtrig[po] && !tB.p7HAPMtrig[po].hapmContent){
				P7_HAPMopen(tB.p7HAPMtrig[po]);
			}
			if(tB.p7opt[9]==1){
				P7_HAPMcurrentMark(tB);
			}
			P7_HAPMurl(tB.id);
			tB.hapmInit=true;
			tB.hapmRotateCycles=tB.p7opt[12];
			tB.hapmRotateCyclesCounter=1;
			tB.hapmRotatePanelNums=tB.p7HAPMtrig.length;
			tB.hapmRotateCounter=1;
			tB.hapmRotateRunning=false;
			if(tB.p7opt[11]==1){
				tB.hapmRotateRunning=true;
				tB.hapmRotate=setInterval("P7_HAPMrotate('"+tB.id+"')",tB.p7opt[13]);
			}
		}
	}
	if(ck){
		p7HAPMa=true;
		setInterval("P7_HAPMcheckHeights()",20);
	}
	else{
		p7HAPMi=false;
	}
}
function P7_HAPMpreloader(){
	var i,x;
	for(i=0;i<arguments.length;i++){
		x=document.p7HAPMpreload.length;
		document.p7HAPMpreload[x]=new Image();
		document.p7HAPMpreload[x].src=arguments[i];
	}
}
function P7_HAPMimovr(im){
	var m=false,r=im.rollover;
	if(im.mark){
		m=(r>1)?true:false;
	}
	else if(im.p7state=='open'){
		m=(r==1||r==3)?true:false;
	}
	else{
		m=true;
	}
	if(m){
		im.src=im.p7imgswap[1];
	}
}
function P7_HAPMimout(im){
	var r=im.rollover;
	if(im.mark){
		if(im.p7state=='open'){
			im.src=im.p7imgswap[2];
		}
		else{
			im.src=im.p7imgswap[3];
		}
	}
	else if(im.p7state=='open'){
		if(r==1||r==3){
			im.src=im.p7imgswap[2];
		}
	}
	else{
		im.src=im.p7imgswap[0];
	}
}
function P7_HAPMopenPanel(d,n){
	var x=n-1,tB=document.getElementById(d);
	if(tB&&tB.p7HAPMtrig){
		if(x>-1&&x<tB.p7HAPMtrig.length){
			P7_HAPMopen(tB.p7HAPMtrig[x]);
		}
	}
}
function P7_HAPMclick(a,dv){
	var wH,m=false;
	if(!a.hapmContent){
		wH=window.location.href;
		if(a.href!=wH&&a.href!=wH+'#'){
			if(a.href.toLowerCase().indexOf('javascript:')==-1){
				m=true;
				if(dv==1){
					document.location=a.href;
				}
				return m;
			}
		}
	}
	if(a.hapmState!='open'){
		P7_HAPMopen(a);
	}
	return m;
}
function P7_HAPMopen(a,au){
	var i,tB,vP,stp,dur,dy=20;
	if(a.hapmState=='open'){
		return;
	}
	tB=document.getElementById(a.hapmDiv);
	vP=document.getElementById(tB.id.replace('_','vp_'));
	if(tB.hapmAnimRunning){
		return;
	}
	if(!au && tB.hapmRotateRunning){
		clearInterval(tB.hapmRotate);
		tB.hapmRotateRunning=false;
	}
	op=tB.p7opt[2];
	if(!p7HAPMa){
		op=0;
	}
	for(i=0;i<tB.p7HAPMtrig.length;i++){
		if(a==tB.p7HAPMtrig[i]){
			P7_HAPMremClass(tB.p7HAPMtrig[i],'closed');
			P7_HAPMremClass(tB.p7HAPMtrig[i].parentNode,'closed');
			P7_HAPMsetClass(tB.p7HAPMtrig[i],'open');
			P7_HAPMsetClass(tB.p7HAPMtrig[i].parentNode,'open');
			tB.p7HAPMtrig[i].hapmState='open';
			tB.p7HAPMtrig[i].parentNode.hapmState='open';
			if(tB.p7HAPMtrig[i].hasImg){
				iM=tB.p7HAPMtrig[i].getElementsByTagName("IMG")[0];
				iM.p7state='open';
				iM.src=iM.p7imgswap[2];
			}
		}
		else{
			P7_HAPMremClass(tB.p7HAPMtrig[i],'open');
			P7_HAPMremClass(tB.p7HAPMtrig[i].parentNode,'open');
			P7_HAPMsetClass(tB.p7HAPMtrig[i],'closed');
			P7_HAPMsetClass(tB.p7HAPMtrig[i].parentNode,'closed');
			tB.p7HAPMtrig[i].hapmState='closed';
			tB.p7HAPMtrig[i].parentNode.hapmState='closed';
			if(tB.p7HAPMtrig[i].hasImg){
				iM=tB.p7HAPMtrig[i].getElementsByTagName("IMG")[0];
				iM.p7state='closed';
				if(iM.mark){
					iM.src=iM.p7imgswap[3];
				}
				else{
					iM.src=iM.p7imgswap[0];
				}
			}
		}
	}
	tB.hapmCurrentPanel=a.hapmPanelNum;
	if(!a.hapmContent){
		return;
	}
	P7_HAPMsetTargets(tB);
	tB.hapmDelay=dy;
	P7_HAPMsetCaption(tB,op);
	tB.hapmHtime=0;
	tB.hapmHduration=0;
	tB.hapmHbegin=vP.offsetHeight;
	if(tB.p7opt[14]===0){
		tB.hapmHfinish=vP.offsetHeight;
	}
	else if(tB.p7opt[14]==1){
		tB.hapmHfinish=tB.p7HAPMcontc[tB.hapmCurrentPanel-1].offsetHeight;
		dur=tB.p7opt[3];
		stp=dur/dy;
		tB.hapmHduration=parseInt(stp,10);
	}
	if(op>0){
		for(i=0;i<tB.p7HAPMsect.length;i++){
			if(!tB.hapmPanelSliderRunning || tB.p7HAPMsect[i].hapmFinish!=tB.p7HAPMsect[i].hapmTargetLeft){
				tB.p7HAPMsect[i].hapmTime=0;
				tB.p7HAPMsect[i].hapmDelay=dy;
				tB.p7HAPMsect[i].hapmFinish=tB.p7HAPMsect[i].hapmTargetLeft;
				tB.p7HAPMsect[i].hapmLbegin=parseInt(tB.p7HAPMsect[i].style.left,10);
				dur=tB.p7opt[3];
				stp=dur/dy;
				tB.p7HAPMsect[i].hapmDuration=parseInt(stp,10);
				if(tB.p7HAPMsect[i].hapmLbegin==tB.p7HAPMsect[i].hapmFinish){
					tB.p7HAPMsect[i].hapmDuration=0;
				}
			}
		}
		if(!tB.hapmPanelSliderRunning){
			tB.hapmPanelSliderRunning=true;
			tB.hapmPanelSlider=setInterval("P7_HAPMpanelSlider('"+tB.id+"',"+op+")",tB.hapmDelay);
		}
	}
	else{
		for(i=0;i<tB.p7HAPMsect.length;i++){
			tB.p7HAPMsect[i].style.left=tB.p7HAPMsect[i].hapmTargetLeft+'px';
		}
		P7_HAPMsetPanelHeights(tB,tB.hapmHfinish);
	}
}
function P7_HAPMsetCaption(el,op){
	var tC,dur,stp;
	tC=document.getElementById(el.p7HAPMtrig[el.hapmCurrentPanel-1].id.replace('a','ov'));
	if(tC){
		if(tC.hapmPanelFaderRunning){
			clearInterval(tC.hapmPanelFader);
			tC.hapmPanelFaderRunning=false;
		}
		if(op>0){
			tC.style.display='block';
			tC.hapmFOPbegin=1;
			tC.hapmFOPfinish=99;
			tC.hapmFOPtime=0;
			tC.hapmFOPdelay=20;
			dur=el.p7opt[6];
			stp=dur/tC.hapmFOPdelay;
			tC.hapmFOPduration=stp;
			if(tC.filters){
				tC.style.filter='alpha(opacity='+tC.hapmFOPbegin+')';
			}
			else{
				tC.style.opacity=tC.hapmFOPbegin/100;
			}
		}
		else{
			tC.style.display='block';
		}
	}
}
function P7_HAPMpanelSlider(d,op){
	var i,tB,nl,tC,m=true;
	tB=document.getElementById(d);
	for(i=0;i<tB.p7HAPMsect.length;i++){
		if(tB.p7HAPMsect[i].hapmTime!=tB.p7HAPMsect[i].hapmDuration){
			tB.p7HAPMsect[i].hapmTime++;
			if(op==1){
				nl=P7_HAPMlinear(tB.p7HAPMsect[i].hapmTime,tB.p7HAPMsect[i].hapmLbegin,tB.p7HAPMsect[i].hapmFinish-tB.p7HAPMsect[i].hapmLbegin,tB.p7HAPMsect[i].hapmDuration);
			}
			else if(op==3){
				nl=P7_HAPMeaseOutBounce(tB.p7HAPMsect[i].hapmTime,tB.p7HAPMsect[i].hapmLbegin,tB.p7HAPMsect[i].hapmFinish-tB.p7HAPMsect[i].hapmLbegin,tB.p7HAPMsect[i].hapmDuration);
			}
			else{
				nl=P7_HAPMInOutQuad(tB.p7HAPMsect[i].hapmTime,tB.p7HAPMsect[i].hapmLbegin,tB.p7HAPMsect[i].hapmFinish-tB.p7HAPMsect[i].hapmLbegin,tB.p7HAPMsect[i].hapmDuration);
			}
			tB.p7HAPMsect[i].style.left=nl+'px';
			m=false;
		}
	}
	if(tB.hapmHtime!=tB.hapmHduration){
		tB.hapmHtime++;
		nh=P7_HAPMInOutQuad(tB.hapmHtime,tB.hapmHbegin,tB.hapmHfinish-tB.hapmHbegin,tB.hapmHduration);
		P7_HAPMsetPanelHeights(tB,nh);
		m=false;
	}
	if(m){
		clearInterval(tB.hapmPanelSlider);
		tB.hapmPanelSliderRunning=false;
		tC=document.getElementById(tB.p7HAPMtrig[tB.hapmCurrentPanel-1].id.replace('a','ov'));
		if(tC){
			if(!tC.hapmPanelFaderRunning){
				tC.hapmPanelFaderRunning=true;
				tC.hapmPanelFader=setInterval("P7_HAPMfader('"+tC.id+"')",tC.hapmFOPdelay);
			}
		}
	}
}
function P7_HAPMfader(d){
	var tD,p;
	tD=document.getElementById(d);
	if(tD.hapmFOPtime<=tD.hapmFOPduration){
		tD.hapmFOPtime++;
		p=P7_HAPMInOutQuad(tD.hapmFOPtime,tD.hapmFOPbegin,tD.hapmFOPfinish-tD.hapmFOPbegin,tD.hapmFOPduration);
		if(tD.filters){
			tD.style.filter='alpha(opacity='+p+')';
		}
		else{
			tD.style.opacity=p/100;
		}
	}
	if(tD.hapmFOPtime>=tD.hapmFOPduration){
		clearInterval(tD.hapmPanelFader);
		tD.hapmPanelFaderRunning=false;
		if(tD.filters){
			tD.style.filter='';
		}
		else{
			tD.style.opacity=1;
		}
	}
}
function P7_HAPMInOutQuad(t,b,c,d){
	if((t/=d/2)<1){
		return c/2*t*t+b;
	}
	else{
		return -c/2*((--t)*(t-2)-1)+b;
	}
}
function P7_HAPMlinear(t,b,c,d){
	return (c*(t/d))+b;
}
function P7_HAPMeaseOutBounce(t,b,c,d){
	if((t/=d)<(1/2.75)){
		return c*(7.5625*t*t)+b;
	}
	else if(t<(2/2.75)){
		return c*(7.5625*(t-=(1.5/2.75))*t+0.75)+b;
	}
	else if (t<(2.5/2.75)){
		return c*(7.5625*(t-=(2.25/2.75))*t+0.9375)+b;
	}
	else{
		return c*(7.5625*(t-=(2.625/2.75))*t+0.984375)+b;
	}
}
function P7_HAPMsetClass(ob,cl){
	if(ob){
		var cc,nc,r=/\s+/g;
		cc=ob.className;
		nc=cl;
		if(cc&&cc.length>0){
			if(cc.indexOf(cl)==-1){
				nc=cc+' '+cl;
			}
			else{
				nc=cc;
			}
		}
		nc=nc.replace(r,' ');
		ob.className=nc;
	}
}
function P7_HAPMremClass(ob,cl){
	if(ob){
		var cc,nc,r=/\s+/g;
		cc=ob.className;
		if(cc&&cc.indexOf(cl>-1)){
			nc=cc.replace(cl,'');
			nc=nc.replace(r,' ');
			nc=nc.replace(/\s$/,'');
			ob.className=nc;
		}
	}
}
function P7_HAPMsetTriggerText(a){
	var i,tT,nt='',cn=0,cv=true;
	if(a.parentNode.className.indexOf('_img')==-1){
		tx=a.innerHTML;
		nt=tx.replace(/\s/g,'&nbsp;');
		if(typeof(opera)=='object'){
			nt='';
			for(i=0;i<tx.length;i++){
				if(tx.charAt(i)=='<'){
					cv=false;
					cn++;
					nt+=tx.charAt(i);
				}
				else if(tx.charAt(i)=='>'){
					cv=true;
					cn=0;
					nt+=tx.charAt(i);
				}
				else if(cv){
					if(tx.charAt(i)==' '){
						nt+=tx.charAt(i)+' &nbsp;';
					}
					nt+=tx.charAt(i)+' ';
				}
				else{
					nt+=tx.charAt(i);
				}
			}
		}
		if(nt.length&&nt.length>1){
			a.innerHTML=nt;
		}
	}
}
function P7_HAPMrsz(){
	var i,j,tB;
	for(i=0;i<p7HAPMctl.length;i++){
		tB=document.getElementById(p7HAPMctl[i][0]);
		if(tB&&tB.hapmInit&&!tB.hapmPanelSliderRunning){
			P7_HAPMresizer(tB);
			P7_HAPMsetTargets(tB);
			for(j=0;j<tB.p7HAPMsect.length;j++){
				tB.p7HAPMsect[j].style.left=tB.p7HAPMsect[j].hapmTargetLeft+'px';
			}
		}
	}
}
function P7_HAPMresizer(tB){
	var i,vp,vw,cw,tgw=0,oh,nh=0;
	vp=document.getElementById(tB.id.replace('_','vp_'));
	if(vp){
		vw=vp.offsetWidth;
		for(i=0;i<tB.p7HAPMtrigdv.length;i++){
			w=tB.p7HAPMtrigdv[i].offsetWidth;
			tgw+=w;
			if(tB.p7HAPMcont[i]){
				tB.p7HAPMcont[i].style.marginLeft=w+'px';
			}
		}
		cw=vw-tgw;
		cw=(cw<10)?10:cw;
		for(i=0;i<tB.p7HAPMcont.length;i++){
			if(tB.p7HAPMcont[i]){
				tB.p7HAPMcont[i].style.width=cw+'px';
				oh=tB.p7HAPMcontc[i].offsetHeight;
				nh=(oh>nh)?oh:nh;
			}
		}
		if(tB.p7opt[14]==1){
			nh=(tB.hapmCurrentPanel>-1&&tB.p7HAPMcontc[tB.hapmCurrentPanel-1])?tB.p7HAPMcontc[tB.hapmCurrentPanel-1].offsetHeight:nh;
		}
		else if(tB.p7opt[14]==2){
			nh=tB.p7opt[4];
		}
		tB.hapmHfinish=nh;
		P7_HAPMsetPanelHeights(tB,nh);
	}
}
function P7_HAPMsetPanelHeights(tB,h){
	var i,vP;
	vP=document.getElementById(tB.id.replace('_','vp_'));
	vP.style.height=h+'px';
	for(i=0;i<tB.p7HAPMtrig.length;i++){
		P7_HAPMsetHeight(tB.p7HAPMtrig[i].parentNode,h);
		if(tB.p7HAPMtrig[i].hapmContent){
			P7_HAPMsetHeight(tB.p7HAPMcontc[i].parentNode,h);
		}
	}
}
function P7_HAPMsetHeight(ob,h){
	var nh;
	if(!ob.hapmHeightAdjust){
		ob.style.height=h+'px';
		nh=h-(ob.offsetHeight-h);
		ob.hapmHeightAdjust=ob.offsetHeight-h;
	}
	else{
		nh=h-ob.hapmHeightAdjust;
	}
	if(nh!==0){
		ob.style.height=nh+'px';
	}
}
function P7_HAPMcheckHeights(){
	var i,j,tB,vp,vh,oh,lh=0;
	for(i=0;i<p7HAPMctl.length;i++){
		lh=0;
		tB=document.getElementById(p7HAPMctl[i][0]);
		if(tB&&tB.hapmInit&&!tB.hapmPanelSliderRunning&&tB.p7opt[14]!=2){
			vp=document.getElementById(tB.id.replace('_','vp_'));
			vh=vp.offsetHeight;
			for(j=0;j<tB.p7HAPMcontc.length;j++){
				if(tB.p7HAPMcontc[j]){
					oh=tB.p7HAPMcontc[j].offsetHeight;
					lh=(oh>lh)?oh:lh;
				}
			}
			if(tB.p7opt[14]==1){
				lh=(tB.hapmCurrentPanel>-1&&tB.p7HAPMcontc[tB.hapmCurrentPanel-1])?tB.p7HAPMcontc[tB.hapmCurrentPanel-1].offsetHeight:lh;
			}
			if(lh!=vh){
				for(j=0;j<tB.p7HAPMtrig.length;j++){
					P7_HAPMsetHeight(tB.p7HAPMtrig[j].parentNode,lh);
					if(tB.p7HAPMcontc[j]){
						P7_HAPMsetHeight(tB.p7HAPMcontc[j].parentNode,lh);
					}
				}
				vp.style.height=lh+'px';
			}
		}
	}
}
function P7_HAPMsetTargets(tB){
	var i,c=0;
	for(i=0;i<tB.p7HAPMtrigdv.length;i++){
		tB.p7HAPMsect[i].hapmTargetLeft=c;
		if(tB.p7HAPMtrig[i].hapmState=='open'){
			c+=tB.p7HAPMsect[i].offsetWidth;
		}
		else{
			c+=tB.p7HAPMtrigdv[i].offsetWidth;
		}
	}
}
function P7_HAPMmark(){
	p7HAPMadv[p7HAPMadv.length]=arguments;
}
function P7_HAPMcurrentMark(el){
	var j,i,x,wH,cm=false,mt=['',1,'',''],op,r1,k,kk,tA,aU,pp,tr,aT,aP,d,pn,im;
	wH=window.location.href;
	if(el.p7opt[10]!=1){
		wH=wH.replace(window.location.search,'');
	}
	if(wH.charAt(wH.length-1)=='#'){
		wH=wH.substring(0,wH.length-1);
	}
	for(k=0;k<p7HAPMadv.length;k++){
		if(p7HAPMadv[k][0]&&p7HAPMadv[k][0]==el.id){
			mt=p7HAPMadv[k];
			cm=true;
			break;
		}
	}
	op=mt[1];
	if(op<1){
		return;
	}
	r1=/index\.[\S]*/i;
	k=-1;
	kk=-1;
	tA=el.getElementsByTagName('A');
	for(j=0;j<tA.length;j++){
		aU=tA[j].href.replace(r1,'');
		if(op>0){
			if(tA[j].href==wH || aU==wH){
				k=j;
				kk=-1;
			}
		}
		if(op==2){
			if(tA[j].firstChild){
				if(tA[j].firstChild.nodeValue.replace(/\s/g,'')==mt[2].replace(/\s/g,'')){
					kk=j;
				}
			}
		}
		if(op==3&&tA[j].href.indexOf(mt[2])>-1){
			kk=j;
		}
		if(op==4){
			for(x=2;x<mt.length;x+=2){
				if(wH.indexOf(mt[x])>-1){
					if(tA[j].firstChild&&tA[j].firstChild.nodeValue){
						if(tA[j].firstChild.nodeValue.replace(/\s/g,'')==mt[x+1].replace(/\s/g,'')){
							kk=j;
						}
					}
				}
			}
		}
	}
	k=(kk>k)?kk:k;
	if(k>-1){
		if(tA[k].hapmPanelNum){
			tr=tA[k];
		}
		else{
			P7_HAPMsetClass(tA[k],'current_mark');
			pp=tA[k].parentNode;
			while (pp){
				if(pp.hapmDiv && pp.hapmDiv==el.id){
					tr=el.p7HAPMtrig[pp.hapmPanelNum-1];
					break;
				}
				pp=pp.parentNode;
			}
		}
		if(tr){
			P7_HAPMsetClass(tr,'current_mark');
			P7_HAPMsetClass(tr.parentNode,'current_mark');
			P7_HAPMopen(tr);
		}
	}
}
function P7_HAPMurl(dv){
	var i,h,s,x,d='hapm',pn,n=dv.replace("p7HAPM_",""),tr;
	if(document.getElementById){
		h=document.location.search;
		if(h){
			h=h.replace('?','');
			s=h.split(/[=&]/g);
			if(s&&s.length){
				for(i=0;i<s.length;i+=2){
					if(s[i]==d){
						x=s[i+1];
						if(n!=x.charAt(0)){
							x=false;
						}
						if(x){
							pn='p7HAPMa'+x;
							tr=document.getElementById(pn);
							if(tr){
								P7_HAPMopen(tr);
							}
						}
					}
				}
			}
		}
		h=document.location.hash;
		if(h){
			x=h.substring(1,h.length);
			if(n!=x.charAt(4)){
				x=false;
			}
			if(x&&x.indexOf(d)===0){
				pn='p7HAPMa'+x.substring(4);
				tr=document.getElementById(pn);
				if(tr){
					P7_HAPMopen(tr);
				}
			}
		}
	}
}
function P7_HAPMrotate(d){
	var tB,c,n,m=true;
	tB=document.getElementById(d);
	n=tB.hapmCurrentPanel-1;
	while(m){
		n++;
		tB.hapmRotateCounter++;
		if(tB.hapmRotateCounter>tB.hapmRotatePanelNums){
			tB.hapmRotateCyclesCounter++;
			tB.hapmRotateCounter=1;
		}
		if(n>tB.p7HAPMtrig.length-1){
			n=0;
		}
		if(tB.p7HAPMcontc[n]){
			m=false;
			break;
		}
	}
	if(tB.hapmRotateCyclesCounter>tB.hapmRotateCycles){
		clearInterval(tB.hapmRotate);
		tB.hapmRotateRunning=false;
		tB.hapmRotateCyclesCounter=1;
		tB.hapmRotateCounter=1;
	}
	if(n>-1&&n<tB.p7HAPMtrig.length){
		P7_HAPMopen(tB.p7HAPMtrig[n],1);
	}
}
function P7_HAPMrotator(d,ac){
	P7_HAPMrotr(d,ac);
}
function P7_HAPMrotr(d,ac){
	var tB=document.getElementById(d);
	if(tB){
		if(ac=='Start'||ac=='Resume'){
			if(!tB.hapmRotateRunning){
				tB.hapmRotateRunning=true;
				if(ac=='Start'){
					tB.hapmRotateCyclesCounter=1;
					tB.hapmRotateCounter=1;
				}
				else{
					P7_HAPMrotate(tB.id);
				}
				tB.hapmRotate=setInterval("P7_HAPMrotate('"+tB.id+"')",tB.p7opt[13]);
			}
		}
		else if(ac=='Stop'||ac=='Pause'){
			tB.hapmRotateRunning=false;
			if(tB.hapmRotate){
				clearInterval(tB.hapmRotate);
			}
		}
	}
}
function P7_HAPMisMobile(){
	var i,m=false,ua=navigator.userAgent.toLowerCase();
	var dv=['iphone','ipad','ipod','android','windows ce','iemobile','windowsce','blackberry','palm','symbian','series60',
	'armv','arm7tdmi','opera mobi','opera mini','polaris','kindle','midp','mmp/','portalmmm','smm-mms','sonyericsson'];
	for(i=0;i<dv.length;i++){
		if(ua.search(dv[i])>-1){
			m=dv[i];
			break;
		}
	}
	return m;
}
function P7_HAPMgetIEver(){
	var j,v=-1,nv,m=false;
	nv=navigator.userAgent.toLowerCase();
	j=nv.indexOf("msie");
	if(j>-1){
		v=parseInt(nv.substring(j+4,j+6),10);
		if(document.documentMode){
			v=document.documentMode;
		}
	}
	return v;
}

