function login() {
  window.open('/discount/member_new/login1.asp','','scrollbars=yes,resizable=yes,width=600,height=500');
}
function logout() {
  window.open('/discount/member_new/logout.asp','','scrollbars=yes,resizable=yes,width=600,height=500');
}
function profile() {
  window.open('/discount/member_new/func/member.asp','','scrollbars=yes,resizable=yes,width=600,height=500');
}
function pop_fav(ishop_id) {
  if (!isNaN(ishop_id)) {
    window.open('/discount/func/pop_fav.asp?shop_id='+ishop_id,'w_fav','resizable=yes,scrollbars=yes,width=520,height=395');
  }
}
function pop_fav_pcode() {
  window.open('/pop_up/fav_pcode.asp','','scrollbars=yes,resizable=yes,width=500,height=520');
}
function pop_ticket(ishop_id) {
  if (!isNaN(ishop_id)) {
    // window.open('/shop/pop_ticket.asp?shop_id='+ishop_id,'','scrollbars=yes,width=645,height=350');
    window.open('/discount/shop/shop_etc/discount_ticket.asp?shop_id='+ishop_id,'','scrollbars=yes,width=645,height=350');
    // window.open('/discount/func/pop_discount.asp?shop_id='+ishop_id,'','resizable=yes,scrollbars=yes,width=520,height=395');
  }
}
function pop_coupon(cid) {
  if (cid!='' && !isNaN(cid)) {
    window.open('/coupon/pop_coupon.asp?id='+cid,'','scrollbars=yes,width=645,height=350');
  }
}
function pop_boss_msg(ishop_id,ireply_to) {
  if (!isNaN(ishop_id)) {
    u=(ireply_to ? ishop_id+'&reply_to='+ireply_to : ishop_id)
    window.open('/discount/forum/guestbook_post_isboss.asp?shop_id='+u,'','resizable=yes,width=400,height=300');
  }
}
function pop_guest_msg(ishop_id) {
  if (!isNaN(ishop_id)) {
    window.open('/discount/forum/guestbook_post.asp?method=1&shop_id='+ishop_id,'','resizable=yes,scrollbars=yes,width=400,height=350');
  }
}
function search(str,starget) {
  if (str) {
    var cpid=getQueryString('client_id')
    var u='/discount/shop/shop_query/index.asp?'+str+(cpid>'' ? '&client_id='+cpid : '')
    if (!starget)
      window.location.href=u
    else if (starget=='opener') {
      opener.location.href=u
      opener.focus()
    } else
      window.open(u,starget,'resizable=yes,scrollbars=yes,width=640,height=480,location=yes,menubar=yes,status=yes,toolbar=yes');
  }
}
function showll(ishop_id,starget) {
  if (!isNaN(ishop_id)) {
    var cpid=getQueryString('client_id')
    var u='/gold/shop_showll.asp?shop_id='+ishop_id+(cpid>'' ? '&client_id='+cpid : '')
    if (!starget)
      window.location.href=u
    else if (starget=='opener') {
      opener.location.href=u
      opener.focus()
    } else
      window.open(u,starget,'resizable=yes,scrollbars=yes,width=640,height=480,location=yes,menubar=yes,status=yes,toolbar=yes');
  }
}
function pop_msg_visible(imsg_no,ivisible) {
  if (!isNaN(imsg_no)) {
    window.open('/discount/forum/pop_msg_visible.asp?message_no='+imsg_no+'&visible='+ivisible,'','resizable=yes,scrollbars=yes,width=440,height=360');
  }
}
function pop_shop_id_history() {
  window.open('/discount/func/pop_shop_id_history.asp','','resizable=yes,scrollbars=yes,width=500,height=360');
}
function pop_open() {
  window.open('/open/index.asp','','scrollbars=yes,resizable=yes,width=640,height=460')
}
function pop_newsletter() {
  window.open('/epaper/subscribe.asp','','scrollbars=yes,resizable=yes,width=640,height=460')
}
function pop_ad_price() {
  window.open('/ads/ad_price.asp','','scrollbars=yes,resizable=yes,width=620')
}

function getCookie(skey){
	var re = new RegExp(skey+'=([^;]*)(?:;|$)');
	var a = re.exec(document.cookie);
	return unescape(a ? a[1] : '');
}

function setCookie(name, value, hours) {
  var expire = '';
  if(hours != null)
  {
    expire = new Date((new Date()).getTime() + hours * 3600000);
    expire = "; expires=" + expire.toGMTString();
  }
  document.cookie = name + "=" + escape(value) + expire + "; path=/";
}
function getQueryString(skey) {
	var p, urlQuery
	if ((p=location.href.indexOf("?")) == -1) return ''
	urlQuery = location.href.substr(p+1)
	if (skey==null) return urlQuery
	var re = new RegExp(skey+'=([^&]*)(?:&|$)');
	var a = re.exec(urlQuery);
	return unescape(a ? a[1] : '');
}