

function pageY(elem) {
// find the y (vertical, top) position of an element. Cmp. Resig : Pro Javascript Techniques
// if at the root element just get the current offset, else add the current offset and recurse upwards
	return elem.offsetParent ? elem.offsetTop + pageY(elem.offsetParent) : elem.offsetTop;
}

// cmp. http://members.aol.com/paypalhelper/simp0.html
function Dollar (val) {  // force to valid dollar amount
	var str,pos,rnd=0;
	if (val < .995) rnd = 1;  // for old Netscape browsers
	str = escape (val*1.0 + 0.005001 + rnd);  // float, round, escape
	pos = str.indexOf (".");
	if (pos > 0) str = str.substring (rnd, pos + 3);
	return str;
}
function ReadForm (obj1) { // process selects
	var i,j,amt=0,des="",obj,pos,tok,val;
	var ary = new Array ();
	if (obj1.baseamt) amt  = obj1.baseamt.value*1.0; // base amount
	if (obj1.basedes) des  = obj1.basedes.value;     // base description
	for (i=0; i<obj1.length; i++) {     // run entire form
		obj = obj1.elements[i];           // a form element
		if (obj.type == "select-one") {   // just get selects
			pos = obj.selectedIndex;        // which option selected
			val = obj.options[pos].value;   // selected value
			ary = val.split (" ");          // break apart
			for (j=0; j<ary.length; j++) {  // look at all items
				// first we do single character tokens...
				if (ary[j].length < 2) continue;
				tok = ary[j].substring (0,1); // first character
				val = ary[j].substring (1);   // get data
				if (tok == "@") amt = val * 1.0;
				if (tok == "+") amt = amt + val*1.0;
				if (tok == "%") amt = amt + (amt * val/100.0);
				// Now we do 3-character tokens...
				if (ary[j].length < 4) continue;
				tok = ary[j].substring (0,3); // first 3 chars
				val = ary[j].substring (3);   // get data
			}
			val = ary.join (" ");           // rebuild val with what's left
			
			if (obj.name == "on0" ||        // let these go where they want
				obj.name == "os0" ||
				obj.name == "on1" ||
				obj.name == "os1") continue;
			
			if (des.length == 0) {
				des = val;
			} else {
				des = des + ", " + val;
			}
		}
	}
	// Now summarize stuff we just processed, above
	obj1.item_name.value = des;
	obj1.amount.value = Dollar (amt);
	if (obj1.tot) obj1.tot.value = "$" + Dollar (amt);
}

/* 

  ================================================
  PVII Horizontal Gallery scripts  Copyright (c) 2006 Project Seven Development
  www.projectseven.com   Version: 1.0.9
  ================================================
  
*/
var txtBuy;

var p7gsiem=(navigator.appVersion.indexOf("MSIE 5")>-1&&navigator.userAgent.indexOf("Mac")>-1)?true:false;
var p7gsca, p7gsa=new Array(),p7gsplot=new Array(),p7gstmb = new Array();

function P7_setHGS(){ //v1.0.9 by PVII-www.projectseven.com
	var i,d='',tA;
	var h="<sty"+"le type=\"text/css\">";
	if(!document.getElementById){return;}
	tA=navigator.userAgent.toLowerCase();
	if(window.opera){
		if(tA.indexOf("opera 5")>-1 || tA.indexOf("opera 6")>-1){return;}
	}
	h+="#p7GS{visibility:hidden;}";
	h+="<"+"/sty"+"le>";
	document.write(h);
}

P7_setHGS();

function P7_HGSinit(){ //v1.0.9 by PVII-www.projectseven.com
	var i,x,s,vp,sc,ul,li,h,hh=0,w,ww=0,uw,n,nn,im,a,nv,hv,bh,bw,ed,eh,ew,cv,j,kw,tA;
	if(!document.getElementById){return;}
	tA=navigator.userAgent.toLowerCase();
	if(window.opera){
		if(tA.indexOf("opera 5")>-1 || tA.indexOf("opera 6")>-1){return;}
	}
	p7gsa=arguments;
	if(p7gsiem||tA.indexOf('scape6/6')>-1){p7gsa[1]=0;}
	vp=document.getElementById('p7GSvp');
	sc=document.getElementById('p7GSsc');
	li=sc.getElementsByTagName('LI');
	im=sc.getElementsByTagName('IMG');
	for(i=0;i<im.length;i++){im[i].style.display='block';}
	for(i=0;i<li.length;i++){
		li[i].style.position='absolute';
		h=li[i].offsetHeight;
		w=li[i].offsetWidth;
		hh=(h>hh)?h:hh;
		ww=(w>ww)?w:ww;
	}
	for(i=0;i<li.length;i++){
		li[i].style.height=hh+'px';
		li[i].style.width=ww+'px';
	}
	for(i=0;i<li.length;i++){
		h=li[i].offsetHeight;
		w=li[i].offsetWidth;
		if(h>hh){
			n=hh-(h-hh);
			li[i].style.height=n+'px';
		}
		if(w>ww){
			n=ww-(w-ww);
			li[i].style.width=n+'px';
		}
	}
	ul=sc.getElementsByTagName('UL');
	ww=0;
	for(i=0;i<ul.length;i++){
		li=ul[i].getElementsByTagName('LI');	
		kw=0;
		for(j=0;j<li.length;j++){
			w=li[j].offsetWidth;
			h=li[j].offsetHeight;
			li[j].style.left=kw+'px';
			kw+=w;
			ww=(kw>ww)?kw:ww;
		}
		ul[i].style.position='relative';
		ul[i].style.height=h+'px';
	}
/*	if(ul.length==1){ TE : show even if no thumb navigators
		document.getElementById('p7GSnv').style.display='none'; 
	}*/
	sc.style.position='absolute';
	sc.style.top='0px';
	sc.style.left='0px';
	vp.style.height=h+'px';
	vp.style.width=ww+'px';
	vp.style.overflow='hidden';
	if(p7gsa[0]==1){
		li=sc.getElementsByTagName('LI');
		for(i=0;i<li.length;i++){
			im=li[i].getElementsByTagName('IMG')[0];
			h=im.offsetHeight;
			w=im.offsetWidth;
			hh=parseInt(li[i].style.height);
			ww=parseInt(li[i].style.width);
			n=parseInt((hh-h)/2);
			nn=parseInt((ww-w)/2);
			if(n>0){im.style.marginTop=n+'px';}
			if(nn>0){im.style.marginLeft=nn+'px';}
		}
	}
	document.p7gspre=new Array();
	a=sc.getElementsByTagName('A');
	x=0;
	for(i=0;i<a.length;i++){
		if(a[i].parentNode.nodeName=='LI'){
			a[i].onmouseover=function(){P7_HGSover(this);};
			a[i].onfocus=function(){P7_HGSover(this);};
			a[i].onmouseout=function(){P7_HGSout(this);};
			a[i].onclick= function(){return P7_HGSshow(this);};
			document.p7gspre[x]=new Image();
			document.p7gspre[x].cmp=false;
			document.p7gspre[x].onload=function (){this.cmp=true;};
			a[i].p7gsindex=x;
			p7gstmb[x]=a[i];
			x++;
		}
	}
	nv=document.getElementById('p7GSnv'); // horizontal bar with logo, thumbnail panel and font-size selection
	x=0;
	if(nv){
		hv=""//	nv.innerHTML;		TE
		ul=sc.getElementsByTagName('UL');

		for(i=0;i<ul.length;i++){
			s=(i==0)?'':' <span>|</span> ';
			x=i+1;
			hv+=s+'<a id="p7gsn'+x+'" href="javascript:;" title="View Thumbnail Panel '+x+'">'+x+'</a>';
		}
		hv+=nv.innerHTML;	// TE
		//nv.innerHTML=hv;
		// add transparent gif to make backround image (logo) act as link to default.htm. Use onclick to avoid another a tag
		nv.innerHTML = "<img title=\"Page One\" src=\"images/pix_clear.gif\" border=\"0\" width=\"200\" height=\"16\" style=\"position:absolute;left:5px;cursor:pointer\" onclick=\"location.href='default.htm'\" />" + hv;
		a=nv.getElementsByTagName('A');
		for(i=0;i<a.length;i++){
			a[i].onclick= function(){return P7_HGSnvs(this);};
		}
		if (ul.length == 1) document.getElementById("p7gsn1").style.display = "none";	// TE : hide thumb number

	}
	document.getElementById('p7GS').style.visibility="visible";
	h=p7gsa[4];
	if(!P7_HGSurl()){
		if(h>0){P7_HGStrig(h-1,9);}
	}
	
	P7_MarkCurrent();
	
	
}
function P7_HGSover(a){ //v1.0.9 by PVII-www.projectseven.com
	var im=a.getElementsByTagName('IMG')[0];
	if(im.className!='p7GSon'){im.className='p7GSover';}
}
function P7_HGSout(a){ //v1.0.9 by PVII-www.projectseven.com
	var im=a.getElementsByTagName('IMG')[0];
	if(im.className!='p7GSon'){im.className='';}
}
function P7_HGSnvs(a,g){ //v1.0.9 by PVII-www.projectseven.com
	var p,ta;
	p=parseInt(a.id.replace('p7gsn',''));
	g=(g)?g:0;
	ta=document.getElementById('p7GSnv').getElementsByTagName('A');
	for(i=0;i<ta.length;i++){
		if(ta[i].className){
			ta[i].className='';
		}
	}
	a.className='p7GSnvon';
	P7_HGSmove(p,g);
	return false;
}
function P7_HGSmove(p,g){ //v1.0.9 by PVII-www.projectseven.com
	var i,h,sc,t,c,m;
	sc=document.getElementById('p7GSsc');
	h=sc.getElementsByTagName('LI')[0].offsetHeight;
	t=((h*p)-h)*-1;
	c=parseInt(sc.style.top);
	c=(c)?c:0;
	m=(c<t)?1:0;
	P7_HGSvon();
	if(p7gsa[5]==1&&g!=9&&g!=6){
		P7_HGSscr(t,m);
	}else{
		sc.style.top=t+'px';P7_HGSvoff();
	}
}
function P7_HGSvoff(){ //v1.0.9 by PVII-www.projectseven.com
	var i,j,ul,m=false;
	ta=document.getElementById('p7GSnv').getElementsByTagName('A');
	for(i=0;i<ta.length;i++){
		if(ta[i].className=='p7GSnvon'){
			m=true;
			break;
		}
	}
	if(m){
		ul=document.getElementById('p7GSsc').getElementsByTagName('UL');
		for(j=0;j<ul.length;j++){
			if(j==i){
				ul[j].style.visibility='visible';
			}else{
				ul[j].style.visibility='hidden';
			}
		}
	}
}
function P7_HGSvon(){ //v1.0.9 by PVII-www.projectseven.com
	var i,ul=document.getElementById('p7GSsc').getElementsByTagName('UL');
	for(i=0;i<ul.length;i++){
		ul[i].style.visibility='visible';
	}
}
function P7_HGSscr(t,m){ //v1.0.9 by PVII-www.projectseven.com
	var d,r,y=30;
	d=document.getElementById('p7GSsc');
	c=parseInt(d.style.top);
	r=P7_HGSrate(c,t);
	c+=(m==1)?r:r*-1;
	if(m==1){
		c=(c>=t)?t:c;
	}else{
		c=(c<=t)?t:c;
	}
	d.style.top=c+"px";
	if(c!=t){
		d.p7hgsan=setTimeout("P7_HGSscr("+t+","+m+")",y);
	}else{
		P7_HGSvoff();
	}
}
function P7_HGSrate(c,t){ //v1.0.9 by PVII-www.projectseven.com
	var tt=Math.abs(t-c),
	i=parseInt(tt*.08);
	i=(i<=20)?20:i;
	return i;
}
function P7_HGStrig(n,ug){ //v1.0.9 by PVII-www.projectseven.com
	var i,sc,a,f;
	ug=(ug)?ug:0;
	a=p7gstmb[n];
	if(a){
		P7_HGStrigp(a,ug);
		f=P7_HGSshow(a,ug);
	}
}
function P7_HGStrigp(a,ug){ //v1.0.9 by PVII-www.projectseven.com
	var i,nv,ul,pp,f;
	nv=document.getElementById('p7GSnv').getElementsByTagName('A');
	ul=document.getElementById('p7GSsc').getElementsByTagName('UL');
	pp=a.parentNode;
	while(pp){
		if(pp.nodeName=='UL'){break;}
		pp=pp.parentNode;
	}
	for(i=0;i<ul.length;i++){
		if(ul[i]==pp){break;}
	}
	f=P7_HGSnvs(nv[i],ug);
}
function P7_HGSurl(){ //v1.0.9 by PVII-www.projectseven.com
	var i,h,s,x,m=false,p='pic';
	if(document.getElementById){
		h=document.location.search;
		if(h){
			h=h.replace('?','');
			s=h.split('=');
			if(s&&s.length){
				for(i=0;i<s.length;i+=2){
					if(s[i]==p){
						x=parseInt(s[i+1]);
						if(x){
							P7_HGStrig(x,9);
							m=true;
							break;
						}
					}
				}
			}
		}
		h=document.location.hash;
		if(h){
			x=parseInt(h.substring(1,h.length));
			if(x&&x>0){
				m=true;
			}
		}
	}
	if(m){
		x--;
		P7_HGStrig(x,9);
		return m;
	}
}
function P7_HGSshow(a,ug){ //v1.0.9 by PVII-www.projectseven.com
	var i,ti,im,fM,pM,dM,cM,dD,ds,h,w;
	ug=(ug)?ug:0;
	im=a.getElementsByTagName('IMG')[0];
	ti=document.getElementById('p7GSvp').getElementsByTagName('IMG');
	if(p7gsca){
		if(p7gsca==a){
			return false;
		}
	}
	for(i=0;i<ti.length;i++){
		ti[i].className='';
	}
	im.className='p7GSon';
	dM=document.getElementById('p7GSfs');
	fM=dM.getElementsByTagName('IMG')[0];
	pM=document.p7gspre[a.p7gsindex];
	if(document.p7gswait){
		clearTimeout(document.p7gswait);
	}
	p7gsca=a;
	if(!pM.cmp){
		P7_GSpbs(fM);
		pM.src=a.href;
		P7_GSwait(a.p7gsindex,ug);
	}else{
		P7_GSfin(pM,ug);
	}
	return false;
}
function P7_GSpbs(im,ug){ //v1.0.9 by PVII-www.projectseven.com
	var i,l,t,p,pb,pw,ph,ih,iw;
	pb=document.getElementById('p7GSpb');
	pw=pb.offsetWidth;
	ph=pb.offsetHeight;
	if(im){
		ih=(p7gsiem)?im.height:im.offsetHeight;
		iw=(p7gsiem)?im.width:im.offsetWidth;
		t=(ih-ph)/2;
		l=(iw-pw)/2;
		p=P7_getPos(im);
		l+=p[0];
		t+=p[1];
		pb.style.left=l+'px';
		pb.style.top=t+'px';
		pb.style.visibility="visible";
	}
}
function P7_getPos(im){ //v1.0.9 by PVII-www.projectseven.com
	 var p,pp,l=0,t=0,r=new Array(2);
	 pp=im;
	 while(pp){
		 l+=(pp.offsetLeft)?pp.offsetLeft:0;
	 	t+=(pp.offsetTop)?pp.offsetTop:0;
		if(window.opera||navigator.userAgent.indexOf("Safari")>-1){
	 		if(pp.nodeName=="BODY"){
				l-=(pp.offsetLeft)?pp.offsetLeft:0;
				t-=(pp.offsetTop)?pp.offsetTop:0;
			}
		}
	 	pp=pp.offsetParent;
	}
	if(p7gsiem){
		l+=parseInt(document.body.currentStyle.marginLeft);
	 	t+=parseInt(document.body.currentStyle.marginTop);
	}
	r[0]=l;
	r[1]=t;
	return r;
}
function P7_GSwait(ix,ug){ //v1.0.9 by PVII-www.projectseven.com
	var im=document.p7gspre[ix];
	if(im.cmp || (!document.all&&im.height>1)){
		im.cmp=true;
		document.getElementById('p7GSpb').style.visibility='hidden';
		P7_GSfin(im,ug);
	}else{
		document.p7gswait=setTimeout("P7_GSwait("+ix+","+ug+")",200);
	}
}
function P7_GSfin(im,ug){ //v1.0.9 by PVII-www.projectseven.com
	// im.src = abs path, large image source
	var dM,fM,cM,aL,cD,ds,dT='',tH='',aC,fS,an,st='',h,h1,h2,ti,ci,ct,cn;
	var aS;
	an=p7gsa[1];
	if(an>0){
		st=' style="visibility:hidden"';
	}
	fS=document.getElementById('p7GSfs');
	dM=document.getElementById('p7GSfs');
	fM=dM.getElementsByTagName('IMG')[0];
	tB=p7gsca.getElementsByTagName('IMG')[0];
	tH+='<table class="p7GSfst" align="center" cellpadding="0" cellspacing="0">';
	aL=tB.getAttribute("alt");	// picture title
	aS=tB.getAttribute("src");	// picture src
	var img = new Image();
	img.src = aS;
	var height = img.height;
	var width = parseInt(18*(img.width/height));
	var topmargin = parseInt((160 - height)/2)
	
	// by TE :
	//var title = aL.substr(aL.indexOf(":") + 2); only if pict title preceded by section + : 
	var title = aL;
	txtBuy = "<div id='wraporder'><img id='pictdelete' onclick='hideSHOP()' title='close this window' src='images/delete_32.png'>"
	txtBuy += "<div id='orderphotocontain'><img id='orderphoto' src='" + aS + "' style='margin-top:" + topmargin + "px'></div>"
	txtBuy += "<h3>" + title + "</h3>"
	txtBuy += "<h5>This picture is available as:</h5>"
	txtBuy += "<ul><li>signed trial print (5X7 - postcard size) 300g/m<sup>2</sup> archival photo rag paper.<br /><strong>$5 only - try before you buy</strong></li>"
	txtBuy += "<li>signed, numbered edition on 13x19 (A3+) 300g/m<sup>2</sup> archival photo rag paper.</li>"
	txtBuy += "<li>signed, numbered edition on 16x23 (A2) 300g/m<sup>2</sup> archival photo rag paper.</li>"
	txtBuy += "<li>framing and other sizes are available on <a href='mailto:terje@enge.no?subject=anotherImage%20Web%20request'>request</a></li></ul>";
	//txtBuy += "<p style='margin-top:2em;'><a href='http://www.paypal.com' target='_blank'><img src='images/paypal_32.png'></a>All payments are via <a href='http://www.paypal.com' target='_blank'>Paypal</a> - both easy and secure. Paypal accepts creditcards.<br />Global shipping is included.</p>"
	txtBuy += "<form target='paypal' action='https://www.paypal.com/cgi-bin/webscr' method='post' onsubmit='this.target = \"paypal\";ReadForm (this);'>"
	txtBuy += "<table border='0' margin='0' padding='0'><tbody>"
	txtBuy += "<tr><td align='left' colspan='3'>"
	txtBuy += "<div style='margin-left:10px;'><a href='http://www.paypal.com' target='_blank'><img src='images/paypal_32.png'></a>All payments are via <a href='http://www.paypal.com' target='_blank'>Paypal</a> - both easy and secure. Paypal accepts creditcards.<br />Global shipping is included.</div>"
	txtBuy += "</td></tr>"
	txtBuy += "<tr><td align='left'>"
	txtBuy += "<select id='selectSize'>"
  	txtBuy += "<option value='" + title + " - trial print(postcard -5X7) @5.00'>trial print (postcard - 5X7) - $5</option>"
	txtBuy += "<option value='" + title + " - real print (A3+ -13X19&) @600.00'>real print (A3+ - 13X19) - $600</option>"
	txtBuy += "<option value='" + title + " - real print (A2 -16X23) @800.00'>real print (A2 - 16X23) - $800</option>"
	txtBuy += "</select>"
	txtBuy += "</td><td align='right'>"
	txtBuy += "<img alt='' border='0' src='https://www.paypal.com/en_US/i/scr/pixel.gif' width='1' height='1'>"
	//txtBuy = txtBuy + "<input type='hidden' name='baseamt' value='250.00' />"
	//txtBuy = txtBuy + "<input type='hidden' name='basedes' value='" + title + "' />"
	txtBuy += "<input type='hidden' name='add' value='1'>"
	txtBuy += "<input type='hidden' name='cmd' value='_cart'>"
	txtBuy += "<input type='hidden' name='business' value='terje@enge.no'>"
	txtBuy += "<input type='hidden' name='item_name' value='" + title + "'>"
	txtBuy += "<input type='hidden' name='amount' value='4000.00'>"
	txtBuy += "<input type='hidden' name='no_shipping' value='2'>"
	txtBuy += "<input type='hidden' name='return' value='http://www.anotherimage.com/default.htm'>"					//http://www.anotherimage.com/confirm
	txtBuy += "<input type='hidden' name='cancel_return' value='http://www.anotherimage.com/default.htm'>"		//http://www.anotherimage.com/cancel
	txtBuy += "<input type='hidden' name='cn' value='Comments:'>"
	txtBuy += "<input type='hidden' name='currency_code' value='USD'>"
	txtBuy += "<input type='hidden' name='lc' value='US'>"
	txtBuy += "<input type='hidden' name='bn' value='PP-ShopCartBF'>"
	txtBuy += "<input id='addcart' class='btnadd' type='submit' name='submit' value='Add to Cart'>"
	txtBuy += "</td><td align='right'>"
	txtBuy += "<input id='viewcart' class='btnview' type='button' name='cmdView' value='View Cart / Checkout' onclick='document.forms.viewcart.target=\"paypal\";document.forms.viewcart.submit ();return false;'>"
	txtBuy += "</td></tr>"
	txtBuy += "</tbody></table>"
	txtBuy += "</form>"
	txtBuy += "<div id='bottomline'>global shipping included&nbsp;&nbsp;&nbsp;&nbsp;payments secured by <a href='http://www.paypal.com' target='_blank'>paypal</a>&nbsp;&nbsp;&nbsp;&nbsp;satisfaction guaranteed</div>"
	txtBuy += "</div>"

	document.getElementById("shop").innerHTML = txtBuy;
	ci=P7GSgi();
	ci[4]+=1;
	ct=p7gstmb.length;
	cn='';
	if(p7gsa[7]==1){
		cn=' <span class="p7GScounter">('+ci[4]+' of '+ct+')</span>';
	}
	aC='<tr><td class="p7GSfsc"><p>'+aL+cn+'</p></td></tr>';	// caption above image
	ds=p7gsca.parentNode.getElementsByTagName('DIV');
	if(ds&&ds[0]){
		// Required: document.location.pathname | aL (pic title) | im.src (complete path of full-size image) | thumb url to show in dialog = tB.src | array which holds all mainpic URLs on this page (p7gstmb) joined with $ (to find the actual index on page (?pic=x)
		
		dT="<div id='actions'><div id='imgcaption'>" + ds[0].innerHTML + "</div>";		// ds[0].innerHTML = picture caption
		dT+="<div id='sharephotobtn'><a href='#sharephoto'>SHARE WITH FRIENDS</a></div>"
		dT+="<div id='sharephoto'><ul>"
		//dT+="<li class='mail_share_button'><a id='refer' href='#' onclick='showLightbox(\"" + im.src + "\", \"" + document.location.pathname + "\", \"" + aL + "\", \"" + tB.src + "\", \"" + p7gstmb.join("$") + "\");return false;' title='del med en venn'>&nbsp;&nbsp;Share with a friend</a></li>"
		dT+="<li class='mail_share_button'><a id='refer' href='#lightbox' rel='facebox' title='del med en venn'>&nbsp;&nbsp;Share with email</a></li>"
		dT+="<li class='fb_share_button'><a id='fb' href='#' onclick='return fbs_click()' title='del meg på Facebook'>&nbsp;&nbsp;Share on Facebook</a></li>"
		dT+="<li class='twtr_share_button'><a id='twtr' href='#' class='twtr_share_button' onclick='return twtr_click()' title='del meg på Twitter'>&nbsp;&nbsp;Share on Twitter</a></li>"
		dT+="<li class='gb_share_button'><a id='gb' href='#' class='gb_share_button' onclick='return googlebuzz_click()' title='del meg på Google Buzz'>&nbsp;&nbsp;Share on Google Buzz</a></li>"
		dT+="<li class='digg_share_button'><a id='digg' href='#' class='digg_share_button' onclick='return digg_click()' title='del meg på DIGG'>&nbsp;&nbsp;Share on Digg</a></li>"
		dT+="</ul></div>"
		//dT+="<div id='containfotomoto' title='select format, shop photography'></div>"
		//dT+="<div id='containfotomoto' title='select format, shop photography'><a class='btngray' href='#shop' rel='facebox'>FOTOMOTO PRINT<img src='" + aS + "' width='" + width + "' height='18'/></a></div>"
		dT+="<div id='containfotomoto' title='select format, order digital C-type prints via FotoMoto'><a class='btngray' href='#shop' rel='facebox'>UNSIGNED PRINT<img src='p7gs/images/fotomoto_16.png' width='16' height='16'/></a></div>"
		dT+="<div id='containorder' title='select format, order signed, hand-made ink-jet prints direct from me'><a class='btngray' href='#shop' rel='facebox'>SIGNED PRINT<img src='" + aS + "' width='" + width + "' height='18'/></a></div>"
		dT+="</div>";
	}
	if(p7gsa[2]==1){
		if(aL&&aL.length>0){
			tH+=aC;
		}
	}
	tH+='<tr><td class="p7GSfsi"><a href="#shop" rel="facebox"><img id="mainpic" src="' + im.src + '" alt="'+aL+'"'+st+'></a></td></tr>';
	if(p7gsa[2]==2){
		if(aL&&aL.length>0){
			tH+=aC;
		}
	}
	if(p7gsa[3]==1){
		if(dT.length>0){
			//tH+='<tr><td class="p7GSfsd">' + dT + txtBuy + '</td></tr>';	// dT =  image caption and shop symbol
			tH+='<tr><td class="p7GSfsd">' + dT + '</td></tr>';	// dT =  image caption and shop symbol
		}
	}
	tH+='</table>';
	dM.innerHTML=tH;
	if(fS){
		fS.style.display='block';
	}
	if(ug<7){
		if(an==1||an==2){
			P7_GSfan();
		}else if(an>2){
			P7_GSfie();
		}
	}else{
		document.getElementById('p7GSfs').getElementsByTagName('IMG')[0].style.visibility='visible';
	}
	
	initLightbox(0);
	fillRefer(im.src, document.location.pathname, aL, tB.src, p7gstmb.join("$"))
	// ************* JQuery Init:
	$("#sharephotobtn a").bind("click mouseenter", function(){	// click due to iPhone, iPad
		$("#sharephoto").slideToggle(400);
		return false;
	});
	$("#containorder a").click(function(){
		hideAll();
		$("#shop").css({
        //top:	pageY(document.getElementById("mainpic")) - 60,
		top:	getPageScroll()[1] + (getPageSize()[3]/9),	
        left:	getPageSize()[0]/2 - 336
      }).slideToggle(600);
		listenKey();	// Check for 'esc' keypress
		toggleSHOP();
		return false;
	});
	$("#mainpic").click(function(){
		hideAll();
		$("#shop").css({
        top:	getPageScroll()[1] + (getPageSize()[3]/9),
        left:	getPageSize()[0]/2 - 336
      }).slideToggle(600);
		listenKey();	// Check for 'esc' keypress
		toggleSHOP();
		return false;
	});
	$("#containfotomoto a").click(function(){
		FOTOMOTO.API.showWindow(100, aS);
		return false;
	});
	//FOTOMOTO.API.showWindow(100, aS)
	//FOTOMOTO.API.showToolbar(document.getElementById("containfotomoto"), aS)
}
function P7GSgi(){ //v1.0.9 by PVII-www.projectseven.com
 var i,x,a,gi=new Array();x=p7gstmb.length-1;for(i=0;i<p7gstmb.length;i++){
 if(p7gstmb[i]==p7gsca){break;}}gi[0]=0;gi[1]=(i>0)?i-1:0;gi[2]=(i<x)?i+1:x;gi[3]=x;gi[4]=i;return gi;
}
function P7_GSfie(){ //v1.0.9 by PVII-www.projectseven.com
	var i,d,im,f,ff,pim;
	var g=new Array();
	var an=p7gsa[1];
	im=document.getElementById('p7GSfs').getElementsByTagName('IMG')[0];
	pim=im.parentNode;
	if(!im.parentNode.filters){
		p7gsa[1]=1;
		P7_GSfan();
		return;
	}
	f='progid:DXImageTransform.Microsoft.';
	d=' Duration=1';
	g[0]='Fade';
	g[1]='Fade';
	g[2]='Fade';
	g[3]='Fade';
	g[4]='Iris(irisstyle="SQUARE", motion="in"'+d+')';
	g[5]='Iris(irisstyle="SQUARE", motion="out"'+d+')';
	g[6]='Iris(irisstyle="CIRCLE", motion="in"'+d+')';
	g[7]='Iris(irisstyle="CIRCLE", motion="out"'+d+')';
	g[8]='Blinds(direction="up", bands=1'+d+')';
	g[9]='Blinds(direction="down", bands=1'+d+')';
	g[10]='Blinds(direction="right", bands=1'+d+')';
	g[11]='Blinds(direction="left", bands=1'+d+')';
	g[12]='Blinds(direction="right"'+d+')';
	g[13]='Blinds(direction="down"'+d+')';
	g[14]='CheckerBoard(direction="right"'+d+')';
	g[15]='CheckerBoard(direction="down"'+d+')';
	g[16]='RandomDissolve('+d+')';
	g[17]='Barn(orientation="vertical", motion="in"'+d+')';
	g[18]='Barn(orientation="vertical", motion="out"'+d+')';
	g[19]='Barn(orientation="horizontal", motion="in"'+d+')'
	g[20]='Barn(orientation="horizontal", motion="out"'+d+')';
	g[21]='Strips(motion="leftdown"'+d+')';
	g[22]='Strips(motion="leftup"'+d+')';
	g[23]='Strips(motion="rightdown"'+d+')';
	g[24]='Strips(motion="rightup"'+d+')';
	g[25]='RandomBars(orientation="horizontal"'+d+')';
	g[26]='RandomBars(orientation="vertical"'+d+')';
	g[27]='Wipe(GradientSize=1.0, wipeStyle=0, motion="forward"'+d+')';
	g[28]='Inset()';
	g[29]='Pixelate(MaxSquare=50,Duration=1,Enabled=false'+d+')';
	g[30]='RadialWipe(wipeStyle="clock"'+d+')';
	g[31]='RadialWipe(wipeStyle="wedge"'+d+')';
	g[32]='RadialWipe(wipeStyle="radial"'+d+')';
	g[33]='Slide(slideStyle="PUSH", bands=1'+d+')';
	g[34]='Slide(slideStyle="SWAP", bands=5'+d+')';
	g[35]='Slide(slideStyle="HIDE", bands=2'+d+')';
	g[36]='Spiral(GridSizeX=16, GridSizeY=16'+d+')';
	g[37]='Stretch(stretchStyle="hide"'+d+')';
	g[38]='Stretch(stretchStyle="spin"'+d+')';
	g[39]='Stretch(stretchStyle="push"'+d+')';
	g[40]='Wheel(spokes=4'+d+')';
	g[41]='Wheel(spokes=16'+d+')';
	g[42]='zigzag(GridSizeX=8, GridSizeY=8'+d+')';
	an=(an>g.length)?3:an;
	f+=g[an];pim.style.filter=f;
	if(pim.filters.length<1){
		p7gsa[1]=1;
		P7_GSfan();
		return;
	}
	pim.filters[0].Apply();
	im.style.visibility='visible';
	pim.filters[0].Play();
}
function P7_GSfan(){ //v1.0.9 by PVII-www.projectseven.com
	var im,fh,fw,tB,tF,tL,l,t,dt,dl,df,fr,dn,pl,an,c=10,i,ih,iw,ih2,iw2,l2,t2,lm=false,tm=false,ch=c,cw=c;
	an=p7gsa[1];
	im=document.getElementById('p7GSfs').getElementsByTagName('IMG')[0];
	tF=P7_getPos(im);
	fh=im.offsetHeight;
	fw=im.offsetWidth;
	tB=p7gsca.getElementsByTagName('IMG')[0];
	tD=P7_getPos(tB);
	if(an==1){
		l=parseInt((tB.offsetWidth/2))-5+tD[0];
		t=parseInt((tB.offsetHeight/2))-5+tD[1];
	}else{
		l=parseInt((fw/2))-5+tF[0];
		t=parseInt((fh/2))-5+tF[1];
	}
	tL=document.getElementById('p7GSah');
	tL.innerHTML='<img src="'+im.src+'" height="'+c+'" width="'+c+'">';
	tL.style.left=l+'px';
	tL.style.top=t+'px';
	dt=tF[1]-t;
	dl=tF[0]-l;
	fr=20;
	p7gsplot.length=0;
	ih=fh-c;
	iw=fw-c;
	if(ih>iw){
		dn=parseInt(ih/fr)+1;
		ih2=fr;
		iw2=parseInt(iw/dn)+1;
	}else{
		dn=parseInt(iw/fr)+1;
		iw2=fr;
		ih2=parseInt(ih/dn)+1;
	}
	l2=parseInt( Math.abs(dl)/dn)+1;
	if(dl<0){
		l2=l2*-1;
		lm=true;
	}
	t2=parseInt( Math.abs(dt)/dn)+1;
	if(dt<0){
		t2=t2*-1;
		tm=true;
	}
	for(i=1;i<dn+1;i++){
		t+=t2;
		if(tm){
			t=(t<=tF[1])?tF[1]:t;
		}else{
			t=(t>=tF[1])?tF[1]:t;
		}
		l+=l2;
		if(lm){
			l=(l<=tF[0])?tF[0]:l;
		}else{
			l=(l>=tF[0])?tF[0]:l;
		}
		cw+=iw2;
		cw=(cw>=fw)?fw:cw;
		ch+=ih2;
		ch=(ch>=fh)?fh:ch;
		p7gsplot[i-1]=t+','+l+','+cw+','+ch;
	}
	tL.style.visibility="visible";
	P7_GSfanim(0);
}
function P7_GSfanim(p){ //v1.0.9 by PVII-www.projectseven.com
	var i,pl,dy=10;
	var tL=document.getElementById('p7GSah');
	var im=tL.getElementsByTagName('IMG')[0];
	if (p<p7gsplot.length) {
		pl=p7gsplot[p].split(',');
		tL.style.top=pl[0]+'px';
		tL.style.left=pl[1]+'px';
		im.style.width=pl[2]+'px';
		im.style.height=pl[3]+'px';
		p++;
		setTimeout("P7_GSfanim("+p+")",dy);
	} else {
		document.getElementById('p7GSfs').getElementsByTagName('IMG')[0].style.visibility='visible';
		tL.style.visibility='hidden';
	}
}
function P7_MarkCurrent(){ //PVII - mod by TE from p7popmenu: Mark current tab
 	var i,tA,pp,wH,tA,aU,r1,k=-1,kk=-1;
 	tA=document.getElementById('galNav').getElementsByTagName("A");
	wH=window.location.href;
	wH = (wH.indexOf("?") == -1) ? wH : wH.substring(0, wH.indexOf("?"));	// remove part after "?" if query exists
	r1=/index\.[\S]*/i;
	for (i = 0; i < tA.length; i++) {
 		if(tA[i].href){
			aU = tA[i].href.replace(r1,'');
			if(tA[i].href == wH || aU == wH) {
				k=i;kk=-1;
				break;
			}
		}
	}
	k=(kk>k)?kk:k;
 	if(k>-1){
		pp=tA[k].parentNode;
		while(pp){
			if(pp.nodeName=="LI"){
				pp.firstChild.className="current"+" "+pp.firstChild.className;
			}
 			pp=pp.parentNode;
		}
	}

}