/* Default Javascript File - For Non jQuery code */

String.prototype.ltrim = function() {
	return this.replace(/^\s+/,"");
}

String.prototype.rtrim = function() {
	return this.replace(/\s+$/,"");
}

String.prototype.trim = function() {
	return this.ltrim().rtrim();
};

function textboxFocus(my_textbox){
	if(my_textbox.value == my_textbox.title){
		my_textbox.value = "";
	}
}

function textboxBlur(my_textbox){
	if(my_textbox.value == ""){
		my_textbox.value = my_textbox.title;
	}
}

function isEmail(s){ 
    if (s.trim() == "") return false;
    
    var i = 1;
    var sLength = s.length;

	while ((i < sLength) && (s.charAt(i) != "@")){ 
		i++
    }

    if ((i >= sLength) || (s.charAt(i) != "@")) return false;
    else i += 2;

    while ((i < sLength) && (s.charAt(i) != ".")){ 
		i++
    }

    if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
    else return true;
}