
function setfunc(m,s,b,p) {

	delCookie("mail");
	delCookie("subject");
	delCookie("body");
	delCookie("pdf");

	if(!m) {
		m = "null";
	}
	
	if(!s) {
		s = "null";
	}
	
	if(!b) {
		b = "null";
	}
	
	if(!p) {
		p = "null";
	}
	setCookie("mail",m);
	setCookie("subject",s);
	setCookie("body",b);
	setCookie("pdf",p);

}

function cookiemail() {
	
	var m,s,b,p;
	
	m = getCookie("mail");
	
	s = getCookie("subject");
	
	b = getCookie("body");
	
	p = getCookie("pdf");
	
	if(m=="null") {
		m = "";
	}
	if(s=="null") {
		s = "";
	}
	if(b=="null") {
		b = "";
	}
	if(p=="null") {
		p = "";
	}
	
	if(p) {
		window.open(p);
	} else if(m && s && b) {
		location.href='mailto:'+m+'?subject='+s+'&body='+b;
	} else if(m && !s && b) {
		location.href='mailto:'+m+'?body='+b;
	} else if(m && s && !b) {
		location.href='mailto:'+m+'?subject='+s;
	} else if(m && !s && !b) {
		location.href='mailto:'+m;
	} else if(!m && s && b) {
		location.href='mailto:?subject='+s+'&body='+b;
	} else if(!m && !s && b) {
		location.href='mailto:?body='+b;
	} else if(!m && !s && !b) {
		location.href='mailto:';
	}
}


/* cookieをセットする */
function setCookie(key,val){
    tmp = key+"="+escape(val)+";";
/*    tmp += "expires=Fri, 31-Dec-2030 23:59:59;";*/
	tmp += "path=/;";
    document.cookie = tmp;
}

/* cookieを取得する */
function getCookie(key){
    tmp = document.cookie+";";
    tmp1 = tmp.indexOf(key,0);
    if(tmp1 != -1){
        tmp = tmp.substring(tmp1,tmp.length);
        start = tmp.indexOf("=",0);
        end = tmp.indexOf(";",start);
        return(unescape(tmp.substring(start+1,end)));
    }
    return("");
}

/* cookieを削除する */
function delCookie(key){
    expiredate = new Date();
    expiredate.setYear(expiredate.getYear()-1);
    tmp = key+"=;";
    tmp += "expires="+expiredate.toGMTString();
    document.cookie = tmp;
}
