// Pop Up Window
var newwindow;
function popup(url){
	newwindow=window.open(url,'name','height=560,width=440, scrollbars=yes, toolbar=no, menubar=no, resizable=yes');
	if (window.focus) {newwindow.focus()}
}

// Bookmarking
function bookmark(url,title){
  if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
  	window.external.AddFavorite(url,title);
  } else if (navigator.appName == "Netscape") {
    window.sidebar.addPanel(title,url,"");
  } else {
    alert("Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark");
  }
}

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;
}

function clearCookie(){
	var date = new Date();
	document.cookie = "ycccname=; expires=" + date.toGMTString() + "; path=/";
	document.cookie = "ycccuser=; expires=" + date.toGMTString() + "; path=/";
	var welcome = document.getElementById("memberwelcome");
	if(welcome){
		welcome.innerHTML = '<strong>Welcome</strong>, <a href="${here/absolute_url}:account.html" title="Login to manage you account details"> please login to access your account</a>. New to the website? You can <a href="${here/absolute_url}:registeruser.html" title="Register with us online to access additional content &amp; features"><strong>register free here</strong></a>.';
	}
	var user = document.getElementById("username");
	if (user) {
		user.value = '';
	}
}