var frappr_url = frappr_host+"?";

addToUrl('a','widget');
addToUrl('req','photo');
if (isNaN(frappr_photo_length)) { frappr_photo_length = 400}
else if (frappr_photo_length > 2000) {frappr_photo_length = 2000}
else if (frappr_photo_length < 1) {frappr_photo_length = 1}
if (frappr_photo_orientation != "tall" && frappr_photo_orientation != "wide") {frappr_photo_orientation = "tall"}

addToUrl('width',frappr_photo_length);
addToUrl('orient',frappr_photo_orientation);
addToUrl('gid',gid);

if(typeof(nocount) != 'undefined') {
  addToUrl('nocount', '1');
}

if (frappr_photo_orientation == "tall") {
	frappr_frame_height = frappr_photo_length;
	frappr_frame_width = 100;
} else if (frappr_photo_orientation == "wide") {
	frappr_frame_width = frappr_photo_length;
	frappr_frame_height = 100;
}

function quoted(str) {
  return (str != null) ? '"' + str + '"' : '""';
}

function addToUrl(name,val) {
  frappr_url+=("&"+name+"="+val);
}

  document.write('<ifr' + 'ame' +
                 ' id="frappr_photo_frame"' +
                 ' height=' + quoted(frappr_frame_height) +
		 ' width=' + quoted(frappr_frame_width) +
                 ' frameborder="0"' +
                 ' src=' + quoted(frappr_url) +
                 ' marginwidth="0"' +
                 ' marginheight="0"' +
                 ' vspace="0"' +
                 ' hspace="0"' +
                 ' allowtransparency="true"' +
                 ' scrolling="no"></iframe>');
