//var patt =/http:\/\/(www\.|[a-z]{2}\.)?youtube\.com\/watch\?v=([^&]+)/;
var patt = "(^www+[.]+youtube.com/watch\\?v=[a-zA-Z0-9-]{11})|(^http://www+[.]+youtube.com/watch\\?v=[a-zA-Z0-9-]{11})|(^http://youtube.com/watch\\?v=[a-zA-Z0-9-]{11})|(^youtube.com/watch\\?v=[a-zA-Z0-9-]{11})";

function getScrollXY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return [ scrOfX, scrOfY ];
}

var chk = new RegExp(patt);
function checkLoginHeader()
{	
	var username	=	document.getElementById("hdr_username").value;
	var password	=	document.getElementById("hdr_password").value;
	
	if(username=="")
	{	
		document.getElementById('hdr_error').innerHTML	="Please Enter Username and Password";	//messages.vars.login_fillallfields;
		return false;
	}
	else if(!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(username))
	{
		document.getElementById("hdr_error").innerHTML="Username should be in valid Email format";
		return false;
	}
	else if(password=="")
	{
		document.getElementById('hdr_error').innerHTML	="Password should not be blank";//	messages.vars.login_passwordblank;
		return false;
	}
	else if(/\s/.test(password))
	{
		document.getElementById("hdr_error").innerHTML	="Password should not cantain spaces";//	messages.vars.login_password_space;
		return false;
	}
	else if(password.length<6)
	{
		document.getElementById('hdr_error').innerHTML	="Password should be atlease six characters Long";//	messages.vars.login_passwordlength;
		return false;	
	}
	else
	{
		return true;
	}
}	

function scrollToTop()
{
	if ( document.documentElement && document.documentElement.scrollTop )
	{
		document.documentElement.scrollTop = 0;
	}
	else if ( document.body )
	{
		document.body.scrollTop = 0;
	}
}


function communitypostingmsg()
{
	alert("You can't post since you don't belong to this community");
	return;
}

function activemsg()
{
	alert('Please verify your account.');
	return;
}
function gotoLogin()
{
	alert("Please first login to post");
	return false;
	//document.location.href=webURL+'/registration' ;
}
function cantEdit()
{
	alert("You can't edit/cancel since you don't belong to this community");
	return
}
function expiredEvent()
{
	alert("This event has expired");
	return
}
function expiredActivity()
{
	alert("This activity has expired");
	return
}
function cantAttendEvent()
{
	alert("You can't attend this event since you did not belong to this  community");
	return false;
}
function Login()
{
	alert("You are not logged in.");
}
function cantVote()
{
	alert("You can't vote on your own share");
}