var isthere=new Array();isthere['length']=0;isthere['neck']=0;isthere['sleeves']=0;isthere['price']=0;p="";n="";sortby="";len="";neck="";sleeves="";price="";dresstype="";color="";tag_group="";var DEFAULT_HIGHPRICE=2000;var DEFAULT_LENGTH="cocktail,tea,floor";var DEFAULT_NECK="vneck,scoop,straight,sweetheart,othern";var DEFAULT_SLEEVES="cap,strapless,spaghetti,wide,others";var DEFAULT_DRESSTYPE="reg";var DEFAULT_PRICE="0,"+DEFAULT_HIGHPRICE;var DEFAULT_SORTBY="popular";var DEFAULT_N=16;var DEFAULT_TAB="weddings";var DEFAULT_NMENU_ARRAY=new Array("16","32","64","100");var DEFAULT_SORTMENU_ARRAY=new Array("popular","high","low");var DEFAULT_TAB_ARRAY=new Array("weddings","prom","everyday","deals");var DEFAULT_COLOR="call";$(document).ready(function(){initResultsDisplay();initSearchDisplay();initDressingRoomDisplay();initLookBook();initPersonalization();dhtmlHistory.initialize();dhtmlHistory.addListener(handleHistoryChange);initMouseHandlers();var currentLocation=dhtmlHistory.getCurrentLocation();if(currentLocation){startSearch(currentLocation,null);}
else{setVanitySearchBar();}});function initLookBook(){$('#thetable a').attr('rel','external');externalLinks();$("#emailsubmit").click(function(){if(isValidEmail($("#newsemail").val())){$.post(dev+"handlecodes.php",{signup:1,email:$("#newsemail").val()},function(data){alert("Thanks!  We'll be sure to email you the latest inspirations. ");});$("#newsemail").val('');}
else{alert("Please input a valid email address.");}});}
function initResultsDisplay(){$('#noresults').hide();$('#waiting').hide();$("#waiting").ajaxStart(function(){});$("#waiting").ajaxStop(function(){$(this).hide();});showTitlePopups();changeAdd();initDresstype();initSubTab();}
function initSubTab(){$('#subbar').find('span').click(function(){var subtab=$(this).attr("id").split("subtab");switch(subtab[0]){case"reg":window.location="/r/popular/";break;case"flower":window.location="/r/flower-girl-dresses/";break;case"MOB":window.location="/r/mother-of-the-bride/";break;case"maternity":window.location="/r/maternity-bridesmaid-dresses/";break;case"qipao":window.location="/r/qipao/";break;case"quince":window.location="/r/quinceanera/";break;case"prom":window.location="/r/prom/";break;case"coupons":window.location="/r/lookbook/";break;case"weddress":window.location="/r/wedding-dresses/";break;case"women":window.location="/r/womens-dresses/";break;case"girls":window.location="/r/girls-dresses/";break;}});}
function initDresstype(){$(".typetab").click(function(){switch($(this).attr("id")){case"weddings":window.location="/r/popular/";break;case"prom":window.location="/r/prom/";break;case"deals":window.location="/r/lookbook/";break;case"everyday":window.location="/r/womens-dresses/";break;}});}
function initDressingRoomDisplay(){if(getCookie("mid")==0){$(".changebutton").attr("src","http://static.shinyorb.com/img/save-share-button.gif");}
else{$(".changebutton").attr("src","http://static.shinyorb.com/img/view-this-room.gif");}
if(getCookie("noshowDRreminder")!=1){var loc=String(window.location);if(loc.search(/personalized/i)==-1){initDRReminder();}}}
function initDRReminder(){var whichoverlay=getOverlayReminder();if(whichoverlay=="dressingroomreminder"){showReminderOverlay(whichoverlay);}
else{setTimeout(function(){showReminderOverlay(whichoverlay)},10000);}}
function showReminderOverlay(whichoverlay){$('#overlay').show();$("#"+whichoverlay).fadeIn('slow');$(".saveDRreminder").click(function(){saveReminderOverlayValues(whichoverlay);});}
function saveReminderOverlayValues(whichoverlay){if($('.drreminder').is(':checked')){setCookie("noshowDRreminder",1,1000);}
if($('#dealsemailaddress').val()){if(isValidEmail($('#dealsemailaddress').val())){storeEmail($('#dealsemailaddress').val(),$('#dresspref').val());hideReminderOverlay(whichoverlay);}
else{alert("Please type in a valid email address");}}
else{hideReminderOverlay(whichoverlay);}}
function hideReminderOverlay(whichoverlay){$('#overlay').hide();$('#'+whichoverlay).hide();}
function getOverlayReminder(){var loc=String(window.location);if(loc.search(/deals/i)==-1){return"dressingroomreminder";}
else{return"dealsemail";}}
function storeEmail(email,details){$.post(dev+"handlecodes.php",{signup:1,email:email,details:details},function(data){var gwoTracker=_gat._getTracker("UA-11262224-6");gwoTracker._trackPageview("/2265973179/goal");setCookie("noshowDRreminder",1,1000);alert("Thanks!  We'll be in touch shortly.");});}
function initSearchDisplay(){showSliderRange();showIcon();highlightColorBox();}
function displayTab(){hideTabs();hideSubTabs();if(!dresstype){dresstype=DEFAULT_DRESSTYPE;var tab=DEFAULT_TAB;}
else{var tab=whichTab();}
$('#'+tab+'tab').show();$('#'+dresstype+'subtab').removeClass('subnotselected');$('#'+dresstype+'subtab').addClass('subselected');$('#'+tab).removeClass('tabnotselected');$('#'+tab).addClass('tabselected');}
function whichTab(){var tab="";switch(dresstype){case"flower":tab="weddings";break;case"maternity":tab="weddings";break;case"MOB":tab="weddings";break;case"qipao":tab="weddings";break;case"quince":tab="prom";break;case"prom":tab="prom";break;case"reg":tab="weddings";break;case"coupons":tab="deals";break;case"weddress":tab="weddings";break;case"women":tab="everyday";break;case"girls":tab="everyday";break;}
return tab;}
function hideTabs(){$('.tabselected').each(function(index){$('.typetab').removeClass('tabselected').addClass('tabnotselected');});}
function hideSubTabs(){$('#subbar').children('p').hide();$('#subbar').find('span').removeClass('subselected').addClass('subnotselected');}
function displayDeals(){$('#searchresults').hide();$('#dealsdisplay').show();}
function displayResults(){$('#dealsdisplay').hide();$('#searchresults').show();}
function startSearch(newLocation,sectionData){$("#waiting").show();$('#noresults').hide();clearGlobalAttr();applyFilters(newLocation);adjustInputs();if(dresstype=="coupons"){displayDeals();}
else{displayResults();queryDB();}}
function setVanitySearchBar(){setDefaultChoices();var vanity_filters=$('#hiddenfilter').val();applyFilters(vanity_filters);adjustInputs();var loc=String(window.location);if(loc.search(/lookbook/i)!=-1){displayDeals();}}
function queryDB(){$.getJSON(dev+"website_results.php",{callback:'callback',sortby:sortby,p:p,len:len,neck:neck,sleeves:sleeves,dresstype:dresstype,price:price,n:n,color:color,tag_group:tag_group},function(data){if((data.resultscount*1)==0){noResults();}
else{printResults(data);$("#resultscount").html(data.resultscount);$(".pagenav").html(data.pagenav);$(".pagenavbot").html(data.pagenav);$("#cur_page").val(data.p);}});}
function printResults(data){var htmlstr="";for(var i=1;i<=data.n;i++){if(data.prod[i]){if(i%4==1){htmlstr=htmlstr+"<div class=\"boxrow\">";}
htmlstr=htmlstr
+"<div id=\"img"+i+"\" class=\"boxresult\">"
+data.prod[i]
+"</div>";if(i%4==0){htmlstr=htmlstr+"</div><br><br><BR>";}}}
$("#imgs").html(htmlstr);showTitlePopups();changeAdd();externalLinks();}
function adjustInputs(){if(!n){n=DEFAULT_N;}
if(!sortby){sortby=DEFAULT_SORTBY;}
img_options=reOrderNMenu();$("#nthumbs").html(img_options);sort_options=reOrderSortMenu();$("#sort").html(sort_options);unCheckAll();var parameters=new Array(len,neck,sleeves);for(i=0;i<parameters.length;i++){var splitByComma=parameters[i].split(",");if(!splitByComma[0]){var whichparam=findMissingCat(i);var allAttr=addMissingValues(whichparam);for(j=0;j<allAttr.length;j++){$("#"+allAttr[j]+"checked input").attr("checked",true);}}
else{for(j=0;j<splitByComma.length;j++){$("#"+splitByComma[j]+"checked input").attr("checked",true);}}}
displayTab();adjustPriceBar();adjustColorBoxes();$('#tag_cloud').val(tag_group);changeIcons();if(!hasResults()){noResults();}}
function findMissingCat(count){var whichparam="";switch(count){case 0:whichparam="len";break;case 1:whichparam="neck";break;case 2:whichparam="sleeves";break;case 3:whichparam="dresstype";break;}
return whichparam;}
function adjustPriceBar(){splitByComma=price.split(",");if((splitByComma[0])&&(splitByComma[1])){var low=splitByComma[0];var high=splitByComma[1];}
else{var low=0;var high=DEFAULT_HIGHPRICE;price="0,"+DEFAULT_HIGHPRICE;}
$("#slider-range").slider('values',0,low);$("#slider-range").slider('values',1,high);$("#amount").val('$'+$("#slider-range").slider("values",0)+' - $'+$("#slider-range").slider("values",1));}
function adjustColorBoxes(){if(!color){color=DEFAULT_COLOR;}
if(!$("#"+color).attr('id')){color=DEFAULT_COLOR;}
$("#"+color).addClass('selected');}
function hasResults(){var hasresults=1;if(!len){$('input[name=length]').attr('checked',false);hasresults=0;}
if(!neck){$('input[name=neck]').attr('checked',false);hasresults=0;}
if(!sleeves){$('input[name=sleeves]').attr('checked',false);hasresults=0;}
if(!dresstype){$('input[name=dresstype]').attr('checked',false);hasresults=0;}
return hasresults;}
function addMissingValues(missingattr){var allattr=new Array();switch(missingattr){case"dresstype":dresstype=DEFAULT_DRESSTYPE;allattr=dresstype.split(",");break;case"len":len=DEFAULT_LENGTH;allattr=len.split(",");break;case"neck":neck=DEFAULT_NECK;allattr=neck.split(",");break;case"sleeves":sleeves=DEFAULT_SLEEVES;allattr=sleeves.split(",");break;}
return allattr;}
function clearGlobalAttr(){p="";sortby="";n="";len="";neck="";sleeves="";price="";color="";}
function addToURL(cat,getstr,val){if(!isthere[cat]){getstr=getstr.slice(0,-1);getstr+="&"+cat+"="+val+",";isthere[cat]=1;}
else{getstr+=val+",";}
return getstr;}
function createUrl(){var filter=new Array("length","neck","sleeves");isthere['length']=0;isthere['neck']=0;isthere['sleeves']=0;isthere['price']=0;if(!(document.getElementById('cur_page').value)){newPage(1);}
var getstr="p="+document.getElementById('cur_page').value+"&"+"n="+document.getElementById('nthumbs').value+"&"+"sortby="+document.getElementById('sort').value+"&"+"color="+$('.selected').attr('id')+"&"+"tags="+$('#tag_cloud').val()+"&";if(dresstype){getstr=getstr+"dresstype="+dresstype+"&";}
for(var i=0;i<filter.length;i++){var ischecked=0;$('input[name='+filter[i]+']').each(function(){if($(this).is(':checked')){ischecked++;getstr=addToURL(filter[i],getstr,$(this).val());}});if(!ischecked){getstr=addToURL(filter[i],getstr,"none");}}
getstr=addToURL("price",getstr,$("#slider-range").slider("values",0)+","
+$("#slider-range").slider("values",1));return getstr.slice(0,-1);}
function setDefaultChoices(){len=DEFAULT_LENGTH;neck=DEFAULT_NECK;sleeves=DEFAULT_SLEEVES;dresstype=DEFAULT_DRESSTYPE;price=DEFAULT_PRICE;}
function applyFilters(filters){var splitByAnd=filters.split("&");for(var i=0;i<splitByAnd.length;i++){var category=splitByAnd[i].split("=");switch(category[0]){case"length":len=category[1];break;case"neck":neck=category[1];break;case"sleeves":sleeves=category[1];break;case"dresstype":dresstype=category[1];break;case"price":price=category[1];break;case"sortby":sortby=category[1];break;case"n":n=category[1];break;case"p":p=category[1];break;case"color":color=category[1];break;case"tags":tag_group=category[1];break;}}}
function reOrderSortMenu(){var sort_options="<option value=\""+sortby+"\">"
+outputMenu(sortby)+"</option>";for(var i=0;i<DEFAULT_SORTMENU_ARRAY.length;i++){if(DEFAULT_SORTMENU_ARRAY[i]!=sortby){sort_options=sort_options+"<option value=\""
+DEFAULT_SORTMENU_ARRAY[i]+"\">"
+outputMenu(DEFAULT_SORTMENU_ARRAY[i])+"</option>";}}
return sort_options;}
function reOrderNMenu(){var img_options="<option value=\""+n+"\">"
+n+"</option>";for(var i=0;i<DEFAULT_NMENU_ARRAY.length;i++){if(DEFAULT_NMENU_ARRAY[i]!=n){img_options=img_options+"<option value=\""
+DEFAULT_NMENU_ARRAY[i]+"\">"
+DEFAULT_NMENU_ARRAY[i]+"</option>";}}
return img_options;}
function reSort(){sortby=document.getElementById('sort').value;sort_options=reOrderSortMenu();$("#sort").html(sort_options);newPage(1);_gaq.push(['_trackEvent','results',dir+'/results/show'+sortby]);}
function reImg(){n=document.getElementById('nthumbs').value;img_options=reOrderNMenu();$("#nthumbs").html(img_options);newPage(1);_gaq.push(['_trackEvent','results',dir+'/results/show'+n]);}
function newPage(num){if(!areCookiesOn()){alert("Please turn on your cookies to log into the dressing room.");}
else{var npages=getCookie("npages");if(npages){var new_val=(npages*1)+1;setCookie("npages",new_val,1);}
else{setCookie("npages",1,1);}}
$("#cur_page").val(num);}
function noResults(){$("#noresults").show();$("#pagenav").html("");$("#pagenavbot").html("");$("#resultscount").html(0);}
function handleHistoryChange(newLocation,historyData){if(newLocation){startSearch(newLocation,historyData);}
else{setVanitySearchBar();}}
function mouseActions(){var newLocation=createUrl();var modifiedLocation=newLocation;var historyData="<p>The following location was loaded from our DHTML history: "+modifiedLocation+"</p>";dhtmlHistory.add(modifiedLocation,historyData);startSearch(newLocation,null);}
function handleMouseClick(e){var evt;if(typeof window.event!="undefined")
evt=window.event;else
evt=e;var target;if(typeof evt.srcElement!="undefined")
target=evt.srcElement;else
target=evt.target;setTimeout("mouseActions()",10);}
function attachListener(ele){if(typeof window.attachEvent!="undefined"){ele.attachEvent("onclick",handleMouseClick);}
else{ele.addEventListener("click",handleMouseClick,false);}}
function attachChangeListener(ele){if(typeof window.attachEvent!="undefined"){ele.attachEvent("onchange",handleMouseClick);}
else{ele.addEventListener("change",handleMouseClick,false);}}
function attachMouseUpListener(ele){if(typeof window.attachEvent!="undefined"){ele.attachEvent("onmouseup",handleMouseClick);}
else{ele.addEventListener("mouseup",handleMouseClick,false);}}
function initMouseHandlers(){var filters=new Array("others","othern","pagenav","pagenavbot");for(j=0;j<filters.length;j++){var d=document.getElementById(filters[j]);attachListener(d,filters[j]);}
var d=document.getElementById("formaltag");attachChangeListener(d,0);var d=document.getElementById("traditionaltag");attachChangeListener(d,0);var d=document.getElementById("sort");attachChangeListener(d,0);var d=document.getElementById("nthumbs");attachChangeListener(d,0);var d=document.getElementById("mousezone");attachMouseUpListener(d,1);$('.icon').each(function(){var d=document.getElementById($(this).attr('id'));attachListener(d,1);});$('#colors .colorrow').children().each(function(){var d=document.getElementById($(this).attr('id'));attachListener(d,1);});$('#personalization .colorrow').children().each(function(){var d=document.getElementById($(this).attr('id'));attachListener(d,1);});}
function showSliderRange(){$("#slider-range").slider({range:true,min:0,max:DEFAULT_HIGHPRICE,values:[0,DEFAULT_HIGHPRICE],slide:function(event,ui){$("#amount").val('$'+ui.values[0]+' - $'+ui.values[1]);}});$("#amount").val('$'+$("#slider-range").slider("values",0)+' - $'+$("#slider-range").slider("values",1));}
function showIcon(){$(".icon div:first-child").click(function(){$($(this).parent().children("div:first-child")).toggle();$($(this).parent().children("div:nth-child(2)")).toggle();if($(this).parent().children("input").attr("checked")){$(this).parent().children("input").attr("checked",false);}else{$(this).parent().children("input").attr("checked",true);};});$(".icon div:nth-child(2)").click(function(){$($(this).parent().children("div:first-child")).toggle();$($(this).parent().children("div:nth-child(2)")).toggle();if($(this).parent().children("input").attr("checked")){$(this).parent().children("input").attr("checked",false);}else{$(this).parent().children("input").attr("checked",true);};});}
function unCheckAll(){$('input[name=length]').attr('checked',false);$('input[name=neck]').attr('checked',false);$('input[name=sleeves]').attr('checked',false);clearColors();}
function changeIcons(){$(".icon input").each(function(){if($(this).attr("checked")){$(this).parent().children("div:first-child").show();$(this).parent().children("div:nth-child(2)").hide();}else{$(this).parent().children("div:first-child").hide();$(this).parent().children("div:nth-child(2)").show();}});}
function outputMenu(val){var opt="";switch(val){case"popular":opt="Most Popular";break;case"high":opt="Highest Price";break;case"low":opt="Lowest Price";break;}
return opt;}
function showTitlePopups(){$('.boxresult').each(function(){var boxDelay=null;var showing=false;$(this).hover(function(){var popup=$('.popup2',this);var addpopup=$('.addcorner',this);var added=$(".added",this);boxDelay=setTimeout(function(){popup.fadeIn(500);if(added.css('display')=='none'){if($("#module").css("display")!="none"){addpopup.fadeIn(500);}}
showing=true;},500);},function(){if(showing){clearTimeout(boxDelay);$("#container").css("background-color","white");$('.popup2',this).hide("slide",{direction:"down"},500);if($(".added",this).css('display')=='none'){if($("#module").css("display")!="none"){$('.addcorner',this).hide("slide",{direction:"right"},500);}}
showing=false;boxDelay=null;}else{clearTimeout(boxDelay);boxDelay=null;}});});}
function showIconLabel(){$('.bubbleInfo').each(function(){var distance=10;var time=250;var hideDelay=250;var hideDelayTimer=null;var beingShown=false;var shown=false;var trigger=$('.trigger',this);var popup=$('.popup',this).css('opacity',0);$([trigger.get(0),trigger.get(1),popup.get(0)]).mouseover(function(){if(hideDelayTimer)clearTimeout(hideDelayTimer);if(beingShown||shown){return;}else{beingShown=true;popup.css({top:-33,left:20,display:'block'}).animate({top:'-='+distance+'px',opacity:1},time,'swing',function(){beingShown=false;shown=true;});}}).mouseout(function(){if(hideDelayTimer)clearTimeout(hideDelayTimer);hideDelayTimer=setTimeout(function(){hideDelayTimer=null;popup.animate({top:'-='+distance+'px',opacity:0},time,'swing',function(){shown=false;popup.css('display','none');});},hideDelay);});});}
function showQuestionMarkLabels(){$('.bubbleInfo2').each(function(){var distance=10;var time=250;var hideDelay=250;var hideDelayTimer=null;var beingShown=false;var shown=false;var trigger=$('.trigger',this);var popup=$('.popup',this).css('opacity',0);$([trigger.get(0),popup.get(0)]).mouseover(function(){if(hideDelayTimer)clearTimeout(hideDelayTimer);if(beingShown||shown){return;}else{beingShown=true;popup.css({top:-33,left:20,display:'block'}).animate({top:'-='+distance+'px',opacity:1},time,'swing',function(){beingShown=false;shown=true;});}}).mouseout(function(){if(hideDelayTimer)clearTimeout(hideDelayTimer);hideDelayTimer=setTimeout(function(){hideDelayTimer=null;popup.animate({top:'-='+distance+'px',opacity:0},time,'swing',function(){shown=false;popup.css('display','none');});},hideDelay);});});}
function highlightColorBox(){$('#colors .colorrow').children().click(function(){clearColors();$(this).addClass('selected');});}
function clearColors(){$('.colorrow').children().each(function(){$(this).removeClass('selected');});}
function moveToRoom(){if(areCookiesOn()){if(!getCookie("dr")||(getCookie("dr")==0)){if($(".changebutton").attr("src")=="http://static.shinyorb.com/img/save-share-button.gif"){_gaq.push(['_trackPageview',"/"+dir+"v/PrivateRoom/"]);}
var createroom=1;$.post(dev+"dressing_room_callback.php",{createroom:createroom},function(data){setCookie("dr",data.dr,1);window.location="/private/"+getCookie("dr")+"/";},"json");}
else{window.location="/private/"+getCookie("dr")+"/";}}
else{alert("Please turn on your cookies to enter your dressing room.");}}
function updateDressCount(){var tempcount=$(".short").html().split("(");var count=tempcount[1].split(")");var newcount=count[0]*1+1;$(".short").html("("+newcount+")");}
function addDress(picked){if(areCookiesOn()){var img_title=$(picked).parents(".boxresult").find("img:first-child").attr("alt");var img_src=$(picked).parents(".boxresult").find("img:first-child").attr("src");var pid=$(picked).parents(".boxresult").find("a:first-child").attr("name");var adddress=1;$.post(dev+"dressing_room_callback.php",{adddress:adddress,pid:pid},function(data){if(data.dr){setCookie("dr",data.dr,1);}},"json");$(".smallpics").prepend("<img height=\"56\" width=\"42\" src=\""
+img_src+"\" title=\""+img_title+"\" alt=\""
+img_title+"\" />");updateDressCount();}
else{alert("Please turn on your cookies.");}}
function changeAdd(){$('.add').each(function(){var addp=$(this);var addedp=addp.prev();addp.click(function(){addp.hide();addp.parent().show();addedp.show();})});$(".add").click(function(){addDress($(this));});$(".fblike").click(function(){likeProdResults($(this).parents(".boxresult").find("a").attr("name"));});}
function animation(){$('#animationwrapper').show();$('#whiteoverlay').fadeIn(1000);$('#img1').fadeTo(1000,0.3);$('#hoverandadd').fadeIn(1000);$('#animateadd').fadeIn(1000,function(){$('#animatearrow').fadeIn(1000);$('#samplepic').fadeIn(1000,function(){$('#thensend').fadeIn(1000);$('#animatearrowdown').fadeIn(1000);$('#animatecircle').fadeIn(1000,function(){setTimeout(function(){$('#animationwrapper').fadeOut(1000);$('#img1').fadeTo(1000,1);},4000);});});});};function addAnimation(){var animation_html="<div id=\"whiteoverlay\"></div>"
+"<img id=\"animateadd\" src=\"http://static.shinyorb.com/img/animate-add.gif\" />"
+"<p id=\"hoverandadd\">Hover and Add</p>"
+"<img id=\"animatearrow\" src=\"http://static.shinyorb.com/img/animate-arrow.gif\" />"
+"<img id=\"samplepic\" width=\"42\" height=\"56\""
+"alt=\"Jovani Evening Dress 44632650\" "
+"src=\"http://static.shinyorb.com/thumbs_tj/1968-20100111.jpg\">"
+"<p id=\"thensend\">"
+"Then save & send dresses to friends </p>"
+"<img id=\"animatearrowdown\" src=\"http://static.shinyorb.com/img/animate-arrow-down.gif\" />"
+"<img id=\"animatecircle\" src=\"http://static.shinyorb.com/img/animate-circle.gif\" />";$('#animationwrapper').html(animation_html);var secondpic=$('#img2').find("img").attr("src");$('#samplepic').attr("src",secondpic);setTimeout(function(){animation();},1000);setCookie("animate",1,60);}
function dressHasBeenAdded(pid,added){for(var i=0;i<added.length;i++){if(added[i]==pid){return 1;}}
return 0;}
function getLook(dir){$.post(dev+"results_lookbook.php",{loadlook:1,pos:$('#theme_num').val(),dir:dir},function(data){switch(dir){case'right':$('#tableprev').attr('id','temp')
$('#tablecurr').attr('id','tableprev');$('#tablenext').attr('id','tablecurr');$('#temp').html('<h2>'+data.title+'</h2>'+data.html);$('#temp').attr('id','tablenext');$('#tableprev').fadeOut(function(){$('#tablecurr').fadeIn();});break;case'left':$('#tablenext').attr('id','temp')
$('#tablecurr').attr('id','tablenext');$('#tableprev').attr('id','tablecurr');$('#temp').html('<h2>'+data.title+'</h2>'+data.html);$('#temp').attr('id','tableprev');$('#tablenext').fadeOut(function(){$('#tablecurr').fadeIn();});break;}
$('#thetable a').attr('rel','external');externalLinks();$('#theme_num').val(data.newpos);},"json");}
function initPersonalization(){var loc=String(window.location);if(loc.search(/personalized/i)!=-1){$('#tagchoice').show();$('#traditionaltag').change(function(){$('#tag_cloud').val(groupTags());});$('#formaltag').change(function(){$('#tag_cloud').val(groupTags());});}}
function runHelper(){$('#overlay').show();$('#personalization').show();$('#q1').show();$("#select_type").change(function(){if($("#select_type").val()=="bridesmaid"){$('#q1').hide();$('#q3').fadeIn();}
else{$('#overlay').hide();$('#personalization').hide();$('#q1').hide();window.location="/r/"+formatVanity($('#select_type').val());}});$('#personalization .colorrow').children().click(function(){$('#tag_cloud').val(groupTags());clearColors();$('#'+$(this).attr("id").slice(0,-1)).addClass('selected');$('#overlay').hide();$('#personalization').hide();$('#q6').hide();});}
function groupTags(){var tagset="";if($('#traditionaltag').val()!="both"){tagset=tagset+$('#traditionaltag').val()+",";}
if($('#formaltag').val()!="both"){tagset=tagset+$('#formaltag').val()+",";}
return tagset.slice(0,-1);}
function formatVanity(dresstype){var formattype="";switch(dresstype){case"flower":formattype="flower-girl-dresses";break;case"MOB":formattype="mother-of-the-bride";break;case"prom":formattype="prom";break;}
return formattype;}
function likeProdResults(pid){if(getCookie("loveit")){if(!alreadyLovedIt(pid)){addToLoveItResults(pid);}}
else{addToLoveItResults(pid);}}
function addToLoveItResults(pid){$.post(dev+"fb_callback.php",{fblike:1,pid:pid},function(data){if(data.msg!="success"){alert("Oops -- sorry!  We did not receive your like.  Please try again.");}
else{showLikesResults(pid);setCookie("loveit",getCookie("loveit")+","+pid,1)}},"json");}
function showLikesResults(pid){if($("#nfans-"+pid).html()){var newcount=$("#nfans-"+pid).html()*1+1*1;$("#nfans-"+pid).html(newcount);}
else{$("#nfans-"+pid).html('(1)');}}