<?xml version="1.0" encoding="UTF-8"?>
<Module>
    <ModulePrefs title="wizQ">
        <Require feature="opensocial-0.8" />
        <Require feature="dynamic-height" />
        <Require feature="views"/>
        <Require feature="flash" />
        <Require feature="hangame"/>
    </ModulePrefs>
    <Content type="html" view="canvas"><![CDATA[

                    <script crossorigin type="module" src="https://api.jp.dev.wizq.net/v2/build/assets/notice-BRfeVop3.js"></script>
            <script crossorigin type="module" src="https://api.jp.dev.wizq.net/v2/build/assets/xsell-nExZg0YY.js"></script>
            <script>
                wizqConfig = {};
                wizqConfig.versionNumber = '2.0.0';
                wizqConfig.appID = 'O_TZN';
                wizqConfig.projectID = '749';
                wizqConfig.handlePaymentURL = 'http\u003A\/\/api.jp.dev.wizq.net\/payment\/hangame\/paymentServerRequestHandler.php';
                wizqConfig.apiRequestHandler = 'http\u003A\/\/api.jp.dev.wizq.net\/api\/hangame\/apiRequest.php';
                wizqConfig.apiRequestResponseType = 'json';
                wizqConfig.apiRequestVersionNumber = '1.0';
                wizqConfig.paymentApiRequestHandler = 'http\u003A\/\/api.jp.dev.wizq.net\/payment\/hangame\/paymentApiRequest.php';
            </script>
            <script src="http://api.jp.dev.wizq.net//static/canvas/hangame/js/2.0.0/wizq.min.js"></script>
                <div class="wizq-scope">
            <div id="wizq-xsell" data-project-id="908" data-xsell-base-url="https://api.jp.dev.wizq.net/v2/xsell" data-xsell-img-root="https://common.wizq.com/xsell/img/" data-css="https://api.jp.dev.wizq.net/v2/build/assets/xsell-BBCMJheL.css"></div>
        </div>
        <link rel="stylesheet" type="text/css" href="https://dev.wizq.net/sampleApp/hangame/css/sampleApp.css">
<link rel="stylesheet" type="text/css" href="https://dev.wizq.net/sampleApp/hangame/css/ui.jqgrid.css">
<link rel="stylesheet" type="text/css" href="https://dev.wizq.net/sampleApp/hangame/css/custom-theme/jquery-ui-1.10.4.custom.css">
<link rel="stylesheet" type="text/css" href="https://dev.wizq.net/sampleApp/hangame/css/prettify.css">
<script src="https://dev.wizq.net/sampleApp/hangame/js/jquery-1.10.2.js" type="text/javascript"></script>
<script src="https://dev.wizq.net/sampleApp/hangame/js/jquery-ui-1.10.4.custom.js" type="text/javascript"></script>
<script src="https://dev.wizq.net/sampleApp/hangame/js/sampleApp.js" type="text/javascript"></script>
<script src="https://dev.wizq.net/sampleApp/hangame/js/i18n/grid.locale-en.js" type="text/javascript"></script>
<script src="https://dev.wizq.net/sampleApp/hangame/js/jquery.jqGrid.min.js" type="text/javascript"></script>
<script src="https://dev.wizq.net/sampleApp/hangame/js/google-code-prettify/run_prettify.js"></script>
 <script>
$(function() {
$( "input[type=submit], input[type=button], button" )
.button();

$('#tabs')
    .tabs()    
    .addClass('ui-tabs-vertical ui-helper-clearfix')
    .click('load',function (event, ui) {if(wqapi){wqapi.resetHeight();}})
    
});
if(typeof WizQBootStrap === 'function')
{
    var wizqBootStrap = new WizQBootStrap();
    wizqBootStrap.init(wizqConfig);		
    wizqBootStrap.registerOnLoadHandler(function(){wqapi.resetHeight();});
}
</script>
<h2>wizQ API JavaScript Sample Application</h2>
<div id="tabs">
<ul>
<li><a href="#getSelfID">getSelfID</a></li><li><a href="#getFriendsID">getFriendsID</a></li><li><a href="#getUsersProfile">getUsersProfile</a></li><li><a href="#postFeed">postFeed</a></li><li><a href="#inviteFriends">inviteFriends</a></li><li><a href="#getAppParams">getAppParams</a></li><li><a href="#validateUserInput">validateUserInput</a></li><li><a href="#makeRequest">makeRequest</a></li><li><a href="#requestPayment">requestPayment</a></li><li><a href="#resetHeight">resetHeight</a></li><li><a href="#submitScore">submitScore</a></li><li><a href="#getUserRank">getUserRank</a></li><li><a href="#getSelfTopScore">getSelfTopScore</a></li><li><a href="#getUserTopScore">getUserTopScore</a></li><li><a href="#getScores">getScores</a></li></ul>
<div id="getSelfID"><script>
 function getSelfIDExample()
 {
	wqapi.getSelfID(function(returnCode,returnMessage,userID)
	{
		var output = document.getElementById('output');		
		output.innerHTML= 'returnCode ' + returnCode + 
		' returnMessage ' + returnMessage + ' userID ' + userID + '\n';	
		if (returnCode == WizQAPI.ReturnCode.SUCCESS.code)
		{
			var result = document.getElementById('getSelfIDResult');
			result.innerHTML = userID;
		}else
		{
			//Fail to get self ID
		}
	});     
 }
</script>
<h3>getSelfID(callback)</h3>
<p>Request current user's ID from the platform and return to callback function.</p>
<h5>Parameters:</h5>
<blockquote><span class="type">Function</span> callback - The function to call once the request has been processed. The function will be passed three parameters, <span class="type">int</span> <span class="parameters">returnCode</span>, <span class="type">String</span> <span class="parameters">returnMessage</span> and <span class="type">String</span> <span class="parameters">userID</span>. If there was an error, userID returns as <span class="null">NULL</span>.</blockquote>
<h5>Returns:</h5>
<blockquote>None</blockquote>
<h5>Callback:</h5>
<blockquote><span class="type">Integer</span> returnCode - The integer identifies the status of the function call.</blockquote>
<blockquote><span class="type">String</span> returnMessage - The message describes the function status.</blockquote>
<blockquote><span class="type">String</span> userID - A string of user ID. If there was an error, userID returns <span class="null">null</span>.</blockquote>
<h5>Example:</h5>
<pre class="prettyprint">
var wizqBootStrap = new WizQBootStrap();
    wizqBootStrap.init(wizqConfig);		
    wizqBootStrap.registerOnLoadHandler(wqinit);

function wqinit()
{
	wqapi.getSelfID(function(returnCode,returnMessage,userID)
	{
		var output = document.getElementById('output');		
		output.innerHTML= 'returnCode ' + returnCode + 
		' returnMessage ' + returnMessage + ' userID ' + userID + '\n';	
		if (returnCode == WizQAPI.ReturnCode.SUCCESS.code)
		{
			//success
		}else
		{
			//Fail to get self ID
		}
	});
}	
</pre>	
<form>
    <table>
	<tr>
	    <td><input type="button" value="Get My User ID" onClick="getSelfIDExample()"/></td>
	</tr>
	<tr>
	    <td>Your user ID : <span id="getSelfIDResult"/></td>
	</tr>
    </table>
</form></div><div id="getFriendsID"><script>
    function getFriendsIDExample()
    {
	var hasApp = $('#getFriendsIDHasAppCheckbox').is(":checked");
        $("#getFriendsIDResult").jqGrid('GridUnload');
	$("#getFriendsIDResult").jqGrid({
	    datatype: "local",
	    height: 250,
	    colNames: ['Friends ID'],
	    colModel: [	{name: 'id', index: 'id', width: 200 , sortable:false}],
	    multiselect: false}
	);        
	wqapi.getFriendsID(hasApp, function(returnCode, returnMessage, userIDList)
	{
	    var output = document.getElementById('output');
	    output.innerHTML = 'returnCode ' + returnCode +
		    ' returnMessage ' + returnMessage + ' userIDList ' + userIDList + '\n';
	    if (returnCode == WizQAPI.ReturnCode.SUCCESS.code)
	    {		
		for (var i = 0; i < userIDList.length; i++) {
		    var o = {};
		    o.id = userIDList[i];		    
		    $("#getFriendsIDResult").jqGrid('addRowData', i + 1, o)
		}
		//$('#getFriendsIDResult').simple_datagrid('loadData', data);
		wqapi.resetHeight();
	    } else
	    {
		//Fail to get Friends
	    }
	});
    }


</script>
<h3>getFriendsID(hasApp, callback)</h3>
<p>Request a list of friends ID from the platform and return to callback function.</p>
<h5>Parameters:</h5>
<blockquote><span class="type">Boolean</span> hasApp - When <span class="null">true</span>, filter users who installed the App.</blockquote>
<blockquote><span class="type">Function</span> callback - The function to call once the request has been processed. The function will be passed three parameters, <span class="type">int</span> <span class="parameters">returnCode</span>, <span class="type">String</span> <span class="parameters">returnMessage</span> and <span class="type">Array</span>.&lt;<span class="type">String</span>&gt; <span class="parameters">userIDList</span></blockquote>  
<h5>Returns:</h5>
<blockquote>None</blockquote>
<h5>Callback:</h5>
<blockquote><span class="type">Integer</span> returnCode - The integer identifies the status of the function call.</blockquote>
<blockquote><span class="type">String</span> returnMessage - The message describes the function status.</blockquote>
<blockquote><span class="type">Array</span>.&lt;<span class="type">String</span>&gt; userIDList - A List of users' ID.</blockquote>
<h5>Example:</h5>
<pre class="prettyprint">
var wizqBootStrap = new WizQBootStrap();
    wizqBootStrap.init(wizqConfig);		
    wizqBootStrap.registerOnLoadHandler(wqinit);

function wqinit()
{
	var hasApp = false;
	wqapi.getFriendsID(hasApp,function(returnCode,returnMessage,userIDList)
	{
		var output = document.getElementById('output');		
		output.innerHTML= 'returnCode ' + returnCode + 
		' returnMessage ' + returnMessage + ' userIDList ' + userIDList + '\n';	
		if (returnCode == WizQAPI.ReturnCode.SUCCESS.code)
		{
			//success
		}else
		{
			//Fail to get Friends
		}		
	});
}	
</pre> 
<form>
    <table>
	<tr>
	    <td>hasApp</td><td><input type="checkbox" checked="checked" id="getFriendsIDHasAppCheckbox"/></td>
	</tr>
	<tr>
	    <td>&nbsp;</td><td><input type="button" value="getFriendsID" onClick="getFriendsIDExample()"/></td>
	</tr>
	<tr>
	    <td>Result</td><td><table id="getFriendsIDResult"></table></td>
	</tr>
    </table>
</form></div><div id="getUsersProfile"><script>
    function getUsersProfileFieldsName(field)
    {
        var info = [];
        info[WizQAPI.User.Fields.FIELD_ID] = {name:'ID',width:100};
        info[WizQAPI.User.Fields.FIELD_HAS_APP] = {name:'Has App',width:50};
        info[WizQAPI.User.Fields.FIELD_DISPLAY_NAME] = {name:'Display Name',width:100};
        info[WizQAPI.User.Fields.FIELD_PROFILE_IMAGE_URL] = {name:'Profle Image URL',width:100};
        info[WizQAPI.User.Fields.FIELD_PROFILE_URL] = {name:'Profile URL',width:100};
        info[WizQAPI.User.Fields.FIELD_AGE] = {name:'Age',width:30};
        info[WizQAPI.User.Fields.FIELD_DATE_OF_BIRTH] = {name:'Date of Birth',width:100};
        info[WizQAPI.User.Fields.FIELD_GENDER] = {name:'Gender',width:30};
        
        return info[field];
    }
    
    function getUsersProfileExample()    
    {
        var userIDList = $('#getUsersProfileUserIDList').val();
        var userIDListArray = userIDList.split(",");
        
	var params = new Array();
	params.push(WizQAPI.User.Fields.FIELD_ID);
	if($('#getUsersProfileCheckboxHasApp').is(":checked"))
	{
	    params.push(WizQAPI.User.Fields.FIELD_HAS_APP);
	}
	if($('#getUsersProfileCheckboxDisplayName').is(":checked"))
	{	
	    params.push(WizQAPI.User.Fields.FIELD_DISPLAY_NAME);
	}
	if($('#getUsersProfileCheckboxProfileImageURL').is(":checked"))
	{	
	    params.push(WizQAPI.User.Fields.FIELD_PROFILE_IMAGE_URL);
	}
	if($('#getUsersProfileCheckboxProfileURL').is(":checked"))
	{	
	    params.push(WizQAPI.User.Fields.FIELD_PROFILE_URL);
	}
	if($('#getUsersProfileCheckboxAge').is(":checked"))
	{	
	    params.push(WizQAPI.User.Fields.FIELD_AGE);
	}
	if($('#getUsersProfileCheckboxDateOfBirth').is(":checked"))
	{	
	    params.push(WizQAPI.User.Fields.FIELD_DATE_OF_BIRTH);
	}
	if($('#getUsersProfileCheckboxGender').is(":checked"))
	{	
	    params.push(WizQAPI.User.Fields.FIELD_GENDER);
	}
        
        var paramsName = [];
        var paramsModel = [];
        for(var i=0;i<params.length;i++)
        {
            var info = getUsersProfileFieldsName(params[i]);
            var o = {};
            o.name = params[i];
            o.index = params[i];
            o.width = info.width;
            o.sortable = false;
            
            paramsName.push(info.name);
            paramsModel.push(o);
        }
        $("#getUsersProfileResult").jqGrid('GridUnload');
        $("#getUsersProfileResult").jqGrid({
            datatype: "local",
            height: 250,
            colNames: paramsName,
            colModel: paramsModel,
            multiselect: false}
        );        
        
	wqapi.getUsersProfile(userIDListArray,params,function(returnCode,returnMessage,usersProfile)
	{
	    var output = document.getElementById('output');
            output.innerHTML = "";
            //success
            for(var key in usersProfile)
            {
                    var user = usersProfile[key];
                    for (var j=0;j<params.length;j++)
                    {
                            var param = params[j];
                            output.innerHTML += param + " : " +user[param] + "\n";
                            
                    }			    
		    $("#getUsersProfileResult").jqGrid('addRowData', i + 1, user)                    
            }               
	});        	
    }
    $(function() {
        $('#tabs').on('tabsactivate',function(e,ui){
            var tabid = ui.newPanel.attr('id');            
            if(tabid == 'getUsersProfile')
            {
                wqapi.getFriendsID(false,function(returnCode,returnMessage,userIDList)
                {
                        if (returnCode == WizQAPI.ReturnCode.SUCCESS.code)
                        {
                                $("#getUsersProfileUserIDList").val(userIDList);
                        }else
                        {
                                //Fail to get Friends
                        }		
                });                
            }
        }) 
    });

</script>
<h3>getUsersProfile(userIDList, params , callback)</h3>
<p>Request the platform to get users' profile data.</p>
<h5>Parameters:</h5>
<blockquote><span class="type">Array</span>.&lt;<span class="type">String</span>&gt; userIDList - List of user ID, represented users to be retrieved data.</blockquote>
<blockquote><span class="type">Array</span>.&lt;<span class="type">WizQAPI.User.Fields</span>&gt; params - List of field to be retrieved.</blockquote>
<blockquote><span class="type">Function</span> callback - The function to call once the request has been processed. The function will be passed three parameters, <span class="type">int</span> <span class="parameters">returnCode</span>, <span class="type">String</span> <span class="parameters">returnMessage</span> and <span class="type">Map.&ltString, Map.&lt; WizQAPI.User.Fields, Object&gt;&gt;</span> <span class="parameters">usersProfile</span>.</blockquote>
<h5>Returns:</h5>
<blockquote>None</blockquote>
<h5>Callback:</h5>
<blockquote><span class="type">Integer</span> returnCode - The integer identifies the status of the function call.</blockquote>
<blockquote><span class="type">String</span> returnMessage - The message describes the function status.</blockquote>
<blockquote><span class="type">Array.&ltString, Array.&lt; WizQAPI.User.Fields, Object&gt;&gt;</span> usersProfile - A collection of user profile. Each object maps with user ID; inside that object, each value maps with <span class="type">WizQAPI.User.Fields</span></blockquote>
<h5>Example:</h5>
<pre class="prettyprint">
var wizqBootStrap = new WizQBootStrap();
wizqBootStrap.init(wizqConfig);
wizqBootStrap.registerOnLoadHandler(wqInit);

function wqInit()
{
    var userList = new Array();
    userList.push('123');
    userList.push('125');
    getUsersProfile(userIDListArray);
}

function getUsersProfile(userIDListArray)
{
    var params = new Array();
    params.push(WizQAPI.User.Fields.FIELD_HAS_APP);
    params.push(WizQAPI.User.Fields.FIELD_DISPLAY_NAME);
    params.push(WizQAPI.User.Fields.FIELD_ID);
    params.push(WizQAPI.User.Fields.FIELD_PROFILE_IMAGE_URL);
    params.push(WizQAPI.User.Fields.FIELD_PROFILE_URL);
    params.push(WizQAPI.User.Fields.FIELD_AGE);
    params.push(WizQAPI.User.Fields.FIELD_DATE_OF_BIRTH);
    params.push(WizQAPI.User.Fields.FIELD_GENDER);

    wqapi.getUsersProfile(userIDListArray,params,function(returnCode, returnMessage, usersProfile)
    {
        var output = document.getElementById('output');
        output.innerHTML= 'returnCode ' + returnCode + ' returnMessage ' + returnMessage + '\n';
        if(returnCode == WizQAPI.ReturnCode.SUCCESS.code)
        {
            //success
            for(var key in usersProfile)
            {
                var user = usersProfile[key];

                var hasApp = user[WizQAPI.User.Fields.FIELD_HAS_APP];
                var displayName = user[WizQAPI.User.Fields.FIELD_DISPLAY_NAME];
                var userID = user[WizQAPI.User.Fields.FIELD_ID];
                var profileImageURL = user[WizQAPI.User.Fields.FIELD_PROFILE_IMAGE_URL];
                var profileURL = user[WizQAPI.User.Fields.FIELD_PROFILE_URL];
                var age = user[WizQAPI.User.Fields.FIELD_AGE];
                var dateOfBirth = user[WizQAPI.User.Fields.FIELD_DATE_OF_BIRTH];
                var gender = user[WizQAPI.User.Fields.FIELD_GENDER];

                output.innerHTML += "hasApp : " + hasApp + "&lt;br/&gt;";
                output.innerHTML += "displayName : " + displayName + "&lt;br/&gt;";
                output.innerHTML += "userID : " + userID + "&lt;br/&gt;";
                output.innerHTML += "profileImageURL : " + profileImageURL + "&lt;br/&gt;";
                output.innerHTML += "profileURL : " + profileURL + "&lt;br/&gt;";
                output.innerHTML += "age : " + age + "&lt;br/&gt;";
                output.innerHTML += "dateOfBirth : " + dateOfBirth + "&lt;br/&gt;";
                output.innerHTML += "gender : " + gender + "&lt;br/&gt;";
                output.innerHTML += "==============================================&lt;br/&gt;";
            }
        }
        else
        {
            //Fail to get user profile
        }
    });
}
</pre> 
<form>
    <table>
	<tr><td>User Fields</td><td>
		<table>
		    <tr>
			<td><label><input type="checkbox" disabled="disabled" checked="checked" id="getUsersProfileCheckboxID" value="value"> ID</label></td>
			<td><label><input type="checkbox" id="getUsersProfileCheckboxHasApp" checked="checked" value="value"> Has App</label></td>
			<td><label><input type="checkbox" id="getUsersProfileCheckboxDisplayName" checked="checked" value="value"> Display Name</label></td>
		    </tr>
		    <tr>
			<td><label><input type="checkbox" id="getUsersProfileCheckboxProfileImageURL" checked="checked" value="value"> Profile Image URL</label></td>
			<td><label><input type="checkbox" id="getUsersProfileCheckboxProfileURL" checked="checked" value="value"> Profile URL</label></td>
			<td><label><input type="checkbox" id="getUsersProfileCheckboxAge" checked="checked" value="value"> Age</label></td>
		    </tr>
		    <tr>
			<td><label><input type="checkbox" id="getUsersProfileCheckboxDateOfBirth" checked="checked" value="value"> Date of Birth</label></td>
			<td><label><input type="checkbox" id="getUsersProfileCheckboxGender" checked="checked" value="value"> Gender</label></td>
			<td>&nbsp;</td>
		    </tr>
		</table>
	    </td></tr>
	<tr><td>User ID List</td><td><textarea id="getUsersProfileUserIDList" style="width:400px;height:100px"></textarea></td></tr>
	<tr><td>&nbsp;</td><td><input type="button" value="Get Users Profile" onClick="getUsersProfileExample()"/></td></tr>
	<tr>
	    <td>Result</td><td><table id="getUsersProfileResult"></table></td>
	</tr>	
    </table>
</form></div><div id="postFeed"><script>
    function postFeedExample()
    {
        var title = $('#postFeedTitle').val();
        var body = $('#postFeedBody').val();

        var mediaList = new Array();
        mediaList.push(WizQAPI.Media.createEmptyMedia());
        var pngMediaURL = $('#postFeedMediaURL').val();
        if(pngMediaURL != ''){
            mediaList.push(WizQAPI.Media.createPNGMedia(pngMediaURL));
        }
        
        var feedPriority = ($('#postFeedFeedPriorityRadioLow:checked').length > 0) ? WizQAPI.Feed.Priority.LOW : WizQAPI.Feed.Priority.HIGH;

        var url = $('#postFeedURL').val();

        wqapi.postFeed(title, body, mediaList, feedPriority , url, function(returnCode, returnMessage)
        {
            var output = document.getElementById('output');
            output.innerHTML = 'returnCode ' + returnCode + ' returnMessage ' + returnMessage + '\n';
            if (returnCode == WizQAPI.ReturnCode.SUCCESS.code)
            {
                //success
            } else
            {
                //failure
            }
        });
    }
    $(function() {
    });

</script>
<h3>postFeed(title, opt_body, opt_media, opt_priority, opt_link, opt_callback)</h3>
<p>Request to post a story to user's page.</p>
<h5>Parameters:</h5>

<blockquote><span class="type">String</span> title - The title of the feed</blockquote>
<blockquote><span class="type">String</span> opt_body - The body of the feed</blockquote>
<blockquote><span class="type">Array</span>.&lt;<span class="type">WizQAPI.Media</span>&gt; opt_media - A list of media item. Represents images to show in the feed and the maximum of the array length is 3.</blockquote>
<blockquote><span class="type">WizQAPI.Feed.Priority</span> opt_priority - The priority for the request</blockquote>
<blockquote><span class="type">String</span> opt_link - The URL that represents the feed</blockquote>
<blockquote><span class="type">Function</span> opt_callback - A function to call once the request has been processed. The function will be passed two parameters,  <span class="type">int</span> <span class="parameters">returnCode</span> and <span class="type">String</span> <span class="parameters">returnMessage</span>.</blockquote>
<h5>Returns:</h5>
<blockquote>None</blockquote>
<h5>Callback:</h5>
<blockquote><span class="type">int</span> returnCode - The integer identifies the status of the function call.</blockquote>
<blockquote><span class="type">String</span> returnMessage - The message describes the function status.</blockquote>
<h5>Example:</h5>
<pre class="prettyprint">
function postFeed()
{
	var title = "Feed Title";
	var body = "Feed Body";	
	
	var mediaList = new Array();
	mediaList.push(WizQAPI.Media.createEmptyMedia());
	mediaList.push(WizQAPI.Media.createPNGMedia('http://www.wizq.com/images/logo.png'));
		
	var url = "";
	
	wqapi.postFeed(title,body,mediaList,WizQAPI.Feed.Priority.HIGH,url,function(returnCode,returnMessage)
	{
		var output = document.getElementById('output');			
		output.innerHTML= 'returnCode ' + returnCode + ' returnMessage ' + returnMessage + '\n';
		if (returnCode == WizQAPI.ReturnCode.SUCCESS.code)
		{
			//success
		}else
		{
			//failure
		}							
	});		
}
</pre> 
<form>
    <table>
        <tr>
            <td>Title</td><td><input type="text" id="postFeedTitle" value="Feed Title"  style="width:250px"/></td>
        </tr>
        <tr>
            <td>Body</td><td><input type="text" id="postFeedBody" value="Feed Body" style="width:250px"/></td>
        </tr>
        <tr>
            <td>URL</td><td><input type="text" id="postFeedURL" value="" style="width:250px"/></td>
        </tr>
        <tr>
            <td>PNG Media URL</td><td><input type="text" id="postFeedMediaURL" value="http://www.wizq.com/images/logo.png" style="width:250px"/></td>
        </tr>           
        <tr>
            <td>Feed Priority</td><td>
                <table cellspacing="0" cellpadding="0" border="0">
                    <tbody>
                        <tr>
                            <td style="padding-left:5px;">
                                <input id="postFeedFeedPriorityRadioLow" type="radio"  name="postFeedFeedPriorityRadio"></input>
                                <label for="postFeedFeedPriorityRadioLow">Low</label>
                            </td>
                            <td style="padding-left:5px;">
                                <input id="postFeedFeedPriorityRadioHigh" type="radio" checked="" value="0" value="1" name="postFeedFeedPriorityRadio"></input>
                                <label for="postFeedFeedPriorityRadioHigh">High</label>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </td>
        </tr>         
        <tr>
            <td>&nbsp;</td><td><input type="button" value="Post Feed" onClick="postFeedExample()"/></td>
        </tr>
    </table>
</form></div><div id="inviteFriends"><script>
function inviteFriendsExample()
{
	wqapi.inviteFriends(function(returnCode,returnMessage,userIDList)
	{
		var output = document.getElementById('output');			
		output.innerHTML= 'returnCode ' + returnCode + 
		' returnMessage ' + returnMessage + ' userIDList ' + userIDList + '\n';			
	});    
}
</script>
<h3>inviteFriends( callback )</h3>
<p>Request the platform to share the App with friends.</p>
<h5>Parameters:</h5>
<blockquote><span class="type">Function</span> callback - The function to call once the request has been processed. The function will be passed three parameters, <span class="type">int</span> <span class="parameters">returnCode</span>, <span class="type">String</span> <span class="parameters">returnMessage</span> and <span class="type">Array</span>.&lt;<span class="type">String</span>&gt; <span class="parameters">userIDList</span>.</blockquote>
<h5>Returns:</h5>
<blockquote>None</blockquote>
<h5>Callback:</h5>
<blockquote><span class="type">int</span> returnCode - The integer identifies the status of the function call.</blockquote>
<blockquote><span class="type">String</span> returnMessage - The message describes the function status.</blockquote>
<blockquote><span class="type">Array</span>.&lt;<span class="type">String</span>&gt; userIDList - A list of selected users' ID. If there was an error, userIDList returns an empty array.</blockquote>
<h5>Example:</h5>
<pre class="prettyprint">
var wizqBootStrap = new WizQBootStrap();
    wizqBootStrap.init(wizqConfig);		
    wizqBootStrap.registerOnLoadHandler(wqinit);

function wqinit()
{
	wqapi.inviteFriends(function(returnCode,returnMessage,userIDList)
	{
		var output = document.getElementById('output');			
		output.innerHTML= 'returnCode ' + returnCode + 
		' returnMessage ' + returnMessage + ' userIDList ' + userIDList + '\n';		
		if (returnCode == WizQAPI.ReturnCode.SUCCESS.code)
		{
			//success
		}else
		{
			//failure
		}			
	});			
}	
</pre> 
<form>
    <table>
        <tr>
            <td colspan="2"><input type="button" value="Invite Friends" onClick="inviteFriendsExample()"/></td>
        </tr>
    </table>
</form></div><div id="getAppParams"><h3>getAppParam()</h3>
<p>Get the JSON string from appParams in URL and convert it into Object.</p>
<h5>Parameters:</h5>
<blockquote>None</blockquote>
<h5>Returns</h5>
<blockquote><span class="type">Object</span> - The converted value of appParams.</blockquote>
<h5>Callback:</h5>
<blockquote>None</blockquote>
<h5>Example:</h5>    
<pre class="prettyprint">
URL:
http://yahoo-mbga.jp/game/12001234/play?appParams={"id": "abc1234", "name": "wizQ"}
JS:
var data = wqapi.getAppParam();
alert(data.id);	//abc1234
alert(data.name);	//wizQ
</pre></div><div id="validateUserInput"><script>
    function validateUserInputExample()
    {
	var input = $('#validateUserInputText').val();
	wqapi.validateUserInput(input,function(returnCode, returnMessage , result)
	{
		output.innerHTML= 'returnCode ' + returnCode + ' returnMessage ' + returnMessage + ' result ' + result+ '\n';	
		if (returnCode == WizQAPI.ReturnCode.SUCCESS.code)
		{
			//success
			if(result == true)
			{
                            $('#validateUserInputResult').html('<span style="color:#00FF00">OK</span>')
			}else
			{
                            $('#validateUserInputResult').html('<span style="color:#FF0000">Prohibited</span>')
			}
		}else
		{
			//failure
		}	
	});        
    }
</script>
<h3>validateUserInput(input , callback)</h3>
<p>Validate user input if it passes the platform policy.</p>
<h5>Parameters:</h5>
<blockquote><span class="type">String</span> input - The user input</blockquote>
<blockquote><span class="type">Function</span> opt_callback - A function to call once the request has been processed. The function will be passed three parameters,  <span class="type">int</span> <span class="parameters">returnCode</span>,  <span class="type">String</span> <span class="parameters">returnMessage</span> and <span class="type">Boolean</span> <span class="parameters">result</span>.</blockquote>
<h5>Returns</h5>
<blockquote>None</blockquote>
<h5>Callback:</h5>
<blockquote><span class="type">int</span> returnCode - The integer identifies the status of the function call</blockquote>
<blockquote><span class="type">String</span> returnMessage - The message decribes the function status</blockquote>
<blockquote><span class="type">Boolean</span> result - When <span class="null">true</span>, the user input passes the policy</blockquote>
<h5>Example:</h5>   
<pre class="prettyprint">
var wizqBootStrap = new WizQBootStrap();
wizqBootStrap.init(wizqConfig);
wizqBootStrap.registerOnLoadHandler(wqInit);

function wqInit()
{
    var input = '殺す';
    wqapi.validateUserInput(input,function(returnCode, returnMessage , result)
    {
            output.innerHTML= 'returnCode ' + returnCode + ' returnMessage ' + returnMessage + ' result ' + result+ '\n';	
            if (returnCode == WizQAPI.ReturnCode.SUCCESS.code)
            {
                    //success
                    if(result == true)
                    {
                            //valid input
                    }else
                    {
                            //invalid input
                    }
            }else
            {
                    //failure
            }	
    });
};
</pre>
<form>
    <table>
        <tr>
            <td>Input</td>
            <td><textarea id="validateUserInputText">セックス and 殺す</textarea></td>
        </tr>
        <tr>
            <td>Result</td>
            <td><span id="validateUserInputResult"></textarea></td>
        </tr>        
        <tr>
            <td>&nbsp;</td>
            <td><input type="button" value="Run" onClick="validateUserInputExample()"/></td></tr>
    </table>
</form></div><div id="makeRequest"><script>
    function makeRequestExample()
    {
        var url = $('#makeRequestURL').val();
        var method   = ($('#makeRequestMethodRadioGet:checked').length > 0) ? WizQAPI.RequestMethod.GET : WizQAPI.RequestMethod.POST;
        var requestParams = $('#makeRequestParams').val();

        wqapi.makeRequest(url, method, requestParams, function(returnCode, returnMessage, response)
        {
            var output = document.getElementById('output');	
            if (returnCode == WizQAPI.ReturnCode.SUCCESS.code)
            {
                //success
                output.innerHTML = response;
            }else
            {
                //failure
                output.innerHTML = 'Fail to get content from my server!';
            }
        });
    }
</script>
<h3>makeRequest(url, method, requestParams, callback)</h3>
<p>Send a proxy request</p>
<h5>Parameters:</h5>
<blockquote><span class="type">String</span> url - URL to be requested</blockquote>
<blockquote><span class="type">WizQAPI.RequestMethod</span> method - The request method</blockquote>
<blockquote><span class="type">String</span> requestParams - Request parameters in key-value pair format, for example, id=123&name=name&status="You%26Me". All the values must be escaped with encodeURIComponent(). null for no parameters.</blockquote>
<blockquote><span class="type">Function</span> callback - The function to call once the request has been processed. The function will be passed three parameters,  <span class="type">int</span> <span class="parameters">returnCode</span>,  <span class="type">String</span> <span class="parameters">returnMessage</span> and <span class="type">String</span> <span class="parameters">content</span>.</blockquote>
<h5>Returns</h5>
<blockquote>None</blockquote>
<h5>Callback:</h5>
<blockquote><span class="type">Integer</span> returnCode - The integer identifies the status of the function call</blockquote>
<blockquote><span class="type">String</span> returnMessage - The message decribes the function status</blockquote>
<blockquote><span class="type">String</span> response - The response of the request.</blockquote>
<h5>Example:</h5>   
<pre class="prettyprint">
var wizqBootStrap = new WizQBootStrap();
wizqBootStrap.init(wizqConfig);
wizqBootStrap.registerOnLoadHandler(wqInit);

function wqInit()
{
    var url = "https://api.dev.wizq.net/makeRequest.php";
    var method = WizQAPI.RequestMethod.GET;
    var requestParams = "content_id=1&page=2&name=You%26Me";

    wqapi.makeRequest(url, method, requestParams, function(returnCode, returnMessage, response)
    {
        var output = document.getElementById('output');	
        if (returnCode == WizQAPI.ReturnCode.SUCCESS.code)
        {
            //success
            output.innerHTML = response;
        }else
        {
            //failure
            output.innerHTML = 'Fail to get content from my server!';
        }
    });
}
</pre>
<form>
    <table>
        <tr>
            <td>URL</td><td><input type="text" id="makeRequestURL" value="https://api.dev.wizq.net/makeRequest.php" style="width:250px"/></td>
        </tr>
        <tr>
            <td>Request Method</td><td>
                <table cellspacing="0" cellpadding="0" border="0">

                    <tbody>
                        <tr>
                            <td style="padding-left:5px;">
                                <input id="makeRequestMethodRadioGet" type="radio" checked="" name="makeRequestMethodRadio"></input>
                                <label for="makeRequestMethodRadioGet">GET</label>
                            </td>
                            <td style="padding-left:5px;">
                                <input id="makeRequestMethodRadioPost" type="radio" value="0" value="1" name="makeRequestMethodRadio"></input>
                                <label for="makeRequestMethodRadioPost">POST</label>
                            </td>
                        </tr>
                    </tbody>

                </table>                

            </td>
        </tr>          
        <tr>
            <td>Params</td><td><input type="text" id="makeRequestParams" value="content_id=1&page=2&name=You%26Me"  style="width:250px"/></td>
        </tr>
        <tr>
            <td>&nbsp;</td><td><input type="button" value="Make Request" onClick="makeRequestExample()"/></td>
        </tr>
    </table>
</form>
</div><div id="requestPayment"><script>
    function requestPaymentExample()
    {
        var skuID = parseInt($('#requestPaymentSkuID').val());
        var skuQuantity = parseInt($('#requestPaymentSKUQuantity').val());
        var skuUnitPrice = parseInt($('#requestPaymentSKUUnitPrice').val());
        var skuName = parseInt($('#requestPaymentSKUName').val());
        var skuImageURL = parseInt($('#requestPaymentSKUImageURL').val());
        var handlePaymentURL = wizqConfig.handlePaymentURL;

        wqapi.requestPayment(skuID, skuQuantity, skuUnitPrice, skuName, skuImageURL, handlePaymentURL, function(returnCode, returnMessage)
        {
            var output = document.getElementById('output');
            output.innerHTML = 'returnCode ' + returnCode + ' returnMessage ' + returnMessage + '\n';
            if (returnCode == WizQAPI.ReturnCode.PAYMENT_REQUEST_SENT.code)
            {
                // request sent, success or failure cannot be determined
            }
            else if (returnCode == WizQAPI.ReturnCode.SUCCESS.code)
            {
                // success
            }
            else
            {
                // fail			
            }
        });
    }
</script>
<h3>requestPayment(skuID, skuQuantity, skuUnitPrice, skuName, skuImageURL, handlePaymentURL, callback)</h3>
<p>Request to begin a payment transaction from the platform and return to callback function.</p>
<h5>Parameters:</h5>
<blockquote><span class="type">Integer</span> skuID - A non-null and non-empty stock-keeping unit uniquely identifies a product</blockquote>
<blockquote><span class="type">Integer</span> skuQuantity - An unsigned integer (greater than 0) specifies the purchase quantity of the product</blockquote>
<blockquote><span class="type">Integer</span> skuUnitPrice - An unsigned integer (greater than 0) specifies the price of the product</blockquote>
<blockquote><span class="type">String</span> skuName - A non-null and non-empty string specifies the name of the product</blockquote>
<blockquote><span class="type">String</span> skuImageURL - A non-null and non-empty string specifies the image of the product</blockquote>
<blockquote><span class="type">String</span> handlePaymentURL - A non-null and non-empty string specifies the location of the payment handler (will be provided by WizQ)</blockquote>
<blockquote><span class="type">Function</span> callback - A function to call once the request has been processed</blockquote>

<h5>Returns:</h5>
<blockquote>None</blockquote>
<h5>Callback:</h5>
<blockquote><span class="type">Integer</span> returnCode - The integer identifies the status of the function call</blockquote>
<blockquote><span class="type">String</span> returnMessage - The message decribes the function status</blockquote>
<h5>Remarks:</h5>
<blockquote>Some platform may trigger a page reload, success or failure cannot be determined by the callback return code</blockquote>
<h5>Example:</h5>
<pre class="prettyprint">
var wizqBootStrap = new WizQBootStrap();
    wizqBootStrap.init(wizqConfig);
    wizqBootStrap.registerOnLoadHandler(wqinit);

function wqinit()
{
	var skuID = 12345678;
	var skuQuantity = 1;
	var skuUnitPrice = 210;
	var skuName = "Clothes";
	var skuImageURL = "http://www.wizq.com/images/logo.png";
	var handlePaymentURL = wizqConfig.handlePaymentURL;
	
	wqapi.requestPayment(skuID, skuQuantity, skuUnitPrice, skuName, skuImageURL, handlePaymentURL, function(returnCode, returnMessage)
	{
		var output = document.getElementById('output');			
		output.innerHTML= 'returnCode ' + returnCode + ' returnMessage ' + returnMessage + '\n';
		if (returnCode == WizQAPI.ReturnCode.PAYMENT_REQUEST_SENT.code)
		{
			// request sent, success or failure cannot be determined
		}
		else if (returnCode == WizQAPI.ReturnCode.SUCCESS.code)
		{
                    // success
		}
		else
		{
                    // fail			
		}
	});
}
</pre> 
<form>
    <table>
        <tr>
            <td>SKU ID</td><td><input type="text" id="requestPaymentSkuID" value="12345678"  style="width:250px"/>Positive Integer</td>
        </tr>
        <tr>
            <td>SKU Quantity</td><td><input type="text" id="requestPaymentSKUQuantity" value="1" style="width:250px"/> 1 to 255</td>
        </tr>
        <tr>
            <td>SKU Unit Price</td><td><input type="text" id="requestPaymentSKUUnitPrice" value="210" style="width:250px"/>Positive Integer</td>
        </tr>
        <tr>
            <td>SKU Name</td><td><input type="text" id="requestPaymentSKUName" value="Clothes" style="width:250px"/></td>
        </tr>
        <tr>
            <td>SKU Image URL</td><td><input type="text" id="requestPaymentSKUImageURL" value="http://www.wizq.com/images/logo.png" style="width:250px"/></td>
        </tr>         
        <tr>
            <td>&nbsp;</td><td><input type="button" value="Request Payment" onClick="requestPaymentExample()"/></td>
        </tr>
    </table>
</form>
</div><div id="resetHeight"><script>
function resetHeightExample()
{
    var h = parseInt($('#resetHeightPaddingBoxHeightInput').val());    
    $('#resetHeightPaddingBox').height(h);
    wqapi.resetHeight();
}
</script>
<h3>resetHeight()</h3>
<p>Reset the height of the canvas.</p>
<h5>Parameters:</h5>
<blockquote>None</blockquote>
<h5>Returns</h5>
<blockquote>None</blockquote>
<h5>Callback:</h5>
<blockquote>None</blockquote>
<h5>Example:</h5>   
<pre class="prettyprint">
var wizqBootStrap = new WizQBootStrap();
wizqBootStrap.init(wizqConfig);
wizqBootStrap.registerOnLoadHandler(wqinit);

function wqinit()
{
  wqapi.resetHeight();
}
</pre>
<form>
    <table>
        <tr>
            <td>Padding box Height</td><td><input type="text" id="resetHeightPaddingBoxHeightInput" value="200"  style="width:250px"/></td>
        </tr>      
        <tr>
            <td>&nbsp;</td><td><input type="button" value="Reset Height" onClick="resetHeightExample()"/></td>
        </tr>
    </table>
</form>
<div id="resetHeightPaddingBox" style="background-color: #9CC;">padding box</div>
</div><div id="submitScore"><script>
    function submitScoreExample()
    {
        var leaderBoardID = $('#submitScoreLeaderBoardID').val();
        var score = $('#submitScoreScore').val();
        var forceUpdate = $('#submitScoreForceUpdateCheckbox').is(":checked");
        wqapi.submitScore(leaderBoardID,score,forceUpdate,function(returnCode,returnMessage)
        {
            var output = document.getElementById('output');			
            output.innerHTML= 'returnCode ' + returnCode + ' returnMessage ' + returnMessage + '\n';
            if (returnCode == WizQAPI.ReturnCode.SUCCESS.code)
            {
                //success            
            }else
            {
                //Fail to submit
            }
        });
    }
</script>
<h3>submitScore(leaderboardID, score, forceUpdate, callback)</h3>
<p>Submit user score to leaderboard.</p>
<h5>Parameters:</h5>

<blockquote><span class="type">String</span> leaderboardID - Identifier of the leaderboard , maximum length 20 characters</blockquote>
<blockquote><span class="type">String</span> score - User score, accept range 0-9007199254740992 represented as string</blockquote>
<blockquote><span class="type">Boolean</span> forceUpdate - Force replace the highest score</blockquote>
<blockquote><span class="type">Function</span> callback - The function to call once the request has been processed</blockquote>
<h5>Returns:</h5>
<blockquote>None</blockquote>
<h5>Callback:</h5>
<blockquote><span class="type">Integer</span> returnCode - The integer identifies the status of the function call.</blockquote>
<blockquote><span class="type">String</span> returnMessage - The message describes the function status.</blockquote>
<h5>Example:</h5>
<pre class="prettyprint">
var wizqBootStrap = new WizQBootStrap();
wizqBootStrap.init(wizqConfig);
wizqBootStrap.registerOnLoadHandler(wqInit);

function wqInit()
{
    var leaderBoardID = 'topScore';
    var score = '12000'
    var forceUpdate = false;
    wqapi.submitScore(leaderBoardID,score,false,function(returnCode,returnMessage)
    {
	var output = document.getElementById('output');			
	output.innerHTML= 'returnCode ' + returnCode + ' returnMessage ' + returnMessage + '\n';
        if (returnCode == WizQAPI.ReturnCode.SUCCESS.code)
        {
            //success            
        }else
        {
            //Fail to submit
        }
    });
}
</pre> 
<form>
    <table>
        <tr>
            <td>Leaderboard ID</td><td><input type="text" id="submitScoreLeaderBoardID" value="score"  style="width:250px"/></td>
        </tr>
        <tr>
            <td>Score</td><td><input type="text" id="submitScoreScore" value="12000"  style="width:250px"/>0-9007199254740992</td>
        </tr>            
	<tr>
	    <td>Force Update</td><td><input type="checkbox" id="submitScoreForceUpdateCheckbox"/></td>
	</tr>        
        <tr>
            <td>&nbsp;</td><td><input type="button" value="Submit Score" onClick="submitScoreExample()"/></td>
        </tr>
    </table>
</form></div><div id="getUserRank"><script>
    function getUserRankExample()
    {
        var leaderBoardID = $('#getUserRankLeaderBoardID').val();
        var requestUserID = $('#getUserRankRequestUserID').val();
        wqapi.getUserRank(leaderBoardID,requestUserID,function(returnCode,returnMessage,rank)
        {
            var output = document.getElementById('output');			
            output.innerHTML= 'returnCode ' + returnCode + ' returnMessage ' + returnMessage + ' rank ' + rank + '\n';            
            if (returnCode == WizQAPI.ReturnCode.SUCCESS.code)
            {
                //success                
                $('#getUserRankResult').html(score);
            }else
            {                
                //Fail to get my score
            }
        });	 
    }
    $(function() {
        $('#tabs').on('tabsactivate',function(e,ui){
            var tabid = ui.newPanel.attr('id');            
            if(tabid == 'getUserRank')
            {
                wqapi.getSelfID(function(returnCode,returnMessage,userID)
                {
                    if (returnCode == WizQAPI.ReturnCode.SUCCESS.code)
                    {
                            $("#getUserRankRequestUserID").val(userID);
                    }	
                });                
            }
        }) 
    });    
</script>
<h3>getUserRank(leaderboardID, requestUserID, callback)</h3>
<p>Get user ranking from the leaderboard.</p>
<h5>Parameters:</h5>
<blockquote><span class="type">String</span> leaderboardID - Identifier of the leaderboard , maximum length 20 characters</blockquote>
<blockquote><span class="type">String</span> requestUserID - Identifier of the target user</blockquote>
<blockquote><span class="type">Function</span> callback - The function to call once the request has been processed</blockquote>
<h5>Returns:</h5>
<blockquote>None</blockquote>
<h5>Callback:</h5>
<blockquote><span class="type">Integer</span> returnCode - The integer identifies the status of the function call.</blockquote>
<blockquote><span class="type">String</span> returnMessage - The message describes the function status.</blockquote>
<blockquote><span class="type">Integer</span> rank - The rank of the requested user.</blockquote>
<h5>Example:</h5>
<pre class="prettyprint">
var wizqBootStrap = new WizQBootStrap();
wizqBootStrap.init(wizqConfig);
wizqBootStrap.registerOnLoadHandler(wqInit);

function wqInit()
{
    var leaderBoardID = 'topScore';
    var requestUserID = 'sb.yahoo-mbga.jp:23371';
    wqapi.getUserRank(leaderBoardID,requestUserID,function(returnCode,returnMessage,rank)
    {
        if (returnCode == WizQAPI.ReturnCode.SUCCESS.code)
        {
            //success
            alert('returnCode : ' + returnCode + ' returnMessage : ' + returnMessage + ' rank ' + rank);	
        }else
        {
            //Fail to get my rank
        }
    });
}
</pre> 
<form>
    <table>
        <tr>
            <td>Leaderboard ID</td><td><input type="text" id="getUserRankLeaderBoardID" value="score"  style="width:250px"/></td>
        </tr>
        <tr>
            <td>Request User ID</td><td><input type="text" id="getUserRankRequestUserID" value=""  style="width:250px"/></td>
        </tr>        
        <tr>
            <td>&nbsp;</td><td><input type="button" value="Get User Rank" onClick="getUserRankExample()"/></td>
        </tr>
        <tr>
            <td>User Rank</td><td><span id="getUserRankResult"/></td>
        </tr>        
    </table>
</form></div><div id="getSelfTopScore"><script>
    function getSelfTopScoreExample()
    {
	 var leaderBoardID = $('#getSelfTopScoreLeaderBoardID').val();
        wqapi.getSelfTopScore(leaderBoardID,function(returnCode,returnMessage,score)
        {
            var output = document.getElementById('output');			
            output.innerHTML= 'returnCode ' + returnCode + ' returnMessage ' + returnMessage + ' score ' + score + '\n';            
            if (returnCode == WizQAPI.ReturnCode.SUCCESS.code)
            {
                //success                
                $('#getSelfTopScoreResult').html(score);
            }else
            {                
                //Fail to get my score
            }
        });
    }
</script>
<h3>getSelfTopScore(leaderboardID, callback)</h3>
<p>Get current user top score in the leaderboard.</p>
<h5>Parameters:</h5>

<blockquote><span class="type">String</span> leaderboardID - Identifier of the leaderboard , maximum length 20 characters</blockquote>
<blockquote><span class="type">Function</span> callback - The function to call once the request has been processed</blockquote>
<h5>Returns:</h5>
<blockquote>None</blockquote>
<h5>Callback:</h5>
<blockquote><span class="type">Integer</span> returnCode - The integer identifies the status of the function call.</blockquote>
<blockquote><span class="type">String</span> returnMessage - The message describes the function status.</blockquote>
<blockquote><span class="type">String</span> score - The top score of the current user represented as string.</blockquote>
<h5>Example:</h5>
<pre class="prettyprint">
var wizqBootStrap = new WizQBootStrap();
wizqBootStrap.init(wizqConfig);
wizqBootStrap.registerOnLoadHandler(wqInit);

function wqInit()
{
    var leaderBoardID = 'topScore';
    wqapi.getSelfTopScore(leaderBoardID,function(returnCode,returnMessage,score)
    {
        if (returnCode == WizQAPI.ReturnCode.SUCCESS.code)
        {
            //success
            alert('returnCode : ' + returnCode + ' returnMessage : ' + returnMessage + ' score ' + score);	
        }else
        {
            //Fail to get my score
        }
    });
}
</pre> 
<form>
    <table>
        <tr>
            <td>Leaderboard ID</td><td><input type="text" id="getSelfTopScoreLeaderBoardID" value="score"  style="width:250px"/></td>
        </tr>
        <tr>
            <td>&nbsp;</td><td><input type="button" value="Get Self Top Score" onClick="getSelfTopScoreExample()"/></td>
        </tr>
        <tr>
            <td>Your top score</td><td><span id="getSelfTopScoreResult"/></td>
        </tr>        
    </table>
</form></div><div id="getUserTopScore"><script>
    function getUserTopScoreExample()
    {
        var leaderBoardID = $('#getUserTopScoreLeaderBoardID').val();
        var requestUserID = $('#getUserTopScoreRequestUserID').val();
        wqapi.getUserTopScore(leaderBoardID,requestUserID,function(returnCode,returnMessage,score)
        {
            var output = document.getElementById('output');			
            output.innerHTML= 'returnCode ' + returnCode + ' returnMessage ' + returnMessage + ' score ' + score + '\n';            
            if (returnCode == WizQAPI.ReturnCode.SUCCESS.code)
            {
                //success                
                $('#getUserTopScoreResult').html(score);
            }else
            {                
                //Fail to get my score
            }
        });	 
    }
    $(function() {
        $('#tabs').on('tabsactivate',function(e,ui){
            var tabid = ui.newPanel.attr('id');            
            if(tabid == 'getUserTopScore')
            {
                wqapi.getSelfID(function(returnCode,returnMessage,userID)
                {
                    if (returnCode == WizQAPI.ReturnCode.SUCCESS.code)
                    {
                            $("#getUserTopScoreRequestUserID").val(userID);
                    }	
                });                
            }
        }) 
    });    
</script>
<h3>getUserTopScore(leaderboardID, requestUserID, callback)</h3>
<p>Get user top score from the leaderboard.</p>
<h5>Parameters:</h5>
<blockquote><span class="type">String</span> leaderboardID - Identifier of the leaderboard , maximum length 20 characters</blockquote>
<blockquote><span class="type">String</span> requestUserID - Identifier of the target user</blockquote>
<blockquote><span class="type">Function</span> callback - The function to call once the request has been processed</blockquote>
<h5>Returns:</h5>
<blockquote>None</blockquote>
<h5>Callback:</h5>
<blockquote><span class="type">Integer</span> returnCode - The integer identifies the status of the function call.</blockquote>
<blockquote><span class="type">String</span> returnMessage - The message describes the function status.</blockquote>
<blockquote><span class="type">String</span> score - The top score of the current user represented as string.</blockquote>
<h5>Example:</h5>
<pre class="prettyprint">
var wizqBootStrap = new WizQBootStrap();
wizqBootStrap.init(wizqConfig);
wizqBootStrap.registerOnLoadHandler(wqInit);

function wqInit()
{
    var leaderBoardID = 'topScore';
    var requestUserID = 'sb.yahoo-mbga.jp:23371';
    wqapi.getUserTopScore(leaderBoardID,requestUserID,function(returnCode,returnMessage,score)
    {
        if (returnCode == WizQAPI.ReturnCode.SUCCESS.code)
        {
            //success
            alert('returnCode : ' + returnCode + ' returnMessage : ' + returnMessage + ' score ' + score);	
        }else
        {
            //Fail to get my score
        }
    });
}
</pre> 
<form>
    <table>
        <tr>
            <td>Leaderboard ID</td><td><input type="text" id="getUserTopScoreLeaderBoardID" value="score"  style="width:250px"/></td>
        </tr>
        <tr>
            <td>Request User ID</td><td><input type="text" id="getUserTopScoreRequestUserID" value=""  style="width:250px"/></td>
        </tr>        
        <tr>
            <td>&nbsp;</td><td><input type="button" value="Get User Top Score" onClick="getUserTopScoreExample()"/></td>
        </tr>
        <tr>
            <td>User top score</td><td><span id="getUserTopScoreResult"/></td>
        </tr>        
    </table>
</form></div><div id="getScores"><script>
    function getScoresExample()
    {
        var leaderBoardID = $('#getScoresLeaderBoardID').val();
        var startingRank = parseInt($('#getScoresStartingRank').val());
        var count = parseInt($('#getScoresCount').val());
        
        $("#getScoresResult").jqGrid('GridUnload');
	$("#getScoresResult").jqGrid({
	    datatype: "local",
	    height: 250,
	    colNames: ['Rank','User ID','Score'],
	    colModel: [	{name: 'rank', index: 'rank', width: 50 , sortable:false},
                        {name: 'userID', index: 'userID', width: 200 , sortable:false},
                        {name: 'score', index: 'score', width: 200 , sortable:false}],
	    multiselect: false}
	);        
        
        wqapi.getScores(leaderBoardID,startingRank,count,function(returnCode,returnMessage,scoreList)
        {
            var output = document.getElementById('output');			
                     
            if (returnCode == WizQAPI.ReturnCode.SUCCESS.code)
            {
                //success                
                var scoreInfoMsg = "";
                for(var i=0;i<scoreList.length;i++)
                {
                    var scoreInfo = scoreList[i];
                    $("#getScoresResult").jqGrid('addRowData', i + 1, scoreInfo)
                    scoreInfoMsg += "userID : " + scoreInfo.userID + " rank : " + scoreInfo.rank + " score : " + scoreInfo.score + "\n";
                    output.innerHTML= 'returnCode ' + returnCode + ' returnMessage ' + returnMessage + ' scoreInfo ' + scoreInfoMsg + '\n';   
                }
            }else
            {       
                output.innerHTML= 'returnCode ' + returnCode + ' returnMessage ' + returnMessage;
                //Fail to get my score
            }
        });	 
    }  
</script>
<h3>getScores(leaderboardID, requestUserID, callback)</h3>
<p>Get user top score from the leaderboard.</p>
<h5>Parameters:</h5>
<blockquote><span class="type">String</span> leaderboardID - Identifier of the leaderboard , maximum length 20 characters</blockquote>
<blockquote><span class="type">Integer</span> startingRank - A positive integer specifies the starting rank to be retrieved.</blockquote>
<blockquote><span class="type">Integer</span> count - The numbers of records to be retrieved.</blockquote>
<blockquote><span class="type">Function</span> callback - The function to call once the request has been processed</blockquote>
<h5>Returns:</h5>
<blockquote>None</blockquote>
<h5>Callback:</h5>
<blockquote><span class="type">Integer</span> returnCode - The integer identifies the status of the function call.</blockquote>
<blockquote><span class="type">String</span> returnMessage - The message describes the function status.</blockquote>
<blockquote><span class="type">Array</span> scoreList - Array of the score info object. The score info object contains 3 properties, rank Integer , userID String and score String.</blockquote>
<h5>Example:</h5>
<pre class="prettyprint">
var wizqBootStrap = new WizQBootStrap();
wizqBootStrap.init(wizqConfig);
wizqBootStrap.registerOnLoadHandler(wqInit);

function wqInit()
{
    var leaderBoardID = 'topScore';	
    var startingRank = 1;
    var count = 50;
    wqapi.getScores(leaderBoardID,startingRank,count,function(returnCode,returnMessage,scoreList)
    {
        if (returnCode == WizQAPI.ReturnCode.SUCCESS.code)
        {
            //success
            var scoreInfoMsg = "";
            for(var i=0;i&lt;scoreList.length;i++)
            {
                var scoreInfo = scoreList[i];
                scoreInfoMsg += "userID : " + scoreInfo.userID + " rank : " + scoreInfo.rank + " score : " + scoreInfo.score + "\n";
            }
            alert('returnCode : ' + returnCode + ' returnMessage : ' + returnMessage + ' scoreList' + scoreInfoMsg);	
        }else
        {
            //Fail to get score list
        }
    });
}
</pre> 
<form>
    <table>
        <tr>
            <td>Leaderboard ID</td><td><input type="text" id="getScoresLeaderBoardID" value="score"  style="width:250px"/></td>
        </tr>
        <tr>
            <td>Starting Rank</td><td><input type="text" id="getScoresStartingRank" value="1"  style="width:250px"/></td>
        </tr>
        <tr>
            <td>Count</td><td><input type="text" id="getScoresCount" value="50"  style="width:250px"/></td>
        </tr>         
        <tr>
            <td>&nbsp;</td><td><input type="button" value="Get User Rank" onClick="getScoresExample()"/></td>
        </tr>
	<tr>
	    <td>Result</td><td><table id="getScoresResult"></table></td>
	</tr>        
    </table>
</form></div>    
</div>
<div id="outputdiv">
	<div>Output :</div>
	<textarea id="output" style="width:100%;height:300px;"></textarea>
</div>


        <div class="wizq-scope">
            <div id="wizq-notice" data-project-id="749" data-notice-base-url="https://api.jp.dev.wizq.net/v2/notice" data-css="https://api.jp.dev.wizq.net/v2/build/assets/notice-CFewdiu0.css"></div>
        </div>
        ]]></Content>
</Module>
