wg_process = function() { this.buildUrl = function() { this.wg_cabtestid=getWbCookie(GetDomain()+'_TestID'); if(this.wg_cabtestid != '') this.wg_cabtestid = '&cabtestid='+this.wg_cabtestid; this.wg_cabtestshow=getWbCookie(GetDomain()+'_ShowWidget'); if(this.wg_cabtestshow != '') this.wg_cabtestshow = '&abtestshow='+this.wg_cabtestshow; this.wg_downminprc = ''; if(typeof(wg_downminprc) != 'undefined') this.wg_downminprc = '&downminprc='+wg_downminprc; this.wg_downmaxprc = ''; if(typeof(wg_downmaxprc) != 'undefined') this.wg_downmaxprc = '&downmaxprc='+wg_downmaxprc; this.wg_upminprc = ''; if(typeof(wg_upminprc) != 'undefined') this.wg_upminprc = '&upminprc='+wg_upminprc; this.wg_upmaxprc = ''; if(typeof(wg_upmaxprc) != 'undefined') this.wg_upmaxprc = '&upmaxprc='+wg_upmaxprc; this.wg_upc = ''; if(typeof(wg_upc) != 'undefined') this.wg_upc = '&upc='+wg_upc; this.wg_isbn = ''; if(typeof(wg_isbn) != 'undefined') this.wg_isbn = '&isbn='+wg_isbn; this.wg_mfg = ''; if(typeof(wg_mfg) != 'undefined') this.wg_mfg = '&mfg='+encodeURIComponent(wg_mfg.replace('\t',' ')); this.wg_price = ''; if(typeof(wg_price) != 'undefined') this.wg_price = '&price='+wg_price; this.wg_client_aid = ''; if(typeof(wg_client_aid) != 'undefined') this.wg_client_aid = '&aid='+wg_client_aid; this.wg_client_id = ''; if(typeof(wg_client_id) != 'undefined') this.wg_client_id = '?id='+wg_client_id; this.wg_height = ''; if(typeof(wg_height) != 'undefined') this.wg_height = '&szh='+wg_height; this.wg_length = ''; if(typeof(wg_length) != 'undefined') this.wg_length = '&szl='+wg_length; this.wg_cat = ''; if(typeof(wg_cat) != 'undefined') this.wg_cat = '&dcat='+wg_cat; this.wg_noncore = ''; if(typeof(wg_noncore) != 'undefined') this.wg_noncore = '&noncore='+wg_noncore; this.wg_tpltype = ''; if(typeof(wg_tpltype) != 'undefined') wg_tpltype = "&tpltype="+wg_tpltype; this.wg_text_color = ''; if(typeof(wg_text_color) != 'undefined') this.wg_text_color = '&tc='+wg_text_color; this.wg_link_color = ''; if(typeof(wg_link_color) != 'undefined') this.wg_link_color = '&lc='+wg_link_color; this.wg_border_color = ''; if(typeof(wg_border_color) != 'undefined') this.wg_border_color = '&bc='+wg_border_color; this.wg_abtest_id = ''; if(typeof(wg_abtest_id) != 'undefined') wg_abtest_id = '&abtestid='+wg_abtest_id; this.wg_font_family = ''; if(typeof(wg_font_family) != 'undefined') this.wg_font_family = '&wff='+wg_font_family; this.wg_font_style = ''; if(typeof(wg_font_style) != 'undefined') this.wg_font_style = '&wfs='+wg_font_style; this.wg_extendedcss = ''; if(typeof(wg_extendedcss) != 'undefined') this.wg_extendedcss = '&extcss='+wg_extendedcss; this.wg_changewidget = 0; if(typeof(wg_changewidget) != 'undefined') this.wg_changewidget = wg_changewidget; this.wg_noncache = ''; if(typeof(wg_noncache) != 'undefined') this.wg_noncache = '&noncache='+wg_noncache; this.wg_nomimage = ''; if(typeof(wg_nomimage) != 'undefined') this.wg_nomimage = '&nomimage='+wg_nomimage; this.wg_domain = ''; if(typeof(wg_domain) != 'undefined') this.wg_domain = '&wgdomain='+wg_domain; this.wg_ts = ''; this.ts = ''; if(typeof(wg_ts) != 'undefined') { this.ts = wg_ts; this.wg_ts = '&ts='+this.ts; } this.wg_tsblank = '&ts2='+1327692129689+'&ts3='; this.wg_cacheid = ''; if(typeof(wg_cacheid) != 'undefined') this.wg_cacheid = '&cacheid='+encodeURIComponent(wg_cacheid.replace('\t',' ')); this.wg_kw = ''; if(typeof(wg_kw) != 'undefined') this.wg_kw = '&kw='+encodeURIComponent(wg_kw.replace('\t',' ')); this.wg_searchterm = ''; if(typeof(wg_searchterm) != 'undefined') this.wg_searchterm = '&q='+encodeURIComponent(wg_searchterm.replace('\t',' ')); this.wg_width = ''; if(typeof(wg_width) != 'undefined') this.wg_width = '&szw='+wg_width; this.wg_alglist = ''; if(typeof(wg_alglist) != 'undefined') this.wg_alglist = '&alglist='+wg_alglist; this.wg_category = ''; if(typeof(wg_category) != 'undefined') this.wg_category = '&wgcategory='+encodeURIComponent(wg_category.replace('\t',' ')); this.wg_map = ''; if(typeof(wg_map) != 'undefined') this.wg_map = '&map='+wg_map; this.wg_includeequal = ''; if(typeof(wg_includeequal) != 'undefined') this.wg_includeequal = '&wg_includeequal='+wg_includeequal; this.wg_url = ''; if(typeof(wg_url) != 'undefined') this.wg_url = '&u='+wg_url; else this.wg_url = geturl(); this.strUrl = 'http://widget.winbuyer.com/w/jswidget.aspx'; if( this.wg_client_id != '' ) { this.strUrl += this.wg_client_id+this.wg_font_family+this.wg_font_style+this.wg_client_aid+this.wg_text_color+ this.wg_link_color+this.wg_border_color+this.wg_width+this.wg_height+this.wg_length+this.wg_cat+this.wg_noncore+ this.wg_ts+this.wg_tsblank+this.wg_noncache+this.wg_tpltype+this.wg_extendedcss+this.wg_abtest_id+this.wg_cabtestid+ this.wg_cabtestshow+this.wg_nomimage+this.wg_domain+this.wg_cacheid+this.wg_kw+this.wg_alglist+ this.wg_searchterm+this.wg_price+this.wg_mfg+this.wg_upc+this.wg_isbn+this.wg_downminprc+this.wg_downmaxprc+this.wg_upminprc+ this.wg_upmaxprc+this.wg_category+this.wg_map+this.wg_includeequal+this.wg_url; } }; this.frameName = 'wg_frame'+wg_ts; this.creatediv = function(){ document.write('
')}; } var wg_process = new wg_process(); if(typeof(wg_processes) == 'undefined') var wg_processes = new Array(); wg_processes[wg_ts] = wg_process; wg_processes[wg_ts].creatediv(); wg_processes[wg_ts].buildUrl(); function reloadwidget() { wg_processes[wg_ts].buildUrl(); loadJs(wg_processes[wg_ts].strUrl); } function loadJs(filename) { //create DOM-element and set parameters var loadedJS = document.createElement('script'); loadedJS.src = filename; loadedJS.type = "text/javascript"; loadedJS.language = "javascript"; //get element head var head = document.getElementsByTagName('head')[0]; //insert new script into head head.appendChild(loadedJS); } function changewidget(u,upc,finish) { if(typeof(finish) != 'undefined') u = setparam(u,'finish', encodeURIComponent(finish.replace('\t',' '))); wg_process.strUrl += '&u=' + u; loadJs(wg_process.strUrl); } function setGlobalOnLoad(f) { var root = window.addEventListener || window.attachEvent ? window : document.addEventListener ? document : null if (root){ if(root.addEventListener) root.addEventListener("load", f, false) else if(root.attachEvent) root.attachEvent("onload", f) } else { if(typeof window.onload == 'function') { var existing = window.onload window.onload = function() { existing() f() } } else { window.onload = f } } } function GetDomain() { return document.domain.replace(new RegExp(/^www\./i),"").split(".").slice(1).join("."); } function geturl() { refurl = window.location.href; if(refurl != '') refurl = '&u='+refurl; return refurl; } function showme(e) { if(wg_process.wg_changewidget != 1 ) { wg_process.strUrl = wg_process.strUrl.replace("&ts3=", "&ts3="+new Date().getTime()); loadJs(wg_process.strUrl); } } function setparam(q,param, value) { var r = ''; var r_before = ''; var r_after = ''; var i = q.indexOf('/' + param + '/'); if (i == -1) { r = q + '/' + param + '/' + value; return r; } r_before = q.substr(0,i + param.length + 2); r = q.substr(r_before.length); i = r.indexOf('/'); if (i != -1) { r = r.substr(0, i); } else { i = r.indexOf('&') if (i != -1) r = r.substr(0, i); } r_after = q.substr( r_before.length + r.length ); r = r_before + value + r_after; return r.replace(/\+/g, ' '); } function alltrim(str) { return str.replace(/^\s+|\s+$/g, ''); } function GetSource() { return (document.documentElement||document.body).innerHTML; } function getWbCookie(c_name) { try { if (document.cookie.length>0) { c_start=document.cookie.indexOf(c_name + "="); if (c_start!=-1) { c_start=c_start + c_name.length+1; c_end=document.cookie.indexOf(";",c_start); if (c_end==-1) c_end=document.cookie.length; return decodeURIComponent(document.cookie.substring(c_start,c_end).replace('\t',' ')); } } } catch(err){} return ""; } function getElementById_s(id){ var obj = null; if (document.getElementById){ /* Prefer the widely supported W3C DOM method, if available:- */ obj = document.getElementById(id); } else if(document.all){ /* Branch to use document.all on document.all only browsers. Requires that IDs are unique to the page and do not coincide with NAME attributes on other elements:- */ obj = document.all[id]; } /* If no appropriate element retrieval mechanism exists on this browser this function always returns null:- */ return obj; } function changeHeight() { try { var aFrame = getElementById_s('winbuyer_frame1254838532069'); var innerDoc = (aFrame.contentDocument) ? aFrame.contentDocument : aFrame.contentWindow.document; if (innerDoc.body.offsetHeight) //ns6 syntax aFrame.style.height = innerDoc.body.offsetHeight + 32; //Extra height FireFox else if (innerDoc.body.scrollHeight) //ie5+ syntax aFrame.style.height = innerDoc.body.scrollHeight; } catch(err) {} } function changeHeight(ts) { try { var aFrame = getElementById_s('winbuyer_frame'+ts); var innerDoc = (aFrame.contentDocument) ? aFrame.contentDocument : aFrame.contentWindow.document; if (innerDoc.body.offsetHeight) //ns6 syntax aFrame.style.height = innerDoc.body.offsetHeight + 32; //Extra height FireFox else if (innerDoc.body.scrollHeight) //ie5+ syntax aFrame.style.height = innerDoc.body.scrollHeight; } catch(err) { } } function wopen(url, name, w, h) { w += 32;h += 96; var win = window.open(url, '', 'width=' + w + ', height=' + h + ', ' + 'location=no, menubar=no, ' + 'status=no, toolbar=no, scrollbars=no, resizable=no'); win.resizeTo(w, h); win.focus(); } setGlobalOnLoad(showme);