﻿var extraStyle = '';
var widthType = 'px';
var fullUrl = 'http://feed.similarad.com/async?';
if (typeof(searchUrl) == 'undefined'){var searchUrl = location.href;}
fullUrl = fullUrl + 'st=' + escape(searchUrl) + '&';
try{fullUrl = fullUrl + 'ref=' + escape(location.href) + '&';}catch(e){}
if (typeof (query) != 'undefined') { fullUrl = fullUrl + 'qry=' + query + '&'; }
if (typeof (clientSearchTerm) != 'undefined') { fullUrl = fullUrl + 'cst=' + clientSearchTerm + '&'; }
if (typeof (profileID) != 'undefined') { fullUrl = fullUrl + 'pid=' + profileID + '&'; }
if (typeof(adStream) != 'undefined'){fullUrl = fullUrl + 'as=' + adStream + '&';}
if (typeof(sourceID) != 'undefined'){fullUrl = fullUrl + 's=' + sourceID + '&';}
if (typeof(placementType) != 'undefined'){if(placementType=='1'){extraStyle='float:left;';}if(placementType=='2'){widthType='%';}}
if (typeof(subID) != 'undefined'){fullUrl = fullUrl + 'subid=' + subID + '&';}
if (typeof(modeID) != 'undefined'){fullUrl = fullUrl + 'md=' + modeID + '&';}
if (typeof(adlt) != 'undefined'){fullUrl = fullUrl + 'adlt=' + adlt + '&';}
if (typeof(count) == 'undefined'){var count = '1';}
fullUrl = fullUrl + 'c=' + count + '&';

var external_display = 'display: inline-table;';
try { var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1; if (is_chrome) {external_display = '';  } } catch (e) { }

if (typeof(placementID) != 'undefined'){fullUrl = fullUrl + 'place=' + placementID + '&';}
if ((typeof(similar_ad_width) != 'undefined') && (typeof(similar_ad_height) != 'undefined')){
document.write('<ins style="' + extraStyle + 'border: medium none ; margin: 0pt; padding: 0pt; ' + external_display + ' height: ' + similar_ad_height + 'px; position: relative; visibility: visible; width: ' + similar_ad_width + widthType + ';">');
document.write('<ins style="border: medium none ; margin: 0pt; padding: 0pt; display: block; height: ' + similar_ad_height + 'px; position: relative; visibility: visible; width: ' + similar_ad_width + widthType + ';">');
document.write('<iframe width="' + similar_ad_width + widthType + '" height="' + similar_ad_height + '" frameborder="0" scrolling="no" vspace="0" style="left: 0pt; position: absolute; top: 0pt;" src="' + fullUrl + '" name="similar_ads_frame" marginwidth="0" marginheight="0" id="similar_ads_frame1" hspace="0" allowtransparency="true"></iframe>');
document.write('</ins>');
document.write('</ins>');
}
