﻿function popUp(URL){day=new Date();id=day.getTime();eval("page"+id+" = window.open(URL, '"+id+"', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=500,height=600,left = 390,top = 212');");}function openWindow(url,name,options){var newWindow=window.open(url,name,options);newWindow.focus();}function openwindowlink(imgUrl){openWindow(imgUrl,"Buycostumes","directories=0,height=550,width=420,scrollbars=no");}function openwindowlink_outstock(){openWindow("/pages/popups/outofstock_pop.htm","Details","directories=0,height=175,width=300,scrollbars=no");}function openPage(pageid,name){openWindow('/pages/Content/ContentDisplay.aspx?siteid=1&pageid='+pageid,name,'width=800,height=800,scrollbars=yes');}function opensizechart(sizeChartId){openWindow("/Pages/Content/SizeChart.aspx?pageid="+sizeChartId,"Buycostumes","directories=0,height=600,width=650,scrollbars=yes");}function openvideoplayer(videoName){var URL="http://images.celebrateexpress.com/video/cevidplayer/VideoPlayer.aspx?VFN="+videoName;openWindow(URL,"CelebrateExpressVideo","directories=0,height=490,width=490,scrollbars=no");}function replaceMainImage(imageLink,mainImageId,imageFileName,productName,ABTest){var URL="javascript:openwindowlink('http://izoom.celebrateexpress.com/merchandizer/zoom_rounded/zoomce.aspx?img={0}&ProductName={1}&ABTest={2}')";var objMainImage=document.getElementsByName(mainImageId)[0];var imgZoomLink1=get_object("imgZoom1");var imgZoomLink2=get_object("imgZoom2");imgZoomLink1.href=URL.replace("{0}",imageFileName).replace("{1}",productName).replace("{2}",ABTest);imgZoomLink2.href=URL.replace("{0}",imageFileName).replace("{1}",productName).replace("{2}",ABTest);objMainImage.src=imageLink;}function createCookie(name,value,hours){var expires=hours/24;setCookie(name,value,expires,"/",'','');}function setCookie(name,value,expires,path,domain,secure){var today=new Date();today.setTime(today.getTime());if(expires){expires=expires*1000*60*60*24;}var expires_date=new Date(today.getTime()+(expires));document.cookie=name+"="+escape(value)+((expires)?";expires="+expires_date.toGMTString():"")+((path)?";path="+path:"")+((domain)?";domain="+domain:"")+((secure)?";secure":"");}function readCookie(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length);}return null;}function eraseCookie(name){createCookie(name,"",-1);}function copyAToB(controlAId,controlBId){get_object(controlBId).value=get_object(controlAId).value;}function RemoveCoupon(couponcode){setCookie('BuyCostumesRemoveCoupon',couponcode,30,'/','','');window.location.href=unescape(window.location.pathname);}function decimalDisplay(input){var outputString=new String();outputString=" "+input;if(outputString.indexOf(".")<0)outputString+=".";var decimalLength=outputString.substring(outputString.indexOf(".")).length;while(decimalLength<3){outputString=outputString+"0";decimalLength=outputString.substring(outputString.indexOf(".")).length;}return outputString.replace(" ","");}function clickButton(e,buttonid){var evt=e?e:window.event;var btn=document.getElementById(buttonid);if(btn){if(evt.keyCode==13){btn.click();return false;}}}function confirmDelete(type){if(type=="address"){return confirm("Are you sure you want to delete this Address from your profile?");}return true;}function disablePostBackWithName(name_i){var hiddenValue=get_object(name_i).value;if(hiddenValue=="false"){get_object(name_i).value="true";return true;}return false;}function disablePostBack(){return disablePostBackWithName("hdnSubmitted");}function enablePostbackWithName(name_i){get_object(name_i).value="false";}function enablePostback(){enablePostbackWithName("hdnSubmitted");}function openNotification(ctrl,prodid,varid,prodname){var hdnProdId=get_object(get_object('hdnPopupProdIdClient').value);var hdnVarId=get_object(get_object('hdnPopupVarIdClient').value);var hdnProdName=get_object(get_object('hdnPopupProdNameClient').value);var title=get_object('hdnPopupTitle');var image=get_object('hdnPopupImage');var popup=get_object('popupOutOfStock');hdnProdId.value=prodid;hdnVarId.value=varid;hdnProdName.value=prodname;title.innerHTML=prodname;image.src='http://images.celebrateexpress.com/mgen/merchandiser/'+prodid+'.jpg?is=200,200,0xffffff';popup.className='AjaxOoSContainer';popup.style.left=(left_pos(ctrl)-popup.offsetWidth-10)+'px';popup.style.top=(top_pos(ctrl)-popup.offsetHeight+20)+'px';}function closeNotification(){makeInvisible('popupOutOfStock');}function makeButtonVisible(buttonId,className){var button=get_object(buttonId);if(button!=null){button.className=className;enablePostback();}}function makeAccessFlyoutVisible(clientId){makeVisible(clientId,'AjaxRecAcBox');}function displayFullReviews(){var tempClassName=get_object("fullReviews").classNameget_object("fullReviews").className=shortReviews.className;get_object("summaryReviews").className=tempClassName;}function changeTabContents(newContentId){var newTabBoxId=newContentId+"Tabs";var newBoxContentsId=newContentId+"Content";get_object("displayedTabBox").innerHTML=get_object(newTabBoxId).innerHTML;get_object("divTabContents").innerHTML=get_object(newBoxContentsId).innerHTML;}function ratingsDisplayed(totalReviewsCount,avgRating,ratingsOnlyReviewCount,buyAgainPercentage){if(totalReviewsCount>0){get_object("hideBV").style.display="block";}}function makeVisible(objid,classname){get_object(objid).className=classname;}function makeInvisible(objid){get_object(objid).className='invisible';}function get_object(obj){if(document.getElementById)return document.getElementById(obj);else if(document.layers)return document.layers[obj];else if(document.all)return document.all[obj];}function top_pos(el){return doPosLoop(el,"Top");}function left_pos(el){return doPosLoop(el,"Left");}function doPosLoop(el,val){var temp=el;var x=temp["offset"+val];while(temp.tagName!="BODY"){temp=temp.offsetParent;if(temp){x+=temp["offset"+val];}else{break;}}return x;}function addLoadEvent(func,param){var oldonload=window.onload;if(typeof window.onload!='function'){window.onload=function(){func(param);}}else{window.onload=function(){if(oldonload){oldonload();}func(param);}}}