// bookmark in all browsers

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

// uppercase, lowercase, propercase 

String.prototype.toCapitalCase = function() {
	var regEx = /([a-z]*)([^a-z]*)([\s\S]*)/i;
	var matchArray = regEx.exec(this);
	var text = '';
	while (matchArray) {
		text += matchArray[1].charAt(0).toUpperCase() + matchArray[1].slice(1).toLowerCase() + matchArray[2];
		temp = matchArray[3];
		if (matchArray[3]) {
			matchArray = regEx.exec(matchArray[3]);
		} else {
			matchArray = false;
		}
		
	}
	if (window.temp) {
		text +=temp.charAt(0).toUpperCase() + temp.slice(1).toLowerCase()
	}
	return text;
}

String.prototype.toSentenceCase = function() {
	var regEx = /([^\.?!]*)([\.?!\s]*)([\s\S]*)/;
	var matchArray = regEx.exec(this);
	var temp;
	var text = '';
	//return matchArray[1]+"\n"+matchArray[2]+"\n"+matchArray[3]+"\nhey";
	while (matchArray) {
		text += matchArray[1].charAt(0).toUpperCase() + matchArray[1].slice(1).toLowerCase() + matchArray[2];
		temp = matchArray[3];
		if (matchArray[3]) {
			matchArray = regEx.exec(matchArray[3]);
		} else {
			matchArray = false;
		}
	}
	if (temp) {
		text +=temp.charAt(0).toUpperCase() + temp.slice(1).toLowerCase()
	}
	return text;
}

function writeToFile() {
	document.convert.submit();
}