var sdtag_posting=0;var sdtag_errors_shown=false;var tagFormShown=false;function setAddTagForm(threadid)
{sdfetch_object("sdtag_form").threadid.value=threadid;}
function showAddTagForm(e,threadid,slickdealid)
{if(tagFormShown==false)
{tagFormShown=true;showDiv(e,'addsdtag_div');formobj=sdfetch_object("sdtag_form");formobj.addsdtag_tagid.value='';formobj.addsdtag_catid.value='';formobj.addsdtag_actag.value='';formobj.threadid.value=threadid;formobj.addsdtag_txt.focus();}
else
{tagFormShown=false;closeDiv(e,'addsdtag_div');}}
function sdtag_prepare_submit(formobj)
{if(!AJAX_Compatible)
{return sdtag_check_data(formobj);}
else if(sdtag_check_data(formobj))
{var test_ajax=new vB_AJAX_Handler(true);if(!test_ajax.init()||(typeof vb_disable_ajax!='undefined'&&vb_disable_ajax>0))
{return true;}
if(is_ie&&userAgent.indexOf('msie 5.')!=-1)
{if(PHP.urlencode(formobj.tag.value).indexOf('%u')!=-1)
{return true;}}
if(sdtag_posting==1)
{return false;}
else
{sdtag_posting=1;setTimeout("sdtag_posting = 0",1000);}
if(typeof formobj=="string")
{var submitstring=formobj;}
else if(typeof formobj=="object")
{var submitstring='do=tagthread&ajax=1';for(i=0;i<formobj.elements.length;i++)
{var obj=formobj.elements[i];if(obj.name&&!obj.disabled)
{switch(obj.type)
{case'text':case'textarea':case'hidden':submitstring+='&'+obj.name+'='+PHP.urlencode(obj.value);break;case'checkbox':case'radio':submitstring+=obj.checked?'&'+obj.name+'='+PHP.urlencode(obj.value):'';break;case'select':submitstring+='&'+obj.name+'='+PHP.urlencode(obj.options[obj.selectedIndex].value);break;}}}}
document.body.style.cursor='wait';sdtag_ajax_post(submitstring);return false;}
else
{return false;}}
function sdtag_check_data(formobj)
{if(typeof formobj=="object")
{re=new RegExp("^[a-zA-Z0-9.&,\\-\\s]{0,50}$",'i');if(formobj.addsdtag_txt!=null)
tagval=formobj.addsdtag_txt.value
else
{var tagin=formobj.filtersdtag_txt;if(tagin.value=="Tag"||tagin.value=="Search Tag")
tagin.value='';tagval=tagin.value;}
var tagvalid=((tagval.match(re)!=null&&tagval!='')||formobj.addsdtag_catid.value)?true:false;if(!tagvalid)
sdtag_show_errors("Invalid tag.");else
sdtag_hide_errors();return tagvalid;}
return true;}
function sdtag_ajax_post(submitstring)
{xml=new vB_AJAX_Handler(true);xml.onreadystatechange(sdtag_do_ajax_post);xml.send('/forums/sdtag_ajax.php',submitstring);}
function sdtag_do_ajax_post()
{if(xml.handler.readyState==4&&xml.handler.status==200&&xml.handler.responseText)
{document.body.style.cursor='auto';if(xml.handler.responseText.match(/^<!-- sdtag ok -->/))
{lp=fetch_object('sdtagbits_'+sdfetch_object("sdtag_form").threadid.value);lp.innerHTML=xml.handler.responseText;fetch_object('addsdtag_txt').value="";fetch_object('addsdtag_tagid').value="";fetch_object('addsdtag_catid').value="";fetch_object('addsdtag_actag').value="";fetch_object('addsdtag_menu').style.display="none";sdtag_hide_errors();if(is_ie)
{xml.handler.abort();}
if(fetch_object('sdtag_submit'))
{fetch_object('sdtag_submit').blur();}}
else
{if(!is_saf)
{if(xml.handler.responseText.match(/^<!-- sdtag error -->/))
{sdtag_show_errors(xml.handler.responseText);if(is_ie)
{xml.handler.abort();}
return;}}
if(is_ie)
{xml.handler.abort();}
fetch_object('sdtag_form').submit();}}}
function sdtag_show_errors(errortext)
{sdtag_errors_shown=true;fetch_object("sdtag_err").innerHTML=errortext;return false;}
function sdtag_hide_errors()
{if(sdtag_errors_shown)
{sdtag_errors_shown=true;fetch_object("sdtag_err").innerHTML="";return false;}}
function sdtag_confirmdel(tag)
{return confirm('Are you sure you want to delete '+tag+'?\nClick OK to delete, or cancel to hide this prompt.');};var sdthreadrate_getting=0;var sdthreadrate_postid=0;function sdthreadrate_vote(postid,vote,controltype)
{controltype=typeof(controltype)!='undefined'?controltype:"thread";votefeedback=$("#vote_feedback_"+postid+"_"+vote);if(votefeedback.length>0)
{if(votefeedback.find("input").length==1)
{sdthreadrate_submit(postid,vote,votefeedback.find("input").val(),controltype);}
else
{votefeedback.find(".voteselected").attr("postid",postid);votefeedback.find(".voteselected").attr("vote",vote);votefeedback.slideDown("fast");}}
else
{sdthreadrate_submit(postid,vote,0,controltype);}}
function sdthreadrate_extendedvote(input,controltype)
{input=$(input);vote=input.attr("vote");postid=input.attr("postid")
$("#vote_feedback_"+postid+"_"+vote).slideUp("fast");sdthreadrate_submit(postid,vote,input.val(),controltype);}
function sdthreadrate_submit(postid,vote,votetypeid,controltype)
{controltype=typeof(controltype)!='undefined'?controltype:"thread";if(sdthreadrate_getting==1)
{return false;}
else
{sdthreadrate_getting=1;setTimeout("sdthreadrate_getting = 0",1000);}
if(controltype=="coupon"){$("#votecontrol_wrap_"+postid).btOff();}
else if(controltype=="permadeal"){$("#ratecontrol_"+postid+"_"+vote).css("background-image","url(http://st.slickdealz.net/images/buttons/ajaxsmall.gif)");}
var sdthreadrate_param=new Object();sdthreadrate_param['ajax']=1;sdthreadrate_param['do']="sdthreadratevote"
sdthreadrate_param['postid']=postid;sdthreadrate_param['vote']=vote;sdthreadrate_param['votetypeid']=votetypeid;sdthreadrate_param['controltype']=controltype;sdthreadrate_param['securitytoken']=SECURITYTOKEN;var voteimgindex=vote+1;$("#ratecontrol_"+postid+" img:eq("+voteimgindex+")").attr("src","http://i.slickdeals.net/images/buttons/ajaxsmall.gif");$.post('/forums/sdthreadrate_ajax.php',sdthreadrate_param,function(data)
{if($(data).find("error").length==0)
{$("#sharethistab:visible").hide();$("#showfeedback:hidden").show();$("#fistthread_publicopinion:hidden").css("visibility","").hide().fadeIn()
var postid=geturlvar($(this).attr("data"),"postid");var score=$(".vote_score")
score.hide();updateHtmlBits(data);score.slideDown("normal");var error=$(data).find("errormsg");if(error.length>0)
{errordialog(error.text());}
else if(controltype=="coupon")
{$("#votecontrol_wrap_"+postid).parents(".coupon_info").removeClass("pos").removeClass("neg").addClass(vote>0?"pos":"neg");}
else if(controltype=="permadeal")
{$(".score").hide().fadeIn();}
else if(controltype=="fpdeal"){$("#thumbup_"+postid).addClass("pos");}
else if(controltype=='hottopic')
{var postid=$(data).find('htmlbits htmlbit').attr('id');$('#sdhottopic_'+postid+' td.htscore').html($(data).find('htmlbits htmlbit').text());}}
else
{errordialog($(data).find("error").text());}});return false;}
function sdlocaldeal_vote(threadid,vote,ddid)
{var sdthreadrate_param={};sdthreadrate_param['ajax']=1;sdthreadrate_param['do']="sdthreadratevote"
sdthreadrate_param['threadid']=threadid;sdthreadrate_param['vote']=vote;sdthreadrate_param['votetypeid']=0;sdthreadrate_param['controltype']='fpdeal';sdthreadrate_param['securitytoken']=SECURITYTOKEN;$.post('/forums/sdthreadrate_ajax.php',sdthreadrate_param,function(data){if($(data).find("error").length==0)
{if(vote<0)
{$('a#thumbdown_'+threadid).addClass('thumb_selected');$('a#thumbup_'+threadid).removeClass('thumb_selected');}
else
{$('a#thumbdown_'+threadid).removeClass('thumb_selected');$('a#thumbup_'+threadid).addClass('thumb_selected');}
createCookie('dailydeal_'+ddid,vote,7);}
else
{errordialog($(data).find("error").text());}});return false;};function vB_AJAX_sdTagSuggest(varname,textobjid,menukey)
{var webkit_version=userAgent.match(/applewebkit\/([0-9]+)/);if(AJAX_Compatible&&!(is_saf&&!(webkit_version[1]>=412)))
{this.menuobj=fetch_object(menukey+'_menu');this.textobj=fetch_object(textobjid);this.textobj.obj=this;this.varname=varname;this.menukey=menukey;this.fragment='';this.donenames='';this.selected=0;this.menuopen=false;this.timeout=null;this.names=new Array();this.xml_sender=null;this.allow_multiple=false;this.min_chars=3;this.get_text=function()
{if(this.allow_multiple)
{var semicolon=this.textobj.value.lastIndexOf(',');if(semicolon==-1)
{this.donenames=new String('');this.fragment=new String(this.textobj.value);}
else
{this.donenames=new String(this.textobj.value.substring(0,semicolon+1));this.fragment=new String(this.textobj.value.substring(semicolon+1));}}
else
{this.fragment=new String(this.textobj.value);}
this.fragment=PHP.trim(this.fragment);}
this.set_text=function(i)
{if(i==-1)
{if(this.textobj.form.onsubmit!=null)
{if(this.textobj.form.onsubmit());this.textobj.form.onsubmit();}
else
this.textobj.form.submit();return false;}
if(this.allow_multiple)
{this.textobj.value=PHP.ltrim(this.donenames+" "+this.names[i]+",");}
else
{this.textobj.value=this.names[i];}
this.textobj.focus();this.menu_hide();return false;}
this.move_row_selection=function(increment)
{var newval=parseInt(this.selected,10)+parseInt(increment,10);if(newval<-1)
{newval=this.names.length-1;}
else if(newval>=this.names.length)
{newval=-1;}
this.set_row_selection(newval);return false;}
this.set_row_selection=function(i)
{var tds=fetch_tags(this.menuobj,'td');if(i==-1)
{if(this.selected>=0&&this.selected<=this.names.length)
tds[this.selected].className='vbmenu_option';this.selected=-1;}
else if(this.selected==-1)
{tds[i].className='vbmenu_hilite';this.selected=i;}
else
{tds[this.selected].className='vbmenu_option';this.selected=i;tds[this.selected].className='vbmenu_hilite';}}
this.key_event_handler=function(evt)
{evt=evt?evt:window.event;if(this.menuopen)
{switch(evt.keyCode)
{case 38:{this.move_row_selection(-1);return false;}
case 40:{this.move_row_selection(1);return false;}
case 27:{this.menu_hide();this.textobj.focus();return false;}
case 13:{this.set_text(this.selected);return false;}}}
this.get_text();if(this.fragment.length>=this.min_chars)
{clearTimeout(this.timeout);this.timeout=setTimeout(this.varname+'.name_search();',500);}
else
{this.menu_hide();}}
this.name_search=function()
{this.names=new Array();if(!this.xml_sender)
{this.xml_sender=new vB_AJAX_Handler(true);}
this.xml_sender.onreadystatechange(this.onreadystatechange);this.xml_sender.send('/forums/sdtag_ajax.php','do=tagautocomplete&tag='+PHP.urlencode(this.fragment)+'&forumid='+PHP.urlencode(this.textobj.form.f.value));}
var me=this;this.onreadystatechange=function()
{if(me.xml_sender.handler.readyState==4&&me.xml_sender.handler.status==200&&me.xml_sender.handler.responseXML)
{var users=fetch_tags(me.xml_sender.handler.responseXML,'tag');for(i=0;i<users.length;i++)
{me.names[i]=users[i].firstChild.nodeValue;}
if(me.names.length>0)
{me.menu_build();me.menu_show();}
else
{me.menu_hide();}
me.xml_sender.handler.abort();}}
this.menu_build=function()
{this.menu_empty();var re=new RegExp('^('+PHP.preg_quote(this.fragment)+')',"i");var table=document.createElement('table');table.cellPadding=4;table.cellSpacing=1;table.border=0;for(i in this.names)
{var td=table.insertRow(-1).insertCell(-1);td.className=(i==this.selected?'vbmenu_hilite':'vbmenu_option');td.innerHTML='<a onclick="return '+this.varname+'.set_text('+i+')">'+this.names[i].replace(re,'<strong>$1</strong>')+'</a>';}
this.menuobj.appendChild(table);this.vbmenu=vBmenu.register(this.menukey,true);}
this.menu_empty=function()
{this.selected=0;while(this.menuobj.firstChild)
{this.menuobj.removeChild(this.menuobj.firstChild);}}
this.menu_show=function()
{this.vbmenu.show(fetch_object(this.menukey),this.menuopen);this.menuopen=true;this.selected=-1;var tds=fetch_tags(this.menuobj,'td');tds[0].className='vbmenu_option';this.set_row_selection(-1);}
this.menu_hide=function()
{try
{this.vbmenu.hide();}
catch(e){}
this.menuopen=false;}
this.textobj.onkeyup=function(e){return this.obj.key_event_handler(e);};this.textobj.onkeypress=function(e)
{e=e?e:window.event;if(e.keyCode==13)
{return(this.obj.menuopen?false:true);}};}};
/*======================================================================*\
|| #################################################################### ||
|| # vBulletin 3.8.2
|| # ---------------------------------------------------------------- # ||
|| # Copyright ©2000-2009 Jelsoft Enterprises Ltd. All Rights Reserved. ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # ---------------- VBULLETIN IS NOT FREE SOFTWARE ---------------- # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html # ||
|| #################################################################### ||
\*======================================================================*/
function display_post(postid)
{if(AJAX_Compatible)
{vB_PostLoader[postid]=new vB_AJAX_PostLoader(postid);vB_PostLoader[postid].init();}
else
{pc_obj=fetch_object('postcount'+this.postid);openWindow('/forums/showpost.php?'+(SESSIONURL?'s='+SESSIONURL:'')+(pc_obj!=null?'&postcount='+PHP.urlencode(pc_obj.name):'')+'&p='+postid);}
return false;};var vB_PostLoader=new Array();function vB_AJAX_PostLoader(postid)
{this.postid=postid;this.container=fetch_object('edit'+this.postid);};vB_AJAX_PostLoader.prototype.init=function()
{if(this.container)
{postid=this.postid;pc_obj=fetch_object('postcount'+this.postid);YAHOO.util.Connect.asyncRequest("POST","/forums/showpost.php?p="+this.postid,{success:this.display,failure:this.handle_ajax_error,timeout:vB_Default_Timeout,scope:this},SESSIONURL+"securitytoken="+SECURITYTOKEN+"&ajax=1&postid="+this.postid+(pc_obj!=null?"&postcount="+PHP.urlencode(pc_obj.name):""));}};vB_AJAX_PostLoader.prototype.handle_ajax_error=function(ajax)
{vBulletin_AJAX_Error_Handler(ajax);};vB_AJAX_PostLoader.prototype.display=function(ajax)
{if(ajax.responseXML)
{var postbit=ajax.responseXML.getElementsByTagName("postbit");if(postbit.length)
{this.container.innerHTML=postbit[0].firstChild.nodeValue;PostBit_Init(fetch_object('post'+this.postid),this.postid);}
else
{openWindow('/forums/showpost.php?'+(SESSIONURL?'s='+SESSIONURL:'')+(pc_obj!=null?'&postcount='+PHP.urlencode(pc_obj.name):'')+'&p='+this.postid);}}};
