/* easy peasy Template naming pragma
 * 
 * function_name__template_name
 * 
 */

var Templates = $H({});		


Templates.lightbox_new__body = new Template(
	'<div id="lightboxPopUp">'
	+'	<div class="barheader"><FONT class="bartitle">Make a new lightbox</font></div>'
	+'	<div id="lightboxPopUpbody"><form action="javascript:nada();" method="get" name="send"><p>Enter a name for your new lightbox in the box below </p>'
	+'		<p><INPUT type="text" name="lightbox_new_name" id="lightbox_new_name" size="15" class="emailbox" value="My new LB name" onfocus="if (this.value == \'My new LB name\'){ this.value=\'\';}">'
	+'		<A href="" onclick="lightbox_new_send(); return false;" class=lblink style="font-size: 10pt; font-weight:bold;">Create the Lightbox</A><BR><BR>'
	+'		Note:  You must enter a unique name for your new lighbox.  It will only be viewable by you unless you use the "E-mail this lightbox" function to share it with someone.<BR><BR>'
	+'		If you do not need a lightbox anymore click the link below.<br><br><A HREF="" onclick="lightbox_email(\'close\'); return false;">[X] close window</A>'
	+'	</div>' 
	+'</div>' 
);
		
Templates.lightbox_email__body = new Template(
	'<div id="lightboxPopUp">'
	+'	<div class="barheader"><FONT class="bartitle">Email your lightbox to a friend</font></div>'
	+'	<div id="lightboxPopUpbody">'
	+'		<form action="javascript:nada();" method="get" name="send"><p><B>E-mail your lightbox '
	+'"#{currentlbname}"</B> to a friend or colleague.</p><p><B>1.</B> Send To:<CODE>*</CODE></b></font><br><input type="text" name="to_email" id="to_email" size="35" class="emailbox" value="friend@domain.com" onfocus="if (this.value == \'friend@domain.com\') {this.value=\'\';}"><BR>'
	+'<BR><B>2.</B> Message:<BR><TEXTAREA NAME="mail_text" ID="mail_text" ROWS="8" COLS="35"></TEXTAREA><BR><BR><B>3.</B> <input type="checkbox" id="readonly" name="readonly" value=1> Read only<br/>'
	+'<B>4.</B> <input type="checkbox" name="notify" id="notify" value="1"><font class="small">Notify me when this lightbox is viewed</font><br>'
	+'#{emaillbaddhtml}<p><A href="" onclick="lightbox_email_send(); return false;" class=lblink style="font-size: 10pt;font-weight:bold;">Send the Lightbox</A>'
	+'<input type="hidden" name="ot" value="2"><input type="hidden" name="dsm" value="1"></center></form><br><p>If you have changed your mind, <A HREF="" onclick="lightbox_email(\'close\'); return false;">[X] close window</A>.'
	+'		</form>'
	+'	</div>' 
	+'</div>' 
);
		
Templates.lightbox_rename__body = new Template(
	'<div id="lightboxPopUp">'
	+'	<div class="barheader"><FONT class="bartitle">Rename lightbox</font></div>'
	+'	<div id="lightboxPopUpbody">'
	+'		<form action="javascript:nada();" method="get" name="send">'
	+'			<p><INPUT type="text" name="lightbox_new_name" id="lightbox_new_name" size="15" class="lightbox_new_name" value="#{currentlbname}" onfocus=" if (this.value == \'#{currentlbname}\'){ this.value=\'\';}">'
	+'			<A href="" onclick="lightbox_rename_send(); return false;" class=lblink style="font-size: 10pt; font-weight:bold;">Rename</A><br/>'
	+'			<br/><A HREF="" onclick="lightbox_email(\'close\'); return false;">[X] close window</A>'
	+'		</form>'
	+'	</div>' 
	+'</div>' 

	+'</form></DIV></TD></TR></TABLE>'
);

Templates.simplemessage__body = new Template(
	'<DIV class=light1 style="text-align:center; width:400px; height:100px; text-align:left; padding:10px; margin-top:200px"><FONT class="header">#{message}</DIV>'
);

Templates.simplemessage__body_lightbox = new Template(
	'<DIV class=light1 style="position:absolute; left:0px; bottom:0px; width:100%; height:30px; text-align:left; padding:10px 20px 10px 20px; margin-top:20px"><FONT class="header">#{message}</DIV>'
);

//this is the metadata layout for a popup
Templates.sp_act__metadata = new Template (
	'<span class="blah"># #{imageid} #{displayimageid} #{rmrftype} #{filesize} #{dimensions} :: #{shortcaption} #{photographer} #{imagerestrictions}'
	+'<br/>'
	+'<span class="warning"> To turn live previews off, use Previews menu at top of page </span>'
);

Templates.enlarge2_act__similars = new Template (
	'<TD valign="top" align="left" width="120" height="440">'
	+'<div style="position:relative; overflow: auto; overflow-y: auto; overflow-x: hidden; height:75%">'
	+"<B>Similar Images:</B><BR>"
	+'#{simcolinfo}'
	+'</div></TD>'
);
		
Templates.enlarge2_act__body = new Template (
	'<table cellspacing="0" cellpadding="0" border="0" width="99%" style="height:99%;overflow:auto">'
		+'<TR height="99%">'
			+'<TD align="left" valign="top" width="99%" height="99%" style="overflow:auto">'
				+'<table cellspacing="4" cellpadding="0" border="0" width="920" height="470" >'
				+'<TR><TD valign="top" align="left" width="430" height="440" style="min-width: 440px">'
					+'<div style="position:relative;margin-left:10px">#{themediainsert}</div>'
				+'<br/></td>'


				+'#{similarscolumn}'
				+'<TD align="left" valign="top" width="320">'
					+'#{navbacklinks}'
					+'#{navenlargedlinks}'
					+'<br/><a href="" onclick="lightbox_addto(\'#{enlargetid}\'); return false;"><img src="/graphics/icon_lightbox.gif" width=21 height=15 border=0 alt=""> ADD TO CURRENT LIGHTBOX </a>'
					+'<br/><a href="" onclick="license(\'#{enlargetid}\'); return false;" class="commercelink"><img src="/graphics/icon_price.gif" width=21 height=15 border=0 alt="" class="commercelink"> CHECK USAGE RATES</a>'
					+'<br/><a href="" onclick="cart_addto(\'#{enlargetid}\'); return false;" class="commercelink"><img src="/graphics/icon_cart.gif" width=21 height=15 border=0 alt="" class="commercelink"> ADD TO SHOPPING CART</a>'
					+'<br/>#{downloadcomplink}'
					+'<BR/><b>Image Number:</b> #{enlargetid}&nbsp;(#{displayenlargetid})&nbsp;[#{rmrftype}]'
					+'#{dimensions}'
					+'<br/><b>Caption:</b> #{myshortcaption}<br/>'
					+'#{releaseinfo}'
					+'#{photographerinfo}'
					+'#{filesizeinfo}'
					+'#{restrictionsinfo}'
					+'<BR/><A class="olink" id="enalarge_keywords_text" onclick="popkeys2(\'enlarge_keywords\', this); return false;">Show keywords</A><BR>'
					+'<div id="enlarge_keywords" style="display:none; overflow-y:auto;">'
					+'#{keywordinfo}'
					+'</div>'
				+'</td><TD rowspan=2 align="left" valign="top" style="padding-left:15px;">'
						+'#{ratetierinfo}'
				+'</TD></TR>'
				+'<tr><td>#{rfcdlinkslug}</td></tr>'
				+'</table>'


	+'<BR></td></TR></table>'
);

Templates.tieredimgpricing__rfslug = new Template (
        '<h4 style="text-align: left;">Select a File Size</h4>'+
        '<table style="text-align: left;width: 95%;" cellpadding=0 cellspacing=0>#{rows}</table>'
);

Templates.tieredimgpricing__rfslug_row = new Template (
        '<tr><td align="left" nowrap="nowrap" valign="top" style="padding-bottom: 4px; padding-top: 4px;border-bottom: solid #999 1px;">#{expr}</td><td align="right" valign=top style="border-bottom: solid #999 1px;padding-bottom: 4px; padding-top: 4px;">#{currency} #{price}<BR><nobr><A href="#" class=orangelink onclick="cart_addto(\'#{enlargetid}\', { ln:\'#{enlargetid}\', lictype:\'RF\', base:\'#{base}\', Size_opname:\'#{id}\', usage:\'#{usage}\'}); return false;">Add to Cart</a></nobr></td></tr>' );

Templates.tieredimgpricing__rrslug = new Template (
        '<div align="left"><IMG src=/graphics/h_RightsReady.gif border=0 alt="Royalty Free Licensing"></div>'+
        '<h4 style="text-align: left;">Select one or more uses below</h4>'+
        '<A href="/EULA/Blend_RM_RR_EULA.pdf" TITLE="View License Agreement as a pdf" class="orangelink" target="eula">View Rights Ready License Agreement (pdf file)</A><BR clear=all>'+
        '<table cellspacing=0 cellpadding=0 width="100%" >#{rows}</table>'
);
Templates.tieredimgpricing__rrslug_row = new Template (
        '<tr><td colspan=2><h2>#{name}<h2></td></tr>'+
        '<tr><td align=left style="border-bottom: 1px solid rgb(187, 187, 187);padding-bottom: 3px; padding-top: 4px;"><span><nobr><b>#{optname}</b></nobr></span><BR>'+
        '<div id="d#{id}"><a href="javascript:ShowOrHideComboText(\'d#{id}\', \'none\',\'e#{id}\'); ShowOrHideComboText(\'d#{id}2\', \'block\');" class="orangelink">Show Details</a></div>'+
        '  <div id="d#{id}2" style="display:none;"><a href="javascript:ShowOrHideComboText(\'d#{id}\', \'block\'); ShowOrHideComboText(\'d#{id}2\', \'none\');" class="orangelink">Hide Details</a>'+
        '<br />#{expr}<BR>'+
        '<div id="d#{id}e" style="display:none;"><a href="javascript:ShowOrHideComboText(\'d#{id}e\', \'none\'); ShowOrHideComboText(\'d#{id}e2\', \'block\');" class="orangelink">Show Examples</a></div>'+
        '  <div id="d#{id}e2" style="display:none;"><a href="javascript:ShowOrHideComboText(\'d#{id}e\', \'block\'); ShowOrHideComboText(\'d#{id}e2\', \'none\');" class="orangelink">Hide Examples</a>'+
        '  <div id="e#{id}">#{expr_extended}</div></div>'+
        '</div></td><td align=right valign=top style="border-bottom: 1px solid rgb(187, 187, 187);padding-bottom: 4px; padding-top: 4px;">'+
            '<div style="min-width: 50px; padding-right: 5px;">#{currency} #{price}</div> '+
            '<div style="min-width: 50px;">'+
                '#{removebutton}'+
                '<nobr><A href="#" onclick="cart_addto(\'#{enlargetid}\',{ \'ln\':\'#{enlargetid}\', \'lictype\':\'RR\', \'base\':\'#{price}\', \'Size_opname\':\'#{id}\', \'usage\':\'#{usage}\', \'callback\':\'enlarge2(#{img_id},#{encount},null,1);\' }); return false;" class="orangelink">Add to Cart</a></nobr>'+
            '</div>'+
        '</td></tr>'
);

Templates.tieredimgpricing__rrslug_row_removebutton = new Template (
        '<nobr><a href="#" class="orangelink" onclick="cart_delete_license(#{img_id},{ \'lictype\':\'RR\', \'usage\':#{usage}, \'opts\':#{id}, \'callback\':\'enlarge2(#{img_id},#{encount},null,1);\' }); return false;">Remove Option</a><nobr> &nbsp;&nbsp;'
);


Templates.hovercopyright__text = new Template (
	'&copy;#{currentyear} #{baseurl}  All rights reserved <a href=/help_login.shtml#Terms_and_Conditions class=disclaimer>Terms</a> <a href=/help_faq.shtml#Privacy_Policy class=disclaimer>Privacy policy</A> &nbsp;<A HREF=/contact.shtml class=disclaimer>contact</a></FONT></nobr>'
);

Templates.footer__body = new Template (
	'<DIV id="copyright"><span class="disclaimer"><A href="/aboutus_mission.shtml" onmouseover="hovercopyright();" class="disclaimer">&copy; #{currentyear} </A></span></DIV>'
);


function htmlit_custom(showid){
	// build html for each image depending on viewing mode
	var html='';
	switchpage = false;
	showfilesize = true;
	if (id[showid]){
		if(! viewmode || viewmode == null){
			viewmode='list'; // default to list view
		}

		var myrmrftype = rm[showid];
		myid = id[showid];
		if (typeof(suspendsimilars) == 'undefined'){
			mysimilarto=st[showid];
		} else { 
			mysimilarto='';
		}

		if(parseFloat(fs[showid]) > .5 ){
			var thumbsrc="http://globaldyn.ipnstock.com/dyn_images/135/50/" + myid + ".JPG";
			var previewsrc="http://globaldyn.ipnstock.com/dyn_images/420/60/" + myid + ".JPG";
		} else {
			// no image available custom
			var thumbsrc="/requires_scanning_small.JPG";
			var previewsrc="/requires_scanning_large.JPG";
		}

			
		if (typeof(scp) != 'undefined' && (viewmode == 'list' || viewmode == 'editing') ) {myshortcaption=unescape(scp[showid]);} else {myshortcaption = "n/a";}
		var temp = true;
		var tempshortcaption='';
		var myreleased = '';

		if (! relcon[showid])
			myreleased = rel[showid];

		if (typeof(relcon) != 'undefined' && relcon[showid] && mysimilarto.length < 13) {  //share control style..
			var shortrel = myreleased; ///( $('gRelease'+showid) && $('gRelease'+showid).value ) ? $('gRelease'+showid).value : myreleased;
			shortrel = shortrel.substring(0,16) + (myreleased.length > 16 ? '...' : '');


			myreleased = '<div id="shortrel'+showid+'">Release: '+shortrel+'</div> <div>  <form id="releasecontrol'+showid+'" > ' + relcon[showid] + ' <input type="hidden" name="shdex" value="'+showid+'"/></form> <a href="javascript: return false;" onclick="sor('+showid+'); return false;" >Save Release</a></div>';
		} 
		else if(showrelease){
			if(! ( myreleased == "MODEL RELEASED" || myreleased == "MODEL AND PROPERTY RELEASED" || myreleased == "PROPERTY RELEASED") ){
				myreleased = "Release: " + myreleased;
			}
			if (typeof(relcon) != 'undefined' && relcon[showid] && mysimilarto.length < 13)
				myreleased ='<br/>'+myreleased;

		} else { myreleased="";}
		//shorten long captions
		if(myshortcaption.length > 90){
			for(z=0; z < 130; z++){
				var c = myshortcaption.charAt(z);
				if(temp == true){
					if((z > 90) && (c == ".")){
						temp = false;
						tempshortcaption+=c + " ...";
					} else if((z > 110) && (c == " ")){
						temp = false;
						tempshortcaption+=" ...";
					} else {
						tempshortcaption+= c;
					}
				}
        		}
        		myshortcaption = tempshortcaption;
    		}
    		var thishassimilars = "yes";
		myphotographer=pho[showid];
		myrglobaldynf = rm[showid];
		myfilesize=fs[showid];
		var myhrdlink = hrdl[showid];

		var mysharestatuses = html_share_con_opts(showid);
		var mysiteweight = html_weight_con_opts(showid);
		var mycombinedcon = html_combined_con_opts(showid);

                var thisisacoverimage_feature = '';
                if(rfcd[showid].match(myid)) //myid is in the info for the link, hence this is the cover image
                {
                        var pm = unescape(rfcd[showid]).match(/SwishSearch\?n\=1\&fn\=(.*)\&supst\=cd/);
                        if(pm != null)
                                thisisacoverimage_feature = pm[1];
                }

		adminheight=0;
		if(myhrdlink){
                        if (viewmode != 'editing')
                                adminheight=11;
		} 
		if(myfilesize < 5){myfilesize='<span class=scanondemand>Scan on Demand</span>';} //else {myfilesize+=" Mb";}
		if(myid.length > 9){
			if ( o[showid] ){displayid=o[showid];} else {displayid=myid;}	
			if(viewmode == "editing"){
					var theight = 160 + adminheight;

					var sharesync = unescape(shsync[showid]);
					sharesync=sharesync.split('|');
					//so 0 is type, 1 is if it matchess
					var shbg = 'white';
					if (sharesync[0] == 'shared') {
							shbg = '#77BB33';
					} else if (sharesync[0].toString().match(/notshared|rejected/)) {
							shbg = '#DF0000';
					}
					var shbdr = 'white';
					if ( parseInt(sharesync[1]) )
					{
							shbdr = 'orange';
					}
					if ( mysimilarto.length < 13){

							html += '<span id="cellwrapper'+myid+'" valign=bottom style="float:left;background-color:'+shbdr+'; padding:0 6px; 0 6px">';

							html += '<div id="d'+myid+'" align=center valign=bottom style=" background-color:'+shbg+'; width:288px; height:' + theight + 'px;">';
							html += '<TABLE width=298 cellspacing=2 cellpadding=0 border=0><TR><TD valign=top><div style="position:relative;height:160px;"><a href="javasc' + 'ript:enlarge2(\'' + myid + '\'' + ',' + '\'' + showid + '\');"><img src="' + thumbsrc + '" border=0 class=pimg vspace=2 hspace=3';
							html += " onmouseover=\"prloadimg('"+ myid +"'); sp(this, '" + myid + "','" + showid + "','"+tset+"');";html += '" onmouseout="hp();" id=' + myid + '>';

							html += '</a>';
							html += mycombinedcon + mysharestatuses;
							html += '</div></TD><TD valign="top"><font class=xsmall>ID:' + myid;
							if(typeof(suppressrmrftype) == 'undefined'){
									html += '  <font class=rmrfindicator>'+rm[showid]+'</font>';
							}
							html += '<DIV class=icons>';

							if ((typeof(pre_q_args) != 'undefined' && pre_q_args.match(/fn=/) ) || (typeof(q_args) != 'undefined' && ( q_args.match(/vmo=/) || q_args.match(/rid=/) || q_args.match(/lb_view=1/) || q_args.match(/fn=/))) )
							{
									html+='<A href="javascript:lightbox_delete_image_enl(\'' + myid + '\');" class="lblink" TITLE="Remove this image from the lightbox">X</A>';
							}

							html += '</DIV>';

							myphotographer = unescape(myphotographer);
							if (myphotographer.length > 18)
									myphotographer = myphotographer.substring(0,18) + '...';

							if(showphotographer == 1){html +='&copy; '+currentYear+' ' + myphotographer;}
							html += '  <nobr>';
							if(showfilesize){html += myfilesize;}

							html += '</nobr><br/>CAPTION: ' + myshortcaption+'<div>'+myreleased+'</div></font>';

							html += mysiteweight;

							if(myhrdlink)
									html += '<br/><NOBR><a href="'+myhrdlink+'" class="hiresdl_link"><font color="#cc0000">Download Hires</font></a></NOBR>';
							html += '<br/><a href="javascript: return false;" ONCLICK="lightbox_addto(\'' + myid + '\'); return false;" class="iconlink" title="Add to your current lightbox">LB+</a>';

							html += '</TD></TR></TABLE></DIV></span></SPAN>';
					} else {

							html += '<span id="cellwrapper'+myid+'" valign=bottom style="float:left;background-color:'+shbdr+'; padding:0 6px; 0 6px;">';
							html += '<div id="d' + myid + '" align=center valign=bottom style=" background-color:'+shbg+'; width:288px; height:' + theight + 'px;">';
							html += writesimilar(myid,showid,myphotographer,myshortcaption,'start','editing', myhrdlink, myreleased);
							html += '</DIV></span></SPAN>';
					}

			} else if(viewmode == "list"){
				var theight = 172 + adminheight;
				if ( mysimilarto.length < 13){	
					
					html += '<span id="cellwrapper'+showid+'" valign=bottom style="float:left;">';
					html += '	<div align=center valign=bottom style="width:305px; height:' + theight + 'px;">';
					html += '		<TABLE width=298 cellspacing=2 cellpadding=0 border0><TR><TD valign=top>';

					if(thisisacoverimage_feature) //myid is in the info for the link, hence this is the cover image
						html += '<a href="/SwishSearch?n=1&fn='+thisisacoverimage_feature+'&supst=cd" >';
					else
					html += '<a href="javascript: return false;" onclick="hp(); enlarge2(\'' + myid + '\'' + ',' + '\'' + showid + '\'); return false;">';

					html += '<img src="' + thumbsrc + '" border=0 class=pimg vspace=2 hspace=3';
					html += " onmouseover=\"prloadimg('"+ myid +"'); sp(this, '" + myid + "','" + showid + "','"+tset+"');";html += '" onmouseout="hp();" id=' + myid + '>';
					html += '</a><BR>';
					if(myhrdlink)
						html += '<center><a href="'+myhrdlink+'" class="hiresdl_link"><font color="#cc0000">Download Hires</font></a></center>';
					html += '</TD><TD valign="top"><font class=xsmall>ID:' + displayid + '</font>';
					if(typeof(suppressrmrftype) == 'undefined'){
						html += '  <font class=rmrfindicator>'+rm[showid]+'</font>';
					}
					if(showfilesize){html +=   '&nbsp;&nbsp;<font class=rmrfindicator>Size: ' + myfilesize +'</font>';}
					html += '			<DIV class=icons>';

					if (  ! thisisacoverimage_feature && ((typeof(pre_q_args) != 'undefined' && pre_q_args.match(/fn=/) ) || (typeof(q_args) != 'undefined' && ( q_args.match(/vmo=/) || q_args.match(/rid=/) || q_args.match(/lb_view=1/) || q_args.match(/fn=/))) ) )	
					{
						html+='<A href="javascript: return false;" onclick="lightbox_delete_image_enl(\'' + myid + '\'); return false;" class="iconlink" TITLE="Remove this image from the lightbox">X</A>';
					}

					html += '<nobr><a href="javascript: return false;" ONCLICK="lightbox_addto(\'' + myid + '\'); return false;" class="iconlink" title="Add to your current lightbox">Add to Lightbox</a></nobr>';
					html += '<a href="javascript: return false;" ONCLICK="return price_image(\'' + myid + '\',\''+myrmrftype+'\')" class="iconlink commercelink" Title="Price Image">Buy</a>';
					if (! thisisacoverimage_feature )
						html += '<a href="javascript: return false;" ONCLICK="enlarge2(\'' + myid + '\'' + ',' + '\'' + showid + '\'); return false;" class=iconlink title="Enlarge image and more info">Enlarge</a>';

					html += '			</DIV>';
					if(showphotographer == 1){html +='<div id=listcaption>&copy; ' + myphotographer;}
					html += '<br/>' + myshortcaption + '</div>';
					html += '</TD></TR></TABLE></DIV></SPAN>';
				} else {	
			
	
					html += '<span valign=bottom style="float:left;">';
					html += '<div id="d' + myid + '" align=center valign=bottom style="width:305px; height:' + theight + 'px;">';
					html += writesimilar(myid,showid,myphotographer,myshortcaption,'start','list', myhrdlink, myreleased);
                                        //html += myhrdlink + '<br/>' + myreleased + mysharestatuses;

					html += '</DIV></SPAN>';
				}
				
			
			} else if (viewmode == "tiny"){
				//adminheight += 8;
				var theight = 100 + adminheight;
				if ( mysimilarto.length < 13){	
					
					html += '<span valign=bottom style="float:left;">';
					html += '<div align=center valign=bottom style="width:95px; height:' + theight + 'px; overflow: hidden;">';

                                        if(thisisacoverimage_feature) //myid is in the info for the link, hence this is the cover image
                                                html += '<a href="/SwishSearch?n=1&fn='+thisisacoverimage_feature+'&supst=cd" ';
                                        else
                                                html += '<a href="javascript: return false;" onclick="hp(); enlarge2(\'' + myid + '\'' + ',' + '\'' + showid + '\'); return false;"';

					if(document.page.previews.selectedIndex == 1){html +=' TITLE="ID:' + displayid;
						if(showphotographer == 1){html += '\r&copy; ' + myphotographer;}
						if(showfilesize){html += '\rSIZE: '+ myfilesize ;}
						html +=  ' \r' + 'CAPTION: ' + myshortcaption + '"';
					}
					html += '><img src=' + thumbsrc + ' border=0 class=pimg vspace=1 hspace=1 height=55';
					html += " onmouseover=\"prloadimg('"+ myid +"'); sp(this, '" + myid + "', '" + showid + "','"+tset+"');";
					html += '" onmouseout="hp();" id=' + myid + '>';
					
					//sp('','" + myid + "','" + myrglobaldynf + "','" + myphotographer + "','" + myid + "','" + showid + "')
					html += '</a><BR>';
					html += '<font class="xxsmall"><DIV class=icons>';

					if (! thisisacoverimage_feature && ((typeof(pre_q_args) != 'undefined' && pre_q_args.match(/fn=/) ) || (typeof(q_args) != 'undefined' && ( q_args.match(/vmo=/) || q_args.match(/rid=/) || q_args.match(/lb_view=1/) || q_args.match(/fn=/))) ) )
					{
						html+='<A href="javascript: return false;" onclick="lightbox_delete_image_enl(\'' + myid + '\'); return false;" class="iconlinktiny" TITLE="Remove this image from the lightbox">X</A>';
					}


					html += '<a href="javascript: return false;" ONCLICK="lightbox_addto(\'' + myid + '\'); return false;" class="iconlinktiny" title="Add to your current lightbox">LB+</a>';
					if(gsession){html += '<a href="javascript: return false;" ONCLICK="cart_addto(\'' + myid + '\'); return false;" class="iconlinktiny" title="Add this image to your shopping cart">CART+</a>';}

					html += '<a href="javascript: return false;" ONCLICK="return price_image(\'' + myid + '\',\''+myrmrftype+'\');" class="iconlinktiny commercelink" Title="Price Image">$</a>';
					if (! thisisacoverimage_feature)
						html += '<a href="javascript: return false;" ONCLICK="enlarge2(\'' + myid + '\'' + ',' + '\'' + showid + '\'); return false;" class="iconlinktiny" title="Enlarge image and more info"><font class=eye>i</font></a>';

					/*  if(typeof(gusert) != 'undefined' && gusert =='IPN'){
						html += '<A href="javascript: return false;" onclick="ajax_TEXT(\'/bin/KeywordAdjust?good=1&id=' + myid + '&q=' + dsplkys + '\'); return false;"><IMG src=/graphics/rating_enhance.gif width=18 height=12 border=0 style="margin-bottom: -3px;"></a><A href="javascript: return false;" onclick="ajax_TEXT(\'/bin/KeywordAdjust?bad=1&id=' + myid + '&q=' + dsplkys + '\'); return false;"><IMG src=/graphics/rating_discourage.gif width=18 border=0 height=12 style="margin-bottom: -3px;"></a>';
					}  */

					html += '</DIV></font>';
					html += '<DIV class=imidxxsmall>' + displayid;
					if(typeof(suppressrmrftype) == 'undefined'){
						html += '  <font class=rmrfindicator>'+rm[showid]+'</font>';
					}
					if(showfilesize){html +=   '&nbsp;&nbsp;' + myfilesize ;}
					html +='</DIV>';

					if (myhrdlink)
						html += '<a href="'+myhrdlink+'" class="hiresdl_link"><font color="#cc0000">Download Hires</font></a>';
					html += '</DIV></SPAN>';

				} else {				
	
					html += '<span valign=bottom style="float:left;">';
					html += '<div id="d' + myid + '" align=center valign=bottom style="width:95px; height:' + theight + 'px; overflow:hidden;">';
					html += writesimilar(myid,showid,myphotographer,myshortcaption,'start','tiny',myhrdlink,myreleased);		
					html += '</DIV></SPAN>';
				}
			
			
			} else if (viewmode == "med"){
				//adminheight += 4; // tweaking adminheight...
				var theight = 130 + adminheight;
				if ( mysimilarto.length < 13){	
				
					html += '<span valign=bottom style="float:left;">';
					html += '<div align=center valign=bottom style="width:140px; height:' + theight + 'px; overflow: hidden;">';

                                        if(thisisacoverimage_feature) //myid is in the info for the link, hence this is the cover image
                                                html += '<a href="/SwishSearch?n=1&fn='+thisisacoverimage_feature+'&supst=cd" ';
                                        else
                                                html += '<a href="javascript: return false;" onclick="hp(); enlarge2(\'' + myid + '\'' + ',' + '\'' + showid + '\'); return false;"';


					if(document.page.previews.selectedIndex == 1){html += ' TITLE="ID:' + displayid;
						if(showphotographer == 1){html += '  \r&copy; ' + myphotographer;}
						if(showfilesize){html += '\rSIZE: ' + myfilesize ;}
						html += ' \r' + 'CAPTION: ' + myshortcaption + '"';
					}
					html += '><img src=' + thumbsrc + ' border=0 vspace=1 class=pimg hspace=1 height=80';
					html += " onmouseover=\"prloadimg('"+ myid +"'); sp(this, '" + myid + "', '" + showid + "','"+tset+"');";
					html += '" onmouseout="hp();" id=' + myid + '>';
						//sp('','" + myid + "','" + myrglobaldynf + "','" + myphotographer + "','" + myid + "','" + showid + "')
					html += '</a><BR>';
					html += '<font class="xsmall"><DIV class=icons>';

					if (! thisisacoverimage_feature && ((typeof(pre_q_args) != 'undefined' && pre_q_args.match(/fn=/) ) || (typeof(q_args) != 'undefined' && ( q_args.match(/vmo=/) || q_args.match(/rid=/) || q_args.match(/lb_view=1/) || q_args.match(/fn=/))) ) )
					{
						html+='<A href="javascript: return false;" onclick="lightbox_delete_image_enl(\'' + myid + '\'); return false;" class="lblink" TITLE="Remove this image from the lightbox">X</A>';
					}

					html += '<a href="javascript: return false;" ONCLICK="lightbox_addto(\'' + myid + '\'); return false;" class="iconlink" title="Add to your current lightbox">LB+</a>';
					if(gsession){html += '<a href="javascript: return false;" ONCLICK="cart_addto(\'' + myid + '\'); return false;" class="iconlink" title="Add this image to your shopping cart">CART+</a>';}

					html += '<a href="javascript: return false;" ONCLICK="return price_image(\'' + myid + '\',\''+myrmrftype+'\');" class="iconlink commercelink" Title="Price Image">$</a>';
					if (! thisisacoverimage_feature)
						html += '<a href="javascript: return false;" ONCLICK="enlarge2(\'' + myid + '\'' + ',' + '\'' + showid + '\'); return false;" class="iconlink" title="Enlarge image and more info"><font class=eye>i</font></a>';

					if(typeof(gusert) != 'undefined' && gusert =='IPN'){
						html += '<A href="javascript: return false;" onclick="ajax_TEXT(\'/bin/KeywordAdjust?good=1&id=' + myid + '&q=' + dsplkys + '\',getpost); return false;"><IMG src=/graphics/rating_enhance.gif width=18 height=12 border=0 style="margin-bottom: -3px;"></a><A href="javascript: return false;" onclick="ajax_TEXT(\'/bin/KeywordAdjust?bad=1&id=' + myid + '&q=' + dsplkys + '\', getpost); return false;"><IMG src=/graphics/rating_discourage.gif width=18 border=0 height=12 style="margin-bottom: -3px;"></a>';
					}
					html += '</DIV></font>';
					html += '<DIV class=imidxxsmall>' + displayid;
					if(typeof(suppressrmrftype) == 'undefined'){
						html += '  <font class=rmrfindicator>'+rm[showid]+'</font>';
					}
					if(showfilesize){html +=   '&nbsp;&nbsp;<font class=rmrfindicator>' + myfilesize +'</font>';}
					html +='</DIV>';
					if (myhrdlink)
						html += '<a href="'+myhrdlink+'" class="hiresdl_link"><font color="#cc0000">Download Hires</font></a>';
					
					

					html += '</DIV></SPAN>';

				} else {				
	
					html += '<span valign=bottom style="float:left;">';
					html += '<div id="d' + myid + '" align=center valign=bottom style="width:140px; height:' + theight + 'px;">';
					html += writesimilar(myid,showid,myphotographer,myshortcaption,'start','med',myhrdlink,myreleased);		
					html += '</DIV></SPAN>';
				}
			} else if (viewmode == "ss"){			
				html = '  ';
			} else if (viewmode == "huge"){		
				var theight = 220 + adminheight;
				if ( mysimilarto.length < 13){	
					html += '<span valign=bottom style="float:left;">';
					html += '<div align=center valign=bottom style="width:330px; height:' + theight + 'px; overflow: hidden;">';

                                        if(thisisacoverimage_feature) //myid is in the info for the link, hence this is the cover image
                                                html += '<a href="/SwishSearch?n=1&fn='+thisisacoverimage_feature+'&supst=cd" ';
                                        else
                                                html += '<a href="javascript: return false;" onclick="hp(); enlarge2(\'' + myid + '\'' + ',' + '\'' + showid + '\'); return false;" TITLE="ID:' + displayid;

					if(showphotographer == 1){html += '\r&copy; ' + myphotographer;}
					if(showfilesize){html +=   '\rSIZE: ' + myfilesize ;}
					html += ' \r' + 'CAPTION: ' + myshortcaption + '"><img src="' + previewsrc + '" border="0" vspace="1" hspace="3" alt="loading..." height="192"></a><BR>';
					html += '<font class="xsmall"><DIV class=icons>';

					if ( ! thisisacoverimage_feature && ((typeof(pre_q_args) != 'undefined' && pre_q_args.match(/fn=/) ) || (typeof(q_args) != 'undefined' && ( q_args.match(/vmo=/) || q_args.match(/rid=/) || q_args.match(/lb_view=1/) || q_args.match(/fn=/))) ) )
					{
						html+='<A href="javascript: return false;" onclick="lightbox_delete_image_enl(\'' + myid + '\'); return false;" class="lblink" TITLE="Remove this image from the lightbox">X</A>';
					}

					html += '<a href="javascript: return false;" ONCLICK="lightbox_addto(\'' + myid + '\'); return false;" class="iconlink" title="Add to your current lightbox">LIGHTBOX+</a>';
					if(gsession){html += '<a href="javascript: return false;" ONCLICK="cart_addto(\'' + myid + '\'); return false;" class="iconlink" title="Add this image to your shopping cart">CART+</a>';}

					html += '<a href="javascript: return false;" ONCLICK="return price_image(\'' + myid + '\',\''+myrmrftype+'\');" class="iconlink commercelink" Title="Price Image">$</a>';
					if (! thisisacoverimage_feature)
						html += '<a href="javascript: return false;" ONCLICK="enlarge2(\'' + myid + '\'' + ',' + '\'' + showid + '\'); return false;" class="iconlink" title="Enlarge image and more info"><font class=eye>i</font> ENLARGE</a> ';

					if(typeof(gusert) != 'undefined' && gusert =='IPN'){
						html += '<A href="javascript: return false;" onclick="ajax_TEXT(\'/bin/KeywordAdjust?good=1&id=' + myid + '&q=' + dsplkys + '\', getpost); return false;"><IMG src=/graphics/rating_enhance.gif width=18 height=12 border=0 style="margin-bottom: -3px;"></a><A href="javascript: return false;" onclick="ajax_TEXT(\'/bin/KeywordAdjust?bad=1&id=' + myid + '&q=' + dsplkys + '\',getpost); return false;"><IMG src=/graphics/rating_discourage.gif width=18 border=0 height=12 style="margin-bottom: -3px;"></a>';
					}
					html += displayid;
					if(typeof(suppressrmrftype) == 'undefined'){
						html += '  <font class=rmrfindicator>'+rm[showid]+'</font> ';
					}
					if(showfilesize){html +=   '&nbsp;&nbsp;Size: ' + myfilesize ;}
	                                html += '</DIV></font>';

					if (myhrdlink)
						html += '<a href="'+myhrdlink+'" class="hiresdl_link"><font color="#cc0000">Download Hires</font></a>';

					html += '</DIV></SPAN>';
					
				} else {
					html += '<span valign=bottom style="float:left;">';
					html += '<div id="d' + myid + '" align=center valign=bottom style="width:330px; height:' + theight + 'px; overflow: hidden;">';
					html += writesimilar(myid,showid,myphotographer,myshortcaption,'start','huge', myhrdlink, myreleased);

					html += '</DIV></SPAN>';
				}				
			} else if (viewmode == "large"){
				var theight = 199 + adminheight;
				if ( mysimilarto.length < 13){		
					html += '<span valign=bottom style="float:left;">';
					html += '<div align=center valign=bottom style="width:187px; height:' + theight + 'px; overflow:hidden;">';
                                        if(thisisacoverimage_feature) //myid is in the info for the link, hence this is the cover image
                                                html += '<a href="/SwishSearch?n=1&fn='+thisisacoverimage_feature+'&supst=cd" ';
                                        else
                                                html += '<a href="javascript: return false;" onclick="hp(); enlarge2(\'' + myid + '\'' + ',' + '\'' + showid + '\'); return false;"'

					if(document.page.previews.selectedIndex == 1){html += ' TITLE="ID:' + displayid;
						if(showphotographer == 1){html +=  '\r&copy; ' + myphotographer;}
						if(showfilesize){html += '\rSIZE: ' + myfilesize ;}
						html += ' \r' + 'CAPTION: ' + myshortcaption + '"';
					}
					html += '><img src="' + thumbsrc + '" class=pimg border="0" vspace="0" hspace="3"';
					html += " onmouseover=\"prloadimg('"+ myid +"'); sp(this, '" + myid + "','" + showid + "','"+tset+"');";
					html += '" onmouseout="hp();" id=' + myid + '>';
					
					html += '</a><BR>';
					html += '<font class="xsmall"><DIV class=icons>';

					
					if (! thisisacoverimage_feature && ((typeof(pre_q_args) != 'undefined' && pre_q_args.match(/fn=/) ) || (typeof(q_args) != 'undefined' && ( q_args.match(/vmo=/) || q_args.match(/rid=/) || q_args.match(/lb_view=1/) || q_args.match(/fn=/))) ) )						{
						html+='<A href="javascript: return false;" onclick="lightbox_delete_image_enl(\'' + myid + '\'); return false;" class="iconlink" TITLE="Remove this image from the lightbox">X</A>';
					}

					html += '<a href="javascript: return false;" ONCLICK="lightbox_addto(\'' + myid + '\'); return false;" class="iconlink" title="Add to your current lightbox">LB+</a>';
					if(gsession){html += '<a href="javascript: return false;" ONCLICK="cart_addto(\'' + myid + '\'); return false;" class="iconlink" title="Add this image to your shopping cart">CART+</a>';}
					html += '<a href="javascript: return false;" ONCLICK="return price_image(\'' + myid + '\',\''+myrmrftype+'\');" class="iconlink commercelink" Title="Price Image">$</a>';
					if (! thisisacoverimage_feature )
						html += '<a href="javascript: return false;" ONCLICK="enlarge2(\'' + myid + '\'' + ',' + '\'' + showid + '\'); return false;" class="iconlink" title="Enlarge image and more info"><font class=eye>i</font></a>&nbsp;';

					if(typeof(gusert) != 'undefined' && gusert =='IPN'){
						html += '<A href="javascript: return false;" onclick="ajax_TEXT(\'/bin/KeywordAdjust?good=1&id=' + myid + '&q=' + dsplkys + '\',getpost); return false;"><IMG src=/graphics/rating_enhance.gif width=18 height=12 border=0 style="margin-bottom: -3px;"></a><A href="javascript: return false;" onclick="ajax_TEXT(\'/bin/KeywordAdjust?bad=1&id=' + myid + '&q=' + dsplkys + '\',getpost); return false;"><IMG src=/graphics/rating_discourage.gif width=18 border=0 height=12 style="margin-bottom: -3px;"></a>';
					}

					html += '</div><div><font class=imid>' + displayid + '</font>';
					if(typeof(suppressrmrftype) == 'undefined'){
						html += '  <font class=rmrfindicator>'+rm[showid]+'</font>';
					}
					if(showfilesize){html +=   '&nbsp;&nbsp;Size: ' + myfilesize ;}
					html +='</DIV></font>';

					if (myhrdlink)
	                                        html += '<a href="'+myhrdlink+'" class="hiresdl_link"><font color="#cc0000">Download Hires</font></a>';

					html += '</DIV></SPAN>';
		
			
				} else {			
					html += '<span valign=bottom style="float:left;">';
					html += '<div id="d' + myid + '" align=center valign=bottom style="width:187px; height:' + theight + 'px; overflow: hidden;">';
					html += writesimilar(myid,showid,myphotographer,myshortcaption,'start','large', myhrdlink, myreleased);

					html += '</DIV></SPAN>';
				}
			} else {
				var theight = 176 + adminheight;
				if ( mysimilarto.length < 13){		
					html += '<span valign=bottom style="float:left;">';
					html += '<div align=center valign=bottom style="width:152px; height:' + theight + 'px; overflow:hidden;">';
                                        if(thisisacoverimage_feature) //myid is in the info for the link, hence this is the cover image
                                                html += '<a href="/SwishSearch?n=1&fn='+thisisacoverimage_feature+'&supst=cd" ';
                                        else
                                                html += '<a href="javascript: return false;" onclick="hp(); enlarge2(\'' + myid + '\'' + ',' + '\'' + showid + '\'); return false;"'


					if(document.page.previews.selectedIndex == 1){html += ' TITLE="ID:' + displayid;
						if(showphotographer == 1){html +=  '\r&copy; ' + myphotographer;}
						if(showfilesize){html += '\rSIZE: ' + myfilesize ;}
						html += ' \r' + 'CAPTION: ' + myshortcaption + '"';
					}
					html += '><img src="' + thumbsrc + '" class=pimg border="0" vspace="0" hspace="3"';
					html += " onmouseover=\"prloadimg('"+ myid +"'); sp(this, '" + myid + "','" + showid + "','"+tset+"');";
					html += '" onmouseout="hp();" id=' + myid + '>';
					
					html += '</a><BR>';
					html += '<font class="xsmall"><DIV class=icons>';

					
					if (! thisisacoverimage_feature && ((typeof(pre_q_args) != 'undefined' && pre_q_args.match(/fn=/) ) || (typeof(q_args) != 'undefined' && ( q_args.match(/vmo=/) || q_args.match(/rid=/) || q_args.match(/lb_view=1/) || q_args.match(/fn=/))) ) )						{
						html+='<A href="javascript: return false;" onclick="lightbox_delete_image_enl(\'' + myid + '\'); return false;" class="iconlink" TITLE="Remove this image from the lightbox">X</A>';
					}

					html += '<a href="javascript: return false;" ONCLICK="lightbox_addto(\'' + myid + '\'); return false;" class="iconlink" title="Add to your current lightbox">LB+</a>';
					if(gsession){html += '<a href="javascript: return false;" ONCLICK="cart_addto(\'' + myid + '\'); return false;" class="iconlink" title="Add this image to your shopping cart">CART+</a>';}
					html += '<a href="javascript: return false;" ONCLICK="return price_image(\'' + myid + '\',\''+myrmrftype+'\');" class="iconlink commercelink" Title="Price Image">$</a>';
					if (! thisisacoverimage_feature)
						html += '<a href="javascript: return false;" ONCLICK="enlarge2(\'' + myid + '\'' + ',' + '\'' + showid + '\'); return false;" class="iconlink" title="Enlarge image and more info"><font class=eye>i</font></a>&nbsp;';

					if(typeof(gusert) != 'undefined' && gusert =='IPN'){
						html += '<A href="javascript: return false;" onclick="ajax_TEXT(\'/bin/KeywordAdjust?good=1&id=' + myid + '&q=' + dsplkys + '\',getpost); return false;"><IMG src=/graphics/rating_enhance.gif width=18 height=12 border=0 style="margin-bottom: -3px;"></a><A href="javascript: return false;" onclick="ajax_TEXT(\'/bin/KeywordAdjust?bad=1&id=' + myid + '&q=' + dsplkys + '\',getpost); return false;"><IMG src=/graphics/rating_discourage.gif width=18 border=0 height=12 style="margin-bottom: -3px;"></a>';
					}
					 
					html += '</div><div><font class=imid>' + displayid + '</font>';
					if(typeof(suppressrmrftype) == 'undefined'){
						html += '  <font class=rmrfindicator>'+rm[showid]+'</font>';
					}
					if(showfilesize){html +=   '&nbsp;&nbsp;<font class=rmrfindicator>' + myfilesize +'</font>';}
					html +='</DIV></font>';

					if (myhrdlink)
	                                        html += '<a href="'+myhrdlink+'" class="hiresdl_link"><font color="#cc0000">Download Hires</font></a>';


					html += '</DIV></SPAN>';
		
			
				} else {			
					html += '<span valign=bottom style="float:left;">';
					html += '<div id="d' + myid + '" align=center valign=bottom style="width:152px; height:' + theight + 'px; overflow: hidden;">';
					html += writesimilar(myid,showid,myphotographer,myshortcaption,'start','normal', myhrdlink, myreleased);

					html += '</DIV></SPAN>';
				}

			}
		}
	} 
	return html;
 };




