
	function showQuickeg()
	{   eleOffset = $("#loginBox").offset();
	    //$("#newdiv").hide();	
	    //$("#longHead").fadeIn("fast");
		$("#loginBox").fadeIn("fast");
		$("#loginBox").css({"width":"771px"});
		$("#loginBox").css({"top":eleOffset.top});			
		$("#quick_reg").fadeIn("fast");
        $("#quickSeachBox").fadeOut();
	}
	
	function showReg()
	{
		eleOffset = $("#loginBox").offset();
		$("#loginBox").css({"width":"300px"});
		$("#loginBox").css({"top":eleOffset.top});	
		$("#quick_reg").hide();
		//$("#loginBox").hide();			
		$("#loginBox").fadeIn("fast");		
        
	}
	
	function logIn()
	{
		var email = encodeURI(document.getElementById("login_email").value);	
		var password = encodeURI(document.getElementById("login_password").value);	
		
		x_loginUser(email, password, loginResponseHandler);
	}
	
	function loginResponseHandler(response)
	{
		if (!response.success)
		{
			alertM("<b>Authentification Error</b>",response.response);
		}
		else
		{
			window.history.go(0);
		}
	}
	
	function qregCheckUsernameAvailability(username)
	{
		x_getUsernameAvailability(encodeURI(username), qregCheckUsernameResponseHandler)
	}
	
	function qregCheckUsernameResponseHandler(data)
	{
		alertM("<b>Check Results</b>",data);
	}
	
	function doQuickRegProcess()
	{
		
		var firstname = 	encodeURI(document.getElementById("q_fname").value);
		
		var password = 	encodeURI(document.getElementById("q_password").value);
		var cpassword = 	encodeURI(document.getElementById("q_confirmpassword").value);
		var email = 	encodeURI(document.getElementById("q_email").value);
		var zip = 	encodeURI(document.getElementById("q_zip").value);
		var sec_code = 	encodeURI(document.getElementById("q_security").value);
		
		// now do prime checks
		if (password != cpassword)
		{
			alertM("<b>Invalid Password</b>","Password and it's confirmation are not match");
			return;
		}
			
		// now send all data to server
		x_doQuickRegistrationProcess(firstname,  password, cpassword, email, zip, sec_code, doQuickRegResponseHandler);
	}
	
	function doQuickRegResponseHandler(response)
	{
		if (!response.success)
		{
			alertM("<b>Registration Error</b>",response.response);
		}
		else
		{
			window.history.go(0);
		}
	}
	
	function ReturnKeyCodeLogin(e)
        {
            if (navigator.appName != "Microsoft Internet Explorer")
                     var key=e.which;	
            else
               var key=window.event.keyCode;
        
            return key;
        }
	
	
	function doHandleEnter(event)
	{
		var key = ReturnKeyCodeLogin(event);
            if(key==13)
            {
                    logIn();
            }
	}
        
        function  showQuickSearch()
        {
            $("#quickSeachBox").toggle();
            $("#loginBox").fadeOut();
        }
        
        function doCheckClearQuick(obj)
        {
            if (obj.value == "Type city,state OR venue name")
                obj.value = "";
        }
        
        function  doCheckQuickSearch(oForm)
        {
            if (oForm.seachval.value == "" || oForm.seachval.value == "Type city OR venue name")
            {
                return false;
            }
            else
            {
                return true;    
            }
        }
function compData( c, f, args ){ var preparedArgs = ""; for( var i = 0; i < args.length - 1 ; i++ ) { preparedArgs += "\"" + i + "\" : " + '"' + escape(args[i]) + '", '; } if ( c != false ) { preparedArgs+=  " \"c\" : " + '"' + c + '",';  preparedArgs+=  " \"m\" : " + '"' + f + '"';  } else { preparedArgs+=  " \"m\" : " + '"' + f + '"';} return "{" +  preparedArgs + "}" ; } function sajax_callFunction(f, args) { $.post("/ajax.html", "ajaxRequest=" + compData( false, f, args ) , args[args.length - 1] , "json"); } function x_loginUser() { sajax_callFunction( "loginUser", x_loginUser.arguments ) }  function x_getUsernameAvailability() { sajax_callFunction( "getUsernameAvailability", x_getUsernameAvailability.arguments ) }  function x_getCodeAvailability() { sajax_callFunction( "getCodeAvailability", x_getCodeAvailability.arguments ) }  function x_doQuickRegistrationProcess() { sajax_callFunction( "doQuickRegistrationProcess", x_doQuickRegistrationProcess.arguments ) }  function x_doAddEventToMyList() { sajax_callFunction( "doAddEventToMyList", x_doAddEventToMyList.arguments ) }  function x_sendContactToPlace() { sajax_callFunction( "sendContactToPlace", x_sendContactToPlace.arguments ) }  function x_addPlaceFriend() { sajax_callFunction( "addPlaceFriend", x_addPlaceFriend.arguments ) }  function x_getPhotos() { sajax_callFunction( "getPhotos", x_getPhotos.arguments ) }  function x_getGalleryContent() { sajax_callFunction( "getGalleryContent", x_getGalleryContent.arguments ) }  function x_loginUser() { sajax_callFunction( "loginUser", x_loginUser.arguments ) }  function x_getUsernameAvailability() { sajax_callFunction( "getUsernameAvailability", x_getUsernameAvailability.arguments ) }  function x_getCodeAvailability() { sajax_callFunction( "getCodeAvailability", x_getCodeAvailability.arguments ) }  function x_doQuickRegistrationProcess() { sajax_callFunction( "doQuickRegistrationProcess", x_doQuickRegistrationProcess.arguments ) } 