    var _ErrorMessage = "JavascriptError: \n\tFile:\n\t\t{0} \n\tFunction:\n\t\t{1} \n\tError Message:\n\t\t {2}";

	//DEFAULT
	eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1;};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p;}('(3($){$.a.b=3(){2 7=6;2 9=c;2 i=0;d(7.g(3(){2 1=$(6);2 5=9[i++];1.4(5).f(3(){8(1.4()==5){1.4("")}1.e(3(){8(1.4()==""){1.4(5)}})})}))}})(h)',19,19,'|textbox|var|function|val|defaultValue|this|textboxes|if|args|fn|DefaultText|arguments|return|blur|focus|each|jQuery|'.split('|'),0,{}));
	
	
    /// <summary>
    /// Throw the exception formated for the user
    /// </summary>
    function ShowException(file,fcn,msg)
    {
        alert(_ErrorMessage.toString().replace('{0}',file).replace('{1}',fcn).replace('{2}',msg));
    }
    
    /// <summary>
    /// Adjust the page layout, called every request
    /// </summary>
    function AdjustLayout()
    {
        try
        {
			if (!($.browser.msie && $.browser.version == '6.0')) {
				AdjustGalleryLightBox();
			}
			AdjustCycle();
			AdjustToolTip();
			AdjustConfirmButton();
			AdjustInputFocus();
			AdjustShadow();
			AdjustDefault();
			AdjustHover();
			$('.Atria_BaseEadControl_Surveys_Survey_ResultBar').each(function() {
				$(this).css('width',$(this).html().replace(',','.') + '%');
				$(this).html('&nbsp;');
			});
		}
        catch(ex)
        {
            ShowException('Portal.js','AdjustLayout();',ex.message);
        }
    }

    function AdjustShadow()
	{
		$('.UserLogin_CellButton>input', $('.Container_Top_Right_Content_Form')).val('');
		$('.UserLogin_CellInput>input', $('.Container_Top_Right_Content_Form')).attr('class', 'text ui-widget-content');
	}
	
	function AdjustHover()
	{
		try {
			$('#contatoNome').DefaultText("Nome");
			$('#contatoEmail').DefaultText("Email");
			$('#ctl15_txtUserName').DefaultText("CPF");
			$('#ctl15_txtPassword').DefaultText("Senha");
		} catch(ex)
		{
		}
	}
	
    /// <summary>
    /// Adjust the gallery lightbox plugin
    /// </summary>
    function AdjustGalleryLightBox()
    {
        try
        {
			//$('.VeloparkBodyContent_InternalRow_Col2_Col1_Text_fotos_item > a > img').lightbox();
		}
		catch(ex)
		{
            ShowException('Portal.js','AdjustGalleryLightBox();',ex.message);
		}
	}
	
	
    /// <summary>
    /// Adjust the cycle plugin
    /// </summary>
    function AdjustCycle()
    {
        try
        {
		}
		catch(ex)
		{
            ShowException('Portal.js','AdjustCycle();',ex.message);
		}
	}
	
	/// <summary>
    /// Display a confirm message in all delete buttons
    /// </summary>
    function AdjustConfirmButton()
    {
        try
        {
            //bind the click function with the oldhref attr value
            $('.ConfirmButton').bind('click', function(){
            
                var button = $(this);
                var text = button.attr('ConfirmText') == undefined ? 'Confirm delete?' : button.attr('ConfirmText');
                var ok = button.attr('ConfirmTextOk') == undefined ? 'Yes' : button.attr('ConfirmTextOk');
                var cancel = button.attr('ConfirmTextCancel') == undefined ? 'No' : button.attr('ConfirmTextCancel');
               
                $.prompt(
                    text,
                    { 
                        buttons: { Ok: ok, Cancel: cancel }, 
                        zIndex: 99999999,
                        focus: 1, 
                            prefix:'Atria_Global_Warning',   
                        callback : function(v,m) { 
                            if (v == ok) { 
                                eval(button.attr('oldhref').substring(11)); 
                            } 
                        }
                    }
                );
            });
            
            //remove href and puts in the oldhref
            $('.ConfirmButton').each(function(){
                    $(this).attr('oldhref',$(this).attr('href'));
            });
                
            //clear href
            $('.ConfirmButton').attr('href','#');

            //make confirm required
        }
        catch(ex)
        {
            ShowException('Atria.Base.js', 'AdjustConfirmButton();', ex.message);
        }
    }

    /// <summary>
    /// Adjust the tool tip plugin
    /// </summary>
    function AdjustToolTip()
    {
        try
        {
			$('[title]').tooltip({fade: false,showURL: false,track: true});
        }
        catch(ex)
        {
            //ShowException('Atria.Base.js', 'AdjustToolTip();', ex.message);
        }
    }

    /// <summary>
    /// Change the inputs border on focus
    /// </summary>
    function AdjustInputFocus() 
    { 
        try
        {
			$('.uibutton').hover(function () {
				$(this).removeClass('ui-state-default').addClass('ui-state-hover');
			}, function () {
				$(this).removeClass('ui-state-hover').addClass('ui-state-default');
			});
        }
        catch(ex)
        {
            ShowException('Atria.Base.js','AdjustInputFocus();',ex.message);
        }
    }
	
	
    /// <summary>
    /// Logout the user
    /// </summary>
    function ApiBminds_Atria_LogoutUser()
    {
        $.getScript('/Services/User/Logout.aspx');
    }
	
	
		
	/// <summary>
	/// Adjust menu
	/// </summary>
	function AdjustDefault()
	{
		try
		{
			$('.HasDefaultValue').each(function(){
				$(this).DefaultText($(this).attr('defaultvalue'));
			});
		}
		catch(ex)
		{
			ShowException('Portal.js','AdjustDefault();',ex.message);
		}
	}
