/* BVL Repository: $Revision: 62 $ */
function addBookmark(){
	bookmarkurl="http://www.printsandfineart.co.uk/"
	bookmarktitle="Prints and Fine Art"
	if (document.all){
	    window.external.AddFavorite(bookmarkurl,bookmarktitle);
	}
}
function emailAFriend(e) {
	if (typeof(e)=='undefined') {
		if (document.body){
			document.getElementById("prodfocusBG").style.height = screen.availHeight;
			document.getElementById("prodfocusBG").style.width = screen.availWidth;
		}
		var s = '<div class="enlarged"><div class="inner">';
		s+= '<iframe src="maf.php"></iframe>';
		s+= "</div></div>";
		document.getElementById("prodfocusCenter").innerHTML = s;
		document.getElementById("prodfocusBG").style.visibility = "visible";
		document.getElementById("prodfocus").style.visibility = "visible";
		$('#prodfocusBG').show("normal");
		$('#prodfocusBG').css('filter','alpha(opacity=90)');
		$('#prodfocus').show("normal");
	}
	else {
		$('#prodfocusBG').hide("fast");
		$('#prodfocus').hide("fast");
		document.getElementById("prodfocus").style.visibility = "hidden";
		document.getElementById("prodfocusBG").style.visibility = "hidden";
		document.getElementById("prodfocusCenter").innerHTML = "";
	}
}
//
function otherinfoKeyPress(obj,evt) {
	var kCode = evt.keyCode ? evt.keyCode : evt.which ? evt.which : evt.charCode;
	if (kCode == 13){ return false; }
	return true;
}
function otherinfoKeyUp(obj) {
	var maxlen=obj.getAttribute?parseInt(obj.getAttribute("maxlength")):0;
	if(maxlen>0&&obj.getAttribute&&obj.value.length>maxlen){
		obj.value=obj.value.substring(0,maxlen);
		return true;
	}
	return true;
}
function otherinfoChange(obj) {
	var maxlen=obj.getAttribute?parseInt(obj.getAttribute("maxlength")):0;
	if(maxlen>0&&obj.getAttribute&&obj.value.length>maxlen){
		obj.value=obj.value.substring(0,maxlen);
		return true;
	}
	if(obj.value.length==0){
		obj.value=' ';
	}
	return true;
}
function inputMaxLength(obj) {
	var maxlen=obj.getAttribute?parseInt(obj.getAttribute("maxlength")):0;
	if(maxlen>0&&obj.getAttribute&&obj.value.length>maxlen){
		obj.value=obj.value.substring(0,maxlen);
	}
}
//
//
function PFAProductInfo(ref,title,pw,ph,iw,ih,af,al,thmb,imgspec,lrg){
	this.nImageMaxWidth = 160;
	this.nImageMaxHeight = 160;
	this.sProductRef = ref;
	this.sProductTitle = title;
	var spec=pw.split('-'); // paper width
	this.nWidthMetric = (spec[0]&&!isNaN(spec[0])) ? parseInt(spec[0]) : 0;
	this.nWidthImperial = (spec[1]&&!isNaN(spec[1])) ? parseInt(spec[1]) : 0;
	spec=ph.split('-'); // paper height
	this.nHeigthMetric = (spec[0]&&!isNaN(spec[0])) ? parseInt(spec[0]) : 0;
	this.nHeightImperial = (spec[1]&&!isNaN(spec[1])) ? parseInt(spec[1]) : 0;
	spec=iw.split('-'); // image width
	this.nImageWidthMetric = (spec[0]&&!isNaN(spec[0])) ? parseInt(spec[0]) : 0;
	this.nImageWidthImperial = (spec[1]&&!isNaN(spec[1])) ? parseInt(spec[1]) : 0;
	spec=ih.split('-'); // image height
	this.nImageHeigthMetric = (spec[0]&&!isNaN(spec[0])) ? parseInt(spec[0]) : 0;
	this.nImageHeightImperial = (spec[1]&&!isNaN(spec[1])) ? parseInt(spec[1]) : 0;
	this.bImperial = (spec.length>2&&spec[2]==='I');
	this.sAuthorFirst = (af!=null) ? af.toLowerCase().replace(/\b([a-z])/g,function($0){return $0.toUpperCase()}) : null;
	this.sAuthorLast = (al!=null) ? al.toLowerCase().replace(/\b([a-z])/g,function($0){return $0.toUpperCase()}) : null;
	this.sImageSpec = imgspec;
	this.sThumbnailSpec = (thmb!=null&&thmb.length>0) ? ('<img src="'+thmb+'" alt="'+this.sProductTitle+'" />') : PFAProductInfoFnRescaleImageSpec(imgspec,this.nImageMaxWidth,this.nImageMaxHeight);
	this.sFullsizeImageSpec = (lrg!=null&&lrg.length>0) ? ('<img src="'+lrg+'" alt="'+this.sProductTitle+'" />') : imgspec;
}
function PFAProductInfoFnRescaleImageSpec(spec,w,h){
	var re=new RegExp('^<img src="([^"]+)"\\s+alt="([^"]+)"\\s+class="([^"]+)"\\s+border=[0-9]+\\s+height=([0-9]+)\\s+width=([0-9]+).*', "i");
	if(spec.match(re)){
		var osrc = spec.match(re)[1];
		var oalt = spec.match(re)[2];
		var oheight = parseInt(spec.match(re)[4]);
		var owidth = parseInt(spec.match(re)[5]);
		var style = null;
		if(owidth>w||oheight>h){
			var pctg=((owidth-w)>(oheight-h)) ? parseInt((w*100)/owidth) : parseInt((h*100)/oheight);
			var s = '<img src="'+osrc+'" alt="'+oalt+'"';
			s += ' width="' + parseInt(owidth*(pctg/100)) + '"';
			s += ' height="' + parseInt(oheight*(pctg/100)) + '"';
			s += ' border="0" />';
			return s;
		}
	}
	return spec;
}
function PFAProductInfoFnGetDimensions() {
	var mtr = (this.nImageWidthMetric>0) ? (this.nImageWidthMetric+' x '+this.nImageHeigthMetric+' cm') : null;
	var imp = (this.nImageWidthImperial>0) ? (this.nImageWidthImperial+'" x '+this.nImageHeightImperial+'"') : null;
	if(true){
		return (mtr!=null&&imp!=null) ? (mtr + ' (' + imp + ')') : ((mtr!=null) ? mtr : ((imp!=null) ? imp : ''));
	}else{
		return (mtr!=null&&imp!=null) ? (imp + ' (' + mtr + ')') : ((mtr!=null) ? mtr : ((imp!=null) ? imp : ''));
	}
}
function PFAProductInfoFnGetAuthor() {
	return (this.sAuthorFirst==null&&this.sAuthorLast==null) ? 'Unkown Author' : (this.sAuthorFirst+' '+this.sAuthorLast);
}
function PFAProductInfoFnGetByLine() {
	return 'by ' + this.getAuthor();
}
PFAProductInfo.prototype.rescaleImageSpec=PFAProductInfoFnRescaleImageSpec;
PFAProductInfo.prototype.getDimensions=PFAProductInfoFnGetDimensions;
PFAProductInfo.prototype.getAuthor=PFAProductInfoFnGetAuthor;
PFAProductInfo.prototype.getByLine=PFAProductInfoFnGetByLine;
//
// BEGIN page tracking - Google et al
var _bvPageTracker = {
	sPageNameOverride:{},
	aTransactionItems:{},
	sOrderId:{},
	sShop:{},
	sTotal:{},
	sTax:{},
	sShipping:{},
	sCity:{},
	sState:{},
	sCountry:{},
	init:function(){
		this.sPageNameOverride = null;
		this.aTransactionItems = [];
		this.sOrderId = null;
		this.sShop = null;
		this.sTotal = null;
		this.sTax = null;
		this.sShipping = null;
		this.sCity = null;
		this.sState = null;
		this.sCountry = null;
	},
	overridePageName:function(s){this.sPageNameOverride=s;},
	cleanupActUnassigned:function(s){
		if(!s||(typeof(s)!=='string')){return null;}
		s=s.replace(/NETQUOTEVAR:\w+/,"");
		return (s&&s.length>0) ? s : null;
	},
	removeMarkup:function(s){
		if(!s||(typeof(s)!=='string')){return null;}
		s=s.replace(/<\w+>/g,"").replace(/&nbsp;/g," ");
		return s;
	},
	cleanupPrice:function(p){
		if(!p){return null;}
		p=this.cleanupActUnassigned(p);
		if(!p){return null;}
		p=p.replace("&#163;","").replace("&#46;","."); // remove/replace entities
		return (p&&p.length>0) ? p : '0';
	},
	setTransaction:function(sOrderId,sShop,sTotal,sTax,sShipping,sCity,sState,sCountry){
		this.sOrderId = this.cleanupActUnassigned(sOrderId);
		this.sShop = sShop;
		this.sTotal = this.cleanupPrice(sTotal);
		this.sTax = this.cleanupPrice(sTax);
		this.sShipping = this.cleanupPrice(sShipping);
		this.sCity = sCity;
		this.sState = sState;
		this.sCountry = sCountry;
	},
	setTransactionTotals:function(sTotal,sTax,sShipping){
		this.sTotal = this.cleanupPrice(sTotal);
		this.sTax = this.cleanupPrice(sTax);
		this.sShipping = this.cleanupPrice(sShipping);
	},
	setTransactionCategory:function(sShop){
		this.sShop = sShop;
	},
	setTransactionOrderId:function(sOrderId){
		this.sOrderId = sOrderId;
	},
	setTransactionLocation:function(sCity,sState,sCountry){
		this.sCity = this.removeMarkup(sCity);
		this.sState = this.removeMarkup(sState);
		this.sCountry = this.removeMarkup(sCountry);
	},
	addCartItem:function(sItem,sSKU,sProductName,sCategory,sPrice,sQuantity){
		var cartitem = new Object();
		sItem=this.cleanupActUnassigned(sItem);
		sSKU=this.cleanupActUnassigned(sSKU);
		sProductName=this.cleanupActUnassigned(sProductName);
		sPrice=this.cleanupPrice(sPrice);
		sQuantity=this.cleanupActUnassigned(sQuantity);
		if(sSKU&&sPrice&&(parseFloat(sPrice)>0)&&sQuantity&&(parseInt(sQuantity)>0)){
			cartitem.sItem=sItem;
			cartitem.sSKU=sSKU;
			cartitem.sProductName=sProductName;
			cartitem.sCategory=sCategory;
			cartitem.sPrice=sPrice;
			cartitem.sQuantity=sQuantity;
			aTransactionItems.push(cartitem);
		}
	},
	getConversionValue:function(){
		if(this.sTotal&&parseFloat(this.sTotal)>0){return parseFloat(this.sTotal);}
		return 0;
	},
	trackOnGoogleAnalytics:function(pageTracker){
		if(this.sPageNameOverride&&this.sPageNameOverride.length>0){
			pageTracker._trackPageview(this.sPageNameOverride);
		}else{
			pageTracker._trackPageview();
		}
		if(this.sOrderId&&this.sTotal&&(parseFloat(this.sTotal)>0)){
			pageTracker._addTrans(this.sOrderId,this.sShop,this.sTotal,this.sTax,this.sShipping,this.sCity,this.sState,this.sCountry);
			if(this.aTransactionItems&&this.aTransactionItems.length>0){
				for(var i=0;i<this.aTransactionItems.length;i++){
					pageTracker._addItem(this.aTransactionItems[i].sItem,this.aTransactionItems[i].sSKU,this.aTransactionItems[i].sProductName,this.aTransactionItems[i].sCategory,this.aTransactionItems[i].sPrice,this.aTransactionItems[i].sQuantity);
				}
			}
			pageTracker._trackTrans();
		}
	},
	trackAffiliateWindowSale:function(mid){
		if(this.sOrderId&&this.sTotal&&(parseFloat(this.sTotal)>0)){
			document.write('<img src="https://www.awin1.com/sale.php?sale=' + parseFloat(this.sTotal) + '&extra=' + this.sOrderId + '&type=s&mid=' + mid + '">');
		}
	},
	debug:function(){
		var s="sPageNameOverride="+this.sPageNameOverride+"\n";
		s+="aTransactionItems="+this.aTransactionItems.length+"\n";
		s+="sOrderId="+this.sOrderId+"\n";
		s+="sShop="+this.sShop+"\n";
		s+="sTotal="+this.sTotal+"\n";
		s+="sTax="+this.sTax+"\n";
		s+="sShipping="+this.sShipping+"\n";
		s+="sCity="+this.sCity+"\n";
		s+="sState="+this.sState+"\n";
		s+="sCountry="+this.sCountry+"\n";
		$('#footer').after("<span style=\"color:white\"><pre>" + s + "</pre></span>");
	}
}
// END page tracking - Google et al
//
function updateCheckoutTitles(sc) {
	$('#'+sc).find(".reference").find('.thumbnail').each(function(i){
		/* thumbnail - look for adjoining lines with empty references */
		var fr='unframed',mr='none',gr='glass',ft='unframed',mt='none',gt='glass';
		var isrc=$(this).attr('src');
		$(this).parents('.cartproductline').parent().find('.cartproductline').each(function(j){
			// find empty references
			if($.trim($(this).find('.reference').find('.reference').text()).length<=1){
				var gp=$(this).parent();
				$(this).find('.product .title').each(function(i){
					var raw=$(this).text();
					var re=new RegExp('^(\\w+)\\s+\\-\\s+(\\w+):\\s+(.*)$');
					if(raw.match(re)&&typeof(fo)!='undefined'){
					  var t=raw.match(re)[1];
					  var r=raw.match(re)[3];
					  var title=r;
					  if(t=='Frame'){fr=r;for(var n=0;n<fo.frames.length;n++){if(fo.frames[n].sReference==fr){ft=title=fo.frames[n].sTitle;}}}
					  if(t=='Mount'){mr=r;for(var n=0;n<fo.mounts.length;n++){if(fo.mounts[n].sReference==mr){mt=title=fo.mounts[n].sTitle;}}}
					  if(t=='Finish'){gr=r;for(var n=0;n<fo.finishes.length;n++){if(fo.finishes[n].sReference==gr){gt=title=fo.finishes[n].sTitle;}}}
					  $(this).parent().parent().find('.reference').find('.reference').text(r);
					  $(this).parent().parent().find('.product').find('.title').text(raw.match(re)[1] + ": " + title);
					  $(this).parent().parent().find('.quantity').text('');
					}
				});
			}			
		});
		// 
		var upldfile='';
		$(this).parents('.cartproductline').parent().find('.cartinfoline').each(function(k){
			 // find POD products
			if($(this).find('span')&&$(this).find('span:first').text()=='Uploaded file:'){
				var eo=$(this).find(":text[name^='O_']");
				eo=$(this).find(".otherinfo");
				if(eo&&eo.val()){
					var ev = eo.val();
					var en = eo.attr('name');
					var h='<input type="hidden" name="'+en+'" value="'+ev+'" />';
					h += '<span>'+ev+'</span>';
					eo.parent().html(h);
					var rev=new RegExp('^(.*)\\s+[(]+([a-f0-9]+)[)]+$');
					if(ev&&ev.match(rev)){upldfile=ev.match(rev)[2];}
				} else {
					// read-only version
					var ev = $(this).find('span:eq(1)').text();
					var rev=new RegExp('^(.*)\\s+[(]+([a-f0-9]+)[)]+$');
					if(ev.match(rev)){upldfile=ev.match(rev)[2];}
				}
			}else{
				// read-only version
				if($(this).find('span')&&$(this).find('span:first').text().substr(0,14)=='Uploaded file:'){
					var ev = $(this).find('span').text().substr(14);
					var rev=new RegExp('^(.*)\\s+[(]+([a-f0-9]+)[)]+$');
					if(ev.match(rev)){upldfile=ev.match(rev)[2];}
				}
			}
		});
		if(isrc&&isrc.indexOf('/')<0){
			if(upldfile&&upldfile.length>0){
				// POD image
				isrc='/imagesp2a/'+fr+'/'+mr+'/120/80/80/'+upldfile+'.jpg';
			} else {
				isrc='/images/'+fr+'/'+mr+'/120/80/80/'+isrc;
			}
			$(this).attr('src',isrc);
		}
	});
}
//
function showSectionDetail(e,c) {
	if(!(typeof c === 'string')||c==null||c.length==0)return '';
	$(".popup2").fadeOut("fast");
	var ts1 = $(e).parent().parent().parent().find(".popup");
	var ts2 = $(e).parent().parent().parent().find(".popup2");
	if(ts2){
		var offset=ts2.parent().offset();
		if(offset.left>=700){
			ts2.css('margin-left','-400px');
		}
	}
	if(ts1){ts1.fadeIn("slow");}
	if(ts2){ts2.fadeIn("slow");}
}
function hideSectionDetail(e,c) {
	if(!(typeof c === 'string')||c==null||c.length==0)return '';
    $(e).parent().parent().parent().find(".popup").fadeOut("fast");
	$(e).parent().parent().parent().find(".popup2").fadeOut("fast");
}

function getSubSections(json,head) {
	if(json==null||!(typeof json === 'string')||json.length==0)return '';
	var obj=eval('(' + json + ')');
	var s = "<ul class=\"subsections\">";
	for (i=0;i<obj.subSections.length&&i<3;i++){
		s += "<li><a href=\"" + obj.subSections[i].uri + "\">"+obj.subSections[i].name+"</a></li>";
	}
	if(obj.subSections.length==4){
		s += "<li><a href=\"" + obj.subSections[3].uri + "\">"+obj.subSections[3].name+"</a></li>";
	}
	if(obj.subSections.length>4){
		s += "<li><a class=\"more\" href=\"" + "#" + "\" onclick=\"showSectionDetail(this,'popup2');return false;\">"+"More &gt;"+"</a></li>";
	}
	s += "</ul>";
	s += "<div class=\"popup2\" style=\"display:none\"><h3 onclick=\"hideSectionDetail(this,'none');return false;\">"+head+"</h3><table class=\"subsections\"><tr>";
	for (i=0;i<obj.subSections.length;i++){
		s += "<td><a href=\"" + obj.subSections[i].uri + "\">"+obj.subSections[i].name+"</a></td>";
		if((i+1)%3==0){
			s+="</tr><tr>";
		}
	}
	s += "</tr></table></div>";
	return s;
}

function getDimensionsString(wm,hm,wi,hi) {
	if(isNaN(wm)||wm==0||isNaN(hm)||hm==0){
		if(isNaN(wi)||wi==0||isNaN(hi)||hi==0){
			return '';
		}
		wm=Math.round(wi*25.4)/10;
		hm=Math.round(hi*25.4)/10;
	}
	if(isNaN(wi)||wi==0||isNaN(hi)||hi==0){
		wi=Math.round(wm*10/2.54)/10;
		hi=Math.round(hm*10/2.54)/10;
	}
	if((typeof(oUserInfo)!='undefined')&&(oUserInfo.sCountryCode=='US'||oUserInfo.sCountryCode=='CA')){
		return wi+'" x '+hi+'"' + ' ('+wm+'" x '+hm+' cm)';
	}
	return wm+' x '+hm+' cm' + ' ('+wi+'" x '+hi+'")';
}

function SwapInnerImage(e,i){
	if(e==null)return;
	e.xxx=e.childNodes[0].src;
	e.childNodes[0].src=i;
}
function RestoreInnerImage(e){
	if(e==null)return;
	e.childNodes[0].src=e.xxx;
}
function DynaMenu(sec, sel){
    var hc = "header", sc = "submenu", ncsc = "ncsubmenu";
    var s = YahooSections(sec,hc,sc,(sel==null)?ncsc:null);
    s += '<scr'+'ipt type="text/javascript">\n';
    s += 'ddamenu.init({headerclass: "' + hc + '", contentclass: "' + sc + '", nccontentclass: "' + ncsc + '", revealtype: "click", collapseprev: true, defaultexpanded: [' + ((sel==null)?'':sel) + '], onemustopen: false, animatedefault: false, persiststate: false, toggleclass: ["collapsed", "selected"], togglehtml: ["", "", ""], animatespeed: "fast", oninit:function(headers, expandedindices){}, onopenclose:function(header, index, state, isuseractivated){}})';
    s += '</scr'+'ipt>';
    return s;
}
function YahooSections(a,hc,sc,ncsc) {
    var s = "", i=0, j=0, k=0; var nMax = 6;
	if(typeof(a)=='undefined') return '';
    for ( i = 1; (i <= a.length) && (i <= nMax); i++) {
        if (a[i].sURL != null) {
            s += '<div class="' + hc + '"><a class="lmh' + i + '" href="' + a[i].sURL + '">' + a[i].sName + '</a></div>';
            if (a[i].pChild) {
                s += '<div class="' + sc + '">';
                for ( j = 1; j <= a[i].pChild.length; j++) {
                    if (a[i].pChild[j].sURL != null) {
                        s += '<a href="' + a[i].pChild[j].sURL + '">' + a[i].pChild[j].sName + '</a><br />';
                    }
                }
				if('Artists'==a[i].sName){
                    s += '<a class="more" href="' + '/acatalog/a.html' + '">More&gt;</a><br />';
                }
                s += '</div>';
                if(ncsc!=null){
                    s += '<div class="' + ncsc + '">';
                    for (j = 1, k = 1; j <= a[i].pChild.length; j++) {
                        if (a[i].pChild[j].sURL != null) {
                            if (k >= 4) {
                                s += '<a class="more" href="' + a[i].sURL + '">More&gt;</a><br />';
                                break;
                            }
                            s += '<a href="' + a[i].pChild[j].sURL + '">' + a[i].pChild[j].sName + '</a><br />';
                            k++;
                        }
                    }
					if('Artists'==a[i].sName){
                        s += '<a class="more" href="' + '/acatalog/a.html' + '">More&gt;</a><br />';
                    }
                    s += '</div>';
                }
            }
        }
    }
    return s;
}

function attachImageRotate() {
	SLIDES = new slideshow("SLIDES");
	var s = new slide();
	s.src =  "/acatalog/welcome1.jpg";
	SLIDES.add_slide(s);
	s = new slide();
	s.src =  "/acatalog/welcome2.jpg";
	SLIDES.add_slide(s);
	s = new slide();
	s.src =  "/acatalog/welcome3.jpg";
	SLIDES.add_slide(s);
	s = new slide();
	s.src =  "/acatalog/welcome4.jpg";
	SLIDES.add_slide(s);
	s = new slide();
	s.src =  "/acatalog/welcome5.jpg";
	SLIDES.add_slide(s);
	s = new slide();
	s.src =  "/acatalog/welcome6.jpg";
	SLIDES.add_slide(s);
	SLIDES.image = document.images.sls1;
	SLIDES.update();
    SLIDES.play();
}
function topBanner(e,t) {
	if(!e||!t||t.length<1||($('#'+e)==null))return;
	$('#'+e).css('width','340px').css('color','#ffffff').css('font-weight','bold').css('background','white url(/acatalog/intadbg.gif) no-repeat center left').text(t).show();
}
function createRequestObject() {
    var ro;
    var browser = navigator.appName;
    if(browser == "Microsoft Internet Explorer"){
        ro = new ActiveXObject("Microsoft.XMLHTTP");
    }else{
        ro = new XMLHttpRequest();
    }
    return ro;
}
var http = createRequestObject();
function showEnlarged() {
    http.open('get', 'pong.htm');
    http.onreadystatechange = handleResponse;
    http.send(null);
}
function handleResponse() {
    if(http.readyState == 4){
        var response = http.responseText;
		document.getElementById("prodfocusCenter").innerHTML = response;
    }
}
// /images/636_547_000/none/310/70-27-M/50-20-M/SPT8349.jpg
function showProductFocus2(e,img) {
	var src=$(e).attr("src");
	var re=new RegExp('^(\\/images\\/[^\\/]+\\/[^\\/]+)\\/(\\d+)\\/(.*)$');
	if(src.match(re)){
		img = src.match(re)[1] + '/' + 700 + '/' + src.match(re)[3];
	}
	re=new RegExp('^(\\/imagesp2a\\/[^\\/]+\\/[^\\/]+)\\/(\\d+)\\/(.*)$');
	if(src.match(re)){
		img = src.match(re)[1] + '/' + 700 + '/' + src.match(re)[3];
	}
	showProductFocus(img);
}
function showProductScale2(e,img,width,height) {
	var src=$(e).attr("src");
	var re=new RegExp('^(\\/images\\/[^\\/]+\\/[^\\/]+)\\/(\\d+)\\/(.*)$');
	if(src.match(re)){
		img = src.match(re)[1] + '/' + 700 + '/' + src.match(re)[3];
	}
	re=new RegExp('^(\\/imagesp2a\\/[^\\/]+\\/[^\\/]+)\\/(\\d+)\\/(.*)$');
	if(src.match(re)){
		img = src.match(re)[1] + '/' + 700 + '/' + src.match(re)[3];
	}
	var extsize=0;
	if(typeof(FrameWizard)==='object'){
		extsize=parseInt(FrameWizard.getCurrentFrameExtent());
	}
	showProductScale(img,parseInt(width)+extsize,parseInt(height)+extsize);
}
function showProductFocus(img) {
	if (img!=null) {
		if (document.body){
			document.getElementById("prodfocusBG").style.height = (document.body.scrollHeight > screen.availHeight) ? document.body.scrollHeight : screen.availHeight;
			document.getElementById("prodfocusBG").style.width = screen.availWidth;
		}
		var note='Please note that all images will be supplied to you without watermarks';
		var s = '<table border="0" cellspacing="0" cellpadding="10" class="enlarged" onclick="showProductFocus(null);">';
        s+= '<tr><td><span class="note">'+note+'</span></td></tr>';
        s+= '<tr><td><img onclick="showProductFocus(null);" src="'+img+'" alt=""/></td></tr>';
		s+= '<tr><td><span class="note">'+note+'</span><input name="close" type="button" onclick="showProductFocus(null);" value="close" class="button" /></td></tr>';
        s+= '</table>';
		document.getElementById("prodfocusCenter").innerHTML = s;
		document.getElementById("prodfocusBG").style.visibility = "visible";
		document.getElementById("prodfocus").style.visibility = "visible";
		$('#prodfocusBG').show("normal");
		$('#prodfocusBG').css('filter','alpha(opacity=90)');
		$('#prodfocus').show("normal");
	}
	else {
		$('#prodfocusBG').hide("fast");
		$('#prodfocus').hide("fast");
		document.getElementById("prodfocus").style.visibility = "hidden";
		document.getElementById("prodfocusBG").style.visibility = "hidden";
		document.getElementById("prodfocusCenter").innerHTML = "";
	}
}

function showProductScale(img,width,height) {
	if (img!=null) {
		if (document.body)
			document.getElementById("prodfocusBG").style.height = screen.availHeight;
		var refimg = "scalecomp.gif", pvh=600, pvw=600, pvm=35;
		var refheight = 200;
		var refimgheight = refheight * (pvh-(2*pvm))/(refheight+parseInt(height));
		var artimgheight = height * (pvh-(2*pvm))/(refheight+parseInt(height));
		var note='Please note that all images will be supplied to you without watermarks';
		var s = '<div class="scaleview" style="width:'+pvw+'px;height:auto;"><span class=\"note\">'+note+'</span><div class="inner">';
		s+= '<div class="image"><img src="'+img+'" alt="" onclick="showProductScale(null);" /></div>';
		s+= '<div class="comp"><img src="'+refimg+'" alt="" onclick="showProductScale(null);" /></div>';
		s+= '</div><span class="note">'+note+'</span><input name="close" type="button" onclick="showProductScale(null);" value="close" class="button" /></div>';
		document.getElementById("prodfocusCenter").innerHTML = s;
		$('#prodfocusCenter').find('div.image').find('img').css('height',artimgheight + 'px');
		$('#prodfocusCenter').find('div.comp').find('img').css('height',refimgheight + 'px');
		document.getElementById("prodfocusBG").style.visibility = "visible";
		document.getElementById("prodfocus").style.visibility = "visible";
		$('#prodfocusBG').show("normal");
		$('#prodfocusBG').css('filter','alpha(opacity=90)');
		$('#prodfocus').show("normal");
	}
	else {
		$('#prodfocusBG').hide("fast");
		$('#prodfocus').hide("fast");
		document.getElementById("prodfocus").style.visibility = "hidden";
		document.getElementById("prodfocusBG").style.visibility = "hidden";
		document.getElementById("prodfocusCenter").innerHTML = "";
	}
}


function ProductInfo(t,wm,hm,wi,hi,af,al,thmb,imgspec,lrg,metr){
	this.nImageMaxWidth = 160;
	this.nImageMaxHeight = 160;
	this.sProductTitle = t;
	this.nWidthMetric = (wm!=null&&!isNaN(wm)) ? parseInt(wm) : 0;
	this.nHeigthMetric = (hm!=null&&!isNaN(hm)) ? parseInt(hm) : 0;
	this.nWidthImperial = (wi!=null&&!isNaN(wi)) ? parseInt(wi) : 0;
	this.nHeightImperial = (hi!=null&&!isNaN(hi)) ? parseInt(hi) : 0;
	if(this.nWidthMetric==0&&this.nWidthImperial>0){
		this.nWidthMetric=Math.round(this.nWidthImperial*25.4)/10;
		this.nHeigthMetric=Math.round(this.nWidthImperial*25.4)/10;
	}
	if(this.nWidthMetric>0&&this.nWidthImperial==0){
		this.nWidthImperial=Math.round(this.nWidthMetric*10/2.54)/10;
		this.nHeightImperial=Math.round(this.nHeigthMetric*10/2.54)/10;
	}
	this.sAuthorFirst = (af!=null) ? af.toLowerCase().replace(/\b([a-z])/g,function($0){return $0.toUpperCase()}) : null;
	this.sAuthorLast = (al!=null) ? al.toLowerCase().replace(/\b([a-z])/g,function($0){return $0.toUpperCase()}) : null;
	this.sImageSpec = imgspec;
	this.sThumbnailSpec = (thmb!=null&&thmb.length>0) ? ('<img src="'+thmb+'" alt="'+this.sProductTitle+'" />') : ProductInfoFnRescaleImageSpec(imgspec,this.nImageMaxWidth,this.nImageMaxHeight);
	this.sFullsizeImageSpec = (lrg!=null&&lrg.length>0) ? ('<img src="'+lrg+'" alt="'+this.sProductTitle+'" />') : imgspec;
}
function ProductInfoFnRescaleImageSpec(spec,w,h){
	var re=new RegExp('^<img src="([^"]+)"\\s+alt="([^"]+)"\\s+class="([^"]+)"\\s+border=[0-9]+\\s+height=([0-9]+)\\s+width=([0-9]+).*', "i");
	if(spec.match(re)){
		var osrc = spec.match(re)[1];
		var oalt = spec.match(re)[2];
		var oheight = parseInt(spec.match(re)[4]);
		var owidth = parseInt(spec.match(re)[5]);
		var style = null;
		if(owidth>w||oheight>h){
			var pctg=((owidth-w)>(oheight-h)) ? parseInt((w*100)/owidth) : parseInt((h*100)/oheight);
			var s = '<img src="'+osrc+'" alt="'+oalt+'"';
			s += ' width="' + parseInt(owidth*(pctg/100)) + '"';
			s += ' height="' + parseInt(oheight*(pctg/100)) + '"';
			s += ' border="0" />';
			return s;
			//return '<img src="'+osrc+'" alt="'+oalt+'" style="width:'+pctg+'%;border:'+0+'%" />';
		}
	}
	return spec;
}
function ProductInfoFnGetDimensions() {
	var mtr = (this.nWidthMetric>0) ? (this.nWidthMetric+' x '+this.nHeigthMetric+' cm') : null;
	var imp = (this.nWidthImperial>0) ? (this.nWidthImperial+'" x '+this.nHeightImperial+'"') : null;
	if(true){
		return (mtr!=null&&imp!=null) ? (mtr + ' (' + imp + ')') : ((mtr!=null) ? mtr : ((imp!=null) ? imp : ''));
	}else{
		return (mtr!=null&&imp!=null) ? (imp + ' (' + mtr + ')') : ((mtr!=null) ? mtr : ((imp!=null) ? imp : ''));
	}
}
function ProductInfoFnGetAuthor() {
	return (this.sAuthorFirst==null&&this.sAuthorLast==null) ? 'Unkown Author' : (this.sAuthorFirst+' '+this.sAuthorLast);
}
function ProductInfoFnGetByLine() {
	return 'by ' + this.getAuthor();
}
ProductInfo.prototype.rescaleImageSpec=ProductInfoFnRescaleImageSpec;
ProductInfo.prototype.getDimensions=ProductInfoFnGetDimensions;
ProductInfo.prototype.getAuthor=ProductInfoFnGetAuthor;
ProductInfo.prototype.getByLine=ProductInfoFnGetByLine;




function slide(src,link,text,target,attr) {
  this.src = src;
  this.link = link;
  this.text = text;
  this.target = target;
  this.attr = attr;
  if (document.images) {
    this.image = new Image();
  }
  this.loaded = false;
  this.load = function() {
    if (!document.images) { return; }

    if (!this.loaded) {
      this.image.src = this.src;
      this.loaded = true;
    }
  }

  this.hotlink = function() {
    var mywindow;
    if (!this.link) return;
    if (this.target) {
      if (this.attr) {
        mywindow = window.open(this.link, this.target, this.attr);
      } else {
        mywindow = window.open(this.link, this.target);
      }
      if (mywindow && mywindow.focus) mywindow.focus();

    } else {
      location.href = this.link;
    }
  }
}

function slideshow( slideshowname ) {
  this.name = slideshowname;
  this.repeat = true;
  this.prefetch = -1;
  this.image;
  this.textid;
  this.textarea;
  this.timeout = 6000;
  this.slides = new Array();
  this.current = 0;
  this.timeoutid = 0;
  this.add_slide = function(slide) {
    var i = this.slides.length;
    if (this.prefetch == -1) {
      slide.load();
    }

    this.slides[i] = slide;
  }

  this.play = function(timeout) {
    this.pause();
    if (timeout) {
      this.timeout = timeout;
    }
    if (typeof this.slides[ this.current ].timeout != 'undefined') {
      timeout = this.slides[ this.current ].timeout;
    } else {
      timeout = this.timeout;
    }
    this.timeoutid = setTimeout( this.name + ".loop()", timeout);
  }
  this.pause = function() {
    if (this.timeoutid != 0) {
      clearTimeout(this.timeoutid);
      this.timeoutid = 0;

    }
  }
  this.update = function() {
    if (! this.valid_image()) { return; }
    if (typeof this.pre_update_hook == 'function') {
      this.pre_update_hook();
    }
    var slide = this.slides[ this.current ];
    var dofilter = false;
    if (this.image &&
        typeof this.image.filters != 'undefined' &&
        typeof this.image.filters[0] != 'undefined') {
      dofilter = true;
    }
    slide.load();
    if (dofilter) {
      if (slide.filter &&
          this.image.style &&
          this.image.style.filter) {

        this.image.style.filter = slide.filter;

      }
      this.image.filters[0].Apply();
    }
    this.image.src = slide.image.src;
    if (dofilter) {
      this.image.filters[0].Play();
    }
    this.display_text();
    if (typeof this.post_update_hook == 'function') {
      this.post_update_hook();
    }
    if (this.prefetch > 0) {
      var next, prev, count;
      next = this.current;
      prev = this.current;
      count = 0;
      do {
        if (++next >= this.slides.length) next = 0;
        if (--prev < 0) prev = this.slides.length - 1;
        this.slides[next].load();
        this.slides[prev].load();
      } while (++count < this.prefetch);
    }
  }

  this.goto_slide = function(n) {
    if (n == -1) {
      n = this.slides.length - 1;
    }
  
    if (n < this.slides.length && n >= 0) {
      this.current = n;
    }
  
    this.update();
  }
  this.goto_random_slide = function(include_current) {
    var i;
    if (this.slides.length > 1) {
      do {
        i = Math.floor(Math.random()*this.slides.length);
      } while (i == this.current);
 
      // Display the slide
      this.goto_slide(i);
    }
  }
  this.next = function() {
    if (this.current < this.slides.length - 1) {
      this.current++;
    } else if (this.repeat) {
      this.current = 0;
    }

    this.update();
  }
  this.previous = function() {
    if (this.current > 0) {
      this.current--;
    } else if (this.repeat) {
      this.current = this.slides.length - 1;
    }
  
    this.update();
  }
  this.get_text = function() {
    return(this.slides[ this.current ].text);
  }
  this.get_all_text = function(before_slide, after_slide) {
    all_text = "";
    for (i=0; i < this.slides.length; i++) {
  
      slide = this.slides[i];
    
      if (slide.text) {
        all_text += before_slide + slide.text + after_slide;
      }
  
    }
  
    return(all_text);
  }

  this.display_text = function(text) {
  }
  this.hotlink = function() {
    this.slides[ this.current ].hotlink();
  }
  this.loop = function() {
    if (this.current < this.slides.length - 1) {
      next_slide = this.slides[this.current + 1];
      if (next_slide.image.complete == null || next_slide.image.complete) {
        this.next();
      }
    } else { 
      this.next();
    }
    this.play( );
  }


  this.valid_image = function() {
 
    if (!this.image)
    {
      return false;
    }
    else {
      return true;
    }
  }

  this.getElementById = function(element_id) {
    if (document.getElementById) {
      return document.getElementById(element_id);
    }
    else if (document.all) {
      return document.all[element_id];
    }
    else if (document.layers) {
      return document.layers[element_id];
    } else {
      return undefined;
    }
  }
}
