function base64_encode(decStr) {
var base64s = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';var bits;var dual;var i = 0;var encOut = '';
while(decStr.length >= i + 3) {
bits = (decStr.charCodeAt(i++) & 0xff) <<16 |
(decStr.charCodeAt(i++) & 0xff) <<8 |
decStr.charCodeAt(i++) & 0xff;
encOut += base64s.charAt((bits & 0x00fc0000) >>18) +
base64s.charAt((bits & 0x0003f000) >>12) +
base64s.charAt((bits & 0x00000fc0) >> 6) +
base64s.charAt((bits & 0x0000003f));
}
if(decStr.length -i > 0 && decStr.length -i < 3) {
dual = Boolean(decStr.length -i -1);
bits = ((decStr.charCodeAt(i++) & 0xff) <<16) |
(dual ? (decStr.charCodeAt(i) & 0xff) <<8 : 0);
encOut += base64s.charAt((bits & 0x00fc0000) >>18) +
base64s.charAt((bits & 0x0003f000) >>12) +
(dual ? base64s.charAt((bits & 0x00000fc0) >>6) : '=') +
'=';
}
return(encOut);
}
//function imagecounter(client_id){
var resolution = window.screen.width + 'x' + window.screen.height + 'x' + window.screen.colorDepth + 'bit';
document.write('<img src="http://www.u1aba.co.uk/image.php?client_id='+client_id+'&document_url='+base64_encode(document.URL)+'&referer='+base64_encode(document.referrer)+'&add_data[]=resolution::'+resolution+'" alt="" width="1" height="1" />');
//}
function goToURL() { history.go(-1); }
function addbookmark()
{
if (window.sidebar) {
window.sidebar.addPanel(bookmarktitle, bookmarkurl,"");
} else if( document.all ) {
window.external.AddFavorite(bookmarkurl, bookmarktitle);
} else if( window.opera && window.print ) {
return true;
}
}
var good;
function checkEmailAddress(field) {
var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
if (goodEmail) {
good = true;
} else {
alert('Please enter a valid e-mail address.');
field.focus();
field.select();
good = false;
}
}
function advimg(pid,uid,aid,amp) {
window.open('shop.php?typ=1&pageid='+pid+'&urlid='+uid+'&advid='+aid+'&ref='+amp);
}
function prodimg(amp) {
window.open('shop.php?typ=3&ref='+amp);
}
function mailThisUrl() {
good = false;
checkEmailAddress(document.eMailer.address);
if (good) {
u = window.location;
m = "I thought this might interest you...";
window.location = "mailto:"+document.eMailer.address.value+"?subject="+m+"&body="+document.title+" "+u;
}
}
function checkFrame(){
if (parent.location.href == self.location.href) {
window.location.href = 'index.html';
}
}
function setCookie( name, value, expires, path, domain, secure ) {
var today = new Date();
today.setTime( today.getTime() );
if ( expires ) {
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );
document.cookie = name+"="+escape( value ) +
( ( expires ) ? ";expires="+expires_date.toGMTString() : "" ) +
( ( path ) ? ";path=" + path : "" ) +
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}
function getCookie( check_name ) {
var a_all_cookies = document.cookie.split( ';' );
var a_temp_cookie = '';
var cookie_name = '';
var cookie_value = '';
var b_cookie_found = false; 
for ( i = 0; i < a_all_cookies.length; i++ )
{
a_temp_cookie = a_all_cookies[i].split( '=' );
cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
if ( cookie_name == check_name )
{
b_cookie_found = true;
if ( a_temp_cookie.length > 1 )
{
cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
}
return cookie_value;
break;
}
a_temp_cookie = null;
cookie_name = '';
}
if ( !b_cookie_found )
{
return null;
}
}
function allez(showit,str1,itm){
if (showit) {
alert(str1);
itm.focus();
}
}
function installSearchEngine() {
if (window.external && ("AddSearchProvider" in window.external)) {
window.external.AddSearchProvider("http://www.u1a.co.uk/Internet_Shopping_Store.xml");
} else {
alert("No search engine support");
}
}
function resizeImg(sz)
{
if(!sz){
	var _resizeWidth  = 100;
	var _resizeHeight = 100;
	var _resizeClass  = 'prodimg';
} else {
	var _resizeWidth  = sz;
	var _resizeHeight = sz;
	var _resizeClass  = 'prodimg'+sz;
}

var imgArray = document.getElementsByTagName( 'IMG' );
for ( var i = 0; i < imgArray.length; i++ ){
	var imgObj = imgArray[i];
	if ( imgObj.className == _resizeClass ){
		if (imgObj.width > _resizeWidth || imgObj.height > _resizeHeight) {
			var w = imgObj.width;
			var h = imgObj.height;
			if (h/_resizeHeight > w/_resizeWidth){
				w = w * (_resizeHeight / h);
				h = _resizeHeight;
			} else {
				h = h * (_resizeWidth/ w);
				w = _resizeWidth;
			}
			imgObj.style.width = w + 'px';
			imgObj.style.height = h + 'px';
		} else {
			if (imgObj.width < _resizeWidth && imgObj.height < _resizeHeight) {
				var w = imgObj.width;
				var h = imgObj.height;
				if (h/_resizeHeight > w/_resizeWidth){
					w = w * (_resizeHeight / h);
					h = _resizeHeight;
				} else {
					h = h * (_resizeWidth/ w);
					w = _resizeWidth;
				}
				imgObj.style.width = w + 'px';
				imgObj.style.height = h + 'px';
			} 
		}
	}
}
}
/*
bxSlider v2.0
Plugin developed by: Steven Wanderski
http://bxslider.com
http://stevenwanderski.com
Released under the GPL license:
http://www.gnu.org/licenses/gpl.html
*/
(function($){$.fn.bxSlider=function(options){var defaults={alignment:'horizontal',controls:true,speed:500,pager:true,pager_short:false,pager_short_separator:' / ',margin:0,next_text:'next',next_image:'',prev_text:'prev',prev_image:'',auto:false,pause:3500,auto_direction:'next',auto_hover:true,auto_controls:false,ticker:false,ticker_controls:false,ticker_direction:'next',ticker_hover:true,stop_text:'stop',start_text:'start',wrapper_class:'bxslider_wrap'};var o=$.extend(defaults,options);return this.each(function(){var $this=$(this);var $kids=$this.children();var l=$this.children().length;var first=$this.children(':first').clone();var last=$this.children(':last').clone();var w=0,h=0,current_temp=0,pos=0,d=0;var is_working=false,playing=true,tick_play=true;var current=1;var ease='swing',side='',t='';var ani={};$this.append(first).prepend(last);$this.wrap('<div class="bxslider_container"></div>');$this.parent().wrap('<div class="'+o.wrapper_class+'"></div>');if(o.alignment=='horizontal'){$this.children().css({'float':'left','listStyle':'none','marginRight':o.margin});w=first.outerWidth(true);$this.css({'width':'99999px','position':'relative','left':-w});$this.parent().css({'position':'relative','overflow':'hidden','width':w-o.margin});}else if(o.alignment=='vertical'){$kids.each(function(){if($(this).height()>h){h=$(this).height();}});w=first.outerWidth();$this.children().css({'height':h,'listStyle':'none','marginBottom':o.margin});$this.css({'height':'99999px','width':w,'position':'relative','top':-(h+o.margin)});$this.parent().css({'position':'relative','overflow':'hidden','height':h})}
if(o.pager&&!o.ticker){$this.parent().after('<div class="bx_pager"></div>');if(!o.pager_short){var $a;$kids.each(function(index){$a=$('<a href="#">'+(index+1)+'</a>');$this.parent().siblings('.bx_pager').append($a);$a.click(function(){is_working=false;tick_play=false;$this.stop();move_slide(index+1);current=index+1;if(o.auto){clearInterval(t);$this.parent().siblings('.auto_controls').find('a').html(o.start_text);playing=false;}
else if(o.ticker){$this.parent().siblings('.ticker_controls').find('a').html(o.start_text);playing=false;}
return false;});});}else{$this.parent().siblings('.bx_pager').append();}
set_active(1);}
if(o.controls&&!o.ticker){if(o.next_image!=''||o.prev_image!=''){$this.parent().after('<a class="prev" href="#"><img src="'+o.prev_image+'" /></a><a class="next" href="#"><img src="'+o.next_image+'" /></a>');}
else{$this.parent().after('<a class="prev" href="#">'+o.prev_text+'</a><a class="next" href="#">'+o.next_text+'</a>');}
$this.parent().siblings('.next').click(function(){if(!is_working){move_slide(++current);}
if(o.auto){clearInterval(t);$this.parent().siblings('.auto_controls').find('a').html(o.start_text);playing=false;}
return false;});$this.parent().siblings('.prev').click(function(){if(!is_working){move_slide(--current);}
if(o.auto){clearInterval(t);$this.parent().siblings('.auto_controls').find('a').html(o.start_text);playing=false;}
return false;});}
if(o.auto&&!o.ticker){t=setInterval(function(){if(o.auto_direction=='next'){move_slide(++current);}else{move_slide(--current);}},o.pause);if(o.auto_hover){$this.hover(function(){clearInterval(t);},function(){if(playing){t=setInterval(function(){if(o.auto_direction=='next'){move_slide(++current);}
else{move_slide(--current);}},o.pause);}});}
if(o.auto_controls){$this.parent().after('<div class="auto_controls"><a class="auto_link" href="#">'+o.stop_text+'</a></div>');$this.parent().siblings('.auto_controls').find('a').click(function(){if(playing){clearInterval(t);$(this).html(o.start_text);playing=false;}
else{t=setInterval(function(){if(o.auto_direction=='next'){move_slide(++current);}else{move_slide(--current);}},o.pause);$(this).html(o.stop_text);playing=true;}
return false;});}}
if(o.ticker){var tick_play=true;tick_slide();$this.hover(function(){$this.stop();},function(){if(tick_play){tick_slide();}});if(o.ticker_controls){$this.parent().after('<div class="ticker_controls"><a class="ticker_link" href="#">'+o.stop_text+'</a></div>');$this.parent().siblings('.ticker_controls').find('a').click(function(){if(tick_play){$this.stop();$(this).html(o.start_text);tick_play=false;}
else{is_working=false;$(this).html(o.stop_text)
tick_slide();tick_play=true;}
return false;});}}
function tick_slide(){if(o.ticker_direction=='next'&&o.alignment=='horizontal'){$this.animate({left:'-=5px'},o.speed/5,'linear',function(){if(parseInt($this.css('left'))<=-((l+1)*w)){$this.css('left',-w);}
tick_slide();});}else if(o.ticker_direction=='prev'&&o.alignment=='horizontal'){$this.animate({left:'+=5px'},o.speed/5,'linear',function(){if(parseInt($this.css('left'))>=-(w)){$this.css('left',-((l+1)*w));}
tick_slide();});}else if(o.ticker_direction=='next'&&o.alignment=='vertical'){$this.animate({top:'-=5px'},o.speed/5,'linear',function(){if(parseInt($this.css('top'))<=-((l+1)*(h+o.margin))){$this.css('top',-(h+o.margin));}
tick_slide();});}else if(o.ticker_direction=='prev'&&o.alignment=='vertical'){$this.animate({top:'+=4px'},o.speed/5,'linear',function(){if(parseInt($this.css('top'))>-(h+o.margin)){$this.css('top',-((l+1)*(h+o.margin-1)));}
tick_slide();});}}
function move_slide(num){if(o.ticker){ease='linear';}
if(!is_working){if(o.alignment=='horizontal'){d=w;side='left';}
else if(o.alignment=='vertical'){d=h+o.margin;side='top';}
pos=num*d;ani[side]=-pos;is_working=true;$this.animate(ani,o.speed,ease,function(){is_working=false;if(current>l){$this.css(side,-d);current=1;}
else if(current<1){$this.css(side,-(d*l));current=l;}
set_active(current);});}}
function set_active(num){if(o.pager&&!o.pager_short){$this.parent().siblings('.bx_pager').find('a').removeClass('active').eq(num-1).addClass('active');}
else if(o.pager_short){$this.parent().siblings('.bx_pager').html(num+o.pager_short_separator+$kids.length);}}});};})(jQuery);
