﻿logIn = 0
expireDate = new Date
expireDate.setMonth(expireDate.getYear()+2)
email = ""
realname = ""
telephone = ""
brand = ""
size = ""
makemodel = ""
terms = "no"
newsletter = "yes"
enquiry=""
subKey="MxQ05kiUO12"

if (document.cookie != "") {
	if(cook = cookieVal("jba1")) {
		cook = unenc(cook)
		realname = cook.split("^")[0]
		email = cook.split("^")[1]
		newsletter = cook.split("^")[2]
		telephone = cook.split("^")[3]
		makemodel = cook.split("^")[4]
		newsletter = cook.split("^")[5]
	}
	enquiry = cookieVal("enquiry")
	brand = cookieVal("brand")
	size = cookieVal("size")
}

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)
}
function setBrand(brand) {
	document.cookie="brand="+brand+";;path=/"
	return true
}
function setSize(size) {
	document.cookie="size="+size+";;path=/"
	return true
}
function setPrice() {
		metaframe=document.FormName.frame.selectedIndex;
		metasize=document.FormName.size.selectedIndex;
		price = prices[metasize*frames+metaframe];
		document.getElementById('actualprice').innerHTML = price;
		if(price==0) {
			alert("The selected size is not available in that frame type")
		}
}
re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/
