function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

// read cookie by name and list value
function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

// delete cookie by name
function eraseCookie(name) {
	createCookie(name,"",-1);
}


function addToWishList(wl, nm, pw){


//alert(wl);
//alert(nm);
//alert(pw);

var html = document.createElement('script');
html.type = 'text/javascript';
html.src = 'http://www.eyhosting.com/client_data/merwinsliquors/addtowish.php?wishitem=' + wl + '&email=' + nm+ '&pass=' + pw;
document.getElementById('Login').appendChild (html);



}



function removeItem(wl, nm){


//alert(wl);
//alert(nm);
//alert(pw);

var html = document.createElement('script');
html.type = 'text/javascript';
html.src = 'http://www.eyhosting.com/client_data/merwinsliquors/removeitem.php?wishitem=' + wl + '&email=' + nm;
document.getElementById('Login').appendChild (html);

}




function userCreate(name, address1, address2, city, state, zip, phone, country, email, password2)
{
	
	var html = document.createElement('script');
	html.type = 'text/javascript';
	html.src = 'http://www.eyhosting.com/client_data/merwinsliquors/myaccountcreate.php?name=' + name + '&address1=' + address1+ '&address2=' + address2+ '&city=' + city+ '&state=' + state+ '&zip=' + zip+ '&phone=' + phone+ '&country=' + country+ '&email=' + email+ '&password2=' + password2;

	document.getElementById('Register').appendChild (html);

	//userTop(email, password2);
	
	return true;
}

function userUpdate(name, address1, address2, city, state, zip, phone, country, email, password2, uidd)
{
	
	var html = document.createElement('script');
	html.type = 'text/javascript';
	html.src = 'http://www.eyhosting.com/client_data/merwinsliquors/myaccountupdate.php?name=' + name + '&address1=' + address1+ '&address2=' + address2+ '&city=' + city+ '&state=' + state+ '&zip=' + zip+ '&phone=' + phone+ '&country=' + country+ '&email=' + email+ '&password2=' + password2+ '&uidd=' + uidd;

	document.getElementById('Login').appendChild (html);

	//userTop(email, password2);
	
	return true;
}



function userLogin(email, password)
{ 
	var html = document.createElement('script');
	html.type = 'text/javascript';
	html.src = 'http://www.eyhosting.com/client_data/merwinsliquors/myaccountinformation.php?name=' + email + '&password=' + password;

	document.getElementById('Login').appendChild (html);
	
	createCookie("nm", email, 100);
	createCookie("pw", password, 100);

	var o="<iframe class='hideFrame' name='ey' src='https://www.eyhosting.com/client_data/merwinsliquors/session.php?un="+email+"&pw="+password+"'></iframe>";
	document.getElementById("Session").innerHTML = o;
	
	return true;
}

function logout(){
eraseCookie("nm");
eraseCookie("pw");
}





