// If/When people put strings in the values then correct them to integers.
q= '"';
if( catalogwidth < 120 ){ catalogwidth= 120; }
if( catalogheight < 120 ){ catalogheight= 120; }

backgroundcolor= depruts( backgroundcolor );
backgroundimage= depruts( backgroundimage );

gridwidth= depruts( gridwidth.toString() );
gridheight= depruts( gridheight.toString() );

listing= depruts( listing );

if ( listing == "" ) { listing = "score"; }
if ( parseInt(gridwidth) < 10 ) { gridwidth = 108; }
if ( parseInt(gridheight) < 11 ) { gridheight = 110; }

stuffz = "?id="+id;
stuffz+= "&bc="+backgroundcolor;
stuffz+= "&so="+listing;
stuffz+= "&gw="+gridwidth;
stuffz+= "&gh="+gridheight;
stuffz+= "&th="+thumbsize;
stuffz+= "&bi="+backgroundimage;

document.writeln( "<script>" );
document.writeln( "    var d=document.getElementById('my_catalog'); " );

document.writeln( "    d.src='http://www.joeri67.nl/boyism/frisky/catalog.php"+stuffz+"';   ");
document.writeln( "    d.style.width='"+catalogwidth+"px';    ");
document.writeln( "    d.style.height='"+catalogheight+"px';    ");

if ( backgroundcolor.length > 0 ){ document.writeln( "    d.style.backgroundColor='"+backgroundcolor+"';    "); }

document.writeln( "</script>" );

function depruts( value ){
	var r = "";
	var m = "";
	if ( value == null ){ return ""; }
	if ( value.length > 0 ){
		// value= value.toLowerCase();
		for (var i=0; i< value.length; i++){
			m= value.charAt( i );
			if ( "-0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ# :/_.~-".indexOf( m ) > 0 ){ r = r + m; }
		}
	}
	return r;
}

