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

function WindowRR(){
	var h = screen.height - 100
	self.location='helpproductinfo.shtml';
	//window.open("helpproductinfo.shtml","popWin","scrollbars=yes,resizable=yes,toolbar=no,menubar=no,directories=no,height="+h+",width=600,top=20,left=20")
}
function ShowOrHideComboText(divid, display,extended){
	document.getElementById(divid).style.display = display
	if(extended){
		if(document.getElementById(extended).innerHTML.length > 10){
			document.getElementById(divid + 'e').style.display = 'block';
		}
	}
}

var Templates = $H({});		


Templates.lightbox_new__body = new Template(
	'<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" ALIGN="left" class=popwindow width="290" height="200"><TR>'
	+'<td width="100%" class="barheader"><FONT class="bartitle">Make a new lightbox</font></td></tr>'
	+'<tr><TD ALIGN="left" VALIGN="top" class="popwindowpanel"><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: 9pt;;"><IMG src=/graphics/b_createthelightbox.gif border=0 alt="create the lightbox" style="padding-top: 3px;"></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>'
	+'</TD></TR></TABLE>'

);

Templates.lightbox_list__body = new Template(
        '<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1" ALIGN="left" width="290" style="background: #fff;"><TR>'
        +'<td class="dark1" valign=bottom width="100%"><DIV class="barheader">&nbsp;<FONT class="bartitle">"#{currentlbname}"</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><textarea style="float: left" name="lightbox_images" id="lightbox_images" rows="25" cols="50" class="lightbox_new_name">#{content}</textarea>'
        +'<A href="javascript: void(0);" onclick="javascript:$(\'lightbox_images\').focus();$(\'lightbox_images\').select(); return false;" class=lblink style="float: right; font-size: 10pt; font-weight:bold;">Select All</A><br/>'
        +'<A style="display: block; clear: both" HREF="" onclick="lightbox_list({ mode : \'close\'}); return false;">[X] close window</A>'
        +'<input type="hidden" id="images" name="images" value="#{images}">'
        +'<input type="hidden" id="origs" name="origs" value="#{origs}">'
        +'</form></DIV></TD></TR></TABLE>'
);
		

Templates.lightbox_email__body = new Template(
	'<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" ALIGN="left" class=popwindow width="390" height="280"><TR>'
	+'<td width="100%" class="barheader"><FONT class="bartitle">Email your lightbox</font></td></tr>'
	+'<tr><TD ALIGN="left" VALIGN="top" class="popwindowpanel"><form action="javascript:nada();" method="get" name="send"><p><B>E-mail your lightbox '
	+'"#{currentlbname}"</B> to a friend or colleague. Enter multiple address\' separated by a comma.</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;"><IMG src=/graphics/b_sendthislightbox.gif border=0 alt="send this lightbox" style="padding-top: 3px;"></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>'
	+'</TD></TR></TABLE>'
);
		
Templates.lightbox_rename__body = new Template(
	'<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" ALIGN="left" width="290" height="200" class=popwindow><TR>'
	+'<td width="100%" class="barheader"><FONT class="bartitle">Rename lightbox</font></td></tr>'
	+'<tr><TD ALIGN="left" VALIGN="top" class="popwindowpanel"><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><IMG src=/graphics/b_rename_lightbox.gif border=0  style="padding-top: 5px;"></A><br/><br/>Enter a new name for your lightbox in the box above.<br/><br/>'
	+'<A href="#" onclick="lightbox_email(\'close\'); return false;">[X] close window</A>'
	+'</form></TD></TR></TABLE>'
);

Templates.simplemessage__body = new Template(
	'<DIV class="popwindow"><DIV class="popwindowpanel"><FONT class="header">#{message}</font></DIV></DIV>'
);

Templates.simplemessage__body_lightbox = new Template(
	'<DIV class="popwindow"><DIV class="popwindowpanel"><FONT class="header">#{message}</DIV></DIV>'
);

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

Templates.enlarge2_act__similars = new Template (
	'<TD rowspan=2 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="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="99%" height="99%" >'
				+'<TR><TD valign="top" align="left" width="430" height="420" style="min-width: 440px">'
					+'<div style="width:420px;position:relative">#{themediainsert}</div>'
				+'<br/></td>'
				+'#{similarscolumn}'
				+'<TD align="left" rowspan=2 width="325" valign="top" style="border-left: 0px solid #bbbbbb;"><div style="padding-left: 15px;"><h3 style="color:#14aae8;">Image Details</h3>'
					+'<nobr>#{navenlargedlinksprev}'
					+'#{navbacklinks}'
					+'#{navenlargedlinksnext}</nobr>'
					+'<table cellspacing=0 cellpadding=0 style="margin-top:10px">'
					+'<tr><td><div id="siconaddsmall65" style="margin-left: 3px;"><a href="#" onclick="lightbox_addto(\'#{enlargetid}\'); return false;"></a></div></td><td><div id="iconrighttextlink"><a href="#" onclick="lightbox_addto(\'#{enlargetid}\'); return false;">ADD TO CURRENT LIGHTBOX </a></div></td></tr>'
					+'#{rmpricelink}'
					+'<tr><td><div id="siconcartsmall65"><a href="#" onclick="cart_addto(\'#{enlargetid}\'); return false;"></div></td><td><div id="iconrighttextlink"><a href="#" onclick="cart_addto(\'#{enlargetid}\'); return false;">ADD TO SHOPPING CART</a></div></td></tr>'
					+'#{downloadcomplink}'
					+'</table>'
					+'<BR/><b>Image Number:</b> #{displayenlargetid}&nbsp;<div class=rmrfindicator#{rmrftype} > </div>'
					+'<br/><b>Caption:</b> #{myshortcaption}<br/>'
					+'#{releaseinfo}'
					+'#{photographerinfo}'
					//+'#{filesizeinfo}'
					+'#{restrictionsinfo}'
					+'<BR/><A href="#" 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: 0px solid #bbbbbb; padding-left:15px;">'
					+'#{ratetierinfo}'
				+'</TD></TR>'
				+'<tr><td>#{rfcdlinkslug}</td></tr>'
				+'</table>'
	+'<BR></td></TR></table>'
);

Templates.hovercopyright__text = new Template ('<DIV id="copyright">'
		+'                                <ul id="footerLinks">'
		+'                                        <li id="contact"><a href="/contact.shtml" target="_top">CONTACT US</a></li>'
		+'                                        <li id="terms"><a href="javascript:displayWindow(\'/terms.shtml\',550,600)">TERMS &amp; CONDITIONS</a></li>'
		+'                                        <li id="privacy"><a href="javascript:displayWindow(\'/privacy.shtml\',550,600)">PRIVACY POLICY</a></li>'
		+'                                        <li id="copyrightdate">&nbsp;&copy; #{currentyear} BLEND IMAGES. ALL RIGHTS RESERVED.</li>'
		+'                                </ul>'
);



Templates.footer__body = new Template ('<DIV id="copyright">'
		+'                                <ul id="footerLinks">'
		+'                                        <li id="contact"><a href="/contact.shtml" target="_top">CONTACT US</a></li>'
		+'                                        <li id="terms"><a href="javascript:displayWindow(\'/terms.shtml\',550,600)">TERMS &amp; CONDITIONS</a></li>'
		+'                                        <li id="privacy"><a href="javascript:displayWindow(\'/privacy.shtml\',550,600)">PRIVACY POLICY</a></li>'
		+'                                        <li id="copyrightdate">&nbsp;&copy; #{currentyear} BLEND IMAGES. ALL RIGHTS RESERVED.</li>'
		+'                                </ul>'
);

Templates.tieredimgpricing__rfslug = new Template (
	'<div align="left" style="margin-top:-15px;margin-left:3px"><h3 style="color:#14aae8;">Royalty Free Licensing</h3></div>'+
	'<h4 style="text-align: left;margin-left:4px">Select a File Size</h4>'+
	'<table style="text-align: left;width: 100%;margin-top:15px" 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;">#{expr}</td><td align="left" valign=top style="border-bottom: solid #999 0px;padding-bottom: 4px; padding-top: 4px;"><br>#{currency} #{price}</tr><tr><td align="left" nowrap="nowrap" valign="top"><hr width=100%><td align="left" valign=top><nobr><A href="#" class=bluelink 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 (
	''
);

Templates.tieredimgpricing__rrslug_row = new Template (
'' 
);

Templates.tieredimgpricing__rrslug_row_removebutton = new Template (
''
);

Templates.rfcd__cdimage_detail = new Template (
	'<table cellspacing=0 cellpadding=0 border=0>' +
	'<tr>' +
	    '<td style="padding-right:10px">' +
		'<img src="http://gdynx.ipnstock.com/blendimagesv2_images/135/50/#{prime_img}.JPG"/>' +
	    '</td>' +
	    '<td><table cellspacing=0 cellpadding=0 border=0><tr><td>' +
		'<span class="header">#{featureTitle}</span><br>' +
		'This image is part of the CD collection #{featureTitle}.<br/>' +
		'<i>#{featureText}</i><br/>' +
		'#{featureLine}</td></tr>' +
	'<tr><td><div id="siconcdsmall65" style="margin:0px;padding:0px;margin-top:-5px"><A HREF="javascript:cart_addto(\'#{prime_img}\');"></div><div style="margin-top:-2px;float:left;position:relative;margin-left:5px">&nbsp;Buy this CD now</div></td></tr>' +
	'<tr><td><A style="margin:0px;padding:0px;height:12px" HREF="/SwishSearch?n=1&fn=#{featureNumber}&supst=cd">View all images on this CD</A><br><A href=/cdstore.shtml >View the CD Store</a></td></tr>' +
	    '</table></td>' +
	'</tr>' +
	'</table>' 
);

function writephotographer(){
return('');

}

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 = "";}
		var temp = true;
		var tempshortcaption='';
		myreleased = rel[showid];

		 if(showrelease){
			if(! ( myreleased == "MODEL RELEASED" || myreleased == "MODEL AND PROPERTY RELEASED" || myreleased == "PROPERTY RELEASED") ){
				myreleased = 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];
		myrgdynxf = 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 = '';
		var thisisacdimage = '';
		var cover_caption = '';
                var rfCDinfo = unescape(rfcd[showid] + " ");
		if ( rfCDinfo.toString().length > 1 )
                	rfCDinfo = rfCDinfo.evalJSON();

		if (typeof(rfCDinfo) == 'object' && rfCDinfo.type)
		{
			if (rfCDinfo.type == 'COVER')
			{
				thisisacoverimage_feature = rfCDinfo.featureNumber;
				cover_caption = 'VCD: '+rfCDinfo.featureTitle ;
			}
			else if (rfCDinfo.type == 'IMAGE')
			{
				thisisacdimage = rfCDinfo.featureNumber;
			}
		}

		



/*                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];
                }
*/
		var lbremove=0;
		if (	( 	typeof(q_args) != 'undefined' && 
				( 	q_args.match(/vmo=|vmo%3D/) || 
					q_args.match(/rid=|rid%3D/) || 
					q_args.match(/lb_view=1|lb_view%3D1/) || 
					q_args.match(/fn=|fn%3D/) && ! (totestman == 'Feature: ' || totestman == 'Virtual CD Store:' )
				)
			) 
		){
			lbremove=1;
		}

		adminheight=0;
		if(myhrdlink){
		adminheight=14;
			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 = 152 + adminheight +  + (typeof(vertremainder)=='undefined' ? 0 : vertremainder);
				var twidth = 305 + (typeof(horizremainder)=='undefined' ? 0 : horizremainder);
				if ( mysimilarto.length < 13){	
					html += '<span id="cellwrapper'+showid+'" valign=bottom style="float:left;">';
					html += '<div align=center valign=bottom style="width:' + twidth + 'px; height:' + theight + 'px;"><div style="border: solid 0px #999;padding: 0px;height:' + (theight - 5 ) + 'px ;width:299px;">';
					html += '<TABLE width=298 cellspacing=4 cellpadding=0 border0><TR><TD valign=top class=imcell>';



                                        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="' + ImageUrl('135/50',myid,showid) + '" 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>';
				
					html += '</TD><TD valign="top" class=imcell style="text-align:left">';
					
					if(thisisacoverimage_feature){html += '<div class=cdtitle style="clear:both;margin-bottom:5px">' + cover_caption + '</div>';mysshortcaption = 'Virtual CD';}
					html += '<DIV class=icons>';

						if(lbremove==1){
							html+='<div id=sicondeletesmall65><A href="#" onclick="lightbox_delete_image_enl(\'' + myid + '\'); return false;" class="lblink" TITLE="Remove this image from the lightbox"></A></div>';
						}
						html += '<div id=siconaddsmall65><a href="#" ONCLICK="lightbox_addto(\'' + myid + '\'); return false;" class="iconlink" title="Add to your current lightbox"></a></div>';
						html += '<div id=siconcartsmall65><a href="#" ONCLICK="cart_addto(\'' + myid + '\'); return false;" class="iconlink" title="Add this image to your shopping cart"></a></div>';
						html += '<div id=sicon'+rm[showid]+'small65><a href=#></a></div>';

					html += '</DIV><br clear=both>';
					if(!thisisacoverimage_feature) {html += '<font class=xsmall>ID:' + displayid;}

					if(showphotographer == 1){html +='<BR>&copy; '+currentYear+' ' + myphotographer;}
					if(showfilesize && ! thisisacoverimage_feature){html += myfilesize;}
					
					if(! thisisacoverimage_feature){html += '<br/>CAPTION: ' + myshortcaption + '<div>'+myreleased+'</div></font>';}
	if(myhrdlink)
						html += "<br/>"+myhrdlink;
					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 0px #999;padding: 0px;height:135px;width:135px;">';
					html += ( typeof(writesimilar_custom) == 'function' ? writesimilar_custom(myid,showid,myphotographer,myshortcaption,'start','list', myhrdlink) : 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 +  + (typeof(vertremainder)=='undefined' ? 0 : vertremainder);
				var twidth = 95 + (typeof(horizremainder)=='undefined' ? 0 : horizremainder);
				if ( mysimilarto.length < 13){	
					
					html += '<span valign=bottom style="float:left;">';
					html += '<div align=center valign=bottom style="width:' + twidth + 'px; height:' + theight + 'px; overflow: hidden;"><div style="border: solid 0px #999;padding: 0px;height:55px;width:88px;">';
					
					//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="' +ImageUrl('135/50',myid,showid)+ '" border=0 class=pimg vspace=1 hspace=1 height=55';
					html += " onmouseover=\"prloadimg('"+ myid +"'); sp(this, '" + myid + "', '" + showid + "','"+tset+"');";
					html += '" onmouseout="hp();" id=' + myid + '>';
					html += '</a></div>';
					html += '<DIV class=icons>';

					if(lbremove==1){
						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=16 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=16 width=11 border=0></a>';
					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=16 width=21 border=0></a>';
					if(thisisacoverimage_feature){html += '<A href="/SwishSearch?n=1&fn=' + thisisacoverimage_feature + '&supst=cd"><IMG src=/graphics/cd.gif height=16 width=18 border=0></a>';}
					else if(thisisacdimage){html += '<A href="/SwishSearch?n=1&fn=' + thisisacdimage + '&supst=cd"><IMG src=/graphics/cd.gif height=16 width=18 border=0></a>';}
					html += '<IMG class=rmrfindicator src=/graphics/icon_'+rm[showid]+'.gif height=16 width=19 border=0>';

//					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>&nbsp;';
					if(thisisacoverimage_feature){html += '</div><div class=cdtitletiny style="clear:both;margin-top:2px">' + cover_caption + '';
					} else { html += '</div><div class=idrow><font class=imid>' + displayid + '</font>';}
					html +='</DIV>';
                    html += myhrdlink;

					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;"><div style="border: solid 0px #999;padding: 0px;height:55px;width:88px;">';
					//html += writesimilar(myid,showid,myphotographer,myshortcaption,'start','tiny');		
                                        html += ( typeof(writesimilar_custom) == 'function' ? writesimilar_custom(myid,showid,myphotographer,myshortcaption,'start','tiny', myhrdlink) : writesimilar(myid,showid,myphotographer,myshortcaption,'start','tiny', myhrdlink) );
					html += myhrdlink;
					html += '</DIV></SPAN>';
				}
			
			
			} else if (viewmode == "med"){
				var theight = 130 + adminheight  + (typeof(vertremainder)=='undefined' ? 0 : vertremainder);
				var twidth = 140 + (typeof(horizremainder)=='undefined' ? 0 : horizremainder);
				if ( mysimilarto.length < 13){	
								
					html += '<span valign=bottom style="float:left;">';
		
					html += '<div align=center style="padding:0px;margin:0px;width:' + twidth + 'px; height:' + theight + 'px; overflow: hidden;"><table cellpadding=0 cellspacing=0 style="border: solid 0px #999;padding: 0px;margin:0px;height:79px;width:128px;"><tr><td align=center height=77>';

                                        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 += '<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="' + ImageUrl('135/50',myid,showid) + '" border=0 vspace=1 class=pimg hspace=1 height=79';
					html += " onmouseover=\"prloadimg('"+ myid +"'); sp(this, '" + myid + "', '" + showid + "','"+tset+"');";
					html += '" onmouseout="hp();" id=' + myid + '>';
					html += '</a></td></tr></table>';

html += '<DIV class=sicons style="text-align:center;clear:both;margin-top:-10px"><table align=center cellspacing=0 cellpadding=0><tr><td>';
if(lbremove==1){
	html+='<div id=sicondeletesmall65><a href="#" onclick="lightbox_delete_image_enl(\'' + myid + '\'); return false;" class="lblink" TITLE="Remove this image from the lightbox"></a></div>';
}
html += '<div id=siconaddsmall65><a href="#" ONCLICK="lightbox_addto(\'' + myid + '\'); return false;" class="iconlink" title="Add to your current lightbox"></a></div>';
html += '<div id=siconcartsmall65><a href="#" ONCLICK="cart_addto(\'' + myid + '\'); return false;" class="iconlink" title="Add this image to your shopping cart"></a></div>';
if(thisisacoverimage_feature){html += '<div id=siconcdsmall65><A href="/SwishSearch?n=1&fn=' + thisisacoverimage_feature + '&supst=cd"></a></div>';}
else if(thisisacdimage){html += '<div id=siconcdsmall65><A href="/SwishSearch?n=1&fn=' + thisisacdimage + '&supst=cd"></a></div>';}
html += '<div id=sicon'+rm[showid]+'small65><a href=#></a></div>';
						if(thisisacoverimage_feature){html += '</div><div style="clear:both:height:3px"></div><div class=cdtitle style="clear:both;padding:3px">' + cover_caption + '';}
html += '</td></tr></table>';
if(!thisisacoverimage_feature){
html+='<div id=simageid>' + displayid + '</div>';
}
						html += '</DIV>'+ myhrdlink;
					html += '</div></SPAN>';

				} else {				
	
					html += '<span valign=bottom style="float:left;"><div style="border: solid 0px #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');		
                                        html += ( typeof(writesimilar_custom) == 'function' ? writesimilar_custom(myid,showid,myphotographer,myshortcaption,'start','med', myhrdlink) : writesimilar(myid,showid,myphotographer,myshortcaption,'start','med', myhrdlink) );
					if(myhrdlink)
						html += myhrdlink;
					html += '</DIV></SPAN>';
				}
			} else if (viewmode == "ss"){			
				html = '  ';
			} else if (viewmode == "huge"){		
				var theight = 230 + adminheight +  + (typeof(vertremainder)=='undefined' ? 0 : vertremainder);
				var twidth = 340 + (typeof(horizremainder)=='undefined' ? 0 : horizremainder);
				if ( mysimilarto.length < 13){	
					html += '<span valign=bottom style="float:left;">';
					html += '	<div align=center valign=bottom style="width:' + twidth + 'px; height:' + theight + 'px; overflow: hidden;"><div style="border: solid 0px #999;padding: 0px;height:202px;width:340px;">';
						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"><img src="' + ImageUrl('420/60',myid,showid) + '" border="0" vspace="1" hspace="3" alt="loading..." height="202"></a></div>';
					html += '<DIV class=icons style="text-align:center;clear:both;"><table align=center><tr><td>';
						if(lbremove==1){
							html+='<div id=sicondeletesmall65><A href="#" onclick="lightbox_delete_image_enl(\'' + myid + '\'); return false;" class="lblink" TITLE="Remove this image from the lightbox"></A></div>';
						}
						html += '<div id=siconaddsmall65><a href="#" ONCLICK="lightbox_addto(\'' + myid + '\'); return false;" class="iconlink" title="Add to your current lightbox"></a></div>';
						html += '<div id=siconcartsmall65><a href="#" ONCLICK="cart_addto(\'' + myid + '\'); return false;" class="iconlink" title="Add this image to your shopping cart"></a></div>';
						if(thisisacoverimage_feature){html += '<div id=siconcdsmall65><A href="/SwishSearch?n=1&fn=' + thisisacoverimage_feature + '&supst=cd"></a></div>';}
						else if(thisisacdimage){html += '<div id=siconcdsmall65><A href="/SwishSearch?n=1&fn=' + thisisacdimage + '&supst=cd"></a></div>';}
						html += '<div id=sicon'+rm[showid]+'small65><a href=#></a></div>';
					if(!thisisacoverimage_feature){	html += '<div id=imageid>' + displayid + '</div>';}
						if(thisisacoverimage_feature){html += '</div><div class=cdtitle style="clear:both;margin-bottom:3px">' + cover_caption + '';}
						html += '</td></tr></table></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 0px #999;padding: 0px;height:192px;width:320px;">';
                                        html += ( typeof(writesimilar_custom) == 'function' ? writesimilar_custom(myid,showid,myphotographer,myshortcaption,'start','huge', myhrdlink) : writesimilar(myid,showid,myphotographer,myshortcaption,'start','huge', myhrdlink) );
                                        html += myhrdlink;

					html += '</DIV></SPAN>';
				}	
				
			} else if (viewmode == "large"){
			

				var theight = 205 + adminheight  + (typeof(vertremainder)=='undefined' ? 0 : vertremainder);
				var twidth = 187 + (typeof(horizremainder)=='undefined' ? 0 : horizremainder);
				if ( mysimilarto.length < 13){		
					html += '<span valign=bottom style="float:left;">';

					html += '<div align=center valign=bottom style="width:' + twidth + 'px; height:' + theight + 'px; overflow:hidden;"><div style="border: solid 0px #999;padding: 0px;height:170px;width:172px;background: url(' + ImageUrl('170/85', myid,showid) + ') center bottom no-repeat;">';
					//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="/graphics/spacer.gif" class=pimg height=170 width=170 border="0"';
					
					html += " onmouseover=\"prloadimg('"+ myid +"'); sp(this, '" + myid + "','" + showid + "','"+tset+"');";
					html += '" onmouseout="hp();" id=' + myid + '>';
					
					html += '</a></div>';
					html += '<DIV class=icons style="text-align:center;clear:both;margin-top:-5px"><table align=center><tr><td>';

					
                                        if(lbremove==1){
						html+='<div id=sicondeletesmall65><A href="#" onclick="lightbox_delete_image_enl(\'' + myid + '\'); return false;" class="iconlink" TITLE="Remove this image from the lightbox"></A></div>';
					}

					html += '<div id=siconaddsmall65><a href="#" ONCLICK="lightbox_addto(\'' + myid + '\'); return false;" class="iconlink" title="Add to your current lightbox"></a></div>';
					html += '<div id=siconcartsmall65><a href="#" ONCLICK="cart_addto(\'' + myid + '\'); return false;" class="iconlink" title="Add this image to your shopping cart"></a></div>';
//					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;';
					if(thisisacoverimage_feature){html += '<div id=siconcdsmall65><A href="/SwishSearch?n=1&fn=' + thisisacoverimage_feature + '&supst=cd"></a></div>';}
					else if(thisisacdimage){html += '<div id=siconcdsmall65><A href="/SwishSearch?n=1&fn=' + thisisacdimage + '&supst=cd"></div>';}
						html += '<div id=sicon'+rm[showid].toUpperCase()+'small65><a href=#></a></div>';
						html += '</td></tr></table>';
						if(!thisisacoverimage_feature){html += '<div id=simageid>' + displayid + '</div>';}
					
					if(thisisacoverimage_feature){html += '</div><div class=cdtitle style="clear:both;padding:2px">' + cover_caption + '';}
					//} else {html += '</div><div class=idrow><font class=imid>' + displayid + '</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:152px; height:' + theight + 'px; overflow: hidden;"><div style="border: solid 0px #999;padding: 0px;height:135px;width:135px;">';
					//html += writesimilar(myid,showid,myphotographer,myshortcaption,'start','normal');
                                        html += ( typeof(writesimilar_custom) == 'function' ? writesimilar_custom(myid,showid,myphotographer,myshortcaption,'start','normal', myhrdlink) : writesimilar(myid,showid,myphotographer,myshortcaption,'start','normal', myhrdlink) );
                                        html += myhrdlink;

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

			
			
			
				
				
			} else {
				var theight = 173 + adminheight + (typeof(vertremainder)=='undefined' ? 0 : vertremainder);
				var twidth = 152 + (typeof(horizremainder)=='undefined' ? 0 : horizremainder);
				if ( mysimilarto.length < 13){		
					html += '<span valign=bottom style="float:left;">';
					html += '<div align=center valign=bottom style="width:' + twidth + 'px; height:' + theight + 'px; overflow:hidden;"><div style="border: solid 0px #999;padding: 0px;height:137px;width:137px;background: url(' + ImageUrl('135/50', myid,showid) + ') center bottom no-repeat;">';

                                        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="/graphics/spacer.gif" class=pimg height=135 width=135 border="0"';
					
					html += " onmouseover=\"prloadimg('"+ myid +"'); sp(this, '" + myid + "','" + showid + "','"+tset+"');";
					html += '" onmouseout="hp();" id=' + myid + '>';
					
					html += '</a></div>';

html += '<DIV class=sicons style="text-align:center;clear:both;margin-top:-5px"><table align=center><tr><td>';
if(lbremove==1){
	html+='<div id=sicondeletesmall65><a href="#" onclick="lightbox_delete_image_enl(\'' + myid + '\'); return false;" class="lblink" TITLE="Remove this image from the lightbox"></a></div>';
}
html += '<div id=siconaddsmall65><a href="#" ONCLICK="lightbox_addto(\'' + myid + '\'); return false;" class="iconlink" title="Add to your current lightbox"></a></div>';
html += '<div id=siconcartsmall65><a href="#" ONCLICK="cart_addto(\'' + myid + '\'); return false;" class="iconlink" title="Add this image to your shopping cart"></a></div>';
if(thisisacoverimage_feature){html += '<div id=siconcdsmall65><A href="/SwishSearch?n=1&fn=' + thisisacoverimage_feature + '&supst=cd"></a></div>';}
else if(thisisacdimage){html += '<div id=siconcdsmall65><A href="/SwishSearch?n=1&fn=' + thisisacdimage + '&supst=cd"></a></div>';}
html += '<div id=sicon'+rm[showid]+'small65><a href=#></a></div>';
						if(thisisacoverimage_feature){html += '</div><div class=cdtitl style="clear:both;padding:3px">' + cover_caption + '';}
html += '</td></tr></table>';
			if(!thisisacoverimage_feature) {html += '<div id=simageid>' + displayid + '</div>'; }

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

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


			}
		}
	} 
	return html;
};



        function setuppagesize_cellsizes_custom()
        {
	 if(browser == "Internet Explorer")
		winH -=25;
	else
		winH -=30;
            imagerows=Math.floor(winH/(173 + adminheight));
            imagespaceheight=imagerows * (173 + adminheight);
            area=imagerows * Math.floor(winW/150);

            if(! viewmode && imagerows == 1)
            {
                viewmode='med';
                gsetCookie('gviewmode','med', '', '/', gGetCookieDom());
            }
			if(!viewmode){viewmode='table';}
            if(viewmode){
            	qq("viewmode=" + viewmode);
                if(viewmode == 'editing'){
                		if(typeof(InitSafetyCheck)=='function'){InitSafetyCheck('135/50');};
                        imagerows=Math.floor(winH/(160 + adminheight));
                        if(imagerows == 0)
                             imagerows=1;
                        imagespaceheight=imagerows * (160 + adminheight);
                        area=imagerows * Math.floor(winW/300.00);
						vertremainder=Math.floor((winH - (imagerows*(160 + adminheight)))/imagerows);
						horizremainder=Math.floor(    (winW - (Math.floor(winW/300) * 300))      /    Math.floor(winW/300)             );
                } else  if(viewmode == 'list'){
                		if(typeof(InitSafetyCheck)=='function'){InitSafetyCheck('135/50');};
                        imagerows=Math.floor(winH/(152.00 + adminheight));
                        if(imagerows == 0)
                                imagerows=1;
                        imagespaceheight=imagerows * (152 + adminheight);
                        area=imagerows * Math.floor(winW/305.00);
						vertremainder=Math.floor((winH - (imagerows*(152 + adminheight)))/imagerows);
                        horizremainder=Math.floor(    (winW - (Math.floor(winW/305) * 305))      /    Math.floor(winW/305)             );
                } else  if (viewmode == 'tiny'){
                		if(typeof(InitSafetyCheck)=='function'){InitSafetyCheck('135/50');};
                        imagerows=Math.floor(winH/(106.00 + adminheight));
                        if(imagerows == 0)
                                imagerows=1;
                        imagespaceheight=imagerows * (106 + adminheight);
                        area=imagerows * Math.floor(winW/96.00);
						vertremainder=Math.floor((winH - (imagerows*(106 + adminheight)))/imagerows);
                        horizremainder=Math.floor(    (winW - (Math.floor(winW/96) * 96))      /    Math.floor(winW/96)             );
                } else if (viewmode == 'med'){
                	if(typeof(InitSafetyCheck)=='function'){InitSafetyCheck('135/50');};
                        imagerows=Math.floor(winH/(130.00 + adminheight));
                        if(imagerows == 0)
                                imagerows=1;
                        imagespaceheight=imagerows * (130 + adminheight);
                        area=imagerows * Math.floor(winW/140.00);
			vertremainder=Math.floor((winH - (imagerows*(130 + adminheight)))/imagerows);
                        horizremainder=Math.floor(    (winW - (Math.floor(winW/140) * 140))      /    Math.floor(winW/140)             );
                } else if (viewmode == 'huge'){
                		if(typeof(InitSafetyCheck)=='function'){InitSafetyCheck('420/60');};
                        imagerows=Math.floor(winH/(230.00 + adminheight));
                        if(imagerows == 0)
                                imagerows=1;
                        imagespaceheight=imagerows * (230 + adminheight);
                        area=imagerows * Math.floor(winW/340.00);
						vertremainder=Math.floor((winH - (imagerows*(230 + adminheight)))/imagerows);
                        horizremainder=Math.floor(    (winW - (Math.floor(winW/340) * 340))      /    Math.floor(winW/340)             );
                } else if (viewmode == 'large'){
                		if(typeof(InitSafetyCheck)=='function'){InitSafetyCheck('170/85');};
                        imagerows=Math.floor(winH/(201.00 + adminheight));
                        if(imagerows == 0)
                           imagerows=1;
                        imagespaceheight=imagerows * (201 + adminheight);
                        area=imagerows * Math.floor(winW/187.00);
						vertremainder=Math.floor((winH - (imagerows*(201 + adminheight)))/imagerows);
                        horizremainder=Math.floor(    (winW - (Math.floor(winW/187) * 187))      /    Math.floor(winW/187)             );

                } else {
                		if(typeof(InitSafetyCheck)=='function'){InitSafetyCheck('135/50');};
		                imagerows=Math.floor(winH/(173 + adminheight));
                        if(imagerows == 0)
                         imagerows=1;
                        imagespaceheight=imagerows * (173 + adminheight);
                        area=imagerows * Math.floor(winW/152);
						vertremainder=Math.floor((winH - (imagerows*(173 + adminheight)))/imagerows);
						horizremainder=Math.floor(    (winW - (Math.floor(winW/152) * 152))      /    Math.floor(winW/152)             );
						}
                qq("winH=" + winH + " winW=" + winW + " imagerows=" + imagerows + " totalimages=" + area + " horizremainder=" + horizremainder + " verticalremainder=" + vertremainder);
			}
}




















