var $_GETURL = location.search.split("&");
$_GETURL[0] = $_GETURL[0].substring(1,$_GETURL[0].length)
function $_GET($_GETStr){
 for (i in $_GETURL){
  if ($_GETStr == $_GETURL[i].substring(0,$_GETURL[i].indexOf("="))){
   return decodeURIComponent(
    $_GETURL[i].substring($_GETURL[i].indexOf("=")+1,$_GETURL[i].length)
   );
  }
 }
}
if ($_GET('affId') != null) {
	writeCookie('affId',$_GET('affId'),30)
}
function writeCookie(name, value,expdays) {
	t = new Date;
	t.setTime(t.getTime() + expdays * 24 * 60 * 60 * 1000);
	document.cookie = name + '=' + escape(value) + '; path=/; expires=' + t.toGMTString();
}
function readCookie(name) {
	allcookie = document.cookie + ';'
	start1 = allcookie.indexOf(name);
	if (start1 != -1) {
		target = allcookie.substring(start1, allcookie.length);
		start2 = target.indexOf('=', 0) + 1;
		end = target.indexOf(';', start2);
		return(unescape(target.substring(start2, end)));
	} else {
		return("");
	}
}
function setOrderUrl() {
	if (readCookie('affId') != null) {
		document.all.lnkOrder.href='https://secure410m.sakura.ne.jp/antanue.com/postmail2/postmail.html?affId=' + readCookie('affId');
	}
}
function setOrderUrl2(obj){
	if (readCookie('affId') != null) {
		obj.href = 'https://secure410m.sakura.ne.jp/antanue.com/postmail2/postmail.html?affId=' + readCookie('affId');
	}
}
