function init() {
	//P7_Uberlink('p7uberlink','right');
}

function P7_Uberlink(cl,d){
	var i,ob,tA,h=document.location.href;
	if(document.getElementById){
	ob=(d)?document.getElementById(d):document;
	if(ob){
	tA=ob.getElementsByTagName('A');
	for(i=0;i<tA.length;i++){
	if(tA[i].href==h){
	tA[i].className=cl;
}}}}}

// rollover image for any image in the normal state
var p7PMMover='_over';
// image for any trigger that has an open sub menu -no rollover
var p7PMMopen='_overdown';
// image to be used for current marker -no roll over
var p7PMMmark='_down';

var p7PMMi=false,p7PMMa=false,p7PMMctl=[],p7PMMadv=[];
function P7_PMMset(){
	var i,h,sh,hd,x,v;
	if(!document.getElementById){
		return;
	}
	sh='.p7PMM div {position:absolute;display:none}\n';
	if(document.styleSheets){
		h='\n<st' + 'yle type="text/css">\n'+sh+'\n</s' + 'tyle>';
		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_PMMset();
function P7_PMMaddLoad(){
	if(window.addEventListener){
		window.addEventListener("load",P7_PMMinit,false);
		window.addEventListener("unload",P7_PMMbb,false);
	}
	else if(window.attachEvent){
		window.attachEvent("onload",P7_PMMinit);
	}
	else{
		window.onload=P7_PMMinit;
	}
}
P7_PMMaddLoad();
function P7_PMMbb(){
	return;
}
function P7_PMMop(){
	if(!document.getElementById){
		return;
	}
	p7PMMctl[p7PMMctl.length]=arguments;
}
function P7_PMMinit(){
	var i,j,jj,k,tM,tA,tU,lv,pp,clv,fs,tS,d=1,cl,tp,uh=0,cN,tw,ow,oh;
	if(p7PMMi){
		return;
	}
	p7PMMi=true;
	document.p7PMMpreload=[];
	for(k=0;k<p7PMMctl.length;k++){
		tM=document.getElementById(p7PMMctl[k][0]);
		if(tM){
			tM.p7opt=p7PMMctl[k];
			if(navigator.appVersion.indexOf("MSIE 5")>-1){
				tM.p7opt[2]=0;
			}
			tM.p7PMMtmr=null;
			tD=tM.getElementsByTagName("DIV");
			for(i=0;i<tD.length;i++){
				tD[i].setAttribute("id",tM.id+'d'+(i+2));
				tD[i].p7state='closed';
				tD[i].pmmmenu=tM.id;
			}
			tU=tM.getElementsByTagName("UL");
			for(i=0;i<tU.length;i++){
				tU[i].setAttribute("id",tM.id+'u'+(i+1));
				lv=1;
				pp=tU[i].parentNode;
				while(pp){
					if(pp.id&&pp.id==tM.id){
						break;
					}
					if(pp.tagName&&pp.tagName=="UL"){
						lv++;
					}
					pp=pp.parentNode;
				}
				tU[i].pmmlevel=lv;
				clv='level_'+lv;
				P7_PMMsetClass(tU[i],clv);
				tN=tU[i].childNodes;
				if(tN){
					fs=-1;
					jj=0;
					for(j=0;j<tN.length;j++){
						if(tN[j].tagName&&tN[j].tagName=="LI"){
							jj++;
							tA=tN[j].getElementsByTagName("A")[0];
							if(fs<0){
								P7_PMMsetClass(tA,'pmmfirst');
								P7_PMMsetClass(tN[j],'pmmfirst');
							}
							fs=j;
							tA.setAttribute("id",tM.id+'a'+(d));
							d++;
							tA.pmmlevel=lv;
							tA.pmmdiv=tU[i].parentNode.id;
							tA.pmmmenu=tM.id;
							if(i==0){
								P7_PMMsetClass(tN[j],('root_'+jj));
							}
							tS=tN[j].getElementsByTagName("UL");
							if(tS&&tS.length>0){
								tA.pmmsub=tS[0].parentNode.id;
								tA.onmousedown=function(){
									P7_PMMtrigclick(this);
								};
								if(tM.p7opt[13]==1&&lv==1){
									P7_PMMsetClass(tA,'trig_closed_up');
									P7_PMMsetClass(tA.parentNode,'trig_closed_up');
								}
								else if(tM.p7opt[5]==1){
									P7_PMMsetClass(tA,'trig_closed_left');
									P7_PMMsetClass(tA.parentNode,'trig_closed_left');
								}
								else{
									P7_PMMsetClass(tA,'trig_closed');
									P7_PMMsetClass(tA.parentNode,'trig_closed');
								}
							}
							else{
								tA.pmmsub=false;
							}
							tA.onmouseover=function(){
								P7_PMMtrig(this);
							};
							tA.hasImg=false;
							var sr,x,fnA,fnB,swp,s1,s2,s3;
							iM=tA.getElementsByTagName("IMG");
							if(iM&&iM[0]){
								sr=iM[0].getAttribute("src");
								swp=tM.p7opt[9];
								iM[0].pmmswap=swp;
								x=sr.lastIndexOf(".");
								fnA=sr.substring(0,x);
								fnB='.'+sr.substring(x+1);
								s1=fnA+p7PMMover+fnB;
								s2=fnA+p7PMMopen+fnB;
								s3=fnA+p7PMMmark+fnB;
								if(swp==1){
									iM[0].p7imgswap=[sr,s1,s1,s1];
									P7_PMMpreloader(s1);
								}
								else if(swp==2){
									iM[0].p7imgswap=[sr,s1,s2,s2];
									P7_PMMpreloader(s1,s2);
								}
								else if(swp==3){
									iM[0].p7imgswap=[sr,s1,s2,s3];
									P7_PMMpreloader(s1,s2,s3);
								}
								else{
									iM[0].p7imgswap=[sr,sr,sr,sr];
								}
								iM[0].p7state='closed';
								iM[0].mark=false;
								iM[0].rollover=tM.p7opt[10];
								if(swp>0){
									tA.hasImg=true;
									iM[0].onmouseover=function(){
										P7_PMMimovr(this);
									};
									iM[0].onmouseout=function(){
										P7_PMMimout(this);
									};
								}
							}
						}
					}
					if(fs>0){
						P7_PMMsetClass(tA,'pmmlast');
						P7_PMMsetClass(tN[fs],'pmmlast');
					}
				}
			}
			if(tM.p7opt[6]==1){
				tw=tM.offsetWidth;
				oh=tM.offsetHeight;
				ow=P7_PMMgetPropValue(tU[0],'position','position');
				tM.style.height=oh+'px';
				tU[0].style.position="absolute";
				uh=tU[0].offsetWidth;
				tU[0].style.position=ow;
				tM.style.height='auto';
				uh=(uh>=tw)?tw:uh;
				tU[0].style.marginLeft=((tw-uh)/2)+'px';
			}
			tM.onmouseout=function(evt){
				var k,rt,pp,tD,m=true;
				evt=(evt)?evt:((event)?event:null);
				if(evt){
					rt=(evt.relatedTarget)?evt.relatedTarget:evt.toElement;
					if(rt){
						pp=rt.parentNode;
						while(pp){
							if(pp&&pp.id&&pp.id.indexOf(this.id)==0){
								m=false;
								break;
							}
							pp=pp.parentNode;
						}
					}
					if(m){
						if(this.p7PMMtmr){
							clearTimeout(this.p7PMMtmr);
						}
						if(this.p7opt[8]==1){
							this.p7PMMtmr=setTimeout("P7_PMMshut('"+this.id+"')",360);
						}
						else{
							P7_PMMshut(this.id);
						}
					}
				}
			}
			if(tM.p7opt[11]==1){
				P7_PMMcurrentMark(tM);
			}
		}
	}
	p7PMMa=true;
}
function P7_PMMshut(d){
	var k,tM,tD;
	tM=document.getElementById(d);
	tD=tM.getElementsByTagName("DIV");
	for(k=tD.length-1;k>-1;k--){
		if(tD[k].p7state&&tD[k].p7state=='open'){
			P7_PMMclose(tD[k]);
		}
	}
}
function P7_PMMpreloader(){
	var i,x;
	for(i=0;i<arguments.length;i++){
		x=document.p7PMMpreload.length;
		document.p7PMMpreload[x]=new Image();
		document.p7PMMpreload[x].src=arguments[i];
	}
}
function P7_PMMimovr(im){
	var m=false,a=im.parentNode,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_PMMimout(im){
	var a=im.parentNode,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_PMMtrig(a){
	var dV;
	dV=document.getElementById(a.pmmmenu);
	if(dV.p7PMMtmr){
		clearTimeout(dV.p7PMMtmr);
	}
	if(a.pmmsub){
		if(dV.p7opt[8]==1){
			dV.p7PMMtmr=setTimeout("P7_PMMopen('"+a.id+"')",160);
		}
		else{
			P7_PMMopen(a.id);
		}
	}
	else{
		if(dV.p7opt[8]==1){
			dV.p7PMMtmr=setTimeout("P7_PMMtoggle('"+a.id+"')",160);
		}
		else{
			P7_PMMtoggle(a.id);
		}
	}
}
function P7_PMMopen(d,bp){
	var i,tA,tM,tD,w,h,mT,mL,pp,xx=0,yy=0,wd,pb,pr,sct,aw,sc,pt,pl,iM;
	tA=document.getElementById(d);
	if(!bp){
		P7_PMMtoggle(d);
	}
	if(tA.p7state=='open'){
		return;
	}
	tA.p7state='open';
	if(tA.hasImg){
		iM=tA.getElementsByTagName("IMG")[0];
		iM.p7state='open';
		iM.src=iM.p7imgswap[2];
	}
	tA.className=tA.className.replace('trig_closed','trig_open');
	tA.parentNode.className=tA.parentNode.className.replace('trig_closed','trig_open');
	tM=document.getElementById(tA.pmmmenu);
	tD=document.getElementById(tA.pmmsub);
	tD.p7trigger=tA.id;
	tD.p7state='open';
	tD.style.visibility="hidden";
	tD.style.display="block";
	tD.style.height='auto';
	tD.style.width='auto';
	w=tD.offsetWidth;
	h=tD.offsetHeight;
	aw=tA.parentNode.offsetWidth;
	mT=(tA.parentNode.offsetHeight*-1)+tM.p7opt[3];
	if(tM.p7opt[5]==1){
		mL=(w*-1)-tM.p7opt[4];
	}
	else{
		mL=tA.offsetWidth+tM.p7opt[4];
	}
	if(tM.p7opt[1]==1&&tA.pmmlevel==1){
		mT=0;
		mL=0;
		if(tM.p7opt[7]==1){
			mL=((w-aw)/2)*-1;
		}
		else if(tM.p7opt[7]==2){
			if(tA.className.indexOf('pmmlast')>-1){
				mL=(w-aw)*-1;
			}
			else if(tA.className.indexOf('pmmfirst')==-1){
				mL=((w-aw)/2)*-1;
			}
			else{
				mL=0;
			}
		}
	}
	if(tM.p7opt[13]==1){
		mT-=h;
		if(tM.p7opt[1]==1&&tA.pmmlevel==1){
			mT-=tA.offsetHeight;
		}
	}
	wd=P7_PMMwin();
	pp=tA;
	while(pp){
		xx+=(pp.offsetLeft)?pp.offsetLeft:0;
		yy+=(pp.offsetTop)?pp.offsetTop:0;
		if(window.opera){
			if(pp.nodeName=="BODY"){
				yy-=(pp.offsetTop)?pp.offsetTop:0;
			}
		}
		pp=pp.offsetParent;
	}
	sc=document.body.parentNode.scrollTop;
	if(!sc){
		sc=document.body.scrollTop;
		if(!sc){
			sc=window.scrollY?window.scrollY:0;
		}
	}
	yy-=sc;
	sc=document.body.parentNode.scrollLeft;
	if(!sc){
		sc=document.body.scrollLeft;
		if(sc){
			sc=window.scrollX?window.scrollX:0;
		}
	}
	xx-=sc;
	pr=xx+mL+w;
	pb=yy+mT+h+tA.offsetHeight;
	if(pr>wd[1]){
		if(tM.p7opt[1]==1&&tA.pmmlevel==1){
			mL=mL-(pr-wd[1]+2);
		}
		else{
			mL=w*-1;
		}
	}
	if(pb>wd[0]){
		mT=mT-(pb-wd[0]+2);
	}
	pt=yy+mT+tA.offsetHeight;
	if(pt<0){
		mT=mT-pt+2;
	}
	pl=xx+mL;
	if(pl<0){
		mL=mL-pl+2;
	}
	tD.style.marginTop=mT+'px';
	tD.style.marginLeft=mL+'px';
	if(p7PMMa&&tM.p7opt[2]>0){
		var dfs,fsA,tU=tD.getElementsByTagName('UL')[0];
		fsA=tU.getElementsByTagName("A")[0];
		if(tM.p7opt[2]==1){
			P7_PMManimA(tU.id,5);
		}
		else if(tM.p7opt[2]==2){
			dfs=P7_PMMgetPropValue(fsA,'lineHeight','line-height');
			dfs=(dfs)?dfs:'normal';
			P7_PMManimB(tU.id,5,dfs);
		}
		else if(tM.p7opt[2]==3){
			if(tM.p7opt[1]==1&&tU.pmmlevel==2){
				dfs=P7_PMMgetPropValue(fsA,'lineHeight','line-height');
				dfs=(dfs)?dfs:'normal';
				P7_PMManimB(tU.id,5,dfs);
			}
			else{
				P7_PMManimA(tU.id,5);
			}
		}
		else if(tM.p7opt[2]==4){
			P7_PMManimC(tU.id,-100);
		}
	}
	else{
		tD.style.visibility="visible";
	}
}
function P7_PMMtoggle(d,bp){
	var i,a,tA,tD,pp;
	a=document.getElementById(d);
	pp=a.parentNode;
	while(pp){
		if(pp.tagName&&pp.tagName=="UL"){
			break;
		}
		pp=pp.parentNode;
	}
	tD=pp.getElementsByTagName("DIV");
	if(tD&&tD.length>0){
		for(i=tD.length-1;i>-1;i--){
			if(tD[i].p7state&&tD[i].p7state=='open'){
				if(!bp&&tD[i].p7trigger!=a.id){
					P7_PMMclose(tD[i]);
				}
			}
		}
	}
}
function P7_PMMclose(d,bp){
	var a,h,w,tM;
	a=document.getElementById(d.p7trigger);
	a.p7state='closed';
	d.p7state='closed';
	a.className=a.className.replace('trig_open','trig_closed');
	a.parentNode.className=a.parentNode.className.replace('trig_open','trig_closed');
	if(a.hasImg){
		iM=a.getElementsByTagName("IMG")[0];
		iM.p7state='closed';
		if(iM.mark){
			iM.src=iM.p7imgswap[3];
		}
		else{
			iM.src=iM.p7imgswap[0];
		}
	}
	d.style.display='none';
}
function P7_PMMtrigclick(a){
	var i,h,sB,tA,sh;
	h=a.getAttribute("href");
	if(h.charAt(h.length-1)=='#'||h.search(/javas/i)==0){
		sB=document.getElementById(a.pmmsub);
		tA=sB.getElementsByTagName('A');
		for(i=0;i<tA.length;i++){
			sh=tA[i].getAttribute('href');
			if(sh.charAt(sh.length-1)!='#'&&sh.search(/javas/i)!=0){
				a.setAttribute('href',sh);
				break;
			}
		}
	}
}
function P7_PMMmark(){
	p7PMMadv[p7PMMadv.length]=arguments;
}
function P7_PMMcurrentMark(el){
	var j,i,k,wH,cm=false,mt=['',1,'',''],op,r1,k,kk,tA,aU,pp,a,im;;
	wH=window.location.href;
	if(el.p7opt[12!=1]){
		wH=wH.replace(window.location.search,'');
	}
	if(wH.charAt(wH.length-1)=='#'){
		wH=wH.substring(0,wH.length-1);
	}
	for(k=0;k<p7PMMadv.length;k++){
		if(p7PMMadv[k][0]&&p7PMMadv[k][0]==el.id){
			mt=p7PMMadv[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==mt[2]){
					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==mt[x+1]){
							kk=j;
						}
					}
				}
			}
		}
	}
	k=(kk>k)?kk:k;
	if(k>-1){
		pp=tA[k].parentNode;
		while(pp){
			if(pp.tagName&&pp.tagName=='LI'){
				P7_PMMsetClass(pp,'li_current_mark');
				a=pp.getElementsByTagName('A');
				if(a&&a[0]){
					P7_PMMsetClass(a[0],'current_mark');
					if(a[0].hasImg){
						im=a[0].getElementsByTagName('IMG')[0];
						im.mark=true;
						im.src=im.p7imgswap[3];
					}
				}
			}
			else{
				if(pp==el){
					break;
				}
			}
			pp=pp.parentNode;
		}
	}
}
function P7_PMManimA(id,v,ft){
	var el,tg=100,fr=10,dy=10;
	el=document.getElementById(id);
	el.style.fontSize=v+'%';
	if(!ft){
		el.style.visibility="visible";
		el.parentNode.style.visibility="visible";
	}
	if(v!=tg){
		v+=fr;
		v=(v>=tg)?tg:v;
		setTimeout("P7_PMManimA('"+id+"',"+v+",1)",dy);
	}
}
function P7_PMManimB(id,v,ln,ft){
	var el,tg=120,fr=10,dy=10;
	el=document.getElementById(id);
	el.style.lineHeight=v+'%';
	if(!ft){
		el.style.visibility="visible";
		el.parentNode.style.visibility="visible";
	}
	if(v!=tg){
		v+=fr;
		v=(v>=tg)?tg:v;
		setTimeout("P7_PMManimB('"+id+"',"+v+",'"+ln+"',1)",dy);
	}
	else{
		el.style.lineHeight=ln;
	}
}
function P7_PMManimC(id,v,ft){
	var el,tg=0,fr=8,dy=10;
	el=document.getElementById(id);
	el.style.textIndent=v+'px';
	if(!ft){
		el.style.visibility="visible";
		el.parentNode.style.visibility="visible";
	}
	if(v!=tg){
		v+=fr;
		v=(v>=tg)?tg:v;
		setTimeout("P7_PMManimC('"+id+"',"+v+",1)",dy);
	}
}
function P7_PMMsetClass(ob,cl){
	var cc,nc,r=/\s+/g;
	cc=ob.className;
	nc=cl;
	if(cc&&cc.length>0){
		nc=cc+' '+cl;
	}
	nc=nc.replace(r,' ');
	ob.className=nc;
}
function P7_PMMremClass(ob,cl){
	var cc,nc,r=/\s+/g;;
	cc=ob.className;
	if(cc&&cc.indexOf(cl>-1)){
		nc=cc.replace(cl,'');
		nc=nc.replace(r,' ');
		ob.className=nc;
	}
}
function P7_PMMwin(){
	var h,w;
	if(document.documentElement&&document.documentElement.clientHeight){
		w=document.documentElement.clientWidth;
		h=document.documentElement.clientHeight;
	}
	else if(window.innerHeight){
		if(document.documentElement.clientWidth){
			w=document.documentElement.clientWidth;
		}
		else{
			w=window.innerWidth;
		}
		h=window.innerHeight;
	}
	else if(document.body){
		w=document.body.clientWidth;
		h=document.body.clientHeight;
	}
	return [h,w];
}
function P7_PMMgetPropValue(ob,prop,prop2){
	var h,v=null;
	if(ob){
		if(ob.currentStyle){
			v=eval('ob.currentStyle.'+prop);
		}
		else if(document.defaultView.getComputedStyle(ob,"")){
			v=document.defaultView.getComputedStyle(ob,"").getPropertyValue(prop2);
		}
		else{
			v=eval("ob.style."+prop);
		}
	}
	return v;
}


jQuery(function(){
   jQuery("div.svw").prepend("<img src='svwloader.gif' class='ldrgif' alt='loading...'/ >"); 
});
var j = 0;
var quantofamo = 0;
jQuery.fn.slideView = function(settings) {
	  settings = jQuery.extend({
     easeFunc: "easeInOutExpo",
     easeTime: 750,
     toolTip: false
  }, settings);
	return this.each(function(){
		var container = jQuery(this);
		container.find("img.ldrgif").remove(); // removes the preloader gif
		container.removeClass("svw").addClass("stripViewer");		
		var pictWidth = container.find("img").width();
		var pictHeight = container.find("img").height();
		var pictEls = container.find("li").size();
		var stripViewerWidth = pictWidth*pictEls;
		container.find("ul").css("width" , stripViewerWidth); //assegnamo la larghezza alla lista UL	
		container.css("width" , pictWidth);
		container.css("height" , pictHeight);
		container.each(function(i) {
			jQuery(this).after("<div class='stripTransmitter' id='stripTransmitter" + (j) + "'><ul><\/ul><\/div>");
			jQuery(this).find("li").each(function(n) {
						jQuery("div#stripTransmitter" + j + " ul").append("<li><a title='" + jQuery(this).find("img").attr("alt") + "' href='#'>"+(n+1)+"<\/a><\/li>");												
				});
			jQuery("div#stripTransmitter" + j + " a").each(function(z) {
				jQuery(this).bind("click", function(){

				jQuery(this).addClass("current").parent().parent().find("a").not(jQuery(this)).removeClass("current"); // wow!
				var cnt = -(pictWidth*z);
				container.find("ul").animate({ left: cnt}, settings.easeTime, settings.easeFunc);
				return false;
				   });
				});
			
			
				// next image via image click	14/01/2009
				jQuery("div#stripTransmitter" + j + " a").parent().parent().parent().prev().find("img").each(function(z) {
				jQuery(this).bind("click", function(){
					var ui 	= 	jQuery(this).parent().parent().parent().next().find("a");
					if(z+1 < pictEls){
						ui.eq(z+1).trigger("click");
					}
					else ui.eq(0).trigger("click");
				   });
				});
				
				
			jQuery("div#stripTransmitter" + j).css("width" , pictWidth);
			jQuery("div#stripTransmitter" + j + " a:first").addClass("current");
			if(settings.toolTip){
			container.next(".stripTransmitter ul").find("a").Tooltip({
				track: true,
				delay: 0,
				showURL: false,
				showBody: false
				});
			}
			});
		j++;
  });	
};

/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
 *
 * Uses the built in easing capabilities added In jQuery 1.1
 * to offer multiple easing options
 *
 * TERMS OF USE - jQuery Easing
 * 
 * Open source under the BSD License. 
 * 
 * Copyright © 2008 George McGinley Smith
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
*/

// t: current time, b: begInnIng value, c: change In value, d: duration
jQuery.easing['jswing'] = jQuery.easing['swing'];

jQuery.extend( jQuery.easing,
{
	def: 'easeOutQuad',
	swing: function (x, t, b, c, d) {
		//alert(jQuery.easing.default);
		return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
	},
	easeInQuad: function (x, t, b, c, d) {
		return c*(t/=d)*t + b;
	},
	easeOutQuad: function (x, t, b, c, d) {
		return -c *(t/=d)*(t-2) + b;
	},
	easeInOutQuad: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t + b;
		return -c/2 * ((--t)*(t-2) - 1) + b;
	},
	easeInCubic: function (x, t, b, c, d) {
		return c*(t/=d)*t*t + b;
	},
	easeOutCubic: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t + 1) + b;
	},
	easeInOutCubic: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t + b;
		return c/2*((t-=2)*t*t + 2) + b;
	},
	easeInQuart: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t + b;
	},
	easeOutQuart: function (x, t, b, c, d) {
		return -c * ((t=t/d-1)*t*t*t - 1) + b;
	},
	easeInOutQuart: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
		return -c/2 * ((t-=2)*t*t*t - 2) + b;
	},
	easeInQuint: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t*t + b;
	},
	easeOutQuint: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t*t*t + 1) + b;
	},
	easeInOutQuint: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
		return c/2*((t-=2)*t*t*t*t + 2) + b;
	},
	easeInSine: function (x, t, b, c, d) {
		return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
	},
	easeOutSine: function (x, t, b, c, d) {
		return c * Math.sin(t/d * (Math.PI/2)) + b;
	},
	easeInOutSine: function (x, t, b, c, d) {
		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
	},
	easeInExpo: function (x, t, b, c, d) {
		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
	},
	easeOutExpo: function (x, t, b, c, d) {
		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
	},
	easeInOutExpo: function (x, t, b, c, d) {
		if (t==0) return b;
		if (t==d) return b+c;
		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
	},
	easeInCirc: function (x, t, b, c, d) {
		return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
	},
	easeOutCirc: function (x, t, b, c, d) {
		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
	},
	easeInOutCirc: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
		return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
	},
	easeInElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
	},
	easeOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
	},
	easeInOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
	},
	easeInBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*(t/=d)*t*((s+1)*t - s) + b;
	},
	easeOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
	},
	easeInOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158; 
		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
	},
	easeInBounce: function (x, t, b, c, d) {
		return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
	},
	easeOutBounce: function (x, 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 + .75) + b;
		} else if (t < (2.5/2.75)) {
			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
		} else {
			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
		}
	},
	easeInOutBounce: function (x, t, b, c, d) {
		if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
		return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
	}
});

/*
 *
 * TERMS OF USE - EASING EQUATIONS
 * 
 * Open source under the BSD License. 
 * 
 * Copyright © 2001 Robert Penner
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
 */
 
 /*
 * jQuery Easing Compatibility v1 - http://gsgd.co.uk/sandbox/jquery.easing.php
 *
 * Adds compatibility for applications that use the pre 1.2 easing names
 *
 * Copyright (c) 2007 George Smith
 * Licensed under the MIT License:
 *   http://www.opensource.org/licenses/mit-license.php
 */

jQuery.extend( jQuery.easing,
{
	easeIn: function (x, t, b, c, d) {
		return jQuery.easing.easeInQuad(x, t, b, c, d);
	},
	easeOut: function (x, t, b, c, d) {
		return jQuery.easing.easeOutQuad(x, t, b, c, d);
	},
	easeInOut: function (x, t, b, c, d) {
		return jQuery.easing.easeInOutQuad(x, t, b, c, d);
	},
	expoin: function(x, t, b, c, d) {
		return jQuery.easing.easeInExpo(x, t, b, c, d);
	},
	expoout: function(x, t, b, c, d) {
		return jQuery.easing.easeOutExpo(x, t, b, c, d);
	},
	expoinout: function(x, t, b, c, d) {
		return jQuery.easing.easeInOutExpo(x, t, b, c, d);
	},
	bouncein: function(x, t, b, c, d) {
		return jQuery.easing.easeInBounce(x, t, b, c, d);
	},
	bounceout: function(x, t, b, c, d) {
		return jQuery.easing.easeOutBounce(x, t, b, c, d);
	},
	bounceinout: function(x, t, b, c, d) {
		return jQuery.easing.easeInOutBounce(x, t, b, c, d);
	},
	elasin: function(x, t, b, c, d) {
		return jQuery.easing.easeInElastic(x, t, b, c, d);
	},
	elasout: function(x, t, b, c, d) {
		return jQuery.easing.easeOutElastic(x, t, b, c, d);
	},
	elasinout: function(x, t, b, c, d) {
		return jQuery.easing.easeInOutElastic(x, t, b, c, d);
	},
	backin: function(x, t, b, c, d) {
		return jQuery.easing.easeInBack(x, t, b, c, d);
	},
	backout: function(x, t, b, c, d) {
		return jQuery.easing.easeOutBack(x, t, b, c, d);
	},
	backinout: function(x, t, b, c, d) {
		return jQuery.easing.easeInOutBack(x, t, b, c, d);
	}
});
