function djRegister(template){

	url = "/global/forms/register/";
	
	if(template)
		url+="?template=" + template;
		
	if(location.href){
	    if(template)
			url+= "&returnURL=" + URLEncode(location.href);
		else
			url+= "?returnURL=" + URLEncode(location.href);
	}
		
	memberWin = window.open(url,"memberWin","height=705,width=570,scrollbars=yes,top=10,left=10,resizable=1");
	if(memberWin)
	    memberWin.focus();
	else
	    alert("Please disable any pop-up blockers, thank you.");
}

function djUpdate(){
	memberWin = window.open("/profileScripts/update.asp","memberWin","height=630,width=630, top=10, left=10");
	if(memberWin)
	    memberWin.focus();
	else
	    alert("Please disable any pop-up blockers, thank you.");
}

function djPasswordReminder(){
	memberWin = window.open("/profileScripts/forgot.asp","memberWin","height=280,width=610, top=10, left=10");
	if(memberWin)
	    memberWin.focus();
	else
	    alert("Please disable any pop-up blockers, thank you.");
}




function URLEncode (clearString) {
  var output = '';
  var x = 0;
  clearString = clearString.toString();
  var regex = /(^[a-zA-Z0-9_.]*)/;
  while (x < clearString.length) {
    var match = regex.exec(clearString.substr(x));
    if (match != null && match.length > 1 && match[1] != '') {
    	output += match[1];
      x += match[1].length;
    } else {
      if (clearString[x] == ' ')
        output += '+';
      else {
        var charCode = clearString.charCodeAt(x);
        var hexVal = charCode.toString(16);
        output += '%' + ( hexVal.length < 2 ? '0' : '' ) + hexVal.toUpperCase();
      }
      x++;
    }
  }
  return output;
}


