<!--
/*function checkMail(mailAddress)
{
 var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
 if (filter.test(mailAddress)) return true;
 else return false;
}*/

function checkMail(mail) 
{
	var goodEmail = mail.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
	if (goodEmail)
		return true;
	else
		return false;
}

function openIdCard(root, id)
{
 	
 	neu = open(root + 'pages/community/popup/id_card.php?user_id='+id, 'id_card', 'width=' + 700 + ',height=' + 460);
}

function sendNewMsg(root, msg_dest)
{
	
    var browserWidth     = (isNaN(window.screen.width))  ? 800 : window.screen.width;  // Default browser width
    var browserHeight    = (isNaN(window.screen.height)) ? 600 : window.screen.height; // Default browser height
        
    var popupWidth       =  400;  // Default popup width
    var popupHeight      =  430;  // Default popup height
    
 	var leftPosition     =  Math.ceil((browserWidth  - popupWidth)/2); // Default left offset
	var topPosition      =  Math.ceil((browserHeight - popupHeight)/2)-15;  // Default top  offset
		
 	var leftPosition     =  Math.ceil((browserWidth  - popupWidth)/2); // Default left offset
	var topPosition      =  Math.ceil((browserHeight - popupHeight)/2)-15;  // Default top  offset
		
	neu = open(root + 'pages/community/popup/write_msg.php?msg_dest='+msg_dest, 'pop_msg', 'width=' + popupWidth + ',height=' + popupHeight + ',top=' + topPosition+',left=' + leftPosition);
}

function invfriends(root)
{
	
    var browserWidth     = (isNaN(window.screen.width))  ? 800 : window.screen.width;  // Default browser width
    var browserHeight    = (isNaN(window.screen.height)) ? 600 : window.screen.height; // Default browser height
        
    var popupWidth       =  400;  // Default popup width
    var popupHeight      =  300;  // Default popup height
    
 	var leftPosition     =  Math.ceil((browserWidth  - popupWidth)/2); // Default left offset
	var topPosition      =  Math.ceil((browserHeight - popupHeight)/2)-15;  // Default top  offset
		
 	var leftPosition     =  Math.ceil((browserWidth  - popupWidth)/2); // Default left offset
	var topPosition      =  Math.ceil((browserHeight - popupHeight)/2)-15;  // Default top  offset
		
	neu = open(root + 'pages/community/popup/invite_friends.php', 'pop_msg', 'width=' + popupWidth + ',height=' + popupHeight + ',top=' + topPosition+',left=' + leftPosition);
}

function readReceivedMsg(root, msg_id)
{
    var browserWidth     = (isNaN(window.screen.width))  ? 800 : window.screen.width;  // Default browser width
    var browserHeight    = (isNaN(window.screen.height)) ? 600 : window.screen.height; // Default browser height

    var popupWidth       =  400;  // Default popup width
    var popupHeight      =  430;  // Default popup height

 	var leftPosition     =  Math.ceil((browserWidth  - popupWidth)/2); // Default left offset
	var topPosition      =  Math.ceil((browserHeight - popupHeight)/2)-15;  // Default top  offset

 	var leftPosition     =  Math.ceil((browserWidth  - popupWidth)/2); // Default left offset
	var topPosition      =  Math.ceil((browserHeight - popupHeight)/2)-15;  // Default top  offset
	
	neu = open(root + 'pages/community/popup/read_receivedmsg.php?msg_id='+msg_id, 'pop_msg', 'width=' + popupWidth + ',height=' + popupHeight + ',top=' + topPosition+',left=' + leftPosition);
}

function readSentMsg(root, msg_id)
{

    var browserWidth     = (isNaN(window.screen.width))  ? 800 : window.screen.width;  // Default browser width
    var browserHeight    = (isNaN(window.screen.height)) ? 600 : window.screen.height; // Default browser height

    var popupWidth       =  400;  // Default popup width
    var popupHeight      =  430;  // Default popup height

 	var leftPosition     =  Math.ceil((browserWidth  - popupWidth)/2); // Default left offset
	var topPosition      =  Math.ceil((browserHeight - popupHeight)/2)-15;  // Default top  offset

 	var leftPosition     =  Math.ceil((browserWidth  - popupWidth)/2); // Default left offset
	var topPosition      =  Math.ceil((browserHeight - popupHeight)/2)-15;  // Default top  offset
	
	neu = open(root + 'pages/community/popup/read_sentmsg.php?msg_id='+msg_id, 'pop_msg', 'width=' + popupWidth + ',height=' + popupHeight + ',top=' + topPosition+',left=' + leftPosition);
}

function loadUserProfile(root, category, userid)
{
	if (userid != "")
	{
		window.parent.location.href  = root + 'pages/community/user/' +category+ '/index.php?user_id='+userid;
	}
}	
function searchContent(root, obj)
{
	window.location = root + 'pages/find/index.php?search_keyword='+obj.value;
}	


function showImage (url)
{
	var img = new Image();
	img.onload = openImageWin;
	img.src = url;
}
	function openImageWin ()
 {
		    var browserWidth     = (isNaN(window.screen.width))  ? 800 : window.screen.width;  // Default browser width
	        var browserHeight    = (isNaN(window.screen.height)) ? 600 : window.screen.height; // Default browser height


	        var popupWidth       =  this.width + 25;  // Default popup width
	        var popupHeight      =  this.height + 25;  // Default popup height

		 	var leftPosition     =  Math.ceil((browserWidth  - popupWidth)/2); // Default left offset
			var topPosition      =  Math.ceil((browserHeight - popupHeight)/2)-15;  // Default top  offset

			var handler = open(this.src, '_blank', 'width=' + popupWidth + ',height=' + popupHeight + ',top=' + topPosition+',left=' + leftPosition);
			
}

function fastlogin_submitForm()
		{

			document.community_login.submit();
		}

//-->

