function CheckEmail(str) {
	validemail=0;
	var checkStr = str;
	for (i = 0; i < checkStr.length; i++){
		if(checkStr.charAt(i)=="@")
			validemail |= 1;
		if(checkStr.charAt(i)==".")
			validemail |= 2;
	}
	if(validemail != 3){
		return false;
	}
	else {
		return true;
	}
}
function NotArabic(str) {
	var arabic = true;
	for(i=0;i<str.length;i++) {
		//alert(str.charCodeAt(i));
		if(
		(str.charCodeAt(i)>=48 && str.charCodeAt(i)<=57) || // number
		(str.charCodeAt(i)>=65 && str.charCodeAt(i)<=90) || // A-Z
		(str.charCodeAt(i)>=97 && str.charCodeAt(i)<=122) // a-z
		) {
			//alert(str.charCodeAt(i));
			arabic = false;
			break;
		}
	}
	
	return arabic;
}

function onAnimate(show) {
	//$(this).fadeIn('slow').show();
	if (show) {
		$(this)
			.css('visibility', 'hidden').show()
				.css('width', $(this).innerWidth())
			.hide().css('visibility', 'visible')
		.fadeIn('normal');
	} else {
		$(this).fadeOut('fast');
	}
}

var MENU_COUNTER = 1;
function loadMenu() {
	if (this.id == 'dynamicMenu') {
		$('> ul > li', this).remove();

		var ul = $('<ul></ul>');
		var t = MENU_COUNTER + 10;
		for (; MENU_COUNTER < t; MENU_COUNTER++) {
			$('> ul', this).append('<li>Item ' + MENU_COUNTER + '</li>');
		}
	}
}

function unloadMenu() {
	if (MENU_COUNTER >= 30) {
		MENU_COUNTER = 1;
	}
}

// We're passed a UL
function onHideCheckMenu() {
	return !$(this).parent().is('.LOCKED');
}

// We're passed a LI
function onClickMenu() {
	$(this).toggleClass('LOCKED');
	return true;
}
