String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}
$("document").ready(function(){
	$("#Cell_Phone").addClass("indexCaptureCPGrey").val("e.g. (708) 456-9962");
	$("#Cell_Phone").focus(function(){
		$(this).removeClass("indexCaptureCPGrey");
		if($(this).val()=="e.g. (708) 456-9962"){
			$(this).val("");
		}
	});
	$("#Cell_Phone").blur(function(){
		if($(this).val().trim()==""){
			$(this).addClass("indexCaptureCPGrey").val("e.g. (708) 456-9962");
		}
	});
	$("#indexBig").cycle({
		fx:    "fade", 
		speed:  5000 
	});
	$("#Cell_Phone").keypress(function(){
		var theNum=$(this).val().trim();
		if(theNum=="1"){
			$(this).val("(");
		} else {
			if(event.shiftKey==0 && event.keyCode!=45){
				switch(theNum.length){
					case 1:
						if(theNum.substring(0,1)!=="("){
							$(this).val("("+theNum);
						}
						break;
					case 4:
						if(theNum.substring(0,4)!=")"){
							$(this).val(theNum+") ");
						}
						break;
					case 9:
						if(theNum.substring(0,9)!="-"){
							$(this).val(theNum+"-");
						}
						break;
				}
			}
		}
	});
	$("#sendText").click(function(){
		var thePhone=$("#Cell_Phone").val().trim();
		if(thePhone.length>8){
			return true;
		} else {
			return false;
		}
	});
});
