function isEmail(s){
	if (s.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]{2,4}$/) != -1)
		return true;
	return false;
}

function isNumber(s) {
	if (s.search(/^\d+$/) != -1)
		return true;
	return false;
}

function isPhone(s) {
	if (s.search(/^[ .0-9]{3,}$/) != -1)
		return true;
	return false;
}

function isDate(s) {
	if (s.search(/^([0]?[1-9]|[1|2][0-9]|[3][0|1])[.\/-]([0]?[1-9]|[1][0-2])[.\/-]([0-9]{4}|[0-9]{2})$/) != -1)
		return true;
	return false;
}

function trim(s) {
	return s.replace(/^\s+/g, '').replace(/\s+$/g, '');
}

function isBlank(s) {
	if(trim(s) == "") 
		return true;
	return false;
}

function isMinLength(s, n) {
	if(trim(s).length >= n) 
		return true;
	return false;
}

function isSelected(comboObject) {
	if ($(comboObject).selectedIndex != 0)
		return true;
	return false;
}

function isBoxChecked(checkBoxObject) {
	return $(checkBoxObject).checked;
}

function isRadioChecked(radioGroup) {
	var forms = $$("input");
	var checked = false;
	forms.each(function(item){
		if (item.type == "radio" && item.name == radioGroup) {
			if (item.checked) checked = true;
		}
	});
	return checked;
}

function valid(formElement, condition, alertString) {
	if (!condition) {
		$(formElement).setStyles({backgroundColor: "#F9CC00"});
		$(formElement).onfocus = function(){
			alertTips.show(alertString, this);
		}
		$(formElement).onblur = function(){
			$(this).setStyles({backgroundColor: ""});
			$(this).onfocus = null;
		}
		return false;
	}
	return true;
}


var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos)
{
	if (mypage!="")
	{
		if(pos=="random") {
			LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;
			TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;
		}

		if(pos=="center") {
			LeftPosition=(screen.width)?(screen.width-w)/2:100;
			TopPosition=(screen.height)?(screen.height-h)/2:100;
		}
		else if((pos!="center" && pos!="random") || pos==null) {
				LeftPosition=0;TopPosition=0
		}
		settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';
		myname1 = myname + Math.round(1099999999*Math.random());
		win=window.open(mypage,myname1,settings);
	}
}

function CheckAvailabilityUsername(value)
{
	var url = "availability.aspx?username="+value;
	var rtnValue = new Array();
	var Left_Position = (screen.width) ? (screen.width-450)/2 : 0;
	var Top_Position = (screen.height) ? (screen.height-250)/2 : 0;
	var opt = 'toolbar=0, menubar=0, location=0, resizable=1, scrollbars=1, width=450, height=250, left=' + Left_Position + ', top=' + Top_Position;
	var wChild = window.open(url, "wChild", opt);
	wChild.focus();
}

function GetReturnValue(name)
{
    var b_Name = eval("window.opener.document.aspnetForm.ctl00_ContentPlaceHolder1_UserName");

    if (window.opener && !window.opener.closed)
    {
        b_Name.value = name;
        window.focus();
        window.close();
    }
}