﻿template = "#ctl00_ctl00_MainContent_SubMainContent_";

function CheckNumbers() {
    if (event.keyCode < 48 || event.keyCode > 57)
        event.returnValue = false;
}

function AjaxCheckEmail(projId, email)
{
    $.get('ajaxCheck.aspx?type=1&projId=' + projId + '&email=' + email.value, function(data){
        $('#statusEmail').html(data);
    });
}

function AjaxCheckUsername(username)
{
    $.get('../ajaxCheck.aspx?type=2&username=' + username.value, function(data){
        
        $('#statusUsername').html(data);
    });
}

function CloseAllWarning()
{
    $.validationEngine.closePrompt('.formError',true);
}


$().ready(function() {
	$("#aspnetForm").validationEngine()
});

function SetTextBox(idTmp,txtTmp)
{
    status = $(template + 'hdnStatus').val();
    id = idTmp.split('/!/');
    txt = txtTmp.split('/!/');
    if(status != 1) {
        for(i=0;i<id.length-1;i++)    {
            $(document).ready(function(){ $('#txtOther' + id[i]).val(txt[i]); });
        }
        $(template+'hdnStatus').val('1');
    }
}

function ChangeLanguage(lang)
{
    var path = window.location + '';
    //path = path.replace(/&lang=en/g,"");
    path = path.replace(/&lang=en/g, "");
    path = path.replace(/&lang=th/g, "");
    path = path.replace(/#/g, "");
    url = path + "&lang=" + lang;
    window.location = url;
}



function Confirm()
{
     $(template+'btnNext2').click(function(e) {
        //e.preventDefault();
        //var targetUrl = $(this).attr("href");

        $('#dialog-confirm').dialog({
          buttons : {
            "Confirm" : function() {
              return true;
            },
            "Cancel" : function() {
              $(this).dialog("close");
            }
          }
        });

        //$("#dialog").dialog("open");
      });

    //return confirm('OnClientClick script: Press OK to continue.');

    //$().ready(function() {
	        /*$("#dialog-confirm").dialog({
		        resizable: false,
		        height:150,
		        //modal: true,
		        buttons: {
			        'Delete all items': function() {
				        $(this).dialog('close');
				        return false;
			        },
			        Cancel: function() {
				        $(this).dialog('close');
				        return false;
			        }
		        }
	        });*/
    //});
    /*$().ready(function() {
        $('#demo').click(
        function() {

	        $("#dialog-confirm").dialog({
		        resizable: false,
		        height:150,
		        modal: true,
		        buttons: {
			        'Delete all items': function() {
				        $(this).dialog('close');
			        },
			        Cancel: function() {
				        $(this).dialog('close');
			        }
		        }
	        });
        });
    });*/
}
/*
$('#demo').click(
    
    function() {

	    $("#dialog-confirm").dialog({
		    resizable: false,
		    height:140,
		    modal: true,
		    buttons: {
			    'Delete all items': function() {
				    $(this).dialog('close');
			    },
			    Cancel: function() {
				    $(this).dialog('close');
			    }
		    }
	    });
});*/

