logIn = 0
expireDate = new Date
expireDate.setMonth(expireDate.getYear()+2)
email = ""
realname = ""
newsletter = "no"
enquiry=""

if (document.cookie != "") {
	if(cook = cookieVal("rpv1")) {
		cook = unenc(cook)
		realname = cook.split("^")[0]
		email = cook.split("^")[1]
		newsletter = cook.split("^")[2]
	}
	enquiry = cookieVal("enquiry")
}

function cookieVal(cookieName) {
	thisCookie = document.cookie.split("; ")
	for (i=0; i<thisCookie.length; i++) {
       	if (cookieName == thisCookie[i].split("=")[0]) {
        	return thisCookie[i].split("=")[1]
        }
    }
return 0
}

function unenc(enc_str) {
	plain = ""
	if(enc_str != "") {
		for(i = 0; i < enc_str.length; i += 2) {
			meta = parseInt(enc_str.substr(i,[2])) + 23
			num_in = unescape('%' + meta.toString(16))
			plain += num_in
		}
	plain = unescape(plain)
 	}
return(plain)
}

function enc(plain) {
	enc_str = "";
	if(plain == "") {
		alert("No string")
	}
	else {
		pl_str = escape(plain);
		for(i = 0; i < pl_str.length; i++) {
			enc_str += pl_str.charCodeAt(i) - 23;
		}
	}
return(enc_str)
}

re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/