function emptyShell(variableName){
this.variableName=variableName;
this.variable=this;
this.enable=function(){ for(var e=0;e<this.enable.arguments.length;e++){ if(typeof(this.enable.arguments[e])=="object" ){ for(var ee=0;ee<this.enable.arguments[e].length;ee++){ this[this.enable.arguments[e][ee]]=new shellGuest(this.variableName, this.enable.arguments[e][ee]) } } else{ this[this.enable.arguments[e]]=new shellGuest(this.variableName, this.enable.arguments[e]); } } };
for(var i=1; i<emptyShell.arguments.length; i++){this.enable(emptyShell.arguments[i]);}
this.timer=false;
}







function shellGuest(variableName, methodName){
this.variableName=this.managerName=variableName;
this.owner = this.manager = this.variable= eval(variableName);
this.methodName= methodName;
this.exec= this.exe= this.ex= this.x= this.X= this.e= this.execute= eval(methodName);
this.isRunning=0; this.isTimed=0;
//func:
this.run=function(arg){
	if(!window['imagesEnoughToScroll']){/*specific FP dot com addon*/
	this.isRunning=0;
	var S=document.getElementById('scrollerwrap');
	var s=document.getElementById('scroller');
		if(S&&s){
			if(document.getElementById('scroller_form')){
			document.getElementById('scroller_form').style.display='none';
			};
		s.style.left= ((S.offsetWidth/2) - (s.offsetWidth/2))+'px';
		}
	return;	
	};
clearInterval( this.timer );
arg=(arg)?arg:''; var runner= this.variableName+ "."+ this.methodName+ ".execute("+arg+")";
this.timer=setInterval(runner, ( (parseFloat(this.variable.speed))?parseFloat(this.variable.speed):parseFloat(this.speed) ) );
};/*func over*/
//func:
this.timedRun=function(arg){ arg=(arg)?arg:''; var runner= this.managerName+ "."+ this.methodName+ ".execute("+arg+")"; 
this.isTimed=1;
this.timer=setTimeout(runner,( (parseFloat(this.variable.speed))?parseFloat(this.variable.speed):parseFloat(this.speed) ));
};/*func over*/
//func:
this.stop=function(){if(!this.isTimed){ clearInterval( this.timer );}else{ clearTimeout(this.timer); this.isTimed=0;};
this.isRunning=0;};/*func over*/
//func:
this.setAttributes=function(){
if(!this.setAttributes.arguments.length){return;};if(this.setAttributes.arguments.length>=2){for(var A=0; A< (this.setAttributes.arguments.length-1); A+=2){this[this.setAttributes.arguments[A]] = this.setAttributes.arguments[A+1];}}
else{
if( typeof(this.setAttributes.arguments[0]) == "object" && this.setAttributes.arguments[0].length>=2){
for(var L=0; L< (this.setAttributes.arguments[0].length-1); L+=2){this[this.setAttributes.arguments[0][L]] = this.setAttributes.arguments[0][L+1];}};
};}/*func over*/
this.setAttribute= this.setattribute= this.setattributes= this.attributes= this.set= this.setAttributes;
}









function scrollRL(){
if(!this.isRunning){
this.isRunning=1;
this.currentCycles=0;
this.bareObject=(document.getElementById)? document.getElementById(this.variableName):
(document.all)?document.all[this.variableName]:0;
	if(!this.bareObject){this.isRunning=0; return false;};
this.owner.lastCalled=this.methodName;
this.reset=function(){this.bareObject.style.top=0+'px'; this.bareObject.style.left=0+'px';}
this.speed=(!isNaN(parseFloat(this.speed)))? parseFloat(this.speed):200;
this.scroll=(!isNaN(parseFloat(this.scroll)))?parseFloat(this.scroll):1;
this.increaser=this.bareObject.offsetLeft;
}
//RUN:
this.increaser-=this.scroll;
if(this.increaser<-this.bareObject.offsetWidth){
++this.currentCycles;
this.increaser=this.bareObject.parentNode.offsetWidth;
}
this.bareObject.style.left=this.increaser+'px';
}







function tp_opacity(value, obj){
obj=obj||document.getElementById('imagezoom');
value=parseFloat(value);
if(isNaN(value)){return;};
if(typeof(obj.style.opacity)!="undefined"){
//value>=0, <=1
	if(value>1){
	value/=100;
	};
obj.style.opacity=value;
}
else if(typeof(obj.style.filter)!="undefined"){
//value >=0, <=100
	if(value<=1 && value>0){
	value*=100;
	};
obj.style.filter="alpha(opacity="+value+")";
};
}

function tp_imagezoom_hide(){
var i=document.getElementById('imagezoom');
if(i){
clearInterval(opacitytimer);
tp_opacity(0);
opacityopacity=0;
i.style.visibility="hidden";//
i.alt='';
};
}

var opacitytimer=null;
var opacityopacity=0;
var opacityincrease=4;
//
function opacityon(){
	if(opacityopacity>=100){
	clearInterval(opacitytimer);
	opacityopacity=0;
	return true;
	}
opacityopacity+=opacityincrease;
tp_opacity(opacityopacity);
}


function showImage(img, index){
var i=document.getElementById('imagezoom');
if(i && img.src){
i.width=images_widths[index]||1; 
i.height=images_heights[index]||1; 
i.src=img.src;
i.alt=img.alt;
var H=screen.height;
var W=screen.width;
if(typeof window.innerHeight!="undefined"){H=window.innerHeight; W=window.innerWidth;}
else if(document.documentElement && document.documentElement.clientHeight){H=document.documentElement.clientHeight; W=document.documentElement.clientWidth;}
else if(document.body.clientHeight){H=document.body.clientHeight; W=document.body.clientWidth;}
else{H=parent.clientHeight; W=parent.clientWidth;};
//RESIZE:
	if(i.width>W){
	i.height=(W/i.width)*i.height;
	i.width=W;
	};
	if(i.height>H){
	i.width=(H/i.height)*i.width;
	i.height=H;
	};
//REPOSITION:
var newTop=(H/2) - (i.height/2);
var newLeft=(W/2) - (i.width/2);
newTop+=(document.documentElement.scrollTop)?document.documentElement.scrollTop:0;
newLeft+=(document.documentElement.scrollLeft)?document.documentElement.scrollLeft:0;
i.style.top=newTop+'px';
i.style.left=newLeft+'px';
tp_opacity(0);
i.style.display="block";//safer
i.style.visibility="visible";//
clearInterval(opacitytimer);
opacityopacity=0;
opacitytimer=setInterval("opacityon()", 100);
};
}

function tp_image(img){
var i=img.match(/\d+/);
if(!i){return false;};
i=parseFloat(i);/*this index allows the instantaneous addressing of things like: images_widths[i]*/
img=document.getElementById(img);
showImage(img, i);
return false;
}


properImagesLoad=0;
//
function countProperImagesLoad(){//if(window['fixserver']){window['fixserver'](properImagesLoad);}
if(++properImagesLoad>=images_names.length){
	if(!scroller[scrollerName].isRunning){scroller[scrollerName].run();}
};
}

var tp_reel=new Image(90,25);
tp_reel.src='../_images_/reel.gif';

var scroller=null;
//
function bodyend(){
	//first set up scroller engines:
scroller=null;
scroller=new emptyShell("scroller");

scroller.enable(scrollerName);
scroller[scrollerName].setAttributes(
"speed", 100,
"scroll", 3 
);
scroller[scrollerName].stop();
if(images_names.length){
document.getElementById('scrollerwrap').style.display='block';
};
	//remove placeholder gifs (they saved loading time), and give proper images:
for(var i=0; i<images_names.length; i++){
	if(document.getElementById('scroller_image_'+i)){
	var I=document.getElementById('scroller_image_'+i);
	I.src=imagesPath+images_names[i];
	I.onload=countProperImagesLoad;/*run scroller only if all proper images have been loaded*/
	I.onmouseover=document.getElementById('desc_image_'+i).onmouseover=function(){
		if(window['scroller']){scroller[scrollerName].stop();};
	}//anonymous function over
	I.onmouseout=document.getElementById('desc_image_'+i).onmouseout=function(){
		if(window['scroller']){scroller[scrollerName].run();};
	}//anonymous function over
	//small pics, make longer description field: nicer to look:
	document.getElementById('desc_image_'+i).style.height=
	(document.getElementById('scroller').offsetHeight - images_heights_resized[i] - 25)+'px';
	};
}
	//if(window['fixserver']){window['fixserver']();}
	//show scroller:
if(images_names.length){
	if(document.getElementById('FP')){
	var FP=document.getElementById('FP');
	var SW=document.getElementById('scrollerwrap');
	FP.style.top=(   (SW.offsetHeight/2)-(FP.offsetHeight/2)   )+'px';
	FP.style.left=(   (SW.offsetWidth/2)-(FP.offsetWidth/2)   )+'px';
	FP.style.visibility='visible';
	};
};
var scrollerWidth=document.getElementById('scrollerwrap').offsetWidth;
imagesEnoughToScroll=
	(document.getElementById('scroller').offsetWidth >= scrollerWidth)?
	imagesEnoughToScroll:false;
setTimeout("scroller."+scrollerName+".stop();scroller."+scrollerName+".run();", 5000);/*IE 6 at times doesn't load*/
getMap(mapAddress, lat, lng);
}













function setScroller(how){//scroller COMMAND buttons
if(!scroller || typeof(scroller[scrollerName])=="undefined" || !images_names.length){return false;};
switch(how){
case 1:
scroller[scrollerName].stop();
break;
case 2:
scroller[scrollerName].stop();
scroller[scrollerName].run();
break;
case 3://slow down
scroller[scrollerName].stop();
scroller[scrollerName].scroll=2;
var newspeed=scroller[scrollerName].speed+50;
	if(newspeed<=2000){
	scroller[scrollerName].speed=newspeed;
	};
scroller[scrollerName].run();
break;
case 4://speed up
scroller[scrollerName].stop();
scroller[scrollerName].speed=50;
var newspeed=scroller[scrollerName].scroll+2;
	if(newspeed<=50){
	scroller[scrollerName].scroll=newspeed;
	};
scroller[scrollerName].run();
break;
case 5:
scroller[scrollerName].stop();
document.getElementById('scroller').style.left='0px';
scroller=null;
scroller=new emptyShell("scroller");
scroller.enable(scrollerName);
scroller[scrollerName].setAttributes(
"speed", 50,
"scroll", 2
);
scroller[scrollerName].run();
break;
}
return false;
}


















function gmapFormatAddressLength(address){/*word wraps to avoid too long info windows*/
if(!address){return '';};
address=address.split(',');
var output='';
for(var a=0; a<address.length; a+=2){
var addFirst=(!/^\s*$/.test(address[a]))?address[a]:'';
output+=addFirst;
	if( typeof address[a+1] !="undefined" && !/^\s*$/.test(address[a+1]) ){
	var separator=(addFirst)?', ':' ';
		output+=separator+address[a+1];
	};
output+='<br />';
}
return output;
}

function addMapControls(addressInfo, lat, lng){
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.addControl(new GScaleControl());
map.addControl(new GOverviewMapControl());
if(!lat && !lng){
mapZoomLevel=2;
addressInfo='<span class="_279">'+FP_getSpan(noLocationSpan).childNodes[0].nodeValue+'</span>';
//return false;//info window?
};
var marker = new GMarker(map.getCenter());
map.addOverlay(marker);
marker.openInfoWindowHtml(
	'<div class="mapinfo">'+gmapFormatAddressLength(addressInfo)+'</div>'
);
}









var tp_mail_mousedown_already_occurred=false;
function tp_mailer_down(email, obj){
if(tp_mail_mousedown_already_occurred){return;/*no need to bother twice*/};
tp_mail_mousedown_already_occurred=true;
var realMail=email.join('');
while(obj.childNodes.length){obj.removeChild(obj.childNodes[0]);}
obj.href='mailto:'+realMail;
obj.appendChild(document.createTextNode(realMail));/*spam bots won't see this. Note: do NOT move this statement before, or it prints... also the 'mailto:' protocol*/
location.href=obj.href;/*or nodeValue rewrite won't launch it at first try*/
}

function tp_mailer(email){
location.href='mailto:'+email.join('')+'?Subject=FULLPOSTER';
return false;
}


