/**
 * gdgt add to list widget
 *
 * @version 1.1.6
 * @author Jon Ursenbach <jon@gdgt.com>
 */
var gdgt=new function(){this.gadget_url='';this.widget_style='full';this.seed='';this.init=function(){this.seed=this.generate_seed();this.gadget_url=(typeof gdgt_url=='string')?gdgt_url:((typeof GDGT_URL=='string')?GDGT_URL:false);this.style=(typeof gdgt_style=='string')?gdgt_style:((typeof GDGT_STYLE=='string')?GDGT_STYLE:false);if(!this.gadget_url){throw new Error('A gdgt gadget url is required.');}
var url_host=this.get_base_url(this.gadget_url);this.base_url='http://'+url_host;this.user_base_url='http://user.'+url_host+'/';this.base_cdn_url='http://media.'+url_host+'/';this.gadget_url=encodeURIComponent(this.gadget_url);if(!this.style){this.style='full';}else{this.style=this.style.toLowerCase();if(this.style!='full'&&this.style!='square'&&this.style!='wide'){this.style='full';}}
gdgt_url=null;GDGT_URL=null;gdgt_style=null;GDGT_STYLE=null;this.generate_widget();};this.process_ajax=function(seed,data){try{var errors={};var error_cnt=0;var item;for(var x=0;x<data.messages.length;++x){item=data.messages[x];if(!item.is_exception){errors[x]=item.msg;error_cnt++;}else{if(navigator.userAgent.indexOf('Chrome')>=0||navigator.userAgent.indexOf('Safari')>=0){window.location.href=data.messages[x].msg;}else{newwindow=window.open(data.messages[x].msg,'gdgtaddtolistwidget');}
return false;}}
if(document.getElementById('errorblock_'+seed)!==null){document.getElementById('errorblock_'+seed).style.display='none';document.getElementById('returned_errors_'+seed).innerHTML='';document.getElementById('returned_errors_'+seed).style.display='none';}
if(error_cnt>0){var error_html='';for(var y=0;y<data.messages.length;++y){error_html+=errors[y]+'<br />';}
if(document.getElementById('errorblock_'+seed)!==null){document.getElementById('errorblock_'+seed).style.display='';document.getElementById('returned_errors_'+seed).innerHTML=error_html;document.getElementById('returned_errors_'+seed).style.display='';}
return false;}
return true;}catch(err){}
return false;};this.pull_gadget_image=function(gadget_url,seed){window['gdgtGadgetDataImg_callback_'+seed]=function(response){if(gdgt.process_ajax(seed,response)){var image_box=document.getElementById('gdgt_add_widget_gadgetimg_'+seed);image_box.innerHTML=gdgt.generate_gadget_image(seed,response);image_box.style.display='';}
document.body.removeChild(document.getElementById('gdgtGadgetDataImg_callback_'+seed));};var s=document.createElement('script');s.src=gdgt.base_url+'/api/gadgetimage/?';s.src+='gadgeturl='+gadget_url+'&';s.src+='gadgetimagesize=100&';s.src+='jsoncallback=gdgtGadgetDataImg_callback_'+seed+'&';s.src+='_api=1';s.id='gdgtGadgetDataImg_callback_'+seed;document.body.appendChild(s);};this.pull_gadget=function(gadget_url,seed){window['gdgtGadgetData_callback_'+seed]=function(response){if(gdgt.process_ajax(seed,response)){var widget_box=document.getElementById('gdgt_add_widget_selector_box_'+seed);if(response.logged_in){widget_box.innerHTML=gdgt.generate_widget_popup(seed,response);}else{widget_box.innerHTML=gdgt.generate_login_popup(seed,response);}
widget_box.style.display='';}
document.body.removeChild(document.getElementById('gdgtGadgetData_'+seed));};var s=document.createElement('script');s.src=gdgt.base_url+'/api/gadgetdata/?';s.src+='gadgeturl='+gadget_url+'&';s.src+='gadgetimagesize=50&';s.src+='jsoncallback=gdgtGadgetData_callback_'+seed+'&';s.src+='_api=1';s.id='gdgtGadgetData_'+seed;document.body.appendChild(s);};this.send_twitter_status_update=function(seed,addtolist){window['gdgtTwitterUserStatusUpdate_callback_'+seed]=function(response){document.getElementById('share_update_links_'+seed).style.display='none';document.getElementById('update_sending_message_'+seed).style.display='none';document.getElementById('update_sent_message_'+seed).style.display='';document.body.removeChild(document.getElementById('gdgtTwitterUserStatusUpdate_'+seed));};var s=document.createElement('script');s.src=gdgt.base_url+'/api/sendtwitterstatusupdate/?';s.src+='gadget_id='+addtolist.gadget_id+'&';s.src+='gadget_ownership='+addtolist.owned_status+'&';s.src+='manual_update=1&';s.src+='jsoncallback=gdgtTwitterUserStatusUpdate_callback_'+seed+'&';s.src+='_api=1';s.id='gdgtTwitterUserStatusUpdate_'+seed;document.body.appendChild(s);};this.send_facebook_status_update=function(seed,addtolist){window['gdgtFacebookUserStatusUpdate_callback_'+seed]=function(response){document.getElementById('share_update_links_'+seed).style.display='none';document.getElementById('update_sending_message_'+seed).style.display='none';document.getElementById('update_sent_message_'+seed).style.display='';document.body.removeChild(document.getElementById('gdgtFacebookUserStatusUpdate_'+seed));};var s=document.createElement('script');s.src=gdgt.base_url+'/api/sendfacebookstatusupdate/?';s.src+='gadget_id='+addtolist.gadget_id+'&';s.src+='gadget_ownership='+addtolist.owned_status+'&';s.src+='manual_update=1&';s.src+='jsoncallback=gdgtFacebookUserStatusUpdate_callback_'+seed+'&';s.src+='_api=1';s.id='gdgtFacebookUserStatusUpdate_'+seed;document.body.appendChild(s);};this.send_status_update=function(seed,addtolist){window['gdgtStatusUpdate_callback_'+seed]=function(response){document.getElementById('share_update_links_'+seed).style.display='none';document.getElementById('update_sending_message_'+seed).style.display='none';document.getElementById('update_sent_message_'+seed).style.display='';document.body.removeChild(document.getElementById('gdgtStatusUpdate_'+seed));};var s=document.createElement('script');s.src=gdgt.base_url+'/api/sendautostatusupdates/?';s.src+='gadget_id='+addtolist.gadget_id+'&';s.src+='current_owned_status='+addtolist.current_owned_status+'&';s.src+='previous_owned_status='+addtolist.previous_owned_status+'&';s.src+='fb_update_setting='+addtolist.fb_update_setting+'&';s.src+='tw_update_setting='+addtolist.tw_update_setting+'&';s.src+='send_fb_auto_update='+addtolist.send_fb_auto_update+'&';s.src+='send_tw_auto_update='+addtolist.send_tw_auto_update+'&';s.src+='jsoncallback=gdgtStatusUpdate_callback_'+seed+'&';s.src+='_api=1';s.id='gdgtStatusUpdate_'+seed;document.body.appendChild(s);};this.add_to_list=function(seed){window['gdgtAddToList_callback_'+seed]=function(response){if(gdgt.process_ajax(seed,response)){var send_fbtw_auto_updates=false;var changed_status=response.owned_status.toLowerCase();document.getElementById('indicator_'+seed).style.display='none';document.getElementById('addtolist_btn_'+seed).style.display='block';document.getElementById('list_type_'+seed).innerHTML=changed_status;document.getElementById('addtolist_success_'+seed).style.display='';document.getElementById('addtolist_window_'+seed).style.display='none';document.getElementById('update_sending_message_'+seed).style.display='none';if(response.send_fb_auto_update||response.send_tw_auto_update){document.getElementById('update_sending_message_'+seed).style.display='';send_fbtw_auto_updates=true;document.getElementById('word_facebook_updating_'+seed).style.display='none';document.getElementById('word_and_updating_'+seed).style.display='none';document.getElementById('word_twitter_updating_'+seed).style.display='none';if(response.send_fb_auto_update){document.getElementById('word_facebook_updating_'+seed).style.display='';}
if(response.send_fb_auto_update&&response.send_tw_auto_update){document.getElementById('word_and_updating_'+seed).style.display='';}
if(response.send_tw_auto_update){document.getElementById('word_twitter_updating_'+seed).style.display='';}
document.getElementById('share_update_links_'+seed).style.display='none';document.getElementById('update_sent_message_'+seed).style.display='none';document.getElementById('update_sending_message_'+seed).style.display='';}else{var facebook_icon=document.getElementById('update_icon_facebook_'+seed);if(response.is_user_connected_with_facebook){facebook_icon.setAttribute('href','javascript:void(0);');facebook_icon.setAttribute('title','Share '+response.gadget.gadget_name+' on Facebook');facebook_icon.setAttribute('onclick','gdgt.send_facebook_status_update("'+seed+'", {gadget_id: "'+response.gadget.gadget_id+'", owned_status: "'+response.owned_status+'"})');}else{facebook_icon.setAttribute('href',gdgt.user_base_url+'settings/services/');facebook_icon.setAttribute('title','Connect with Facebook to share your gdgt updates');facebook_icon.setAttribute('target','_blank');}
var twitter_icon=document.getElementById('update_icon_twitter_'+seed);if(response.is_user_connected_with_twitter){twitter_icon.setAttribute('href','javascript:void(0);');twitter_icon.setAttribute('title','Share '+response.gadget.gadget_name+' on Twitter');twitter_icon.setAttribute('onclick','gdgt.send_twitter_status_update("'+seed+'", {gadget_id: "'+response.gadget.gadget_id+'", owned_status: "'+response.owned_status+'"})');}else{twitter_icon.setAttribute('href',gdgt.user_base_url+'settings/services/');twitter_icon.setAttribute('title','Connect with Twitter to share your gdgt updates');twitter_icon.setAttribute('target','_blank');}
document.getElementById('update_sent_message_'+seed).style.display='none';document.getElementById('share_update_links_'+seed).style.display='';}
if(send_fbtw_auto_updates){gdgt.send_status_update(seed,{gadget_id:response.gadget_id,current_owned_status:response.owned_status,previous_owned_status:response.previous_status,fb_update_setting:response.fb_update_setting,tw_update_setting:response.tw_update_setting,send_fb_auto_update:response.send_fb_auto_update,send_tw_auto_update:response.send_tw_auto_update});}}
document.body.removeChild(document.getElementById('gdgtAddToList_'+seed));};document.getElementById('indicator_'+seed).style.display='';document.getElementById('addtolist_btn_'+seed).style.display='none';document.getElementById('errorblock_'+seed).style.display='none';document.getElementById('error_list_required_'+seed).style.display='none';var gadget_id=document.getElementById('gadget_id_'+seed).value;if(gadget_id.length<=0){document.getElementById('indicator_'+seed).style.display='none';document.getElementById('addtolist_btn_'+seed).style.display='';throw new Error('missing gadget_id');}
var ownership=false;var ownership_radio=document.getElementsByName('add_'+seed);for(var x=0;x<ownership_radio.length;x++){if(ownership_radio[x].checked){ownership=ownership_radio[x].value;}}
if(!ownership||ownership.length<=0){document.getElementById('indicator_'+seed).style.display='none';document.getElementById('addtolist_btn_'+seed).style.display='block';document.getElementById('errorblock_'+seed).style.display='';document.getElementById('error_list_required_'+seed).style.display='';return;}
var s=document.createElement('script');s.src=gdgt.base_url+'/api/addtolist/?';s.src+='gadgetid='+gadget_id+'&';s.src+='gadgetownership='+ownership+'&';s.src+='jsoncallback=gdgtAddToList_callback_'+seed+'&';s.src+='_api=1';s.id='gdgtAddToList_'+seed;document.body.appendChild(s);};this.close_widget_popup=function(seed){var widget_box=document.getElementById('gdgt_add_widget_selector_box_'+seed);widget_box.style.display='none';};this.close_login_popup=function(seed){var widget_box=document.getElementById('gdgt_add_widget_login_'+seed);widget_box.style.display='none';};this.get_common_elements=function(seed,gadget){return common={css:{add_list_entry:'list-style: none; padding: 0 0 1px 0; margin: 0; background: none;',button:'cursor: pointer; padding: 3px 6px; margin: 8px 0 4px 2px; color: #fff; background: #333; text-decoration: none; text-align: center;',button_container:'margin: 1em 0 0.5em;',close_button:'float: right; display: block; width: 16px; height: 16px; margin: -5px -5px 0 8px; background: #333 url('+this.base_cdn_url+'img/site/gdgt-widget-img.png) -71px 0 no-repeat; padding: 0px !important;',sharing_settings:'display: block; float: right; background: none !important; margin: 8px 0; font-size: 11px; color: #c00; text-decoration: none;',text_container:'padding: 0; margin: 0; line-height: 1.4em;',widget_popup:'text-shadow: none; position: absolute; z-index: 100000000; width: 230px; margin-top: 2px; padding: 10px; background: #f6f6f6; font: 12px Arial, Helvetica, sans-serif; color: #333; border: 1px solid #000;'},link:{gadget:'<a href="'+gadget.gadget_url+'" target="_blank" style="background: none !important; color: #c00; text-decoration: none;">'+gadget.gadget_name+'</a>',gdgt:'<a href="http://gdgt.com/" target="_blank" style="background: none !important; color: #c00; text-decoration: none;">gdgt</a>'}};};this.generate_widget=function(){var html='';var IE6=false;switch(this.style){case'square':html+='<div id="gdgt_add_widget_button_'+this.seed+'" class="gdgt_add_widget" style="width: 49px;">';html+='<a href="http://gdgt.com/" title="gdgt" target="_blank" style="float: left; display: block; width: 49px; height: 23px; background: transparent url('+this.base_cdn_url+'img/site/gdgt-widget-img.png) no-repeat; border: 0; padding: 0 !important;"></a>';html+='<a href="'+((IE6)?this.gadget_url:'javascript:void(0);')+'" ';if(IE6){html+='target="_blank" ';}
html+='title="add to list" ';html+='onmouseover="this.style.background = \'#c00 url(\\\''+this.base_cdn_url+'img/site/gdgt-widget-img.png\\\') -87px -7px no-repeat\';" ';html+='onmouseout="this.style.background = \'#333 url(\\\''+this.base_cdn_url+'img/site/gdgt-widget-img.png\\\') -87px -7px no-repeat\';" ';html+='onclick="'+((IE6)?'return false;':'gdgt.pull_gadget(\''+this.gadget_url+'\', \''+this.seed+'\');')+'" ';html+='style="float: left; display: block; cursor: pointer; width: 24px; height: 22px; padding: 0 5px 0 20px; margin-top: 3px; background: #333 url('+this.base_cdn_url+'img/site/gdgt-widget-img.png) -87px -7px no-repeat; font: 13px Arial, Helvetica, sans-serif; color: #fff; text-decoration: none; line-height: 22px; border: 0;">add</a>';html+='</div>';html+='<div style="clear: both"></div>';break;case'full':case'wide':default:html+='<div class="gdgt_add_widget" style="width: 100px; padding: 3px;">';if(this.style=='full'){html+='<div id="gdgt_add_widget_gadgetimg_'+this.seed+'" style="display: none;">';html+='</div>';gdgt.pull_gadget_image(this.gadget_url,this.seed);}
html+='<div id="gdgt_add_widget_button_'+this.seed+'">';html+='<a ';html+='href="http://gdgt.com/" ';html+='title="gdgt" ';html+='target="_blank" ';html+='style="float: left; display: block; width: 22px; height: 22px; background: transparent url('+this.base_cdn_url+'img/site/gdgt-widget-img.png) -49px 0 no-repeat; border: 0; padding: 0 !important;"></a>';html+='<a ';html+='href="'+((IE6)?this.gadget_url:'javascript:void(0);')+'" ';if(IE6){html+='target="_blank" ';}
html+='title="add to list" ';html+='onmouseover="this.style.background = \'#c00 url(\\\''+this.base_cdn_url+'img/site/gdgt-widget-img.png\\\') -88px -7px no-repeat\';" ';html+='onmouseout="this.style.background = \'#333 url(\\\''+this.base_cdn_url+'img/site/gdgt-widget-img.png\\\') -88px -7px no-repeat\';" ';html+='onclick="'+((IE6)?'return false;':'gdgt.pull_gadget(\''+this.gadget_url+'\', \''+this.seed+'\');')+'" ';html+='style="float: left; display: block; cursor: pointer; width: 57px; height: 22px; padding: 0 0 0 18px; margin-left: 3px; background: #333 url('+this.base_cdn_url+'img/site/gdgt-widget-img.png) -88px -7px no-repeat; font: 12px Arial, Helvetica, sans-serif; color: #fff; text-decoration: none; line-height: 22px; border: 0;">add to list</a>';html+='</div>';html+='<div style="clear: both"></div>';html+='</div>';break;}
html+='<div id="gdgt_add_widget_selector_box_'+this.seed+'" class="gdgt_add_widget_selector_box" style="display: none;"></div>';document.write(html);};this.generate_gadget_image=function(seed,gadget){var html='';html+='<a href="'+gadget.gadget_url+'" target="_blank">';html+='<img src="'+gadget.gadget_image+'" width="100" height="100" alt="'+gadget.gadget_name+'" style="margin: 0px 0px 3px !important; border: 0px;" />';html+='</a>';return html;};this.generate_login_popup=function(seed,gadget){var common=gdgt.get_common_elements(seed,gadget);var html='';html+='<div id="gdgt_add_widget_login_'+seed+'" class="gdgt_add_widget_login" style="'+common.css.widget_popup+'">';html+='<a ';html+='href="javascript:void(0);" ';html+='onclick="gdgt.close_login_popup(\''+seed+'\')" ';html+='title="close" ';html+='style="'+common.css.close_button+'"></a>';html+='<div id="login_window_'+seed+'">';html+='<p style="'+common.css.text_container+' font-weight: bold; padding-bottom: 5px;">';html+='Do you have a '+common.link.gdgt+' account?<br />';html+='</p>';html+='<p style="'+common.css.text_container+'">';html+='You need to be logged into '+common.link.gdgt+' to add the '+common.link.gadget+' to your list.';html+='</p>';html+='<p style="'+common.css.button_container+'">';html+='<a ';html+='href="'+this.base_url+'/login/?redirect='+gadget.gadget_url+'" ';html+='title="login" ';html+='target="_blank" ';html+='onmouseover="this.style.background = \'#c00\';" ';html+='onmouseout="this.style.background = \'#333\';" ';html+='style="'+common.css.button+'">login</a>&nbsp;';html+='<a ';html+='href="'+this.base_url+'/register/" ';html+='title="register" ';html+='target="_blank" ';html+='onmouseover="this.style.background = \'#c00\';" ';html+='onmouseout="this.style.background = \'#333\';" ';html+='style="'+common.css.button+'">register</a>';html+='</p>';html+='</div>';html+='</div>';return html;};this.generate_widget_popup=function(seed,gadget){var common=gdgt.get_common_elements(seed,gadget);var html='';html+='<div id="gdgt_add_widget_selector_'+seed+'" class="gdgt_add_widget_selector" style="'+common.css.widget_popup+'">';html+='<a ';html+='href="javascript:void(0);" ';html+='onclick="gdgt.close_widget_popup(\''+seed+'\')" ';html+='title="close" ';html+='style="'+common.css.close_button+'"></a>';html+='<div id="addtolist_success_'+seed+'" style="display: none;">';html+='<p style="'+common.css.text_container+' font-weight: bold;">'+common.link.gadget+' has been added to your <span id="list_type_'+seed+'"></span> list.</p>';html+='<p style="'+common.css.button_container+'">';html+='<a ';html+='href="javascript:void(0);" ';html+='title="ok" ';html+='onclick="gdgt.close_widget_popup(\''+seed+'\')" ';html+='onmouseover="this.style.background = \'#c00\';" ';html+='onmouseout="this.style.background = \'#333\';" ';html+='style="'+common.css.button+'">ok</a>&nbsp;';html+='<a ';html+='href="'+this.user_base_url+'gadgets/" ';html+='title="my gadgets" ';html+='target="_blank" ';html+='onmouseover="this.style.background = \'#c00\';" ';html+='onmouseout="this.style.background = \'#333\';" ';html+='style="'+common.css.button+'">my gadgets</a>';html+='</p>';html+='<p id="update_sending_message_'+seed+'" style="border-top: 1px solid #ccc; background: transparent url('+this.base_cdn_url+'img/site/indicator.gif) no-repeat 0 8px; padding: 10px 0 4px 26px; margin: 12px 0 0; clear: both;">';html+='Updating <span id="word_facebook_updating_'+seed+'" style="display: none;">Facebook</span><span id="word_and_updating_'+seed+'" style="display: none;"> and </span><span id="word_twitter_updating_'+seed+'" style="display: none;">Twitter</span><br />';html+='<a ';html+='href="'+this.user_base_url+'settings/services/" ';html+='style="'+common.css.sharing_settings+'" ';html+='target="_blank">sharing settings</a>';html+='</p>';html+='<p id="update_sent_message_'+seed+'" style="border-top: 1px solid #ccc; background: transparent url('+this.base_cdn_url+'img/site/step-checkmark.png) no-repeat 0 8px; padding: 10px 0 4px 26px; margin: 12px 0 0; clear: both;">';html+='Updated <span class="word_facebook_'+seed+'" style="display: none;">Facebook</span><span id="word_and_'+seed+'" style="display: none;"> and </span><span id="word_twitter_'+seed+'" style="display: none;">Twitter</span><br />';html+='<a ';html+='href="'+this.user_base_url+'settings/services/" ';html+='style="'+common.css.sharing_settings+'" ';html+='target="_blank">sharing settings</a>';html+='</p>';html+='<div id="share_update_links_'+seed+'" style="border-top: 1px solid #ccc; padding-top: 10px; clear: both;">';html+='<strong style="display: block; float: left; margin-right: 5px;">Share on</strong>&nbsp;';html+='<a ';html+='href="javascript:void(0);" ';html+='title="Send update to Facebook" ';html+='id="update_icon_facebook_'+seed+'" ';html+='style="display: block; background: transparent url('+this.base_cdn_url+'img/site/facebook-icon-16.gif) no-repeat center !important; cursor: pointer; float: left; width: 16px; padding: 16px 0 0 !important; margin: 0 6px; line-height: normal; border: 0;"></a>&nbsp;';html+='<a ';html+='href="javascript:void(0);" ';html+='title="Send update to Twitter" ';html+='id="update_icon_twitter_'+seed+'" ';html+='style="display: block; background: transparent url('+this.base_cdn_url+'img/site/twitter-icon-16.gif) no-repeat center !important; cursor: pointer; float: left; width: 16px; padding: 16px 0 0 !important; margin: 0 6px 0 1px; line-height: normal; border: 0;"></a>&nbsp;';html+='<a ';html+='href="'+this.user_base_url+'settings/services/" ';html+='style="'+common.css.sharing_settings+'" ';html+='target="_blank">sharing settings</a>';html+='</div>';html+='<div id="gdgt_metadata_'+seed+'" class="addgadget_additional" style="display: none;">';html+='</div>';html+='</div>';html+='<div id="addtolist_window_'+seed+'">';html+='<p style="'+common.css.text_container+' font-weight: bold;">';html+='Add the <a href="'+gadget.gadget_url+'" target="_blank" style="background: none !important; color: #c00; text-decoration: none;">'+gadget.gadget_name+'</a> to your <a href="http://gdgt.com/" target="_blank" style="background: none !important; color: #c00; text-decoration: none;">gdgt</a>:';html+='</p>';if(gadget.gadget_image.length>0){html+='<img src="'+gadget.gadget_image+'" width="50" height="50" alt="'+gadget.gadget_name+'" style="float: left; margin: 10px 8px 0 0; border: 1px solid #ccc;" />';}
html+='<div style="float: left; margin: 9px 0 0 3px;">';html+='<input type="hidden" id="gadget_id_'+seed+'" value="'+gadget.gadget_id+'" />';html+='<fieldset style="border: 0; padding: 0; margin: 0;">';html+='<ul style="padding: 0; margin: 0;">';html+='<li style="'+common.css.add_list_entry+'"><input id="have" type="radio" name="add_'+seed+'" value="HAVE" /> <label for="have">Have list</label></li>';html+='<li style="'+common.css.add_list_entry+'"><input id="want" type="radio" name="add_'+seed+'" value="WANT" /> <label for="want">Want list</label></li>';html+='<li style="'+common.css.add_list_entry+'"><input id="had" type="radio" name="add_'+seed+'" value="HAD" /> <label for="had">Had list</label></li>';html+='</ul>';html+='<p style="'+common.css.button_container+'">';html+='<a ';html+='href="javascript:void(0);" ';html+='title="add to list" ';html+='id="addtolist_btn_'+seed+'" ';html+='onmouseover="this.style.background = \'#c00\';" ';html+='onmouseout="this.style.background = \'#333\';" ';html+='onclick="gdgt.add_to_list(\''+seed+'\')" ';html+='style="display: block; cursor: pointer; padding: 3px 5px; width: 30px; margin: 8px 0 4px 2px; background: #333; color: #fff; text-decoration: none; text-align: center;">add</a>';html+='<img id="indicator_'+seed+'" src="'+this.base_cdn_url+'img/site/indicator.gif" style="display: none;" />';html+='</p>';html+='</fieldset>';html+='</div>';html+='</div>';html+='<div style="clear: both"></div>';html+='<div id="errorblock_'+seed+'" style="padding-top: 5px;" style="display: none;">';html+='<div id="error_list_required_'+seed+'" style="display: none;">Please select a list.</div>';html+='<div id="returned_errors_'+seed+'" style="display: none;"></div>';html+='</div>';html+='<div style="clear: both"></div>';html+='</div>';return html;};this.generate_seed=function(){function S4(){return(((1+Math.random())*0x10000)|0).toString(16).substring(1);}
return('gdgt'+S4()+S4()+S4());};this.get_base_url=function(url){function parseUri(str){var o=parseUri.options;var m=o.parser[o.strictMode?"strict":"loose"].exec(str);var uri={};var i=14;while(i--)uri[o.key[i]]=m[i]||"";uri[o.q.name]={};uri[o.key[12]].replace(o.q.parser,function($0,$1,$2){if($1)uri[o.q.name][$1]=$2;});return uri;}
parseUri.options={strictMode:false,key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}};url=parseUri(url);return url.host;};};try{gdgt.init();}catch(err){}
