(function(){ var url = location.href, projectIdArray, projectIdArrayLen; if(url.indexOf('/cart/') == -1 && url.indexOf('/credit/') == -1 && url.indexOf('/general/lp/guidegift') == -1){ //カート以外かつLPページでない画面 if(getCookie('project_id') != ''){ //企画IDがある if(getCookie('project_id').indexOf(',')!== -1){ //企画IDが複数ある projectIdArray = getCookie('project_id').split(','); projectIdArrayLen = projectIdArray.length; for(var i=0; i < projectIdArrayLen; i++){ if(getCookie('coupon_issue_' + projectIdArray[i]) != ''){ //獲得フラグがある setCookie('coupon_use_' + projectIdArray[i],'1'); } } } else { if(getCookie('coupon_issue_' + getCookie('project_id')) != ''){ //獲得フラグがある setCookie('coupon_use_' + getCookie('project_id'),'1'); } } } } function setCookie(c_name,value){ var domain = document.domain; var domains = new Array(); domains = domain.split("."); domain = domains[domains.length-2]+'.'+domains[domains.length-1]; var extime = new Date().getTime(); var cltime = new Date(extime + (60*60*24*1000*365)); var exdate = cltime.toUTCString(); var s=""; s += c_name +"="+ escape(value); s += "; path=/; domain="+domain; s += "; expires=" +exdate+"; "; document.cookie=s; } function getCookie(c_name){ var st = ""; var ed = ""; if(document.cookie.length>0){ st = document.cookie.indexOf(c_name + "="); if(st != -1){ st = st+c_name.length+1; ed = document.cookie.indexOf(";",st); if(ed == -1) ed = document.cookie.length; return unescape(document.cookie.substring(st,ed)); } } return ""; } }());