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

var Templates = $H({});		


Templates.lightbox_new__body = new Template(
	'<div id="lightboxPopUp">'
	+'<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1" ALIGN="left" width="290" height="200"><TR>'
	+'<td class="dark1" valign=bottom width="100%"><DIV class="barheader">&nbsp;<FONT class="bartitle">Make a new lightbox</font></DIV></td></tr>'
	+'<tr><TD ALIGN="left" VALIGN="top" width="290" class="dark1"><DIV class="light1" style="padding: 15px;"><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>' 
);
		
Templates.lightbox_email__body = new Template(
	'<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1" ALIGN="left" width="390" height="280"><TR>'
	+'<td class="dark1" valign=bottom width="100%"><DIV class="barheader"><FONT class="bartitle">Email your lightbox to a friend</font></DIV></td></tr>'
	+'<tr><TD ALIGN="left" VALIGN="top" width="390" class="dark1"><DIV class="light1" style="padding: 15px;"><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="7" COLS="45"></TEXTAREA><BR><BR><B>3.</B> <input type="checkbox" id="readonly" name="readonly" value=1> Read only<BR><FONT CLASS="xsmall">check this box to prevent recipient from changing your lightbox.</FONT></p>'
	+'<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}<br><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><br><p>If you have changed your mind, click the link below.<BR><BR> <A HREF="" onclick="lightbox_email(\'close\'); return false;">[X] close window</A>.<BR>'
	+'</DIV></TD></TR></TABLE>'
);
		
Templates.lightbox_rename__body = new Template(
	'<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1" ALIGN="left" width="290"><TR>'
	+'<td class="dark1" valign=bottom width="100%"><DIV class="barheader">&nbsp;<FONT class="bartitle">Rename  lightbox</font></DIV></td></tr>'
	+'<tr><TD ALIGN="left" VALIGN="top" width="290" class="dark1"><DIV class="light1" style="padding: 15px;"><form action="javascript:nada();" method="get" name="send"><p>'
	+'</p><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/>'
	+'<A HREF="" onclick="lightbox_email(\'close\'); return false;">[X] close window</A>'
	+'</form></DIV></TD></TR></TABLE>'
);

Templates.simplemessage__body = new Template(
	'<DIV class=light1 style="text-align:center; width:400px; 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"># #{displayimageid} <font class=rmrfindicator>#{rmrftype}</font> #{filesize} :: #{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;padding-left:6px;">'
				+'<table cellspacing="4" cellpadding="0" border="0" width="920" height="99%" >'
				+'<TR><TD valign="top" align="left" width="430" height="440" style="min-width: 440px">'
					+'<div style="position:relative">#{themediainsert}</div>'
				+'<br/></td>'
				+'#{similarscolumn}'
				+'<TD align="left" valign="top" style="border-left: 1px solid #bbbbbb;"><div style="padding-left: 15px;">'
					+'#{navbacklinks}'
					+'#{navenlargedlinks}'
					+'<br/><a href="" onclick="lightbox_addto(\'#{enlargetid}\'); return false;"><img src="/graphics/icon01.gif" width=11 height=16 border=0 alt=""> ADD TO CURRENT LIGHTBOX </a>'
					+'<br/><a href="" onclick="license(\'#{enlargetid}\'); return false;"><img src="/graphics/icon03.gif" width=10 height=16 border=0 alt=""> CHECK USAGE RATES</a>'
					+'<br/><a href="" onclick="cart_addto(\'#{enlargetid}\'); return false;"><img src="/graphics/icon02.gif" width=18 height=16 border=0 alt=""> ADD TO SHOPPING CART</a>'
					+'<br/>#{downloadcomplink}'
					+'<BR/><b>Image Number:</b> #{displayenlargetid}&nbsp;<font class=rmrfindicator>#{rmrftype}</font>'
					+'<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></div>'
 +'</td><TD rowspan=2 align="left" valign="top" style="border-left: 1px solid #bbbbbb; 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 writephotographer(){
return('<div id="searchByPhotographers"><h3>Filter by photographer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:clearfotid()"><span style="color:#ffffff">clear</span></a></h3><select name="fotid" size="8" multiple class="photographersList" onKeyup="fotidOnKeyup()"><option value="AD" >Adam Den Haene</option><option value="AR" >Andersen Ross   </option><option value="A1" >ArabianEye</option><option value="AS" >Ariel Skelley   </option><option value="BH" >Bootsy Holler</option><option value="BL" >Bruce Laurance   </option><option value="CS" >Caroline Schiff   </option><option value="CA" >Colin Anderson   </option><option value="CB" >ColorBlind Images   </option><option value="DL" >Dave & Les Jacobs   </option><option value="DB" >David Buffington   </option><option value="DM" >Don Mason   </option><option value="SC" >DreamPictures  </option><option value="EI" >Erik Isakson</option><option value="ER" >ERproductions Ltd  </option><option value="GM" >Gabriela Medina  </option><option value="HS" >Hill Street Studios   </option><option value="IS" >Inti St Clair   </option><option value="JH" >Jack Hollingsworth   </option><option value="JC" >James Carman   </option><option value="JW" >Jeremy Woodhouse   </option><option value="JG" >JGI   </option><option value="SG" >Jinxy Productions</option><option value="HN" >John Henley   </option><option value="JL" >John Lund   </option><option value="JF" >Jon Feingersh   </option><option value="JP" >Jose Luis Pelaez Inc</option><option value="JS" >JoSon   </option><option value="KD" >Karin Dreyer   </option><option value="KS" >Kim Steele</option><option value="KL" >Klaus Tiedge   </option><option value="KT" >Kris Timken   </option><option value="LW" >LWA/Larry Williams   </option><option value="MA" >Mark Edward Atkinson   </option><option value="FX" >Moxie Productions   </option><option value="MY" >Mychal M Richardson</option><option value="NF" >Ned Frisk   </option><option value="NH" >Noel Hendrickson   </option><option value="PG" >Patterson Graham</option><option value="SF" >Paul Burns   </option><option value="PB" >PBNJ Productions    </option><option value="PD" >Peter Dressel</option><option value="PN" >Picturenet     </option><option value="PL" >Plush Studios   </option><option value="GZ" >Rick Gomez   </option><option value="RM" >RK Studio   </option><option value="RB" >Rolf Bruderer   </option><option value="RK" >Ronnie Kaufman   </option><option value="RA" >Ross Anania   </option><option value="SO" >Shalom Ormsby   </option><option value="LZ" >Studio Zanello   </option><option value="TC" >Tanya Constantine   </option><option value="BC" >Teresa De Paul   </option><option value="TV" >Terry Vine  </option><option value="A2" >Tetra Images</option><option value="TW" >Todd Wright</option><option value="TB" >TRBfoto   </option><option value="TL" >Trevor Lush   </option><option value="TR" >Trinette Reed   </option><option value="VI" >Visual Ideas</option></select>');

}







function htmlit_custom(showid){

	// build html for each image depending on viewing mode
	var html='';
	switchpage = false;
	if (id[showid]){
		
		var myrmrftype = rm[showid];
		myid = id[showid];
		//mysimilarto=st[showid];
		mysimilarto=myid;
		if (typeof(scp) != 'undefined' && (viewmode == 'list' || viewmode == 'editing') ) {myshortcaption=unescape(scp[showid]);} else {myshortcaption = "n/a";}
		var temp = true;
		var tempshortcaption='';
		myreleased = rel[showid];

		 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_custom=14;
		if(myhrdlink){
			myhrdlink = myhrdlink.replace(/(<br>|%3cbr%3e)/ig, '');
		} 
		if(myfilesize < 5){myfilesize='Scan on Demand';} //else {myfilesize+=" Mb";}
		if(myid.length > 9){
			if ( o[showid] ){displayid=o[showid];} else {displayid=myid;}	
			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;"><div style="border: solid 1px #999;padding: 0px;height:' + (theight - 5 ) + 'px ;width:299px;">';
					html += '<TABLE width=298 cellspacing=2 cellpadding=0 border0><TR><TD valign=top class=imcell>';

//<a href="" onclick="hp(); enlarge2(\'' + myid + '\'' + ',' + '\'' + showid + '\'); return false;">

                                       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="" onclick="hp(); enlarge2(\'' + myid + '\'' + ',' + '\'' + showid + '\'); return false;">';



					html += '<img src="http://globaldyn.ipnstock.com/'+dynimagesname+'/135/50/' + myid + '.JPG" 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>'+myhrdlink+'</center>';
					html += '</TD><TD valign="top" class=imcell><font class=xsmall>ID:' + displayid;
					if(typeof(suppressrmrftype) == 'undefined'){
						html += '  <font class=rmrfindicator>'+rm[showid]+'</font>';
					}
					html += '<DIV class=icons>';

					if ( ! thisisacoverimage_feature && ! q_args.match(/supst=cd/) && ((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="" onclick="lightbox_delete_image_enl(\'' + myid + '\'); return false;" class="lblink" TITLE="Remove this image from the lightbox"><IMG SRC=/graphics/icon05.gif height=15 width=14 border=0></A>';
					}

					html += '<a href="" ONCLICK="lightbox_addto(\'' + myid + '\'); return false;" class="iconlink" title="Add to your current lightbox"><IMG src=/graphics/icon01.gif height=15 width=11 border=0></a>';
					if(gsession){html += '<a href="" ONCLICK="cart_addto(\'' + myid + '\'); return false;" class="iconlink" title="Add this image to your shopping cart"><IMG src=/graphics/icon02.gif height=15 width=18 border=0></a>';}

					html += '<a href="" ONCLICK="return price_image(\'' + myid + '\',\''+myrmrftype+'\');" class="iconlink" Title="Price Image"><IMG src=/graphics/icon03.gif height=15 width=10 border=0></a>';
					html += '<a href="" ONCLICK="enlarge2(\'' + myid + '\'' + ',' + '\'' + showid + '\'); return false;" class=iconlink title="Enlarge image and more info"><IMG src=/graphics/icon04.gif height=15 width=12 border=0></a>';
					html += '</DIV>';
					
					if(showphotographer == 1){html +='<BR>&copy; '+currentYear+' ' + myphotographer;}
					html += '  <nobr>';
					if(showfilesize){html += myfilesize;}
					html += '</nobr><br/>CAPTION: ' + myshortcaption + '<div>'+myreleased+'</div></font>';


					html += '</TD></TR></TABLE></DIV></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;"><div style="border: solid 1px #999;padding: 0px;height:135px;width:135px;">';
					html += writesimilar(myid,showid,myphotographer,myshortcaption,'start','list', myhrdlink);
                                        //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:96px; height:' + theight + 'px; overflow:hidden;"><table cellpadding=0 height=' + (theight - 4) + ' width=92 cellspacing=0 style="border: solid 1px #999;padding: 0px;"><tr><td align=center class=imcell>';

					//html += '<a href="" onclick="hp(); enlarge2(\'' + myid + '\'' + ',' + '\'' + showid + '\'); return false;"';

                                        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="" 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=http://globaldyn.ipnstock.com/'+dynimagesname+'/135/50/' + myid + '.JPG 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></div>';
					html += '<DIV class=icons>';

					if ( ! thisisacoverimage_feature && ! q_args.match(/supst=cd/) && ((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="" onclick="lightbox_delete_image_enl(\'' + myid + '\'); return false;" class="iconlinktiny" TITLE="Remove this image from the lightbox"><IMG SRC=/graphics/icon05.gif height=15 width=14 border=0></A>';
					}

					html += '<a href="" ONCLICK="lightbox_addto(\'' + myid + '\'); return false;" class="iconlinktiny" title="Add to your current lightbox"><IMG src=/graphics/icon01.gif height=15 width=11 border=0></a>';
					if(gsession){html += '<a href="" ONCLICK="cart_addto(\'' + myid + '\'); return false;" class="iconlinktiny" title="Add this image to your shopping cart"><IMG src=/graphics/icon02.gif height=15 width=18 border=0></a>';}

					html += '<a href="" ONCLICK="return price_image(\'' + myid + '\',\''+myrmrftype+'\');" class="iconlinktiny" Title="Price Image"><IMG src=/graphics/icon03.gif height=15 width=10 border=0></a>';
					html += '<a href="" ONCLICK="enlarge2(\'' + myid + '\'' + ',' + '\'' + showid + '\'); return false;" class="iconlinktiny" title="Enlarge image and more info"><IMG src=/graphics/icon04.gif height=15 width=12 border=0></a>';
					html += '</DIV>';
					html += '<DIV class=imidxxsmall>' + displayid;
					if(typeof(suppressrmrftype) == 'undefined'){
						html += '  <font class=rmrfindicator>'+rm[showid]+'</font>';
					}
					html +='</DIV>';
                                        html += myhrdlink;


					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:95px; height:' + theight + 'px; overflow:hidden;"><div style="border: solid 1px #999;padding: 0px;height:55px;width:88px;">';
					html += writesimilar(myid,showid,myphotographer,myshortcaption,'start','tiny');		
					html += myhrdlink;
					html += '</DIV></SPAN>';
				}
			
			
			} else if (viewmode == "med"){
				//adminheight += 4; // tweaking adminheight...
				var theight = 120 + 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;"><table cellpadding=0 height=' + (theight - 4) + ' width=136 cellspacing=0 style="border: solid 1px #999;padding: 0px;"><tr><td align=center class=imcell>';
					//html += '<a href="" ONCLICK="hp(); enlarge2(\'' + myid + '\'' + ',' + '\'' + showid + '\'); return false;"';
                                       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="" 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=http://globaldyn.ipnstock.com/'+dynimagesname+'/135/50/' + myid + '.JPG 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></div>';
					html += '<DIV class=icons>';

					if (! thisisacoverimage_feature && ! q_args.match(/supst=cd/) && ((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="" onclick="lightbox_delete_image_enl(\'' + myid + '\'); return false;" class="lblink" TITLE="Remove this image from the lightbox"><IMG SRC=/graphics/icon05.gif height=15 width=14 border=0></A>';
					}

					html += '<a href="" ONCLICK="lightbox_addto(\'' + myid + '\'); return false;" class="iconlink" title="Add to your current lightbox"><IMG src=/graphics/icon01.gif height=15 width=11 border=0></a>';
					if(gsession){html += '<a href="" ONCLICK="cart_addto(\'' + myid + '\'); return false;" class="iconlink" title="Add this image to your shopping cart"><IMG src=/graphics/icon02.gif height=15 width=18 border=0></a>';}

					html += '<a href="" ONCLICK="return price_image(\'' + myid + '\',\''+myrmrftype+'\');" class="iconlink" Title="Price Image"><IMG src=/graphics/icon03.gif height=15 width=10 border=0></a>';
					html += '<a href="" ONCLICK="enlarge2(\'' + myid + '\'' + ',' + '\'' + showid + '\'); return false;" class="iconlink" title="Enlarge image and more info"><IMG src=/graphics/icon04.gif height=15 width=12 border=0></a>';
					html += '</DIV>';
					html += '<DIV class=imidxxsmall>' + displayid;
					if(typeof(suppressrmrftype) == 'undefined'){
						html += '  <font class=rmrfindicator>'+rm[showid]+'</font>';
					}
					html +='</DIV>';
                                        html += myhrdlink;


					html += '</td></tr></table></DIV></SPAN>';
		

				} else {				
	
					html += '<span valign=bottom style="float:left;"><div style="border: solid 1px #999;padding: 0px;height:80px;width:120px;">';
					html += '<div id="d' + myid + '" align=center valign=bottom style="width:140px; height:' + theight + 'px;">';
					html += writesimilar(myid,showid,myphotographer,myshortcaption,'start','med');		
					if(myhrdlink)
						html += myhrdlink;
					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;"><div class=imcell style="border: solid 1px #999;padding: 0px;height:192px;width:320px;">';
					//html += '<a href="" ONCLICK="hp(); enlarge2(\'' + myid + '\'' + ',' + '\'' + showid + '\'); return false;" TITLE="ID:' + displayid;

                                        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="" 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="http://globaldyn.ipnstock.com/'+dynimagesname+'/420/60/' + myid + '.JPG" border="0" vspace="1" hspace="3" alt="loading..." height="192"></a></div>';
					html += '<DIV class=icons>';

					if (! thisisacoverimage_feature && ! q_args.match(/supst=cd/) && ((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="" onclick="lightbox_delete_image_enl(\'' + myid + '\'); return false;" class="lblink" TITLE="Remove this image from the lightbox"><IMG SRC=/graphics/icon05.gif height=15 width=14 border=0></A>';
					}

					html += '<a href="" ONCLICK="lightbox_addto(\'' + myid + '\'); return false;" class="iconlink" title="Add to your current lightbox"><IMG src=/graphics/icon01.gif height=15 width=11 border=0></a>';
					if(gsession){html += '<a href="" ONCLICK="cart_addto(\'' + myid + '\'); return false;" class="iconlink" title="Add this image to your shopping cart"><IMG src=/graphics/icon02.gif height=15 width=18 border=0></a>';}

					html += '<a href="" ONCLICK="return price_image(\'' + myid + '\',\''+myrmrftype+'\');" class="iconlink" Title="Price Image"><IMG src=/graphics/icon03.gif height=15 width=10 border=0></a>';
					html += '<a href="" ONCLICK="enlarge2(\'' + myid + '\'' + ',' + '\'' + showid + '\'); return false;" class="iconlink" title="Enlarge image and more info"><IMG src=/graphics/icon04.gif height=15 width=12 border=0></a> ';
					html += displayid;
					if(typeof(suppressrmrftype) == 'undefined'){
						html += '  <font class=rmrfindicator>'+rm[showid]+'</font> ';
					}
                                        html += '</DIV>'+ myhrdlink;

					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;"><div style="border: solid 1px #999;padding: 0px;height:192px;width:320px;">';
					html += writesimilar(myid,showid,myphotographer,myshortcaption,'start','huge', myhrdlink);
                                        html += myhrdlink;

					html += '</DIV></SPAN>';
				}				
			} else {
				var theight = 168 + 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;"><table cellpadding=0 height=' + (theight - 4) + ' width=147 cellspacing=0 style="border: solid 1px #999;padding: 0px;"><tr><td align=center class=imcell>';
					//html += '<a href="" onclick="hp(); enlarge2(\'' + myid + '\'' + ',' + '\'' + showid + '\'); return false;"';
                                        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="" 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="http://globaldyn.ipnstock.com/'+dynimagesname+'/135/50/' + myid + '.JPG" class=pimg border="0"';
					html += " onmouseover=\"prloadimg('"+ myid +"'); sp(this, '" + myid + "','" + showid + "','"+tset+"');";
					html += '" onmouseout="hp();" id=' + myid + '>';
					
					html += '</a>';
					html += '<DIV class=icons>';

					
					if (! thisisacoverimage_feature && ! q_args.match(/supst=cd/) && ((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="" onclick="lightbox_delete_image_enl(\'' + myid + '\'); return false;" class="iconlink" TITLE="Remove this image from the lightbox"><IMG SRC=/graphics/icon05.gif height=15 width=14 border=0></A>';
					}

					html += '<a href="" ONCLICK="lightbox_addto(\'' + myid + '\'); return false;" class="iconlink" title="Add to your current lightbox"><IMG src=/graphics/icon01.gif height=15 width=11 border=0></a>';
					if(gsession){html += '<a href="" ONCLICK="cart_addto(\'' + myid + '\'); return false;" class="iconlink" title="Add this image to your shopping cart"><IMG src=/graphics/icon02.gif height=15 width=18 border=0></a>';}
					html += '<a href="" ONCLICK="return price_image(\'' + myid + '\',\''+myrmrftype+'\');" class="iconlink" Title="Price Image"><IMG src=/graphics/icon03.gif height=15 width=10 border=0></a>';
					html += '<a href="" ONCLICK="enlarge2(\'' + myid + '\'' + ',' + '\'' + showid + '\'); return false;" class="iconlink" title="Enlarge image and more info"><IMG src=/graphics/icon04.gif height=15 width=12 border=0></a>&nbsp;';
					html += '</div><div class=idrow><font class=imid>' + displayid + '</font>';
					if(typeof(suppressrmrftype) == 'undefined'){
						html += '  <font class=rmrfindicator>'+rm[showid]+'</font>';
					}
					html +='</DIV>';
                                        html += myhrdlink;


					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:152px; height:' + theight + 'px; overflow: hidden;"><div style="border: solid 1px #999;padding: 0px;height:135px;width:135px;">';
					html += writesimilar(myid,showid,myphotographer,myshortcaption,'start','normal');
                                        html += myhrdlink;

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

			}
		}
	} 
	return html;
};

function writesearch_custom() {
        panelheight=340;
        if (typeof(showIllusPhotog) != 'undefined'){ //if adding Illustration / Photography selector checkboxes
                panelheight += parseInt(showIllusPhotog);
        }

        gsearchprefs=ggetCookie('gsearchprefs');
        var temph=' checked';
        var tempv=temph;
        var temps=tempv;
        var tempp=tempv;
        var temprno='';
        var temprany=tempv;
        var temppeopany=tempv;
        var temppeopwith='';
        var temppeopwithout='';
        var temppeopcrowd='';
        var temprelany=tempv;
        var temprelonly='';
        var tempcolany=tempv;
        var tempcolcol='';
        var tempcolbw='';
        var rmc="checked";var rfc=rmc;

        var tempillustration=' checked';
        var tempphotography= tempillustration;

        var tempsearchnew = ' selected';
        var tempsearchwithin = '';

/*
 if(gsearchprefs){
                if(gsearchprefs.indexOf("f")>=0 || gsearchprefs.indexOf("g")>=0 || gsearchprefs.indexOf("h")>=0 || gsearchprefs.indexOf("i")>=0){
                        if(gsearchprefs.indexOf("f")>=0){ } else {
                                temph=' ';
                        }
                        if(gsearchprefs.indexOf("g")>=0){ } else {
                                tempv=' ';
                        }
                        if(gsearchprefs.indexOf("h")>=0){ } else {
                                tempp=' ';
                        }
                        if(gsearchprefs.indexOf("i")>=0){ } else {
                                temps=' ';
                        }
                }

                if (typeof(showIllusPhotog) != 'undefined'){ //if adding Illustration / Photography selector checkboxes
                        if(gsearchprefs.indexOf("1")<0 && gsearchprefs.indexOf("0")<0){ }
                        else
                        {
                                if(gsearchprefs.indexOf("1")<0){ tempphotography=' '; }
                                if(gsearchprefs.indexOf("0")<0){ tempillustration=' '; }
                        }
                }

                if (typeof(showSearchWithin) != 'undefined'){
                        if ( $('method') && $F('method') == 'within')
                        {
                                tempsearchnew = '';
                                tempsearchwithin = 'selected';
                        }
                        else
                        {
                                tempsearchnew = 'selected';
                                tempsearchwithin = '';
                        }
                }

                if(gsearchprefs.indexOf("j")<0 || gsearchprefs.indexOf("k")<0){
                        if(gsearchprefs.indexOf("k")<=0 && gsearchprefs.indexOf("j")<=0 ){ }
                        else
                        {
                                if(gsearchprefs.indexOf("k")<=0){// && ! gsearchprefs.indexOf("k")>=0){
                                        rfc = "";
                                }
                                if(gsearchprefs.indexOf("j")<=0){// && ! gsearchprefs.indexOf("j")>=0){
                                        rmc = "";
                                }
                        }
                }

	   if(gsearchprefs.indexOf("b")>=0){ //restrictions
                        temprany='';
                        temprno='checked';
                }
                if(gsearchprefs.indexOf("c")>=0 || gsearchprefs.indexOf("d")>=0 || gsearchprefs.indexOf("e")>=0)
                {
                        if(gsearchprefs.indexOf("c")>=0) //without people
                        {
                                temppeopany = '';
                                temppeopwith = '';
                                temppeopwithout = 'checked';
                                temppeopcrowd = '';
                        }
                        if(gsearchprefs.indexOf("d")>=0) //with people
                        {
                                temppeopany = '';
                                temppeopwith = 'checked';
                                temppeopwithout = '';
                                temppeopcrowd = '';
                        }
                        if(gsearchprefs.indexOf("e")>=0) //with crowd
                        {
                                temppeopany = '';
                                temppeopwith = '';
                                temppeopwithout = '';
                                temppeopcrowd = 'checked';
                        }
                }
                if(gsearchprefs.indexOf("a")>=0){
                        temprelonly = 'checked';
                        temprelany = '';
                }
                if(gsearchprefs.indexOf("m")>=0 || gsearchprefs.indexOf("n")>=0 || gsearchprefs.indexOf("o")>=0)
                {
                        if(gsearchprefs.indexOf("m")>=0) //any
                        {
                                tempcolany='checked';
                                tempcolcol='';
                                tempcolbw='';
                        }
                        if(gsearchprefs.indexOf("n")>=0) //
                        {
                                tempcolany='';
                                tempcolcol='checked';
                                tempcolbw='';
                        }
                        if(gsearchprefs.indexOf("o")>=0) //
                        {
                                tempcolany='';
                                tempcolcol='';
                                tempcolbw='checked';
                        }
                }
        }
*/
	  var thehtml = '<form action="javasc' + 'ript:g(); return false;" method=get name=displaypanel id=displaypanel>';
        thehtml += '<div id="searchpanelouter"><table cellspacing=0 cellpadding=10 border=0 width=100% height=' + panelheight + '>';
        thehtml += '<tr><td valign=top align=left class="light1"><div id="searchpanelcolumn1">';
        thehtml += '<b>ORIENTATION:</b><br>';
        thehtml += '<table cellspacing=3 cellpadding=0 border=0><tr>';
        thehtml += '<td><nobr><input type=checkbox name=orient value=horizontal onclick=javasc' + 'ript:fsearchprefs("f","add"); ' + temph + '> Horizontal</nobr></td></tr>';
        thehtml += '<tr><td><input type=checkbox name=orient value=vertical onclick=javasc' + 'ript:fsearchprefs("g","add"); ' + tempv + '> Vertical</td></tr>';
        thehtml += '<tr><td><input type=checkbox name=orient value=panoramic onclick=javascr' + 'ipt:fsearchprefs("h","add"); ' + tempp + '> Panororamic</td></tr>';
        thehtml += '<tr><td><input type=checkbox name=orient value=square onclick=javasc' + 'ript:fsearchprefs("i","add"); ' + temps + '> Square</td></tr>';
        thehtml += '</table><br>';
        thehtml += '<b>COLOR:</b><br>';
        thehtml += '<table cellspacing=3 cellpadding=0 border=0>';
        thehtml += '<tr><td><nobr><input '+tempcolany+' type=radio name=color value="" onclick=javascr' + 'ipt:fsearchprefs("color","add");> Any</td></tr>';
        thehtml += '<tr><td><nobr><input '+tempcolcol+' type=radio name=color value=color onclick=javascr' + 'ipt:fsearchprefs("color","add");> Color</td></tr>';
        thehtml += '<tr><td><input '+tempcolbw+' type=radio name=color value=gray onclick=javascr' + 'ipt:fsearchprefs("color","add");> B/W</td></tr>';
        thehtml += '</table></div>';

        if (typeof(rmonly) == 'undefined'){
                thehtml += '<BR><b>TYPE:</b><br>';
                thehtml += '<table cellspacing="0" cellpadding="3" border="0"><tr><td><nobr><input type="checkbox" name="rmrftype" value="RM" ' + rmc + ' onclick=javascr' + 'ipt:fsearchprefs("RM","add");> Rights Managed</nobr></font></td>';
                thehtml += '</tr><tr><td><input type="checkbox" name="rmrftype" value="RF" ' + rfc + ' onclick=javascr' + 'ipt:fsearchprefs("RF","add");> Royalty Free</font></td></tr></table>';
        }

   thehtml += '</td><td valign=top align=left class="light1"><div id="searchpanelcolumn2">';

        if (typeof(showIllusPhotog) != 'undefined'){
                thehtml += '<b>MEDIA:</b><br>';
        thehtml += '<input type="checkbox" name="searchinclude" value="illustration"' + tempillustration + ' onclick=javascr' + 'ipt:fsearchprefs("1","add"); />Illustration<br/>';
        thehtml += '<input type="checkbox" name="searchinclude" value="photography"' + tempphotography + ' onclick=javascr' + 'ipt:fsearchprefs("0","add"); />Photography<br/>';
        thehtml += '<br/>';
        }

        if (typeof(suspendYesNoRestrictons) == 'undefined'){
                thehtml += '<b>RESTRICTIONS:</b><br>';
                thehtml += '<input '+temprany+' type=radio name=restrictions value="" onclick=javascr' + 'ipt:fsearchprefs("norestrictions","remove");> Any<br>';
                thehtml += '<input '+temprno+' type=radio name=restrictions value=not+imagehasrestrictions  onclick=javascr' + 'ipt:fsearchprefs("norestrictions","add");> No Restrictions<br>';
                thehtml += '<br>';
        }

        if (typeof(suspendWithPeople) == 'undefined'){
                thehtml += '<b>PEOPLE:</b><br>';
                thehtml += '<input '+temppeopany+' type=radio name=people value="" onclick=javasc' + 'ript:fsearchprefs("people","remove");> Any<br>';
                thehtml += '<input '+temppeopwith+' type=radio name=people value=withpeople onclick=javasc' + 'ript:fsearchprefs("withpeople","add");> With People<br>';
                thehtml += '<input '+temppeopwithout+' type=radio name=people value=nobody onclick=javascr' + 'ipt:fsearchprefs("nobody","add");> Without People<br>';
                thehtml += '<input '+temppeopcrowd+' type=radio name=people value=withcrowd onclick=javascr' + 'ipt:fsearchprefs("withcrowd","add");> Crowd<br>';
        }

        thehtml += '<br><b>RELEASES:</b><br>';
        thehtml += '<font class=small>';
        thehtml += '<input '+temprelany+' type=radio name=xtrasql value="" onclick=javascr' + 'ipt:fsearchprefs("released","remove");> Any release status<br>';
        thehtml += '<input '+temprelonly+' type=radio name=xtrasql value=released onclick=javascr' + 'ipt:fsearchprefs("released","add");> Only show released images<br>';

// conditional to insert 'search within' box in dropdown:
        if (typeof(showSearchWithin) != 'undefined'){
                thehtml += '<br/><b>METHOD:</b><br/>';
                thehtml += '<nobr>&nbsp;<select id="method" name="method" class="smallmenu" style="height:16px;"><option value="new" '+tempsearchnew+'>as a new search</option><option value="within" '+tempsearchwithin+'>within current results</option></select></nobr><br/>';
        }

//        thehtml += '<BR><a href="" onclick="g(); return false;"><img src="/graphics/button_go.gif" alt="search" border="0"></a><BR><BR><A href="" onclick="hidedisplaypanel(1); return false;">[x] close search options panel</A>';
        thehtml += '</td></tr></table>';
        var temp=Position.cumulativeOffset($('tablerow2'));
        center_panel(340,panelheight,thehtml,temp[1]);
        Event.observe(document, 'mousemove', getMouseXY);
 };

	




















