	function echeckEvent(str) {

		var at="@";
		var dot=".";
		var lat=str.indexOf(at);
		var lstr=(str.length-1);
		var ldot=str.indexOf(dot);
		var alertStr = "";
		var plusmin = "±";
		
		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.lastIndexOf(at)==lstr){
			return false;
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.lastIndexOf(dot)==lstr){
			return false;
		}

		if (str.indexOf("_")==0 || str.lastIndexOf("_")==lstr){
			return false;
		}

		if (str.indexOf("-")==0 || str.lastIndexOf("-")==lstr){
			return false;
		}

		if (str.indexOf(at,(lat+1))!=-1){
			return false;
		}
		
		if (str.substring(lat,(lat+1))==dot || str.substring((lat+1),(lat+2))==dot){
			return false;
		}

		if (str.indexOf(dot,(lat+2))==-1){
			return false;
		}

		if (str.indexOf(" ")!=-1){
			return false;
		}

		if (!(str.indexOf(plusmin)==-1)){
			return false;
		}

		if (!(str.indexOf(":")==-1)){
			return false;
		}

		if (!(str.indexOf(",")==-1)){
			return false;
		}
		for (var i=0; i<(str.length-1); i++){
			ch = str.charAt(i);
			ch1 = str.charAt(i+1);
			if (ch==ch1 && ch=='.'){
				return false;
			}
		}
		return true;					
	}

	function chkSpecialCharMailEvent(formelementvalue, mChar){
		var alertStr="";
		var msg='true';
		var a=formelementvalue;
		var b=a.length;
		var ch=mChar.length;
		var i,j;
		for(i=0;i<ch;i++){
			var ch1=mChar.substring(i,i+1);
			for(j=0;j<b;j++){
				var a1=a.substring(j,j+1);
				if(a1==ch1){
					msg='false';
					return false;
				}
			}
		}
		if (msg=='true'){
			return true;
		}

	}

	function checkEventEmail(formelementvalue){

		if(!chkSpecialCharMailEvent(formelementvalue, '`~!#$%^&()[]{}|;,+<>*')){
			return false;
		}
		if (echeckEvent(formelementvalue)==false){
			return false;
		}
		return true;
	 }

	var ie4 = (document.all) ? true : false;
	var ns4 = (document.layers) ? true : false;
	var ns6 = (document.getElementById && !document.all) ? true : false;
	
	
	function hidelayer(lay) {
		if (ie4) {document.all[lay].style.display = "none";}
		if (ns4) {document.layers[lay].visibility = "hide";}
		if (ns6) {document.getElementById([lay]).style.display = "none";}
	}
	function showlayer(lay) {
		if (ie4) {document.all[lay].style.display = "block";}
		if (ns4) {document.layers[lay].visibility = "show";}
		if (ns6) {document.getElementById([lay]).style.display = "block";}
	}
	function beginHideShowLayer()
	{
		var undefined;
		var regBkStatus = eval("document.forms[0].regCreateUpdate");
		if(regBkStatus!=undefined)
		{
			if(document.forms[0].regCreateUpdate[0].checked)
				showlayer('spnVisible');
			else
				hidelayer('spnVisible');
		}
		else
			showlayer('spnVisible');
	}
	function validate()
	{
		var undefined;
		var str = eval("document.forms[0].emailEntered.value");
		var regTypeFormat = eval("document.forms[0].regFormat");//eval("document.forms[0].elements['registrationTypeList[0].format']");
		var invitationCode = eval("document.forms[0].invitationCode");
		var attCurrId = eval("document.forms[0].attCurrId");
		var regBkStatus = eval("document.forms[0].regCreateUpdate");
		
		if(str!=undefined)
		{
			if(trim(str) == '')
			{
				alert("You have not entered Email Address.\nPlease enter a valid Email Address in Event Details section.")
				document.forms[0].emailEntered.focus();
				return false;
			}
			if(str.length < 6 )
			{
				alert("Email Address you have provided is not correct.\nPlease ensure that the Email Address should contain minimum 6 characters.")
				document.forms[0].emailEntered.focus();
				return false;
			}
			if(str.length > 70 )
			{
				alert("Email Address you have provided is not correct.\nPlease ensure that the Email Address does not exceed maximum 70 characters.")
				document.forms[0].emailEntered.focus();
				return false;
			}
			if(!checkEventEmail(str))
			{ 
				alert("Email Address you have provided is not correct.\nPlease ensure that Email Address is in proper format like myname@myaddress.com ");
				document.forms[0].emailEntered.focus();
				return false;
			}
		}
		
		if(invitationCode!=undefined)
		{
			if(trim(invitationCode.value) == '')
			{
				alert("You have not entered Invitation Code.\nPlease enter a valid Invitation Code in Event Details section.")
				invitationCode.focus();
				return false;
			}
		}
		if(regBkStatus!=undefined && regBkStatus[0].checked)
		{
			if(attCurrId!=undefined && attCurrId.value == '')
			{
				alert("You have not selected Transaction Currency.\nPlease select atleast one Transaction currency from the Event Details Section.");
				attCurrId.focus();
				return false;
			}
			if(regTypeFormat!=undefined)
			{
				if(regTypeFormat.value=='2')
				{
					if(document.forms[0].regTypeId.value=='')
					{
						alert("You have not selected Registration Type.\nPlease select atleast one Registration Type from the Event Details section.");
						document.forms[0].regTypeId.focus();
						return false;
					}
				}
				if(regTypeFormat.value=='3')
				{
					var size = document.forms[0].regTypeId.length;
					if(size > 1 )
					{
						for (var count=0;count < size;count++)
						{
							if(document.forms[0].regTypeId[count].checked)
								break;
						}
						if(count >= size)
						{
							alert("You have not selected Registration Type.\nPlease select atleast one Registration Type from the Event Details section.");
							return false;
						}
					}
					else
					{
						if(!document.forms[0].regTypeId.checked)
						{
							alert("You have not selected Registration Type.\nPlease select atleast one Registration Type from the Event Details section.");
							return false;
						}
					}
				}
			}
		}

		return true;

	}
	function loginAttendee()
	{
		if(validate())
		{
			document.forms[0].action="attPasswordCheck.do";
			document.forms[0].submit();
		}
	}	
	function loginAttendeeSubmit()
	{
		if(validate())
			return true;
		else
			return false;
	}

	function ClearTheOtherField( obj )
	{
		var txtField = eval("document.forms[0]."+obj+".value");

		if(txtField!="")
		{
			if( obj == "emailEntered")
			{
				document.forms[0].membershipIdEntered.value = "";
			}
			else if(obj == "membershipIdEntered")
			{
				document.forms[0].emailEntered.value = "";

			}
		}		
	}
	function loadAddInfo(regTypeId)
	{
		var h=250;
		var w=550;
		var scroll="yes";
		var winl = (screen.width - w) / 2;
		var wint = (screen.height - h) / 4;
		winprops = 'standard, height=' + h + ',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll;
		document.forms[0].command.value = "GoToRegTypeAddInfo";
		document.forms[0].addInfoId.value = regTypeId;
		win = window.open('','win',winprops)
		document.forms[0].target = "win"
		document.forms[0].action="attRegAddInfo.do";
		document.forms[0].submit();
		document.forms[0].target = "_self"
	}
	
	function loadContactInfo()
	{
		var h=250;
		var w=350;
		var scroll="yes";
		var winl = (screen.width - w) / 2;
		var wint = (screen.height - h) / 4;
		winprops = 'standard, height=' + h + ',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll;
		document.forms[0].command.value = "GoToEventContactInfo";
		win = window.open('','win',winprops)
		document.forms[0].target = "win"
		document.forms[0].action="attRegAddInfo.do";
		document.forms[0].submit();
		document.forms[0].target = "_self"
	}
	
	function loadGroupAddInfo()
	{
		var h=250;
		var w=550;
		var scroll="yes";
		var winl = (screen.width - w) / 2;
		var wint = (screen.height - h) / 4;
		winprops = 'standard, height=' + h + ',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll;
		document.forms[0].command.value = "GoToEventGroupInfo";
		win = window.open('','win',winprops)
		document.forms[0].target = "win"
		document.forms[0].action="attRegAddInfo.do";
		document.forms[0].submit();
		document.forms[0].target = "_self"
	}

	function loadEventInfo()
	{
		var h=250;
		var w=600;
		var scroll="yes";
		var winl = (screen.width - w) / 2;
		var wint = (screen.height - h) / 4;
		winprops = 'standard, height=' + h + ',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll;
		document.forms[0].command.value = "GoToSurveyInfo";
		win = window.open('','win',winprops)
		document.forms[0].target = "win"
		document.forms[0].action="attRegAddInfo.do";
		document.forms[0].submit();
		document.forms[0].target = "_self"
	}
	
	function loadEventSummaryInfo(evtId)
	{
		var h = (screen.height - 150);
		var w = (screen.width * (2/3));
		var scroll="yes";
		var winl = (screen.width - w) / 2;
		var wint = 40;
		winprops = 'standard, height=' + h + ',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable';
		win = window.open('attRegEvtDetails.do?eventId='+evtId,'win',winprops)
		document.forms[0].target = "win"
		document.forms[0].target = "_self"
	}
