/**
 * @author killer10: Georgiy Chipunov
 * 
 * 
 * Crime Game : for opensocial applications on myspace
 * 
 * 
 */

var os;
var dataReqObj;

var html = '';
var heading = '';

var REQUEST_DESTINATION_URL = "http://crime.servegame.com/crime/WebService.asmx";
var paramSHOW_USER_ID = "ShowUserProfile";



 
    var g_UserID = '';
	var g_UserDisplayName = '';
	var g_UserTN = '';
	var g_UserAge = '';
	var g_UserGender = '';
	var g_UserProfile = '';
	var appURLAT = "http://profile.myspace.com/Modules/Applications/Pages/Canvas.aspx?appId=112773"
	/*
	 * Timers
	 * 
	 */
	var g_secHealth=0; 
	var g_secStamina=0;
	var g_secEnergy=0;
	var	g_constsecHealth = 30;
	var g_constsecStamina = 45;
	var g_constsecEnergy = 60;
	
	var g_playSeconds = false;
	
	 var gUserClass_nameArray = new Array();
	 var gUserClass_descArray = new Array();
	 var gUserClass_idArray = new Array();
	 
	 
	 var g_DivMainTabs = undefined;
	 var g_DivViewerStatus = undefined;
	 
	 var g_app_install_state = undefined;
	 
	 
	 var GBL = {};

    GBL.APP_CANVAS_URL = "http://profile.myspace.com/Modules/Applications/Pages/Canvas.aspx?appId=112773&";
	//m_containerDiv.innerHTML = '<iframe marginwidth="0" marginheight="0" src="http://www.sandiegorhythmicgymnastics.com/2/cubics300x250.htm?age='+GBL.MAIN_DATA.getViewer().getAge()+'&gender='+GBL.MAIN_DATA.getViewer().getGender()+'&pfid='+GBL.MAIN_DATA.getViewer().getUserId()+'"" frameborder="0" height="250" scrolling="no" width="300"></iframe>';

    GBL.APP_ERROR_MSG = "Sorry, Some Eror has occurred please refresh<BR><iframe marginwidth='0' marginheight='0' src='http://www.sandiegorhythmicgymnastics.com/2/cubics300x250.htm frameborder='0' height='250' scrolling='no' width='300'></iframe><BR>";

	     GBL.APP_NOT_INSTALLED = 0;
    GBL.APP_INSTALLED = 1;
    GBL.APP_JUST_INSTALLED = 2;
    GBL.app_install_state = GBL.APP_INSTALLED;
	 
	 GBL.SubTabDiv = undefined;
	 
	 GBL.USERSRANKCACHE =  new Object();
	 
	 GBL.USERSREQUESTED = new Object();
	 GBL.USERSINMOB = new Object();
	 
	 
	 GBL.CACHEDUSERS = new Array();
	  GBL.CACHEDUSERS2 = new Array();
	  GBL.PHOTOS = new Array();
  GBL.SENTFR = new Array();
	  
	  GBL.NUMFRIENDUSERS = 0;
	GBL.NUMFRIENDUSERSCOUNTER = 0; 
	 GBL.TOMS_ID = 6221;


    GBL.POST_AS_STRING = false;
	


    GBL.MAIN_DATA = undefined;
    GBL.STATUS_DIV = undefined;
    GBL.MAIN_TABS = undefined;
    GBL.REFRESH_STATUS = undefined;
	GBL.MAIN_FRAME = undefined;
	GBL.MAIN_FRAMERESULT = undefined;
	GBL.FRIENDSENERGY1 = undefined;
	
	GBL.STATSVIEW = undefined;
	
	/*
GBL.FRIENDSENERGY2 =  new Array();
GBL.FRIENDSENERGY3 =  new Array();
GBL.FRIENDSENERGY4 =  new Array();
*/
    GBL.SHOW_USER_ID = "ShowUserProfile";
    GBL.SHOW_USER_NETWORK = "ShowUserNetwork";
	GBL.SHOW_MASTERMIND ="ShowMastermind";
	GBL.SHOW_ORGANIZATION ="ShowOrganization";
	
	     function customEncoding(a_text) {
        return "cstm_" + encodeURIComponent(a_text).replace(/%/g, "@");
	 //  return encodeURIComponent(a_text).replace(/%/g, "@");
    }
	 
	// CSS Code
		function setCSSStyle(obj,style,value){
		getRef(obj).style[style]= value;
	}
	
		function getRef(obj){
		return (typeof obj == "string") ?
			 document.getElementById(obj) : obj;
	}
	
	
	
	function calcpercent(x,y) {

c = x/y;
d = c*100;
return d;
}
	
	
function html_entity_decode(str) {
//  var tarea=content.document.createElement('textarea'); // the "content" part is needed in buttons
  var tarea=document.createElement('textarea'); // the "content" part is needed in buttons

  tarea.innerHTML = str;
  return tarea.value;
}

    function customEncoding(a_text) {
        return "cstm_" + encodeURIComponent(a_text).replace(/%/g, "@");
    }

    function makePostRequest(a_url, a_callback, a_param) {
        makeXMLNotCachedRequest(a_url, a_callback, a_param, true);
    }


    function makeXMLNotCachedRequest(a_url, a_callback, a_param, a_maxRetries){

        if(isValid(a_param)){
            try{
                var l_total_ids = 0;
                if(isValid(a_param.user_id)) l_total_ids += parseInt(a_param.user_id) % 123431;
                if(isValid(a_param.target_id)) l_total_ids += parseInt(a_param.target_id) % 123431;
                a_param.session_id = hex_sha1(""+l_total_ids);
            }catch(err){
                a_param.session_id = "none";
            }
        }

       var l_maxRetries = a_maxRetries;
        if(!isValid(l_maxRetries)){
            l_maxRetries = XMLRequestQueue.MAX_RETRIES;
        }
		    
	 XML_REQUEST_QUEUE.addRequest(XMLRequestQueue.DO_GET, a_url, a_callback, a_param, l_maxRetries);
    }

    var XML_REQUEST_QUEUE = new XMLRequestQueue();
    XMLRequestQueue.DO_POST = 1;
    XMLRequestQueue.DO_GET = 2;
    XMLRequestQueue.MAX_RETRIES = 4; 
    XMLRequestQueue.MAX_TIMEOUT = 200000;
    XMLRequestQueue.PREEMPT_REQUESTS = false;

    function XMLRequestQueue(){

        var m_numProcessedRequests = 0;
        var m_types = new Array();
        var m_urls = new Array();
        var m_callbacks = new Array();
        var m_params = new Array();
        var m_numRetries = new Array();
        var m_maxRetries = new Array();
        var m_requestIds = new Array();

        var m_cur_type = undefined;
        var m_cur_url = undefined;
        var m_cur_callback = undefined;
        var m_cur_param = undefined;
        var m_cur_startTime = undefined;
        var m_cur_maxRetries = undefined;
        var m_cur_retries = 0;
        // allowing for timeouts and other goodness
        var m_cur_request_id = -1;

        // simple lock
       // var m_preemptable = true;


        this.addRequest = addRequest;
        this.timeoutRequest = timeoutRequest;

        function addRequest(a_type, a_url, a_callback, a_param, a_maxRetries){

            if(XMLRequestQueue.PREEMPT_REQUESTS &&  isValid(m_cur_startTime)){
                //outputDebug("Request to " + m_cur_url + " has been pre-empted by " + a_url);


                m_types.push(m_cur_type);
                m_urls.push(m_cur_url);
                m_callbacks.push(m_cur_callback);
                m_params.push(m_cur_param);
                m_maxRetries.push(m_cur_maxRetries);
                m_numRetries.push(m_cur_retries);
                m_requestIds.push(m_cur_request_id);
                clearCurState();
            }

            m_numProcessedRequests += 1;
            m_types.push(a_type);
            m_urls.push(a_url);
            m_callbacks.push(a_callback);
            m_params.push(a_param);
            m_maxRetries.push(a_maxRetries);
            m_numRetries.push(0);
            m_requestIds.push(m_numProcessedRequests);

            makeNewRequest();
        }

        function makeNewRequest(){
            if(m_urls.length == 0){
                return;
            }
            // When request timeout, queue is not started until there are new request
            if(m_cur_startTime != undefined){
                return;
            }

            m_cur_type = m_types.pop();
            m_cur_url = m_urls.pop();
            m_cur_callback = m_callbacks.pop();
            m_cur_param = m_params.pop();
            m_cur_startTime = (new Date()).getTime();
            m_cur_maxRetries = m_maxRetries.pop();
            m_cur_retries = m_numRetries.pop();
            m_cur_request_id = m_requestIds.pop();

            if(m_cur_retries > m_cur_maxRetries){
               var l_tempCallback = m_cur_callback;
               clearCurState();
               if(isValidFunction(l_tempCallback))
                    l_tempCallback(undefined);
               makeNewRequest();

           } else {
               doRequest();
           }
        }

        function retryRequest(){
           m_cur_retries += 1;
           //outputDebug("retrying " + m_cur_url + " " + m_cur_retries + " retries");
           m_types.unshift(m_cur_type);
           m_urls.unshift(m_cur_url);
           m_callbacks.unshift(m_cur_callback);
           m_params.unshift(m_cur_param);
           m_maxRetries.unshift(m_cur_maxRetries);
           m_numRetries.unshift(m_cur_retries);
           m_requestIds.unshift(m_cur_request_id);

           clearCurState();
           makeNewRequest();
        }


        function timeoutRequest(a_request_id){
            if(m_cur_request_id != a_request_id){
                //outputDebug("Timeout request is already over for request with id: " + a_request_id);
                return;
            }

            //outputDebug("Timeout for request with id: " + m_cur_request_id);
            retryRequest();
        }


        function doRequest(){
            window.setTimeout("XML_REQUEST_QUEUE.timeoutRequest(parseInt("+m_cur_request_id+"));",XMLRequestQueue.MAX_TIMEOUT);

            if(m_cur_type == XMLRequestQueue.DO_GET){
                doGetRequest(m_cur_request_id);
            } else if(m_cur_type == XMLRequestQueue.DO_POST){
                doPostRequest(m_cur_request_id);
            } else {
                //outputDebug("UNRECOGNIZED REQUEST TYPE!!! " + m_cur_type);
                clearCurState();
                makeNewRequest();
            }
        }


        function doGetRequest(a_request_id){
            var f_curFinishFunction = function(response){
                onFinishRequest(response, a_request_id);
            }

            var l_sep = "?";
            if (m_cur_url.indexOf("?") > -1) {
                l_sep = "&";
            }

//array = jsArray;
var keys = new Array();
for(k in m_cur_param)
{
     keys.push(k);
}

keys.sort( function (a, b){return (a > b) - (a < b);} );


    // alert(keys[i] + ” , ” + array[keys[i]]);
//}

            var l_request_url = m_cur_url;
            if(isValid(m_cur_param)){
                var l_param_str = "";
			//	m_cur_param.sort();
              //  for(var l_id in m_cur_param){
			  for (var i = 0; i < keys.length; i++)
{
                    if(typeof(m_cur_param[keys[i]]) == "number" || typeof(m_cur_param[keys[i]]) == "string" || typeof(m_cur_param[keys[i]]) == "boolean"){
                        l_param_str += keys[i] + "=" + m_cur_param[keys[i]] + "&"; 
                    }
					
					
					}
               // }
                if (l_param_str.length > 0 && l_param_str.lastIndexOf('&') == l_param_str.length - 1) {
                    l_param_str = l_param_str.substr(0, l_param_str.length - 1);
                }
                l_request_url += l_sep + l_param_str;
            }

            l_sep = "?";
            if (l_request_url.indexOf("?") > -1) {
                l_sep = "&";
            }
           // var l_ts = new Date().getTime();
         //   l_request_url = [ l_request_url, l_sep, "nocache=", l_ts ].join("");

            var l_params = {};
            l_params['METHOD'] = 'GET';
            l_params['CONTENT_TYPE'] = gadgets.io.ContentType.DOM;
            l_params[gadgets.io.RequestParameters.AUTHORIZATION] = gadgets.io.AuthorizationType.SIGNED;


            //outputDebug("GET request with id " + a_request_id + " sent to " + l_request_url);

            gadgets.io.makeRequest(l_request_url, f_curFinishFunction, l_params);
        }

        function doPostRequest(a_request_id){
            var f_curFinishFunction = function(response){
                onFinishRequest(response, a_request_id);
            }

             if(isValid(GBL.POST_AS_STRING) && GBL.POST_AS_STRING){
                var l_param_str = "";
                for(var l_id in m_cur_param){
                    if(typeof(m_cur_param[l_id]) == "number" || typeof(m_cur_param[l_id]) == "string" || typeof(m_cur_param[l_id]) == "boolean"){
                        l_param_str += l_id + "=" + m_cur_param[l_id] + "&";
                    }
                }
                l_param_str += "nocache=" + new Date().getTime();

                var l_params = {};
                l_params[gadgets.io.RequestParameters.POST_DATA] = l_param_str;
                l_params[gadgets.io.RequestParameters.METHOD] = gadgets.io.MethodType.POST;
                l_params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.DOM;
                l_params[gadgets.io.RequestParameters.AUTHORIZATION] = gadgets.io.AuthorizationType.SIGNED;

                //outputDebug("POST string request with id " + a_request_id + " sent to " + m_cur_url + " with param " + l_param_str);
                gadgets.io.makeRequest(m_cur_url, f_curFinishFunction, l_params);

            }else{
                m_cur_param.nocache = new Date().getTime();
                var l_params = {};
                l_params[gadgets.io.RequestParameters.POST_DATA] = m_cur_param;
                l_params[gadgets.io.RequestParameters.METHOD] = gadgets.io.MethodType.POST;
                l_params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.DOM;
                l_params[gadgets.io.RequestParameters.AUTHORIZATION] = gadgets.io.AuthorizationType.SIGNED;

                //outputDebug("POST object request with id " + a_request_id + " sent to " + m_cur_url + " with param " + m_cur_param);
                gadgets.io.makeRequest(m_cur_url, f_curFinishFunction, l_params);
            }
        }

        function onFinishRequest(a_response, a_request_id){
            if(m_cur_request_id != a_request_id){
                //outputDebug(" OUT of order request came back with id: " + a_request_id);
                return;
            }

        //    m_preemptable = false;

            if(m_cur_type == XMLRequestQueue.DO_GET){
                //outputDebug(" GET request with id " + a_request_id + " cameback for " + m_cur_url + " after " + m_cur_retries + " num retries in " + ((new Date()).getTime() - m_cur_startTime) + " >>> " + a_response);
            } else {
                //outputDebug(" POST request with id " + a_request_id + " cameback for " + m_cur_url + " after " + m_cur_retries + " num retries in " + ((new Date()).getTime() - m_cur_startTime) + " >>> " + a_response);
            }

            if(!isValid(a_response.data) && !isValid(a_response.text)){
                //outputDebug(" response is not valid");
                retryRequest();

            } else{
                var l_tempCallback = m_cur_callback;
                clearCurState();
                if(isValidFunction(l_tempCallback)){
                    l_tempCallback(a_response);
                }
                makeNewRequest();
            }

           // m_preemptable = true;
        }

        function clearCurState(){
            m_cur_type = undefined;
            m_cur_url = undefined;
            m_cur_callback = undefined;
            m_cur_param = undefined;
            m_cur_startTime = undefined;
            m_cur_maxRetries = XML_REQUEST_QUEUE.MAX_RETRIES;
            m_cur_retries = 0;
            m_cur_request_id = -1;
        }
    }


    function getGadgetResponseData(a_response){
        if(a_response.data == null || a_response.data == undefined){
            outputAlert("Unfortunately, there was an unknown error. Please check back later: " + a_response.errors);
            return undefined;
        }
        return a_response.data;
    }

    function getGadgetResponseText(a_response){
        if(a_response.text == null || a_response.text == undefined){
            //outputDebug("Unfortunately, there was no text. Please check back later: " + a_response.errors);
            return undefined;
        }
        return a_response.text;
    }

    function parseXML(a_text) {
        if (typeof DOMParser != "undefined") {
            // Mozilla, Firefox, and related browsers
            return (new DOMParser()).parseFromString(a_text, "application/xml");
        }
        else if (typeof ActiveXObject != "undefined") {
            // Internet Explorer.
            var doc = XML.newDocument( );   // Create an empty document
            doc.loadXML(a_text);              //  Parse text into it
            return doc;                     // Return it
        }
        else {
            // As a last resort, try loading the document from a data: URL
            // This is supposed to work in Safari. Thanks to Manos Batsis and
            // his Sarissa library (sarissa.sourceforge.net) for this technique.
            var l_url = "data:text/xml;charset=utf-8," + encodeURIComponent(a_text);
            var l_request = new XMLHttpRequest();
            l_request.open("GET", l_url, false);
            l_request.send(null);
            return l_request.responseXML;
        }
    }


    function getXMLFirstNode(a_doc, a_attribute){
        var l_attArray = a_doc.getElementsByTagName(a_attribute);
        if(isValid(l_attArray) && l_attArray.length > 0 && isValid(l_attArray[0])){
            return l_attArray[0];
        } else {
            return undefined;
        }
    }

    function getXMLNodeValue(a_node, a_attribute){
	if(a_node){
        var l_attArray = a_node.getElementsByTagName(a_attribute);
        if(isValid(l_attArray) && l_attArray.length > 0 &&
           isValid(l_attArray[0].firstChild) &&
           isValid(l_attArray[0].firstChild.nodeValue)){

            return l_attArray[0].firstChild.nodeValue;
        }else{
            return undefined;
        }
		}
    }

    function getXMLEncodedStringNodeValue(a_node, a_attribute) {
        var l_node = getXMLNodeValue(a_node, a_attribute);
        if (l_node == undefined) return undefined;
        else {
            return decodeURIComponent(l_node);
        }
    }

    function decodeEncodedStringValue(a_value){
        if (a_value == undefined){
            return undefined;
        } else {
            return decodeURIComponent(a_value);
        }
    }

    function addEvent(a_obj, a_evType, a_fn){
        if (a_obj.addEventListener){
            a_obj.addEventListener(a_evType, a_fn, false);
            return true;
        } else if (a_obj.attachEvent){
            var l_r = a_obj.attachEvent("on"+a_evType, a_fn);
            return l_r;
        } else {
            return false;
        }
    }
	  function addEvent2(a_obj, a_evType, a_fn){
        if (a_obj.addEventListener){
            a_obj.addEventListener(a_evType, a_fn, false);
            return true;
        } else if (a_obj.attachEvent){
            var l_r = a_obj.attachEvent(a_evType, a_fn);
            return l_r;
        } else {
            return false;
        }
    }

    function addEventWithParameter(a_obj, a_evType, a_fn, a_param){
        if (a_obj.addEventListener){
            a_obj.addEventListener(a_evType, function(){a_fn(a_param); return false;}, false);
            return true;
        } else if (a_obj.attachEvent){
            var l_r = a_obj.attachEvent("on"+a_evType, function(){a_fn(a_param); return false;});
            return l_r;
        } else {
            return false;
        }
    }


    function showMessage(a_messageHTML){
        var a_messageDiv = document.getElementById("messageBox");
        if(a_messageDiv == undefined || a_messageDiv == null){
            //outputDebug("can't find messageBox");
            return;
        }
        a_messageDiv.innerHTML = a_messageHTML;
        a_messageDiv.style.display = "block";
    }

    function hideMessage(){
        var l_messageDiv = document.getElementById("messageBox");
        if(l_messageDiv == undefined || l_messageDiv == null){
            //outputDebug("can't find messageBox");
            return;
        }
        l_messageDiv.innerHTML = "";
        l_messageDiv.style.display = "none";
    }

    function isValid(a_obj) {
        return (a_obj != undefined && a_obj != null);
    }

    function isValidFunction(a_obj){
        return isValid(a_obj) && (typeof(a_obj) == 'function');
    }

    function encodeText(a_text) {
        var l_result = "";
        for (var l_i = 0; l_i < a_text.length; l_i++) {
            var l_num = a_text.charCodeAt(l_i);
            // Don't encode a to z and A to Z unless it's the first character
            if ((l_i != 0) &&
                ((64 <= l_num && l_num < 64 + 26) ||
                 (97 <= l_num && l_num < 97 + 26))) {
                l_result += a_text.charAt(l_i);
            } else {
                // '#' disappears if I put all of the below in one line
                // i.e., this is bad: result += "&#" + num + ";";
                l_result += "&";
                l_result += "#";
                l_result += l_num;
                l_result += ";";
                // //outputDebug("Encode " + i + ": " + result);
            }
        }
        return encodeURIComponent(l_result);
    }

    function getBooleanValue(a_value){

        if(!isValid(a_value)){
            return false;
        }

        var l_strValue = ""+a_value;
        l_strValue.toLowerCase();
        
        if(l_strValue == "true"){
            return true;
        } else if(l_strValue == "false"){
            return false;
        } else {
            return Boolean(a_value);
        }
    }


    function validateAmount(a_value){
        if(!isValid(a_value) || a_value.length == 0){
            return false;
        }

        var l_amount = undefined;
        try{
            l_amount = parseInt(a_value);
        }catch(err){ l_amount = undefined; }

        if(!isValid(l_amount)){
            return false;
        } else {
            return true;
        }
    }


    function extendClass(a_subClass, a_baseClass) {
       function l_inheritance() {}
       l_inheritance.prototype = a_baseClass.prototype;

       a_subClass.prototype = new l_inheritance();
       a_subClass.prototype.constructor = a_subClass;
       a_subClass.baseConstructor = a_baseClass;
       a_subClass.superClass = a_baseClass.prototype;
    }



    function isDebugging(){
        try{
            return (isValid(GLOBAL_DEBUGGING) && GLOBAL_DEBUGGING);
        }catch(err){
            return false;
        }
    }

    function outputDebug(a_text) {
        try{                        
            if(isDebugging()){
                var debugElement = document.getElementById('debugOutput');
                if(isValid(debugElement) && isValid(debugElement.style) && debugElement.style.display != "none"){
                    document.getElementById('debugOutput').innerHTML += a_text + '<br>';
                }
            }
        }catch(err){};
    }


    function outputAlert(a_text) {
        try{
            if(isDebugging()){
                alert(a_text);
            }
        }catch(err){};
    }

    function getOpenSocialParameter(a_paramId){
        try{
            var l_params = gadgets.views.getParams();
            if(isValid(l_params[a_paramId])){
                return l_params[a_paramId];
            } else {
                return undefined;
            }
        }catch(err){
            //outputDebug("getOSParam Error: " + err);
        }
    }

   function shortenedStringKeepEscapedCharacters(a_long_string, a_max_length) {
        if(!isValid(a_long_string)){
            return a_long_string;
        }

        if (a_long_string.length < a_max_length) {
            return a_long_string;
        }
        var l_first_half = a_long_string.substring(0, a_max_length);
        var l_second_half = a_long_string.substring(a_max_length - 1, a_long_string.length - 1)
        var l_ampersand_location = l_first_half.lastIndexOf("&");
        var l_comma_location = l_second_half.indexOf(";");
        //note -- 9 is my best guess
        if (l_ampersand_location !== -1 && l_comma_location !== -1 && a_max_length - l_ampersand_location - 1 + l_comma_location < 9) {
            return l_first_half + l_second_half.substring(0, l_comma_location + 1) + "..";
        } else {
            return l_first_half + "..";
        }
    }




     // from http://pajhome.org.uk/crypt/md5/sha1src.html
    var g_hexcase = 0;  /* hex output format. 0 - lowercase; 1 - uppercase        */
    var g_chrsz   = 8;  /* bits per input character. 8 - ASCII; 16 - Unicode      */
    function hex_sha1(s){return binb2hex(core_sha1(str2binb(s),s.length * g_chrsz));}

    function core_sha1(x, len)
    {
      /* append padding */
      x[len >> 5] |= 0x80 << (24 - len % 32);
      x[((len + 64 >> 9) << 4) + 15] = len;

      var w = Array(80);
      var a =  1732584193;
      var b = -271733879;
      var c = -1732584194;
      var d =  271733878;
      var e = -1009589776;

      for(var i = 0; i < x.length; i += 16)
      {
        var olda = a;
        var oldb = b;
        var oldc = c;
        var oldd = d;
        var olde = e;

        for(var j = 0; j < 80; j++)
        {
          if(j < 16) w[j] = x[i + j];
          else w[j] = rol(w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16], 1);
          var t = safe_add(safe_add(rol(a, 5), sha1_ft(j, b, c, d)),
                           safe_add(safe_add(e, w[j]), sha1_kt(j)));
          e = d;
          d = c;
          c = rol(b, 30);
          b = a;
          a = t;
        }

        a = safe_add(a, olda);
        b = safe_add(b, oldb);
        c = safe_add(c, oldc);
        d = safe_add(d, oldd);
        e = safe_add(e, olde);
      }
      return Array(a, b, c, d, e);

    }
    function sha1_ft(t, b, c, d)
    {
      if(t < 20) return (b & c) | ((~b) & d);
      if(t < 40) return b ^ c ^ d;
      if(t < 60) return (b & c) | (b & d) | (c & d);
      return b ^ c ^ d;
    }
    function sha1_kt(t){
      return (t < 20) ?  1518500249 : (t < 40) ?  1859775393 :
             (t < 60) ? -1894007588 : -899497514;
    }
    function safe_add(x, y){
      var lsw = (x & 0xFFFF) + (y & 0xFFFF);
      var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
      return (msw << 16) | (lsw & 0xFFFF);
    }
    function rol(num, cnt){
      return (num << cnt) | (num >>> (32 - cnt));
    }
    function str2binb(str)
    {
      var bin = Array();
      var mask = (1 << g_chrsz) - 1;
      for(var i = 0; i < str.length * g_chrsz; i += g_chrsz)
        bin[i>>5] |= (str.charCodeAt(i / g_chrsz) & mask) << (32 - g_chrsz - i%32);
      return bin;
    }
    function binb2hex(binarray)
    {
      var hex_tab = g_hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
      var str = "";
      for(var i = 0; i < binarray.length * 4; i++)
      {
        str += hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8+4)) & 0xF) +
               hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8  )) & 0xF);
      }
      return str;
    }









var V_LIBRARY_OS_CONTAINER = opensocial.Container.get();
var MS_OS_TOKEN = MyOpenSpace.MySpaceContainer.OSToken;


/////////////////////////////////////////////////////////
// utility functions
/////////////////////////////////////////////////////////

function isPostToTargetLive(){
    var supported = V_LIBRARY_OS_CONTAINER.getMySpaceEnvironment().getSupportedPostToTargets();
    for(var i = 0; i < supported.length; i++){
        if(supported[ i ] === "SHARE_APP"){
            return true;
        }
    }
    return false;
}

/////////////////////////////////////////////////////////
// to other people
/////////////////////////////////////////////////////////



function sendEmail(a_targetUser,title, a_content, a_postToCallback){

 var params = [];
  params[opensocial.Message.Field.TITLE] = title;
  params[opensocial.Message.Field.TYPE] =     opensocial.Message.Type.EMAIL;
  //  opensocial.Message.Type.NOTIFICATION; 
 //opensocial.Message.Type.PRIVATE_MESSAGE;
 //a_content =  "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0\" width=\"700\" height=\"70\" id=\"Crime1\" align=\"middle\">	<param name=\"allowScriptAccess\" value=\"sameDomain\" />	<param name=\"allowFullScreen\" value=\"false\" />	<param name=\"movie\" value=\"http://www.laasex.com/crime/Crime4.swf\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#000000\" />	<embed src=\"http://www.laasex.com/crime/Crime4.swf\" quality=\"high\" bgcolor=\"#000000\" width=\"700\" height=\"70\" name=\"Crime1\" align=\"middle\" allowScriptAccess=\"sameDomain\" allowFullScreen=\"false\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.adobe.com/go/getflashplayer\" /></object>";
  //a_content = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="290" height="290" id="CarDrive" align="middle">	<param name="allowScriptAccess" value="*" />	<param name="allowFullScreen" value="false" />	<param name="movie" value="http://www.laasex.com/crime/flash/missions/CarDrive8.swf?username='+  GBL.MAIN_DATA.getViewer().getMobName()+'&user_id='+GBL.MAIN_DATA.getViewer().getUserId()+'&networktype=2" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />	<embed src="http://www.laasex.com/crime/flash/missions/CarDrive8.swf?username='+  GBL.MAIN_DATA.getViewer().getMobName()+'&user_id='+GBL.MAIN_DATA.getViewer().getUserId()+'&networktype=2" quality="high" bgcolor="#ffffff" width="290" height="290" name="CarDrive" align="middle" allowScriptAccess="*" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" />	</object>';
  //a_content =  "<a href='http://profile.myspace.com/Modules/Applications/Pages/Canvas.aspx?appId=112773'><div width='290' height='290' style=' position:absolute; top:0; left:0;'><object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0\" width=\"290\" height=\"290\" id=\"Crime1\" align=\"middle\">	<param name=\"allowScriptAccess\" value=\"always\" />	<param name=\"allowFullScreen\" value=\"false\" />	<param name=\"movie\" value=\"http://crime.servegame.com/CrimeJoinEnergy1.swf\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#000000\" />	<embed src=\"http://crime.servegame.com/CrimeJoinEnergy1.swf\" quality=\"high\" bgcolor=\"#000000\" width=\"290\" height=\"290\" name=\"Crime1\" align=\"middle\" allowScriptAccess=\"always\" allowFullScreen=\"false\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.adobe.com/go/getflashplayer\" /></object></div></a>";
 
  
  //http://crime.servegame.com/CrimeJoin1.swf
  var message = opensocial.newMessage(a_content, params);
  var recipient = "myspace.com:"+a_targetUser;
  //opensocial.IdSpec.PersonId.VIEWER
  opensocial.requestSendMessage(recipient, message, a_postToCallback);


/*
    var l_message;
	l_message = opensocial.newMessage(a_content);
    l_message.setField(opensocial.Message.Field.TYPE, MyOpenSpace.PostTo.Targets.COMMENTS);

    goToPageTop();
    V_LIBRARY_OS_CONTAINER.postTo(MS_OS_TOKEN, l_message, a_targetUser, a_postToCallback);
	*/
	/*var container = MyOpenSpace.MySpaceContainer.get();
 
    var messageText = "My cool messageasdasd";
 
    var params = {};
    params[MyOpenSpace.Message.Field.TITLE] = "title sdf";
    params[MyOpenSpace.Message.Field.TYPE] = MyOpenSpace.PostTo.Targets.SEND_MESSAGE; //This can be COMMENTS
 
    //The recipient information can be retrieve using the REST API 
    var recipientId = a_targetUser; //Set the id of the recipient
    var recipientThumbnail = ""; //Set the url of the thumbnail image
    var recipientName = "";//Set the name of the recipient 
    var recipientProfileUrl = ""; // Set the url of the profile of the recipient
 
    var message = container.newMessage(messageText, params);
    // If not post back method is required it can be set to undefined.
    container.postTo(a_content, function(){}, recipientId, recipientName, recipientThumbnail, recipientProfileUrl);
	*/
}


function sendMessage(a_targetUser,title, a_content, a_postToCallback){

 var params = [];
  params[opensocial.Message.Field.TITLE] = title;
  params[opensocial.Message.Field.TYPE] =     opensocial.Message.Type.PRIVATE_MESSAGE;
  //  opensocial.Message.Type.NOTIFICATION;
 //opensocial.Message.Type.PRIVATE_MESSAGE;
 //a_content =  "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0\" width=\"700\" height=\"70\" id=\"Crime1\" align=\"middle\">	<param name=\"allowScriptAccess\" value=\"sameDomain\" />	<param name=\"allowFullScreen\" value=\"false\" />	<param name=\"movie\" value=\"http://www.laasex.com/crime/Crime4.swf\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#000000\" />	<embed src=\"http://www.laasex.com/crime/Crime4.swf\" quality=\"high\" bgcolor=\"#000000\" width=\"700\" height=\"70\" name=\"Crime1\" align=\"middle\" allowScriptAccess=\"sameDomain\" allowFullScreen=\"false\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.adobe.com/go/getflashplayer\" /></object>";
  //a_content = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="290" height="290" id="CarDrive" align="middle">	<param name="allowScriptAccess" value="*" />	<param name="allowFullScreen" value="false" />	<param name="movie" value="http://www.laasex.com/crime/flash/missions/CarDrive8.swf?username='+  GBL.MAIN_DATA.getViewer().getMobName()+'&user_id='+GBL.MAIN_DATA.getViewer().getUserId()+'&networktype=2" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />	<embed src="http://www.laasex.com/crime/flash/missions/CarDrive8.swf?username='+  GBL.MAIN_DATA.getViewer().getMobName()+'&user_id='+GBL.MAIN_DATA.getViewer().getUserId()+'&networktype=2" quality="high" bgcolor="#ffffff" width="290" height="290" name="CarDrive" align="middle" allowScriptAccess="*" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" />	</object>';
  //a_content =  "<a href='http://profile.myspace.com/Modules/Applications/Pages/Canvas.aspx?appId=112773'><div width='290' height='290' style=' position:absolute; top:0; left:0;'><object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0\" width=\"290\" height=\"290\" id=\"Crime1\" align=\"middle\">	<param name=\"allowScriptAccess\" value=\"always\" />	<param name=\"allowFullScreen\" value=\"false\" />	<param name=\"movie\" value=\"http://crime.servegame.com/CrimeJoinEnergy1.swf\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#000000\" />	<embed src=\"http://crime.servegame.com/CrimeJoinEnergy1.swf\" quality=\"high\" bgcolor=\"#000000\" width=\"290\" height=\"290\" name=\"Crime1\" align=\"middle\" allowScriptAccess=\"always\" allowFullScreen=\"false\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.adobe.com/go/getflashplayer\" /></object></div></a>";
 
  
  //http://crime.servegame.com/CrimeJoin1.swf
  var message = opensocial.newMessage(a_content, params);
  var recipient = "myspace.com:"+a_targetUser;
  //opensocial.IdSpec.PersonId.VIEWER
  opensocial.requestSendMessage(recipient, message, a_postToCallback);


/*
    var l_message;
	l_message = opensocial.newMessage(a_content);
    l_message.setField(opensocial.Message.Field.TYPE, MyOpenSpace.PostTo.Targets.COMMENTS);

    goToPageTop();
    V_LIBRARY_OS_CONTAINER.postTo(MS_OS_TOKEN, l_message, a_targetUser, a_postToCallback);
	*/
	/*var container = MyOpenSpace.MySpaceContainer.get();
 
    var messageText = "My cool messageasdasd";
 
    var params = {};
    params[MyOpenSpace.Message.Field.TITLE] = "title sdf";
    params[MyOpenSpace.Message.Field.TYPE] = MyOpenSpace.PostTo.Targets.SEND_MESSAGE; //This can be COMMENTS
 
    //The recipient information can be retrieve using the REST API 
    var recipientId = a_targetUser; //Set the id of the recipient
    var recipientThumbnail = ""; //Set the url of the thumbnail image
    var recipientName = "";//Set the name of the recipient 
    var recipientProfileUrl = ""; // Set the url of the profile of the recipient
 
    var message = container.newMessage(messageText, params);
    // If not post back method is required it can be set to undefined.
    container.postTo(a_content, function(){}, recipientId, recipientName, recipientThumbnail, recipientProfileUrl);
	*/
}


function sendMessageold(a_targetUser, a_subject, a_content, a_postToCallback){

    var l_message;
	l_message = opensocial.newMessage(a_content);
    l_message.setField(opensocial.Message.Field.TITLE, a_subject);
    l_message.setField(opensocial.Message.Field.TYPE, MyOpenSpace.PostTo.Targets.SEND_MESSAGE);

    goToPageTop();
    V_LIBRARY_OS_CONTAINER.postTo(MS_OS_TOKEN, l_message, a_targetUser, a_postToCallback);
}


function sendComment2(a_targetUser, a_content, a_postToCallback){

 var params = [];
  params[opensocial.Message.Field.TITLE] = "Crime Energy Pack";
  params[opensocial.Message.Field.TYPE] =     opensocial.Message.Type.PUBLIC_MESSAGE;
  //  opensocial.Message.Type.NOTIFICATION;
 //opensocial.Message.Type.PRIVATE_MESSAGE;
 //a_content =  "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0\" width=\"700\" height=\"70\" id=\"Crime1\" align=\"middle\">	<param name=\"allowScriptAccess\" value=\"sameDomain\" />	<param name=\"allowFullScreen\" value=\"false\" />	<param name=\"movie\" value=\"http://www.laasex.com/crime/Crime4.swf\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#000000\" />	<embed src=\"http://www.laasex.com/crime/Crime4.swf\" quality=\"high\" bgcolor=\"#000000\" width=\"700\" height=\"70\" name=\"Crime1\" align=\"middle\" allowScriptAccess=\"sameDomain\" allowFullScreen=\"false\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.adobe.com/go/getflashplayer\" /></object>";
  //a_content = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="290" height="290" id="CarDrive" align="middle">	<param name="allowScriptAccess" value="*" />	<param name="allowFullScreen" value="false" />	<param name="movie" value="http://www.laasex.com/crime/flash/missions/CarDrive8.swf?username='+  GBL.MAIN_DATA.getViewer().getMobName()+'&user_id='+GBL.MAIN_DATA.getViewer().getUserId()+'&networktype=2" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />	<embed src="http://www.laasex.com/crime/flash/missions/CarDrive8.swf?username='+  GBL.MAIN_DATA.getViewer().getMobName()+'&user_id='+GBL.MAIN_DATA.getViewer().getUserId()+'&networktype=2" quality="high" bgcolor="#ffffff" width="290" height="290" name="CarDrive" align="middle" allowScriptAccess="*" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" />	</object>';
  a_content =  "<a href='http://profile.myspace.com/Modules/Applications/Pages/Canvas.aspx?appId=112773'><div width='290' height='290' style=' position:absolute; top:0; left:0;'><object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0\" width=\"290\" height=\"290\" id=\"Crime1\" align=\"middle\">	<param name=\"allowScriptAccess\" value=\"always\" />	<param name=\"allowFullScreen\" value=\"false\" />	<param name=\"movie\" value=\"http://www.laasex.com/Crime/CrimeJoinEnergy1.swf\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#000000\" />	<embed src=\"http://www.laasex.com/Crime/CrimeJoinEnergy1.swf\" quality=\"high\" bgcolor=\"#000000\" width=\"290\" height=\"290\" name=\"Crime1\" align=\"middle\" allowScriptAccess=\"always\" allowFullScreen=\"false\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.adobe.com/go/getflashplayer\" /></object></div></a>";
 
  
  //http://crime.servegame.com/CrimeJoin1.swf
  var message = opensocial.newMessage(a_content, params);
  var recipient = "myspace.com:"+a_targetUser;
  //opensocial.IdSpec.PersonId.VIEWER
  opensocial.requestSendMessage(recipient, message, a_postToCallback);


/*
    var l_message;
	l_message = opensocial.newMessage(a_content);
    l_message.setField(opensocial.Message.Field.TYPE, MyOpenSpace.PostTo.Targets.COMMENTS);

    goToPageTop();
    V_LIBRARY_OS_CONTAINER.postTo(MS_OS_TOKEN, l_message, a_targetUser, a_postToCallback);
	*/
	/*var container = MyOpenSpace.MySpaceContainer.get();
 
    var messageText = "My cool messageasdasd";
 
    var params = {};
    params[MyOpenSpace.Message.Field.TITLE] = "title sdf";
    params[MyOpenSpace.Message.Field.TYPE] = MyOpenSpace.PostTo.Targets.SEND_MESSAGE; //This can be COMMENTS
 
    //The recipient information can be retrieve using the REST API 
    var recipientId = a_targetUser; //Set the id of the recipient
    var recipientThumbnail = ""; //Set the url of the thumbnail image
    var recipientName = "";//Set the name of the recipient 
    var recipientProfileUrl = ""; // Set the url of the profile of the recipient
 
    var message = container.newMessage(messageText, params);
    // If not post back method is required it can be set to undefined.
    container.postTo(a_content, function(){}, recipientId, recipientName, recipientThumbnail, recipientProfileUrl);
	*/
}


function sendCommentQuick(a_targetUser){


 var params = [];
  params[opensocial.Message.Field.TITLE] =  "Join Crime";
  params[opensocial.Message.Field.TYPE] =     opensocial.Message.Type.PUBLIC_MESSAGE;
  //  opensocial.Message.Type.NOTIFICATION;
 //opensocial.Message.Type.PRIVATE_MESSAGE;
 //a_content =  "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0\" width=\"700\" height=\"70\" id=\"Crime1\" align=\"middle\">	<param name=\"allowScriptAccess\" value=\"sameDomain\" />	<param name=\"allowFullScreen\" value=\"false\" />	<param name=\"movie\" value=\"http://www.laasex.com/crime/Crime4.swf\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#000000\" />	<embed src=\"http://www.laasex.com/crime/Crime4.swf\" quality=\"high\" bgcolor=\"#000000\" width=\"700\" height=\"70\" name=\"Crime1\" align=\"middle\" allowScriptAccess=\"sameDomain\" allowFullScreen=\"false\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.adobe.com/go/getflashplayer\" /></object>";
  // a_content = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="290" height="290" id="CarDrive" align="middle">	<param name="allowScriptAccess" value="*" />	<param name="allowFullScreen" value="false" />	<param name="movie" value="http://www.laasex.com/crime/flash/missions/CarDrive8.swf?username='+  GBL.MAIN_DATA.getViewer().getMobName()+'&user_id='+GBL.MAIN_DATA.getViewer().getUserId()+'&networktype=2" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />	<embed src="http://www.laasex.com/crime/flash/missions/CarDrive8.swf?username='+  GBL.MAIN_DATA.getViewer().getMobName()+'&user_id='+GBL.MAIN_DATA.getViewer().getUserId()+'&networktype=2" quality="high" bgcolor="#ffffff" width="290" height="290" name="CarDrive" align="middle" allowScriptAccess="*" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" />	</object>';
  var a_content =  "<a href='http://profile.myspace.com/Modules/Applications/Pages/Canvas.aspx?appId=112773'><div width='290' height='290' style=' position:absolute; top:0; left:0;'><object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0\" width=\"290\" height=\"290\" id=\"Crime1\" align=\"middle\">	<param name=\"allowScriptAccess\" value=\"always\" />	<param name=\"allowFullScreen\" value=\"false\" />	<param name=\"movie\" value=\"http://www.laasex.com/Crime/CrimeJoin2.swf\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#000000\" />	<embed src=\"http://www.laasex.com/Crime/CrimeJoin2.swf\" quality=\"high\" bgcolor=\"#000000\" width=\"290\" height=\"290\" name=\"Crime1\" align=\"middle\" allowScriptAccess=\"always\" allowFullScreen=\"false\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.adobe.com/go/getflashplayer\" /></object></div></a>";
 
  
  //http://crime.servegame.com/CrimeJoin1.swf
  var message = opensocial.newMessage(a_content, params);
  var recipient = "myspace.com:"+a_targetUser;
  //opensocial.IdSpec.PersonId.VIEWER
  opensocial.requestSendMessage(recipient, message, function() {});
}

function sendComment(a_targetUser,title, a_content, a_postToCallback){

 var params = [];
  params[opensocial.Message.Field.TITLE] = title;
  params[opensocial.Message.Field.TYPE] =     opensocial.Message.Type.PUBLIC_MESSAGE;
  //  opensocial.Message.Type.NOTIFICATION;
 //opensocial.Message.Type.PRIVATE_MESSAGE;
 //a_content =  "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0\" width=\"700\" height=\"70\" id=\"Crime1\" align=\"middle\">	<param name=\"allowScriptAccess\" value=\"sameDomain\" />	<param name=\"allowFullScreen\" value=\"false\" />	<param name=\"movie\" value=\"http://www.laasex.com/crime/Crime4.swf\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#000000\" />	<embed src=\"http://www.laasex.com/crime/Crime4.swf\" quality=\"high\" bgcolor=\"#000000\" width=\"700\" height=\"70\" name=\"Crime1\" align=\"middle\" allowScriptAccess=\"sameDomain\" allowFullScreen=\"false\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.adobe.com/go/getflashplayer\" /></object>";
  //a_content = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="290" height="290" id="CarDrive" align="middle">	<param name="allowScriptAccess" value="*" />	<param name="allowFullScreen" value="false" />	<param name="movie" value="http://www.laasex.com/crime/flash/missions/CarDrive8.swf?username='+  GBL.MAIN_DATA.getViewer().getMobName()+'&user_id='+GBL.MAIN_DATA.getViewer().getUserId()+'&networktype=2" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />	<embed src="http://www.laasex.com/crime/flash/missions/CarDrive8.swf?username='+  GBL.MAIN_DATA.getViewer().getMobName()+'&user_id='+GBL.MAIN_DATA.getViewer().getUserId()+'&networktype=2" quality="high" bgcolor="#ffffff" width="290" height="290" name="CarDrive" align="middle" allowScriptAccess="*" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" />	</object>';
  //a_content =  "<a href='http://profile.myspace.com/Modules/Applications/Pages/Canvas.aspx?appId=112773'><div width='290' height='290' style=' position:absolute; top:0; left:0;'><object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0\" width=\"290\" height=\"290\" id=\"Crime1\" align=\"middle\">	<param name=\"allowScriptAccess\" value=\"always\" />	<param name=\"allowFullScreen\" value=\"false\" />	<param name=\"movie\" value=\"http://crime.servegame.com/CrimeJoinEnergy1.swf\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#000000\" />	<embed src=\"http://crime.servegame.com/CrimeJoinEnergy1.swf\" quality=\"high\" bgcolor=\"#000000\" width=\"290\" height=\"290\" name=\"Crime1\" align=\"middle\" allowScriptAccess=\"always\" allowFullScreen=\"false\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.adobe.com/go/getflashplayer\" /></object></div></a>";
 
  
  //http://crime.servegame.com/CrimeJoin1.swf
  var message = opensocial.newMessage(a_content, params);
  var recipient = "myspace.com:"+a_targetUser;
  //opensocial.IdSpec.PersonId.VIEWER
  opensocial.requestSendMessage(recipient, message, a_postToCallback);


/*
    var l_message;
	l_message = opensocial.newMessage(a_content);
    l_message.setField(opensocial.Message.Field.TYPE, MyOpenSpace.PostTo.Targets.COMMENTS);

    goToPageTop();
    V_LIBRARY_OS_CONTAINER.postTo(MS_OS_TOKEN, l_message, a_targetUser, a_postToCallback);
	*/
	/*var container = MyOpenSpace.MySpaceContainer.get();
 
    var messageText = "My cool messageasdasd";
 
    var params = {};
    params[MyOpenSpace.Message.Field.TITLE] = "title sdf";
    params[MyOpenSpace.Message.Field.TYPE] = MyOpenSpace.PostTo.Targets.SEND_MESSAGE; //This can be COMMENTS
 
    //The recipient information can be retrieve using the REST API 
    var recipientId = a_targetUser; //Set the id of the recipient
    var recipientThumbnail = ""; //Set the url of the thumbnail image
    var recipientName = "";//Set the name of the recipient 
    var recipientProfileUrl = ""; // Set the url of the profile of the recipient
 
    var message = container.newMessage(messageText, params);
    // If not post back method is required it can be set to undefined.
    container.postTo(a_content, function(){}, recipientId, recipientName, recipientThumbnail, recipientProfileUrl);
	*/
}



function sendCommentWOGoToPageTop(a_targetUser, a_content, a_postToCallback){

    var l_message;
	l_message = opensocial.newMessage(a_content);
    l_message.setField(opensocial.Message.Field.TYPE, MyOpenSpace.PostTo.Targets.COMMENTS);

    V_LIBRARY_OS_CONTAINER.postTo(MS_OS_TOKEN, l_message, a_targetUser, a_postToCallback);
}


function sendInvite(a_targetUser, a_content, a_postToCallback){
    var l_message = opensocial.newMessage(a_content);
    opensocial.requestShareApp(a_targetUser.getUserId(), l_message, a_postToCallback);
}

/////////////////////////////////////////////////////////
// to the viewer's own account only
/////////////////////////////////////////////////////////

function postToProfile(a_targetUser, a_content, a_postToCallback){

    var l_message;
	l_message = opensocial.newMessage(a_content);
    l_message.setField(opensocial.Message.Field.TYPE, MyOpenSpace.PostTo.Targets.PROFILE);

    goToPageTop();
    V_LIBRARY_OS_CONTAINER.postTo(MS_OS_TOKEN, l_message, a_targetUser, a_postToCallback);
}

function postToBlog(a_targetUser, a_subject, a_content, a_postToCallback){

    var l_message;
	l_message = opensocial.newMessage(a_content);
    l_message.setField(opensocial.Message.Field.TITLE, a_subject);
    l_message.setField(opensocial.Message.Field.TYPE, MyOpenSpace.PostTo.Targets.BLOG);

    goToPageTop();
    V_LIBRARY_OS_CONTAINER.postTo(MS_OS_TOKEN, l_message, a_targetUser);
}


function postToBulletin(a_targetUser,title, a_content, a_postToCallback){

 var params = [];
  params[opensocial.Message.Field.TITLE] = title;
  params[opensocial.Message.Field.TYPE] =     opensocial.Message.Type.NOTIFICATION;
  //  opensocial.Message.Type.NOTIFICATION;
 //opensocial.Message.Type.PRIVATE_MESSAGE;
 //a_content =  "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0\" width=\"700\" height=\"70\" id=\"Crime1\" align=\"middle\">	<param name=\"allowScriptAccess\" value=\"sameDomain\" />	<param name=\"allowFullScreen\" value=\"false\" />	<param name=\"movie\" value=\"http://www.laasex.com/crime/Crime4.swf\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#000000\" />	<embed src=\"http://www.laasex.com/crime/Crime4.swf\" quality=\"high\" bgcolor=\"#000000\" width=\"700\" height=\"70\" name=\"Crime1\" align=\"middle\" allowScriptAccess=\"sameDomain\" allowFullScreen=\"false\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.adobe.com/go/getflashplayer\" /></object>";
  //a_content = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="290" height="290" id="CarDrive" align="middle">	<param name="allowScriptAccess" value="*" />	<param name="allowFullScreen" value="false" />	<param name="movie" value="http://www.laasex.com/crime/flash/missions/CarDrive8.swf?username='+  GBL.MAIN_DATA.getViewer().getMobName()+'&user_id='+GBL.MAIN_DATA.getViewer().getUserId()+'&networktype=2" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />	<embed src="http://www.laasex.com/crime/flash/missions/CarDrive8.swf?username='+  GBL.MAIN_DATA.getViewer().getMobName()+'&user_id='+GBL.MAIN_DATA.getViewer().getUserId()+'&networktype=2" quality="high" bgcolor="#ffffff" width="290" height="290" name="CarDrive" align="middle" allowScriptAccess="*" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" />	</object>';
  //a_content =  "<a href='http://profile.myspace.com/Modules/Applications/Pages/Canvas.aspx?appId=112773'><div width='290' height='290' style=' position:absolute; top:0; left:0;'><object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0\" width=\"290\" height=\"290\" id=\"Crime1\" align=\"middle\">	<param name=\"allowScriptAccess\" value=\"always\" />	<param name=\"allowFullScreen\" value=\"false\" />	<param name=\"movie\" value=\"http://crime.servegame.com/CrimeJoinEnergy1.swf\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#000000\" />	<embed src=\"http://crime.servegame.com/CrimeJoinEnergy1.swf\" quality=\"high\" bgcolor=\"#000000\" width=\"290\" height=\"290\" name=\"Crime1\" align=\"middle\" allowScriptAccess=\"always\" allowFullScreen=\"false\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.adobe.com/go/getflashplayer\" /></object></div></a>";
 
  
  //http://crime.servegame.com/CrimeJoin1.swf
  var message = opensocial.newMessage(a_content, params);
  var recipient = "myspace.com:"+a_targetUser;
  //opensocial.IdSpec.PersonId.VIEWER
  opensocial.requestSendMessage(recipient, message, a_postToCallback);


/*
    var l_message;
	l_message = opensocial.newMessage(a_content);
    l_message.setField(opensocial.Message.Field.TYPE, MyOpenSpace.PostTo.Targets.COMMENTS);

    goToPageTop();
    V_LIBRARY_OS_CONTAINER.postTo(MS_OS_TOKEN, l_message, a_targetUser, a_postToCallback);
	*/
	/*var container = MyOpenSpace.MySpaceContainer.get();
 
    var messageText = "My cool messageasdasd";
 
    var params = {};
    params[MyOpenSpace.Message.Field.TITLE] = "title sdf";
    params[MyOpenSpace.Message.Field.TYPE] = MyOpenSpace.PostTo.Targets.SEND_MESSAGE; //This can be COMMENTS
 
    //The recipient information can be retrieve using the REST API 
    var recipientId = a_targetUser; //Set the id of the recipient
    var recipientThumbnail = ""; //Set the url of the thumbnail image
    var recipientName = "";//Set the name of the recipient 
    var recipientProfileUrl = ""; // Set the url of the profile of the recipient
 
    var message = container.newMessage(messageText, params);
    // If not post back method is required it can be set to undefined.
    container.postTo(a_content, function(){}, recipientId, recipientName, recipientThumbnail, recipientProfileUrl);
	*/
}


function postToBulletinold(a_targetUser, a_subject, a_content, a_postToCallback){

    var l_message;
	l_message = opensocial.newMessage( a_content);
    l_message.setField(opensocial.Message.Field.TITLE, a_subject);
    l_message.setField(opensocial.Message.Field.TYPE, MyOpenSpace.PostTo.Targets.BULLETINS);

    goToPageTop();
    V_LIBRARY_OS_CONTAINER.postTo(MS_OS_TOKEN, l_message, a_targetUser, a_postToCallback);
}

function postToBulletinWOGoToPageTop(a_targetUser, a_subject, a_content, a_postToCallback){
    var l_message;
	l_message = opensocial.newMessage( a_content);
    l_message.setField(opensocial.Message.Field.TITLE, a_subject);
    l_message.setField(opensocial.Message.Field.TYPE, MyOpenSpace.PostTo.Targets.BULLETINS);

    V_LIBRARY_OS_CONTAINER.postTo(MS_OS_TOKEN, l_message, a_targetUser, a_postToCallback);
}


// User
    function User(a_userData) {
        // standard
        this.m_userId = undefined;
	  this.m_usernetworkid = undefined;
        this.m_name = undefined;
        this.m_thumbnail_url = undefined;
        this.m_profile_url = undefined;
        this.m_age = undefined;
        this.m_gender = undefined;
		this.m_city = undefined;
		this.m_region = undefined;
		this.m_country = undefined;
		this.m_zipcode = undefined;
		
        // specific to crime
        this.m_mobName = undefined;
        this.m_mobClass = undefined;
        this.m_mobSize = undefined;
        this.m_cash = undefined;
        this.m_cashInBank = undefined;
        this.m_attackStrength = undefined;
        this.m_defenseStrength = undefined;
        this.m_health = undefined;
        this.m_maxHealth = undefined;
        this.m_energy = undefined;
        this.m_maxEnergy = undefined;
        this.m_stamina = undefined;
        this.m_maxStamina = undefined;
		this.m_adrenaline = undefined;
		this.m_maxadrenaline = undefined;
		
        this.m_experience = undefined;
        this.m_percentToNextLevel = undefined;
        this.m_expPointsToNextLevel = undefined;
        this.m_level = undefined;
        this.m_skillPoints = undefined;
        this.m_favorPoints = undefined; 
        this.m_secondsToHealthRefresh = undefined;
        this.m_secondsToEnergyRefresh = undefined;
        this.m_secondsToStaminaRefresh = undefined;
		this.m_secondsToadrenalineRefresh = undefined;
        this.m_numRequests = undefined;
        this.m_joinedDaysAgo = undefined;
        this.m_income = undefined;
        this.m_upkeep = undefined;
        this.m_partOfViewerMob = undefined;
        this.m_requestedByUser = undefined;
		
		
this.m_numcars = undefined;

        // for opensocial
        this.m_is_owner = false;
        this.m_is_viewer = false;


        if(isValid(a_userData)){
            this.createOsUser(a_userData);
        }
    }


  User.prototype.createOsUser = function(a_osUserData) {
        
	
	////outputDebug('Username:'+ a_osUserData.getDisplayName());
	
	
	////outputDebug('UserID:'+ a_osUserData.getField(opensocial.Person.Field.ID));
	
	var person_id =a_osUserData.getField(opensocial.Person.Field.ID);
							person_id = person_id.replace(/^[^0-9]*/, "");
	this.m_userId = person_id;
	
	
	//.getField(opensocial.Person.Field.NICKNAME); 
	
        this.m_name = a_osUserData.getDisplayName();
		   this.m_thumbnail_url = a_osUserData.getField(opensocial.Person.Field.THUMBNAIL_URL);
		   this.getField(opensocial.Person.Field.STATUS);
if(a_osUserData.isViewer())
{
        this.m_age = a_osUserData.getField(opensocial.Person.Field.AGE);
        this.m_gender = a_osUserData.getField(opensocial.Person.Field.GENDER).getDisplayValue();
     
        this.m_profile_url = a_osUserData.getField(opensocial.Person.Field.PROFILE_URL);
		this.m_city = a_osUserData.getField(MyOpenSpace.Person.Field.CITY);

		this.m_region = a_osUserData.getField(MyOpenSpace.Person.Field.REGION);

		this.m_zipcode = a_osUserData.getField(MyOpenSpace.Person.Field.POSTALCODE);

		this.m_country = a_osUserData.getField(MyOpenSpace.Person.Field.COUNTRY);
}
		
		
    }

    User.prototype.createXMLUser = function(a_userInfoNode){
       try{this.m_userId = getXMLNodeValue(a_userInfoNode, "user_id"); }catch(err){};
         try{this.m_usernetworkid = getXMLNodeValue(a_userInfoNode, "user_networkid"); }catch(err){};
       try{this.m_name = getXMLEncodedStringNodeValue(a_userInfoNode, "display_name"); }catch(err){};
       try{this.m_thumbnail_url = getXMLEncodedStringNodeValue(a_userInfoNode, "thumbnail_url"); }catch(err){};
       try{this.m_profile_url = getXMLEncodedStringNodeValue(a_userInfoNode, "profile_url"); }catch(err){};
      
	  try{this.m_city = getXMLEncodedStringNodeValue(a_userInfoNode, "city"); }catch(err){};
	  try{this.m_region = getXMLEncodedStringNodeValue(a_userInfoNode, "region"); }catch(err){};
	  try{this.m_zipcode = getXMLEncodedStringNodeValue(a_userInfoNode, "postalcode"); }catch(err){};
	  try{this.m_country = getXMLEncodedStringNodeValue(a_userInfoNode, "country"); }catch(err){};
	  
	  
	  
	   this.fillSpecificInfoFromXML(a_userInfoNode);
    }
    // createJSONUser
 User.prototype.createJSONUser = function(a_userInfoNode){
     try{this.mob_class = a_userInfoNode.UCTName }catch(err){};
      try{this.m_thumbnail_url = a_userInfoNode.TN }catch(err){};
     try{this.m_name =  a_userInfoNode.Username }catch(err){};
        
	   try{this.m_userId = a_userInfoNode.NetworkID }catch(err){};
	   try{this.level = a_userInfoNode.Ulevel }catch(err){};
	     
     
      
       try{this.m_profile_url = a_userInfoNode.ProfileURL }catch(err){};
        
	 
	     try{this.mob_size =  a_userInfoNode.NumFriends }catch(err){};
	      try{this.m_usernetworkid = a_userInfoNode.NetworkTypeID }catch(err){};
		  try{this.m_numcars = a_userInfoNode.numcars }catch(err){};
		  //
		  
	     /*
	       try{this.m_profile_url = a_userInfoNode.ProfileURL }catch(err){};
	         try{this.m_profile_url = a_userInfoNode.ProfileURL }catch(err){};
	     */
      /*
	  try{this.m_city = getXMLEncodedStringNodeValue(a_userInfoNode, "city"); }catch(err){};
	  try{this.m_region = getXMLEncodedStringNodeValue(a_userInfoNode, "region"); }catch(err){};
	  try{this.m_zipcode = getXMLEncodedStringNodeValue(a_userInfoNode, "postalcode"); }catch(err){};
	  try{this.m_country = getXMLEncodedStringNodeValue(a_userInfoNode, "country"); }catch(err){};
	  
	      try{ if(isValid(getXMLNodeValue(a_xmlNode,"mob_name"))) this.m_mobName = getXMLEncodedStringNodeValue(a_xmlNode,"mob_name"); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"mob_class"))) this.m_mobClass = getXMLEncodedStringNodeValue(a_xmlNode,"mob_class"); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"mob_size"))) this.m_mobSize = parseInt(getXMLNodeValue(a_xmlNode,"mob_size")); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"cash"))) this.m_cash = parseInt(getXMLNodeValue(a_xmlNode,"cash")); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"cash_in_bank"))) this.m_cashInBank = parseInt(getXMLNodeValue(a_xmlNode,"cash_in_bank")); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"attack_strength"))) this.m_attackStrength = parseInt(getXMLNodeValue(a_xmlNode,"attack_strength")); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"defense_strength"))) this.m_defenseStrength = parseInt(getXMLNodeValue(a_xmlNode,"defense_strength")); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"health"))) this.m_health = parseInt(getXMLNodeValue(a_xmlNode,"health")); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"max_health"))) this.m_maxHealth = parseInt(getXMLNodeValue(a_xmlNode,"max_health")); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"energy"))) this.m_energy = parseInt(getXMLNodeValue(a_xmlNode,"energy")); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"max_energy"))) this.m_maxEnergy = parseInt(getXMLNodeValue(a_xmlNode,"max_energy")); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"stamina"))) this.m_stamina = parseInt(getXMLNodeValue(a_xmlNode,"stamina")); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"max_stamina"))) this.m_maxStamina = parseInt(getXMLNodeValue(a_xmlNode,"max_stamina")); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"experience"))) this.m_experience = parseInt(getXMLNodeValue(a_xmlNode,"experience")); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"percent_to_next_level"))) this.m_percentToNextLevel = parseInt(getXMLNodeValue(a_xmlNode,"percent_to_next_level")); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"exp_pt_to_next_level"))) this.m_expPointsToNextLevel = parseInt(getXMLNodeValue(a_xmlNode,"exp_pt_to_next_level")); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"level"))) this.m_level = parseInt(getXMLNodeValue(a_xmlNode,"level")); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"skill_points"))) this.m_skillPoints = parseInt(getXMLNodeValue(a_xmlNode,"skill_points")); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"favor_points"))) this.m_favorPoints = parseInt(getXMLNodeValue(a_xmlNode,"favor_points")); }catch(err){};
	   
	   try{ if(isValid(getXMLNodeValue(a_xmlNode,"userjailed"))) this.m_userjailed = getXMLNodeValue(a_xmlNode,"userjailed"); }catch(err){};
// m_userjailed

       try{ this.m_secondsToHealthRefresh = undefined; if(isValid(getXMLNodeValue(a_xmlNode,"seconds_to_health_refresh"))) this.m_secondsToHealthRefresh = parseInt(getXMLNodeValue(a_xmlNode,"seconds_to_health_refresh")); }catch(err){};
       try{ this.m_secondsToEnergyRefresh = undefined; if(isValid(getXMLNodeValue(a_xmlNode,"seconds_to_energy_refresh"))) this.m_secondsToEnergyRefresh = parseInt(getXMLNodeValue(a_xmlNode,"seconds_to_energy_refresh")); }catch(err){};
       try{ this.m_secondsToStaminaRefresh = undefined; if(isValid(getXMLNodeValue(a_xmlNode,"seconds_to_stamina_refresh"))) this.m_secondsToStaminaRefresh = parseInt(getXMLNodeValue(a_xmlNode,"seconds_to_stamina_refresh")); }catch(err){};

       try{ if(isValid(getXMLNodeValue(a_xmlNode,"num_requests"))) this.m_numRequests = parseInt(getXMLNodeValue(a_xmlNode,"num_requests")); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"joined_days_ago"))) this.m_joinedDaysAgo = parseInt(getXMLNodeValue(a_xmlNode,"joined_days_ago")); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"land_income"))) this.m_income = parseInt(getXMLNodeValue(a_xmlNode,"land_income")); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"item_upkeep"))) this.m_upkeep = parseInt(getXMLNodeValue(a_xmlNode,"item_upkeep")); }catch(err){};

       try{ this.m_partOfViewerMob = getXMLNodeValue(a_xmlNode,"part_of_viewer_mob"); }catch(err){};
       try{ this.m_requestedByUser = getXMLNodeValue(a_xmlNode,"requested_by_viewer"); }catch(err){};
      */
	  
	  
	//   this.fillSpecificInfoFromXML(a_userInfoNode);
    }

    User.prototype.constructParamForReq = function() {
        var l_params = {};
		//outputDebug("User.prototype.constructParamForReq");
		
        l_params.nid = this.m_userId;
		l_params.nt = 2;
		
			l_params.city = "";
		
           
       l_params.gender = "0";
        l_params.thumbnail_url = "";;
        l_params.profileurl = "";;
         l_params.displayname ="";;
		
		//if (isValid(this.m_city))
		
		 l_params.region = "";
		 l_params.zipcode = "";
		 l_params.country ="";
                
		
        if (isValid(this.m_age)) l_params.age = this.m_age;
        if (isValid(this.m_gender)) l_params.gender = this.m_gender;
        if (isValid(this.m_thumbnail_url)) l_params.tn = this.m_thumbnail_url;
        if (isValid(this.m_profile_url)) l_params.profileurl = this.m_profile_url;
        if (isValid(this.m_name)) l_params.displayname = customEncoding(this.m_name);
		
		//if (isValid(this.m_city)) 
		 
		if (isValid(this.m_region)) l_params.region = this.m_region; 
		if (isValid(this.m_zipcode)) l_params.zipcode = this.m_zipcode;
		if (isValid(this.m_country)) l_params.country = this.m_country;
		//l_params.countrya = "eyg3";
	//	 l_params.wtf ="wtf";  
		//		this.m_city =a_osUserData.getField(opensocial.Person.Field.CITY);
	//	this.m_region = a_osUserData.getField(opensocial.Person.Field.REGION);
	//	this.m_zipcode = a_osUserData.getField(opensocial.Person.Field.POSTALCODE); 
	//	this.m_country = a_osUserData.getField(opensocial.Person.Field.COUNTRY);
		
        return l_params;
    }

    User.prototype.signInViewer = function(onFinishCallback) {
       if (isValid(this.m_userId)) {
           var l_params = this.constructParamForReq();
           l_params.sign_in = "true";
		   l_params.gender = "1";
		   l_params.f = "JCheckUserID";
// http://crime.servegame.com/JSonService2.aspx?NID=152564710&NT=2&City=&thumbnail_url=&ProfileURL=http://www.myspace.com/captchacrack&displayname=cstm_killer10&region=&zipcode=&country=&age=25&tn=http://c2.ac-images.myspacecdn.com/images01/30/s_34cae79d2c8824b5bca0d22dcab4f45d.jpg&sign_in=true&Gender=dontcare&f=JCheckUserID&session_id=b6589fc6ab0dc82cf12099d1c2d40ab994e8410c&nocache=1256601355706
// URL:/JSonService2.htm?age=25&City=&country=&displayname=cstm_killer10&f=JCheckUserID&Gender=dontcare&NID=152564710&nocache=1256601355706&NT=2&opensocial_owner_id=152564710&opensocial_viewer_id=152564710&ProfileURL=http://www.myspace.com/captchacrack&region=&session_id=b6589fc6ab0dc82cf12099d1c2d40ab994e8410c&sign_in=true&thumbnail_url=&tn=http://c2.ac-images.myspacecdn.com/images01/30/s_34cae79d2c8824b5bca0d22dcab4f45d.jpg&zipcode=




		   // User.prototype.constructParamForReq
		  
		  // http://www.bigideastech.com/crime/WebService.asmx//sign_in?user_id=152564710&age=24&gender=Male&thumbnail_url=http://a198.ac-images.myspacecdn.com/images01/30/s_34cae79d2c8824b5bca0d22dcab4f45d.jpg&profile_url=http://www.myspace.com/captchacrack&display_name=cstm_killer10&sign_in=true&session_id=ecc79e00cb10b5be627e5d87c3466e363f2e3ba1&nocache=1220907364247

		  
		   //outputDebug("makeXMLNotCachedRequest("+"http://crime.servegame.com/JSonService.aspx/JCheckUserID");
          // makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/http://crime.servegame.com/", onFinishCallback, l_params);
		     makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx",
                        onFinishCallback,
                        l_params, 0);
       }
    }



 User.prototype.getNumCars = function(){
        return this.m_numcars;
    }
    User.prototype.getUserId = function(){
        return this.m_userId;
    }
    User.prototype.getUserNetworkID = function() {
        
        return this.m_usernetworkid;
    }
    User.prototype.getGender = function(){
        return this.m_gender;
    }

    User.prototype.getAge = function(){
        return this.m_age;
    }/*
	//GBL.MAIN_DATA.getViewer().getAge();
	//GBL.MAIN_DATA.getViewer().getGender();
	
	*/

    User.prototype.getThumbnailUrl = function(){
        return this.m_thumbnail_url;
    }

    User.prototype.getName = function() {
        return this.m_name;
    }

    User.prototype.getShortName = function(){
        if(this.m_name.length < 12){
            return this.m_name;
        }
        return this.m_name.substring(0, 11)+"..";
    }

    User.prototype.getProfileUrl = function() {
        return this.m_profile_url;
    }


    User.prototype.output = function() {
        //outputDebug("userId: " + this.m_userId);
        //outputDebug("name: " + this.m_name);
        //outputDebug("gender: " + this.m_gender);
    }


    ////////////////////////////////////////////////////////////
    // Specific to Mobsters
 User.prototype.fillSpecificInfoFromJSON = function(a_xmlNode){
 //user_id
 try{ if(isValid(a_xmlNode.m_userId)) this.m_userId = a_xmlNode.user_id; }catch(err){};
       try{ if(isValid(a_xmlNode.mob_name)) this.m_mobName = a_xmlNode.mob_name; }catch(err){};
       try{ if(isValid(a_xmlNode.mob_class)) this.m_mobClass = a_xmlNode.mob_class; }catch(err){ this.m_mobClass = "0";};
       try{ if(isValid(a_xmlNode.mob_size)) this.m_mobSize = (a_xmlNode.mob_size); }catch(err){};
       try{ if(isValid(a_xmlNode.cash)) this.m_cash = (a_xmlNode.cash); }catch(err){};
       try{ if(isValid(a_xmlNode.cash_in_bank)) this.m_cashInBank = (a_xmlNode.cash_in_bank); }catch(err){};
       try{ if(isValid(a_xmlNode.attack_strength)) this.m_attackStrength = (a_xmlNode.attack_strength); }catch(err){};
       try{ if(isValid(a_xmlNode.defense_strength)) this.m_defenseStrength = (a_xmlNode.defense_strength); }catch(err){};
       try{ if(isValid(a_xmlNode.health)) this.m_health = (a_xmlNode.health); }catch(err){};
       try{ if(isValid(a_xmlNode.max_health)) this.m_maxHealth = (a_xmlNode.max_health); }catch(err){};
       try{ if(isValid(a_xmlNode.energy)) this.m_energy = (a_xmlNode.energy); }catch(err){};
       try{ if(isValid(a_xmlNode.max_energy)) this.m_maxEnergy = (a_xmlNode.max_energy); }catch(err){};
       try{ if(isValid(a_xmlNode.stamina)) this.m_stamina = (a_xmlNode.stamina); }catch(err){};
       try{ if(isValid(a_xmlNode.max_stamina)) this.m_maxStamina = (a_xmlNode.max_stamina); }catch(err){};
	   //adrenaline
	   try{ if(isValid(a_xmlNode.adrenaline)) this.m_adrenaline = (a_xmlNode.adrenaline); }catch(err){};
       try{ if(isValid(a_xmlNode.max_adrenaline)) this.m_maxadrenaline = (a_xmlNode.max_adrenaline); }catch(err){};
       try{ if(isValid(a_xmlNode.experience)) this.m_experience = (a_xmlNode.experience); }catch(err){};
       try{ if(isValid(a_xmlNode.percent_to_next_level)) this.m_percentToNextLevel = (a_xmlNode.percent_to_next_level); }catch(err){};
       try{ if(isValid(a_xmlNode.exp_pt_to_next_level)) this.m_expPointsToNextLevel = (a_xmlNode.exp_pt_to_next_level); }catch(err){};
       try{ if(isValid(a_xmlNode.level)) this.m_level = (a_xmlNode.level); }catch(err){};
       try{ if(isValid(a_xmlNode.skill_points)) this.m_skillPoints = (a_xmlNode.skill_points); }catch(err){};
       try{ if(isValid(a_xmlNode.favor_points)) this.m_favorPoints = (a_xmlNode.favor_points); }catch(err){};
	   
	   try{ if(isValid(a_xmlNode.userjailed)) this.m_userjailed = a_xmlNode.userjailed; }catch(err){};
// m_userjailed

       try{ this.m_secondsToHealthRefresh = undefined; if(isValid(a_xmlNode.seconds_to_health_refresh)) this.m_secondsToHealthRefresh = (a_xmlNode.seconds_to_health_refresh); }catch(err){};
       try{ this.m_secondsToEnergyRefresh = undefined; if(isValid(a_xmlNode.seconds_to_energy_refresh)) this.m_secondsToEnergyRefresh = (a_xmlNode.seconds_to_energy_refresh); }catch(err){};
       try{ this.m_secondsToStaminaRefresh = undefined; if(isValid(a_xmlNode.seconds_to_stamina_refresh)) this.m_secondsToStaminaRefresh = (a_xmlNode.seconds_to_stamina_refresh); }catch(err){};
try{ this.m_secondsToadrenalineRefresh = undefined; if(isValid(a_xmlNode.seconds_to_adrenaline_refresh)) this.m_secondsToadrenalineRefresh = (a_xmlNode.seconds_to_adrenaline_refresh); }catch(err){};

	   //
       try{ if(isValid(a_xmlNode.num_requests)) this.m_numRequests = (a_xmlNode.num_requests); }catch(err){};
       try{ if(isValid(a_xmlNode.joined_days_ago)) this.m_joinedDaysAgo = (a_xmlNode.joined_days_ago); }catch(err){};
       try{ if(isValid(a_xmlNode.land_income)) this.m_income = (a_xmlNode.land_income); }catch(err){};
       try{ if(isValid(a_xmlNode.item_upkeep)) this.m_upkeep = (a_xmlNode.item_upkeep); }catch(err){};

       try{ this.m_partOfViewerMob = a_xmlNode.part_of_viewer_mob; }catch(err){};
       try{ this.m_requestedByUser = a_xmlNode.requested_by_viewer; }catch(err){};
    }
	
    User.prototype.fillSpecificInfoFromXML = function(a_xmlNode){
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"mob_name"))) this.m_mobName = getXMLEncodedStringNodeValue(a_xmlNode,"mob_name"); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"mob_class"))) this.m_mobClass = getXMLEncodedStringNodeValue(a_xmlNode,"mob_class"); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"mob_size"))) this.m_mobSize = parseInt(getXMLNodeValue(a_xmlNode,"mob_size")); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"cash"))) this.m_cash = parseInt(getXMLNodeValue(a_xmlNode,"cash")); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"cash_in_bank"))) this.m_cashInBank = parseInt(getXMLNodeValue(a_xmlNode,"cash_in_bank")); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"attack_strength"))) this.m_attackStrength = parseInt(getXMLNodeValue(a_xmlNode,"attack_strength")); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"defense_strength"))) this.m_defenseStrength = parseInt(getXMLNodeValue(a_xmlNode,"defense_strength")); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"health"))) this.m_health = parseInt(getXMLNodeValue(a_xmlNode,"health")); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"max_health"))) this.m_maxHealth = parseInt(getXMLNodeValue(a_xmlNode,"max_health")); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"energy"))) this.m_energy = parseInt(getXMLNodeValue(a_xmlNode,"energy")); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"max_energy"))) this.m_maxEnergy = parseInt(getXMLNodeValue(a_xmlNode,"max_energy")); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"stamina"))) this.m_stamina = parseInt(getXMLNodeValue(a_xmlNode,"stamina")); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"max_stamina"))) this.m_maxStamina = parseInt(getXMLNodeValue(a_xmlNode,"max_stamina")); }catch(err){};
	          try{ if(isValid(getXMLNodeValue(a_xmlNode,"adrenaline"))) this.m_adrenaline = parseInt(getXMLNodeValue(a_xmlNode,"adrenaline")); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"max_adrenaline"))) this.m_maxadrenaline = parseInt(getXMLNodeValue(a_xmlNode,"max_adrenaline")); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"experience"))) this.m_experience = parseInt(getXMLNodeValue(a_xmlNode,"experience")); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"percent_to_next_level"))) this.m_percentToNextLevel = parseInt(getXMLNodeValue(a_xmlNode,"percent_to_next_level")); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"exp_pt_to_next_level"))) this.m_expPointsToNextLevel = parseInt(getXMLNodeValue(a_xmlNode,"exp_pt_to_next_level")); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"level"))) this.m_level = parseInt(getXMLNodeValue(a_xmlNode,"level")); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"skill_points"))) this.m_skillPoints = parseInt(getXMLNodeValue(a_xmlNode,"skill_points")); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"favor_points"))) this.m_favorPoints = parseInt(getXMLNodeValue(a_xmlNode,"favor_points")); }catch(err){};
	   
	   try{ if(isValid(getXMLNodeValue(a_xmlNode,"userjailed"))) this.m_userjailed = getXMLNodeValue(a_xmlNode,"userjailed"); }catch(err){};
// m_userjailed

       try{ this.m_secondsToHealthRefresh = undefined; if(isValid(getXMLNodeValue(a_xmlNode,"seconds_to_health_refresh"))) this.m_secondsToHealthRefresh = parseInt(getXMLNodeValue(a_xmlNode,"seconds_to_health_refresh")); }catch(err){};
       try{ this.m_secondsToEnergyRefresh = undefined; if(isValid(getXMLNodeValue(a_xmlNode,"seconds_to_energy_refresh"))) this.m_secondsToEnergyRefresh = parseInt(getXMLNodeValue(a_xmlNode,"seconds_to_energy_refresh")); }catch(err){};
       try{ this.m_secondsToStaminaRefresh = undefined; if(isValid(getXMLNodeValue(a_xmlNode,"seconds_to_stamina_refresh"))) this.m_secondsToStaminaRefresh = parseInt(getXMLNodeValue(a_xmlNode,"seconds_to_stamina_refresh")); }catch(err){};

       try{ if(isValid(getXMLNodeValue(a_xmlNode,"num_requests"))) this.m_numRequests = parseInt(getXMLNodeValue(a_xmlNode,"num_requests")); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"joined_days_ago"))) this.m_joinedDaysAgo = parseInt(getXMLNodeValue(a_xmlNode,"joined_days_ago")); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"land_income"))) this.m_income = parseInt(getXMLNodeValue(a_xmlNode,"land_income")); }catch(err){};
       try{ if(isValid(getXMLNodeValue(a_xmlNode,"item_upkeep"))) this.m_upkeep = parseInt(getXMLNodeValue(a_xmlNode,"item_upkeep")); }catch(err){};

       try{ this.m_partOfViewerMob = getXMLNodeValue(a_xmlNode,"part_of_viewer_mob"); }catch(err){};
       try{ this.m_requestedByUser = getXMLNodeValue(a_xmlNode,"requested_by_viewer"); }catch(err){};
    }
// m_mobClass , m_mobName, m_mobSize
    User.prototype.getMobName = function(){
        return this.m_mobName;
    }

    User.prototype.getShortMobName = function(a_max){
        if(!isValid(this.m_mobName) || !isValid(a_max) || this.m_mobName.length <= a_max){
            return this.m_mobName;
        }
        return this.m_mobName.substr(0, a_max-2) + "...";
    }

    User.prototype.getMobClass = function(){
        return this.m_mobClass;
    }

    User.prototype.getMobSize = function(){
        return this.m_mobSize;
    }

    User.prototype.getCash = function(){
        return this.m_cash;
    }

    User.prototype.getCashInBank = function(){
        return this.m_cashInBank;
    }

    User.prototype.getAttackStrength = function(){
        return this.m_attackStrength;
    }

    User.prototype.getDefenseStrength = function(){
        return this.m_defenseStrength;
    }

    User.prototype.getHealth = function(){
        return this.m_health;
    }
   User.prototype.getJailed = function(){
        return this.m_userjailed;
    }
	
    User.prototype.getMaxHealth = function(){
        return this.m_maxHealth;
    }

    User.prototype.getEnergy = function(){
        return this.m_energy;
    }

    User.prototype.getMaxEnergy = function(){
        return this.m_maxEnergy;
    }

    User.prototype.getStamina = function(){
        return this.m_stamina;
    }
// .getAdrinaline() + "/" + l_user.getAdrinalineMax();
	User.prototype.getAdrinaline = function(){
        return this.m_adrenaline;
    }
    
    User.prototype.getAdrinalineMax = function(){
        return this.m_maxadrenaline;
    }
    // getPercentAdrinaline
User.prototype.getPercentAdrinaline = function(){
        return this.m_stamina;
    }
    User.prototype.getMaxStamina = function(){
        return this.m_maxStamina;
    }

    User.prototype.getExperience = function(){
        return this.m_experience;
    }

    User.prototype.getPercentToNextLevel = function(){
        return this.m_percentToNextLevel;
    }

    User.prototype.getExpPointsToNextLevel = function(){
        return this.m_expPointsToNextLevel;
    }

    User.prototype.getLevel  = function(){
        return this.m_level;
    }

    User.prototype.getSkillPoints = function(){
        return this.m_skillPoints;
    }

    User.prototype.getFavorPoints = function(){
        return this.m_favorPoints;
    }

    User.prototype.getSecondsToHealthRefresh = function(){
        return this.m_secondsToHealthRefresh;
    }

    User.prototype.getSecondsToEnergyRefresh = function(){
        return this.m_secondsToEnergyRefresh;
    }

    User.prototype.getSecondsToStaminaRefresh = function(){
        return this.m_secondsToStaminaRefresh;
    }
	  User.prototype.getSecondsToAdrenalineRefresh = function(){
        return this.m_secondsToadrenalineRefresh;
    }
//
    User.prototype.getNumRequests = function(){
        return this.m_numRequests;
    }

    User.prototype.getJoinedDaysAgo = function(){
        return this.m_joinedDaysAgo;
    }

    User.prototype.getIncome = function(){
        return this.m_income;
    }

    User.prototype.getUpkeep = function(){
        return this.m_upkeep;
    }

    User.prototype.getpartOfViewerMob = function(){
        return getBooleanValue(this.m_partOfViewerMob); 
    }

    User.prototype.getRequestedByUser = function(){
        return getBooleanValue(this.m_requestedByUser);
    }

    ////////////////////////////////////////////////////////////
    // for opensocial compliance

    User.prototype.getField = function(a_key){
        // this has to handle some things
        switch(a_key){
            case opensocial.Person.Field.ID: return this.m_userId;
            case opensocial.Person.Field.NAME: return this.m_name;
            case opensocial.Person.Field.AGE: return this.m_age;
            case opensocial.Person.Field.GENDER: return this.m_gender;
            case opensocial.Person.Field.THUMBNAIL_URL: return this.m_thumbnail_url;
            case opensocial.Person.Field.PROFILE_URL: return this.m_profile_url;
			case opensocial.Person.Field.CITY: return this.m_city;
			case opensocial.Person.Field.REGION: return this.m_region;
			case opensocial.Person.Field.POSTALCODE: return this.m_zipcode;
			case opensocial.Person.Field.COUNTRY: return this.m_country; 
			
	
		
        }
        return undefined;
    }
    User.prototype.getDisplayName = function(){
        return this.m_name;
    }

    User.prototype.getId = function(){
        return this.m_userId;
    }

    User.prototype.isOwner = function(){
        return this.m_is_owner;
    }

    User.prototype.setIsOwner = function(a_is_owner){
        this.m_is_owner = a_is_owner;
    }

    User.prototype.isViewer = function(){
        return this.m_is_viewer;
    }

    User.prototype.setIsViewer = function(a_is_viewer){
        this.m_is_viewer = a_is_viewer;
    }
// end user









function CachedOSFriendList(a_owner){

    var m_owner = a_owner;
    var m_totalNumUsers = undefined;
    var m_cachedUsers = undefined;
    var m_cachedUserIdUserMap = new Object();

    this.invalidateCache = invalidateCache;

    var m_numUsersFinishCallback = undefined;
    this.getNumUsers = getNumUsers;

    var m_usersFinishCallback = undefined;
    this.getUsers = getUsers;
	this.getUsers2 = getUsers2;
    this.getUserById = getUserById;


    function invalidateCache(){
      //  //outputDebug("invalidate CachedOSFriendList cache");
      /*
        m_totalNumUsers = undefined;
        m_cachedUsers = new Array();
        m_cachedUserIdUserMap = new Object();
      */
    }


    function getNumUsers(a_finishCallback){
      //  //outputDebug("CachedOSFriendList: getNumUsers");

        if(isValid(m_totalNumUsers)){
            a_finishCallback(m_totalNumUsers);
            return;
        }

        m_numUsersFinishCallback = a_finishCallback;

        // just get the number of friends
	  var req = opensocial.newDataRequest();
   
    params = {};
    params[opensocial.IdSpec.Field.USER_ID] = opensocial.IdSpec.PersonId.VIEWER;
    params[opensocial.IdSpec.Field.GROUP_ID] = opensocial.IdSpec.GroupId.FRIENDS;


    var opt_params = {};
    opt_params[opensocial.DataRequest.PeopleRequestFields.FIRST] = 1;
    opt_params[opensocial.DataRequest.PeopleRequestFields.MAX] = 1;

   var idspec = opensocial.newIdSpec(params);
    req.add(req.newFetchPeopleRequest(idspec, opt_params), "viewerFriends");
   
    req.send(onGetNumUsers);
	
	
	
	/*
        var l_param = {};
        l_param[opensocial.DataRequest.PeopleRequestFields.FIRST] = 0;
        l_param[opensocial.DataRequest.PeopleRequestFields.MAX] = 0;
        var l_req = opensocial.newDataRequest();
        l_req.add(l_req.newFetchPeopleRequest('VIEWER_FRIENDS', l_param), 'numFriends');
        l_req.send(onGetNumUsers);
	
	*/
    }

    function onGetNumUsers(a_response){
      //  //outputDebug("CachedOSFriendList: onGetNumUsers, a_response:" +a_response);
var fr = a_response.get("viewerFriends").getData();


        try{
	   //  //outputDebug("fr.getTotalSize():" +fr.getTotalSize());
            m_totalNumUsers = parseInt(fr.getTotalSize())
        }catch (err) {
            m_totalNumUsers = undefined;
          //  //outputDebug(err);
        }

        m_cachedUsers = new Array();
        for(var l_index = 0; l_index < m_totalNumUsers; l_index++){
            m_cachedUsers.push(undefined);
        }

        if(isValidFunction(m_numUsersFinishCallback)){
            var l_tempCallback = m_numUsersFinishCallback;
            m_numUsersFinishCallback = undefined;
            l_tempCallback(m_totalNumUsers);
        }
    }


    function getUsers(a_requiredStart, a_requiredNum, a_finishFetchCallback){
      //  //outputDebug("CachedOSFriendList: getUsers start " + a_requiredStart + " num " + a_requiredNum);

        if(a_requiredNum % 40 != 0){
            outputAlert("Can only handle indices in multiples of 40, since myspace pages friends");
        }

        if(!isValid(m_totalNumUsers)){
            getNumUsers(function(){
               getUsers(a_requiredStart, a_requiredNum, a_finishFetchCallback);
            });
            return;
        }


        var l_upperLimit = Math.min(a_requiredStart + a_requiredNum, m_totalNumUsers);
      //  //outputDebug("l_upperLimit: " + l_upperLimit);

        var l_entriesCached = true;
        if(m_cachedUsers.length >= l_upperLimit){
            for(var l_index = a_requiredStart; l_entriesCached && l_index < l_upperLimit; l_index ++ ){
                l_entriesCached = isValid(m_cachedUsers[l_index]);
            }
        }

      //  //outputDebug("l_entriesCached: " + l_entriesCached);

        if(l_entriesCached){
            a_finishFetchCallback(m_cachedUsers);
        } else {
            m_usersFinishCallback = a_finishFetchCallback;
            getOSUsers(a_requiredStart);
        }
    }
function getUsers2(a_requiredStart, a_requiredNum, a_finishFetchCallback){
      //  //outputDebug("CachedOSFriendList: getUsers start " + a_requiredStart + " num " + a_requiredNum);

        if(a_requiredNum % 100 != 0){
            outputAlert("Can only handle indices in multiples of 40, since myspace pages friends");
        }

        if(!isValid(m_totalNumUsers)){
            getNumUsers(function(){
               getUsers2(a_requiredStart, a_requiredNum, a_finishFetchCallback);
            });
            return;
        }


        var l_upperLimit = Math.min(a_requiredStart + a_requiredNum, m_totalNumUsers);
      //  //outputDebug("l_upperLimit: " + l_upperLimit);

        var l_entriesCached = true;
        if(m_cachedUsers.length >= l_upperLimit){
            for(var l_index = a_requiredStart; l_entriesCached && l_index < l_upperLimit; l_index ++ ){
                l_entriesCached = isValid(m_cachedUsers[l_index]);
            }
        }

      //  //outputDebug("l_entriesCached: " + l_entriesCached);

        if(l_entriesCached){
            a_finishFetchCallback(m_cachedUsers);
        } else {
            m_usersFinishCallback = a_finishFetchCallback;
            getOSUsers(a_requiredStart);
        }
    }
    function getOSUsers(a_requiredStart){
      //  //outputDebug("getOSUsers: " + a_requiredStart);

        var l_param = {};
      //  l_param[opensocial.DataRequest.PeopleRequestFields.FIRST] = a_requiredStart;
    //    l_param[opensocial.DataRequest.PeopleRequestFields.MAX] = 40;
   params[opensocial.IdSpec.Field.GROUP_ID] = opensocial.IdSpec.GroupId.FRIENDS;
   
       var opt_params = {};
    opt_params[opensocial.DataRequest.PeopleRequestFields.FIRST] = a_requiredStart+1;
    opt_params[opensocial.DataRequest.PeopleRequestFields.MAX] = 100;
    
   
        var l_req = opensocial.newDataRequest();
	   var idspec = opensocial.newIdSpec(params);
	
	
        l_req.add(l_req.newFetchPeopleRequest(idspec, opt_params), 'viewerFriends');

        l_req.send(function(a_dataResponse) {
            onLoadFriends(a_requiredStart, a_dataResponse);
        });
    }


    function onLoadFriends(a_startIndex, a_dataResponse){
      //  //outputDebug("onLoadFriends: " + a_startIndex);

        var l_success = false;
        var l_currentIndex = a_startIndex;
        var l_queryIdString = "";
        
        try{
            var l_ownerFriends = a_dataResponse.get('viewerFriends').getData();
            if(isValid(l_ownerFriends)){
                l_success = true;
                l_ownerFriends.each(
                    function(a_person) {
                        var l_nonAppUser = new User(a_person);
		//	var current_UserID = l_nonAppUser.getUserId()
			var person_id = l_nonAppUser.getId();
							person_id = person_id.replace(/^[^0-9]*/, "");
							
							/*
                        if(!isValid(m_cachedUserIdUserMap[person_id])){
                         //   l_queryIdString += person_id + ",";
                        }*/
                        m_cachedUsers[l_currentIndex] = l_nonAppUser;
                        m_cachedUserIdUserMap[person_id] = l_nonAppUser;
                        l_currentIndex += 1;
                    }
                );
            }
        }catch (err) {
            l_success = false;
          //  //outputDebug("onLoadFriends " + err);
        }

        if(!l_success){
          //  //outputDebug("Getting OS Users failed, should I retry?");
        } else {

        }
            if(isValid(l_queryIdString) && l_queryIdString.length > 0){
                var l_params = {};
				
                l_params.NetworkID = GBL.MAIN_DATA.getViewer().getUserId();
				 l_params.NetworkType = "2";
                l_params.query_ids= l_queryIdString;
		onLoadAppFriends(m_cachedUsers);
			/*	
 makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/GetGameUsers",
           //     makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/get_app_users",
                        onLoadAppFriends,
                        l_params, true);
 */
                return;
        }

        if(isValidFunction(m_usersFinishCallback)){
            var l_tempCallback = m_usersFinishCallback;
            m_usersFinishCallback = undefined;
            l_tempCallback(m_cachedUsers);
        }
    }   

    function onLoadAppFriends(a_requestData){
      //  //outputDebug("onLoadAppFriends");
/*
        var l_xmlDoc = getGadgetResponseData(a_requestData);
        if(l_xmlDoc != undefined){
            var l_userNodes = l_xmlDoc.getElementsByTagName("user");
            if(isValid(l_userNodes) && l_userNodes.length > 0){
                for(var l_index = 0; l_index < l_userNodes.length; l_index++){
                    try{
                        var l_userId = getXMLNodeValue(l_userNodes[l_index], "user_id");
                        var l_user = m_cachedUserIdUserMap[l_userId];
                        if(isValid(l_user)){
                            l_user.fillSpecificInfoFromXML(l_userNodes[l_index]);
                        }
                    } catch (err){
                      //  //outputDebug("onLoadAppFriends: " + err);
                    }
                }
            }
        }
		*/

        if(isValidFunction(m_usersFinishCallback)){
            var l_tempCallback = m_usersFinishCallback;
            m_usersFinishCallback = undefined;
            l_tempCallback(m_cachedUsers);
        }
    }

    function getUserById(id){
        return m_cachedUserIdUserMap[id];
    }
}



CachedUserList.MY_REQUESTS = 1;
CachedUserList.MY_MOB = 2;

function CachedUserList(a_type){

    var m_type = a_type;
    var m_totalNumUsers = undefined;
    var m_cachedUsers = new Array();
    var m_cachedUserIdUserMap = new Object();


    this.setTotalNumUsers = setTotalNumUsers;
    this.addUser = addUser;
    this.invalidateCache = invalidateCache;

    var m_numUsersFinishCallback = undefined;
    this.getNumUsers = getNumUsers;
    this.onLoadNumUsers = onLoadNumUsers;

    var m_usersFinishCallback = undefined;
    this.getUsers = getUsers;
    this.onLoadUsers = onLoadUsers;
    this.getUserById = getUserById;


    function setTotalNumUsers(a_totalNumUsers){
        m_totalNumUsers = a_totalNumUsers;
    }

    function addUser(a_user){
        m_cachedUsers.push(a_user);
        m_cachedUserIdUserMap[a_user.getUserId()] = a_user;
    }

    function invalidateCache(){
        //outputDebug("invalidate user cache");
        m_totalNumUsers = undefined;
        m_cachedUsers = new Array();
        m_cachedUserIdUserMap = new Object();
    }

    function getNumUsers(a_finishCallback){
        if(m_totalNumUsers != undefined){
            a_finishCallback(m_totalNumUsers);
            return;
        }

        m_numUsersFinishCallback = a_finishCallback;

        var l_params = {};
        l_params.NetworkID = GBL.MAIN_DATA.getViewer().getUserId();
		l_params.NetworkType = "2";
        l_params.action = getActionURI(m_type);
        makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/GetNumUsers", onLoadNumUsers, l_params);
    }

    function onLoadNumUsers(a_requestData){
        var l_xmlDoc = getGadgetResponseData(a_requestData);
        if(l_xmlDoc != undefined){
            try{
                m_totalNumUsers = getXMLNodeValue(l_xmlDoc, "num");
            }catch(err){outputAlert(err);}
        }

        if(isValidFunction(m_numUsersFinishCallback)){
            var l_tempCallback = m_numUsersFinishCallback;
            m_numUsersFinishCallback = undefined;
            l_tempCallback(m_totalNumUsers);
        }
    }


    function getUsers(a_requiredStart, a_requiredNum, a_finishFetchCallback){
        if(m_cachedUsers.length >= m_totalNumUsers || m_cachedUsers.length >= (a_requiredStart + a_requiredNum-1)){
            a_finishFetchCallback(m_cachedUsers);
            return;
        }
//        outputAlert("cached length: " + m_cachedUsers.length + " required: " + requiredStart + " for " + requiredNum);
        var l_startIndex = Math.min(m_cachedUsers.length, a_requiredStart);
        var l_numToFetch = (a_requiredStart + a_requiredNum) - l_startIndex;
        m_usersFinishCallback = a_finishFetchCallback;

        var l_params = {};
        l_params.NetworkID = GBL.MAIN_DATA.getViewer().getUserId();
		l_params.NetworkType = "2";
		
        l_params.action = getActionURI(m_type);
        l_params.start = l_startIndex;
        l_params.num = l_numToFetch;

        makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/GetOrgUsers", onLoadUsers, l_params);
    }


    function onLoadUsers(requestData){
        var l_xmlDoc = getGadgetResponseData(requestData);
        if(l_xmlDoc != undefined){
            var l_users = l_xmlDoc.getElementsByTagName("user");
            if(isValid(l_users) && l_users.length > 0){
                for(var l_index = 0; l_index < l_users.length; l_index++){
                    var l_pet = new User(undefined);
                    l_pet.createXMLUser(l_users[l_index]);
                    m_cachedUsers.push(l_pet);
                    m_cachedUserIdUserMap[l_pet.getUserId()] = l_pet;
                }
            }
        }

        if(isValidFunction(m_usersFinishCallback)){
            var l_tempCallback = m_usersFinishCallback;
            m_usersFinishCallback = undefined;
            l_tempCallback(m_cachedUsers);
        }
    }

    function getUserById(a_id){
        return m_cachedUserIdUserMap[a_id];
    }

    function getActionURI(a_typeCode){
        switch(a_typeCode){
            case CachedUserList.MY_REQUESTS:
                return "request";
            case CachedUserList.MY_MOB:
                return "my_mob";
            default:
                //outputDebug("Unrecognized category code " + a_typeCode);
                return undefined;
        }
    }
}


	
function init() {

//document.getElementById('main').innerHTML +=  "<h1>TESTING LAPTOP SERVER</h1><BR/>May lag out teeeerrrribly";

     //outputDebug("init called");
//MyOpenSpace.MySpaceContainer.get().registerParam("panelId", "apppanel_112773_canvas"); 
//MyOpenSpace.MySpaceContainer.get().registerParam("localRelay", "http://crime.servegame.com/ifpc_relay_external002.html"); 
	 
	 // var page = opensocial.getEnvironment().getParams()["page"];
// http://profile.myspace.com/Modules/Applications/Pages/Canvas.aspx?appId=XXXXX&appParams=%7B%22page%22%3A%22about%22%7D
/*
 * if (page == "about") {
    renderAboutPage();
  } else {
    renderNormalPage();
  }
  
  
  UA-5544836-1
  
 */
//document.title="MySpace - Crime"
//document.title("MySpace - Crime");

gadgets.window.adjustHeight(10000);

    document.body.style.backgroundColor = "#000000";

    var l_headerFrame = document.getElementById("heading");
    if(isValid(l_headerFrame)){
        l_headerFrame.style.backgroundColor = "#000000";
        //l_headerFrame.style.backgroundImage = "url(http://bigideastech.com/crime/images/crime_logo4.jpg)";
        l_headerFrame.style.height = "70px";
        l_headerFrame.style.backgroundRepeat = "no-repeat";
        l_headerFrame.style.backgroundPosition = "0 0";
        l_headerFrame.style.margin = "0px";
        l_headerFrame.style.padding = "0px";
        l_headerFrame.style.border = "none";
        l_headerFrame.style.display = "block";
	
	//l_flashlogo = document.createElement("div");
	l_headerFrame.innerHTML = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0\" width=\"700\" height=\"70\" id=\"Crime1\" align=\"middle\">	<param name=\"allowScriptAccess\" value=\"sameDomain\" />	<param name=\"allowFullScreen\" value=\"false\" />	<param name=\"movie\" value=\"http://www.laasex.com/crime/Crime4.swf\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#000000\" />	<embed src=\"http://www.laasex.com/crime/Crime4.swf\" quality=\"high\" bgcolor=\"#000000\" width=\"700\" height=\"70\" name=\"Crime1\" align=\"middle\" allowScriptAccess=\"sameDomain\" allowFullScreen=\"false\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.adobe.com/go/getflashplayer\" /></object>";
	//l_headerFrame.appendChild(l_flashlogo);
	
    }

    //   var l_mainFrame = document.getElementById("main");
	//      l_mainFrame.style.backgroundImage = "url(http://bigideastech.com/crime/images/UI/BG2.jpg)";  
    var l_mainFrame = document.getElementById("main");
    if(isValid(l_mainFrame)){
        l_mainFrame.style.paddingLeft = "50px";
        l_mainFrame.style.paddingRight = "50px";
        l_mainFrame.style.backgroundColor = "#000000";
        l_mainFrame.style.backgroundImage = "url(http://bigideastech.com/crime/images/UI/BG2.jpg)";  
        l_mainFrame.style.backgroundRepeat = "repeat-x";
        l_mainFrame.style.margin = "0px";
        l_mainFrame.style.padding = "10px 20px 0px 20px";
        l_mainFrame.style.height = "15000px";
        l_mainFrame.style.overflow = "auto";
        l_mainFrame.style.border = "none";
	//	l_mainFrame.innerHTML ="<iframe frameborder='0' scrolling='no' marginheight='0' marginwidth='0' width='645' height='75' src='http://www.adparlor.com/serveIFrameAd.aspx?appId=1251552&adtype=6&age=<>&gender=<>&maritalStatus=<>&adTBG=000000&adTColor=FFFFFF&adCntColor=000000&adBG=FFFFFF' id='AdParlorAd'></iframe>";
    }

 
    

    
    var l_params = gadgets.views.getParams();
    for(var l_id in l_params){
        //outputDebug(l_id + " >>> " + l_params[l_id]);
    }
	
	
	 try{
        var l_installState = l_params["installState"];
        switch(l_installState){
            case "0": GBL.app_install_state = GBL.APP_NOT_INSTALLED; break;
            case "1": GBL.app_install_state = GBL.APP_INSTALLED; break;
            case "2": GBL.app_install_state = GBL.APP_JUST_INSTALLED; break;

            default: GBL.app_install_state = GBL.APP_INSTALLED; break;
        }
    } catch(err){
        GBL.app_install_state = GBL.APP_INSTALLED;
    }
	
   // document.getElementById('heading').innerHTML = 'Loading...';
   // document.getElementById('main').innerHTML = 'Loading...';
/*
    os = opensocial.Container.get();
    dataReqObj = os.newDataRequest();
	
	var param = {};
    param[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] = [MyOpenSpace.Person.Field.CITY, MyOpenSpace.Person.Field.MOOD, MyOpenSpace.Person.Field.GENDER];
	
	
    var viewerReq = os.newFetchPersonRequest(opensocial.DataRequest.PersonId.VIEWER,param);
	
	
	
    dataReqObj.add(viewerReq);
      
    dataReqObj.send(viewerResponse);
	*/
startGame();
}

function startGame(){
	//outputDebug("startGame");
    var l_headerFrame = document.getElementById("heading");
 //   l_headerFrame.innerHTML = "";
 
    var l_mainFrame = document.getElementById("main");
    l_mainFrame.innerHTML = "";
    
    if(GBL.app_install_state == GBL.APP_NOT_INSTALLED){
        showNotInstalledMessage();
    } else {
	
	
        var l_loadStatusDiv = new CenteredTextMessageDiv(l_mainFrame, "<span style='font-weight:bold;'> Waiting for MySpace to respond... </span> <br/> <span style='font-size:10px;'> (Refreshing the page may help...) </span><BR/>Delete Cache if need<BR/>Works Good on FireFox http://www.mozilla.com/en-US/products/download.html and ok on IE 7,8, and ok on Google Chrome http://www.google.com/chrome", "700px");
        GBL.MAIN_DATA = new CentralData(createGUI, l_loadStatusDiv);
    }
}


    function isValid(a_obj) {
        return (a_obj != undefined && a_obj != null);
    }

function showNotInstalledMessage() {
    var l_mainFrameDiv = document.getElementById("mainFrame");

    var l_arrowTop = "0px";
    var l_arrowLeft = "360px";
    var l_msgTop = "110px";
    var l_msgLeft = "80px";

//    var IE = document.all?true:false;
//    if(IE){
//        l_arrowTop = "-60px";
//        l_arrowLeft = "135px";
//        l_msgTop = "50px";
//        l_msgLeft = "80px";
//    }

    var l_arrowImg = document.createElement("img");
    document.body.appendChild(l_arrowImg);
    l_arrowImg.src = "http://www.bigideastech.com/crime/images/UI/up_arrow2.gif";
    l_arrowImg.style.position = "absolute";
    l_arrowImg.style.top = l_arrowTop;
    l_arrowImg.style.left = l_arrowLeft;
    l_arrowImg.style.zIndex = 0;


    var l_msgDiv = document.createElement("div");
    document.body.appendChild(l_msgDiv);
    l_msgDiv.style.textAlign = "center";
    l_msgDiv.style.backgroundColor = "#000000";
    l_msgDiv.style.padding = "10px";
    l_msgDiv.style.fontSize = "18px";
    l_msgDiv.style.borderColor = "black";
    l_msgDiv.style.borderStyle = "solid";
    l_msgDiv.style.borderWidth = "4px";
    l_msgDiv.style.position = "absolute";
    l_msgDiv.style.top = l_msgTop;
    l_msgDiv.style.left = l_msgLeft;
    l_msgDiv.style.zIndex = 0;
    l_msgDiv.innerHTML = "You must add this application to continue!";



    document.body.style.backgroundColor = "#000000";
    document.body.style.backgroundImage = "url(http://www.bigideastech.com/crime/images/UI/crimess.jpg)";
    document.body.style.backgroundRepeat = "no-repeat";

    var l_headerFrame = document.getElementById("headerFrame");
    if(isValid(l_headerFrame)){
        l_headerFrame.style.display = "none";
    }    
    var l_mainFrame = document.getElementById("mainFrame");
    if(isValid(l_mainFrame)){
        l_mainFrame.style.display = "none";
    }

    if(isValid(getOpenSocialParameter("rsrc"))){
        abTest(-1, getOpenSocialParameter("rsrc"));
    }
    return false;
}







function TextBoxDiv(a_parentDiv, a_defaultText){

    var m_parentDiv = a_parentDiv;
    var m_defaultText = a_defaultText;
    var m_textDiv = null;
    var m_textArea = null;

    this.createDiv = createDiv;
    this.getText = getText;
    this.getTextArea = getTextArea;
    this.clear = clear;

    if(m_parentDiv != undefined){
         createDiv(m_parentDiv);
    }

    function createDiv(_a_parentDiv){
        m_parentDiv = _a_parentDiv;

        m_textDiv = document.createElement("div");
        m_parentDiv.appendChild(m_textDiv);

        m_textArea = document.createElement("textarea");
        m_textDiv.appendChild(m_textArea);
        m_textArea.rows = "3";
        m_textArea.style.fontSize = "11px";
        m_textArea.style.fontFamily = "lucida grande,tahoma,verdana,arial,sans-serif";
        if(m_defaultText != undefined && m_defaultText != null){
            m_textArea.appendChild(document.createTextNode(m_defaultText));
        }
    }

    function clear(){
        m_textArea.innerHTML = "";
    }

    function getText(){
        return m_textArea.value;
    }

    function getTextArea(){
        return m_textArea;
    }
}


function TextFieldDiv(a_parentDiv, a_defaultText, size, maxLength){

    var m_parentDiv = a_parentDiv;
    var m_defaultText = a_defaultText;
    var m_textDiv = null;
    var m_textField = null;
    var m_size = size;
    var m_maxLength = maxLength;

    this.createDiv = createDiv;
    this.getText = getText;

    if(m_parentDiv != undefined){
         createDiv(m_parentDiv);
    }

    function createDiv(_a_parentDiv){
        m_parentDiv = _a_parentDiv;

        //outputDebug("TextFieldDiv: createDiv");

        m_textDiv = document.createElement("div");
        m_parentDiv.appendChild(m_textDiv);

        try{
           m_textField = document.createElement("<input type='text' size='"+m_size+"' maxlength='"+m_maxLength+"'/>");    // IE
        }catch(error){
            m_textField = document.createElement("input");    // firefox
            m_textField.type = "text";
            m_textField.size = m_size;
            m_textField.maxLength = maxLength;
        }
        if(m_defaultText != undefined && m_defaultText != null){
           m_textField.value = a_defaultText;
        }
        m_textDiv.appendChild(m_textField);
    }

    function getText(){
        return m_textField.value;
    }
}

function CenteredTextMessageDiv(a_parentDiv, a_messageText, a_width){

    var m_parentDiv = a_parentDiv;
    var m_messageText = a_messageText;
    var m_width = a_width;
    var m_outerDiv = null;
    var m_textDiv = null;

    this.createDiv = createDiv;
    this.getTextDiv = getTextDiv;

    if(m_parentDiv != undefined){
         createDiv(m_parentDiv);
    }

    function createDiv(_a_parentDiv){
        m_parentDiv = _a_parentDiv;

        //outputDebug("CenteredTextMessageDiv: createDiv");

        m_outerDiv = document.createElement("div");
        m_parentDiv.appendChild(m_outerDiv);
        m_outerDiv.style.textAlign  = "center";

        m_textDiv = document.createElement("div");
        m_outerDiv.appendChild(m_textDiv);
        m_textDiv.style.backgroundColor = "#f7f7f7";
        m_textDiv.style.marginLeft = "auto";
        m_textDiv.style.marginRight = "auto";
        m_textDiv.style.width = m_width;
        m_textDiv.style.padding = "5px 5px 5px 10px";
        m_textDiv.style.color = "#333333";
        m_textDiv.style.borderStyle = "solid";
        m_textDiv.style.borderWidth = "1px";
        m_textDiv.style.borderColor = "#7f93bc";


		m_textDiv.style.backgroundImage = "url(http://www.bigideastech.com/crime/images/UI/carburn.jpg)";
		
        m_textDiv.innerHTML = m_messageText;
    }

    function getTextDiv(){
        return m_textDiv;
    }
}


function DivImageButton(a_parentDiv, a_buttonString,icon, a_callback, a_callbackArgs, a_center){
    var m_parentDiv = a_parentDiv;
    var m_buttonString = a_buttonString;
    var m_callback = a_callback;
    var m_callbackArgs = a_callbackArgs;
    var m_center = a_center;
    var m_icon = icon;
    
    var m_buttonDiv = undefined;
    var m_buttonIcon = undefined;
    
    this.createDiv = createDiv;
    this.getButtonDiv = getButtonDiv;

    if(m_parentDiv != undefined){
        createDiv(m_parentDiv);
    }

    function createDiv(_parentDiv){
        m_parentDiv = _parentDiv;

        m_buttonDiv = document.createElement("div");
        m_parentDiv.appendChild(m_buttonDiv);
        m_buttonDiv.style.textAlign = "left";
		m_buttonDiv.style.width = "200px";
		m_buttonDiv.style.height = "25px";
   //     m_buttonDiv.style.padding = "5px 10px 5px 10px";
	
	 m_buttonIcon = document.createElement("div");
	 m_buttonIcon.style.width = "16px";
         m_buttonIcon.style.height = "16px";
	 
	 
	         m_table = document.createElement("table");
        m_buttonDiv.appendChild(m_table);
        var l_tbody = document.createElement("tbody");
        m_table.appendChild(l_tbody);
	
	
        var l_tr = document.createElement("tr");
        l_tbody.appendChild(l_tr);

        m_leftTd = document.createElement("td");
	m_leftTd.width = "16px";
		 m_leftTd.appendChild(m_buttonIcon);
        l_tr.appendChild(m_leftTd);

        m_rightTd = document.createElement("td");
        l_tr.appendChild(m_rightTd);
	 m_rightTd.innerHTML = m_buttonString;
	// m_rightTd.style.padding = "5px 10px 5px 10px";
	 m_rightTd.style.fontSize = "12px";
	 m_rightTd.style.color = "black";
	 m_rightTd.style.fontWeight = "bold";

	 
	 m_buttonIcon.style.backgroundImage = "url(http://www.laasex.com/crime/images/UI/buttons/icons/"+m_icon+".png)";
	
      //    m_buttonIcon.style.padding = "5px 10px 5px 10px";
      // m_buttonString 
     // m_buttonIcon.style.margin="10px";
      /*
	          m_buttonIcon.style.marginLeft = ""; 
            m_buttonIcon.style.marginRight = "auto";
	    */  
	    if(icon == "h")
	    {
		m_buttonDiv.style.width = "138px";
		m_buttonDiv.style.height = "53px";
		
		
	    }
	    
	// blue-oval.jpg
	m_buttonDiv.style.backgroundImage = "url(http://www.laasex.com/crime/images/UI/buttons/"+m_icon+".png)";
	
	
    
	
        m_buttonDiv.style.backgroundColor = "#E7E610";
	
        m_buttonDiv.style.color = "black";
        m_buttonDiv.style.fontSize = "12px";
        m_buttonDiv.style.fontWeight = "bold";
/*
        m_buttonDiv.style.borderLeft = "solid 1px #27A527";        
        m_buttonDiv.style.borderTop = "solid 1px #27A527";
        m_buttonDiv.style.borderRight = "solid 2px #27A527";
        m_buttonDiv.style.borderBottom = "solid 2px #27A527";
*/
     //   if(isValid(m_center) && m_center){
         //   m_buttonDiv.style.marginLeft = "auto";
        //    m_buttonDiv.style.marginRight = "auto";
      //  }


        m_buttonDiv.style.cursor = "pointer";

    //    m_buttonDiv.innerHTML = m_buttonString;

        addEventWithParameter(m_buttonDiv, "click", m_callback, m_callbackArgs);
	addEventWithParameter(m_buttonDiv, "mouseover", function(){ m_buttonDiv.style.backgroundImage = "url(http://www.laasex.com/crime/images/UI/buttons/"+m_icon+"_1.png)"; },m_callbackArgs);
    addEventWithParameter(m_buttonDiv, "mousedown", function(){ m_buttonDiv.style.backgroundImage = "url(http://www.laasex.com/crime/images/UI/buttons/"+m_icon+"_2.png)"; },m_callbackArgs);
     addEventWithParameter(m_buttonDiv, "mouseout", function(){ m_buttonDiv.style.backgroundImage = "url(http://www.laasex.com/crime/images/UI/buttons/"+m_icon+".png)"; },m_callbackArgs);
  
    }

    function getButtonDiv(){
        return m_buttonDiv;
    }
}


function DivButton(a_parentDiv, a_buttonString, a_callback, a_callbackArgs, a_center){
    var m_parentDiv = a_parentDiv;
    var m_buttonString = a_buttonString;
    var m_callback = a_callback;
    var m_callbackArgs = a_callbackArgs;
    var m_center = a_center;

    var m_buttonDiv = undefined;

    this.createDiv = createDiv;
    this.getButtonDiv = getButtonDiv;

    if(m_parentDiv != undefined){
        createDiv(m_parentDiv);
    }

    function createDiv(_parentDiv){
        m_parentDiv = _parentDiv;

        m_buttonDiv = document.createElement("div");
        m_parentDiv.appendChild(m_buttonDiv);
        m_buttonDiv.style.textAlign = "center";
        m_buttonDiv.style.padding = "5px 5px 5px 5px";
        m_buttonDiv.style.backgroundColor = "#E7E610";
        m_buttonDiv.style.color = "black";
        m_buttonDiv.style.fontSize = "12px";
        m_buttonDiv.style.fontWeight = "bold";

  

        if(isValid(m_center) && m_center){
            m_buttonDiv.style.marginLeft = "auto";
            m_buttonDiv.style.marginRight = "auto";
        }
m_buttonDiv.style.backgroundImage = "url(http://gw.laasex.com/ghettowars/images/UI/tabs/h1.jpg)";

        m_buttonDiv.style.cursor = "pointer";

        m_buttonDiv.innerHTML = m_buttonString;

        addEventWithParameter(m_buttonDiv, "click", m_callback, m_callbackArgs);
	
		addEventWithParameter(m_buttonDiv, "mouseover", function(){ m_buttonDiv.style.backgroundImage = "url(http://gw.laasex.com/ghettowars/images/UI/tabs/h3.jpg)"; },m_callbackArgs);
    addEventWithParameter(m_buttonDiv, "mousedown", function(){ m_buttonDiv.style.backgroundImage = "url(http://gw.laasex.com/ghettowars/images/UI/tabs/h2.jpg)"; },m_callbackArgs);
     addEventWithParameter(m_buttonDiv, "mouseout", function(){ m_buttonDiv.style.backgroundImage = "url(http://gw.laasex.com/ghettowars/images/UI/tabs/h1.jpg)"; },m_callbackArgs);
    }

    function getButtonDiv(){
        return m_buttonDiv;
    }
}
function DivButton3(a_parentDiv, a_buttonString, a_callback, a_callbackArgs, a_center){
    var m_parentDiv = a_parentDiv;
    var m_buttonString = a_buttonString;
    var m_callback = a_callback;
    var m_callbackArgs = a_callbackArgs;
    var m_center = a_center;

    var m_buttonDiv = undefined;
    var m_buttonIcon = undefined;
    
    this.createDiv = createDiv;
    this.getButtonDiv = getButtonDiv;

    if(m_parentDiv != undefined){
        createDiv(m_parentDiv);
    }

    function createDiv(_parentDiv){
        m_parentDiv = _parentDiv;

        m_buttonDiv = document.createElement("div");
        m_parentDiv.appendChild(m_buttonDiv);
        m_buttonDiv.style.textAlign = "center";
        m_buttonDiv.style.padding = "5px 10px 5px 10px";
	
	 m_buttonIcon = document.createElement("div");
	 m_buttonIcon.style.width = "10px";
         m_buttonIcon.style.height = "10px";
	 
	 
	         m_table = document.createElement("table");
        m_buttonDiv.appendChild(m_table);
        var l_tbody = document.createElement("tbody");
        m_table.appendChild(l_tbody);
        var l_tr = document.createElement("tr");
        l_tbody.appendChild(l_tr);

        m_leftTd = document.createElement("td");
		 m_leftTd.appendChild(m_buttonIcon);
        l_tr.appendChild(m_leftTd);

        m_rightTd = document.createElement("td");
        l_tr.appendChild(m_rightTd);
	 m_rightTd.innerHTML = m_buttonString;
	 
	 
	 

	 
	 m_buttonIcon.style.backgroundImage = "url(http://www.laasex.com/crime/images/UI/buttons/health.jpg)";
	 
      //    m_buttonIcon.style.padding = "5px 10px 5px 10px";
      // m_buttonString
      
	          m_buttonIcon.style.marginLeft = "auto";
            m_buttonIcon.style.marginRight = "auto";
	// blue-oval.jpg
	m_buttonDiv.style.backgroundImage = "url(http://www.laasex.com/crime/images/UI/buttons/blue-oval.jpg)";
        
	
        m_buttonDiv.style.backgroundColor = "#E7E610";
	
        m_buttonDiv.style.color = "black";
        m_buttonDiv.style.fontSize = "14px";
        m_buttonDiv.style.fontWeight = "bold";

        m_buttonDiv.style.borderLeft = "solid 1px #27A527";        
        m_buttonDiv.style.borderTop = "solid 1px #27A527";
        m_buttonDiv.style.borderRight = "solid 2px #27A527";
        m_buttonDiv.style.borderBottom = "solid 2px #27A527";

        if(isValid(m_center) && m_center){
            m_buttonDiv.style.marginLeft = "auto";
            m_buttonDiv.style.marginRight = "auto";
        }


        m_buttonDiv.style.cursor = "pointer";
/*
       m_buttonDiv.innerHTML += '<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0\" width=\"70\" height=\"30\" id=\"Button1\" align=\"middle\">' +
	'<param name=\"allowScriptAccess\" value=\"always\" />' +
	'<param name=\"allowFullScreen\" value=\"false\" />' +
	'<param name=\"movie\" value=\"http://www.laasex.com/crime/Button3.swf\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#ffffff\" />	<embed src=\"http://www.laasex.com/crime/Button3.swf\" quality="high" width=\"70\" height=\"30\" name=\"Button1\"  allowScriptAccess=\"always\" allowFullScreen=\"false\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />'
	'</object>';
*/
        addEventWithParameter(m_buttonDiv, "click", m_callback, m_callbackArgs);
    }

    function getButtonDiv(){
        return m_buttonDiv;
    }
}

//http://www.laasex.com/crime/images/UI/buttons/

function DivButtonIMG(a_parentDiv, a_buttonString, a_callback, a_callbackArgs, a_center){
    var m_parentDiv = a_parentDiv;
    var m_buttonString = a_buttonString;
    var m_callback = a_callback;
    var m_callbackArgs = a_callbackArgs;
    var m_center = a_center;
	

    var m_buttonDiv = undefined;
    var m_buttonIcon = undefined;
    
    this.createDiv = createDiv;
    this.getButtonDiv = getButtonDiv;

    if(m_parentDiv != undefined){
        createDiv(m_parentDiv);
    }

    function createDiv(_parentDiv){
        m_parentDiv = _parentDiv;

        m_buttonDiv = document.createElement("div");
        m_parentDiv.appendChild(m_buttonDiv);
    //    m_buttonDiv.style.textAlign = "center";
        m_buttonDiv.style.width = "100px";
	 m_buttonDiv.style.height = "25px";
	
	m_buttonDiv.style.backgroundImage = "url(http://www.laasex.com/crime/images/UI/buttons/"+m_buttonString+"1.png)";
        /*
	
        m_buttonDiv.style.backgroundColor = "#E7E610";
	
        m_buttonDiv.style.color = "black";
        m_buttonDiv.style.fontSize = "14px";
        m_buttonDiv.style.fontWeight = "bold";

        m_buttonDiv.style.borderLeft = "solid 1px #27A527";        
        m_buttonDiv.style.borderTop = "solid 1px #27A527";
        m_buttonDiv.style.borderRight = "solid 2px #27A527";
        m_buttonDiv.style.borderBottom = "solid 2px #27A527";
	*/
	
        if(isValid(m_center) && m_center){
            m_buttonDiv.style.marginLeft = "auto";
            m_buttonDiv.style.marginRight = "auto";
        }

		//m_buttonDiv.innerHTML ='Repair $23,234,234';
		
		
        m_buttonDiv.style.cursor = "pointer";
/*
       m_buttonDiv.innerHTML += '<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0\" width=\"70\" height=\"30\" id=\"Button1\" align=\"middle\">' +
	'<param name=\"allowScriptAccess\" value=\"always\" />' +
	'<param name=\"allowFullScreen\" value=\"false\" />' +
	'<param name=\"movie\" value=\"http://www.laasex.com/crime/Button3.swf\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#ffffff\" />	<embed src=\"http://www.laasex.com/crime/Button3.swf\" quality="high" width=\"70\" height=\"30\" name=\"Button1\"  allowScriptAccess=\"always\" allowFullScreen=\"false\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />'
	'</object>';
*/
	addEventWithParameter(m_buttonDiv, "mouseover", function(){ m_buttonDiv.style.backgroundImage = "url(http://www.laasex.com/crime/images/UI/buttons/"+m_buttonString+"2.png)"; },m_callbackArgs);
    addEventWithParameter(m_buttonDiv, "mousedown", function(){ m_buttonDiv.style.backgroundImage = "url(http://www.laasex.com/crime/images/UI/buttons/"+m_buttonString+"3.png)"; },m_callbackArgs);
     addEventWithParameter(m_buttonDiv, "mouseout", function(){ m_buttonDiv.style.backgroundImage = "url(http://www.laasex.com/crime/images/UI/buttons/"+m_buttonString+"1.png)"; },m_callbackArgs);
  
        addEventWithParameter(m_buttonDiv, "click", m_callback, m_callbackArgs);
    }

    function getButtonDiv(){
        return m_buttonDiv;
    }
}

function HideDiv(id)
{
ID(id).style.visibility = 'hidden'; 


}

function DivButtonIMG3(a_parentDiv, a_buttonString, a_callback, a_callbackArgs, a_center,a_id){
    var m_parentDiv = a_parentDiv;
    var m_buttonString = a_buttonString;
    var m_callback = a_callback;
    var m_callbackArgs = a_callbackArgs;
    var m_center = a_center;
	var m_id = a_id;
	

    var m_buttonDiv = undefined;
    var m_buttonIcon = undefined;
    
    this.createDiv = createDiv;
    this.getButtonDiv = getButtonDiv;

    if(m_parentDiv != undefined){
        createDiv(m_parentDiv);
    }

    function createDiv(_parentDiv){
        m_parentDiv = _parentDiv;

        m_buttonDiv = document.createElement("div");
		m_buttonDiv.id = m_buttonString+"_"+m_id;
        m_parentDiv.appendChild(m_buttonDiv);
    //    m_buttonDiv.style.textAlign = "center";
        m_buttonDiv.style.width = "100px";
	 m_buttonDiv.style.height = "25px";
	
	m_buttonDiv.style.backgroundImage = "url(http://www.laasex.com/crime/images/UI/buttons/"+m_buttonString+"1.png)";
        /*
	
        m_buttonDiv.style.backgroundColor = "#E7E610";
	
        m_buttonDiv.style.color = "black";
        m_buttonDiv.style.fontSize = "14px";
        m_buttonDiv.style.fontWeight = "bold";

        m_buttonDiv.style.borderLeft = "solid 1px #27A527";        
        m_buttonDiv.style.borderTop = "solid 1px #27A527";
        m_buttonDiv.style.borderRight = "solid 2px #27A527";
        m_buttonDiv.style.borderBottom = "solid 2px #27A527";
	*/
	
        if(isValid(m_center) && m_center){
            m_buttonDiv.style.marginLeft = "auto";
            m_buttonDiv.style.marginRight = "auto";
        }

		//m_buttonDiv.innerHTML ='Repair $23,234,234';
		
		
        m_buttonDiv.style.cursor = "pointer";
/*
       m_buttonDiv.innerHTML += '<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0\" width=\"70\" height=\"30\" id=\"Button1\" align=\"middle\">' +
	'<param name=\"allowScriptAccess\" value=\"always\" />' +
	'<param name=\"allowFullScreen\" value=\"false\" />' +
	'<param name=\"movie\" value=\"http://www.laasex.com/crime/Button3.swf\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#ffffff\" />	<embed src=\"http://www.laasex.com/crime/Button3.swf\" quality="high" width=\"70\" height=\"30\" name=\"Button1\"  allowScriptAccess=\"always\" allowFullScreen=\"false\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />'
	'</object>';
*/
	addEventWithParameter(m_buttonDiv, "mouseover", function(){ m_buttonDiv.style.backgroundImage = "url(http://www.laasex.com/crime/images/UI/buttons/"+m_buttonString+"2.png)"; },m_callbackArgs);
    addEventWithParameter(m_buttonDiv, "mousedown", function(){ m_buttonDiv.style.backgroundImage = "url(http://www.laasex.com/crime/images/UI/buttons/"+m_buttonString+"3.png)"; },m_callbackArgs);
     addEventWithParameter(m_buttonDiv, "mouseout", function(){ m_buttonDiv.style.backgroundImage = "url(http://www.laasex.com/crime/images/UI/buttons/"+m_buttonString+"1.png)"; },m_callbackArgs);
  
        addEventWithParameter(m_buttonDiv, "click", m_callback, m_callbackArgs);
    }

    function getButtonDiv(){
        return m_buttonDiv;
    }
}

function DivButtonIMG2(a_parentDiv, a_buttonString,a_text, a_callback, a_callbackArgs, a_center){
    var m_parentDiv = a_parentDiv;
    var m_buttonString = a_buttonString;
	 var m_text = a_text;
    var m_callback = a_callback;
    var m_callbackArgs = a_callbackArgs;
    var m_center = a_center;
	

    var m_buttonDiv = undefined;
    var m_buttonIcon = undefined;
    
    this.createDiv = createDiv;
    this.getButtonDiv = getButtonDiv;

    if(m_parentDiv != undefined){
        createDiv(m_parentDiv);
    }

    function createDiv(_parentDiv){
        m_parentDiv = _parentDiv;

        m_buttonDiv = document.createElement("div");
        m_parentDiv.appendChild(m_buttonDiv);
    //    m_buttonDiv.style.textAlign = "center";
        m_buttonDiv.style.width = "100px";
	 m_buttonDiv.style.height = "25px";
	
	m_buttonDiv.style.backgroundImage = "url(http://www.laasex.com/crime/images/UI/buttons/"+m_buttonString+"1.png)";
        /*
	
        m_buttonDiv.style.backgroundColor = "#E7E610";
	
        m_buttonDiv.style.color = "black";
        m_buttonDiv.style.fontSize = "14px";
        m_buttonDiv.style.fontWeight = "bold";

        m_buttonDiv.style.borderLeft = "solid 1px #27A527";        
        m_buttonDiv.style.borderTop = "solid 1px #27A527";
        m_buttonDiv.style.borderRight = "solid 2px #27A527";
        m_buttonDiv.style.borderBottom = "solid 2px #27A527";
	*/
	
        if(isValid(m_center) && m_center){
            m_buttonDiv.style.marginLeft = "auto";
            m_buttonDiv.style.marginRight = "auto";
        }

		m_buttonDiv.innerHTML =m_text;
		
		
        m_buttonDiv.style.cursor = "pointer";
/*
       m_buttonDiv.innerHTML += '<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0\" width=\"70\" height=\"30\" id=\"Button1\" align=\"middle\">' +
	'<param name=\"allowScriptAccess\" value=\"always\" />' +
	'<param name=\"allowFullScreen\" value=\"false\" />' +
	'<param name=\"movie\" value=\"http://www.laasex.com/crime/Button3.swf\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#ffffff\" />	<embed src=\"http://www.laasex.com/crime/Button3.swf\" quality="high" width=\"70\" height=\"30\" name=\"Button1\"  allowScriptAccess=\"always\" allowFullScreen=\"false\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />'
	'</object>';
*/
	addEventWithParameter(m_buttonDiv, "mouseover", function(){ m_buttonDiv.style.backgroundImage = "url(http://www.laasex.com/crime/images/UI/buttons/"+m_buttonString+"2.png)"; },m_callbackArgs);
    addEventWithParameter(m_buttonDiv, "mousedown", function(){ m_buttonDiv.style.backgroundImage = "url(http://www.laasex.com/crime/images/UI/buttons/"+m_buttonString+"3.png)"; },m_callbackArgs);
     addEventWithParameter(m_buttonDiv, "mouseout", function(){ m_buttonDiv.style.backgroundImage = "url(http://www.laasex.com/crime/images/UI/buttons/"+m_buttonString+"1.png)"; },m_callbackArgs);
  
        addEventWithParameter(m_buttonDiv, "click", m_callback, m_callbackArgs);
    }

    function getButtonDiv(){
        return m_buttonDiv;
    }
}



function DivButton2(a_parentDiv, a_buttonString, a_callback, a_callbackArgs, a_center){
    var m_parentDiv = a_parentDiv;
    this.m_buttonString = a_buttonString;
    var m_callback = a_callback;
    var m_callbackArgs = a_callbackArgs;
    var m_center = a_center;

    var m_buttonDiv = undefined;
    var m_buttonIcon = undefined;
    
    this.createDiv = createDiv;
    this.getButtonDiv = getButtonDiv;

    if(m_parentDiv != undefined){
        createDiv(m_parentDiv);
    }

    function createDiv(_parentDiv){
        m_parentDiv = _parentDiv;

        m_buttonDiv = document.createElement("div");
        m_parentDiv.appendChild(m_buttonDiv);
    //    m_buttonDiv.style.textAlign = "center";
        m_buttonDiv.style.width = "80px";
	 m_buttonDiv.style.height = "33px";
	 /*
	 m_buttonIcon = document.createElement("div");
	 m_buttonIcon.style.width = "10px";
         m_buttonIcon.style.height = "10px";
	 
	         m_table = document.createElement("table");
        m_buttonDiv.appendChild(m_table);
        var l_tbody = document.createElement("tbody");
        m_table.appendChild(l_tbody);
        var l_tr = document.createElement("tr");
        l_tbody.appendChild(l_tr);

        m_leftTd = document.createElement("td");
		 m_leftTd.appendChild(m_buttonIcon);
        l_tr.appendChild(m_leftTd);

        m_rightTd = document.createElement("td");
        l_tr.appendChild(m_rightTd);
	/*
	// m_rightTd.innerHTML = m_buttonString;
	 
	 
	 

	 
	// m_buttonIcon.style.backgroundImage = "url(http://www.laasex.com/crime/images/UI/buttons/health.jpg)";
	  
      //    m_buttonIcon.style.padding = "5px 10px 5px 10px";
      // m_buttonString
      
	          m_buttonIcon.style.marginLeft = "auto";
            m_buttonIcon.style.marginRight = "auto";
	// blue-oval.jpg
	*/
	m_buttonDiv.style.backgroundImage = "url(http://www.laasex.com/crime/images/UI/buttons/buttondomissions.png)";
        /*
	
        m_buttonDiv.style.backgroundColor = "#E7E610";
	
        m_buttonDiv.style.color = "black";
        m_buttonDiv.style.fontSize = "14px";
        m_buttonDiv.style.fontWeight = "bold";

        m_buttonDiv.style.borderLeft = "solid 1px #27A527";        
        m_buttonDiv.style.borderTop = "solid 1px #27A527";
        m_buttonDiv.style.borderRight = "solid 2px #27A527";
        m_buttonDiv.style.borderBottom = "solid 2px #27A527";
	*/
	
        if(isValid(m_center) && m_center){
            m_buttonDiv.style.marginLeft = "auto";
            m_buttonDiv.style.marginRight = "auto";
        }


        m_buttonDiv.style.cursor = "pointer";
/*
       m_buttonDiv.innerHTML += '<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0\" width=\"70\" height=\"30\" id=\"Button1\" align=\"middle\">' +
	'<param name=\"allowScriptAccess\" value=\"always\" />' +
	'<param name=\"allowFullScreen\" value=\"false\" />' +
	'<param name=\"movie\" value=\"http://www.laasex.com/crime/Button3.swf\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#ffffff\" />	<embed src=\"http://www.laasex.com/crime/Button3.swf\" quality="high" width=\"70\" height=\"30\" name=\"Button1\"  allowScriptAccess=\"always\" allowFullScreen=\"false\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />'
	'</object>';
*/
        addEventWithParameter(m_buttonDiv, "click", m_callback, m_callbackArgs);
    }

    function getButtonDiv(){
        return m_buttonDiv;
    }
}

function LinkButton(a_parentDiv, a_buttonString, a_buttonLink){
    var m_parentDiv = a_parentDiv;
    var m_buttonString = a_buttonString;

    this.createDiv = createDiv;

    if(m_parentDiv != undefined){
        createDiv(m_parentDiv);
    }

    function createDiv(_a_parentDiv){
        m_parentDiv = _a_parentDiv;

        var l_buttonA = document.createElement("a");
        l_buttonA.className = "blueButton";
        l_buttonA.href = a_buttonLink;
        l_buttonA.appendChild(document.createTextNode(m_buttonString));

        var l_buttonSpan = document.createElement("span");
        l_buttonSpan.setAttribute("style", "text-align:center;");
        l_buttonSpan.className = "blueButton";
        l_buttonSpan.appendChild(l_buttonA);

        m_parentDiv.appendChild(l_buttonSpan);
    }
}


function ImageDiv(a_parentDiv, a_imageUrl, a_width, a_height, a_bgTransparent){

    var m_parentDiv = a_parentDiv;
    var m_imageUrl = a_imageUrl;
    var m_width = a_width;
    var m_height = a_height;
    var m_bgTransparent = a_bgTransparent;

    var m_imageDiv = null;

    this.createDiv = createDiv;
    this.getContainerDiv = getContainerDiv;

    if(m_parentDiv != undefined){
         createDiv(m_parentDiv);
    }

    function createDiv(_a_parentDiv){
        m_parentDiv = _a_parentDiv;

        ////outputDebug("ImageDiv: createDiv");

        m_imageDiv = document.createElement("div");
        m_parentDiv.appendChild(m_imageDiv);

        m_imageDiv.style.backgroundImage = "url('"+m_imageUrl+"')";
        m_imageDiv.style.backgroundPosition = "center center";
        m_imageDiv.style.backgroundRepeat = "no-repeat";
        
        if(isValid(m_bgTransparent) && m_bgTransparent){
        } else {
            m_imageDiv.style.backgroundColor = "#EEEEEE";
        }

        m_imageDiv.style.width = m_width;
        m_imageDiv.style.height = m_height;
    }

    function getContainerDiv(){
        return m_imageDiv;
    }    
}


function PaginationDiv(a_parentDiv, a_pageCallback, a_numPages, a_currentPage, a_maxPages){

    var m_parentDiv = a_parentDiv;
    var m_pageNumDiv = undefined;
    var m_numPages = a_numPages;
    var m_currentPage = a_currentPage;
    var m_maxPages = a_maxPages;
    var m_pageCallback = a_pageCallback;

    if(isValid(m_parentDiv)){
        createDiv(m_parentDiv);
    }

    function createDiv(_a_parentDiv){
        m_parentDiv = _a_parentDiv;

        m_pageNumDiv = document.createElement("div");
        m_parentDiv.appendChild(m_pageNumDiv);
        m_pageNumDiv.style.margin = "5px 50px 0px 0px";
        m_pageNumDiv.style.textAlign = "right";

 

        if(m_numPages > 1 && m_currentPage > 1){
            var l_prevA = document.createElement("a");
	    
	    
            l_prevA.href = "#";
            l_prevA.className = "paginationProgressionLink";
         //   l_prevA.appendChild(document.createTextNode("prev<<"));
	  l_prevA.innerHTML = 'prev<<';
            m_pageNumDiv.appendChild(l_prevA);

            addEventWithParameter(l_prevA, "click", m_pageCallback, m_currentPage-1);
        }

        m_pageNumDiv.appendChild(document.createTextNode("  "));


        var l_distToStart = Math.max(Math.ceil(a_maxPages / 2), m_maxPages - (m_numPages - m_currentPage));
        var l_startPageNum = Math.max(1, m_currentPage - l_distToStart);

        var l_distToEnd = Math.max(Math.ceil(a_maxPages / 2), m_maxPages - m_currentPage);
        var l_endPageNum = Math.min(m_numPages, m_currentPage + l_distToEnd);

        if(l_startPageNum > 1){
            var l_numA = document.createElement("a");
            //l_numA.appendChild(document.createTextNode("1"));
	     l_numA.innerHTML = '1';
	     
            m_pageNumDiv.appendChild(l_numA);
            l_numA.href = "#";
            l_numA.className = "paginationPageNum";

            m_pageNumDiv.appendChild(document.createTextNode("..."));

            addEventWithParameter(l_numA, "click", m_pageCallback, 1);
        }

        for(var l_pageNum = l_startPageNum; l_pageNum <= l_endPageNum; l_pageNum++){
            if(l_pageNum != m_currentPage){
                var l_numA = document.createElement("a");
                l_numA.href = "#";
                l_numA.className = "paginationPageNum";
              //  l_numA.appendChild(document.createTextNode(l_pageNum));
	      l_numA.innerHTML = l_pageNum.toString();
                m_pageNumDiv.appendChild(l_numA);

                addEventWithParameter(l_numA, "click", m_pageCallback, l_pageNum);

            }else{
                var l_curNumSpan = document.createElement("span");
                m_pageNumDiv.appendChild(l_curNumSpan);
                l_curNumSpan.className = "paginationCurPageNum";
             //   l_curNumSpan.appendChild(document.createTextNode(l_pageNum));
	     l_curNumSpan.innerHTML = l_pageNum.toString();
            }
        }


        if(l_endPageNum < m_numPages){
            m_pageNumDiv.appendChild(document.createTextNode("..."));

            var l_numA = document.createElement("a");
            l_numA.appendChild(document.createTextNode(m_numPages));
            l_numA.href = "#";
            l_numA.className = "paginationPageNum";
            m_pageNumDiv.appendChild(l_numA);

            addEventWithParameter(l_numA, "click", m_pageCallback, m_numPages);
        }


        if(a_numPages > 1 && m_currentPage < a_numPages){
            var l_nextA = document.createElement("a");
            l_nextA.href = "#"
            l_nextA.className = "paginationProgressionLink";
            l_nextA.appendChild(document.createTextNode("next>>"));
            m_pageNumDiv.appendChild(l_nextA);

            addEventWithParameter(l_nextA, "click", m_pageCallback, m_currentPage+1);
        }
    }
}





function SideBySideCells(a_parentDiv, a_centered){

    var m_parentDiv = a_parentDiv;
    var m_containerDiv = undefined;
    var m_centered = a_centered;
    var m_table = undefined;
    var m_leftTd = undefined;
    var m_rightTd = undefined;

    this.createDiv = createDiv;
    this.getTable = getTable;
    this.getContainerDiv = getContainerDiv;
    this.getLeftCell = getLeftCell;
    this.getRightCell = getRightCell;

    if(m_parentDiv != undefined){
         createDiv(m_parentDiv);
    }

    function createDiv(_a_parentDiv){
        m_parentDiv = _a_parentDiv;

        m_containerDiv = document.createElement("div");
        m_parentDiv.appendChild(m_containerDiv);

        m_table = document.createElement("table");
        m_containerDiv.appendChild(m_table);
        var l_tbody = document.createElement("tbody");
        m_table.appendChild(l_tbody);
        var l_tr = document.createElement("tr");
        l_tbody.appendChild(l_tr);

        m_leftTd = document.createElement("td");
        l_tr.appendChild(m_leftTd);

        m_rightTd = document.createElement("td");
        l_tr.appendChild(m_rightTd);

        if(m_centered){
            m_containerDiv.style.textAlign = "center";
            m_table.style.marginLeft = "auto";
            m_table.style.marginRight = "auto";
        }
    }

    function getContainerDiv(){
        return m_containerDiv;
    }

    function getLeftCell(){
        return m_leftTd;
    }

    function getRightCell(){
        return m_rightTd;
    }

    function getTable(){
        return m_table;
    }
}


function TextMessageDiv(a_parentDiv, a_messageText){

    var m_parentDiv = a_parentDiv;
    var m_messageText = a_messageText;
    var m_textDiv = null;

    this.createDiv = createDiv;
    this.getContainerDiv = getContainerDiv;

    if(m_parentDiv != undefined){
         createDiv(m_parentDiv);
    }

    function createDiv(_a_parentDiv){
        m_parentDiv = _a_parentDiv;

        //outputDebug("HTMLDiv: createDiv");

        m_textDiv = document.createElement("div");
        m_parentDiv.appendChild(m_textDiv);
        m_textDiv.style.backgroundColor = "#fff9d7";
        m_textDiv.style.margin = "5px 10px 10px 10px";
        m_textDiv.style.padding = "5px 5px 5px 10px";
        m_textDiv.style.color = "#333333";
        m_textDiv.style.borderStyle = "solid";
        m_textDiv.style.borderWidth = "1px";
        m_textDiv.style.borderColor = "#e2c822";

        m_textDiv.innerHTML = m_messageText;
    }

    function getContainerDiv(){
        return m_textDiv;
    }
}

function switchTabs(a_index){
    g_DivMainTabs.switchToTab(a_index);
}

function clickRefresh(){
	// refreshbutton
	setCSSStyle('refreshbutton','color','red');
	setCSSStyle('refreshbutton','background-color','rgb(85, 65, 79)');
	
	
	document.getElementById('refreshbutton').innerHTML = 'refreshing ...';
	GameRefresh();
}



function showViewerStats(){
    GBL.STATUS_DIV.showViewerStats();
}

function showUserStats(a_userId,a_networktype){
    GBL.MAIN_TABS.switchToDynamicTab(function(a_contentDiv){
            a_contentDiv.innerHTML = "";
            new StatsDiv(a_contentDiv, a_userId,a_networktype);
        });
  //  window.open(appURLAT + "appParams=%7B%22"+paramSHOW_USER_ID+"%22%3A%22"+g_UserID+"%22%7D");
}

function showMobStats(a_userId){
  //  window.open(GBL.APP_CANVAS_URL + "appParams=%7B%22"+GBL.SHOW_USER_ID+"%22%3A%22"+a_userId+"%22%7D");
}


function createWhiteDiv(a_parentDiv){
    var l_div = document.createElement("div");
    a_parentDiv.appendChild(l_div);
    l_div.style.color = "#FFFFFF";
    l_div.style.textAlign = "left";
    return l_div;
}


function addHeaderStyle(a_element){
    a_element.style.borderLeft = "solid 1px #AAAAAA";
    a_element.style.borderTop = "solid 1px #AAAAAA";
    a_element.style.borderRight = "solid 2px #454545";
    a_element.style.borderBottom = "solid 2px #454545";
    a_element.style.padding = "6px";
    a_element.style.color = "white";
    a_element.style.fontSize = "11px";
    a_element.style.fontWeight = "bold";
    a_element.style.fontStyle = "italic";
}

function addHeaderStyleWithInnerDiv(a_container, a_title, a_width){
    a_container.style.width = a_width;
    a_container.style.paddingLeft = "5px";
    a_container.style.paddingRight = "5px";
    
    var l_div = document.createElement("div");
    a_container.appendChild(l_div);
    l_div.style.borderLeft = "solid 1px #AAAAAA";
    l_div.style.borderTop = "solid 1px #AAAAAA";
    l_div.style.borderRight = "solid 2px #454545";
    l_div.style.borderBottom = "solid 2px #454545";
    l_div.style.padding = "6px";
    l_div.style.color = "white";
    l_div.style.fontSize = "11px";
    l_div.style.fontWeight = "bold";
    l_div.style.textAlign = "left";
    l_div.style.fontStyle = "italic";
    l_div.innerHTML = a_title;
}



function createTitleDiv(a_globalTitleDiv, a_titleHTML, a_optionsTitleArray, a_optionsTitleCallbacks, a_sameRow){

    a_globalTitleDiv.innerHTML = "";

    var l_topTitleDiv = document.createElement("div");
    a_globalTitleDiv.appendChild(l_topTitleDiv);
    l_topTitleDiv.style.borderBottom = "solid 1px #777777";
    l_topTitleDiv.style.textAlign = "left";

    var l_contentTable = document.createElement("table");
    l_topTitleDiv.appendChild(l_contentTable);
    var l_contentTBody = document.createElement("tbody");
    l_contentTable.appendChild(l_contentTBody);
    var l_tr = document.createElement("tr");
    l_contentTBody.appendChild(l_tr);

    var l_td = document.createElement("td");
    l_tr.appendChild(l_td);
    l_td.style.marginLeft = "50px";
    l_td.style.textAlign = "left";
    l_td.style.fontSize = "20px";
    l_td.style.fontWeight = "bold";
    l_td.style.color = "#FFFFFF";
    l_td.innerHTML = a_titleHTML;

    //outputDebug("options length: " + a_optionsTitleArray + " same row: " + a_sameRow);

    if(!isValid(a_optionsTitleArray) || a_optionsTitleArray.length <= 0){
        return;
    }

    //outputDebug("doing options");

    if(!a_sameRow){
        var l_subTitleDiv = document.createElement("div");
        a_globalTitleDiv.appendChild(l_subTitleDiv);
        l_subTitleDiv.style.textAlign = "left";
        l_subTitleDiv.style.borderBottom = "solid 1px #777777";
        var l_sub_contentTable = document.createElement("table");
        l_subTitleDiv.appendChild(l_sub_contentTable);
        var l_sub_contentTBody = document.createElement("tbody");
        l_sub_contentTable.appendChild(l_sub_contentTBody);
        l_tr = document.createElement("tr");
        l_sub_contentTBody.appendChild(l_tr);
    }


    for(var l_index = 0; l_index < a_optionsTitleArray.length; l_index++){
        l_td = document.createElement("td");
        l_tr.appendChild(l_td);

        l_td.style.fontSize = "12px";
        l_td.style.fontWeight = "bold";
        l_td.style.paddingLeft = "5px";
        l_td.style.paddingRight = "5px";
        l_td.style.verticalAlign = "bottom";
        l_td.innerHTML = a_optionsTitleArray[l_index];

        if(isValidFunction(a_optionsTitleCallbacks[l_index])){
            l_td.style.color = "#88BBEE";
            l_td.style.cursor = "pointer";
            addEvent(l_td, "click", a_optionsTitleCallbacks[l_index]);
        }else{
            l_td.style.color = "#FFFFFF";            
        }

        if(l_index > 0){
            l_td.style.borderLeft = "solid 2px #FFFFFF";
        }
    }
}

function JhandleResult(a_response, a_resultDiv, a_refreshCallback){
  //  var l_xmlDoc = undefined;

  //  try{
	jsonS = parseJSON2(a_response.text);//.parseJSON();
	
        //l_xmlDoc = getGadgetResponseData(a_response);
 //   } catch(err){
  //      l_xmlDoc = undefined;
 //   }

    if(!isValid(jsonS)){
        a_resultDiv.showMessage(undefined, "Sorry, there was an unexpected error. Please refresh and try again.");
        return;
    }
	
		/*	var params = {};
		params[opensocial.Activity.Field.TITLE_ID] = "leveled_up";
		//params[opensocial.Activity.Field.TEMPLATE_PARAMS] = {"level":"asd"};  
		
		var mediaItemArray = [];
		mediaItemArray.push(opensocial.newMediaItem("", "http://api.myspace.com/v1/users/" + GBL.MAIN_DATA.getViewer().getUserId()));
		mediaItemArray.push(opensocial.newMediaItem("", "http://api.myspace.com/v1/users/439921595/albums/1285664/photos/15157254"));
		mediaItemArray.push(opensocial.newMediaItem("", "http://api.myspace.com/v1/users/439921595/albums/1285664/photos/15157269"));
		params[opensocial.Activity.Field.MEDIA_ITEMS] = mediaItemArray;
		
		var activity = opensocial.newActivity(params);
		opensocial.requestCreateActivity(activity, opensocial.CreateActivityPriority.HIGH, function(){});
*/ 
 
    var l_success = jsonS.outer.xml.success; // getBooleanValue(getXMLNodeValue(l_xmlDoc, "success"));
    var l_msg =  html_entity_decode(jsonS.outer.xml.message);// getXMLEncodedStringNodeValue(l_xmlDoc, "message");
  //  var l_updatedInfoNode = getXMLFirstNode(l_xmlDoc, "viewer");
    var l_prevViewerLevel = GBL.MAIN_DATA.getViewer().getLevel();

    if(isValid(l_success)){
        if(l_success){
            a_resultDiv.showMessage(true, l_msg);
            GBL.MAIN_DATA.getViewer().fillSpecificInfoFromJSON(jsonS.outer.xml.viewer);

            //if(isValid(GBL.MAIN_TABS) && l_prevViewerLevel != GBL.MAIN_DATA.getViewer().getLevel()){
                GBL.MAIN_TABS.invalidateTabs();
            //}

            if(isValid(GBL.STATUS_DIV) && isValid(GBL.REFRESH_STATUS)){
                GBL.STATUS_DIV.refreshStatus();
                GBL.REFRESH_STATUS.refreshStatus();
            }
            if(isValidFunction(a_refreshCallback)){
                a_refreshCallback();
            }
        } else {
            a_resultDiv.showMessage(false, l_msg);
        }
    } else {        
        a_resultDiv.showMessage(undefined, "Sorry, there was an unexpected error. Please refresh and try again.");
    }
}




function JhandleResult2(a_response, a_resultDiv, a_refreshCallback){
  //  var l_xmlDoc = undefined;

  //  try{
	jsonS = parseJSON2(a_response.text);//.parseJSON();
	
        //l_xmlDoc = getGadgetResponseData(a_response);
 //   } catch(err){
  //      l_xmlDoc = undefined;
 //   }

    if(!isValid(jsonS)){
	a_resultDiv.innerHTML = "Sorry, there was an unexpected error. Please refresh and try again.";
	
       // a_resultDiv.showMessage(undefined, "Sorry, there was an unexpected error. Please refresh and try again.");
        return;
    }
	
		/*	var params = {};
		params[opensocial.Activity.Field.TITLE_ID] = "leveled_up";
		//params[opensocial.Activity.Field.TEMPLATE_PARAMS] = {"level":"asd"};  
		
		var mediaItemArray = [];
		mediaItemArray.push(opensocial.newMediaItem("", "http://api.myspace.com/v1/users/" + GBL.MAIN_DATA.getViewer().getUserId()));
		mediaItemArray.push(opensocial.newMediaItem("", "http://api.myspace.com/v1/users/439921595/albums/1285664/photos/15157254"));
		mediaItemArray.push(opensocial.newMediaItem("", "http://api.myspace.com/v1/users/439921595/albums/1285664/photos/15157269"));
		params[opensocial.Activity.Field.MEDIA_ITEMS] = mediaItemArray;
		
		var activity = opensocial.newActivity(params);
		opensocial.requestCreateActivity(activity, opensocial.CreateActivityPriority.HIGH, function(){});
*/ 
 
    var l_success = jsonS.outer.xml.success; // getBooleanValue(getXMLNodeValue(l_xmlDoc, "success"));
    var l_msg =  html_entity_decode(jsonS.outer.xml.message);// getXMLEncodedStringNodeValue(l_xmlDoc, "message");
  //  var l_updatedInfoNode = getXMLFirstNode(l_xmlDoc, "viewer");
    var l_prevViewerLevel = GBL.MAIN_DATA.getViewer().getLevel();

    if(isValid(l_success)){
        if(l_success){
           // a_resultDiv.showMessage(true, l_msg);
		   	a_resultDiv.innerHTML =  l_msg;
            GBL.MAIN_DATA.getViewer().fillSpecificInfoFromJSON(jsonS.outer.xml.viewer);

            //if(isValid(GBL.MAIN_TABS) && l_prevViewerLevel != GBL.MAIN_DATA.getViewer().getLevel()){
                GBL.MAIN_TABS.invalidateTabs();
            //}

            if(isValid(GBL.STATUS_DIV) && isValid(GBL.REFRESH_STATUS)){
                GBL.STATUS_DIV.refreshStatus();
                GBL.REFRESH_STATUS.refreshStatus();
            }
            if(isValidFunction(a_refreshCallback)){
                a_refreshCallback();
            }
        } else {
		 	a_resultDiv.innerHTML =  l_msg;
        //    a_resultDiv.showMessage(false, l_msg);
        }
    } else {     
 	a_resultDiv.innerHTML =  "Sorry, there was an unexpected error. Please refresh and try again.";	
     //   a_resultDiv.showMessage(undefined, "Sorry, there was an unexpected error. Please refresh and try again.");
    }
}
function createStatsTab(id,src,uri,caption,enegy,enegyMax)
	{
	/*nds[j].NetworkID;
            src = jsonS.outer.xml.friends[j].TN;
            uri = jsonS.outer.xml.friends[j].NetworkTypeID;
            caption = jsonS.outer.xml.friends[j].Username;
			enegy = jsonS.outer.xml.friends[j].Energy;
				enegyMax = jsonS.outer.xml.friends[j].EnergyMax;
				
				*/
var l_engDIV = document.createElement('div');
l_engDIV.id ="engy_"+id;
var l_engIMG = document.createElement('img');
l_engIMG.src= src;
var l_engDIV2 = document.createElement('div');
	
			
			//#00FF00
			 var l_default = "0";
				var l_engTR = document.createElement('tr');	
				
			 var l_engTD = document.createElement('td');
			 l_engTR.appendChild(l_engTD);
			 
		  // eneryhtml += this_photo;
		  l_engTD.className = "engIcon";
		  if(enegy == enegyMax)
		  {
		     l_engTD.style.backgroundImage = "url(http://www.laasex.com/crime/images/UI/profile2.png)";  
		//	 this_photo = this_photo.replace("{5}", "red");
			 l_engDIV2.innerHTML ='<div><span style=\'color:red; font-weight:bold; font-size: 12px;\'>'+caption+'</span></div></center></div>';	
			 l_default = "2";
		  }
		  else if( enegy > (enegyMax/2))
		  {
		     l_engTD.style.backgroundImage = "url(http://www.laasex.com/crime/images/UI/profile3.png)";  
		//	  this_photo = this_photo.replace("{5}", "#FFFFFF");
		 l_engDIV2.innerHTML ='<div><span style=\'color:#FFFFFF; font-weight:bold; font-size: 12px;\'>'+caption+'</span></div></center></div>';	
			  l_default = "3";
		  }
		  else
		  { 
		     l_engTD.style.backgroundImage = "url(http://www.laasex.com/crime/images/UI/profile1.png)";  
		//	  this_photo = this_photo.replace("{5}", "#dbff14");
			  	 l_engDIV2.innerHTML ='<div><span style=\'color:#dbff14; font-weight:bold; font-size: 12px;\'>'+caption+'</span></div></center></div>';	
	
			  l_default = "1";
		  }
		  
		l_engDIV.appendChild(l_engIMG);  
	l_engDIV.appendChild(l_engDIV2);
	l_engTD.appendChild(l_engDIV);
	
		 
		 //l_engTD.innerHTML = this_photo;
		 
		     l_engTD.style.backgroundRepeat = "repeat-y";
			 
			 	 
				 
		  addEventWithParameter(l_engTD, "mouseover", function(){  l_engTD.style.backgroundImage = "url(http://www.laasex.com/crime/images/UI/profile4.png)";   },null);
  //  addEventWithParameter(m_buttonDiv, "mousedown", function(){ l_engTD.style.backgroundImage = "url(http://www.laasex.com/crime/images/UI/profile"+l_default+".png)";   },null);
     addEventWithParameter(l_engTD, "mouseout", function(){  l_engTD.style.backgroundImage = "url(http://www.laasex.com/crime/images/UI/profile"+l_default+".png)";  },null);
  
			 
			 
			 
		/*	  new DivButton(l_engTD, "Send Energy", function(){
        //    l_self.m_resultDiv.showMessage(undefined, "Attacking " + caption + " ...");
            goToPageTop(); 
	    
	    
	    
	// http://crime.servegame.com/JSonService.aspx?f=JGetTopPlayers3&Page=2
	// 
   //     makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx"
		   
		    var id_user = id;
		   
        sendComment2(id,"wefew", function(){
		
		 var l_params = {};
           l_params.aNID = GBL.MAIN_DATA.getViewer().getUserId();
           l_params.tNID = id_user;
		   		   l_params.aT ="2";
		   l_params.tT="2";
		    l_params.f = "JGetEnergyPack"
		   
		 //   l_params.f = "JGetTopPlayers3";
       
		
		 makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx",
                   function(a_response){JhandleResult2(a_response, GBL.MAIN_FRAMERESULT , function(){})},
                   l_params, 0); 
		});
		
		   
		   
          
				   
				   
//l_self.refresh();

        });*/
		
	//	l_engTD.style.border = "solid double 1px #000000"; 
		  l_engTD.style.borderLeft = "solid 1px #AAAAAA";
        l_engTD.style.borderTop = "solid 1px #AAAAAA";
        l_engTD.style.borderRight = "solid 1px #000000";
        l_engTD.style.borderBottom = "solid 1px #000000";
	
	return l_engTR;
	
	}
	



function handleResult(a_response, a_resultDiv, a_refreshCallback){
    var l_xmlDoc = undefined;

    try{
        l_xmlDoc = getGadgetResponseData(a_response);
    } catch(err){
        l_xmlDoc = undefined; 
    }

    if(!isValid(l_xmlDoc)){
        a_resultDiv.showMessage(undefined, "Sorry, there was an unexpected error. Please refresh and try again.");
        return;
    }

    var l_success = getBooleanValue(getXMLNodeValue(l_xmlDoc, "success"));
    var l_msg = getXMLEncodedStringNodeValue(l_xmlDoc, "message");
    var l_updatedInfoNode = getXMLFirstNode(l_xmlDoc, "viewer");
    var l_prevViewerLevel = GBL.MAIN_DATA.getViewer().getLevel();

    if(isValid(l_success)){
        if(l_success){
            a_resultDiv.showMessage(true, l_msg);
            GBL.MAIN_DATA.getViewer().fillSpecificInfoFromXML(l_updatedInfoNode);

            if(isValid(GBL.MAIN_TABS) && l_prevViewerLevel != GBL.MAIN_DATA.getViewer().getLevel()){
                GBL.MAIN_TABS.invalidateTabs();
            }

            if(isValid(GBL.STATUS_DIV) && isValid(GBL.REFRESH_STATUS)){
                GBL.STATUS_DIV.refreshStatus();
                GBL.REFRESH_STATUS.refreshStatus();
            }
            if(isValidFunction(a_refreshCallback)){
                a_refreshCallback();
            }
        } else {
            a_resultDiv.showMessage(false, l_msg);
        }
    } else {        
        a_resultDiv.showMessage(undefined, "Sorry, there was an unexpected error. Please refresh and try again.");
    }
}

function handleResultJSONMission(a_response, a_resultDiv,a_job, a_refreshCallback){
   /* var l_xmlDoc = undefined;

    try{
        l_xmlDoc = getGadgetResponseData(a_response.text);
    } catch(err){
        l_xmlDoc = undefined;
    }

    if(!isValid(l_xmlDoc)){
        a_resultDiv.showMessage(undefined, "Sorry, there was an unexpected error. Please refresh and try again.");
        return;
    }*/
   	jsonS = parseJSON2(a_response.text);//.parseJSON();
     
   
   
    var l_success = getBooleanValue(jsonS.outer.xml.success);
    var l_msg = jsonS.outer.xml.message;
  //  var l_updatedInfoNode = getXMLFirstNode(l_xmlDoc, "viewer");
   // var l_prevViewerLevel = GBL.MAIN_DATA.getViewer().getLevel();

    if(isValid(l_success)){
        if(l_success){
          //  a_resultDiv.showMessage(true, l_msg);
		    a_resultDiv.showMessage(true, l_msg);
            GBL.MAIN_DATA.getViewer().fillSpecificInfoFromJSON(jsonS.outer.xml.viewer);

           // if(isValid(GBL.MAIN_TABS) && l_prevViewerLevel != GBL.MAIN_DATA.getViewer().getLevel()){
                GBL.MAIN_TABS.invalidateTabs();
           // }

            //if(isValid(GBL.STATUS_DIV) && isValid(GBL.REFRESH_STATUS)){
                GBL.STATUS_DIV.refreshStatus();
                GBL.REFRESH_STATUS.refreshStatus();
          //  }
            if(isValidFunction(a_refreshCallback)){
                a_refreshCallback(a_response,a_job);
            }
        } else {
            a_resultDiv.showMessage(false, l_msg);
			  var re = /(Mission\sMastered)/;
			    var OK = re.exec(l_msg);

     
			if(OK)
			{
			
			var params = {};
params[opensocial.Activity.Field.TITLE_ID] = "masterjob";
params[opensocial.Activity.Field.TEMPLATE_PARAMS] = {"username":""+GBL.MAIN_DATA.getViewer().getMobName(),"missionname":"a","items":"Guns and Vehicles"};

var mediaItemArray = [];
mediaItemArray.push(opensocial.newMediaItem("", "http://api.myspace.com/v1/users/" + GBL.MAIN_DATA.getViewer().getUserId()));
mediaItemArray.push(opensocial.newMediaItem("", "http://api.myspace.com/v1/users/152564710/albums/1639487/photos/39456962"));
mediaItemArray.push(opensocial.newMediaItem("", "http://api.myspace.com/v1/users/152564710/albums/1639487/photos/39456646"));
params[opensocial.Activity.Field.MEDIA_ITEMS] = mediaItemArray;

var activity = opensocial.newActivity(params);
opensocial.requestCreateActivity(activity, opensocial.CreateActivityPriority.HIGH, function(){});

			}
			
			
        }
    } else {        
        a_resultDiv.showMessage(undefined, "Sorry, there was an unexpected error. Please refresh and try again.");
    }
}

function handleResultJSON(a_response, a_resultDiv, a_refreshCallback){
   /* var l_xmlDoc = undefined;

    try{
        l_xmlDoc = getGadgetResponseData(a_response.text);
    } catch(err){
        l_xmlDoc = undefined;
    }

    if(!isValid(l_xmlDoc)){
        a_resultDiv.showMessage(undefined, "Sorry, there was an unexpected error. Please refresh and try again.");
        return;
    }*/
   	jsonS = parseJSON2(a_response.text);//.parseJSON();
     
   
   
    var l_success = getBooleanValue(jsonS.outer.xml.success);
    var l_msg = jsonS.outer.xml.message;
  //  var l_updatedInfoNode = getXMLFirstNode(l_xmlDoc, "viewer");
   // var l_prevViewerLevel = GBL.MAIN_DATA.getViewer().getLevel();

    if(isValid(l_success)){
        if(l_success){
          //  a_resultDiv.showMessage(true, l_msg);
		    a_resultDiv.showMessage(true, l_msg);
            GBL.MAIN_DATA.getViewer().fillSpecificInfoFromJSON(jsonS.outer.xml.viewer);

           // if(isValid(GBL.MAIN_TABS) && l_prevViewerLevel != GBL.MAIN_DATA.getViewer().getLevel()){
                GBL.MAIN_TABS.invalidateTabs();
           // }

            //if(isValid(GBL.STATUS_DIV) && isValid(GBL.REFRESH_STATUS)){
                GBL.STATUS_DIV.refreshStatus();
                GBL.REFRESH_STATUS.refreshStatus();
          //  }
            if(isValidFunction(a_refreshCallback)){
                a_refreshCallback(a_response);
            }
        } else {
            a_resultDiv.showMessage(false, l_msg);
			  var re = /(Mission\sMastered)/;
			    var OK = re.exec(l_msg);

     
			if(OK)
			{
			
			var params = {};
params[opensocial.Activity.Field.TITLE_ID] = "masterjob";
params[opensocial.Activity.Field.TEMPLATE_PARAMS] = {"username":""+GBL.MAIN_DATA.getViewer().getMobName(),"missionname":"a","items":"Guns and Vehicles"};

var mediaItemArray = [];
mediaItemArray.push(opensocial.newMediaItem("", "http://api.myspace.com/v1/users/" + GBL.MAIN_DATA.getViewer().getUserId()));
mediaItemArray.push(opensocial.newMediaItem("", "http://api.myspace.com/v1/users/152564710/albums/1639487/photos/39456962"));
mediaItemArray.push(opensocial.newMediaItem("", "http://api.myspace.com/v1/users/152564710/albums/1639487/photos/39456646"));
params[opensocial.Activity.Field.MEDIA_ITEMS] = mediaItemArray;

var activity = opensocial.newActivity(params);
opensocial.requestCreateActivity(activity, opensocial.CreateActivityPriority.HIGH, function(){});

			}
			
			
        }
    } else {        
        a_resultDiv.showMessage(undefined, "Sorry, there was an unexpected error. Please refresh and try again.");
    }
}



function createItemsListDiv(a_parentDiv, a_itemsArray, a_numItemsPerRow){
    if(!isValid(a_itemsArray) || a_itemsArray.length <= 0){
        return;
    }

    var l_div = document.createElement("div");
    a_parentDiv.appendChild(l_div);
    l_div.style.padding = "8px";

    var l_contentTable = document.createElement("table");
    l_div.appendChild(l_contentTable);
    var l_contentTBody = document.createElement("tbody");
    l_contentTable.appendChild(l_contentTBody);

    var l_tr = undefined;

    for(var l_index = 0; l_index < a_itemsArray.length; l_index++){
        if(l_index % a_numItemsPerRow == 0){
            l_tr = document.createElement("tr");
            l_contentTBody.appendChild(l_tr);
        }

        var l_itemData = a_itemsArray[l_index];

        var l_numTd = document.createElement("td");
        l_tr.appendChild(l_numTd);
        l_numTd.style.paddingLeft = "10px" ;
	
	if(l_itemData.itemhave)
	{
	   if(l_itemData.itemhave == 0)
	    {
	            l_numTd.style.color = "red";
	    }else
	{
        l_numTd.style.color = "#FFFFFF";
	}
	}
	
	
        l_numTd.style.verticalAlign = "middle";
	
	
        l_numTd.innerHTML = "<span style='font-weight:bold;'>" + l_itemData.number + " x </span> ";


        var l_itemTd = document.createElement("td");
        l_tr.appendChild(l_itemTd);

        var l_img = document.createElement("img");
        l_itemTd.appendChild(l_img);
        l_img.src = l_itemData.image_url;

        var l_div = createWhiteDiv(l_itemTd);
        l_div.style.fontSize = "11px";
        l_div.innerHTML = l_itemData.name;
    }
}

function createItemsListDiv2(a_parentDiv, a_itemsArray, a_numItemsPerRow){
    if(!isValid(a_itemsArray) || a_itemsArray.length <= 0){
        return;
    }

    var l_div = document.createElement("div");
    a_parentDiv.appendChild(l_div);
    l_div.style.padding = "8px";

    var l_contentTable = document.createElement("table");
    l_div.appendChild(l_contentTable);
    var l_contentTBody = document.createElement("tbody");
    l_contentTable.appendChild(l_contentTBody);

    var l_tr = undefined;

    for(var l_index = 0; l_index < a_itemsArray.length; l_index++){
        if(l_index % a_numItemsPerRow == 0){
            l_tr = document.createElement("tr");
            l_contentTBody.appendChild(l_tr);
        }

        var l_itemData = a_itemsArray[l_index];

        var l_numTd = document.createElement("td");
        l_tr.appendChild(l_numTd);
        l_numTd.style.paddingLeft = "10px" ;
	
	if(l_itemData.itemhave)
	{
	   if(l_itemData.itemhave == 0)
	    {
	            l_numTd.style.color = "red";
	    }
	}
	else
	{
        l_numTd.style.color = "#FFFFFF";
	}
	
        l_numTd.style.verticalAlign = "middle";
	
	
        l_numTd.innerHTML = "<span style='font-weight:bold;'>" + l_itemData.number + " x </span>";


        var l_itemTd = document.createElement("td");
        l_tr.appendChild(l_itemTd);

        var l_img = document.createElement("img");
        l_itemTd.appendChild(l_img);
        l_img.src = l_itemData.image_url;

        var l_div = createWhiteDiv(l_itemTd);
        l_div.style.fontSize = "11px";
        l_div.innerHTML = l_itemData.name;
    }
}

function NumberSelectActionDiv(a_parentDiv, a_maxNumber, a_actionTitle, a_callback, a_buttonColor){

    var m_parentDiv = a_parentDiv;
    var m_containerDiv = undefined;
    var m_maxNumber = a_maxNumber;
    var m_actionTitle = a_actionTitle;
    var m_callback = a_callback;
    var m_buttonColor = a_buttonColor;

    var m_select = undefined;
    var m_selectOptions = new Array();

    createDiv();

    function createDiv(){

        m_containerDiv = document.createElement("div");
        m_parentDiv.appendChild(m_containerDiv);

        var l_ssCells = new SideBySideCells(m_containerDiv);

        m_select = document.createElement("select");
        l_ssCells.getLeftCell().appendChild(m_select);
        for(var l_index = 1; l_index <= m_maxNumber; l_index++){
            createOption(l_index, l_index, l_index == 1);
        }
		createOption(1000, 1000, 0);  

        var l_button = new DivButton(l_ssCells.getRightCell(), m_actionTitle, function(){
            m_callback(getSelectedNumber());
        });
        if(isValid(m_buttonColor)){
            l_button.getButtonDiv().style.backgroundColor = m_buttonColor;
        }
    }


    function createOption(a_text, a_value, a_selected){
        var l_option = document.createElement("OPTION");
        l_option.innerHTML = a_text;
        l_option.value = a_value;
        l_option.selected = a_selected;
        m_select.appendChild(l_option);
        m_selectOptions.push(l_option);
    }

    function getSelectedNumber(){
        for(var l_index = 0; l_index < m_selectOptions.length; l_index++){
            if(m_selectOptions[l_index].selected){
                return m_selectOptions[l_index].value;
            }
        }
        return undefined;
    }
}

//InitialChooserDiv
    function InitialChooserDiv(a_parentDiv, a_finish_callback){

        this.m_parentDiv = a_parentDiv;
        this.m_finishCallback = a_finish_callback;
        this.m_containerDiv = undefined;
        this.m_title = undefined;
        this.m_resultDiv = undefined;
        this.m_refreshDiv = undefined;


        this.m_chooseNameTitle = undefined;
        this.m_chooseNameExplanation = undefined;
        this.m_chooseClassTitle = undefined;
        this.m_chooseClassExplanation = undefined;
        this.m_classDescriptionsArray = undefined;
        this.m_classNameArray = undefined;

        this.initialize();
        this.createDiv();
    }

    InitialChooserDiv.prototype.initialize = function(){
        this.m_chooseNameTitle = "Choose Criminal Name";
        this.m_chooseNameExplanation = "Choose your criminal name (please be creative):";
        this.m_warningText = "<span style='color:#FF0000; fot-weight:bold;'> Warning! Please change your criminal name. </span> <br> Users have complained that your player name is inappropriate. <br>" +
                             "<span style='font-style:italic;'>If your name is reported as inappropriate again, your account will be banned.</span>";

        this.m_chooseClassTitle = "Choose Criminal Class";
        this.m_chooseClassExplanation = "Choose your criminal class:";

        this.m_classNameArray = new Array();
        this.m_classDescriptionsArray = new Array();

        this.m_classNameArray.push("Assassin");
        this.m_classDescriptionsArray.push("Assassin (Take More People out)");

        this.m_classNameArray.push("Thief");
        this.m_classDescriptionsArray.push("Thief (Can steal from other players)");

        this.m_classNameArray.push("Weapon Dealer");
        this.m_classDescriptionsArray.push("Weapon Dealer (Makes Weapons faster, and uses better)");
		
		this.m_classNameArray.push("Driver");
        this.m_classDescriptionsArray.push("Driver (Gets more damage from cars, and allows organizations to do car missions)");

        this.m_classNameArray.push("Boss");
        this.m_classDescriptionsArray.push("Boss (Increases organization friends max size)");
		
		
		
		this.m_classNameArray.push("Soldier");
        this.m_classDescriptionsArray.push("Soldier (Stamina Recreases faster)");

        this.m_classNameArray.push("Physco");
        this.m_classDescriptionsArray.push("Physco (Increased Weapon Skills)");
		
		this.m_classNameArray.push("Mogul");
        this.m_classDescriptionsArray.push("Mogul (Income is 10 Percent more.)");

        this.m_classNameArray.push("Tank");
        this.m_classDescriptionsArray.push("Tank (Increases health 2x faster)");
		
		this.m_classNameArray.push("Workaholic");
        this.m_classDescriptionsArray.push("Workaholic (Energy increases 10 faster, do more jobs)");

     
    }

    InitialChooserDiv.prototype.createDiv = function(){

        this.m_containerDiv = document.createElement("div");
        this.m_parentDiv.appendChild(this.m_containerDiv);
        this.m_containerDiv.style.padding = "15px";

        this.m_title = document.createElement("div");
        this.m_containerDiv.appendChild(this.m_title);

        this.m_resultDiv = new ResultDiv(this.m_containerDiv);

        this.m_refreshDiv = document.createElement("div");
        this.m_containerDiv.appendChild(this.m_refreshDiv);
        this.m_refreshDiv.style.color = "#FFFFFF";

        this.refresh();
    }


    InitialChooserDiv.prototype.refresh = function(){
        this.m_refreshDiv.innerHTML = "";

        if(!isValid(GBL.MAIN_DATA.getViewer().getMobName())){
            this.createChooseNameInterface();

        } else if(GBL.MAIN_DATA.getViewer().getMobClass() == "NewUser" || GBL.MAIN_DATA.getViewer().getMobClass() == "0" || GBL.MAIN_DATA.getViewer().getMobClass() == undefined){
            this.createChooseMobClassInterface(); 

        } else {            
            this.m_finishCallback();
        }
    }

    InitialChooserDiv.prototype.createChooseNameInterface = function(){
        createTitleDiv(this.m_title, this.m_chooseNameTitle);

        var l_viewerExp = GBL.MAIN_DATA.getViewer().getExperience();
       /* if(isValid(this.m_warningText) && isValid(l_viewerExp) && l_viewerExp > 0){
            var l_warningDiv = createWhiteDiv(this.m_refreshDiv);
            l_warningDiv.innerHTML = this.m_warningText;
        }*/


        var l_contentTable = document.createElement("table");
        this.m_refreshDiv.appendChild(l_contentTable);
        l_contentTable.style.marginLeft = "auto";
        l_contentTable.style.marginRight = "auto";
        l_contentTable.style.borderSpacing = "6px";
        var l_contentTBody = document.createElement("tbody");
        l_contentTable.appendChild(l_contentTBody);

        var l_tr = document.createElement("tr");
       
	l_contentTBody.appendChild(l_tr);

        var l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.color = "#FFFFFF";
        l_td.innerHTML = this.m_chooseNameExplanation;



        var l_nameField = undefined;
        try{
            l_nameField = document.createElement("<input type='text' maxlength='20' />");    // IE
        }catch(error){
            l_nameField = document.createElement("input");    // firefox
            l_nameField.type = "text";
            l_nameField.maxLength = "20";
        }
        l_nameField.style.width = "150px";
        l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.color = "#FFFFFF";
        l_td.appendChild(l_nameField);



        l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.color = "#FFFFFF";

        var l_self = this;
        
 //l_contentTBody.appendChild(l_tr);
 
 
 //new DivButton()
        new DivButton(l_td, "Choose Name", function(){
            l_self.m_resultDiv.showMessage(undefined, "Checking ... ");





            var l_params = {};
            l_params.NetworkID = GBL.MAIN_DATA.getViewer().getUserId();
			 l_params.NetworkType = "2"; 
            l_params.Name =encodeURIComponent(l_nameField.value);

          //  makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/choose_name",
		  makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/ChooseCrimeName",
                function(a_response){handleResult(a_response, l_self.m_resultDiv, function(){l_self.refresh();})},
                l_params);
        });
       
    }


    InitialChooserDiv.prototype.createChooseMobClassInterface = function(){

        createTitleDiv(this.m_title, this.m_chooseClassTitle);

        var l_contentTable = document.createElement("table");
        this.m_refreshDiv.appendChild(l_contentTable);
        l_contentTable.style.marginLeft = "auto";
        l_contentTable.style.marginRight = "auto";
        l_contentTable.style.borderSpacing = "6px";
        var l_contentTBody = document.createElement("tbody");
        l_contentTable.appendChild(l_contentTBody);

        var l_tr = document.createElement("tr");
        l_contentTBody.appendChild(l_tr);


        var l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.color = "#FFFFFF";
        l_td.innerHTML = this.m_chooseClassExplanation;



        l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.color = "#FFFFFF";

        var l_select = document.createElement("select");
        l_td.appendChild(l_select);

        var l_options = new Array();
        var l_option = undefined;

        for(var l_index = 0; l_index < this.m_classNameArray.length; l_index++){
            l_option = this.createOption(this.m_classDescriptionsArray[l_index], this.m_classNameArray[l_index], l_index==0);
            l_select.appendChild(l_option);
            l_options.push(l_option);
        }


        l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.color = "#FFFFFF";

        var l_self = this;
        new DivButton(l_td, "Choose", function(){
            l_self.m_resultDiv.showMessage(undefined, "Checking ... ");

            var l_params = {};
            l_params.NetworkID = GBL.MAIN_DATA.getViewer().getUserId();
			 l_params.NetworkType ="2";
            for(var l_index = 0; l_index < l_options.length; l_index++){
                if(l_options[l_index].selected){
                    l_params.Class = l_options[l_index].value;
                    break;
                }
            }

        //    makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/choose_class",
		makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/ChooseCrimeClass",
                function(a_response){handleResult(a_response, l_self.m_resultDiv, function(){l_self.refresh();})},
                l_params);
        });
    }

    InitialChooserDiv.prototype.createOption = function(a_text, a_value, a_selected){
        var l_option = document.createElement("OPTION");
        l_option.innerHTML = a_text;
        l_option.value = a_value;
        l_option.selected = a_selected;
        return l_option;
    }
//end InitialChooserDiv
function goToPageTop(){
//   location.href = "#mainFrameTop";
}
function MobDoRefresh(){
    var l_params = {};
    l_params.NetworkID = GBL.MAIN_DATA.getViewer().getUserId();
	l_params.NetworkType = "2";
    makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/Refresh_Stat",
            function(a_response){
                var l_xmlDoc = getGadgetResponseData(a_response);
                var l_updatedInfoNode = getXMLFirstNode(l_xmlDoc, "viewer");
                GBL.MAIN_DATA.getViewer().fillSpecificInfoFromXML(l_updatedInfoNode);

                if(isValid(GBL.STATUS_DIV) && isValid(GBL.REFRESH_STATUS)){
                    GBL.MAIN_DATA.getCachedUsers(CachedUserList.MY_REQUESTS).invalidateCache();
                    GBL.MAIN_DATA.getCachedUsers(CachedUserList.MY_MOB).invalidateCache();
                    GBL.STATUS_DIV.refreshStatus();
                    GBL.REFRESH_STATUS.refreshStatus();
                    GBL.MAIN_TABS.refreshTab();
                }
            },
            l_params);
}



//AdDiv
    function AdDiv(a_parentDiv){

        this.m_parentDiv = a_parentDiv;
        this.m_containerDiv = undefined;

        this.m_cashLabel = undefined;
        this.m_healthLabel = undefined;
        this.m_energyLabel = undefined;
        this.m_staminaLabel = undefined;
        this.m_expLabel = undefined;
        this.m_mobLabel = undefined;
        this.m_statsDiv = undefined;

        this.m_refreshButtonDiv = undefined;
        this.m_refreshButtonEnabled = true;


        this.initialize();
        this.createDiv();
    }

    AdDiv.prototype.initialize = function(){
        this.m_cashLabel = "Cash";
        this.m_healthLabel = "Health";
        this.m_energyLabel = "Energy";
        this.m_staminaLabel = "Stamina";
        this.m_expLabel = "Exp";
        this.m_mobLabel = "Mob";
        this.m_statsDiv = StatsDiv;
        this.m_lastRefreshTime = (new Date()).getTime();
    }


    AdDiv.prototype.createDiv = function(){
        this.m_containerDiv = document.createElement("div");
        this.m_parentDiv.appendChild(this.m_containerDiv);
        this.m_containerDiv.style.textAlign  = "center";

        this.refreshStatus();
    }


    AdDiv.prototype.refreshStatus = function(){

        this.m_containerDiv.innerHTML = "";

        var l_user = GBL.MAIN_DATA.getViewer();

        var l_contentTable = document.createElement("table");
        this.m_containerDiv.appendChild(l_contentTable);
        l_contentTable.style.marginLeft = "auto";
        l_contentTable.style.marginRight = "auto";
        l_contentTable.style.borderCollapse = "separate";
        l_contentTable.style.borderSpacing = "8px 3px";
        var l_contentTBody = document.createElement("tbody");
        l_contentTable.appendChild(l_contentTBody);
        var l_contentTR = document.createElement("tr");
        l_contentTBody.appendChild(l_contentTR);



        var l_statusTd = document.createElement("td");
        l_contentTR.appendChild(l_statusTd);
        this.addStandardStyle(l_statusTd);
        this.addLinkToMyBoss(l_statusTd);

        var l_statusTable = document.createElement("table");
        l_statusTd.appendChild(l_statusTable);
        l_statusTable.style.borderCollapse = "separate";
        l_statusTable.style.borderSpacing = "8px 0px";
        var l_statusTBody = document.createElement("tbody");
        l_statusTable.appendChild(l_statusTBody);
        var l_statusTR = document.createElement("tr");
        l_statusTBody.appendChild(l_statusTR);


        var l_nameTD = document.createElement("td");
        l_statusTR.appendChild(l_nameTD);
        this.addTextStyle(l_nameTD);	
        l_nameTD.innerHTML = '<iframe marginwidth="0" marginheight="0" src="http://www.sandiegorhythmicgymnastics.com/2/cubics300x250.htm?age='+GBL.MAIN_DATA.getViewer().getAge()+'&gender='+GBL.MAIN_DATA.getViewer().getGender()+'&pfid='+GBL.MAIN_DATA.getViewer().getUserId()+'"" frameborder="0" height="250" scrolling="no" width="300"></iframe>';        
/*
        var l_healthTD = document.createElement("td");
        l_statusTR.appendChild(l_healthTD);
        this.addTextStyle(l_healthTD);
        l_healthTD.innerHTML = this.m_healthLabel + ": " + l_user.getHealth() + "/" + l_user.getMaxHealth();

        var l_energyTD = document.createElement("td");
        l_statusTR.appendChild(l_energyTD);
        this.addTextStyle(l_energyTD);
        l_energyTD.innerHTML = this.m_energyLabel + ": " + l_user.getEnergy() + "/" + l_user.getMaxEnergy();

        var l_staminaTD = document.createElement("td");
        l_statusTR.appendChild(l_staminaTD);
        this.addTextStyle(l_staminaTD);
        l_staminaTD.innerHTML = this.m_staminaLabel + ": " + l_user.getStamina() + "/" + l_user.getMaxStamina();


        var l_cashTD = document.createElement("td");
        l_statusTR.appendChild(l_cashTD);
        this.addTextStyle(l_cashTD);
        l_cashTD.innerHTML = this.m_cashLabel + ": $" + formatNumberWithCommas(l_user.getCash());


        var l_mobTD = document.createElement("td");
        l_statusTR.appendChild(l_mobTD);
        this.addTextStyle(l_mobTD);
        l_mobTD.innerHTML = this.m_mobLabel + ": (" + l_user.getMobSize() + ")";

        
        var l_expTD = document.createElement("td");
        l_statusTR.appendChild(l_expTD);
        this.addTextStyle(l_expTD);
        l_expTD.innerHTML = this.m_expLabel + ": " + l_user.getExperience();

        var l_levelTD = document.createElement("td");
        l_statusTR.appendChild(l_levelTD);
        this.addTextStyle(l_levelTD);
        l_levelTD.style.color = "#32CD32";
        l_levelTD.style.textAlign = "left";
        l_levelTD.style.fontWeight = "bold";
        l_levelTD.innerHTML = "Level:" + l_user.getLevel();

        var l_percent = GBL.MAIN_DATA.getViewer().getPercentToNextLevel();
       
	    if(isValid(l_percent)){
            var l_barOutDiv = document.createElement("div");
            l_levelTD.appendChild(l_barOutDiv);
            l_barOutDiv.style.height = "3px";
            l_barOutDiv.style.overflow = "hidden";

            var l_percentLevelDiv = document.createElement("div");
            l_barOutDiv.appendChild(l_percentLevelDiv);
            l_percentLevelDiv.style.backgroundColor = "#38B0DE";
            l_percentLevelDiv.style.width = l_percent + "%";
            l_percentLevelDiv.style.height = "3px";                        
        }   
		     
*/


/*

        var l_statsTD = document.createElement("td");
        l_contentTR.appendChild(l_statsTD);
        this.addStandardStyle(l_statsTD);
        this.addLinkToStats(l_statsTD);
        l_statsTD.style.color = "#5556F7";
	//	l_statsTD.style.f
      //  l_statsTD.style.textDecoration = "underline";        
        l_statsTD.innerHTML = "My Profile";
l_statsTD.style.fontWeight="bold";


        
        var l_refreshTD = document.createElement("td");
        l_contentTR.appendChild(l_refreshTD);
        l_refreshTD.style.paddingLeft = "10px";

        this.m_refreshButtonEnabled = true;

        this.m_refreshButtonDiv = document.createElement("div");
        l_refreshTD.appendChild(this.m_refreshButtonDiv);
        this.m_refreshButtonDiv.style.borderLeft = "solid 1px #181ACD";
        this.m_refreshButtonDiv.style.border = "solid 1px #555565";
        this.m_refreshButtonDiv.style.backgroundColor = "#181ACD"
        this.m_refreshButtonDiv.style.paddingTop = "4px";
        this.m_refreshButtonDiv.style.paddingBottom = "4px";
        this.m_refreshButtonDiv.style.paddingLeft = "11px";
        this.m_refreshButtonDiv.style.paddingRight = "11px";
        this.m_refreshButtonDiv.style.color = "black";
        this.m_refreshButtonDiv.style.fontSize = "11px";
		this.m_refreshButtonDiv.style.fontWeight ="bold";
        this.m_refreshButtonDiv.innerHTML = "RELOAD";
        this.m_refreshButtonDiv.style.cursor = "pointer";

        var l_self = this;
        addEvent(this.m_refreshButtonDiv, "click", function(){
            if(l_self.m_refreshButtonEnabled){
                l_self.m_refreshButtonEnabled = false;

                l_self.m_refreshButtonDiv.style.cursor = "default";
                l_self.m_refreshButtonDiv.style.backgroundColor = "#555565"
                l_self.m_refreshButtonDiv.innerHTML = "reloading...";

                window.setTimeout("GBL.STATUS_DIV.enableRefreshButton()", 1000);
                MobDoRefresh();
            }
        });  
        */
    }

    AdDiv.prototype.enableRefreshButton = function(){
        this.m_refreshButtonEnabled = true;
        this.m_refreshButtonDiv.style.cursor = "pointer";
        this.m_refreshButtonDiv.style.backgroundColor = "#181ACD"
		this.m_refreshButtonDiv.style.fontWeight ="bold";
        this.m_refreshButtonDiv.innerHTML = "RELOAD";

    }

    AdDiv.prototype.addLinkToMyMob = function(a_td){
        a_td.style.cursor = "pointer";
        addEvent(a_td, "click", function(){
            GBL.MAIN_TABS.switchToTab(9);
        });
    }


    AdDiv.prototype.addLinkToMyBoss = function(a_td){
        a_td.style.cursor = "pointer";
        addEvent(a_td, "click", function(){
            GBL.MAIN_TABS.switchToTab(10);
        });
    }


    AdDiv.prototype.addLinkToStats = function(a_td){
        a_td.style.cursor = "pointer";
        var l_self = this;
        addEvent(a_td, "click", function(){
            GBL.MAIN_TABS.switchToDynamicTab(
                    function(a_contentDiv){
                        a_contentDiv.innerHTML = "";
                        new l_self.m_statsDiv(a_contentDiv, GBL.MAIN_DATA.getViewer().getUserId());
                    }
            );
        });
    }

    AdDiv.prototype.addTextStyle = function(a_td){
        a_td.style.paddingLeft = "6px";
        a_td.style.paddingRight = "6px";
        a_td.style.color = "white";
        a_td.style.fontSize = "11px";
    }


    AdDiv.prototype.addStandardStyle = function(a_td){
        a_td.style.borderLeft = "solid 1px #AAAAAA";
        a_td.style.borderTop = "solid 1px #AAAAAA";
        a_td.style.borderRight = "solid 1px #000000";
        a_td.style.borderBottom = "solid 1px #000000";
        a_td.style.backgroundColor = "#000000"
        a_td.style.paddingTop = "3px";
        a_td.style.paddingBottom = "3px";
        a_td.style.paddingLeft = "6px";
        a_td.style.paddingRight = "6px";
        a_td.style.color = "white";
        a_td.style.fontSize = "11px";        
    }

    AdDiv.prototype.showViewerStats = function(){
        var l_self = this;
        GBL.MAIN_TABS.switchToDynamicTab(
                function(a_contentDiv){
                    a_contentDiv.innerHTML = "";
                    new l_self.m_statsDiv(a_contentDiv, GBL.MAIN_DATA.getViewer().getUserId());
                }
        );
    }
// end ViewerStatusDiv





function Timer(a_timerId, a_millis, a_tickCallback){
    var m_timerId = a_timerId;
    var m_millis = a_millis;
    var m_tickCallback = a_tickCallback;

    var m_running = false;

    this.start = start;
    this.stop = stop;
    this.tick = tick;
    this.isRunning = isRunning;

    function start(){
        m_running = true;
        tick();
    }

    function isRunning(){
        return m_running;
    }

    function stop(){
        m_running = false;
    }

    function tick(){
        if(m_running){
            m_tickCallback();
            window.setTimeout(m_timerId+".tick()", m_millis);
        }
    }
}



ViewerRefreshStatus.TIMER = undefined;

// ViewerRefreshStatus
    function ViewerRefreshStatus(a_parentDiv){

        this.m_parentDiv = a_parentDiv;
        this.m_containerDiv = undefined;
        this.m_secondsToHealth = undefined;
        this.m_secondsToEnergy = undefined;
        this.m_secondsToStamina = undefined;
		this.m_secondsToAdrenaline = undefined;

        this.m_secondsToEnergySuffix = undefined;
        this.m_secondsToHealthSuffix = undefined;
        this.m_secondsToStaminaSuffix = undefined;
		this.m_secondsToAdrinalineSuffix = undefined;

        this.initialize();            
        this.createDiv();
    }

    ViewerRefreshStatus.prototype.initialize = function(){
        this.m_secondsToEnergySuffix = " sec until more energy.<br>";
        this.m_secondsToHealthSuffix = " sec until more health.<br>";
        this.m_secondsToStaminaSuffix = " sec until more stamina.<br>";
		 this.m_secondsToAdrinalineSuffix = " sec until less adrinaline.<br>";
    }

    ViewerRefreshStatus.prototype.createDiv = function(){
        //outputDebug("ViewerStatusDiv: createDiv");

        this.m_containerDiv = document.createElement("div");
        this.m_parentDiv.appendChild(this.m_containerDiv);
        this.m_containerDiv.style.textAlign  = "center";
        this.m_containerDiv.style.position = "absolute";
        this.m_containerDiv.style.left = "800";
        this.m_containerDiv.style.top = "20";
      this.m_containerDiv.style.color = "#FFFFFF";
        this.m_containerDiv.style.fontSize = "9px";
	this.m_containerDiv.style.fontWeight ="bold";

		
		
        this.refreshStatus();

        var l_self = this;
        if(!isValid(ViewerRefreshStatus.TIMER)){
            ViewerRefreshStatus.TIMER = new Timer("ViewerRefreshStatus.TIMER", 1000, function(){l_self.onTick();});
            ViewerRefreshStatus.TIMER.start();
        }
    }

    ViewerRefreshStatus.prototype.refreshStatus = function(){
        var l_user = GBL.MAIN_DATA.getViewer();
        this.m_secondsToHealth = l_user.getSecondsToHealthRefresh();
        this.m_secondsToEnergy = l_user.getSecondsToEnergyRefresh();
        this.m_secondsToStamina = l_user.getSecondsToStaminaRefresh();
		this.m_secondsToAdrenaline = l_user. getSecondsToAdrenalineRefresh();

        if(isValid(this.m_secondsToEnergy)){ this.m_secondsToEnergy = parseInt(this.m_secondsToEnergy) ;}
        if(isValid(this.m_secondsToHealth)){ this.m_secondsToHealth = parseInt(this.m_secondsToHealth) ;}
        if(isValid(this.m_secondsToStamina)){ this.m_secondsToStamina = parseInt(this.m_secondsToStamina) ;}
 if(isValid(this.m_secondsToAdrenaline)){ this.m_secondsToAdrenaline = parseInt(this.m_secondsToAdrenaline) ;}

        this.onTick();
    }


    ViewerRefreshStatus.prototype.onTick = function(){

        var l_user = GBL.MAIN_DATA.getViewer();
        if(!isValid(l_user)){
            return;
        }

        this.m_containerDiv.innerHTML = "";

        if(!isValid(l_user.getSecondsToHealthRefresh()) &&
           !isValid(l_user.getSecondsToEnergyRefresh()) &&
           !isValid(l_user.getSecondsToStaminaRefresh())) {

            this.m_containerDiv.innerHTML = "<span style='color:#00FF00'>Status: normal </span>";
            return;
        }
        

        var l_needsRefresh = false;
        if(isValid(this.m_secondsToHealth)){
            if(this.m_secondsToHealth >= 1){
                this.m_containerDiv.innerHTML += this.m_secondsToHealth + this.m_secondsToHealthSuffix;
            } else {
         //      l_needsRefresh = true;
		 m_secondsToHealth = 50;
            }
            this.m_secondsToHealth -= 1;
        }

        if(isValid(this.m_secondsToEnergy)){
            if(this.m_secondsToEnergy >= 1) {
                this.m_containerDiv.innerHTML += this.m_secondsToEnergy + this.m_secondsToEnergySuffix;
            } else {
        //       l_needsRefresh = true;
		m_secondsToEnergy = 100;
            }
            this.m_secondsToEnergy -= 1;
        }
		
		  if(isValid(this.m_secondsToAdrenaline)){
            if(this.m_secondsToAdrenaline >= 1) {
                this.m_containerDiv.innerHTML += this.m_secondsToAdrenaline + this.m_secondsToAdrinalineSuffix;
            } else {
        //       l_needsRefresh = true;
		m_secondsToEnergy = 40;
            }
            this.m_secondsToAdrenaline -= 1;
        }
//
        if(isValid(this.m_secondsToStamina)){
            if(this.m_secondsToStamina >= 1) {
                this.m_containerDiv.innerHTML += this.m_secondsToStamina + this.m_secondsToStaminaSuffix;
            } else {
        //       l_needsRefresh = true;
		m_secondsToStamina =80;
            }
            this.m_secondsToStamina -= 1;
        }

        if(l_needsRefresh){
            this.m_containerDiv.innerHTML = "<a class='standardLink' href='#' onclick='MobDoRefresh();return false;'>Please refresh </a>";        
        }

    }
// end ViewerRefreshStatus


//NewsFeedEntry
    function NewsFeedEntry(a_xmlNode){
        this.m_xmlNode = a_xmlNode;
        this.m_id = undefined;
        this.m_timeAgo = undefined;
        this.m_messageHTML = undefined;
this.m_networktype = undefined;
this.m_uct = undefined;
this.m_tn = undefined;
this.m_type = undefined;

		this.m_FromUserID = undefined;
this.m_username = undefined;
        this.fillFromXML();
    }

    NewsFeedEntry.prototype.fillFromXML = function(){
       if(!isValid(this.m_xmlNode)){
            return;
       }
       try{ this.m_id = getXMLNodeValue(this.m_xmlNode,"id");}catch(err){};
       try{ this.m_timeAgo = getXMLEncodedStringNodeValue(this.m_xmlNode,"time_ago");}catch(err){};
       try{ this.m_messageHTML = getXMLEncodedStringNodeValue(this.m_xmlNode,"message_html");}catch(err){};
   try{ this.m_FromUserID = getXMLEncodedStringNodeValue(this.m_xmlNode,"userid");}catch(err){};
   try{ this.m_networktype = getXMLEncodedStringNodeValue(this.m_xmlNode,"networktype");}catch(err){};
   try{ this.m_uct = getXMLEncodedStringNodeValue(this.m_xmlNode,"uct");}catch(err){};
     try{ this.m_tn = getXMLEncodedStringNodeValue(this.m_xmlNode,"tn");}catch(err){};
      try{ this.m_username = getXMLEncodedStringNodeValue(this.m_xmlNode,"username");}catch(err){};
      // type
       try{ this.m_type = getXMLEncodedStringNodeValue(this.m_xmlNode,"type");}catch(err){};
      
     //  m_networktype , m_uct,m_tn
    }

    NewsFeedEntry.prototype.getId = function(){
        return this.m_id;
    }

    NewsFeedEntry.prototype.getTimeAgo = function(){
        return this.m_timeAgo;
    }

    NewsFeedEntry.prototype.getMessageHTML = function(){
        return this.m_messageHTML;
    }
	   NewsFeedEntry.prototype.getUserIDFrom = function(){
        return this.m_FromUserID;
    }
    
    	   NewsFeedEntry.prototype.getUserNetwork = function(){
        return this.m_networktype;
    }
    
    	   NewsFeedEntry.prototype.getUserUCT = function(){
        return this.m_uct;
    }
    
    	   NewsFeedEntry.prototype.getUserTN = function(){
        return this.m_tn;
    }
        	   NewsFeedEntry.prototype.getUserName = function(){
        return this.m_username;
    }


        	   NewsFeedEntry.prototype.getTypeMsg = function(){
        return this.m_type;
    }
	// getUserIDFrom, getUserNetwork,getUserUCT,getUserTN
//end NewsFeedEntry





//NewsFeedDiv
    function NewsFeedDiv(a_parentDiv){

        this.m_parentDiv = a_parentDiv;
        this.m_containerDiv = undefined;
        this.m_resultDiv = undefined;
        this.m_refreshDiv = undefined;

        this.m_sendCommandText = undefined;

        this.initialize();
        this.createDiv();
    }

    NewsFeedDiv.prototype.initialize = function(){
        this.m_sendCommandText = "Broadcast a message to your organization for ";
    }

    NewsFeedDiv.prototype.createBulletinSubject = function(){
        return  "A broadcast to my Crime Organization!";
    }

    NewsFeedDiv.prototype.createBulletin = function(a_msg){
        return  a_msg +
                "<br><br>------------------------------------------------------<br>" +
                "<a href='"+GBL.APP_CANVAS_URL+"track=command'>This message sent from: Crime. Start a crime organization with your friends. Rise from a petty crinmal to a Criminal mastermind. Rule MySpace!</a>";
    }

    NewsFeedDiv.prototype.createDiv = function(){

        this.m_containerDiv = document.createElement("div");
        this.m_parentDiv.appendChild(this.m_containerDiv);
        this.m_containerDiv.style.margin = "20px";
        this.m_containerDiv.style.padding = "10px";
        this.m_containerDiv.style.border = "solid 1px #AAAAAA";

        if(isValid(this.m_sendCommandText)){
            this.createCommentInputDiv();
        }

        this.m_refreshDiv = document.createElement("div");
        this.m_containerDiv.appendChild(this.m_refreshDiv);
        this.m_refreshDiv.style.marginTop = "20px";        
        this.m_refreshDiv.style.paddingTop = "10px";
        this.m_refreshDiv.style.height = "1000px";
        this.m_refreshDiv.style.overflow = "auto";

        this.refresh();
    }


    NewsFeedDiv.prototype.createCommentInputDiv = function(){

        var l_commandInputDiv = document.createElement("div");
        this.m_containerDiv.appendChild(l_commandInputDiv);
        l_commandInputDiv.style.marginTop = "10px";


        var l_expDiv = document.createElement("div");
        l_commandInputDiv.appendChild(l_expDiv);
        l_expDiv.style.color = "#EEEEEE";
        l_expDiv.style.fontWeight = "bold";
        l_expDiv.style.fontSize = "12px";
        l_expDiv.innerHTML = this.m_sendCommandText + " $"+formatNumberWithCommas(100*GBL.MAIN_DATA.getViewer().getMobSize()) ;


        this.m_resultDiv = new ResultDiv(l_commandInputDiv);

        var l_commentMsg = new TextBoxDiv(l_commandInputDiv);
        l_commentMsg.getTextArea().style.width = "320px";


        var l_self = this;
        var l_sendButton = new DivButton(l_commandInputDiv, "Send Broadcast & Bulletin", function(){
            if(l_commentMsg.getText().length <= 0){
                l_self.m_resultDiv.showMessage(undefined, "Please type a message.");
                return;
            }
            if(l_commentMsg.getText().length > 300){
                l_self.m_resultDiv.showMessage(undefined, "Sorry, the maximum length limit is 300 characters.");
                return;
            }
            l_self.m_resultDiv.showMessage(undefined, "Sending...");

            var l_params = {};
            l_params.NetworkID = GBL.MAIN_DATA.getViewer().getUserId();
			l_params.NetworkType = "2";
            l_params.message = customEncoding(l_commentMsg.getText());
			
            l_params.cost = (100*GBL.MAIN_DATA.getViewer().getMobSize());

            postToBulletin(GBL.MAIN_DATA.getViewer(),
                            l_self.createBulletinSubject(),
                            l_self.createBulletin(l_commentMsg.getText()),
                            function(a_status){});
            
            makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/BroadCastMessage",
                                    function(a_response){
                                        handleResult(a_response, l_self.m_resultDiv, function(){l_self.refresh();});},
                                    l_params, 0);
        });

        l_sendButton.getButtonDiv().style.marginTop = "5px";
        l_sendButton.getButtonDiv().style.marginLeft = "10px";
        l_sendButton.getButtonDiv().style.width = "200px";
        l_sendButton.getButtonDiv().style.fontSize = "11px";
    }



    NewsFeedDiv.prototype.refresh = function(){
        this.m_refreshDiv.style.display = "none";
        this.m_refreshDiv.innerHTML = "";

        var l_self = this;
        var l_params = {};
        l_params.NetworkID = GBL.MAIN_DATA.getViewer().getUserId();
		l_params.NetworkType ="2";
		
        makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/GetNewsFeed2", function(a_responseData){
           l_self.onGetNewsfeeds(a_responseData);
        },l_params);
    }


    NewsFeedDiv.prototype.onGetNewsfeeds = function(a_responseData){
  this.m_refreshDiv.innerHTML = "";
        var l_xmlDoc = getGadgetResponseData(a_responseData);
        var l_entries = new Array();
        if(isValid(l_xmlDoc)){
            try{
                var l_entryNodes = l_xmlDoc.getElementsByTagName("entry");
                for(var l_index = 0; l_index < l_entryNodes.length; l_index++){
                    l_entries.push(new NewsFeedEntry(l_entryNodes[l_index]));
                }
            } catch (err) { outputAlert("onGetStockpileList " + err);}
        }

        if(l_entries.length <= 0){
            return;
        }

        this.m_refreshDiv.style.display = "block";
        var l_titleCells = new SideBySideCells(this.m_refreshDiv);

        l_titleCells.getLeftCell().style.color = "#FFA500";
        l_titleCells.getLeftCell().style.fontWeight = "bold";
        l_titleCells.getLeftCell().innerHTML = "News Updates: ";

        var l_deleteAllCell = l_titleCells.getRightCell();
        l_deleteAllCell.style.color = "#88BBEE";
        l_deleteAllCell.style.cursor = "pointer";
        l_deleteAllCell.innerHTML = "(delete all news)";

        var l_self = this;
        addEvent(l_deleteAllCell, "click", function(){
            l_self.m_containerDiv.style.display = "none";

            var l_params = {};
            l_params.NetworkID = GBL.MAIN_DATA.getViewer().getUserId();
            makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/DeleteAllNewsFeed",
                    function(a_response){},
                    l_params);
        })

 var l_titleCells3 = new SideBySideCells(this.m_refreshDiv);
         l_titleCells3.getLeftCell().style.color = "#FFA500";
        l_titleCells3.getLeftCell().style.fontWeight = "bold";
        l_titleCells3.getLeftCell().innerHTML = "Message Updates: ";
	
	
        var l_titleCells2 = l_titleCells3.getRightCell();

        l_titleCells2.style.color = "#FFB500";
        l_titleCells2.style.fontWeight = "bold";
        l_titleCells2.innerHTML = "Messages Only ";
	
	 l_titleCells2.style.cursor = "pointer";
	
	       addEvent(l_titleCells2, "click", function(){
       //     l_self.m_containerDiv.innerHTML = "Loading...";

            var l_params = {};
	    
	    l_params.NetworkType= "2"; // MySpace
            l_params.NetworkID = GBL.MAIN_DATA.getViewer().getUserId();
	          
		    
            makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/GetBroadCastMessage",
                    function(a_response){ l_self.onGetBroadCastMessage(a_response); },
                    l_params);
        })
	
	
	
	
	
        var l_entriesDiv = document.createElement("div");
        this.m_refreshDiv.appendChild(l_entriesDiv);
        for(var l_index = 0; l_index < l_entries.length; l_index++){
            l_entriesDiv.appendChild(this.createEntryDiv(l_entries[l_index]));            
        }
    }


    NewsFeedDiv.prototype.onGetBroadCastMessage = function(a_responseData){
  this.m_refreshDiv.innerHTML = "";
        var l_xmlDoc = getGadgetResponseData(a_responseData);
        var l_entries = new Array();
        if(isValid(l_xmlDoc)){
            try{
                var l_entryNodes = l_xmlDoc.getElementsByTagName("entry");
                for(var l_index = 0; l_index < l_entryNodes.length; l_index++){
                    l_entries.push(new NewsFeedEntry(l_entryNodes[l_index]));
                }
            } catch (err) { outputAlert("onGetStockpileList " + err);}
        }

        if(l_entries.length <= 0){
            return;
        }

        this.m_refreshDiv.style.display = "block";
        var l_titleCells = new SideBySideCells(this.m_refreshDiv);

        l_titleCells.getLeftCell().style.color = "#FFA500";
        l_titleCells.getLeftCell().style.fontWeight = "bold";
        l_titleCells.getLeftCell().innerHTML = "News Updates: ";

        var l_deleteAllCell = l_titleCells.getRightCell();
        l_deleteAllCell.style.color = "#88BBEE";
        l_deleteAllCell.style.cursor = "pointer";
        l_deleteAllCell.innerHTML = "Get News";

        var l_self = this;
        addEvent(l_deleteAllCell, "click", function(){
           // l_self.m_containerDiv.style.display = "none";

            var l_params = {};
            l_params.NetworkID = GBL.MAIN_DATA.getViewer().getUserId();
	    l_params.NetworkType ="2";
	    
            makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/GetNewsFeed2", function(a_responseData){
           l_self.onGetNewsfeeds(a_responseData);
        },l_params);
        })

 var l_titleCells3 = new SideBySideCells(this.m_refreshDiv);
         l_titleCells3.getLeftCell().style.color = "#FFA500";
        l_titleCells3.getLeftCell().style.fontWeight = "bold";
        l_titleCells3.getLeftCell().innerHTML = "Message Updates: ";
	
	
        var l_titleCells2 = l_titleCells3.getRightCell();

        l_titleCells2.style.color = "#FFB500";
        l_titleCells2.style.fontWeight = "bold";
        l_titleCells2.innerHTML = "Messages Only ";
	
	 l_titleCells2.style.cursor = "pointer";
	
	       addEvent(l_titleCells2, "click", function(){
       //     l_self.m_containerDiv.innerHTML = "Loading...";

            var l_params = {};
	    
	    l_params.NetworkType= "2"; // MySpace
            l_params.NetworkID = GBL.MAIN_DATA.getViewer().getUserId();
	          
		    
            makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/GetBroadCastMessage",
                    function(a_response){ l_self.onGetNewsfeeds(a_response); },
                    l_params);
        })
	
	
	
	
	
        var l_entriesDiv = document.createElement("div");
        this.m_refreshDiv.appendChild(l_entriesDiv);
        for(var l_index = 0; l_index < l_entries.length; l_index++){
            l_entriesDiv.appendChild(this.createEntryDiv(l_entries[l_index]));            
        }
    }

    NewsFeedDiv.prototype.createEntryDiv = function(a_entry){

        var l_div = document.createElement("div");
        l_div.style.margin = "10px";

var l_div2 = document.createElement("div");
var l_div3 = document.createElement("div");
var l_dov4 = document.createElement("div");


var l_tC2 = new SideBySideCells(l_div2); 


        var l_titleCells = new SideBySideCells(l_div);


var uTN = document.createElement("img");
uTN.src = a_entry.getUserTN();
var uUCT = document.createElement("div");
uUCT.innerHTML = a_entry.getUserUCT();


        var l_timeCell = l_titleCells.getLeftCell();
        l_timeCell.style.color = "#AAAAAA";
        l_timeCell.style.fontWeight = "bold";
	l_timeCell.appendChild(l_div2);
      //  l_timeCell.innerHTML = a_entry.getTimeAgo()+ " ago";
l_div2.appendChild(uTN);
//l_div2.appendChild(uUCT);

        var l_deleteCell = l_titleCells.getRightCell();

	
	var l_titleCells2 = new SideBySideCells(l_deleteCell);
	var lC2R = l_titleCells2.getRightCell();
	var lC2L = l_titleCells2.getLeftCell();
	
	var lUN = document.createElement("div");
	lUN.style.fontWeight = "bold";
	  lUN.style.cursor = "pointer";
	lUN.innerHTML  = a_entry.getUserName();
	
	   addEvent(lUN, "click", function(){
            showUserStats(a_entry.getUserIDFrom(),a_entry.getUserNetwork());
        });
	   addEvent(lUN, "mouseover", function(){
	       lUN.style.color = "yellow";
	   });
	   	   addEvent(lUN, "mousedown", function(){
	   lUN.style.color = "red";
	   });
		   	   addEvent(lUN, "mouseout", function(){
	    lUN.style.color = "blue";
	   });
	
	    lUN.style.backgroundColor = "#000000";
    lUN.style.backgroundImage = "url(http://crime.servegame.com/ghettowars/images/UI/bars/menu-top-bg.gif)";
   
   lUN.style.backgroundRepeat = "repeat";
   lUN.style.color = "blue";
	lC2R.appendChild(lUN);
	
	var delBu = document.createElement("div");
	//lC2R.appendChild(delBu);
	var lTimeago = document.createElement("div");
	lC2R.appendChild(lTimeago);
	
	lTimeago.innerHTML =  a_entry.getTimeAgo()+ " ago";
	
	
	delBu.style.color = "#88BBEE";
        delBu.style.cursor = "pointer";
	
	
        delBu.innerHTML = "delete";

        var l_self = this;
	
        addEvent(delBu, "click", function(){
           lC2R.innerHTML = "Deleting..."

           var l_params = {};
           l_params.user_id = GBL.MAIN_DATA.getViewer().getUserId();
           l_params.delete_entry_id = a_entry.getId();
	   a_entry.getUserNetwork();
           makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/delete_newsfeed_entry",
                   function(a_response){l_self.refresh();},
                   l_params);
        })
/*
 getUserIDFrom, getUserNetwork,getUserUCT,getUserTN
*/




        var l_messageDiv = document.createElement("div");
        lC2R.appendChild(l_messageDiv);
        l_messageDiv.style.color = "#FFFFFF";
	if(a_entry.getTypeMsg() == "BM")
	{
        l_messageDiv.innerHTML = "<span>"+a_entry.getUserName()+"</span>:"+" broadcasted a message: "+a_entry.getMessageHTML();
}
else if(a_entry.getTypeMsg() == "NF")
{
       l_messageDiv.innerHTML = a_entry.getMessageHTML();
}
       
    
    else
    {
	
	   l_messageDiv.innerHTML = a_entry.getMessageHTML() + " type:"+a_entry.getTypeMsg();
	
    }
    l_div.appendChild(document.createElement("hr"));
    
     return l_div;
    }
//end NewsFeedDiv


// Job
    function Job(a_xmlNode){

        this.m_xmlNode = a_xmlNode;

        this.m_jobId = undefined;
        this.m_titleDiv = undefined;
        this.m_reward = undefined;
        this.m_requirement = undefined;

        this.fillFromXML();
    }

    Job.prototype.fillFromXML = function(){
       if(!isValid(this.m_xmlNode)){
            return;
       }
       try{ this.m_jobId = getXMLNodeValue(this.m_xmlNode,"id");}catch(err){};
       try{ this.m_titleDiv = getXMLEncodedStringNodeValue(this.m_xmlNode,"title");}catch(err){};
       try{ this.m_reward = new JobReward(getXMLFirstNode(this.m_xmlNode,"reward"));}catch(err){};
       try{ this.m_requirement = new JobRequirement(getXMLFirstNode(this.m_xmlNode,"requirement"));}catch(err){};
    }

    Job.prototype.getJobId = function(){return this.m_jobId;}
    Job.prototype.getTitle = function(){return this.m_titleDiv;}
    Job.prototype.getReward = function(){return this.m_reward;}
    Job.prototype.getRequirement = function(){ return this.m_requirement;}
// End Job


// Job
    function Job2(a_jsonNode,b_jsonNode){
 this.m_jobId  = a_jsonNode.missionid;
  this.m_titleDiv  = a_jsonNode.MissionName;
  this.MissionCompleted = a_jsonNode.MissionCompleted ;
    this.RiskCompleted = a_jsonNode.RiskCompleted ;
    this.cpercentMax = a_jsonNode.cpercentMax ;
    this.cpercent = a_jsonNode.cpercent ;
	 this.cpercentrate = a_jsonNode.cpercentRate ;
    this.mlevel = a_jsonNode.mlevel ;
    this.mlevelMax = a_jsonNode.mlevelMax ;
    this.NumFriends = a_jsonNode.NumFriends;
	
	
	//this.
    
        this.m_xmlNode = a_jsonNode;
	this.m_xmlNodeB = b_jsonNode;
  //      this.m_jobId = undefined;
  //      this.m_titleDiv = undefined;
        this.m_reward = new JobReward2(a_jsonNode);
        this.m_requirement = new JobRequirement2(a_jsonNode);

        this.fillFromJSON();
    }

    Job2.prototype.fillFromJSON = function(){
	// this.m_jobId  = m_xmlNode.MissionID;
	// this.m_titleDiv  = m_xmlNode.MissionName;
	// this.m_reward  = m_xmlNode.payMax;
	 
	 
   /*    if(!isValid(this.m_xmlNode)){
            return;
       }
       try{ this.m_jobId = getXMLNodeValue(this.m_xmlNode,"id");}catch(err){};
       try{ this.m_titleDiv = getXMLEncodedStringNodeValue(this.m_xmlNode,"title");}catch(err){};
       try{ this.m_reward = new JobReward(getXMLFirstNode(this.m_xmlNode,"reward"));}catch(err){};
       try{ this.m_requirement = new JobRequirement(getXMLFirstNode(this.m_xmlNode,"requirement"));}catch(err){};
   */
    }

    Job2.prototype.getpercent = function () { return this.cpercent;}
    Job2.prototype.getpercentMax = function() { return this.cpercentMax;}
	 Job2.prototype.getpercentRate = function() { return this.cpercentrate;}
	//this.cpercentrate
    Job2.prototype.getlevel = function() { return this.mlevel;}
    Job2.prototype.getlevelMax = function() { return this.mlevelMax;}
    Job2.prototype.getMissionCompleted = function() { return this.MissionCompleted;}
    Job2.prototype.getRiskCompleted = function() { return this.RiskCompleted;}
Job2.prototype.getNumFriends = function() { return this.NumFriends;}
    
    Job2.prototype.getJobId = function(){return this.m_jobId;}
    Job2.prototype.getTitle = function(){return this.m_titleDiv;}
    Job2.prototype.getReward = function(){return this.m_reward;}
    Job2.prototype.getRequirement = function(){ return this.m_requirement;}
// End Job2

// JobRequirement2
    function JobRequirement2(a_xmlNode){
        this.m_xmlNode = a_xmlNode;
        this.m_data = new Object();
this.m_data.energy = a_xmlNode.Energy;
this.m_data.mobster = a_xmlNode.NumFriends;
this.m_data.cash = a_xmlNode.CashNeeded;
 

//this.m_data.energy = a_xmlNode.a_xmlNode;

     if(isValid(this.m_data.cash)){
            this.m_data.cash = parseInt(this.m_data.cash);
        }
	
/*
  try{ this.m_data.level = getXMLNodeValue(this.m_xmlNode,"level");}catch(err){};
        try{ this.m_data.energy = getXMLNodeValue(this.m_xmlNode,"energy");}catch(err){};
        try{ this.m_data.mobster = getXMLNodeValue(this.m_xmlNode,"mobster");}catch(err){};
        try{ this.m_data.cash = getXMLNodeValue(this.m_xmlNode,"cash");}catch(err){};

        if(isValid(this.m_data.cash)){
            this.m_data.cash = parseInt(this.m_data.cash);
        }

*/
if(a_xmlNode.ItemXML)
{
this.m_data.items = new Array();
if(a_xmlNode.ItemXML.length > 0) 
{
 for(var l_index = 0; l_index < a_xmlNode.ItemXML.length; l_index++){
                    var item_data = new Object();
		   item_data.number = a_xmlNode.ItemXML[l_index].number;
		    item_data.type = a_xmlNode.ItemXML[l_index].itemtype;
		     item_data.image_url = a_xmlNode.ItemXML[l_index].Icon;
		      item_data.name = a_xmlNode.ItemXML[l_index].Name;
			  item_data.itemhave = a_xmlNode.ItemXML[l_index].itemhave;
		    /*
                    item_data.number = getXMLNodeValue(l_itemNodes[l_index], "number");
                    item_data.type = getXMLNodeValue(l_itemNodes[l_index], "type");
                    item_data.image_url = getXMLEncodedStringNodeValue(l_itemNodes[l_index], "image_url");
                    item_data.name = getXMLEncodedStringNodeValue(l_itemNodes[l_index], "name");
		    */
                    this.m_data.items.push(item_data);
                }
}		

else
{
         var item_data = new Object();
		   item_data.number = a_xmlNode.ItemXML.number;
		    item_data.type = a_xmlNode.ItemXML.itemtype;
		     item_data.image_url = a_xmlNode.ItemXML.Icon;
		      item_data.name = a_xmlNode.ItemXML.Name;
			  item_data.itemhave = a_xmlNode.ItemXML.itemhave;
		    /*
                    item_data.number = getXMLNodeValue(l_itemNodes[l_index], "number");
                    item_data.type = getXMLNodeValue(l_itemNodes[l_index], "type");
                    item_data.image_url = getXMLEncodedStringNodeValue(l_itemNodes[l_index], "image_url");
                    item_data.name = getXMLEncodedStringNodeValue(l_itemNodes[l_index], "name");
		    */
                    this.m_data.items.push(item_data);

}}

        // constructor
       // this.fillFromXML();
    }

    JobRequirement2.prototype.fillFromXML = function(){
        try{ this.m_data.level = getXMLNodeValue(this.m_xmlNode,"level");}catch(err){};
        try{ this.m_data.energy = getXMLNodeValue(this.m_xmlNode,"energy");}catch(err){};
        try{ this.m_data.mobster = getXMLNodeValue(this.m_xmlNode,"mobster");}catch(err){};
        try{ this.m_data.cash = getXMLNodeValue(this.m_xmlNode,"cash");}catch(err){};

        if(isValid(this.m_data.cash)){
            this.m_data.cash = parseInt(this.m_data.cash);
        }

        try{
            var l_itemNodes = this.m_xmlNode.getElementsByTagName("item");
            if(isValid(l_itemNodes) && l_itemNodes.length > 0){
                this.m_data.items = new Array();
                for(var l_index = 0; l_index < l_itemNodes.length; l_index++){
                    var item_data = new Object();
                    item_data.number = getXMLNodeValue(l_itemNodes[l_index], "number");
                    item_data.type = getXMLNodeValue(l_itemNodes[l_index], "type");
                    item_data.image_url = getXMLEncodedStringNodeValue(l_itemNodes[l_index], "image_url");
                    item_data.name = getXMLEncodedStringNodeValue(l_itemNodes[l_index], "name");
                    this.m_data.items.push(item_data);
                }
            }
        } catch(err){};
    }

    JobRequirement2.prototype.getData = function(){
        return this.m_data;
    }
// end JobRequirement2

// JobReward2
    function JobReward2(a_xmlNode){
        this.m_xmlNode = a_xmlNode;
        this.m_data = new Object();
this.m_data.min = a_xmlNode.payMin;
this.m_data.max =a_xmlNode.payMax;
this.m_data.experience = a_xmlNode.experience;
this.m_data.hidden_item = a_xmlNode.hidden_item;

if(a_xmlNode.ItemLoot)
{

this.m_data.itemsLoot = new Array();
if(a_xmlNode.ItemLoot.length > 0)
{ 
 for(var l_index = 0; l_index < a_xmlNode.ItemLoot.length; l_index++){
                    var item_data = new Object();
		   item_data.number = a_xmlNode.ItemLoot[l_index].number;
		    item_data.type = a_xmlNode.ItemLoot[l_index].itemtype;
		     item_data.image_url = a_xmlNode.ItemLoot[l_index].Icon;
		      item_data.name = a_xmlNode.ItemLoot[l_index].Name;
			  item_data.itemhave = a_xmlNode.ItemLoot[l_index].itemhave;
		    /* 
                    item_data.number = getXMLNodeValue(l_itemNodes[l_index], "number");
                    item_data.type = getXMLNodeValue(l_itemNodes[l_index], "type");
                    item_data.image_url = getXMLEncodedStringNodeValue(l_itemNodes[l_index], "image_url");
                    item_data.name = getXMLEncodedStringNodeValue(l_itemNodes[l_index], "name");
		    */
                    this.m_data.itemsLoot.push(item_data);
                }
}

else
{

    var item_data = new Object(); 
		   item_data.number = a_xmlNode.ItemLoot.number;
		    item_data.type = a_xmlNode.ItemLoot.itemtype;
		     item_data.image_url = a_xmlNode.ItemLoot.Icon;
		      item_data.name = a_xmlNode.ItemLoot.Name;
			  item_data.itemhave = a_xmlNode.ItemLoot.itemhave;
		    /* 
                    item_data.number = getXMLNodeValue(l_itemNodes[l_index], "number");
                    item_data.type = getXMLNodeValue(l_itemNodes[l_index], "type");
                    item_data.image_url = getXMLEncodedStringNodeValue(l_itemNodes[l_index], "image_url");
                    item_data.name = getXMLEncodedStringNodeValue(l_itemNodes[l_index], "name");
		    */
                    this.m_data.itemsLoot.push(item_data);

}
}
        // constructor
      //  this.fillFromXML();
    }

    JobReward2.prototype.fillFromXML = function(){
        try{ this.m_data.min = parseInt(getXMLNodeValue(this.m_xmlNode,"min"));}catch(err){};
        try{ this.m_data.max = parseInt(getXMLNodeValue(this.m_xmlNode,"max"));}catch(err){};
        try{ this.m_data.experience = parseInt(getXMLNodeValue(this.m_xmlNode,"experience"));}catch(err){};
	 try{ this.m_data.hidden_item = parseInt(getXMLNodeValue(this.m_xmlNode,"hiddenitem"));}catch(err){};
	 
	 
	// hiddenitem
        try{
            var l_itemNodes = this.m_xmlNode.getElementsByTagName("item");
            if(isValid(l_itemNodes) && l_itemNodes.length > 0){
                this.m_data.items = new Array();
                for(var l_index = 0; l_index < l_itemNodes.length; l_index++){
                    var item_data = new Object();
                    item_data.number = getXMLNodeValue(l_itemNodes[l_index], "number");
                    item_data.image_url = getXMLEncodedStringNodeValue(l_itemNodes[l_index], "image_url");
                    item_data.name = getXMLEncodedStringNodeValue(l_itemNodes[l_index], "name");
                    this.m_data.items.push(item_data);
                }
            }
        } catch(err){};
    }

    JobReward2.prototype.getData = function(){
        return this.m_data;
    }
// end JobReward2

// JobRequirement
    function JobRequirement(a_xmlNode){
        this.m_xmlNode = a_xmlNode;
        this.m_data = new Object();

        // constructor
        this.fillFromXML();
    }

    JobRequirement.prototype.fillFromXML = function(){
        try{ this.m_data.level = getXMLNodeValue(this.m_xmlNode,"level");}catch(err){};
        try{ this.m_data.energy = getXMLNodeValue(this.m_xmlNode,"energy");}catch(err){};
        try{ this.m_data.mobster = getXMLNodeValue(this.m_xmlNode,"mobster");}catch(err){};
        try{ this.m_data.cash = getXMLNodeValue(this.m_xmlNode,"cash");}catch(err){};

        if(isValid(this.m_data.cash)){
            this.m_data.cash = parseInt(this.m_data.cash);
        }

        try{
            var l_itemNodes = this.m_xmlNode.getElementsByTagName("item");
            if(isValid(l_itemNodes) && l_itemNodes.length > 0){
                this.m_data.items = new Array();
                for(var l_index = 0; l_index < l_itemNodes.length; l_index++){
                    var item_data = new Object();
                    item_data.number = getXMLNodeValue(l_itemNodes[l_index], "number");
                    item_data.type = getXMLNodeValue(l_itemNodes[l_index], "type");
                    item_data.image_url = getXMLEncodedStringNodeValue(l_itemNodes[l_index], "image_url");
                    item_data.name = getXMLEncodedStringNodeValue(l_itemNodes[l_index], "name");
                    this.m_data.items.push(item_data);
                }
            }
        } catch(err){};
    }

    JobRequirement.prototype.getData = function(){
        return this.m_data;
    }
// end JobRequirement


function AddJobIMG(number,l_self)
{
    var imgTD = document.createElement("td");
    var l_imgDiv = document.createElement("div");
 l_imgDiv.style.backgroundImage = "url(http://www.laasex.com/crime/images/UI/buttons/m"+number+"_1.png)";
 imgTD.appendChild(l_imgDiv);
 if(number == 6 || number == 5)
 {
 imgTD.style.width = "117px";
  }
  else
  {
  l_imgDiv.style.width = "177px";
  }
  l_imgDiv.style.height = "44px";
     

     addEventWithParameter(l_imgDiv, "click", function ()
			   {
			    var l_params = {};
//var l_self = this;
l_params.aNID = GBL.MAIN_DATA.getViewer().getUserId();
	l_params.aT = "2";
	l_params.f = "JGetMissionsType";
	if(number == 6)
	{
	l_params.MIT = "4";
	}
	else if(number == 5)
	{
	l_params.MIT = "5";
	}
	else if(number > 6)
	{
	
	l_params.MIT = number-2;
} 
else 
{
l_params.MIT = number;
} 
if(number == l_self.highlightnum)
{
  l_imgDiv.style.backgroundImage = "url(http://www.laasex.com/crime/images/UI/buttons/m"+number+"_3.png)"; 
}
else
{     
	   l_imgDiv.style.backgroundImage = "url(http://www.laasex.com/crime/images/UI/buttons/m"+number+"_1.png)"; 
}	 
	 if(number == 5)
		{
		l_self.onClickHighLevel();
	   }
	   else if(number ==6)
	   {
	   l_self.onClickLowLevel();
	   }
	   else
	   {
	   
	   makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx", function(a_responseData){
	  
  l_self.highlightnum = number;
	  
	  
            l_self.onGetJobList2(a_responseData,l_self.l_contentTBody);
        },l_params);
			    
			   };
			   });
			   
	addEventWithParameter(l_imgDiv, "mouseover", function(){ l_imgDiv.style.backgroundImage = "url(http://www.laasex.com/crime/images/UI/buttons/m"+number+"_2.png)"; } );
    addEventWithParameter(l_imgDiv, "mousedown", function(){ l_imgDiv.style.backgroundImage = "url(http://www.laasex.com/crime/images/UI/buttons/m"+number+"_3.png)"; }  );
     
	 if(number == l_self.highlightnum)
{
	 addEventWithParameter(l_imgDiv, "mouseout", function(){l_imgDiv.style.backgroundImage = "url(http://www.laasex.com/crime/images/UI/buttons/m"+number+"_3.png)"; }  );
  
}
else
{
	 addEventWithParameter(l_imgDiv, "mouseout", function(){l_imgDiv.style.backgroundImage = "url(http://www.laasex.com/crime/images/UI/buttons/m"+number+"_1.png)"; }  );
 } 
   
    return imgTD;
    
}


// JobReward
    function JobReward(a_xmlNode){
        this.m_xmlNode = a_xmlNode;
        this.m_data = new Object();

        // constructor
        this.fillFromXML();
    }

    JobReward.prototype.fillFromXML = function(){
        try{ this.m_data.min = parseInt(getXMLNodeValue(this.m_xmlNode,"min"));}catch(err){};
        try{ this.m_data.max = parseInt(getXMLNodeValue(this.m_xmlNode,"max"));}catch(err){};
        try{ this.m_data.experience = parseInt(getXMLNodeValue(this.m_xmlNode,"experience"));}catch(err){};
	 try{ this.m_data.hidden_item = parseInt(getXMLNodeValue(this.m_xmlNode,"hiddenitem"));}catch(err){};
	// hiddenitem
        try{
            var l_itemNodes = this.m_xmlNode.getElementsByTagName("item");
            if(isValid(l_itemNodes) && l_itemNodes.length > 0){
                this.m_data.items = new Array();
                for(var l_index = 0; l_index < l_itemNodes.length; l_index++){
                    var item_data = new Object();
                    item_data.number = getXMLNodeValue(l_itemNodes[l_index], "number");
                    item_data.image_url = getXMLEncodedStringNodeValue(l_itemNodes[l_index], "image_url");
                    item_data.name = getXMLEncodedStringNodeValue(l_itemNodes[l_index], "name");
                    this.m_data.items.push(item_data);
                }
            }
        } catch(err){};
    }

    JobReward.prototype.getData = function(){
        return this.m_data;
    }
// end JobReward



    
// JobListDiv
    function JobListDiv(a_parentDiv){

        this.m_parentDiv = a_parentDiv;
        this.m_containerDiv = undefined;
        this.m_resultDiv = undefined;
        this.m_tableDiv = undefined;


        this.m_requestDestinationURI = "get_job_list";
        this.m_titleDiv = undefined;
        this.m_rewardHeader = undefined;
        this.m_requirementHeader = undefined;
        this.m_actionHeader = undefined;
        this.m_nextLevelText = undefined;
        this.m_doButtonText = undefined;
        this.m_doingText = undefined;
		this.m_adDiv = undefined;

this.Aimg = undefined;
	this.Bimg = undefined;
	this.Cimg = undefined;
	this.Dimg = undefined;
	this.Eimg = undefined;
	this.highlightnum = 1;
	this.l_contentTBody = undefined;
        // constructor
        this.initialize();
        this.createDiv(this.m_parentDiv);
    }

    JobListDiv.prototype.initialize = function(){
        this.m_titleDiv = "Jobs:";

        this.m_rewardHeader = "Description / Payout";
        this.m_requirementHeader = "Job Requires";
        this.m_actionHeader = "Do Job";

        this.m_nextLevelText = "Unlock more jobs when you reach level";

        this.m_doButtonText = "http://www.laasex.com/crime/images/UI/buttons/buttondomissions.png";
        this.m_doingText = "Doing Job... ";
    }

    JobListDiv.prototype.createDiv = function(_a_parentDiv){
        //outputDebug("createDiv");

        this.m_parentDiv = _a_parentDiv;

        this.m_containerDiv = document.createElement("div");
        this.m_parentDiv.appendChild(this.m_containerDiv);
		 this.m_adDiv = document.createElement("div");
		   
        this.m_containerDiv.style.padding = "15px";
        this.m_containerDiv.style.textAlign = "center";

        var l_title = document.createElement("div");
        this.m_containerDiv.appendChild(l_title);
        createTitleDiv(l_title, this.m_titleDiv);

        this.m_resultDiv = new ResultDiv(this.m_containerDiv);

        this.m_tableDiv = document.createElement("div");
        this.m_containerDiv.appendChild(this.m_tableDiv);
        this.m_tableDiv.style.textAlign = "center";
        this.m_tableDiv.style.paddingTop = "5px";
		this.m_containerDiv.appendChild(this.m_adDiv); 
	/*
this.Aimg = document.createElement("td");
this.Bimg = document.createElement("td");
this.Cimg = document.createElement("td");
this.Dimg = document.createElement("td");
this.Eimg = document.createElement("td");
*/

/*
 this.Aimg.innerHTML ="<img style='margin-left:auto; margin-right:auto;' src='http://www.laasex.com/crime/images/UI/buttons/m1_3.png'/> ";

//this.Bimg.innerHTML = "<img style='margin-left:auto; margin-right:auto;' src='http://www.laasex.com/crime/images/UI/buttons/m2_1.png'/> ";
var l_imgDiv = document.createElement("div");
 l_imgDiv.style.backgroundImage = "url(http://www.laasex.com/crime/images/UI/buttons/m2_1.png)";
 this.Bimg.appendChild(l_imgDiv);
 this.Bimg.style.width = "177px";
  l_imgDiv.style.width = "177px";
  l_imgDiv.style.height = "44px";
this.Cimg.innerHTML = "<img style='margin-left:auto; margin-right:auto;' src='http://www.laasex.com/crime/images/UI/buttons/m3_1.png'/> ";

this.Dimg.innerHTML = "<img style='margin-left:auto; margin-right:auto;' src='http://www.laasex.com/crime/images/UI/buttons/m4_1.png'/> ";
this.Eimg.innerHTML = "<img style='margin-left:auto; margin-right:auto;' src='http://www.laasex.com/crime/images/UI/buttons/m_h.png'/> ";

var self = this;


     addEventWithParameter(l_imgDiv, "click", function ()
			   {
			    var l_params = {};
//var l_self = this;
l_params.aNID = GBL.MAIN_DATA.getViewer().getUserId();
	l_params.aT = "2";
	l_params.f = "JGetMissions";
     
	   
   
	   makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx", function(a_responseData){
            l_self.onGetJobList2(a_responseData,l_contentTBody);
        },l_params);
			    
			   });
	addEventWithParameter(l_imgDiv, "mouseover", function(){ l_imgDiv.style.backgroundImage = "url(http://www.laasex.com/crime/images/UI/buttons/m2_2.png)"; } );
    addEventWithParameter(l_imgDiv, "mousedown", function(){ l_imgDiv.style.backgroundImage = "url(http://www.laasex.com/crime/images/UI/buttons/m2_3.png)"; }  );
     addEventWithParameter(l_imgDiv, "mouseout", function(){l_imgDiv.style.backgroundImage = "url(http://www.laasex.com/crime/images/UI/buttons/m2_1.png)"; }  );
  
*/

        this.refresh();
    }
//onClickLowLevel
//onClickHighLevel

    JobListDiv.prototype.onClickLowLevel = function(){
	 this.refresh();
	}
	
	 JobListDiv.prototype.onClickHighLevel = function(){
        //outputDebug("onClickHighLevel");

        this.m_tableDiv.innerHTML = "";

        var l_contentTable = document.createElement("table");
	 var l_contentTable2 = document.createElement("table");
	      var l_contentTBody2 = document.createElement("tbody");
        l_contentTable2.appendChild(l_contentTBody2);
	   var l_contentTableTR2 = document.createElement("tr");
	   l_contentTBody2.appendChild(l_contentTableTR2);
	   /*
	l_contentTableTR2.appendChild(this.Aimg);
	l_contentTableTR2.appendChild(this.Bimg);
	l_contentTableTR2.appendChild(this.Cimg); 
	l_contentTableTR2.appendChild(this.Dimg);
	l_contentTableTR2.appendChild(this.Eimg);
	*/
	
	for(var Mi = 6 ; Mi < 11; Mi++)
{
    
    	l_contentTableTR2.appendChild(AddJobIMG(Mi,this));
    
}
	
	
	
	 this.m_tableDiv.appendChild(l_contentTable2);
        this.m_tableDiv.appendChild(l_contentTable);
	
	
	
        l_contentTable.style.marginLeft = "auto";
        l_contentTable.style.marginRight = "auto";
        l_contentTable.style.cellSpacing = "0px";
        l_contentTable.style.borderCollapse = "collapse";
//        l_contentTable.style.borderSpacing = "6px";
        var l_contentTBody = document.createElement("tbody");
        l_contentTable.appendChild(l_contentTBody);
this.l_contentTBody  =l_contentTBody;

        var l_headerTR = document.createElement("tr");
        l_contentTBody.appendChild(l_headerTR);

        var l_td = document.createElement("td");
        l_headerTR.appendChild(l_td);
        addHeaderStyleWithInnerDiv(l_td, this.m_rewardHeader, "250px");

        l_td = document.createElement("td");
        l_headerTR.appendChild(l_td);
        addHeaderStyleWithInnerDiv(l_td, this.m_requirementHeader, "450px");

        l_td = document.createElement("td");
        l_headerTR.appendChild(l_td);
        addHeaderStyleWithInnerDiv(l_td, this.m_actionHeader, "100px");

        var l_loadingDiv = document.createElement("div");
        /*
		this.m_containerDiv.appendChild(l_loadingDiv);
        l_loadingDiv.style.padding = "10px";
        l_loadingDiv.innerHTML = "<span style='color:#FF6F00; font-weight:bold;'> Loading ...  </span>";
		*/
var l_params = {};
var l_self = this;
l_params.aNID = GBL.MAIN_DATA.getViewer().getUserId();
	l_params.aT = "2";
	l_params.f = "JGetMissionsType";
     	l_params.MIT = "5";
	    
	    
	   makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx", function(a_responseData){
            l_self.onGetJobList2(a_responseData,l_contentTBody);
        },l_params);
/*
        var l_params = {};
        l_params.user_id = GBL.MAIN_DATA.getViewer().getUserId();
        l_params.level = GBL.MAIN_DATA.getViewer().getLevel();
        
        
        makeXMLNotCachedRequest(REQUEST_DESTINATION_URL + "/" + this.m_requestDestinationURI, function(a_responseData){
           l_loadingDiv.style.display = "none";
           l_self.onGetJobList(a_responseData, l_contentTBody);
        },l_params);
	*/
    }
	
	
    JobListDiv.prototype.refresh = function(){
        //outputDebug("refresh");

        this.m_tableDiv.innerHTML = "";

        var l_contentTable = document.createElement("table");
	 var l_contentTable2 = document.createElement("table");
	      var l_contentTBody2 = document.createElement("tbody");
        l_contentTable2.appendChild(l_contentTBody2);
	   var l_contentTableTR2 = document.createElement("tr");
	   l_contentTBody2.appendChild(l_contentTableTR2);
	   /*
	l_contentTableTR2.appendChild(this.Aimg);
	l_contentTableTR2.appendChild(this.Bimg);
	l_contentTableTR2.appendChild(this.Cimg);
	l_contentTableTR2.appendChild(this.Dimg);
	l_contentTableTR2.appendChild(this.Eimg);
	*/
	
	for(var Mi = 1 ; Mi < 6; Mi++)
{
    
    	l_contentTableTR2.appendChild(AddJobIMG(Mi,this));
    
}
	
	
	
	 this.m_tableDiv.appendChild(l_contentTable2);
        this.m_tableDiv.appendChild(l_contentTable);
	
	
	
        l_contentTable.style.marginLeft = "auto";
        l_contentTable.style.marginRight = "auto";
        l_contentTable.style.cellSpacing = "0px";
        l_contentTable.style.borderCollapse = "collapse";
//        l_contentTable.style.borderSpacing = "6px";
        var l_contentTBody = document.createElement("tbody");
        l_contentTable.appendChild(l_contentTBody);
this.l_contentTBody  =l_contentTBody;

        var l_headerTR = document.createElement("tr");
        l_contentTBody.appendChild(l_headerTR);

        var l_td = document.createElement("td");
        l_headerTR.appendChild(l_td);
        addHeaderStyleWithInnerDiv(l_td, this.m_rewardHeader, "250px");

        l_td = document.createElement("td");
        l_headerTR.appendChild(l_td);
        addHeaderStyleWithInnerDiv(l_td, this.m_requirementHeader, "450px");

        l_td = document.createElement("td");
        l_headerTR.appendChild(l_td);
        addHeaderStyleWithInnerDiv(l_td, this.m_actionHeader, "100px");

        var l_loadingDiv = document.createElement("div");
       /*
	   this.m_containerDiv.appendChild(l_loadingDiv);
        l_loadingDiv.style.padding = "10px";
        l_loadingDiv.innerHTML = "<span style='color:#FF6F00; font-weight:bold;'> Loading ...  </span>";
		*/
var l_params = {};
var l_self = this;
l_params.aNID = GBL.MAIN_DATA.getViewer().getUserId();
	l_params.aT = "2";
	l_params.MIT = "1";
	l_params.f = "JGetMissionsType";
     
	   
	   
	   makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx", function(a_responseData){
            l_self.onGetJobList2(a_responseData,l_contentTBody);
        },l_params); 
/*
        var l_params = {};
        l_params.user_id = GBL.MAIN_DATA.getViewer().getUserId();
        l_params.level = GBL.MAIN_DATA.getViewer().getLevel();
        
        
        makeXMLNotCachedRequest(REQUEST_DESTINATION_URL + "/" + this.m_requestDestinationURI, function(a_responseData){
           l_loadingDiv.style.display = "none";
           l_self.onGetJobList(a_responseData, l_contentTBody);
        },l_params);
	*/
	
//	new AdDiv2(this.m_tableDiv);
	
    }

 JobListDiv.prototype.onGetJobList2 = function(a_responseData, a_contentTBody){
    
	//a_contentTBody.innerHTML = "";
	 while(a_contentTBody.hasChildNodes())
{ 
  a_contentTBody.removeChild(a_contentTBody.firstChild);
}

     jsonS = parseJSON2(a_responseData.text);
    var l_nextLevel = jsonS.outer.xml.nextlevel;
                if(l_nextLevel){
                    var l_moreDiv = document.createElement("tr");
					 var l_moreDiv2 = document.createElement("td");
					 l_moreDiv.appendChild(l_moreDiv2);
                    a_contentTBody.appendChild(l_moreDiv);
                    l_moreDiv2.style.padding = "10px"; 
					
                    l_moreDiv2.innerHTML = "<span style='color:#00FF00; font-weight:bold;'>  " + this.m_nextLevelText + " " + l_nextLevel + " ...";
                } 
				try
				{
     for(var l_index = 0; l_index < jsonS.outer.xml.MissionXML.length; l_index++){
	//var obj_um = a_jQ.from( jsonS.outer.xml, "entry", ".MissionID=='"+jsonS.outer.xml.missions[l_index].MissionID+"'" ) ;
	
	var l_job = new Job2(jsonS.outer.xml.MissionXML[l_index],null);
                    a_contentTBody.appendChild(this.createJobTr2(l_job));
     } 
	 
	 } 
	 catch(err)
	 {
	 };
	      /*    var l_moreDiv3 = document.createElement("tr");
			  
					 var l_moreDiv4 = document.createElement("td");
					 l_moreDiv3.appendChild(l_moreDiv4);
					 var l_moreDiv5 =document.createElement("div");
					 l_moreDiv4.appendChild(l_moreDiv5);
					  a_contentTBody.appendChild(l_moreDiv3); 
	 new AdDiv2(l_moreDiv5); */
	this.m_adDiv.innerHTML = '';
	 new AdDiv2(this.m_adDiv); 
	 
     /*
        var l_moreDiv = document.createElement("div");
                    this.m_tableDiv.appendChild(l_moreDiv);
                    l_moreDiv.style.padding = "10px";
                    l_moreDiv.innerHTML = "<span style='color:#00FF00; font-weight:bold; font-size: 26px;'>testing3...</span>";
		    */
     /*
        var l_xmlDoc = getGadgetResponseData(a_responseData);
        if(isValid(l_xmlDoc)){
            try{
                var l_jobNodes = l_xmlDoc.getElementsByTagName("job");
                for(var l_index = 0; l_index < l_jobNodes.length; l_index++){
                    var l_job = new Job(l_jobNodes[l_index]);
                    a_contentTBody.appendChild(this.createJobTr(l_job));
                }

               

            } catch (err) { outputAlert("onGetJobList " + err);}
        }
	*/
    }


    JobListDiv.prototype.onGetJobList = function(a_responseData, a_contentTBody){
        var l_xmlDoc = getGadgetResponseData(a_responseData);
        if(isValid(l_xmlDoc)){
            try{
                var l_jobNodes = l_xmlDoc.getElementsByTagName("job");
                for(var l_index = 0; l_index < l_jobNodes.length; l_index++){
                    var l_job = new Job(l_jobNodes[l_index]);
                    a_contentTBody.appendChild(this.createJobTr(l_job));
                }

                var l_nextLevel = getXMLNodeValue(l_xmlDoc, "next_level");
                if(isVal-id(l_nextLevel)){
                    var l_moreDiv = document.createElement("div");
                    this.m_tableDiv.appendChild(l_moreDiv);
                    l_moreDiv.style.padding = "10px";
                    l_moreDiv.innerHTML = "<span style='color:#00FF00; font-weight:bold;'>  " + this.m_nextLevelText + " " + l_nextLevel + " ...";
                }

            } catch (err) { outputAlert("onGetJobList " + err);}
        }
    }


    JobListDiv.prototype.createJobTr2 = function(a_job){

        var l_tr = document.createElement("tr");

        var l_td = document.createElement("td");
        l_tr.appendChild(l_td);
	
        l_td.style.padding = "5px 20px 5px 10px";
        l_td.style.borderBottom = "solid 1px #505050";
        l_td.style.verticalAlign = "top";
	
	/*
	var l_div1 = document.createElement("div");
	 l_div1.className = "xp_bar_fix";
	 
	 	var l_div2 = document.createElement("div");
	 l_div2.id = "level_bar_container";
	 var l_div3 = document.createElement("div");
	 l_div3.id = "level_bar";
	 l_div3.style.backgroundcolor = 'red';
	 
	 var percent = a_job.getpercent() +"%";
	 
	 l_div3.style.width = percent;
	 //l_div3.innerHTML = percent;
	 
	 
	 
	 l_div1.appendChild(l_div2);
	 l_div2.appendChild(l_div3);
	 l_td.appendChild(l_div1);
	
	*/
	
	
	
        var l_div = createWhiteDiv(l_td);
	
	l_td.appendChild(document.createElement("BR"));
	
        l_div.style.fontSize = "18px";
        l_div.style.fontWeight = "bold";
        l_div.innerHTML = a_job.getTitle();
	
	var l_percentMission = a_job.getpercent();
        if(isValid(l_percentMission)){
            var l_barOutDiv = document.createElement("div");
            l_td.appendChild(l_barOutDiv);  
            l_barOutDiv.style.height = "12px";
	     l_barOutDiv.style.backgroundColor = "black";
	     l_barOutDiv.id  = "barout";
            l_barOutDiv.style.overflow = "hidden";

            var l_percentLevelDiv = document.createElement("div");
	    l_percentLevelDiv.id = "level_bar"+ a_job.getJobId();
		
            l_barOutDiv.appendChild(l_percentLevelDiv);
            l_percentLevelDiv.style.backgroundColor = "#38B0DE";
            l_percentLevelDiv.style.width = (parseInt(l_percentMission)+3).toString() + "%";
            l_percentLevelDiv.style.height = "12px";
	    
	    var l_percentLevelDiv2 = document.createElement("div");
	    l_percentLevelDiv2.innerHTML = "Master Percent: " + l_percentMission + "%";
	    l_percentLevelDiv2.id= "level_bar_text"+ a_job.getJobId();;
	    l_td.appendChild(l_percentLevelDiv2);
	    
        }
	var l_levelMission = a_job.getlevel();
	if(isValid(l_percentMission)){ 
            var l_barOutDiv = document.createElement("div");
            l_td.appendChild(l_barOutDiv);
			var l_imagehtml = "";
			for(var i = 0 ; i < l_levelMission; i++)
			{
			
			l_imagehtml += "<img src=\"http://www.laasex.com/crime/images/UI/levels/"+i+".png\"/> "  ;
			}
			
			
			l_barOutDiv.id = "l_barOutDiv"+ a_job.getJobId();;
	    l_barOutDiv.innerHTML = "Mastery:" + l_imagehtml  ;
	}
        l_td.appendChild(this.getRewardDiv(a_job.getReward()));
	l_td.style.padding = "5px 10px 5px 10px";
	

	
	
	/*    Job2.prototype.getlevel = function() {return this.mlevel;}
    Job2.prototype.getlevelMax = function () { return this.mlevelMax;}
    Job2.prototype.getpercent = function () { return this.cpercent;}
    Job2.prototype.getpercentMax = function() { return this.cpercentMax;}
    Job2.prototype.getlevel = function() { return this.mlevel;}
    Job2.prototype.getlevelMax = function() { return this.mlevelMax;}
    Job2.prototype.getMissionCompleted = function() { return this.MissionCompleted;}
    Job2.prototype.getRiskCompleted = function() { return this.RiskCompleted;}
	*/
	
	
	
        l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.padding = "5px 10px 5px 10px";
        l_td.style.borderBottom = "solid 1px #505050";
        l_td.style.verticalAlign = "top";
	
	
        l_td.appendChild(this.getRequirementDiv(a_job.getRequirement()));
	
/*
<div class="xp_bar_fix">
                <div id="level_bar_container">
                	<div id="level_bar" style="overflow: hidden; background-color: rgb(41, 202, 49); text-align: left; float: left; width: 48%;">&nbsp;</div>
                </div>
                </div>
*/

        l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.padding = "5px 15px 5px 15px";
        l_td.style.borderBottom = "solid 1px #505050";

        var l_self = this;

        new DivButton2(l_td, "http://www.laasex.com/crime/images/UI/buttons/buttondomissions.png", function(a_event){
            goToPageTop();
            l_self.m_resultDiv.showMessage(undefined, l_self.m_doingText);
/*
            var l_params = {};
            l_params.NetworkID = GBL.MAIN_DATA.getViewer().getUserId();
			l_params.NetworkType = "2";
            l_params.MissionID = a_job.getJobId();
			
			
            //makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/do_job",
			makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/DoMission",
                    function(a_response){
                        handleResult(a_response, l_self.m_resultDiv, function(){l_self.refresh();});},
                    l_params, 0);
                    
*/

var l_params = {};
//var l_self = this;
l_params.aNID = GBL.MAIN_DATA.getViewer().getUserId(); 
	l_params.aT = "2";
	l_params.f = "JDoMission";
      l_params.mid = a_job.getJobId();
	  
	   // http://xat.com/Crime_TheFamily
	   if(a_job.getJobId() == "300")
	   { 
	   l_self.m_tableDiv.innerHTML = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="800" height="600" id="CarDrive" align="middle">	<param name="allowScriptAccess" value="*" />	<param name="allowFullScreen" value="false" />	<param name="movie" value="http://www.laasex.com/crime/flash/missions/CarDrive8.swf?username='+  GBL.MAIN_DATA.getViewer().getMobName()+'&user_id='+GBL.MAIN_DATA.getViewer().getUserId()+'&networktype=2" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />	<embed src="http://www.laasex.com/crime/flash/missions/CarDrive8.swf?username='+  GBL.MAIN_DATA.getViewer().getMobName()+'&user_id='+GBL.MAIN_DATA.getViewer().getUserId()+'&networktype=2" quality="high" bgcolor="#ffffff" width="800" height="600" name="CarDrive" align="middle" allowScriptAccess="*" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" />	</object>';
	     //l_self.m_resultDiv.style.width = "600px";
		// l_self.m_resultDiv.style.height = "800px";  
//m_tableDiv 		 
	   } 
	   else
	   {
	   outputDebug("JDoMission");
	   makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx", function(a_responseData){
            //l_self.onGetJobList2(a_responseData,l_contentTBody);
	     
                        handleResultJSONMission(a_responseData, l_self.m_resultDiv,a_job, function(a_responseData,a_job){
						//l_self.refresh();
						
						 	jsonS = parseJSON2(a_responseData.text);//.parseJSON();
     outputDebug("after do mission " + a_responseData.text+ " retries");
    
				var l_success = getBooleanValue(jsonS.outer.xml.success);
	if(l_success)
	{

	var NextPercent  = parseInt(a_job.getpercent() ) +  parseInt(a_job.getpercentRate());
	 
		outputDebug("after do mission if(l_success) retries a_job.getpercent(): " + a_job.getpercent() + " a_job.getpercentRate()" + a_job.getpercentRate() + " NextPercent:" + NextPercent.toString());
	if(NextPercent > 99)
	{
	NextPercent = 0; 
	
	a_job.mlevel = (parseInt(a_job.mlevel) + 1).toString();
	
	ID("l_barOutDiv"+ a_job.getJobId()).innerHTML += "<img src=\"http://www.laasex.com/crime/images/UI/levels/"+(parseInt(a_job.getlevel())+1).toString()+".png\"/> "  ;
	/* l_percentLevelDiv.id = "level_bar"+ a_job.getJobId();
		
            l_barOutDiv.appendChild(l_percentLevelDiv);
            l_percentLevelDiv.style.backgroundColor = "#38B0DE";
            l_percentLevelDiv.style.width = (parseInt(l_percentMission)+3).toString() + "%";
            l_percentLevelDiv.style.height = "12px";
	    
	    var l_percentLevelDiv2 = document.createElement("div");
	    l_percentLevelDiv2.innerHTML = "Master Percent: " + l_percentMission + "%";
	    l_percentLevelDiv2.id= "level_bar_text"+ a_job.getJobId();;
	    l_td.appendChild(l_percentLevelDiv2);
	    
        } 
	var l_levelMission = a_job.getlevel();
	if(isValid(l_percentMission)){ 
            var l_barOutDiv = document.createElement("div");
            l_td.appendChild(l_barOutDiv);
			var l_imagehtml = "";
			for(var i = 0 ; i < l_levelMission; i++)
			{
			
			l_imagehtml += "<img src=\"http://www.laasex.com/crime/images/UI/levels/"+i+".png\"/> "  ;
			}
			
			
			
	    l_barOutDiv.innerHTML = "Mastery:" + l_imagehtml  ;
	*/
	}
	a_job.cpercent = NextPercent.toString();
						ID("level_bar"+a_job.getJobId()).style.width = (NextPercent +3).toString() + "%";
						ID("level_bar_text"+a_job.getJobId()).innerHTML = "Master Percent: " + NextPercent.toString()  + "%";
	}					
						/*    l_percentLevelDiv.id = "level_bar"+ a_job.getJobId();
		
            l_barOutDiv.appendChild(l_percentLevelDiv);
            l_percentLevelDiv.style.backgroundColor = "#38B0DE";
            l_percentLevelDiv.style.width = (parseInt(l_percentMission)+3).toString() + "%";
            l_percentLevelDiv.style.height = "12px";
	    
	    var l_percentLevelDiv2 = document.createElement("div");
	    l_percentLevelDiv2.innerHTML = "Master Percent: " + l_percentMission + "%";
	    l_percentLevelDiv2.id= "level_bar_text"+ a_job.getJobId();;*/
						
						});
						},l_params); 
      }
		});
        return l_tr;
    }
    
    
    JobListDiv.prototype.createJobTr = function(a_job){

        var l_tr = document.createElement("tr");

        var l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.padding = "5px 20px 5px 10px";
        l_td.style.borderBottom = "solid 1px #505050";
        l_td.style.verticalAlign = "top";
        var l_div = createWhiteDiv(l_td);
        l_div.style.fontSize = "18px";
        l_div.style.fontWeight = "bold";
        l_div.innerHTML = a_job.getTitle();
        l_td.appendChild(this.getRewardDiv(a_job.getReward()));

        l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.padding = "5px 10px 5px 10px";
        l_td.style.borderBottom = "solid 1px #505050";
        l_td.style.verticalAlign = "top";
        l_td.appendChild(this.getRequirementDiv(a_job.getRequirement()));


        l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.padding = "5px 15px 5px 15px";
        l_td.style.borderBottom = "solid 1px #505050";

        var l_self = this;

        new DivButton(l_td, this.m_doButtonText, function(a_event){
            goToPageTop();
            l_self.m_resultDiv.showMessage(undefined, l_self.m_doingText);

            var l_params = {};
            l_params.NetworkID = GBL.MAIN_DATA.getViewer().getUserId();
			l_params.NetworkType = "2";
            l_params.MissionID = a_job.getJobId();
			
			
            //makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/do_job",
			makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/DoMission",
                    function(a_response){
                        handleResult(a_response, l_self.m_resultDiv, function(){l_self.refresh();});},
                    l_params, 0);
        });

        return l_tr;
    }

    JobListDiv.prototype.getRewardDiv = function(a_reward){
        var l_rewardData = a_reward.getData();
        var l_containerDiv = document.createElement("div");

        var l_div = undefined;
        if(l_rewardData.min > 0){
            l_div = createWhiteDiv(l_containerDiv);
            l_div.innerHTML = "<img src=\"http://www.laasex.com/crime/images/UI/icons/money4.png\"/> <span style='color:#00FF00'>$" + formatNumberWithCommas(l_rewardData.min) + " - $" + formatNumberWithCommas(l_rewardData.max) + " </span>";
        }
        if(l_rewardData.experience > 0){
            l_div = createWhiteDiv(l_containerDiv);
            l_div.innerHTML = "Experience: +"+l_rewardData.experience;
        }
	if(l_rewardData.hidden_item == "1"){
            l_div = createWhiteDiv(l_containerDiv); 
            l_div.innerHTML = 'Hidden Loot  ' + '<img src="http://www.laasex.com/crime/images/UI/buttons/L.png"/>';
        }
	
// hiddenitem

        if(l_rewardData.itemsLoot)
{		if(		l_rewardData.itemsLoot.length > 0){
            l_div = createWhiteDiv(l_containerDiv);
            l_div.innerHTML = "Loot:";
            createItemsListDiv(l_containerDiv, l_rewardData.itemsLoot, 1);
        }
}
        return l_containerDiv;
    }

    JobListDiv.prototype.getRequirementDiv = function(a_requirement){
        var l_requirementData = a_requirement.getData();

        var l_containerDiv = document.createElement("div");
        var l_ssCells = new SideBySideCells(l_containerDiv, false);

        var l_requiredCell = l_ssCells.getLeftCell();
        l_requiredCell.style.verticalAlign = "top";
        var l_div = createWhiteDiv(l_requiredCell);
        l_div.style.fontWeight = "bold";
        l_div.style.fontStyle = "italic";
        l_div.innerHTML = "Requires...";

        if(l_requirementData.energy > 0){
            l_div = createWhiteDiv(l_requiredCell);
            l_div.innerHTML = "Energy: "+l_requirementData.energy;
        }
        if(l_requirementData.mobster > 0){
            l_div = createWhiteDiv(l_requiredCell);
            l_div.innerHTML = "Friends: "+l_requirementData.mobster ;
        }
        if(isValid(l_requirementData.cash) && l_requirementData.cash > 0){
            l_div = createWhiteDiv(l_requiredCell);
            l_div.innerHTML = "Cash: $"+l_requirementData.cash;
        }


        var l_itemCell = l_ssCells.getRightCell();
        createItemsListDiv(l_itemCell, l_requirementData.items, 2);

        return l_containerDiv;
    }

// end joblistDiv


// JobOrgListDiv
    function JobOrgListDiv(a_parentDiv){

        this.m_parentDiv = a_parentDiv;
        this.m_containerDiv = undefined;
        this.m_resultDiv = undefined;
        this.m_tableDiv = undefined;


        this.m_requestDestinationURI = "get_job_list";
        this.m_titleDiv = undefined;
        this.m_rewardHeader = undefined;
        this.m_requirementHeader = undefined;
        this.m_actionHeader = undefined;
        this.m_nextLevelText = undefined;
        this.m_doButtonText = undefined;
        this.m_doingText = undefined;


        // constructor
        this.initialize();
        this.createDiv(this.m_parentDiv);
    }

    JobOrgListDiv.prototype.initialize = function(){
        this.m_titleDiv = "Jobs:";

        this.m_rewardHeader = "Description / Payout";
        this.m_requirementHeader = "Job Requires";
        this.m_actionHeader = "Do Job";

        this.m_nextLevelText = "Unlock more jobs when you reach level";

        this.m_doButtonText = "Do Job";
        this.m_doingText = "Doing Job... ";
    }

    JobOrgListDiv.prototype.createDiv = function(_a_parentDiv){
        //outputDebug("createDiv");

        this.m_parentDiv = _a_parentDiv;

        this.m_containerDiv = document.createElement("div");
        this.m_parentDiv.appendChild(this.m_containerDiv);
        this.m_containerDiv.style.padding = "15px";
        this.m_containerDiv.style.textAlign = "center";

        var l_title = document.createElement("div");
        this.m_containerDiv.appendChild(l_title);
        createTitleDiv(l_title, this.m_titleDiv);

        this.m_resultDiv = new ResultDiv(this.m_containerDiv);

        this.m_tableDiv = document.createElement("div");
        this.m_containerDiv.appendChild(this.m_tableDiv);
        this.m_tableDiv.style.textAlign = "center";
        this.m_tableDiv.style.paddingTop = "5px";

        this.refresh();
    }

    JobOrgListDiv.prototype.refresh = function(){
        //outputDebug("refresh");

        this.m_tableDiv.innerHTML = "";

        var l_contentTable = document.createElement("table");
        this.m_tableDiv.appendChild(l_contentTable);
        l_contentTable.style.marginLeft = "auto";
        l_contentTable.style.marginRight = "auto";
        l_contentTable.style.cellSpacing = "0px";
        l_contentTable.style.borderCollapse = "collapse";
//        l_contentTable.style.borderSpacing = "6px";
        var l_contentTBody = document.createElement("tbody");
        l_contentTable.appendChild(l_contentTBody);

        var l_headerTR = document.createElement("tr");
        l_contentTBody.appendChild(l_headerTR);

        var l_td = document.createElement("td");
        l_headerTR.appendChild(l_td);
        addHeaderStyleWithInnerDiv(l_td, this.m_rewardHeader, "250px");

        l_td = document.createElement("td");
        l_headerTR.appendChild(l_td);
        addHeaderStyleWithInnerDiv(l_td, this.m_requirementHeader, "450px");

        l_td = document.createElement("td");
        l_headerTR.appendChild(l_td);
        addHeaderStyleWithInnerDiv(l_td, this.m_actionHeader, "100px");

        var l_loadingDiv = document.createElement("div");
        this.m_containerDiv.appendChild(l_loadingDiv);
        l_loadingDiv.style.padding = "10px";
        l_loadingDiv.innerHTML = "<span style='color:#FF6F00; font-weight:bold;'> Loading ...  </span>";


        var l_params = {};
        l_params.user_id = GBL.MAIN_DATA.getViewer().getUserId();
        l_params.level = GBL.MAIN_DATA.getViewer().getLevel();
        
        var l_self = this;
        makeXMLNotCachedRequest(REQUEST_DESTINATION_URL + "/" + this.m_requestDestinationURI, function(a_responseData){
           l_loadingDiv.style.display = "none";
           l_self.onGetJobList(a_responseData, l_contentTBody);
        },l_params);
    }


    JobOrgListDiv.prototype.onGetJobList = function(a_responseData, a_contentTBody){
        var l_xmlDoc = getGadgetResponseData(a_responseData);
        if(isValid(l_xmlDoc)){
            try{
                var l_jobNodes = l_xmlDoc.getElementsByTagName("job");
                for(var l_index = 0; l_index < l_jobNodes.length; l_index++){
                    var l_job = new Job(l_jobNodes[l_index]);
                    a_contentTBody.appendChild(this.createJobTr(l_job));
                }

                var l_nextLevel = getXMLNodeValue(l_xmlDoc, "next_level");
                if(isValid(l_nextLevel)){
                    var l_moreDiv = document.createElement("div");
                    this.m_tableDiv.appendChild(l_moreDiv);
                    l_moreDiv.style.padding = "10px";
                    l_moreDiv.innerHTML = "<span style='color:#00FF00; font-weight:bold;'>  " + this.m_nextLevelText + " " + l_nextLevel + " ...";
                }

            } catch (err) { outputAlert("onGetJobList " + err);}
        }
    }


    JobOrgListDiv.prototype.createJobTr = function(a_job){

        var l_tr = document.createElement("tr");

        var l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.padding = "5px 20px 5px 10px";
        l_td.style.borderBottom = "solid 1px #505050";
        l_td.style.verticalAlign = "top";
        var l_div = createWhiteDiv(l_td);
        l_div.style.fontSize = "18px";
        l_div.style.fontWeight = "bold";
        l_div.innerHTML = a_job.getTitle();
        l_td.appendChild(this.getRewardDiv(a_job.getReward()));

        l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.padding = "5px 10px 5px 10px";
        l_td.style.borderBottom = "solid 1px #505050";
        l_td.style.verticalAlign = "top";
        l_td.appendChild(this.getRequirementDiv(a_job.getRequirement()));


        l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.padding = "5px 15px 5px 15px";
        l_td.style.borderBottom = "solid 1px #505050";

        var l_self = this;

        new DivButton(l_td, this.m_doButtonText, function(a_event){
            goToPageTop();
            l_self.m_resultDiv.showMessage(undefined, l_self.m_doingText);

            var l_params = {};
            l_params.NetworkID = GBL.MAIN_DATA.getViewer().getUserId();
			l_params.NetworkType = "2";
            l_params.MissionID = a_job.getJobId();
			
			
            //makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/do_job",
			makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/DoMission",
                    function(a_response){
                        handleResult(a_response, l_self.m_resultDiv, function(){l_self.refresh();});},
                    l_params, 0);
        });

        return l_tr;
    }

    JobOrgListDiv.prototype.getRewardDiv = function(a_reward){
        var l_rewardData = a_reward.getData();
        var l_containerDiv = document.createElement("div");

        var l_div = undefined;
        if(l_rewardData.min > 0){
            l_div = createWhiteDiv(l_containerDiv);
            l_div.innerHTML = "Payout: <span style='color:#00FF00'>$" + formatNumberWithCommas(l_rewardData.min) + " - $" + formatNumberWithCommas(l_rewardData.max) + " </span>";
        }
        if(l_rewardData.experience > 0){
            l_div = createWhiteDiv(l_containerDiv);
            l_div.innerHTML = "Experience: +"+l_rewardData.experience;
        }

        if(isValid(l_rewardData.items) && l_rewardData.items.length > 0){
            l_div = createWhiteDiv(l_containerDiv);
            l_div.innerHTML = "Loot:";
            createItemsListDiv(l_containerDiv, l_rewardData.items, 1);
        }

        return l_containerDiv;
    }

    JobOrgListDiv.prototype.getRequirementDiv = function(a_requirement){
        var l_requirementData = a_requirement.getData();

        var l_containerDiv = document.createElement("div");
        var l_ssCells = new SideBySideCells(l_containerDiv, false);

        var l_requiredCell = l_ssCells.getLeftCell();
        l_requiredCell.style.verticalAlign = "top";
        var l_div = createWhiteDiv(l_requiredCell);
        l_div.style.fontWeight = "bold";
        l_div.style.fontStyle = "italic";
        l_div.innerHTML = "Requires...";

        if(l_requirementData.energy > 0){
            l_div = createWhiteDiv(l_requiredCell);
            l_div.innerHTML = "Energy: "+l_requirementData.energy;
        }
        if(l_requirementData.mobster > 0){
            l_div = createWhiteDiv(l_requiredCell);
            l_div.innerHTML = "Friends: "+l_requirementData.mobster;
        }
        if(isValid(l_requirementData.cash) && l_requirementData.cash > 0){
            l_div = createWhiteDiv(l_requiredCell);
            l_div.innerHTML = "Cash: $"+l_requirementData.cash;
        }


        var l_itemCell = l_ssCells.getRightCell();
        createItemsListDiv(l_itemCell, l_requirementData.items, 2);

        return l_containerDiv;
    }

// end JobOrgListDiv




// JobClassListDiv
    function JobClassListDiv(a_parentDiv){

        this.m_parentDiv = a_parentDiv;
        this.m_containerDiv = undefined;
        this.m_resultDiv = undefined;
        this.m_tableDiv = undefined;


        this.m_requestDestinationURI = "get_job_list";
        this.m_titleDiv = undefined;
        this.m_rewardHeader = undefined;
        this.m_requirementHeader = undefined;
        this.m_actionHeader = undefined;
        this.m_nextLevelText = undefined;
        this.m_doButtonText = undefined;
        this.m_doingText = undefined;


        // constructor
        this.initialize();
        this.createDiv(this.m_parentDiv);
    }

    JobClassListDiv.prototype.initialize = function(){
        this.m_titleDiv = "Class Jobs:";

        this.m_rewardHeader = "Description / Payout";
        this.m_requirementHeader = "Job Requires";
        this.m_actionHeader = "Do Job";

        this.m_nextLevelText = "Unlock more jobs when you reach level";

        this.m_doButtonText = "Do Job";
        this.m_doingText = "Doing Job... ";
    }

    JobClassListDiv.prototype.createDiv = function(_a_parentDiv){
        //outputDebug("createDiv");

        this.m_parentDiv = _a_parentDiv;

        this.m_containerDiv = document.createElement("div");
        this.m_parentDiv.appendChild(this.m_containerDiv);
        this.m_containerDiv.style.padding = "15px";
        this.m_containerDiv.style.textAlign = "center";

        var l_title = document.createElement("div");
        this.m_containerDiv.appendChild(l_title);
        createTitleDiv(l_title, this.m_titleDiv);

        this.m_resultDiv = new ResultDiv(this.m_containerDiv);

        this.m_tableDiv = document.createElement("div");
        this.m_containerDiv.appendChild(this.m_tableDiv);
        this.m_tableDiv.style.textAlign = "center";
        this.m_tableDiv.style.paddingTop = "5px";

        this.refresh();
    }

    JobClassListDiv.prototype.refresh = function(){
        //outputDebug("refresh");

        this.m_tableDiv.innerHTML = "";

        var l_contentTable = document.createElement("table");
        this.m_tableDiv.appendChild(l_contentTable);
        l_contentTable.style.marginLeft = "auto";
        l_contentTable.style.marginRight = "auto";
        l_contentTable.style.cellSpacing = "0px";
        l_contentTable.style.borderCollapse = "collapse";
//        l_contentTable.style.borderSpacing = "6px";
        var l_contentTBody = document.createElement("tbody");
        l_contentTable.appendChild(l_contentTBody);

        var l_headerTR = document.createElement("tr");
        l_contentTBody.appendChild(l_headerTR);

        var l_td = document.createElement("td");
        l_headerTR.appendChild(l_td);
        addHeaderStyleWithInnerDiv(l_td, this.m_rewardHeader, "250px");

        l_td = document.createElement("td");
        l_headerTR.appendChild(l_td);
        addHeaderStyleWithInnerDiv(l_td, this.m_requirementHeader, "450px");

        l_td = document.createElement("td");
        l_headerTR.appendChild(l_td);
        addHeaderStyleWithInnerDiv(l_td, this.m_actionHeader, "100px");

        var l_loadingDiv = document.createElement("div");
        this.m_containerDiv.appendChild(l_loadingDiv);
        l_loadingDiv.style.padding = "10px";
        l_loadingDiv.innerHTML = "<span style='color:#FF6F00; font-weight:bold;'> Loading ...  </span>";


        var l_params = {};
        l_params.user_id = GBL.MAIN_DATA.getViewer().getUserId();
        l_params.level = GBL.MAIN_DATA.getViewer().getLevel();
        
        var l_self = this;
        makeXMLNotCachedRequest(REQUEST_DESTINATION_URL + "/" + this.m_requestDestinationURI, function(a_responseData){
           l_loadingDiv.style.display = "none";
           l_self.onGetJobList(a_responseData, l_contentTBody);
        },l_params);
    }


    JobClassListDiv.prototype.onGetJobList = function(a_responseData, a_contentTBody){
        var l_xmlDoc = getGadgetResponseData(a_responseData);
        if(isValid(l_xmlDoc)){
            try{
                var l_jobNodes = l_xmlDoc.getElementsByTagName("job");
                for(var l_index = 0; l_index < l_jobNodes.length; l_index++){
                    var l_job = new Job(l_jobNodes[l_index]);
                    a_contentTBody.appendChild(this.createJobTr(l_job));
                }

                var l_nextLevel = getXMLNodeValue(l_xmlDoc, "next_level");
                if(isValid(l_nextLevel)){
                    var l_moreDiv = document.createElement("div");
                    this.m_tableDiv.appendChild(l_moreDiv);
                    l_moreDiv.style.padding = "10px";
                    l_moreDiv.innerHTML = "<span style='color:#00FF00; font-weight:bold;'>  " + this.m_nextLevelText + " " + l_nextLevel + " ...";
                }

            } catch (err) { outputAlert("onGetJobList " + err);}
        }
    }


    JobClassListDiv.prototype.createJobTr = function(a_job){

        var l_tr = document.createElement("tr");

        var l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.padding = "5px 20px 5px 10px";
        l_td.style.borderBottom = "solid 1px #505050";
        l_td.style.verticalAlign = "top";
        var l_div = createWhiteDiv(l_td);
        l_div.style.fontSize = "18px";
        l_div.style.fontWeight = "bold";
        l_div.innerHTML = a_job.getTitle();
        l_td.appendChild(this.getRewardDiv(a_job.getReward()));

        l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.padding = "5px 10px 5px 10px";
        l_td.style.borderBottom = "solid 1px #505050";
        l_td.style.verticalAlign = "top";
        l_td.appendChild(this.getRequirementDiv(a_job.getRequirement()));


        l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.padding = "5px 15px 5px 15px";
        l_td.style.borderBottom = "solid 1px #505050";

        var l_self = this;

        new DivButton(l_td, this.m_doButtonText, function(a_event){
            goToPageTop();
            l_self.m_resultDiv.showMessage(undefined, l_self.m_doingText);

            var l_params = {};
            l_params.NetworkID = GBL.MAIN_DATA.getViewer().getUserId();
			l_params.NetworkType = "2";
            l_params.MissionID = a_job.getJobId();
			
			
            //makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/do_job",
			makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/DoMission",
                    function(a_response){
                        handleResult(a_response, l_self.m_resultDiv, function(){l_self.refresh();});},
                    l_params, 0);
        });

        return l_tr;
    }

    JobClassListDiv.prototype.getRewardDiv = function(a_reward){
        var l_rewardData = a_reward.getData();
        var l_containerDiv = document.createElement("div");

        var l_div = undefined;
        if(l_rewardData.min > 0){
            l_div = createWhiteDiv(l_containerDiv);
            l_div.innerHTML = "Payout: <span style='color:#00FF00'>$" + formatNumberWithCommas(l_rewardData.min) + " - $" + formatNumberWithCommas(l_rewardData.max) + " </span>";
        }
        if(l_rewardData.experience > 0){
            l_div = createWhiteDiv(l_containerDiv);
            l_div.innerHTML = "Experience: +"+l_rewardData.experience;
        }

        if(isValid(l_rewardData.items) && l_rewardData.items.length > 0){
            l_div = createWhiteDiv(l_containerDiv);
            l_div.innerHTML = "Loot:";
            createItemsListDiv(l_containerDiv, l_rewardData.items, 1);
        }

        return l_containerDiv;
    }

    JobClassListDiv.prototype.getRequirementDiv = function(a_requirement){
        var l_requirementData = a_requirement.getData();

        var l_containerDiv = document.createElement("div");
        var l_ssCells = new SideBySideCells(l_containerDiv, false);

        var l_requiredCell = l_ssCells.getLeftCell();
        l_requiredCell.style.verticalAlign = "top";
        var l_div = createWhiteDiv(l_requiredCell);
        l_div.style.fontWeight = "bold";
        l_div.style.fontStyle = "italic";
        l_div.innerHTML = "Requires...";

        if(l_requirementData.energy > 0){
            l_div = createWhiteDiv(l_requiredCell);
            l_div.innerHTML = "Energy: "+l_requirementData.energy;
        }
        if(l_requirementData.mobster > 0){
            l_div = createWhiteDiv(l_requiredCell);
            l_div.innerHTML = "Friends: "+l_requirementData.mobster;
        }
        if(isValid(l_requirementData.cash) && l_requirementData.cash > 0){
            l_div = createWhiteDiv(l_requiredCell);
            l_div.innerHTML = "Cash: $"+l_requirementData.cash;
        }


        var l_itemCell = l_ssCells.getRightCell();
        createItemsListDiv(l_itemCell, l_requirementData.items, 2);

        return l_containerDiv;
    }

// end JobClassListDiv


// Property
    function Property(a_xmlNode){

        this.m_xmlNode = a_xmlNode;

        this.m_id = undefined;
        this.m_imageURL = undefined;
        this.m_detailsHTML = undefined;
        this.m_cost = undefined;
        this.m_numOwned = undefined;

        this.fillFromXML();
    }

    Property.prototype.fillFromXML = function(){
       if(!isValid(this.m_xmlNode)){
            return;
       }
       try{ this.m_id = getXMLNodeValue(this.m_xmlNode,"id");}catch(err){};
       try{ this.m_imageURL = getXMLEncodedStringNodeValue(this.m_xmlNode,"image_url");}catch(err){};
       try{ this.m_detailsHTML = getXMLEncodedStringNodeValue(this.m_xmlNode,"details");}catch(err){};
       try{ this.m_cost = getXMLNodeValue(this.m_xmlNode,"cost");}catch(err){};
       try{ this.m_numOwned = parseInt(getXMLNodeValue(this.m_xmlNode,"num_owned"));}catch(err){};
    }

    Property.prototype.getId = function(){return this.m_id;}
    Property.prototype.getImageURL = function(){return this.m_imageURL;}
    Property.prototype.getDetailsHTML = function(){return this.m_detailsHTML;}
    Property.prototype.getCost = function(){return this.m_cost;}
    Property.prototype.getNumOwned = function(){return this.m_numOwned;}
// end Property



// Property
    function Property2(a_xmlNode){

        this.m_xmlNode = a_xmlNode;

        this.m_id = undefined;
        this.m_imageURL = undefined;
        this.m_detailsHTML = undefined;
        this.m_cost = undefined;
		   this.m_health = undefined;
		 this.m_landhealth = undefined;
		  this.m_landprotected = undefined;
		  this.m_landname = undefined;
        this.m_numOwned = undefined;
		 this.m_income = undefined;

        this.fillFromJSON();
    }

    Property2.prototype.fillFromJSON = function(){
       if(!isValid(this.m_xmlNode)){
            return;
       }
       try{ this.m_id = this.m_xmlNode.id;}catch(err){};
       try{ this.m_imageURL = this.m_xmlNode.image_url;}catch(err){};
       try{ this.m_detailsHTML = this.m_xmlNode.details;}catch(err){};
       try{ this.m_cost = this.m_xmlNode.cost;}catch(err){};
	   
	     try{ this.m_health = this.m_xmlNode.Health;}catch(err){};
		   try{ this.m_landprotected = this.m_xmlNode.LandProtected;}catch(err){};
		     try{ this.m_landhealth = this.m_xmlNode.LandHealth;}catch(err){};
			 
       try{ this.m_numOwned = parseInt(this.m_xmlNode.num_owned);}catch(err){};
	    try{ this.m_landname = this.m_xmlNode.LandName;}catch(err){};
		  try{ this.m_income = this.m_xmlNode.Income;}catch(err){};
    }

    Property2.prototype.getId = function(){return this.m_id;}
    Property2.prototype.getImageURL = function(){return this.m_imageURL;}
    Property2.prototype.getDetailsHTML = function(){return this.m_detailsHTML;}
    Property2.prototype.getCost = function(){return this.m_cost;}
    Property2.prototype.getNumOwned = function(){return this.m_numOwned;}
	Property2.prototype.getIncome = function(){return this.m_income;}
	Property2.prototype.getLandProtected = function(){return this.m_landprotected;}
	Property2.prototype.getLandHealth = function(){return this.m_landhealth;}
	Property2.prototype.getHealth = function(){return this.m_health;}
	Property2.prototype.getLandName = function(){return this.m_landname;}
// end Property


// CityListDiv
    function CityListDiv(a_parentDiv){
        this.m_parentDiv = a_parentDiv;
        this.m_containerDiv = undefined;
        this.m_titleDiv = undefined;
        this.m_resultDiv = undefined;

        this.m_tableDiv = undefined;
        this.m_landList = undefined;
        this.m_establishmentList = undefined;


        this.m_undevelopedLandTitle = undefined;
        this.m_establishmentsTitle = undefined;
		
		this.m_ResidentialTitle = undefined;
		this.m_MilitaryTitle = undefined;
		
	//	this.m_MilitaryTitle = undefined;
		
        this.m_explanationText = undefined;
        this.m_cashFlowText = "Cash Flow";

        this.initialize();
        this.createDiv(this.m_parentDiv);
    }


    CityListDiv.prototype.initialize = function(){                
      
		
		 this.m_undevelopedLandTitle = "Undeveloped";
		 this.m_IndustrialLandTitle = "Industrial";
		   this.m_ResidentialLandTitle = "Residential";
        this.m_CommercialsTitle = "Commercial";
		this.m_MilitaryTitle = "Military";
		// Military, 
		
        this.m_explanationText = "Buy up new territory to earn hourly income! First, purchase undeveloped land, then build on your land to earn even more. Once developed, a unit of land will be converted permanently to the establishment you build on it. Need more cash? <a class='standardLink' href='#' onclick='switchTabs(1);return false;'>Complete some Jobs</a>.";
    }

    CityListDiv.prototype.createTitle = function(a_optionTitles, a_optionCallbacks){
        createTitleDiv(this.m_titleDiv, "Your Real Estate: <span style='font-size:14px'> (Income <span style='color:#00FF00'>$"+formatNumberWithCommas(GBL.MAIN_DATA.getViewer().getIncome())+"</span>, Upkeep From Equipment: <span style='color:#FF0000'>$"+formatNumberWithCommas(GBL.MAIN_DATA.getViewer().getUpkeep())+"</span> ) </span>", a_optionTitles, a_optionCallbacks, false);
    }


    CityListDiv.prototype.createDiv = function(_a_parentDiv){
        //outputDebug("createDiv");

        this.m_parentDiv = _a_parentDiv;

        this.m_containerDiv = document.createElement("div");
        this. m_parentDiv.appendChild(this.m_containerDiv);
        this. m_containerDiv.style.padding = "15px";
        this. m_containerDiv.style.textAlign = "center";

        this.m_titleDiv = document.createElement("div");
        this.m_containerDiv.appendChild(this.m_titleDiv);
        this.createTitle();

        var l_noteDiv = createWhiteDiv(this.m_containerDiv);
        l_noteDiv.style.padding = "5px";
        l_noteDiv.innerHTML = this.m_explanationText;

        this.m_resultDiv = new ResultDiv(this.m_containerDiv);

        this.m_tableDiv = document.createElement("div");
        this.m_containerDiv.appendChild(this.m_tableDiv);
        this.m_tableDiv.style.textAlign = "center";

        this.refresh();
    }



    CityListDiv.prototype.refresh = function(){
        //outputDebug("refresh");

        this.m_tableDiv.innerHTML = "";

        var l_self = this;

        this.m_landList = new PropertyListDiv(this.m_tableDiv, this.m_undevelopedLandTitle,  function(a_buyId, a_amount){l_self.doBuy(a_buyId, a_amount);},
                                                                                    function(a_sellId, a_amount){l_self.doSell(a_sellId, a_amount);});
																					
        this.m_ResidentialList = new PropertyListDiv(this.m_tableDiv, this.m_ResidentialLandTitle,   function(a_buyId, a_amount){l_self.doBuy(a_buyId, a_amount);},
                                                                                            function(a_sellId, a_amount){l_self.doSell(a_sellId, a_amount);});

this.m_IndustrialList = new PropertyListDiv(this.m_tableDiv, this.m_IndustrialLandTitle,   function(a_buyId, a_amount){l_self.doBuy(a_buyId, a_amount);},
                                                                                            function(a_sellId, a_amount){l_self.doSell(a_sellId, a_amount);});
        this.m_CommercialsList = new PropertyListDiv(this.m_tableDiv, this.m_CommercialsTitle,   function(a_buyId, a_amount){l_self.doBuy(a_buyId, a_amount);},
                                                                                            function(a_sellId, a_amount){l_self.doSell(a_sellId, a_amount);});
																							
	        this.m_MilitaryList = new PropertyListDiv(this.m_tableDiv, this.m_MilitaryTitle,   function(a_buyId, a_amount){l_self.doBuy(a_buyId, a_amount);},
                                                                                            function(a_sellId, a_amount){l_self.doSell(a_sellId, a_amount);});																						
/*
        var l_params = {};
        l_params.NetworkID = GBL.MAIN_DATA.getViewer().getUserId();
		l_params.NetworkType = "2"; 
        var l_self = this;*/
		
       var l_params = {};
	   
        l_params.aNID = GBL.MAIN_DATA.getViewer().getUserId();
	l_params.aT = "2";
	l_params.lT = "1";
	l_params.f = "JGetLand";
       /*
        	l_params.f = "JGetTopPlayers3";
        var l_self = this;
	// http://crime.servegame.com/JSonService.aspx?f=JGetTopPlayers3&Page=2
	// 
        makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx", function(a_responseData){l_self.onGetMadeMen(a_responseData);}, l_params);
   
       */
    //    makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/get_fight_list", function(a_responseData){
	makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx", function(a_responseData){
   
           l_self.onGetCityList2(a_responseData);
        },l_params);
    }

CityListDiv.prototype.onGetCityList2 = function(a_responseData){
        //outputDebug("onGetCityList2");
jsonS = parseJSON2(a_responseData.text);//.parseJSON();
        //var l_xmlDoc = getGadgetResponseData(a_responseData);
      //  if((jsonS)){
       //     try{

                var l_updatePeriod = jsonS.outer.xml.update_period;
                var l_minutesToUpdate = jsonS.outer.xml.minutes_to_update;

                var l_optionTitles = new Array();
                l_optionTitles.push(this.m_cashFlowText + ":<span style='color:#00FF00'>$" + formatNumberWithCommas(GBL.MAIN_DATA.getViewer().getIncome() - GBL.MAIN_DATA.getViewer().getUpkeep()) + "</span> every " + l_updatePeriod + " minutes. Next paid in: " + l_minutesToUpdate + " minutes");
                var l_optionCallbacks = new Array();
                l_optionCallbacks.push(undefined);
                this.createTitle(l_optionTitles, l_optionCallbacks);



              //  var l_landsNode = getXMLFirstNode(l_xmlDoc, "undeveloped_lands");
             //   var l_landNodes = jsonS.outer.xml.undeveloped_lands.land;
			 if(jsonS.outer.xml.undeveloped_lands.length > 0)
			 {
                for(var l_index = 0; l_index < jsonS.outer.xml.undeveloped_lands.length; l_index++){
                    this.m_landList.addProperty(new Property2(jsonS.outer.xml.undeveloped_lands[l_index].land));
                }
			}
		else if(jsonS.outer.xml.undeveloped_lands.land)
		{
				 this.m_landList.addProperty(new Property2(jsonS.outer.xml.undeveloped_lands.land));
		}
		
                //var l_establishmentsNode = getXMLFirstNode(l_xmlDoc, "Residential_lands");
             //   var l_establishmentNodes = l_establishmentsNode.getElementsByTagName("land");
			 if(jsonS.outer.xml.Residential_lands.length > 0)
			 {
                for(var l_index = 0; l_index < jsonS.outer.xml.Residential_lands.length; l_index++){
                    this.m_ResidentialList.addProperty(new Property2(jsonS.outer.xml.Residential_lands[l_index].land));
                }
				}
				else if(jsonS.outer.xml.Residential_lands.land)
				{
				 this.m_ResidentialList.addProperty(new Property2(jsonS.outer.xml.Residential_lands.land));
				}
				// Industrial
				
		     //           var l_establishmentsNode = getXMLFirstNode(l_xmlDoc, "Industrial_lands");
              // var l_establishmentNodes = l_establishmentsNode.getElementsByTagName("land");
			  if(jsonS.outer.xml.Industrial_lands.length)
			  {
                for(var l_index = 0; l_index < jsonS.outer.xml.Industrial_lands.length; l_index++){
                    this.m_IndustrialList.addProperty(new Property2(jsonS.outer.xml.Industrial_lands[l_index].land));
                }		
				}
				else if(jsonS.outer.xml.Industrial_lands.land)
				{
				 this.m_IndustrialList.addProperty(new Property2(jsonS.outer.xml.Industrial_lands.land));
				
				
				}
				
			//	var l_establishmentsNode = getXMLFirstNode(l_xmlDoc, "Commercial_lands");
             //   var l_establishmentNodes = l_establishmentsNode.getElementsByTagName("land");
			 if( jsonS.outer.xml.Commercial_lands.length)
			 {
                for(var l_index = 0; l_index < jsonS.outer.xml.Commercial_lands.length; l_index++){
                    this.m_CommercialsList.addProperty(new Property2(jsonS.outer.xml.Commercial_lands[l_index].land));
                }
				}
				else if( jsonS.outer.xml.Commercial_lands.land)
				{
				 this.m_CommercialsList.addProperty(new Property2(jsonS.outer.xml.Commercial_lands.land));
				
				}
				
				//var l_establishmentsNode = getXMLFirstNode(l_xmlDoc, "Military_lands");
               // var l_establishmentNodes = l_establishmentsNode.getElementsByTagName("land");
			   
			   if(jsonS.outer.xml.Military_lands.length)
			   {
                for(var l_index = 0; l_index < jsonS.outer.xml.Military_lands.length; l_index++){
                    this.m_MilitaryList.addProperty(new Property2(jsonS.outer.xml.Military_lands[l_index].land));
                }
}
else if(jsonS.outer.xml.Military_lands.land)
{

 this.m_MilitaryList.addProperty(new Property2(jsonS.outer.xml.Military_lands.land));
}
                //var l_nextLevel = getXMLNodeValue(l_xmlDoc, "next_level");
                if((jsonS.outer.xml.next_level)){
                    var l_moreDiv = document.createElement("div");
                    this.m_tableDiv.appendChild(l_moreDiv);
                    l_moreDiv.style.padding = "10px";
                    l_moreDiv.innerHTML = "<span style='color:#00FF00; font-weight:bold; font-size:26px;'> Unlock more Real Estate when you reach level " + jsonS.outer.xml.next_level + " ...";
               }

          //  } catch (err) { outputAlert("onGetCityList " + err);}
        
   // }
	
	
}
	
	
    CityListDiv.prototype.onGetCityList = function(a_responseData){
        //outputDebug("onGetCityList");

        var l_xmlDoc = getGadgetResponseData(a_responseData);
        if(isValid(l_xmlDoc)){
            try{

                var l_updatePeriod = getXMLNodeValue(l_xmlDoc, "update_period");
                var l_minutesToUpdate = getXMLNodeValue(l_xmlDoc, "minutes_to_update");

                var l_optionTitles = new Array();
                l_optionTitles.push(this.m_cashFlowText + ":<span style='color:#00FF00'>$" + formatNumberWithCommas(GBL.MAIN_DATA.getViewer().getIncome() - GBL.MAIN_DATA.getViewer().getUpkeep()) + "</span> every " + l_updatePeriod + " minutes. Next paid in: " + l_minutesToUpdate + " minutes");
                var l_optionCallbacks = new Array();
                l_optionCallbacks.push(undefined);
                this.createTitle(l_optionTitles, l_optionCallbacks);



                var l_landsNode = getXMLFirstNode(l_xmlDoc, "undeveloped_lands");
                var l_landNodes = l_landsNode.getElementsByTagName("land");
                for(var l_index = 0; l_index < l_landNodes.length; l_index++){
                    this.m_landList.addProperty(new Property(l_landNodes[l_index]));
                }

                var l_establishmentsNode = getXMLFirstNode(l_xmlDoc, "Residential_lands");
                var l_establishmentNodes = l_establishmentsNode.getElementsByTagName("land");
                for(var l_index = 0; l_index < l_establishmentNodes.length; l_index++){
                    this.m_ResidentialList.addProperty(new Property(l_establishmentNodes[l_index]));
                }
				// Industrial
				
		                var l_establishmentsNode = getXMLFirstNode(l_xmlDoc, "Industrial_lands");
                var l_establishmentNodes = l_establishmentsNode.getElementsByTagName("land");
                for(var l_index = 0; l_index < l_establishmentNodes.length; l_index++){
                    this.m_IndustrialList.addProperty(new Property(l_establishmentNodes[l_index]));
                }		
				
				
				var l_establishmentsNode = getXMLFirstNode(l_xmlDoc, "Commercial_lands");
                var l_establishmentNodes = l_establishmentsNode.getElementsByTagName("land");
                for(var l_index = 0; l_index < l_establishmentNodes.length; l_index++){
                    this.m_CommercialsList.addProperty(new Property(l_establishmentNodes[l_index]));
                }
				
				
				var l_establishmentsNode = getXMLFirstNode(l_xmlDoc, "Military_lands");
                var l_establishmentNodes = l_establishmentsNode.getElementsByTagName("land");
                for(var l_index = 0; l_index < l_establishmentNodes.length; l_index++){
                    this.m_MilitaryList.addProperty(new Property(l_establishmentNodes[l_index]));
                }

                var l_nextLevel = getXMLNodeValue(l_xmlDoc, "next_level");
                if(isValid(l_nextLevel)){
                    var l_moreDiv = document.createElement("div");
                    this.m_tableDiv.appendChild(l_moreDiv);
                    l_moreDiv.style.padding = "10px";
                    l_moreDiv.innerHTML = "<span style='color:#00FF00; font-weight:bold; font-size:26px;'> Unlock more Real Estate when you reach level " + l_nextLevel + " ...";
                }

            } catch (err) { outputAlert("onGetCityList " + err);}
        }
    }
	//DoProtect , DoRepair
CityListDiv.prototype.DoRepair = function(LandID,LandName)
{
this.m_resultDiv.showMessage(undefined, "Repairing ... " + LandName);
   var l_params = {};
       l_params.anid = GBL.MAIN_DATA.getViewer().getUserId();
	    l_params.at = "2";
		 l_params.lid = LandID;
    //   l_params.it = a_buyId;
	   
    //   l_params.count = a_amount;    
	   	l_params.f = "JRepairLand";

        var l_self = this;
        makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx",
                        function(a_response){handleResultJSON(a_response, l_self.m_resultDiv, function(){
						//l_self.refresh();
						ID('healinfo_'+LandID).innerHTML = "<b>Health:100/100</b>";
							HideDiv('repair_'+LandID); 
						})},
                        l_params, 0);

}
CityListDiv.prototype.DoProtect = function(LandID,LandName)
{
this.m_resultDiv.showMessage(undefined, "Protecting ... " + LandName);
   var l_params = {};
       l_params.anid = GBL.MAIN_DATA.getViewer().getUserId();
	    l_params.at = "2";
		  l_params.lid = LandID;
    //   l_params.it = a_buyId;
	   
    //   l_params.count = a_amount;    
	   	l_params.f = "JProtectLand"; 

        var l_self = this;
        makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx",
                        function(a_response){handleResultJSON(a_response, l_self.m_resultDiv, function(){
						
						//l_self.refresh();
						ID('repairinfo_'+LandID).innerHTML = "<b>Protected:100/100</b>";
						HideDiv('protect_'+LandID);
						
						})},
                        l_params, 0);

}


    CityListDiv.prototype.doBuy = function(a_buyId, a_amount){
        this.m_resultDiv.showMessage(undefined, "Buying ... ");
        goToPageTop();

        var l_params = {};
       l_params.anid = GBL.MAIN_DATA.getViewer().getUserId();
	    l_params.at = "2";
		 l_params.iat = "5";
       l_params.it = a_buyId;
	   
       l_params.count = a_amount;    
	   	l_params.f = "JBuyItem";

        var l_self = this;
        makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx",
                        function(a_response){handleResultJSON(a_response, l_self.m_resultDiv, function(){l_self.refresh();})},
                        l_params, 0);
    }

    CityListDiv.prototype.doSell = function(a_sellId, a_amount){
       this.m_resultDiv.showMessage(undefined, "Selling ... ");
       goToPageTop();

       var l_params = {};
       l_params.anid = GBL.MAIN_DATA.getViewer().getUserId();
	    l_params.at = "2";
		 l_params.iat = "5";
       l_params.it = a_sellId;
	   
       l_params.count = -a_amount;
	   	l_params.f = "JBuyItem";
/*
      var l_params = {};
	   
        l_params.aNID = GBL.MAIN_DATA.getViewer().getUserId();
	l_params.aT = "2";
	l_params.lT = "1";
	l_params.f = "JBuyItem";
       /*
        	l_params.f = "JGetTopPlayers3";
        var l_self = this;
	// http://crime.servegame.com/JSonService.aspx?f=JGetTopPlayers3&Page=2
	// 
        makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx", function(a_responseData){l_self.onGetMadeMen(a_responseData);}, l_params);
   
      
    //    makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/get_fight_list", function(a_responseData){
	makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx"
*/
       var l_self = this;
       makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx",
                        function(a_response){handleResultJSON(a_response, l_self.m_resultDiv, function(){l_self.refresh();})},
                        l_params, 0);

    }

// end CityListDiv





function PropertyListDiv(a_parentDiv, a_typeName, a_buyCallback, a_sellCallback){

    var m_parentDiv = a_parentDiv;
    var m_containerDiv = undefined;
    var m_typeName = a_typeName;
    var m_loadingDiv = undefined;
    var m_contentTBody = undefined;
    var m_buyCallback = a_buyCallback;
    var m_sellCallback = a_sellCallback;


    this.addProperty = addProperty;


    if(m_parentDiv != undefined){
         createDiv(m_parentDiv);
    }

    function createDiv(_a_parentDiv){
        //outputDebug("createDiv");

        m_parentDiv = _a_parentDiv;

        m_containerDiv = document.createElement("div");
        m_parentDiv.appendChild(m_containerDiv);
        m_containerDiv.style.padding = "15px";
        m_containerDiv.style.textAlign = "center";

        var l_contentTable = document.createElement("table");
        m_containerDiv.appendChild(l_contentTable);
        l_contentTable.style.marginLeft = "auto";
        l_contentTable.style.marginRight = "auto";
        l_contentTable.style.marginTop = "5px";
        l_contentTable.style.cellSpacing = "0px";
        l_contentTable.style.borderCollapse = "collapse";
        m_contentTBody = document.createElement("tbody");
        l_contentTable.appendChild(m_contentTBody);

        var l_headerTR = document.createElement("tr");
        m_contentTBody.appendChild(l_headerTR);

        var l_td = document.createElement("td");
        l_headerTR.appendChild(l_td);
        addHeaderStyleWithInnerDiv(l_td, m_typeName, "500px");        

        l_td = document.createElement("td");
        l_headerTR.appendChild(l_td);
        addHeaderStyleWithInnerDiv(l_td, "Buy / Sell", "300px");        

        m_loadingDiv = document.createElement("div");
        m_containerDiv.appendChild(m_loadingDiv);
        m_loadingDiv.style.padding = "10px";
        m_loadingDiv.innerHTML = "<span style='color:#FF6F00; font-weight:bold;'> Loading ...  </span>";
    }   


    function addProperty(a_property){
        //outputDebug("addProperty");

        m_loadingDiv.style.display = "none";


        var l_tr = document.createElement("tr");

        var l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.padding = "5px 10px 5px 10px";
        l_td.style.textAlign = "left";
        l_td.style.borderBottom = "solid 1px #505050";
	
		

        var l_descriptionSSCells = new SideBySideCells(l_td, false); 
       // l_descriptionSSCells.getLeftCell().innerHTML = "<img style='margin-left:auto; margin-right:auto;' src='"+a_property.getImageURL()+"'/><BR>Health:"+a_property.getHealth()+"/100<BR>Protected:"+a_property.getLandProtected()+"/100";
        
	   var l_default = document.createElement('div');
	   l_default.innerHTML = "<img style='margin-left:auto; margin-right:auto;' src='"+a_property.getImageURL()+"'/>"; 
	   var l_heal = document.createElement('div');
	   var l_repair = document.createElement('div');
	   l_heal.id ="healinfo_"+a_property.getId();
	   
	   
	   l_repair.id ="repairinfo_"+a_property.getId();
	   
	  
	  
	   l_descriptionSSCells.getLeftCell().appendChild(l_default);
	   
	  l_descriptionSSCells.getLeftCell().appendChild(l_heal);
	    
if(parseInt(a_property.getNumOwned()) > 0)
{
l_heal.innerHTML = "<b>Health:"+a_property.getHealth()+"/100</b>";
	  if(a_property.getLandProtected()!=100)
	   {
	
	   
	     var LandRepairHealth = 100 -parseInt(a_property.getHealth());
	   
	   var CostRepair = (parseInt(a_property.getIncome())*parseInt(a_property.getNumOwned())*LandRepairHealth)/40;
	   
	    l_repair.innerHTML = "<font style='font-size:8px color:#00FF00 font-weight:bold;'>Protection:"+a_property.getLandProtected()+"</font><font style='font-size:8px color:#FFFFFF font-weight:bold;'>/100</font><BR><font style='font-size:8px color:#00FF00 font-weight:bold;'>Protect for "+formatNumberWithCommas(CostRepair.toString())+"</font>";
	   
	     DivButtonIMG3(l_descriptionSSCells.getLeftCell(), "protect", function(){
		 GBL.REALESTATE.DoProtect(a_property.getId(),a_property.getLandName());
		 
		 	
		 
		 
		 
		 }, undefined, undefined,a_property.getId());
	   
	   }

	  if(a_property.getHealth()!= 100)
	   {
	   
	   
	   
	   
	   var LandHealHealth = 100 -parseInt(a_property.getHealth());
	   
	   var CostHeal = (parseInt(a_property.getIncome())*parseInt(a_property.getNumOwned())*LandHealHealth)/20;
	   // @TotalRepairCost =  (@UserLandIncome * @UserLandNumber*@LandRepairHealth)/200;
	   
	   l_heal.innerHTML = "<font style=\"font-size:8px color:#00FF00 font-weight:bold;\">Health:"+a_property.getHealth()+"</font><font style='font-size:8px color:#FFFFFF font-weight:bold;'>/100</font><BR><font style='font-size:8px color:#00FF00 font-weight:bold;'>Repair for "+formatNumberWithCommas(CostHeal.toString())+"</font>";
	   
	    DivButtonIMG3(l_descriptionSSCells.getLeftCell(), "repair", function(){
		 GBL.REALESTATE.DoRepair(a_property.getId(),a_property.getLandName());
		  //DoProtect , DoRepair
		
		}, undefined, undefined,a_property.getId());
	   //l_descriptionSSCells.getLeftCell().innerHTML += 
	   }
	   
	   l_descriptionSSCells.getLeftCell().appendChild(l_repair); 
	   
	      l_repair.innerHTML = "<b>Protected:"+a_property.getLandProtected()+"/100</b>";
		  
	   
	   
}
	   l_descriptionSSCells.getRightCell().style.paddingLeft = "10px";
        l_descriptionSSCells.getRightCell().style.verticalAlign = "top";
        l_descriptionSSCells.getRightCell().innerHTML = a_property.getDetailsHTML();


/*
Property2.prototype.getLandProtected = function(){return this.m_landprotected;}
	Property2.prototype.getLandHealth = function(){return this.m_landhealth;}
	Property2.prototype.getHealth = function(){return this.Health;}
*/
        l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.padding = "5px 10px 5px 10px";
        l_td.style.borderBottom = "solid 1px #505050";
        

        var l_actionSSCells = new SideBySideCells(l_td, false);
        l_actionSSCells.getLeftCell().style.width = "110px";
        l_actionSSCells.getLeftCell().innerHTML = "<span style='font-size:18px; color:#00FF00;'> $" + formatNumberWithCommas(a_property.getCost())+"</span>";
        if(a_property.getNumOwned() > 0){
            l_actionSSCells.getRightCell().innerHTML = "<span style='font-size:14px;color:#FFFFFF; font-weight:bold;'> Owned: " + a_property.getNumOwned()+"</span>";
        } 


        var l_ssCells = new SideBySideCells(l_td, false);
        var l_buyCell = l_ssCells.getLeftCell();
        new NumberSelectActionDiv(l_buyCell, 25, "Buy", function(a_numToBuy){
            m_buyCallback(a_property.getId(), a_numToBuy);
        });


        if(a_property.getNumOwned() > 0){
            var l_sellCell = l_ssCells.getRightCell();
            new NumberSelectActionDiv(l_sellCell, 25, "Sell", function(a_numToSell){
                m_sellCallback(a_property.getId(), a_numToSell);
            }, "#656565");
        }


        m_contentTBody.appendChild(l_tr);
    }
}


// BankDiv
    function BankDiv(a_parentDiv){

        this.m_parentDiv = a_parentDiv;
        this.m_containerDiv = undefined;
        this.m_titleDiv = undefined;
        this.m_resultDiv = undefined;
        this.m_tableDiv = undefined;

        this.m_bankName = undefined;
        this.m_depositTaxExplanation = undefined;

        this.initialize();
        this.createDiv();
    }

    BankDiv.prototype.initialize = function(){
        this.m_bankName = "Bank";
        this.m_depositTaxExplanation = "A 10% money laundering fee will be taken out of all incoming funds.";
    }


    BankDiv.prototype.createDiv = function(){

        this.m_containerDiv = document.createElement("div");
        this.m_parentDiv.appendChild(this.m_containerDiv);
        this.m_containerDiv.style.padding = "15px";
        this.m_containerDiv.style.textAlign = "center";

        this.m_titleDiv = document.createElement("div");
        this.m_containerDiv.appendChild(this.m_titleDiv);

        this.m_resultDiv = new ResultDiv(this.m_containerDiv);

        this.m_tableDiv = document.createElement("div");
        this.m_containerDiv.appendChild(this.m_tableDiv);
        this.m_tableDiv.style.textAlign = "center";

        this.refresh();
    }


    BankDiv.prototype.refresh = function(){
        this.m_tableDiv.innerHTML = "";
        if(!isValid(GBL.MAIN_DATA.getViewer().getCashInBank()) || GBL.MAIN_DATA.getViewer().getCashInBank() <= 0){
            this.createOpenAccountInterface();
        } else {
            this.createAccountInterface();
        }
    }

    BankDiv.prototype.createOpenAccountInterface = function(){
        createTitleDiv(this.m_titleDiv, "The "+this.m_bankName+" (Open an Account)");

        if(GBL.MAIN_DATA.getViewer().getCashInBank() <= 0 && GBL.MAIN_DATA.getViewer().getCash() < 10000){
            this.m_resultDiv.showMessage(undefined, "Sorry, you need at least $10,000 to open an account!");
            return;
        }

        var l_contentTable = document.createElement("table");
        this.m_tableDiv.appendChild(l_contentTable);
        l_contentTable.style.marginLeft = "auto";
        l_contentTable.style.marginRight = "auto";
        l_contentTable.style.borderSpacing = "6px";
        var l_contentTBody = document.createElement("tbody");
        l_contentTable.appendChild(l_contentTBody);

        var l_tr = document.createElement("tr");
        l_contentTBody.appendChild(l_tr);

        var l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.color = "#FFFFFF";
        l_td.innerHTML = "Open an account with: ";


        l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        var l_amountField = undefined;
        try{
            l_amountField = document.createElement("<input type='text'/>");    // IE
        }catch(error){
            l_amountField = document.createElement("input");    // firefox
            l_amountField.type = "text";
        }
        l_amountField.value = GBL.MAIN_DATA.getViewer().getCash();
        l_td.appendChild(l_amountField);

        l_td = document.createElement("td");
        l_tr.appendChild(l_td);

        var l_self = this;
        new DivButton(l_td, "Open Account", function(){
            if(!validateAmount(l_amountField.value)){
                l_self.m_resultDiv.showMessage(undefined, "Please specify a valid amount to open your account with!");
                return;
            }
            try{
                if(parseInt(l_amountField.value) < 10000){
                    l_self.m_resultDiv.showMessage(false, "Sorry, you need at least $10,000 to open an account!");
                    return;
                }
            }catch(err){}



            var l_params = {};
            l_params.NetworkID = GBL.MAIN_DATA.getViewer().getUserId();
			l_params.NetworkType = "2";
            l_params.amount = l_amountField.value;
			
            makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/DepositBank",
                    function(a_response){handleResult(a_response, l_self.m_resultDiv, function(){l_self.refresh()})},
                    l_params, 0);
        });
    }



    BankDiv.prototype.createAccountInterface = function(){
        createTitleDiv(this.m_titleDiv, "The "+this.m_bankName+" (Account Balance: $" + formatNumberWithCommas(GBL.MAIN_DATA.getViewer().getCashInBank()) + ")");

        var l_contentTable = document.createElement("table");
        this.m_tableDiv.appendChild(l_contentTable);
        l_contentTable.style.marginLeft = "auto";
        l_contentTable.style.marginRight = "auto";
        l_contentTable.style.borderSpacing = "6px";
        var l_contentTBody = document.createElement("tbody");
        l_contentTable.appendChild(l_contentTBody);

        var l_headerTR = document.createElement("tr");
        l_contentTBody.appendChild(l_headerTR);

        var l_td = document.createElement("td");
        l_headerTR.appendChild(l_td);
        addHeaderStyle(l_td);
        l_td.style.width = "350px";
        l_td.innerHTML = "Withdraw";

        l_td = document.createElement("td");
        l_headerTR.appendChild(l_td);
        addHeaderStyle(l_td);
        l_td.style.width = "350px";
        l_td.innerHTML = "Deposit";


        // create the interface for widthdrawing and depositing
        var l_tr = document.createElement("tr");
        l_contentTBody.appendChild(l_tr);
        
        l_tr.appendChild(this.createInterfaceTd(true));
        l_tr.appendChild(this.createInterfaceTd(false));

    }

    BankDiv.prototype.createInterfaceTd = function(a_withdraw){
        var l_td = document.createElement("td");

        var l_ssCells = new SideBySideCells(l_td, true);
        if(a_withdraw){
            l_ssCells.getLeftCell().style.color = "#FFFFFF";
            l_ssCells.getLeftCell().innerHTML = "Withdrawal Amount: ";
        } else {
            l_ssCells.getLeftCell().style.color = "#FFFFFF";
            l_ssCells.getLeftCell().innerHTML = "Deposit Amount: ";
        }


        var l_amountField = undefined;
        try{
            l_amountField = document.createElement("<input type='text'/>");    // IE
        }catch(error){
            l_amountField = document.createElement("input");    // firefox
            l_amountField.type = "text";
        }
        if(a_withdraw){
            l_amountField.value = "" + Math.min(1000, GBL.MAIN_DATA.getViewer().getCashInBank());
        } else {
            l_amountField.value = GBL.MAIN_DATA.getViewer().getCash();
        }

        l_ssCells.getRightCell().appendChild(l_amountField);


        var l_button = undefined;
        var l_self = this;
        if(a_withdraw){
            l_button = new DivButton(l_td, "Withdraw", function(){
                if(!validateAmount(l_amountField.value)){
                    l_self.m_resultDiv.showMessage(undefined, "Please specify a valid amount to withdraw!");
                    return;
                }
/*            var l_params = {};
            l_params.NetworkID = GBL.MAIN_DATA.getViewer().getUserId();
			l_params.NetworkType = "2";
            l_params.amount = l_amountField.value;
			
            makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/DepositBank",*/
                var l_params = {};
                l_params.NetworkID = GBL.MAIN_DATA.getViewer().getUserId();
                l_params.NetworkType = "2";
				l_params.amount = -l_amountField.value;
                makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/DepositBank",
                        function(a_response){handleResult(a_response, l_self.m_resultDiv, function(){l_self.refresh();})},
                        l_params, 0);
            });
        } else {
             l_button = new DivButton(l_td, "Deposit", function(){
                if(!validateAmount(l_amountField.value)){
                    l_self.m_resultDiv.showMessage(undefined, "Please specify a valid amount to deposit!");
                    return;
                }

                var l_params = {};
                l_params.NetworkID = GBL.MAIN_DATA.getViewer().getUserId();
                l_params.NetworkType = "2";
				l_params.amount = l_amountField.value;
                makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/DepositBank",
                        function(a_response){handleResult(a_response, l_self.m_resultDiv, function(){l_self.refresh();})},
                        l_params, 0);
            });
        }
        l_button.getButtonDiv().style.width = "100px";


        var l_expDiv = document.createElement("div");
        l_td.appendChild(l_expDiv);
        l_expDiv.style.color = "#FFFFFF";
        l_expDiv.style.fontSize = "10px";
        if(a_withdraw){
            l_expDiv.innerHTML = "Withdrawing money to cash is free.";
        } else {
            l_expDiv.innerHTML = this.m_depositTaxExplanation;
        }


        return l_td;
    }
// end BankDiv

// GodfatherDiv 
    function GodfatherDiv(a_parentDiv){

        this.m_parentDiv = a_parentDiv;
        this.m_containerDiv = undefined;
        this.m_resultDiv = undefined;
        this.m_refreshDiv = undefined;

        this.m_explanationText = undefined;
        this.m_offerHeadingText = "Mastermind's Offer";

        this.m_offerKeys = undefined;
        this.m_offerDescriptions = undefined;
        this.m_offerCosts = undefined;

        this.m_offerpalConstructor = undefined;


        this.initialize();
        this.createDiv();
    }


    GodfatherDiv.prototype.initialize = function(){
        this.m_explanationText = "Buy offers below to earn crime points from The Crime Mastermind. In return for crime points, The Crime Mastermind will offer you various rewards such as cash, items, territory, and more crime members.*<br/><br/><font size='2'>*Crime points are NOT necessary for game play or game advancement.</font>";

        this.m_offerKeys = new Array();
        this.m_offerDescriptions = new Array();
        this.m_offerCosts = new Array();

        this.m_offerKeys.push("cash");
        this.m_offerDescriptions.push("The Mastermind offers you $" + formatNumberWithCommas(10000*GBL.MAIN_DATA.getViewer().getLevel()) + " for 10 crime points.");
        this.m_offerCosts.push(10);

 
		
        this.m_offerKeys.push("energy");
        this.m_offerDescriptions.push( "The Mastermind offers you full energy (refill) for 10 crime points.");
        this.m_offerCosts.push(10);

		     this.m_offerKeys.push("stamina");
        this.m_offerDescriptions.push( "The Mastermind offers you full stamina (refill) for 10 crime points.");
        this.m_offerCosts.push(10);
		
		     this.m_offerKeys.push("adrineline");
        this.m_offerDescriptions.push( "The Mastermind offers you 50 adrineline for 10 crime points.");
        this.m_offerCosts.push(10);
		
		       this.m_offerKeys.push("maxfriends");
        this.m_offerDescriptions.push("The Mastermind offers you 1 hired criminal professional for 20 crime points.");
        this.m_offerCosts.push(20);

		    this.m_offerKeys.push("maxfriends4");
        this.m_offerDescriptions.push("The Mastermind offers you 4 hired criminal professional for 40 crime points.");
        this.m_offerCosts.push(40);
		
		 this.m_offerKeys.push("maxfriends12");
        this.m_offerDescriptions.push("The Mastermind offers you 12 hired criminal professional for 100 crime points.");
        this.m_offerCosts.push(100);
		
		     this.m_offerKeys.push("energyrate");
        this.m_offerDescriptions.push( "The Mastermind offers you energy rate x 2 (enegry regenerates 100% faster than regular) for 150 crime points.");
        this.m_offerCosts.push(150);
		
		     this.m_offerKeys.push("staminarate");
        this.m_offerDescriptions.push( "The Mastermind offers you rate x 2 (stamina regenerates 100% faster than regular) for 150 crime points.");
        this.m_offerCosts.push(150);
		     this.m_offerKeys.push("healthrate");
        this.m_offerDescriptions.push( "The Mastermind offers you rate x 2 (health regenerates 100% faster than regular) for 150 crime points.");
        this.m_offerCosts.push(150);
		/*
		     this.m_offerKeys.push("boxes1"); 
        this.m_offerDescriptions.push( "The Mastermind offers you 1 box for 6 crime points.");
        this.m_offerCosts.push(6);
		
		    this.m_offerKeys.push("boxes4");
        this.m_offerDescriptions.push( "The Mastermind offers you 4 boxes for 12 crime points.");
        this.m_offerCosts.push(12);
		
			    this.m_offerKeys.push("boxes12");
        this.m_offerDescriptions.push( "The Mastermind offers you 12 boxes for 30 crime points.");
        this.m_offerCosts.push(30);
		*/
		
	//	     this.m_offerKeys.push("adrinelinerate");
    //    this.m_offerDescriptions.push( "The Mastermind offers you full x 2 adrineline (refillx2) for 10 crime points.");
		
      //  this.m_offerCosts.push(10);
		     this.m_offerKeys.push("skillpoints");
        this.m_offerDescriptions.push( "The Mastermind offers you 4 skill points (for upgrades) for 5 crime points.");
        this.m_offerCosts.push(5);
		/*
		     this.m_offerKeys.push("name");
        this.m_offerDescriptions.push( "The Mastermind offers you new name for 15 crime points.");
        this.m_offerCosts.push(15);
		*/
		
        this.m_offerpalConstructor = OfferPalDiv;
    }
/*
 * <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="gchipunov@hotmail.com">
<input type="hidden" name="item_name" value="name">
<input type="hidden" name="item_number" value="1111">
<input type="hidden" name="amount" value="8.00">
<input type="hidden" name="no_shipping" value="0">
<input type="hidden" name="return" value="http://www.bigideastech.com/SomeWebService">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="bn" value="PP-BuyNowBF">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
 */
    GodfatherDiv.prototype.createTitle = function(a_title){
      //  var l_snuid = GBL.MAIN_DATA.getViewer().getUserId() * 3 + 1;
	  var l_snuid = GBL.MAIN_DATA.getViewer().getUserId();
	  
        var l_offerPalCS = "<span onclick='window.open(\"http://pub.myofferpal.com/899ebfd8df18fc72bddfc59d6915dd8e/userstatus.action?snuid="+l_snuid+"\"); return false;' style='text-decoration:underline; cursor:pointer; font-size:13px; color:#EEEEEE;'> Missing Crime Points, click here! </span>";
        createTitleDiv(a_title, "The Mastermind: <span style='font-size:14px; color:#D9D919;'>(You have " + GBL.MAIN_DATA.getViewer().getFavorPoints() + " favor points) </span>  "+  l_offerPalCS );
    }

    GodfatherDiv.prototype.getButtonText = function(a_numPoints){
        return "Accept for " + a_numPoints + " points!";        
    }


    GodfatherDiv.prototype.createDiv = function(){

        this.m_containerDiv = document.createElement("div");
        this.m_parentDiv.appendChild(this.m_containerDiv);
        this.m_containerDiv.style.padding = "15px";
        this.m_containerDiv.style.textAlign = "center";

			
var l_frameDiv = document.createElement("div");
        this.m_containerDiv.appendChild(l_frameDiv);
		//l_frameDiv.innerHTML = "<iframe style='width:650px; height: 500px; margin-left:auto; margin-right:auto; overflow:auto; border:none;' src='http://www.laasex.com/crime/iframepaypal.aspx?NetworkID="+ GBL.MAIN_DATA.getViewer().getUserId() +"'>";
		
		
        var l_title = document.createElement("div");
        this.m_containerDiv.appendChild(l_title);
        this.createTitle(l_title);

        var l_noteDiv = createWhiteDiv(this.m_containerDiv);
        l_noteDiv.style.padding = "8px";
        l_noteDiv.innerHTML = this.m_explanationText; 

        this.m_resultDiv = new ResultDiv(this.m_containerDiv);

        this.m_refreshDiv = document.createElement("div");
        this.m_containerDiv.appendChild(this.m_refreshDiv);
        this.m_refreshDiv.style.textAlign = "center";


        new this.m_offerpalConstructor(this.m_containerDiv);

        this.refresh();
    }

    GodfatherDiv.prototype.refresh = function(){
        //outputDebug("refresh");

        this.m_refreshDiv.innerHTML = "";

        var l_contentTable = document.createElement("table");
        this.m_refreshDiv.appendChild(l_contentTable);
        l_contentTable.style.marginLeft = "auto";
        l_contentTable.style.marginRight = "auto";
        l_contentTable.style.borderSpacing = "6px";
        var l_contentTBody = document.createElement("tbody");
        l_contentTable.appendChild(l_contentTBody);

        var l_headerTR = document.createElement("tr");
        l_contentTBody.appendChild(l_headerTR);

        var l_td = document.createElement("td");
        l_headerTR.appendChild(l_td);
        addHeaderStyle(l_td);
        l_td.style.width = "600px";
        l_td.innerHTML = this.m_offerHeadingText;

        l_td = document.createElement("td");
        l_headerTR.appendChild(l_td);
        addHeaderStyle(l_td);
        l_td.style.width = "200px";
        l_td.innerHTML = "Accept";        

        for(var l_index = 0; l_index < this.m_offerKeys.length; l_index++){
            l_contentTBody.appendChild(this.createContentElement(this.m_offerKeys[l_index], this.m_offerDescriptions[l_index], this.m_offerCosts[l_index]));
        }
    }


    GodfatherDiv.prototype.createContentElement = function(a_offerStr, a_offerDescription, a_offerCost){

        var l_tr = document.createElement("tr");

        var l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.padding = "5px 10px 5px 10px";
        l_td.style.color = "#FFFFFF";
        l_td.innerHTML = a_offerDescription;


        l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.padding = "5px 10px 5px 10px";

        var l_self = this;
//  <img src='http://www.laasex.com/crime/images/UI/buttons/U2.png'>
/*
 new DivImageButton(l_buttonDiv, this.m_healPrefix + " $" + formatNumberWithCommas(l_cost),"h", function(){
            l_self.m_resultDiv.showMessage(undefined, l_self.m_healProcessText + " ... ");

            var l_params = {};
            l_params.NetworkID = GBL.MAIN_DATA.getViewer().getUserId();
			l_params.NetworkType = "2";
       //     l_params.level = GBL.MAIN_DATA.getViewer().getLevel();
			
            makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/HealSelf",
                function(a_response){handleResult(a_response, l_self.m_resultDiv, function(){l_self.refresh();})},
                l_params, 0);
        });
*/
        new DivButton(l_td, this.getButtonText(a_offerCost), function(){
            l_self.m_resultDiv.showMessage(undefined, "Buying.....");
			
			
			    var l_params = {};
        l_params.aNID = GBL.MAIN_DATA.getViewer().getUserId();
	l_params.aT = "2";
	l_params.reward = a_offerStr;
	l_params.f = "JAcceptMasterMind";
       /*
        	l_params.f = "JGetTopPlayers3";
        var l_self = this; 
	// http://crime.servegame.com/JSonService.aspx?f=JGetTopPlayers3&Page=2
	// 
        makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx", function(a_responseData){l_self.onGetMadeMen(a_responseData);}, l_params);
   
       */
    //    makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/get_fight_list", function(a_responseData){ 
	makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx", function(a_response){handleResultJSON(a_response, l_self.m_resultDiv, function(){l_self.refresh();})},
                    l_params, 0);
/*
            var l_params = {};
            l_params.NetworkID = GBL.MAIN_DATA.getViewer().getUserId();
			l_params.NetworkType = "2";
			
            l_params.reward = a_offerStr;
			
			
            makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/AcceptMasterMind",
                    function(a_response){handleResult(a_response, l_self.m_resultDiv, function(){l_self.refresh();})},
                    l_params, 0);
					*/
        });

        return l_tr;
    }
// End GodfatherDiv





// OfferPalDiv
    function OfferPalDiv(a_parentDiv){

        this.m_parentDiv = a_parentDiv;
        this.m_containerDiv = undefined;
        this.m_explanationText = undefined;
        this.m_titleText = "Buy Crime Points";

        this.m_offerPalLink = undefined;

        this.initialize();
        this.createDiv();
    }

    OfferPalDiv.prototype.initialize = function(){
     //   var l_snuid = GBL.MAIN_DATA.getViewer().getUserId() * 3 + 1;
	    var l_snuid = GBL.MAIN_DATA.getViewer().getUserId();
		
       var l_offerPalCS = "<span onclick='window.open(\"http://pub.myofferpal.com/899ebfd8df18fc72bddfc59d6915dd8e/userstatus.action?snuid="+l_snuid+"\"); return false;' style='text-decoration:underline; cursor:pointer; font-size:12px; color:#EEEEEE;'> If you have missing favor points, click here! </span>";
        this.m_explanationText = "Earn Crime points and help sponsor this application by completing offers! <br> "  ;
        this.m_offerPalLink = "http://pub.myofferpal.com/899ebfd8df18fc72bddfc59d6915dd8e/showoffers.action?";
    }

    OfferPalDiv.prototype.createDiv = function(){

        this.m_containerDiv = document.createElement("div");
        this.m_parentDiv.appendChild(this.m_containerDiv);
		
        this.m_containerDiv.style.textAlign = "center";
        this.m_containerDiv.style.paddingTop = "15px";

        var l_titleDiv = document.createElement("div");
        this.m_containerDiv.appendChild(l_titleDiv);
        createTitleDiv(l_titleDiv, this.m_titleText);
	

        var l_noteDiv = createWhiteDiv(this.m_containerDiv);
        l_noteDiv.style.padding = "8px";
        l_noteDiv.innerHTML = this.m_explanationText;

        var l_user = GBL.MAIN_DATA.getViewer();
        var l_srcUrl = this.m_offerPalLink;
       l_srcUrl += "snuid=" + (l_user.getUserId());

        if(isValid(l_user.getAge())){
            var l_age = undefined;
            try{l_age = parseInt(l_user.getAge());}catch (err){ l_age = undefined;}
            if(isValid(l_age)){
               l_srcUrl += "&dob=01-Jan-"+(2008-l_age);
            }
        }

        if(isValid(l_user.getGender())){
            l_srcUrl += "&gender="+l_user.getGender();
        }

        
		        var l_frameDiv2 = document.createElement("div");
        this.m_containerDiv.appendChild(l_frameDiv2);
		
        l_frameDiv2.innerHTML = "<iframe style='width:650px; height: 2300px; margin-left:auto; margin-right:auto; overflow:auto; border:none;' src='"+l_srcUrl+"'>";
    }
//end OfferPalDiv


    
	function ItemInfoFight( NumWeapons,numfriends ,name)
	{
	var l_gunsInfo =  document.createElement("div");
		l_gunsInfo.innerHTML =  + NumWeapons + '/' + numfriends + ' '+name; 
		      l_gunsInfo.style.color = "#E7CF07";
        l_gunsInfo.style.textAlign = "center";
        l_gunsInfo.style.fontSize = "10px";
        l_gunsInfo.style.fontWeight = "bold";
	
	return l_gunsInfo;
	}
	
	function ItemTopFight(Icon,ext,Title,l_mainTabletr)
	{
	var l_mainTabletd2 =   document.createElement("td");
	
	     l_mainTabletd2.style.borderLeft = "solid 1px #AAAAAA";
        l_mainTabletd2.style.borderTop = "solid 1px #AAAAAA";
        l_mainTabletd2.style.borderRight = "solid 1px #000000";
        l_mainTabletd2.style.borderBottom = "solid 1px #000000";
		l_mainTabletd2.style.width = "60px";
        l_mainTabletd2.style.height = "40px";
		
			l_mainTabletr.appendChild(l_mainTabletd2);
			
			// http://www.bigideastech.com/crime/images/weapons/icons/ - ext
			l_mainTabletd2.innerHTML = '<img alt=\''+Title+'\' title=\''+Title+'\' style=\'width:60px;   height:40px;   background-repeat: repeat-x;\' src=\''+ext+Icon+'\'/> ';
	return l_mainTabletd2;
	}
	//ItemInfoFight
	function ItemBarFight( NumWeapons,numfriends )
	{
			var l_gunsBar =  document.createElement("div");
			
			l_gunsBar.style.width =  "91px";
			l_gunsBar.style.height =  "23px";
			l_gunsBar.style.border="solid 1px #E7CF07";
			var l_gunsBar2 =  document.createElement("div");
			l_gunsBar.appendChild(l_gunsBar2);
			var p = calcpercent(NumWeapons,numfriends);
		//equipment.png
			l_gunsBar2.style.backgroundImage = "url('http://www.bigideastech.com/crime/images/UI/buttons/progressT4.png')";
			l_gunsBar2.style.width =  p+"%";
			l_gunsBar2.style.height =  "25px";
	return l_gunsBar;
	}

// MobFightListDiv
    function FightListDiv(a_parentDiv){

        this.m_parentDiv = a_parentDiv;
        this.m_containerDiv = undefined;
        this.m_resultDiv = undefined;
        this.m_tableDiv = undefined;
this.m_userstatsDiv = undefined;

        this.m_titleString = undefined;
        this.m_mobNameLabel = undefined;
        this.m_mobSizeLabel = undefined;
        this.m_mobActionLabel = undefined;
		this.m_mobNetworkLabel = undefined;
		
        this.m_emptyMessage = undefined;
this.m_contentTequimentMenuBody  = undefined;
	this.Wimg = undefined;
	this.Aimg = undefined;
	this.Bimg = undefined;
	this.Cimg = undefined;
	this.Dimg = undefined;
	this.Fimg = undefined;
	this.Gimg = undefined;
	this.Himg = undefined;
	this.Jimg = undefined;
	this.Kimg = undefined; 
	this.Nimg = undefined; 
	this.Mimg = undefined; 
	
		this.Limg = undefined;
	this.m_contentTBody = undefined;
	this.m_title = undefined;
	
		this.m_sidestats = undefined;
		
        this.initialize();
        this.createDiv();
    }

    FightListDiv.prototype.initialize = function(){
        this.m_titleString = "Kill Others!";
        this.m_mobNameLabel = "Criminal";
        this.m_mobSizeLabel = "Organization Size"; 
        this.m_mobActionLabel = "Action";
		this.m_mobNetworkLabel ="Network";
        this.m_emptyMessage = "There are no other criminals around your level to fight. You should check the streets again in a couple minutes. Why not <a class='standardLink' href='#' onclick='switchTabs(1);return false;'>complete some jobs</a> in the meantime?";

	   
		}

    FightListDiv.prototype.createDiv = function(){

        this.m_containerDiv = document.createElement("div");
        this.m_parentDiv.appendChild(this.m_containerDiv);
        this.m_containerDiv.style.padding = "15px";
        this.m_containerDiv.style.textAlign = "center";


 //this.m_containerDiv.appendChild(this.);
        
  
        this.m_title = document.createElement("div");
        this.m_containerDiv.appendChild(this.m_title);
    //    createTitleDiv(this.m_title, this.m_titleString);

        this.m_resultDiv = new ResultDiv(this.m_containerDiv);

        this.m_tableDiv = document.createElement("div");
        this.m_containerDiv.appendChild(this.m_tableDiv);
        this.m_tableDiv.style.textAlign = "center";

		
  this.m_tableDiv.innerHTML = "";
this.m_tableDiv.id = "hey1223";
//this.m_tableDiv.style.width = "600px";

var l_mainTable = document.createElement("table");

//l_mainTable
     l_mainTable.style.borderLeft = "solid 1px #AAAAAA";
        l_mainTable.style.borderTop = "solid 1px #AAAAAA";
        l_mainTable.style.borderRight = "solid 1px #000000";
        l_mainTable.style.borderBottom = "solid 1px #000000";
var l_statsTable = document.createElement("table");

    l_statsTable.style.borderLeft = "solid 1px #AAAAAA";
        l_statsTable.style.borderTop = "solid 1px #AAAAAA";
        l_statsTable.style.borderRight = "solid 1px #000000";
        l_statsTable.style.borderBottom = "solid 1px #000000";
		
        var l_contentTable = document.createElement("table");
	 var l_headerTable = document.createElement("table");
	 
	 
	 var  l_UserStats =  document.createElement("div");
 // l_UserStats.innerHTML = '<div class="fightbar_skill"><div class="fightbar_text">Your Skills:</div>			<div class="fightbar_skill_atk">25</div>			<div class="fightbar_skill_def">24</div>		</div>		<div class="fightbar_group">			<div class="fightbar_text">Your Mafia:<span class="fightbar_popup"><div class="zy_popup_box_bg" id="zy_popup_box_bg1253545728.64740"/><div class="zy_popup_box" id="zy_popup_box1253545728.64740"><div id="zy_popup_box_button1253545728.64740" class="zy_popup_box_button"><a onclick="document.getElementById(\'zy_popup_box_bg1253545728.64740\').style.visibility = \'hidden\';document.getElementById(\'zy_popup_box1253545728.64740\').style.visibility = \'hidden\';document.getElementById(\'zy_popup_box_button1253545728.64740\').style.visibility = \'hidden\';document.getElementById(\'zy_popup_box_title1253545728.64740\').style.visibility = \'hidden\';document.getElementById(\'zy_popup_box_body1253545728.64740\').style.visibility = \'hidden\';return (false);" href="javascript:;"><img src="http://mwms.static.zynga.com/mwms/graphics/popup_close_button.png"/></a></div><div id="zy_popup_box_title1253545728.64740" class="zy_popup_box_title">Mafia Fight Strength</div><div id="zy_popup_box_body1253545728.64740" class="zy_popup_box_body"><p style="margin-top: 0px;">Up to 501 mafia members and hired guns help you in fights, each using a weapon, armor, and vehicle from your inventory.</p><p><img style="margin: 2px; width: 22px; height: 16px;" alt="Mafia Attack Strength" title="Mafia Attack Strength" src="http://mwms.static.zynga.com/mwms/graphics/icon_mafia_attack_22x16_01.gif"/>Mafia Attack Strength is the total equipped offensive power of everyone in your mafia.</p><p><img style="margin: 2px; width: 22px; height: 16px;" alt="Mafia Defense Strength" title="Mafia Defense Strength" src="http://mwms.static.zynga.com/mwms/graphics/icon_mafia_defense_22x16_01.gif"/>Likewise, Mafia Defense Strength is your total mafia\'s defensive power.</p><p>Make sure you have at least one weapon, armor, and vehicle for each of your mafia\'s soldiers.  Your three strongest offensive and defensive items add a bonus to your total mafia\'s strength.  Raising your attack and defense skills provides a secret increase to your mafia\'s strength that your opponent cannot see.</p></div></div><a onclick="document.getElementById(\'zy_popup_box_bg1253545728.64740\').style.visibility = \'visible\';document.getElementById(\'zy_popup_box1253545728.64740\').style.visibility = \'visible\';document.getElementById(\'zy_popup_box_button1253545728.64740\').style.visibility = \'visible\';document.getElementById(\'zy_popup_box_title1253545728.64740\').style.visibility = \'visible\';document.getElementById(\'zy_popup_box_body1253545728.64740\').style.visibility = \'visible\';return (false);" href="javascript:;"><img style="height: 12px; width: 12px;" src="http://mwms.static.zynga.com/mwms/graphics/icon-help.gif"/> What\'s this?</a></span></div>			<div style="clear: left;" class="fightbar_group_stat"><img style="width: 22px; height: 16px;" alt="Mafia Size" title="Mafia Size" src="http://mwms.static.zynga.com/mwms/graphics/icon_mafia_size_21x16_01.gif"/> 138</div>			<div class="fightbar_group_stat"><img style="width: 22px; height: 16px;" alt="Mafia Attack Strength" title="Mafia Attack Strength" src="http://mwms.static.zynga.com/mwms/graphics/icon_mafia_attack_22x16_01.gif"/> 4,749</div>			<div class="fightbar_group_stat"><img style="width: 22px; height: 16px;" alt="Mafia Defense Strength" title="Mafia Defense Strength" src="http://mwms.static.zynga.com/mwms/graphics/icon_mafia_defense_22x16_01.gif"/> 5,004</div>					</div>		<div class="fightbar_top3_atk">			<div class="fightbar_text">Best Offense:</div>			<div class="fightbar_top3_items">				<div class="fightbar_top3_item"> <img style="width: 30px; height: 30px;" title="RA-92" alt="RA-92" src="http://mwms.static.zynga.com/mwms/graphics/item_ra92_75x75_01.gif"/></div><div class="fightbar_top3_item"> <img style="width: 30px; height: 30px;" title="Street Gang Member" alt="Street Gang Member" src="http://mwms.static.zynga.com/mwms/graphics/item_streetgangmember_75x75_01.gif"/></div><div class="fightbar_top3_item"> <img style="width: 30px; height: 30px;" title="Chopper" alt="Chopper" src="http://mwms.static.zynga.com/mwms/graphics/item_harley_fat_boy.gif"/></div>			</div>		</div>		<div class="fightbar_top3_def">			<div class="fightbar_text">Best Defense:</div>			<div class="fightbar_top3_items">				<div class="fightbar_top3_item"> <img style="width: 30px; height: 30px;" title="SMG" alt="SMG" src="http://mwms.static.zynga.com/mwms/graphics/item_mini_uzi_75x75_01.gif"/></div><div class="fightbar_top3_item"> <img style="width: 30px; height: 30px;" title="Bodyguards" alt="Bodyguards" src="http://mwms.static.zynga.com/mwms/graphics/item_bodyguards.gif"/></div><div class="fightbar_top3_item"> <img style="width: 30px; height: 30px;" title="Decommissioned APC" alt="Decommissioned APC" src="http://mwms.static.zynga.com/mwms/graphics/item_decommissionedapc_75x75_01.gif"/></div>			</div>		</div>	</div>';
	
	
	  this.m_tableDiv.appendChild(l_mainTable);
      //  this.m_tableDiv.appendChild(l_contentTable);
		
	 //  this.m_tableDiv.appendChild(l_UserStats);
	var l_mainTabletbody=   document.createElement("tbody");
	var l_mainTabletr =   document.createElement("tr");
	var l_mainTabletr2 =   document.createElement("tr");
	var l_mainTabletd1 =   document.createElement("td");
	 var l_mainTabletd2 =   document.createElement("td");  
	this.m_userstatsDiv =     document.createElement("td");
	
	// l_mainTabletd2.innerHTML = '<div class="fightbar_skill"><div class="fightbar_text">Your Skills:</div>			<div class="fightbar_skill_atk">25</div>			<div class="fightbar_skill_def">24</div>		</div>		<div class="fightbar_group">			<div class="fightbar_text">Your Mafia:<span class="fightbar_popup"><div class="zy_popup_box_bg" id="zy_popup_box_bg1253545728.64740"/><div class="zy_popup_box" id="zy_popup_box1253545728.64740"><div id="zy_popup_box_button1253545728.64740" class="zy_popup_box_button"><a onclick="document.getElementById(\'zy_popup_box_bg1253545728.64740\').style.visibility = \'hidden\';document.getElementById(\'zy_popup_box1253545728.64740\').style.visibility = \'hidden\';document.getElementById(\'zy_popup_box_button1253545728.64740\').style.visibility = \'hidden\';document.getElementById(\'zy_popup_box_title1253545728.64740\').style.visibility = \'hidden\';document.getElementById(\'zy_popup_box_body1253545728.64740\').style.visibility = \'hidden\';return (false);" href="javascript:;"><img src="http://mwms.static.zynga.com/mwms/graphics/popup_close_button.png"/></a></div><div id="zy_popup_box_title1253545728.64740" class="zy_popup_box_title">Mafia Fight Strength</div><div id="zy_popup_box_body1253545728.64740" class="zy_popup_box_body"><p style="margin-top: 0px;">Up to 501 mafia members and hired guns help you in fights, each using a weapon, armor, and vehicle from your inventory.</p><p><img style="margin: 2px; width: 22px; height: 16px;" alt="Mafia Attack Strength" title="Mafia Attack Strength" src="http://mwms.static.zynga.com/mwms/graphics/icon_mafia_attack_22x16_01.gif"/>Mafia Attack Strength is the total equipped offensive power of everyone in your mafia.</p><p><img style="margin: 2px; width: 22px; height: 16px;" alt="Mafia Defense Strength" title="Mafia Defense Strength" src="http://mwms.static.zynga.com/mwms/graphics/icon_mafia_defense_22x16_01.gif"/>Likewise, Mafia Defense Strength is your total mafia\'s defensive power.</p><p>Make sure you have at least one weapon, armor, and vehicle for each of your mafia\'s soldiers.  Your three strongest offensive and defensive items add a bonus to your total mafia\'s strength.  Raising your attack and defense skills provides a secret increase to your mafia\'s strength that your opponent cannot see.</p></div></div><a onclick="document.getElementById(\'zy_popup_box_bg1253545728.64740\').style.visibility = \'visible\';document.getElementById(\'zy_popup_box1253545728.64740\').style.visibility = \'visible\';document.getElementById(\'zy_popup_box_button1253545728.64740\').style.visibility = \'visible\';document.getElementById(\'zy_popup_box_title1253545728.64740\').style.visibility = \'visible\';document.getElementById(\'zy_popup_box_body1253545728.64740\').style.visibility = \'visible\';return (false);" href="javascript:;"><img style="height: 12px; width: 12px;" src="http://mwms.static.zynga.com/mwms/graphics/icon-help.gif"/> What\'s this?</a></span></div>			<div style="clear: left;" class="fightbar_group_stat"><img style="width: 22px; height: 16px;" alt="Mafia Size" title="Mafia Size" src="http://mwms.static.zynga.com/mwms/graphics/icon_mafia_size_21x16_01.gif"/> 138</div>			<div class="fightbar_group_stat"><img style="width: 22px; height: 16px;" alt="Mafia Attack Strength" title="Mafia Attack Strength" src="http://mwms.static.zynga.com/mwms/graphics/icon_mafia_attack_22x16_01.gif"/> 4,749</div>			<div class="fightbar_group_stat"><img style="width: 22px; height: 16px;" alt="Mafia Defense Strength" title="Mafia Defense Strength" src="http://mwms.static.zynga.com/mwms/graphics/icon_mafia_defense_22x16_01.gif"/> 5,004</div>					</div>		<div class="fightbar_top3_atk">			<div class="fightbar_text">Best Offense:</div>			<div class="fightbar_top3_items">				<div class="fightbar_top3_item"> <img style="width: 30px; height: 30px;" title="RA-92" alt="RA-92" src="http://mwms.static.zynga.com/mwms/graphics/item_ra92_75x75_01.gif"/></div><div class="fightbar_top3_item"> <img style="width: 30px; height: 30px;" title="Street Gang Member" alt="Street Gang Member" src="http://mwms.static.zynga.com/mwms/graphics/item_streetgangmember_75x75_01.gif"/></div><div class="fightbar_top3_item"> <img style="width: 30px; height: 30px;" title="Chopper" alt="Chopper" src="http://mwms.static.zynga.com/mwms/graphics/item_harley_fat_boy.gif"/></div>			</div>		</div>		<div class="fightbar_top3_def">			<div class="fightbar_text">Best Defense:</div>			<div class="fightbar_top3_items">				<div class="fightbar_top3_item"> <img style="width: 30px; height: 30px;" title="SMG" alt="SMG" src="http://mwms.static.zynga.com/mwms/graphics/item_mini_uzi_75x75_01.gif"/></div><div class="fightbar_top3_item"> <img style="width: 30px; height: 30px;" title="Bodyguards" alt="Bodyguards" src="http://mwms.static.zynga.com/mwms/graphics/item_bodyguards.gif"/></div><div class="fightbar_top3_item"> <img style="width: 30px; height: 30px;" title="Decommissioned APC" alt="Decommissioned APC" src="http://mwms.static.zynga.com/mwms/graphics/item_decommissionedapc_75x75_01.gif"/></div>			</div>		</div>	</div>';
	
		 this.m_userstatsDiv.style.verticalAlign = "TOP";
		  this.m_userstatsDiv.style.borderLeft = "solid 1px #AAAAAA";
        this.m_userstatsDiv.style.borderTop = "solid 1px #AAAAAA";
        this.m_userstatsDiv.style.borderRight = "solid 1px #000000";
        this.m_userstatsDiv.style.borderBottom = "solid 1px #000000";
		 
		 
	   l_mainTable.appendChild(l_mainTabletbody);
	    l_mainTabletbody.appendChild(l_mainTabletr2);
		l_mainTabletbody.appendChild(l_mainTabletr);
		 l_mainTabletr.appendChild(l_mainTabletd1);
		  l_mainTabletr.appendChild(l_mainTabletd2);
		  
		    var l_sidestatsTable=   document.createElement("table");
			
			 l_sidestatsTable.style.borderLeft = "solid 1px #AAAAAA";
        l_sidestatsTable.style.borderTop = "solid 1px #AAAAAA";
        l_sidestatsTable.style.borderRight = "solid 1px #000000";
        l_sidestatsTable.style.borderBottom = "solid 1px #000000";
			
		  var l_sidestatsTabletbody=   document.createElement("tbody");
	var l_sidestatsTabletr =   document.createElement("tr");
 l_sidestatsTable.style.verticalAlign = "TOP"; 
	//var l_sidestatsTabletd1 =   document.createElement("td");
	l_mainTabletd2.style.verticalAlign = "TOP"; 
	
	 var l_sidestatsTD  = document.createElement("td");
		  this.m_sidestats  = document.createElement("div");
		   // this.m_sidestats.innerHTML= 'sdf';
			
		  l_mainTabletd2.style.width ="106px"; 
		  		  l_mainTabletd2.style.height ="255px"; 
		  l_mainTabletd1.style.width ="739px"; 
		  l_sidestatsTabletr.style.width ="106px"; 
		 // l_mainTabletd2.appendChild(l_sidestatsTable);
		  
		  l_sidestatsTable.appendChild(l_sidestatsTabletbody);
		  l_sidestatsTable.appendChild(l_sidestatsTabletr);
		//  l_sidestatsTabletr.appendChild(l_sidestatsTD);
		    l_mainTabletd2.appendChild(this.m_sidestats);
		  
		  
		  l_mainTabletr2.appendChild(l_sidestatsTD); 
		
		
		
   l_mainTabletd1.appendChild(l_headerTable);
       l_mainTabletd1.appendChild(l_contentTable);
		
		
        l_contentTable.style.marginLeft = "auto";
        l_contentTable.style.marginRight = "auto";
        l_contentTable.style.borderSpacing = "6px";
	l_contentTable.style.width = "500px";
        this.m_contentTBody = document.createElement("tbody");
	 var l_headerTBody = document.createElement("tbody");
	 
	   var l_headerTR = document.createElement("tr");
  
       l_headerTable.appendChild(l_headerTBody);
      l_headerTBody.appendChild(l_headerTR);
        l_contentTable.appendChild(this.m_contentTBody);
  
// <table style="margin: auto; border-collapse: collapse;" cellpadding="5" cellspacing="0"><tbody><tr><td style="border-bottom: 1px solid rgb(85, 85, 85); padding: 10px; color: rgb(255, 255, 255); font-size: 12px; text-align: left; width: 220px; background-color: rgb(17, 17, 17);"><div><div style="font-family: Georgia; font-weight: bold; font-size: 16px;">Attack strength</div><br><div style="font-weight: bold;">3/26 featured items</div><div class="equip_bar"><div style="width: 11%;" class="equip_fill"></div></div><div style="font-size: 11px;"><div>Maximize by <a href="#" onclick='Redirect("Equipment");'>buying 23 more</a>!</div></div><br><div style="font-weight: bold;">26/26 weapons</div><div class="equip_bar"><div style="width: 100%;" class="equip_fill"></div></div><div style="font-size: 11px;"><div><a href="#" onclick='Redirect("Invites");'>Grow your Family</a> to use more!</div></div><br><div style="font-weight: bold;">26/26 armors</div><div class="equip_bar"><div style="width: 100%;" class="equip_fill"></div></div><div style="font-size: 11px;"><div><a href="#" onclick='Redirect("Invites");'>Grow your Family</a> to use more!</div></div><br><div style="font-weight: bold;">26/26 vehicles</div><div class="equip_bar"><div style="width: 100%;" class="equip_fill"></div></div><div style="font-size: 11px;"><div><a href="#" onclick='Redirect("Invites");'>Grow your Family</a> to use more!</div></div><br></div></td></tr></tbody></table>

var l_contentTableEquipmentMenu = document.createElement("table");
	this.m_parentDiv.appendChild(l_contentTableEquipmentMenu);	
		
		GBL.MAIN_TABS.fighttablist = this.m_containerDiv;
		GBL.MAIN_TABS.fighttab = this;
		
         this.m_containerDiv.appendChild(l_contentTableEquipmentMenu);
        l_contentTableEquipmentMenu.style.marginLeft = "auto";
        l_contentTableEquipmentMenu.style.marginRight = "auto";
        l_contentTableEquipmentMenu.style.marginTop = "5px";
        l_contentTableEquipmentMenu.style.cellSpacing = "0px";
        l_contentTableEquipmentMenu.style.borderCollapse = "collapse";
        this.m_contentTequimentMenuBody = document.createElement("tbody");
        l_contentTableEquipmentMenu.appendChild(this.m_contentTequimentMenuBody);

     

       // var l_td = document.createElement("td");
      //  l_headerTR.appendChild(l_td);
       // addHeaderStyleWithInnerDiv(l_td, "Weapons", "500px");




	 this.Wimg = document.createElement("td");
         //  l_headerTR.appendChild(this.Wimg);
	// this.m_containerDiv.appendChild(this.Wimg);
	// this.Wimg.style.textAlign = "center";
	this.Wimg.style.cursor = "pointer";
	
		 this.Aimg = document.createElement("td");
	// this.m_containerDiv.appendChild(this.Aimg);
       //  l_headerTR.appendChild(this.Aimg);
	 this.Aimg.style.textAlign = "center";
	 this.Aimg.style.cursor = "pointer";
          this.Bimg = document.createElement("td");
	 //this.m_containerDiv.appendChild(this.Aimg);
       
	 this.Bimg.style.textAlign = "center";
         this.Bimg.style.cursor = "pointer";
          this.Cimg = document.createElement("td");
	
        
	 this.Cimg.style.textAlign = "center";
         this.Cimg.style.cursor = "pointer";
          this.Dimg = document.createElement("td");
	// this.m_containerDiv.appendChild(this.Aimg);
        
	 this.Dimg.style.textAlign = "center";
         this.Dimg.style.cursor = "pointer";
         
	 
	this.Fimg  = document.createElement("td");
		 this.Fimg.style.textAlign = "center";
         this.Fimg.style.cursor = "pointer";
	this.Gimg =  document.createElement("td");
		 this.Gimg.style.textAlign = "center";
         this.Gimg.style.cursor = "pointer";
	this.Himg =  document.createElement("td");
		 this.Himg.style.textAlign = "center";
         this.Himg.style.cursor = "pointer";
	this.Jimg = document.createElement("td");
		 this.Jimg.style.textAlign = "center";
         this.Jimg.style.cursor = "pointer";
	this.Kimg = document.createElement("td");
		 this.Kimg.style.textAlign = "center";
         this.Kimg.style.cursor = "pointer";
	
		this.Nimg = document.createElement("td");
		 this.Nimg.style.textAlign = "center";
         this.Nimg.style.cursor = "pointer";
		 
		 	this.Mimg = document.createElement("td");
		 this.Mimg.style.textAlign = "center";
         this.Mimg.style.cursor = "pointer";
		 
	
	this.Limg = document.createElement("td");
		 this.Limg.style.textAlign = "center";
         this.Limg.style.cursor = "pointer";
		 
         /*
	 	 this.Bimg = document.createElement("div");
	 this.m_containerDiv.appendChild(this.Bimg);
	 this.Bimg.style.textAlign = "left";
	 
	 	 this.Cimg = document.createElement("div");
	 this.m_containerDiv.appendChild(this.Cimg);
	 this.Cimg.style.textAlign = "left";
	 
	 	 this.Dimg = document.createElement("div");
	 this.m_containerDiv.appendChild(this.Dimg);
	 this.Dimg.style.textAlign = "left";
	 
	 	 this.Eimg = document.createElement("div");
	 this.m_containerDiv.appendChild(this.Eimg);
	 this.Eimg.style.textAlign = "left";
         */
	//this.Wimg = document.createElement("img");
	//this.Wimg.src="http://www.bigideastech.com/crime/images/UI/weapons2.jpg");
	
	
	// "<img style='margin-left:auto; margin-right:auto;' src='"+a_item.getImageURL()+"'/>";
	
	// this.m_refreshDiv.appendChild(this.Wimg);
	
	// this.m_refreshDiv.innerHTML = "<h2>Choose Shops Category</h2> ";
 
  this.Wimg.innerHTML =  "<img style='margin-left:auto; margin-right:auto;' src='http://www.laasex.com/crime/images/UI/opensocial/MS.png'/> ";
 
 this.Aimg.innerHTML ="<img style='margin-left:auto; margin-right:auto;' src='http://www.laasex.com/crime/images/UI/opensocial/FB.png'/> ";

this.Bimg.innerHTML = "<img style='margin-left:auto; margin-right:auto;' src='http://www.laasex.com/crime/images/UI/opensocial/OK.png'/> ";

this.Cimg.innerHTML = "<img style='margin-left:auto; margin-right:auto;' src='http://www.laasex.com/crime/images/UI/opensocial/H5.png'/> ";

this.Dimg.innerHTML = "<img style='margin-left:auto; margin-right:auto;' src='http://www.laasex.com/crime/images/UI/opensocial/BB.png'/> ";

this.Limg.innerHTML = "<img style='margin-left:auto; margin-right:auto;' src='http://www.laasex.com/crime/images/UI/buttons/kill2.png'/> ";
 
this.Fimg.innerHTML = "<img style='margin-left:auto; margin-right:auto;' src='http://www.laasex.com/crime/images/UI/buttons/enemy.png'/> ";

	this.Gimg.innerHTML = "<img style='margin-left:auto; margin-right:auto;' src='http://www.laasex.com/crime/images/UI/buttons/friends.png'/> ";
	this.Himg.innerHTML = "<img style='margin-left:auto; margin-right:auto;' src='http://www.laasex.com/crime/images/UI/buttons/robbery.png'/> ";
	this.Jimg.innerHTML = "<img style='margin-left:auto; margin-right:auto;' src='http://www.laasex.com/crime/images/UI/buttons/gta.png'/> ";
	
	this.Nimg.innerHTML = "<img style='margin-left:auto; margin-right:auto;' src='http://www.laasex.com/crime/images/UI/buttons/DriveBy2.png'/> ";
	this.Mimg.innerHTML = "<img style='margin-left:auto; margin-right:auto;' src='http://www.laasex.com/crime/images/UI/buttons/assassin2.png'/> ";
	
	
	this.Kimg.innerHTML = "<img style='margin-left:auto; margin-right:auto; background-repeat: repeat-x;' src='http://www.laasex.com/crime/images/UI/icons/bullet-holes1.png'/> ";


	/*
l_headerTR.appendChild(this.Wimg);
l_headerTR.appendChild(this.Aimg);
  l_headerTR.appendChild(this.Bimg);
 l_headerTR.appendChild(this.Cimg);
 
 l_headerTR.appendChild(this.Dimg);
	*/
 l_headerTR.appendChild(this.Limg);
 l_headerTR.appendChild(this.Fimg);
	l_headerTR.appendChild(this.Gimg);
	l_headerTR.appendChild(this.Himg);
	l_headerTR.appendChild(this.Jimg);
	
	l_headerTR.appendChild(this.Nimg);
	l_headerTR.appendChild(this.Mimg);
//	l_headerTR.appendChild(this.Kimg);
	
        this.refresh();
    }

    FightListDiv.prototype.refresh = function(){

      
 
var l_self = this;

   try{
            l_self.m_contentTBody.innerHTML = "";    // IE
        } catch(error){
	
while(l_self.m_contentTBody.hasChildNodes())
{
l_self.m_contentTBody.removeChild(l_self.m_contentTBody.firstChild);
}
	}




addEvent(this.Wimg, "click", function(e) {
    //GBL.MAIN_TABS.switchToDynamicTab(function(a_contentDiv){
    
    //l_contentTBody.id = "hey1223";
    //  $("hey1223").hide("slide", {}, 1000);
       //  $("hey1223").hide("slide", { direction: "down" }, 1000);
          try{
            l_self.m_contentTBody.innerHTML = "";    // IE
        } catch(error){
	
while(l_self.m_contentTBody.hasChildNodes())
{
l_self.m_contentTBody.removeChild(l_self.m_contentTBody.firstChild);
}
	}
	 
			//l_contentTBody.innerHTML = "";
			   var l_loadingDiv = document.createElement("div");
       l_self.m_contentTBody.appendChild(l_loadingDiv);
        l_loadingDiv.style.padding = "10px";
      //  l_loadingDiv.innerHTML = "<span style='color:#FF6F00; font-weight:bold;'> Loading Kill list... please wait  </span>";
 
   try{
    l_loadingDiv.innerHTML = "Loading Kill list... please wait";
           // l_self.m_contentTBody.innerHTML = "";    // IE
        } catch(error){
	
	}
	 

        var l_params = {};
        l_params.aNID = GBL.MAIN_DATA.getViewer().getUserId();
	l_params.aT = "2";
	l_params.f = "JGetFightListNetwork";
       /*
        	l_params.f = "JGetTopPlayers3";
        var l_self = this;
	// http://crime.servegame.com/JSonService.aspx?f=JGetTopPlayers3&Page=2
	// 
        makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx", function(a_responseData){l_self.onGetMadeMen(a_responseData);}, l_params);
   
       */
    //    makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/get_fight_list", function(a_responseData){
	makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx", function(a_responseData){
           l_loadingDiv.style.display = "none";
           l_self.onGetFightList2(a_responseData, l_self.m_contentTBody,"http://www.laasex.com/crime/images/UI/stats/O2.png","http://www.laasex.com/crime/images/UI/stats/D2.png");
        },l_params);
});



addEvent(this.Fimg, "click", function(e) {
    //GBL.MAIN_TABS.switchToDynamicTab(function(a_contentDiv){
    
    //l_contentTBody.id = "hey1223";
    //  $("hey1223").hide("slide", {}, 1000);
       //  $("hey1223").hide("slide", { direction: "down" }, 1000);
          try{
            l_self.m_contentTBody.innerHTML = "";    // IE
        } catch(error){
	
while(l_self.m_contentTBody.hasChildNodes())
{
l_self.m_contentTBody.removeChild(l_self.m_contentTBody.firstChild);
}
	}
	 
			//l_contentTBody.innerHTML = "";
			   var l_loadingDiv = document.createElement("div");
       l_self.m_contentTBody.appendChild(l_loadingDiv);
        l_loadingDiv.style.padding = "10px";
      //  l_loadingDiv.innerHTML = "<span style='color:#FF6F00; font-weight:bold;'> Loading Kill list... please wait  </span>";
 
   try{
    l_loadingDiv.innerHTML = "Loading Enemy list... please wait";
           // l_self.m_contentTBody.innerHTML = "";    // IE
        } catch(error){
	
	}
	 

        var l_params = {};
        l_params.aNID = GBL.MAIN_DATA.getViewer().getUserId();
	l_params.aT = "2";
	l_params.f = "JGetEnemyListLevelNetwork";
       /*
        	l_params.f = "JGetTopPlayers3";
        var l_self = this;
	// http://crime.servegame.com/JSonService.aspx?f=JGetTopPlayers3&Page=2
	// 
        makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx", function(a_responseData){l_self.onGetMadeMen(a_responseData);}, l_params);
   
       */
    //    makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/get_fight_list", function(a_responseData){
	makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx", function(a_responseData){ 
           l_loadingDiv.style.display = "none";
           l_self.onGetFightList6(a_responseData, l_self.m_contentTBody);
        },l_params);
});


addEvent(this.Gimg, "click", function(e) {
    //GBL.MAIN_TABS.switchToDynamicTab(function(a_contentDiv){
    
    //l_contentTBody.id = "hey1223";
    //  $("hey1223").hide("slide", {}, 1000);
       //  $("hey1223").hide("slide", { direction: "down" }, 1000);
          try{
            l_self.m_contentTBody.innerHTML = "";    // IE
        } catch(error){
	
while(l_self.m_contentTBody.hasChildNodes())
{
l_self.m_contentTBody.removeChild(l_self.m_contentTBody.firstChild);
}
	}
	 
			//l_contentTBody.innerHTML = "";
			   var l_loadingDiv = document.createElement("div");
       l_self.m_contentTBody.appendChild(l_loadingDiv);
        l_loadingDiv.style.padding = "10px";
      //  l_loadingDiv.innerHTML = "<span style='color:#FF6F00; font-weight:bold;'> Loading Kill list... please wait  </span>";
 
   try{
    l_loadingDiv.innerHTML = "Loading Kill list... please wait";
           // l_self.m_contentTBody.innerHTML = "";    // IE
        } catch(error){
	
	}
	 

        var l_params = {};
        l_params.aNID = GBL.MAIN_DATA.getViewer().getUserId();
	l_params.aT = "2";
	l_params.f = "JGetFriendsListLevelNetwork";
       /*
        	l_params.f = "JGetTopPlayers3";
        var l_self = this;
	// http://crime.servegame.com/JSonService.aspx?f=JGetTopPlayers3&Page=2
	// 
        makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx", function(a_responseData){l_self.onGetMadeMen(a_responseData);}, l_params);
   
       */
    //    makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/get_fight_list", function(a_responseData){
	makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx", function(a_responseData){
           l_loadingDiv.style.display = "none";
           l_self.onGetFightList3(a_responseData, l_self.m_contentTBody);
        },l_params);
});



addEvent(this.Himg, "click", function(e) {
    //GBL.MAIN_TABS.switchToDynamicTab(function(a_contentDiv){
    
    //l_contentTBody.id = "hey1223";
    //  $("hey1223").hide("slide", {}, 1000);
       //  $("hey1223").hide("slide", { direction: "down" }, 1000);
          try{
            l_self.m_contentTBody.innerHTML = "";    // IE
        } catch(error){
	
while(l_self.m_contentTBody.hasChildNodes())
{
l_self.m_contentTBody.removeChild(l_self.m_contentTBody.firstChild);
}
	}
	 
			//l_contentTBody.innerHTML = "";
			   var l_loadingDiv = document.createElement("div");
       l_self.m_contentTBody.appendChild(l_loadingDiv);
        l_loadingDiv.style.padding = "10px";
      //  l_loadingDiv.innerHTML = "<span style='color:#FF6F00; font-weight:bold;'> Loading Kill list... please wait  </span>";
 
   try{
    l_loadingDiv.innerHTML = "Loading Kill list... please wait";
           // l_self.m_contentTBody.innerHTML = "";    // IE
        } catch(error){
	
	}
	 

        var l_params = {};
        l_params.aNID = GBL.MAIN_DATA.getViewer().getUserId();
	l_params.aT = "2";
	l_params.f = "JGetRobListLevelNetwork";
       /*
        	l_params.f = "JGetTopPlayers3";
        var l_self = this;
	// http://crime.servegame.com/JSonService.aspx?f=JGetTopPlayers3&Page=2
	// 
        makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx", function(a_responseData){l_self.onGetMadeMen(a_responseData);}, l_params);
   
       */
    //    makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/get_fight_list", function(a_responseData){
	makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx", function(a_responseData){
           l_loadingDiv.style.display = "none";
           l_self.onGetFightList4(a_responseData, l_self.m_contentTBody);
        },l_params);
});



addEvent(this.Nimg, "click", function(e) {
    //GBL.MAIN_TABS.switchToDynamicTab(function(a_contentDiv){
    
    //l_contentTBody.id = "hey1223";
    //  $("hey1223").hide("slide", {}, 1000);
       //  $("hey1223").hide("slide", { direction: "down" }, 1000);
          try{
            l_self.m_contentTBody.innerHTML = "";    // IE
        } catch(error){
	
while(l_self.m_contentTBody.hasChildNodes())
{
l_self.m_contentTBody.removeChild(l_self.m_contentTBody.firstChild);
}
	}
	 
			//l_contentTBody.innerHTML = "";
			   var l_loadingDiv = document.createElement("div");
       l_self.m_contentTBody.appendChild(l_loadingDiv);
        l_loadingDiv.style.padding = "10px";
      //  l_loadingDiv.innerHTML = "<span style='color:#FF6F00; font-weight:bold;'> Loading Kill list... please wait  </span>";
 
   try{
    l_loadingDiv.innerHTML = "Loading Drive By list... please wait";
           // l_self.m_contentTBody.innerHTML = "";    // IE
        } catch(error){
	
	}
	 

        var l_params = {};
        l_params.aNID = GBL.MAIN_DATA.getViewer().getUserId();
	l_params.aT = "2";
	l_params.f = "JGetDriveByListNetwork";
       /*
        	l_params.f = "JGetTopPlayers3";
        var l_self = this;
	// http://crime.servegame.com/JSonService.aspx?f=JGetTopPlayers3&Page=2
	// 
        makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx", function(a_responseData){l_self.onGetMadeMen(a_responseData);}, l_params);
   
var l_params = {};
        l_params.aNID = GBL.MAIN_DATA.getViewer().getUserId();
	l_params.aT = "2";
	l_params.f = "JGetFightListNetwork";
       /*
        	l_params.f = "JGetTopPlayers3";
        var l_self = this;
	// http://crime.servegame.com/JSonService.aspx?f=JGetTopPlayers3&Page=2
	// 
        makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx", function(a_responseData){l_self.onGetMadeMen(a_responseData);}, l_params);
   
       */
    //    makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/get_fight_list", function(a_responseData){
	makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx", function(a_responseData){
           l_loadingDiv.style.display = "none";
           l_self.onGetFightList2(a_responseData, l_self.m_contentTBody,"http://www.laasex.com/crime/images/UI/buttons/DByA3.png","http://www.laasex.com/crime/images/UI/buttons/DByD7.png");
        },l_params); 

});




addEvent(this.Mimg, "click", function(e) {
    //GBL.MAIN_TABS.switchToDynamicTab(function(a_contentDiv){
    
    //l_contentTBody.id = "hey1223";
    //  $("hey1223").hide("slide", {}, 1000);
       //  $("hey1223").hide("slide", { direction: "down" }, 1000);
          try{
            l_self.m_contentTBody.innerHTML = "";    // IE
        } catch(error){
	
while(l_self.m_contentTBody.hasChildNodes())
{
l_self.m_contentTBody.removeChild(l_self.m_contentTBody.firstChild);
}
	}
	 
			//l_contentTBody.innerHTML = "";
			   var l_loadingDiv = document.createElement("div");
       l_self.m_contentTBody.appendChild(l_loadingDiv);
        l_loadingDiv.style.padding = "10px";
      //  l_loadingDiv.innerHTML = "<span style='color:#FF6F00; font-weight:bold;'> Loading Kill list... please wait  </span>";
 
   try{
    l_loadingDiv.innerHTML = "Loading Assassin list... please wait";
           // l_self.m_contentTBody.innerHTML = "";    // IE
        } catch(error){
	
	}
	 

        var l_params = {};
        l_params.aNID = GBL.MAIN_DATA.getViewer().getUserId();
	l_params.aT = "2";
	l_params.f = "JGetAssassinListNetwork";
       /*
        	l_params.f = "JGetTopPlayers3";
        var l_self = this;
	// http://crime.servegame.com/JSonService.aspx?f=JGetTopPlayers3&Page=2
	// 
        makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx", function(a_responseData){l_self.onGetMadeMen(a_responseData);}, l_params);
   
var l_params = {};
        l_params.aNID = GBL.MAIN_DATA.getViewer().getUserId();
	l_params.aT = "2";
	l_params.f = "JGetFightListNetwork";
       /*
        	l_params.f = "JGetTopPlayers3";
        var l_self = this;
	// http://crime.servegame.com/JSonService.aspx?f=JGetTopPlayers3&Page=2
	// 
        makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx", function(a_responseData){l_self.onGetMadeMen(a_responseData);}, l_params);
   
       */
    //    makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/get_fight_list", function(a_responseData){
	makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx", function(a_responseData){
           l_loadingDiv.style.display = "none";
           l_self.onGetFightList2(a_responseData, l_self.m_contentTBody,"http://www.laasex.com/crime/images/UI/buttons/ASSA2.png","http://www.laasex.com/crime/images/UI/buttons/ASSD2.png");
        },l_params); 

});


addEvent(this.Limg, "click", function(e) {
    //GBL.MAIN_TABS.switchToDynamicTab(function(a_contentDiv){
    
    //l_contentTBody.id = "hey1223";
    //  $("hey1223").hide("slide", {}, 1000);
       //  $("hey1223").hide("slide", { direction: "down" }, 1000);
          try{
            l_self.m_contentTBody.innerHTML = "";    // IE
        } catch(error){
	
while(l_self.m_contentTBody.hasChildNodes())
{
l_self.m_contentTBody.removeChild(l_self.m_contentTBody.firstChild);
}
	}
	 
			//l_contentTBody.innerHTML = "";
			   var l_loadingDiv = document.createElement("div");
       l_self.m_contentTBody.appendChild(l_loadingDiv);
        l_loadingDiv.style.padding = "10px";
      //  l_loadingDiv.innerHTML = "<span style='color:#FF6F00; font-weight:bold;'> Loading Kill list... please wait  </span>";
 
   try{
    l_loadingDiv.innerHTML = "Loading Fight list... please wait";
           // l_self.m_contentTBody.innerHTML = "";    // IE
        } catch(error){
	
	}
	 

        var l_params = {};
        l_params.aNID = GBL.MAIN_DATA.getViewer().getUserId();
	l_params.aT = "2";
	l_params.f = "JGetFightListNetwork";
       /*
        	l_params.f = "JGetTopPlayers3";
        var l_self = this;
	// http://crime.servegame.com/JSonService.aspx?f=JGetTopPlayers3&Page=2
	// 
        makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx", function(a_responseData){l_self.onGetMadeMen(a_responseData);}, l_params);
   
var l_params = {};
        l_params.aNID = GBL.MAIN_DATA.getViewer().getUserId();
	l_params.aT = "2";
	l_params.f = "JGetFightListNetwork";
       /*
        	l_params.f = "JGetTopPlayers3";
        var l_self = this;
	// http://crime.servegame.com/JSonService.aspx?f=JGetTopPlayers3&Page=2
	// 
        makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx", function(a_responseData){l_self.onGetMadeMen(a_responseData);}, l_params);
   
       */
    //    makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/get_fight_list", function(a_responseData){
	makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx", function(a_responseData){
           l_loadingDiv.style.display = "none";
           l_self.onGetFightList2(a_responseData, l_self.m_contentTBody,"http://www.laasex.com/crime/images/UI/stats/O2.png","http://www.laasex.com/crime/images/UI/stats/D2.png");
        },l_params); 

});

addEvent(this.Jimg, "click", function(e) {
    //GBL.MAIN_TABS.switchToDynamicTab(function(a_contentDiv){
    
    //l_contentTBody.id = "hey1223";
    //  $("hey1223").hide("slide", {}, 1000);
       //  $("hey1223").hide("slide", { direction: "down" }, 1000);
          try{
            l_self.m_contentTBody.innerHTML = "";    // IE
        } catch(error){
	
while(l_self.m_contentTBody.hasChildNodes())
{
l_self.m_contentTBody.removeChild(l_self.m_contentTBody.firstChild);
}
	}
	 
			//l_contentTBody.innerHTML = "";
			   var l_loadingDiv = document.createElement("div");
       l_self.m_contentTBody.appendChild(l_loadingDiv);
        l_loadingDiv.style.padding = "10px";
      //  l_loadingDiv.innerHTML = "<span style='color:#FF6F00; font-weight:bold;'> Loading Kill list... please wait  </span>";
 
   try{
    l_loadingDiv.innerHTML = "Loading GTA list... please wait";
           // l_self.m_contentTBody.innerHTML = "";    // IE
        } catch(error){
	
	}
	 

        var l_params = {};
        l_params.aNID = GBL.MAIN_DATA.getViewer().getUserId();
	l_params.aT = "2";
	l_params.f = "JGetFightListGTA";
       /*
        	l_params.f = "JGetTopPlayers3";
        var l_self = this;
	// http://crime.servegame.com/JSonService.aspx?f=JGetTopPlayers3&Page=2
	// 
        makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx", function(a_responseData){l_self.onGetMadeMen(a_responseData);}, l_params);
   
       */
    //    makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/get_fight_list", function(a_responseData){
	makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx", function(a_responseData){
           l_loadingDiv.style.display = "none";
           l_self.onGetFightList5(a_responseData, l_self.m_contentTBody);
        },l_params);
});

// JGetFriendsListLevelNetwork
	//	});; });

addEvent(this.Aimg, "click", function(e) { 
		     try{
            l_self.m_contentTBody.innerHTML = "";    // IE
        } catch(error){
	while(l_self.m_contentTBody.hasChildNodes())
{
l_self.m_contentTBody.removeChild(l_self.m_contentTBody.firstChild);
}
	}
			var l_loadingDiv = document.createElement("div");
       l_self.m_contentTBody.appendChild(l_loadingDiv);
        l_loadingDiv.style.padding = "10px";
	try {
        l_loadingDiv.innerHTML = "<span style='color:#FF6F00; font-weight:bold;'> Loading Kill list... please wait  </span>";
    // l_self.m_contentTBody.innerHTML = "";    // IE
        } catch(error){
	
	}

        var l_params = {};
        l_params.attacteruserid = GBL.MAIN_DATA.getViewer().getUserId();
	l_params.NetworkType = "4";
        
    //    makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/get_fight_list", function(a_responseData){
	 makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/GetFightListNetwork", function(a_responseData){
           l_loadingDiv.style.display = "none";
           l_self.onGetFightList(a_responseData, l_self.m_contentTBody);
        },l_params);
		 });

addEvent(this.Bimg, "click", function(e) {
 //   GBL.MAIN_TABS.switchToDynamicTab(
				
			     try{
            l_self.m_contentTBody.innerHTML = "";    // IE
        } catch(error){
	while(l_self.m_contentTBody.hasChildNodes())
{
l_self.m_contentTBody.removeChild(l_self.m_contentTBody.firstChild);
}
	}
			var l_loadingDiv = document.createElement("div");
       l_self.m_contentTBody.appendChild(l_loadingDiv);
        l_loadingDiv.style.padding = "10px";
        try {
        l_loadingDiv.innerHTML = "<span style='color:#FF6F00; font-weight:bold;'> Loading Kill list... please wait  </span>";
    // l_self.m_contentTBody.innerHTML = "";    // IE
        } catch(error){
	
	}

        var l_params = {};
        l_params.attacteruserid = GBL.MAIN_DATA.getViewer().getUserId();
	l_params.NetworkType = "1024";
    
    //    makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/get_fight_list", function(a_responseData){
	 makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/GetFightListNetwork", function(a_responseData){
           l_loadingDiv.style.display = "none";
           l_self.onGetFightList(a_responseData, l_self.m_contentTBody);
        },l_params);
		
});
		
//});

addEvent(this.Cimg, "click", function(e) {
    //GBL.MAIN_TABS.switchToDynamicTab(function(a_contentDiv){
			     try{
            l_self.m_contentTBody.innerHTML = "";    // IE
        } catch(error){
	while(l_self.m_contentTBody.hasChildNodes())
{
l_self.m_contentTBody.removeChild(l_self.m_contentTBody.firstChild);
}
	}
			var l_loadingDiv = document.createElement("div");
        l_self.m_contentTBody.appendChild(l_loadingDiv);
        l_loadingDiv.style.padding = "10px";
        try {
        l_loadingDiv.innerHTML = "<span style='color:#FF6F00; font-weight:bold;'> Loading Kill list... please wait  </span>";
    // l_self.m_contentTBody.innerHTML = "";    // IE
        } catch(error){
	
	}

        var l_params = {};
        l_params.attacteruserid = GBL.MAIN_DATA.getViewer().getUserId();
	l_params.NetworkType = "8";
        
    //    makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/get_fight_list", function(a_responseData){
	 makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/GetFightListNetwork", function(a_responseData){
           l_loadingDiv.style.display = "none";
           l_self.onGetFightList(a_responseData, l_self.m_contentTBody);
        },l_params);
});

//});; });


//this.Dimg.innerHTML = "<img style='margin-left:auto; margin-right:auto;' src='http://www.bigideastech.com/crime/images/UI/buttons/pets.jpg'/> ";

addEvent(this.Dimg, "click", function(e) {
    //GBL.MAIN_TABS.switchToDynamicTab(function(a_contentDiv){
    
//l_contentTBody.id = "hey1223";
    //  $("hey1223").hide("slide", {}, 1000);
    //     $("hey1223").hide("slide", { direction: "down" }, 1000);

			     try{
            l_self.m_contentTBody.innerHTML = "";    // IE
        } catch(error){
	while(l_self.m_contentTBody.hasChildNodes())
{
l_self.m_contentTBody.removeChild(l_self.m_contentTBody.firstChild);
}
	}
			var l_loadingDiv = document.createElement("div");
        l_self.m_contentTBody.appendChild(l_loadingDiv);
        l_loadingDiv.style.padding = "10px";
        try {
        l_loadingDiv.innerHTML = "<span style='color:#FF6F00; font-weight:bold;'> Loading Kill list... please wait  </span>";
    // l_self.m_contentTBody.innerHTML = "";    // IE
        } catch(error){
	
	}

        var l_params = {};
        l_params.attacteruserid = GBL.MAIN_DATA.getViewer().getUserId();
	l_params.NetworkType = "16";
        
    //    makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/get_fight_list", function(a_responseData){
	 makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/GetFightListNetwork", function(a_responseData){
           l_loadingDiv.style.display = "none";
           l_self.onGetFightList(a_responseData, l_self.m_contentTBody);
        },l_params);
});
//});; });





        var l_headerTR = document.createElement("tr");
         this.m_contentTBody.appendChild(l_headerTR);

        var l_td = document.createElement("td");
        l_headerTR.appendChild(l_td);
        addHeaderStyle(l_td);
        l_td.style.width = "150px";
        l_td.innerHTML = this.m_mobNameLabel;

        l_td = document.createElement("td");
        l_headerTR.appendChild(l_td);
        addHeaderStyle(l_td); 
        l_td.style.width = "100px";  
        l_td.innerHTML = this.m_mobSizeLabel;

        l_td = document.createElement("td");
        l_headerTR.appendChild(l_td);
        addHeaderStyle(l_td);
        l_td.style.width = "100px";
        l_td.innerHTML = this.m_mobNetworkLabel;

		l_td = document.createElement("td");
        l_headerTR.appendChild(l_td);
        addHeaderStyle(l_td);
        l_td.style.width = "100px";
        l_td.innerHTML = this.m_mobActionLabel;
		
		
        var l_loadingDiv = document.createElement("div");
        this.m_containerDiv.appendChild(l_loadingDiv);
        l_loadingDiv.style.padding = "10px";
        l_loadingDiv.innerHTML = "<span style='color:#FF6F00; font-weight:bold;'> Loading Kill list... please wait  </span>";

/*
        var l_params = {};
        l_params.attacteruserid = GBL.MAIN_DATA.getViewer().getUserId();
        var l_self = this;
    //    makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/get_fight_list", function(a_responseData){
	 makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/GetFightList", function(a_responseData){
           l_loadingDiv.style.display = "none";
           l_self.onGetFightList(a_responseData,  l_self.m_contentTBody);
        },l_params);*/
		   var l_params = {};
        l_params.aNID = GBL.MAIN_DATA.getViewer().getUserId();
	l_params.aT = "2";
	l_params.f = "JGetFightListNetwork";
       /*
        	l_params.f = "JGetTopPlayers3";
        var l_self = this;
	// http://crime.servegame.com/JSonService.aspx?f=JGetTopPlayers3&Page=2
	// 
        makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx", function(a_responseData){l_self.onGetMadeMen(a_responseData);}, l_params);
   
       */
    //    makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/get_fight_list", function(a_responseData){
	makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx", function(a_responseData){
           l_loadingDiv.style.display = "none";
           l_self.onGetFightList2(a_responseData, l_self.m_contentTBody,"http://www.laasex.com/crime/images/UI/stats/O2.png","http://www.laasex.com/crime/images/UI/stats/D2.png");
        },l_params); 
	 
    }
// jsonS = parseJSON2(a_responseData.text);//.parseJSON();


 FightListDiv.prototype.onGetFightList5 = function(a_responseData, a_contentTBody){
  //  a_contentTBody.id ="hey1223";
 while(a_contentTBody.hasChildNodes())
{
a_contentTBody.removeChild(a_contentTBody.firstChild);
}
jsonS = parseJSON2(a_responseData.text);//.parseJSON();
       // var l_xmlDoc = getGadgetResponseData(a_responseData);
       // var l_numTargets = undefined;
        //if(isValid(jsonS)){
     //       try{
	    var l_StatsInfo = document.createElement("table");
			
				while(this.m_title.hasChildNodes())
{
this.m_title.removeChild(this.m_title.firstChild);
}
			
			this.m_title.appendChild(l_StatsInfo);
			
			
			
			
			var l_mainTabletbody=   document.createElement("tbody");
			l_StatsInfo.appendChild(l_mainTabletbody);
			
	var l_mainTabletr =   document.createElement("tr");
	l_mainTabletbody.appendChild(l_mainTabletr);
	
	//var l_mainTabletr2 =   document.createElement("tr");
	var l_mainTabletd1 =   document.createElement("td");
	
	l_mainTabletr.appendChild(l_mainTabletd1);
	l_mainTabletd1.innerHTML = ' <img style=\'margin-left:auto; margin-right:auto; background-repeat: repeat-x;\' src=\'http://www.laasex.com/crime/images/UI/buttons/GTAA.png\'/><span style=\'font-size:10px;color:#E70707; font-weight:bold;\'><b>Attack:</b></span><span style=\'font-size:10px;color:#FFFFFF; font-weight:bold;\'><b>' + jsonS.outer.xml.user.Attack + '</b></span>';
	
	
	// this.Kimg.innerHTML = "<img style='margin-left:auto; margin-right:auto; background-repeat: repeat-x;' src='http://www.laasex.com/crime/images/UI/icons/bullet-holes1.png'/> ";
	
	//jsonS.outer.xml.ADamageGuns
	//jsonS.outer.xml.ATopWeaponIcon
	/*
		{"outer":{"xml":{"user":{"ADamageGuns":"9120","ADamageArmor":"1937","ADamageVehicles":"262","ADamageItems":"691","ADamagePets":"1307","ADamageSpecials":"117","ADamageLand":"0","DDamageGuns":"6472","DDamageArmor":"2137","DDamageVehicles":"15100","DDamageItems":"3171","DDamagePets":"1186","DDamageLand":"0","NumWeaponsA":"151","NumWeaponsD":"151","NumVehiclesA":"151","NumVehiclesD":"151","NumArmorA":"132","NumArmorD":"132","NumItemsA":"151","NumItemsD":"151","NumLandA":"0","NumLandD":"0","NumPetsA":"151","NumPetsD":"151","NumSpecialsA":"18","NumSpecialsD":"18","ATopWeaponIcon":"big-hammer-120x80.png","ATopWeaponName":"Big Hammer","DTopWeaponIcon":"brass_knucles-120x80.png","DTopWeaponName":"brass_knucles-120x80.png","ATopVehiclesIcon":"Oka.png","ATopVehiclesName":"Oka","DTopVehiclesIcon":"quad.png","DTopVehiclesName":"quad.png","ATopArmorIcon":"http://bigideastech.com/c","ATopArmorName":"Bullet Proof vest","DTopArmorIcon":"http://bigideastech.com/c","DTopArmorName":"http://bigideastech.com/c","ATopItemsIcon":"http://www.bigideastech.c","ATopItemsName":"Bullet Proof Folder","DTopItemsIcon":"http://www.bigideastech.c","DTopItemsName":"http://www.bigideastech.c","ATopPetsIcon":"Yorkie-120x80.jpg","ATopPetsName":"Yorkie","DTopPetsIcon":"Yorkie-120x80.jpg","DTopPetsName":"Yorkie-120x80.jpg","ATopSpecialsIcon":"http://p.laasex.com/pimpw","ATopSpecialsName":"Speicial Item","DTopSpecialsIcon":"http://p.laasex.com/pimpw","DTopSpecialsName":"http://p.laasex.com/pimpw"}
		   
		*/   
		// calcpercent
		//this.m_sidestats.innerHTML = 'NumGuns: ' + jsonS.outer.xml.numfriends + ' guns: ' + jsonS.outer.xml.user.NumWeaponsA  + ' armor: ' + jsonS.outer.xml.user.NumArmorA; 
		
	/*	var l_gunsInfo =  document.createElement("div");
		l_gunsInfo.innerHTML =  + jsonS.outer.xml.user.NumWeaponsA + '/' + jsonS.outer.xml.numfriends + ' weapons '; 
		      l_gunsInfo.style.color = "#E7CF07";
        l_gunsInfo.style.textAlign = "center";
        l_gunsInfo.style.fontSize = "10px";
        l_gunsInfo.style.fontWeight = "bold";
		
		
			var l_gunsBar =  document.createElement("div");
			
			l_gunsBar.style.width =  "138px";
			l_gunsBar.style.height =  "25px";
			
			var l_gunsBar2 =  document.createElement("div");
			l_gunsBar.appendChild(l_gunsBar2);
			var p = calcpercent(jsonS.outer.xml.user.NumWeaponsA,jsonS.outer.xml.numfriends);
		
			l_gunsBar2.style.backgroundImage = "url('http://www.bigideastech.com/crime/images/UI/buttons/progressR.png')";
			l_gunsBar2.style.width =  p+"%";
			l_gunsBar2.style.height =  "25px";
		
			
		this.m_sidestats.appendChild(l_gunsInfo);
			this.m_sidestats.appendChild(l_gunsBar);
			*/
			//equipment.png
			
			 //var l_SideStats = document.createElement("table");
			 
		var	l_headersidestats =  document.createElement("div");
			
			l_headersidestats.style.backgroundImage = "url('http://www.bigideastech.com/crime/images/UI/buttons/equipment.png')";
			l_headersidestats.style.width =  "100px";
			l_headersidestats.style.height =  "25px";
			
			while(this.m_sidestats.hasChildNodes())
{
this.m_sidestats.removeChild(this.m_sidestats.firstChild);
}
			//	var l_mainsideTabletbody=   document.createElement("tbody");
		//	l_SideStats.appendChild(l_mainsideTabletbody);
			
	//var l_sideTabletr =   document.createElement("tr");
	//l_mainsideTabletbody.appendChild(l_sideTabletr);
	
	//var l_mainTabletr2 =   document.createElement("tr");
//	var l_mainTabletd1 =   document.createElement("td");
	
	//l_sideTabletr.appendChild(l_headersidestats);
	
			this.m_sidestats.appendChild(l_headersidestats);
			
		this.m_sidestats.appendChild(ItemInfoFight(jsonS.outer.xml.user.NumWeaponsA,jsonS.outer.xml.numfriends,'Weapons'));
	 this.m_sidestats.appendChild(ItemBarFight(jsonS.outer.xml.user.NumWeaponsA,jsonS.outer.xml.numfriends));
// NumWeaponsA":"151","NumWeaponsD":"151","NumVehiclesA":"151","NumVehiclesD":"151",
//"NumArmorA":"132","NumArmorD":"132","NumItemsA":"151","NumItemsD":"151","NumLandA":"0","NumLandD":"0","NumPetsA":"151","NumPetsD":"151","NumSpecialsA
	 
				this.m_sidestats.appendChild(ItemInfoFight(jsonS.outer.xml.user.NumArmorA,jsonS.outer.xml.numfriends,'Armors'));
	 this.m_sidestats.appendChild(ItemBarFight(jsonS.outer.xml.user.NumArmorA,jsonS.outer.xml.numfriends));
	 
	 		this.m_sidestats.appendChild(ItemInfoFight(jsonS.outer.xml.user.NumArmorA,jsonS.outer.xml.numfriends,'Vehicles'));
	 this.m_sidestats.appendChild(ItemBarFight(jsonS.outer.xml.user.NumArmorA,jsonS.outer.xml.numfriends));
	 
	 	 		this.m_sidestats.appendChild(ItemInfoFight(jsonS.outer.xml.user.NumItemsA,jsonS.outer.xml.numfriends,'Items'));
	 this.m_sidestats.appendChild(ItemBarFight(jsonS.outer.xml.user.NumItemsA,jsonS.outer.xml.numfriends));
	 
			 		this.m_sidestats.appendChild(ItemInfoFight(jsonS.outer.xml.user.NumPetsA,jsonS.outer.xml.numfriends,'Pets'));
	 this.m_sidestats.appendChild(ItemBarFight(jsonS.outer.xml.user.NumPetsA,jsonS.outer.xml.numfriends));
		
			 		this.m_sidestats.appendChild(ItemInfoFight(jsonS.outer.xml.user.NumSpecialsA,jsonS.outer.xml.numfriends,'Specials'));
	 this.m_sidestats.appendChild(ItemBarFight(jsonS.outer.xml.user.NumSpecialsA,jsonS.outer.xml.numfriends));
	
	var l_addiv = document.createElement('div');
	l_addiv.innerHTML += '<iframe marginwidth="0" marginheight="0" src="http://www.sandiegorhythmicgymnastics.com/2/adparlor120x600.htm" scrolling="no" width="120" frameborder="0" height="600"></iframe><br/>';
	l_addiv.innerHTML += '<iframe marginwidth="0" marginheight="0" src="http://www.sandiegorhythmicgymnastics.com/2/cubics120x600.htm" scrolling="no" width="120" frameborder="0" height="600"></iframe><br/>';
	l_addiv.innerHTML += '<iframe marginwidth="0" marginheight="0" src="http://www.sandiegorhythmicgymnastics.com/2/clicksor120x600.htm" scrolling="no" width="120" frameborder="0" height="600"></iframe><br/>';
	l_addiv.innerHTML += '<iframe marginwidth="0" marginheight="0" src="http://www.sandiegorhythmicgymnastics.com/2/google120x600.htm" scrolling="no" width="120" frameborder="0" height="600"></iframe><br/>';
	l_addiv.innerHTML += '<iframe marginwidth="0" marginheight="0" src="http://www.sandiegorhythmicgymnastics.com/2/adparlor125x125.htm" scrolling="no" width="125" frameborder="0" height="125"></iframe><br/>';
	l_addiv.innerHTML += '<iframe marginwidth="0" marginheight="0" src="http://www.sandiegorhythmicgymnastics.com/2/cubics125x125.htm" scrolling="no" width="125" frameborder="0" height="125"></iframe><br/>';
		l_addiv.innerHTML += '<iframe marginwidth="0" marginheight="0" src="http://www.sandiegorhythmicgymnastics.com/2/google120x240.htm" scrolling="no" width="120" frameborder="0" height="240"></iframe><br/>';
		l_addiv.innerHTML += '<iframe marginwidth="0" marginheight="0" src="http://www.sandiegorhythmicgymnastics.com/2/adparlor125x60.htm" scrolling="no" width="125" frameborder="0" height="60"></iframe><br/>';
		l_addiv.innerHTML += '<iframe marginwidth="0" marginheight="0" src="http://www.sandiegorhythmicgymnastics.com/2/clicksor120x240.htm" scrolling="no" width="120" frameborder="0" height="240"></iframe><br/>';
	
	 
	//
	//adparlor125x60.htm
	this.m_sidestats.appendChild(l_addiv);
	
	// document.getElementById('main').innerHTML = '<iframe marginwidth="0" marginheight="0" src="http://www.sandiegorhythmicgymnastics.com/2/adparlor600x600.htm" scrolling="no" width="645" frameborder="0" height="60"></iframe>';
 	
		
	if(jsonS.outer.xml.user.ATopWeaponName){
		ItemTopFight(jsonS.outer.xml.user.ATopWeaponIcon,"http://www.bigideastech.com/crime/images/weapons/icons/",jsonS.outer.xml.user.ATopWeaponName,l_mainTabletr);
	} 
	
	/*var l_mainTabletd3 =   document.createElement("td");
	l_mainTabletr.appendChild(l_mainTabletd3); 
	
	l_mainTabletd3.innerHTML =  '<img style=\'margin-left:auto; margin-right:auto; width:50%;   height:50%;   background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/armor/icons/'+jsonS.outer.xml.user.ATopArmorIcon+'\'/>';
	*/
	if(jsonS.outer.xml.user.ATopArmorName){
	ItemTopFight(jsonS.outer.xml.user.ATopArmorIcon,"http://www.bigideastech.com/crime/images/armor/icons/",jsonS.outer.xml.user.ATopArmorName,l_mainTabletr);
	}
	
	
	
	/*var l_mainTabletd4 =   document.createElement("td");
	l_mainTabletr.appendChild(l_mainTabletd4);
	l_mainTabletd4.innerHTML =  '<img style=\'margin-left:auto; margin-right:auto; width:50%;   height:50%;   background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/cars/icons/'+jsonS.outer.xml.user.ATopVehiclesIcon+'\'/>';
	*/
	if(jsonS.outer.xml.user.ATopVehiclesName){
	ItemTopFight(jsonS.outer.xml.user.ATopVehiclesIcon,"http://www.bigideastech.com/crime/images/cars/icons/",jsonS.outer.xml.user.ATopVehiclesName,l_mainTabletr);
	}
	
	/*var l_mainTabletd5 =   document.createElement("td");
	l_mainTabletr.appendChild(l_mainTabletd5);
	l_mainTabletd5.innerHTML = '<img style=\'margin-left:auto; margin-right:auto; width:50%;   height:50%;   background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/items/icon/'+jsonS.outer.xml.user.ATopItemsIcon+'\'/>';
	*/
	if(jsonS.outer.xml.user.ATopItemsName){
	  ItemTopFight(jsonS.outer.xml.user.ATopItemsIcon,"http://www.bigideastech.com/crime/images/items/icon/",jsonS.outer.xml.user.ATopItemsName,l_mainTabletr);
	}
	/*
	var l_mainTabletd6 =   document.createElement("td");
	l_mainTabletr.appendChild(l_mainTabletd6);
	l_mainTabletd6.innerHTML =  '<img style=\'margin-left:auto; margin-right:auto; width:50%;   height:50%;   background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/pets/icons/'+jsonS.outer.xml.user.ATopPetsIcon+'\'/>';
	*/
	if(jsonS.outer.xml.user.ATopPetsName)
	{
	ItemTopFight(jsonS.outer.xml.user.ATopPetsIcon,"http://www.bigideastech.com/crime/images/pets/icons/",jsonS.outer.xml.user.ATopPetsName,l_mainTabletr);
	}
	
	
	/*	var l_mainTabletd7 =   document.createElement("td");
	l_mainTabletr.appendChild(l_mainTabletd7);
	l_mainTabletd7.innerHTML =  '<img style=\'margin-left:auto; margin-right:auto; width:50%;   height:50%;   background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/specials/icons/'+jsonS.outer.xml.user.ATopSpecialsIcon+'\'/>';
	
	*/
	if(jsonS.outer.xml.user.ATopSpecialsName){
	ItemTopFight(jsonS.outer.xml.user.ATopSpecialsIcon,"http://www.bigideastech.com/crime/images/specials/icons/",jsonS.outer.xml.user.ATopSpecialsName,l_mainTabletr);
	}
	
	/*
	 var l_mainTabletd8 =   document.createElement("td");
	l_mainTabletr.appendChild(l_mainTabletd8);
	l_mainTabletd8.innerHTML = 'Land: ' + jsonS.outer.xml.user.ADamageLand + '<img style=\'margin-left:auto; margin-right:auto; width:50%;   height:50%;   background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/land/icons/'+jsonS.outer.xml.user.ATopLandIcon+'\'/>';
	*/
	
	
	
		var l_mainTabletr2 =   document.createElement("tr");
	l_mainTabletbody.appendChild(l_mainTabletr2);
	//l_mainTabletr2.height = "100px";
	//l_mainTabletr2.style.height = "100px";
	var l_mainTabletd10 =   document.createElement("td");
	
	l_mainTabletr2.appendChild(l_mainTabletd10);
	l_mainTabletd10.innerHTML = '<img style=\'margin-left:auto; margin-right:auto; background-repeat: repeat-x;\' src=\'http://www.laasex.com/crime/images/UI/buttons/GTAD.png\'/><span style=\'font-size:10px;color:#2F1ED0; font-weight:bold;\'><b>Defense:</b></span><span style=\'font-size:10px;color:#FFFFFF; font-weight:bold;\'><b>' + jsonS.outer.xml.user.Defense + '</b></span>';
	/*
	var l_mainTabletd11 =   document.createElement("td");
			l_mainTabletr2.appendChild(l_mainTabletd11);
			l_mainTabletd11.innerHTML =  '<img style=\'margin-left:auto; margin-right:auto; width:70%;   height:70%;   background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/weapons/icons/'+jsonS.outer.xml.user.DTopWeaponIcon+'\'/>';
	*/
if(jsonS.outer.xml.user.DTopWeaponName){
	ItemTopFight(jsonS.outer.xml.user.DTopWeaponIcon,"http://www.bigideastech.com/crime/images/weapons/icons/",jsonS.outer.xml.user.DTopWeaponName,l_mainTabletr2);
	}
	
	/*
	var l_mainTabletd12 =   document.createElement("td");
	l_mainTabletr2.appendChild(l_mainTabletd12);
	
	l_mainTabletd12.innerHTML =  '<img style=\'margin-left:auto; margin-right:auto; width:50%;   height:50%;   background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/armor/icons/'+jsonS.outer.xml.user.DTopArmorIcon+'\'/>';
	*/
	if(jsonS.outer.xml.user.DTopArmorName){
	ItemTopFight(jsonS.outer.xml.user.DTopArmorIcon,"http://www.bigideastech.com/crime/images/armor/icons/",jsonS.outer.xml.user.DTopArmorName,l_mainTabletr2);
	}
	
	/*
	var l_mainTabletd13 =   document.createElement("td");
	l_mainTabletr2.appendChild(l_mainTabletd13);
	l_mainTabletd13.innerHTML =  '<img style=\'margin-left:auto; margin-right:auto; width:50%;   height:50%;   background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/cars/icons/'+jsonS.outer.xml.user.DTopVehiclesIcon+'\'/>';
	*/
	if(jsonS.outer.xml.user.DTopVehiclesName){
	ItemTopFight(jsonS.outer.xml.user.DTopVehiclesIcon,"http://www.bigideastech.com/crime/images/cars/icons/",jsonS.outer.xml.user.DTopVehiclesName,l_mainTabletr2);
	}
	
	/*var l_mainTabletd14 =   document.createElement("td");
	l_mainTabletr2.appendChild(l_mainTabletd14);
	l_mainTabletd14.innerHTML = '<img style=\'margin-left:auto; margin-right:auto; width:50%;   height:50%;   background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/items/icon/'+jsonS.outer.xml.user.DTopItemsIcon+'\'/>';
	*/
	if(jsonS.outer.xml.user.DTopItemsName){
	ItemTopFight(jsonS.outer.xml.user.DTopItemsIcon,"http://www.bigideastech.com/crime/images/items/icon/",jsonS.outer.xml.user.DTopItemsName,l_mainTabletr2);
	}
	    
	/*
	var l_mainTabletd15 =   document.createElement("td");
	l_mainTabletr2.appendChild(l_mainTabletd15);
	l_mainTabletd15.innerHTML =  '<img style=\'margin-left:auto; margin-right:auto; width:50%;    height:50%;  background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/pets/icons/'+jsonS.outer.xml.user.DTopPetsIcon+'\'/>';
	 */
	 if(jsonS.outer.xml.user.DTopPetsName){
	 ItemTopFight(jsonS.outer.xml.user.DTopPetsIcon,"http://www.bigideastech.com/crime/images/pets/icons/",jsonS.outer.xml.user.DTopPetsName,l_mainTabletr2);
	}
	   
	
	   /*
		var l_mainTabletd16 =   document.createElement("td");
	l_mainTabletr2.appendChild(l_mainTabletd16);
	l_mainTabletd16.innerHTML =  '<img style=\'margin-left:auto; margin-right:auto;width:50%;    height:50%;   background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/specials/icons/'+jsonS.outer.xml.user.DTopSpecialsIcon+'\'/>';
	*/
	 if(jsonS.outer.xml.user.DTopSpecialsName){
	ItemTopFight(jsonS.outer.xml.user.DTopSpecialsIcon,"http://www.bigideastech.com/crime/images/specials/icons/",jsonS.outer.xml.user.DTopSpecialsName,l_mainTabletr2);
	}
	
	
	/*
		var l_mainTabletr2 =   document.createElement("tr");
	l_mainTabletbody.appendChild(l_mainTabletr2);
	
	var l_mainTabletd10 =   document.createElement("td");
	
	l_mainTabletr.appendChild(l_mainTabletd10);
	l_mainTabletd10.innerHTML = '<img style=\'margin-left:auto; margin-right:auto; background-repeat: repeat-x;\' src=\'http://www.laasex.com/crime/images/UI/stats/D2.png\'/> ';
	
	var l_mainTabletd11 =   document.createElement("td");
			l_mainTabletr2.appendChild(l_mainTabletd11);
			l_mainTabletd11.innerHTML = 'Guns: ' + jsonS.outer.xml.user.DDamageGuns + '<img style=\'margin-left:auto; margin-right:auto; width:50px; width:50px; height:33px;  background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/weapons/icons/'+jsonS.outer.xml.user.DTopWeaponIcon+'\'/>';
	
	var l_mainTabletd12 =   document.createElement("td");
	l_mainTabletr2.appendChild(l_mainTabletd12);
	
	l_mainTabletd12.innerHTML = 'Armor: ' + jsonS.outer.xml.user.DDamageArmor + '<img style=\'margin-left:auto; margin-right:auto; width:50px; width:50px; height:33px;  background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/armor/icons/'+jsonS.outer.xml.user.DTopArmorIcon+'\'/>';
	
	var l_mainTabletd13 =   document.createElement("td");
	l_mainTabletr2.appendChild(l_mainTabletd13);
	l_mainTabletd13.innerHTML = 'Vehicles: ' + jsonS.outer.xml.user.DDamageVehicles + '<img style=\'margin-left:auto; margin-right:auto; width:50px; width:50px; height:33px;  background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/cars/icons/'+jsonS.outer.xml.user.DTopVehiclesIcon+'\'/>';
	
	
	var l_mainTabletd14 =   document.createElement("td");
	l_mainTabletr2.appendChild(l_mainTabletd14);
	l_mainTabletd14.innerHTML = 'Items: ' + jsonS.outer.xml.user.DDamageItems + '<img style=\'margin-left:auto; margin-right:auto; width:50px; width:50px; height:33px;  background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/items/icon/'+jsonS.outer.xml.user.DTopItemsIcon+'\'/>';
	
	    
	
	var l_mainTabletd15 =   document.createElement("td");
	l_mainTabletr2.appendChild(l_mainTabletd15);
	l_mainTabletd15.innerHTML = 'Pets: ' + jsonS.outer.xml.user.DDamagePets + '<img style=\'margin-left:auto; margin-right:auto; width:50px; width:50px; height:33px;  background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/pets/icons/'+jsonS.outer.xml.user.DTopPetsIcon+'\'/>';
	 
	
	   
		var l_mainTabletd16 =   document.createElement("td");
	l_mainTabletr2.appendChild(l_mainTabletd16);
	l_mainTabletd16.innerHTML = 'Specials: ' + jsonS.outer.xml.user.DDamageSpecials + '<img style=\'margin-left:auto; margin-right:auto; width:50px; width:50px; height:33px;  background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/specials/icons/'+jsonS.outer.xml.user.DTopSpecialsIcon+'\'/>';
	
	
	
	 var l_mainTabletd17 =   document.createElement("td");
	l_mainTabletr2.appendChild(l_mainTabletd17);
	l_mainTabletd17.innerHTML = 'Land: ' + jsonS.outer.xml.user.DDamageLand + '<img style=\'margin-left:auto; margin-right:auto; width:50px; width:50px; height:33px;  background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/Properties/icons/'+jsonS.outer.xml.user.DTopLandIcon+'\'/>';
	*/
		var l_mainTabletr3 =   document.createElement("tr");
	l_mainTabletbody.appendChild(l_mainTabletr3);
	
	var l_mainTabletd20 =   document.createElement("td");
	
	l_mainTabletr3.appendChild(l_mainTabletd20);
	l_mainTabletd20.innerHTML = '<img style=\'margin-left:auto; margin-right:auto; background-repeat: repeat-x;\' src=\'http://www.laasex.com/crime/images/UI/stats/f.png\'/><span style=\'font-size:10px;color:#0CC041; font-weight:bold;\'><b>Organization:</b></span><span style=\'font-size:10px;color:#FFFFFF; font-weight:bold;\'><b>' + jsonS.outer.xml.numfriends + '</b></span>';// '+jsonS.outer.xml.user.NumItemsA,jsonS.outer.xml.numfriends;
	//<span style=\'font-size:10px;color:#2F1ED0; font-weight:bold;\'><b>Defense:</b></span><span style=\'font-size:10px;color:#FFFFFF; font-weight:bold;\'><b>
	//	l_mainTabletr3.appendChild(l_mainTabletd20);
	//l_mainTabletd20.innerHTML = '<img style=\'margin-left:auto; margin-right:auto; background-repeat: repeat-x;\' src=\'http://www.laasex.com/crime/images/UI/stats/f.png\'/> '+jsonS.outer.xml.user.NumItemsA,jsonS.outer.xml.numfriends;
	/*
	,{"mob_class":"Mogul","UCT":"8","TN":"http://a60.ac-images.myspacecdn.com/images01/32/s_429b1dc4f16b3c47fd63c744bd82d52b.jpg","mob_name":"djajich","userid":"53541900","level":"167","mob_size":"63","usernetworkid":"2","ProfileURL":"http://www.myspace.com/Cory_Djajich"},{"mob_class":"Physco","UCT":"7","TN":"http://c2.ac-images.myspacecdn.com/images02/79/s_9d14db4e87154170bff21be50fd33b91.jpg","mob_name":"Str8","userid":"231695088","level":"168","mob_size":"58","usernetworkid":"2","ProfileURL":"http://www.myspace.com/nocchitloose"}]},"numfriends":"152","friends":{"Username":["LADY CAPONE","Wish you would","badangel","Pepper","Dark Crime Boss","cmobsta","Curtis Jackson","okok","funkyponger","nikkerbokker"],"TN":["http://c1.ac-images.myspacecdn.com/images01/21/s_401481f9dc9680fa4ecef26acf62b938.jpg","http://c1.ac-images.myspacecdn.com/images02/39/s_dc9e5c5a78164ace862294345442e174.jpg","http://a584.ac-images.myspacecdn.com/images01/44/s_dcbd27ac515cef1471e746a3fbc4bc17.jpg","http://a514.ac-images.myspacecdn.com/images01/93/s_69f9f30cd93ae37acbaa4d8f5b66b969.jpg","http://c3.ac-images.myspacecdn.com/images01/87/s_77db4ee6089cf422bf224e6733475426.jpg","http://c1.ac-images.myspacecdn.com/images02/42/s_3203d2dacf654217babb39618460ae48.jpg","http://a173.ac-images.myspacecdn.com/images01/88/s_060c995cd37d667bda13106f5ca4162c.jpg","http://x.myspacecdn.com/images/no_pic.gif","http://x.myspacecdn.com/images/no_pic.gif","http://a196.ac-images.myspacecdn.com/images01/50/s_65fb658da7117f9bd37681df95037efb.jpg"],"UCT":["1","1","5","8","5","7","10","2","7","8"],"lastlogin":["2009-10-31T13:52:34.880","2009-10-31T13:35:04.887","2009-10-31T02:21:08.167","2009-10-29T23:33:15.427","2009-10-28T11:10:56.303","2009-10-28T00:29:58.530","2009-10-26T00:31:12.230","2009-10-23T03:19:40.417","2009-10-22T23:43:35.617","2009-10-21T06:11:14.547"]}}}}
	*/
	if(jsonS.outer.xml.friends)
	{
	if(jsonS.outer.xml.numfriends > 2)
	{
	for(var i = 0; i < jsonS.outer.xml.friends.Username.length; i++)
	{
	var l_mainTableFriendTD =  document.createElement("td");
	
	var gentitle = jsonS.outer.xml.friends.Username[i] +" Last logged on: "+ jsonS.outer.xml.friends.lastlogin[i];
	//l_mainTableFriendTD.style.width = "80px";
	//l_mainTableFriendTD.style.height = "60px";
	
	l_mainTableFriendTD.innerHTML = "<span style='font-size:10px;color:#FFD927; font-weight:bold;'>"+ jsonS.outer.xml.friends.Username[i] + "</span><BR/>" + "<img style='margin-left:auto; margin-right:auto; width:50px; height:50px;' title='"+gentitle+"' alt='"+gentitle + "' "+"' src='"+jsonS.outer.xml.friends.TN[i]+"' />";
	
	//l_mainTableFriendTD.innerHTML = '<span style=\'font-size:10px;color:#FFD927; font-weight:bold;\'>'+ jsonS.outer.xml.friends.Username[i] + '</span><BR/><img title=\''+gentitle+'\' alt=\''+gentitle + '\' src=\''+jsonS.outer.xml.friends.TN[i]+'\' />';
	
	l_mainTabletr3.appendChild(l_mainTableFriendTD);
	
	}
	}
	else
	{
	
		var l_mainTableFriendTD =  document.createElement("td");
	
	var gentitle = jsonS.outer.xml.friends.Username +" Last logged on: "+ jsonS.outer.xml.friends.lastlogin;
	//l_mainTableFriendTD.style.width = "80px";
	//l_mainTableFriendTD.style.height = "60px";
	 
	l_mainTableFriendTD.innerHTML = "<span style='font-size:10px;color:#FFD927; font-weight:bold;'>"+ jsonS.outer.xml.friends.Username + "</span><BR/>" + "<img style='margin-left:auto; margin-right:auto; width:50px; height:50px;' title='"+gentitle+"' alt='"+gentitle + "' "+"' src='"+jsonS.outer.xml.friends.TN+"' />";
	
	//l_mainTableFriendTD.innerHTML = '<span style=\'font-size:10px;color:#FFD927; font-weight:bold;\'>'+ jsonS.outer.xml.friends.Username[i] + '</span><BR/><img title=\''+gentitle+'\' alt=\''+gentitle + '\' src=\''+jsonS.outer.xml.friends.TN[i]+'\' />';
	
	l_mainTabletr3.appendChild(l_mainTableFriendTD);
	
	
	
	}
	
	}
	
               // l_numTargets = parseInt(getXMLNodeValue(l_xmlDoc, "num_targets"));                

         //       var l_targetUserNodes = l_xmlDoc.getElementsByTagName("user");
		var count = 0;
		
		
                for(var l_index = 0; l_index < jsonS.outer.xml.targets.length; l_index++){
                  //  var l_friendUser = new User(undefined);
		     var l_enemyUser = new User(undefined);
		 //    var l_gain = '';
		 //    var l_timeago = '';
		     /*
		       l_friendUser.m_userId = jsonS.outer.xml.targets.user[l_index].fn_id;
		      l_friendUser.m_usernetworkid = jsonS.outer.xml.targets.user[l_index].fu_nd;
		     l_friendUser.m_mobName = jsonS.outer.xml.targets.user[l_index].fu_un;
		     l_friendUser.m_thumbnail_url = jsonS.outer.xml.targets.user[l_index].fu_tn;
		     */
		     
		     l_enemyUser.m_userId = jsonS.outer.xml.targets[l_index].u.user_id;
		     l_enemyUser.m_usernetworkid = jsonS.outer.xml.targets[l_index].u.networktype;
		       l_enemyUser.m_mobName = jsonS.outer.xml.targets[l_index].u.username;
		       l_enemyUser.m_thumbnail_url = jsonS.outer.xml.targets[l_index].u.tn;
		            l_enemyUser.m_numcars = jsonS.outer.xml.targets[l_index].u.numcars;
					
			  a_contentTBody.appendChild(this.createContentElementG(l_enemyUser));
		   
			var l_carGTA = "";
			var l_userCarsTR = document.createElement('tr');
			var l_userCarsTD = document.createElement('td');
			
			
			var l_icarCounter = 0;
			
			for(var p_index = 0; p_index < jsonS.outer.xml.targets[l_index].u.cars.length; p_index++){
			
			var altgen = jsonS.outer.xml.targets[l_index].u.cars[p_index].CarName + ' x ' + jsonS.outer.xml.targets[l_index].u.cars[p_index].Number;
			 l_icarCounter++;
			 if(!(l_icarCounter%4)) 
			 {
			 	var l_userCarsTR = document.createElement('tr');
			var l_userCarsTD = document.createElement('td');
			 l_userCarsTD.innerHTML = l_carGTA; 
			 l_userCarsTR.appendChild(l_userCarsTD);
			 
			
			a_contentTBody.appendChild(l_userCarsTR);
			 l_carGTA = "";
			 }
			    l_carGTA += "<img style='margin-left:auto; margin-right:auto;' title='"+altgen+"' alt='"+altgen + "' src='"+jsonS.outer.xml.targets[l_index].u.cars[p_index].Icon+"'/>";
			   //  a_contentTBody.appendChild(this.createContentElementC(jsonS.outer.xml.targets[l_index].u.cars[p_index]));
			   
			}
			
				var l_userCarsTR = document.createElement('tr');
			var l_userCarsTD = document.createElement('td');
			 l_userCarsTD.innerHTML = l_carGTA; 
			 l_userCarsTR.appendChild(l_userCarsTD);
			 
			 
			a_contentTBody.appendChild(l_userCarsTR);
			
		       
		     /*
		      l_enemyUser.m_usernetworkid = jsonS.outer.xml.targets.user[l_index].eu_nd;
		     l_enemyUser.m_mobName = jsonS.outer.xml.targets.user[l_index].eu_un;
		     l_enemyUser.m_thumbnail_url = jsonS.outer.xml.targets.user[l_index].eu_tn;
		    try{
			l_gain  = jsonS.outer.xml.targets.user[l_index].gain;
			}
			catch (err)
			{
			    
			    
			}
		     l_timeago  = jsonS.outer.xml.targets.user[l_index].date_ago;
		     */
                 //   l_targetUser.createJSONUser(jsonS.outer.xml.targets.user[l_index]);
		 /*
		    l_targetUser.m_mobClass = jsonS.outer.xml.targets.user[l_index].mob_class;
      l_targetUser.m_thumbnail_url = jsonS.outer.xml.targets.user[l_index].TN;
     l_targetUser.m_mobName =  jsonS.outer.xml.targets.user[l_index].mob_name;
        // m_mobClass , m_mobName, m_mobSize
	   l_targetUser.m_userId = jsonS.outer.xml.targets.user[l_index].userid;
	   l_targetUser.m_level = jsonS.outer.xml.targets.user[l_index].level;
	     
     
      
       l_targetUser.m_profile_url = jsonS.outer.xml.targets.user[l_index].ProfileURL;
        
	 
	     l_targetUser.m_mobSize =  jsonS.outer.xml.targets.user[l_index].mob_size;
	      l_targetUser.m_usernetworkid = jsonS.outer.xml.targets.user[l_index].usernetworkid;
		 
		 */
                   count++;
		    
		    if(!(count % 20))
		    {
			
			        var l_tr = document.createElement("tr");

        var l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.color = "#FFFFFF";
     //   l_td.style.padding = "5px 10px 5px 10px";
    //    l_td.innerHTML = "<a target=\"_blank\" href=\""+ GBL.APP_CANVAS_URL + "appParams=%7B%22"+GBL.SHOW_USER_ID+"%22%3A%22"+a_targetUser.getUserId()+"%22%7D\" >" + "<span style='color:#3E99C3; font-weight:bold;'> <img width=\"50\" height=\"50\" src=\'" + a_targetUser.getThumbnailUrl() + "\'/>" + a_targetUser.getMobName() + " </span>, Level " + a_targetUser.getLevel() + " " + a_targetUser.getMobClass() + "</span></a>";
        l_td.style.cursor = "pointer";
	
			//var AdDiv = document.createElement("div"); 
		 l_td.innerHTML  = getadtype2();;
		//	AdDiv.style.textAlign = "center";
		/*
		            tabContentDiv.style.position = "absolute";
            tabContentDiv.style.top = m_hideContentDivTopPosition;
            tabContentDiv.style.left = "55px";
            tabContentDiv.style.width = "860px";
            tabContentDiv.style.zIndex = "1";*/
		a_contentTBody.appendChild(l_tr);
		
		//	this.m_containerDiv.appendChild(AdDiv);
		    }
               }
			   
          //  } catch (err) { outputAlert("onGetJobList " + err);}
    //    }

        /*if(!isValid(l_numTargets) || l_numTargets <= 0){
            var l_noteDiv = createWhiteDiv(this.m_tableDiv);
            l_noteDiv.style.textAlign = "center";
            l_noteDiv.innerHTML = this.m_emptyMessage;
        }*/
	// $("hey1223").innerHTML ="tesT";
	 //   $("hey1223").hide("slide", { direction: "up" }, 0);
	  //  this.m_contentTBody.style.display = "none";
	//    $(this.m_contentTBody).hide();
	    
	//  $(this.m_contentTBody).slideDown(10000);


   //   $(this.m_contentTBody).show("slide", { direction: "down" }, 10000);
    }



  FightListDiv.prototype.onGetFightList4 = function(a_responseData, a_contentTBody){
  //  a_contentTBody.id ="hey1223";
 
jsonS = parseJSON2(a_responseData.text);//.parseJSON();
       // var l_xmlDoc = getGadgetResponseData(a_responseData);
       // var l_numTargets = undefined;
        //if(isValid(jsonS)){
		
		    var l_StatsInfo = document.createElement("table");
			
				while(this.m_title.hasChildNodes())
{
this.m_title.removeChild(this.m_title.firstChild);
}
			
			this.m_title.appendChild(l_StatsInfo);
			
			
			
			
			var l_mainTabletbody=   document.createElement("tbody");
			l_StatsInfo.appendChild(l_mainTabletbody);
			
	var l_mainTabletr =   document.createElement("tr");
	l_mainTabletbody.appendChild(l_mainTabletr);
	
	//var l_mainTabletr2 =   document.createElement("tr");
	var l_mainTabletd1 =   document.createElement("td");
	
	l_mainTabletr.appendChild(l_mainTabletd1);
	l_mainTabletd1.innerHTML = ' <img style=\'margin-left:auto; margin-right:auto; background-repeat: repeat-x;\' src=\'http://www.laasex.com/crime/images/UI/buttons/ROBA.png\'/><span style=\'font-size:10px;color:#E70707; font-weight:bold;\'><b>Attack:</b></span><span style=\'font-size:10px;color:#FFFFFF; font-weight:bold;\'><b>' + jsonS.outer.xml.user.Attack + '</b></span>';
	
	
	// this.Kimg.innerHTML = "<img style='margin-left:auto; margin-right:auto; background-repeat: repeat-x;' src='http://www.laasex.com/crime/images/UI/icons/bullet-holes1.png'/> ";
	
	//jsonS.outer.xml.ADamageGuns
	//jsonS.outer.xml.ATopWeaponIcon
	/*
		{"outer":{"xml":{"user":{"ADamageGuns":"9120","ADamageArmor":"1937","ADamageVehicles":"262","ADamageItems":"691","ADamagePets":"1307","ADamageSpecials":"117","ADamageLand":"0","DDamageGuns":"6472","DDamageArmor":"2137","DDamageVehicles":"15100","DDamageItems":"3171","DDamagePets":"1186","DDamageLand":"0","NumWeaponsA":"151","NumWeaponsD":"151","NumVehiclesA":"151","NumVehiclesD":"151","NumArmorA":"132","NumArmorD":"132","NumItemsA":"151","NumItemsD":"151","NumLandA":"0","NumLandD":"0","NumPetsA":"151","NumPetsD":"151","NumSpecialsA":"18","NumSpecialsD":"18","ATopWeaponIcon":"big-hammer-120x80.png","ATopWeaponName":"Big Hammer","DTopWeaponIcon":"brass_knucles-120x80.png","DTopWeaponName":"brass_knucles-120x80.png","ATopVehiclesIcon":"Oka.png","ATopVehiclesName":"Oka","DTopVehiclesIcon":"quad.png","DTopVehiclesName":"quad.png","ATopArmorIcon":"http://bigideastech.com/c","ATopArmorName":"Bullet Proof vest","DTopArmorIcon":"http://bigideastech.com/c","DTopArmorName":"http://bigideastech.com/c","ATopItemsIcon":"http://www.bigideastech.c","ATopItemsName":"Bullet Proof Folder","DTopItemsIcon":"http://www.bigideastech.c","DTopItemsName":"http://www.bigideastech.c","ATopPetsIcon":"Yorkie-120x80.jpg","ATopPetsName":"Yorkie","DTopPetsIcon":"Yorkie-120x80.jpg","DTopPetsName":"Yorkie-120x80.jpg","ATopSpecialsIcon":"http://p.laasex.com/pimpw","ATopSpecialsName":"Speicial Item","DTopSpecialsIcon":"http://p.laasex.com/pimpw","DTopSpecialsName":"http://p.laasex.com/pimpw"}
		   
		*/   
		// calcpercent
		//this.m_sidestats.innerHTML = 'NumGuns: ' + jsonS.outer.xml.numfriends + ' guns: ' + jsonS.outer.xml.user.NumWeaponsA  + ' armor: ' + jsonS.outer.xml.user.NumArmorA; 
		
	/*	var l_gunsInfo =  document.createElement("div");
		l_gunsInfo.innerHTML =  + jsonS.outer.xml.user.NumWeaponsA + '/' + jsonS.outer.xml.numfriends + ' weapons '; 
		      l_gunsInfo.style.color = "#E7CF07";
        l_gunsInfo.style.textAlign = "center";
        l_gunsInfo.style.fontSize = "10px";
        l_gunsInfo.style.fontWeight = "bold";
		
		
			var l_gunsBar =  document.createElement("div");
			
			l_gunsBar.style.width =  "138px";
			l_gunsBar.style.height =  "25px";
			
			var l_gunsBar2 =  document.createElement("div");
			l_gunsBar.appendChild(l_gunsBar2);
			var p = calcpercent(jsonS.outer.xml.user.NumWeaponsA,jsonS.outer.xml.numfriends);
		
			l_gunsBar2.style.backgroundImage = "url('http://www.bigideastech.com/crime/images/UI/buttons/progressR.png')";
			l_gunsBar2.style.width =  p+"%";
			l_gunsBar2.style.height =  "25px";
		
			
		this.m_sidestats.appendChild(l_gunsInfo);
			this.m_sidestats.appendChild(l_gunsBar);
			*/
			//equipment.png
			
			 //var l_SideStats = document.createElement("table");
			 
		var	l_headersidestats =  document.createElement("div");
			
			l_headersidestats.style.backgroundImage = "url('http://www.bigideastech.com/crime/images/UI/buttons/equipment.png')";
			l_headersidestats.style.width =  "100px";
			l_headersidestats.style.height =  "25px";
			
			while(this.m_sidestats.hasChildNodes())
{
this.m_sidestats.removeChild(this.m_sidestats.firstChild);
}
			//	var l_mainsideTabletbody=   document.createElement("tbody");
		//	l_SideStats.appendChild(l_mainsideTabletbody);
			
	//var l_sideTabletr =   document.createElement("tr");
	//l_mainsideTabletbody.appendChild(l_sideTabletr);
	
	//var l_mainTabletr2 =   document.createElement("tr");
//	var l_mainTabletd1 =   document.createElement("td");
	
	//l_sideTabletr.appendChild(l_headersidestats);
	
			this.m_sidestats.appendChild(l_headersidestats);
			
		this.m_sidestats.appendChild(ItemInfoFight(jsonS.outer.xml.user.NumWeaponsA,jsonS.outer.xml.numfriends,'Weapons'));
	 this.m_sidestats.appendChild(ItemBarFight(jsonS.outer.xml.user.NumWeaponsA,jsonS.outer.xml.numfriends));
// NumWeaponsA":"151","NumWeaponsD":"151","NumVehiclesA":"151","NumVehiclesD":"151",
//"NumArmorA":"132","NumArmorD":"132","NumItemsA":"151","NumItemsD":"151","NumLandA":"0","NumLandD":"0","NumPetsA":"151","NumPetsD":"151","NumSpecialsA
	 
				this.m_sidestats.appendChild(ItemInfoFight(jsonS.outer.xml.user.NumArmorA,jsonS.outer.xml.numfriends,'Armors'));
	 this.m_sidestats.appendChild(ItemBarFight(jsonS.outer.xml.user.NumArmorA,jsonS.outer.xml.numfriends));
	 
	 		this.m_sidestats.appendChild(ItemInfoFight(jsonS.outer.xml.user.NumArmorA,jsonS.outer.xml.numfriends,'Vehicles'));
	 this.m_sidestats.appendChild(ItemBarFight(jsonS.outer.xml.user.NumArmorA,jsonS.outer.xml.numfriends));
	 
	 	 		this.m_sidestats.appendChild(ItemInfoFight(jsonS.outer.xml.user.NumItemsA,jsonS.outer.xml.numfriends,'Items'));
	 this.m_sidestats.appendChild(ItemBarFight(jsonS.outer.xml.user.NumItemsA,jsonS.outer.xml.numfriends));
	 
			 		this.m_sidestats.appendChild(ItemInfoFight(jsonS.outer.xml.user.NumPetsA,jsonS.outer.xml.numfriends,'Pets'));
	 this.m_sidestats.appendChild(ItemBarFight(jsonS.outer.xml.user.NumPetsA,jsonS.outer.xml.numfriends));
		
			 		this.m_sidestats.appendChild(ItemInfoFight(jsonS.outer.xml.user.NumSpecialsA,jsonS.outer.xml.numfriends,'Specials'));
	 this.m_sidestats.appendChild(ItemBarFight(jsonS.outer.xml.user.NumSpecialsA,jsonS.outer.xml.numfriends));
		
			var l_addiv = document.createElement('div');
	l_addiv.innerHTML += '<iframe marginwidth="0" marginheight="0" src="http://www.sandiegorhythmicgymnastics.com/2/adparlor120x600.htm" scrolling="no" width="120" frameborder="0" height="600"></iframe><br/>';
	l_addiv.innerHTML += '<iframe marginwidth="0" marginheight="0" src="http://www.sandiegorhythmicgymnastics.com/2/cubics120x600.htm" scrolling="no" width="120" frameborder="0" height="600"></iframe><br/>';
	l_addiv.innerHTML += '<iframe marginwidth="0" marginheight="0" src="http://www.sandiegorhythmicgymnastics.com/2/clicksor120x600.htm" scrolling="no" width="120" frameborder="0" height="600"></iframe><br/>';
	l_addiv.innerHTML += '<iframe marginwidth="0" marginheight="0" src="http://www.sandiegorhythmicgymnastics.com/2/google120x600.htm" scrolling="no" width="120" frameborder="0" height="600"></iframe><br/>';
	l_addiv.innerHTML += '<iframe marginwidth="0" marginheight="0" src="http://www.sandiegorhythmicgymnastics.com/2/google120x600.htm" scrolling="no" width="120" frameborder="0" height="600"></iframe><br/>';
	l_addiv.innerHTML += '<iframe marginwidth="0" marginheight="0" src="http://www.sandiegorhythmicgymnastics.com/2/adparlor125x125.htm" scrolling="no" width="125" frameborder="0" height="125"></iframe><br/>';
		l_addiv.innerHTML += '<iframe marginwidth="0" marginheight="0" src="http://www.sandiegorhythmicgymnastics.com/2/cubics125x125.htm" scrolling="no" width="125" frameborder="0" height="125"></iframe><br/>';
	l_addiv.innerHTML += '<iframe marginwidth="0" marginheight="0" src="http://www.sandiegorhythmicgymnastics.com/2/google120x240.htm" scrolling="no" width="120" frameborder="0" height="240"></iframe><br/>';
		l_addiv.innerHTML += '<iframe marginwidth="0" marginheight="0" src="http://www.sandiegorhythmicgymnastics.com/2/adparlor125x60.htm" scrolling="no" width="125" frameborder="0" height="60"></iframe><br/>';
		l_addiv.innerHTML += '<iframe marginwidth="0" marginheight="0" src="http://www.sandiegorhythmicgymnastics.com/2/clicksor120x240.htm" scrolling="no" width="120" frameborder="0" height="240"></iframe><br/>';
	
	//
	this.m_sidestats.appendChild(l_addiv);
		
	if(jsonS.outer.xml.user.ATopWeaponName){
		ItemTopFight(jsonS.outer.xml.user.ATopWeaponIcon,"http://www.bigideastech.com/crime/images/weapons/icons/",jsonS.outer.xml.user.ATopWeaponName,l_mainTabletr);
	} 
	
	/*var l_mainTabletd3 =   document.createElement("td");
	l_mainTabletr.appendChild(l_mainTabletd3); 
	
	l_mainTabletd3.innerHTML =  '<img style=\'margin-left:auto; margin-right:auto; width:50%;   height:50%;   background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/armor/icons/'+jsonS.outer.xml.user.ATopArmorIcon+'\'/>';
	*/
	if(jsonS.outer.xml.user.ATopArmorName){
	ItemTopFight(jsonS.outer.xml.user.ATopArmorIcon,"http://www.bigideastech.com/crime/images/armor/icons/",jsonS.outer.xml.user.ATopArmorName,l_mainTabletr);
	}
	
	
	
	/*var l_mainTabletd4 =   document.createElement("td");
	l_mainTabletr.appendChild(l_mainTabletd4);
	l_mainTabletd4.innerHTML =  '<img style=\'margin-left:auto; margin-right:auto; width:50%;   height:50%;   background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/cars/icons/'+jsonS.outer.xml.user.ATopVehiclesIcon+'\'/>';
	*/
	if(jsonS.outer.xml.user.ATopVehiclesName){
	ItemTopFight(jsonS.outer.xml.user.ATopVehiclesIcon,"http://www.bigideastech.com/crime/images/cars/icons/",jsonS.outer.xml.user.ATopVehiclesName,l_mainTabletr);
	}
	
	/*var l_mainTabletd5 =   document.createElement("td");
	l_mainTabletr.appendChild(l_mainTabletd5);
	l_mainTabletd5.innerHTML = '<img style=\'margin-left:auto; margin-right:auto; width:50%;   height:50%;   background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/items/icon/'+jsonS.outer.xml.user.ATopItemsIcon+'\'/>';
	*/
	if(jsonS.outer.xml.user.ATopItemsName){
	  ItemTopFight(jsonS.outer.xml.user.ATopItemsIcon,"http://www.bigideastech.com/crime/images/items/icon/",jsonS.outer.xml.user.ATopItemsName,l_mainTabletr);
	}
	/*
	var l_mainTabletd6 =   document.createElement("td");
	l_mainTabletr.appendChild(l_mainTabletd6);
	l_mainTabletd6.innerHTML =  '<img style=\'margin-left:auto; margin-right:auto; width:50%;   height:50%;   background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/pets/icons/'+jsonS.outer.xml.user.ATopPetsIcon+'\'/>';
	*/
	if(jsonS.outer.xml.user.ATopPetsName)
	{
	ItemTopFight(jsonS.outer.xml.user.ATopPetsIcon,"http://www.bigideastech.com/crime/images/pets/icons/",jsonS.outer.xml.user.ATopPetsName,l_mainTabletr);
	}
	
	
	/*	var l_mainTabletd7 =   document.createElement("td");
	l_mainTabletr.appendChild(l_mainTabletd7);
	l_mainTabletd7.innerHTML =  '<img style=\'margin-left:auto; margin-right:auto; width:50%;   height:50%;   background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/specials/icons/'+jsonS.outer.xml.user.ATopSpecialsIcon+'\'/>';
	
	*/
	if(jsonS.outer.xml.user.ATopSpecialsName){
	ItemTopFight(jsonS.outer.xml.user.ATopSpecialsIcon,"http://www.bigideastech.com/crime/images/specials/icons/",jsonS.outer.xml.user.ATopSpecialsName,l_mainTabletr);
	}
	
	/*
	 var l_mainTabletd8 =   document.createElement("td");
	l_mainTabletr.appendChild(l_mainTabletd8);
	l_mainTabletd8.innerHTML = 'Land: ' + jsonS.outer.xml.user.ADamageLand + '<img style=\'margin-left:auto; margin-right:auto; width:50%;   height:50%;   background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/land/icons/'+jsonS.outer.xml.user.ATopLandIcon+'\'/>';
	*/
	
	
	
		var l_mainTabletr2 =   document.createElement("tr");
	l_mainTabletbody.appendChild(l_mainTabletr2);
	//l_mainTabletr2.height = "100px";
	//l_mainTabletr2.style.height = "100px";
	var l_mainTabletd10 =   document.createElement("td");
	
	l_mainTabletr2.appendChild(l_mainTabletd10);
	l_mainTabletd10.innerHTML = '<img style=\'margin-left:auto; margin-right:auto; background-repeat: repeat-x;\' src=\'http://www.laasex.com/crime/images/UI/buttons/ROBD.png\'/><span style=\'font-size:10px;color:#2F1ED0; font-weight:bold;\'><b>Defense:</b></span><span style=\'font-size:10px;color:#FFFFFF; font-weight:bold;\'><b>' + jsonS.outer.xml.user.Defense + '</b></span>';
	/*
	var l_mainTabletd11 =   document.createElement("td");
			l_mainTabletr2.appendChild(l_mainTabletd11);
			l_mainTabletd11.innerHTML =  '<img style=\'margin-left:auto; margin-right:auto; width:70%;   height:70%;   background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/weapons/icons/'+jsonS.outer.xml.user.DTopWeaponIcon+'\'/>';
	*/
if(jsonS.outer.xml.user.DTopWeaponName){
	ItemTopFight(jsonS.outer.xml.user.DTopWeaponIcon,"http://www.bigideastech.com/crime/images/weapons/icons/",jsonS.outer.xml.user.DTopWeaponName,l_mainTabletr2);
	}
	
	/*
	var l_mainTabletd12 =   document.createElement("td");
	l_mainTabletr2.appendChild(l_mainTabletd12);
	
	l_mainTabletd12.innerHTML =  '<img style=\'margin-left:auto; margin-right:auto; width:50%;   height:50%;   background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/armor/icons/'+jsonS.outer.xml.user.DTopArmorIcon+'\'/>';
	*/
	if(jsonS.outer.xml.user.DTopArmorName){
	ItemTopFight(jsonS.outer.xml.user.DTopArmorIcon,"http://www.bigideastech.com/crime/images/armor/icons/",jsonS.outer.xml.user.DTopArmorName,l_mainTabletr2);
	}
	
	/*
	var l_mainTabletd13 =   document.createElement("td");
	l_mainTabletr2.appendChild(l_mainTabletd13);
	l_mainTabletd13.innerHTML =  '<img style=\'margin-left:auto; margin-right:auto; width:50%;   height:50%;   background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/cars/icons/'+jsonS.outer.xml.user.DTopVehiclesIcon+'\'/>';
	*/
	if(jsonS.outer.xml.user.DTopVehiclesName){
	ItemTopFight(jsonS.outer.xml.user.DTopVehiclesIcon,"http://www.bigideastech.com/crime/images/cars/icons/",jsonS.outer.xml.user.DTopVehiclesName,l_mainTabletr2);
	}
	
	/*var l_mainTabletd14 =   document.createElement("td");
	l_mainTabletr2.appendChild(l_mainTabletd14);
	l_mainTabletd14.innerHTML = '<img style=\'margin-left:auto; margin-right:auto; width:50%;   height:50%;   background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/items/icon/'+jsonS.outer.xml.user.DTopItemsIcon+'\'/>';
	*/
	if(jsonS.outer.xml.user.DTopItemsName){
	ItemTopFight(jsonS.outer.xml.user.DTopItemsIcon,"http://www.bigideastech.com/crime/images/items/icon/",jsonS.outer.xml.user.DTopItemsName,l_mainTabletr2);
	}
	    
	/*
	var l_mainTabletd15 =   document.createElement("td");
	l_mainTabletr2.appendChild(l_mainTabletd15);
	l_mainTabletd15.innerHTML =  '<img style=\'margin-left:auto; margin-right:auto; width:50%;    height:50%;  background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/pets/icons/'+jsonS.outer.xml.user.DTopPetsIcon+'\'/>';
	 */
	 if(jsonS.outer.xml.user.DTopPetsName){
	 ItemTopFight(jsonS.outer.xml.user.DTopPetsIcon,"http://www.bigideastech.com/crime/images/pets/icons/",jsonS.outer.xml.user.DTopPetsName,l_mainTabletr2);
	}
	   
	
	   /*
		var l_mainTabletd16 =   document.createElement("td");
	l_mainTabletr2.appendChild(l_mainTabletd16);
	l_mainTabletd16.innerHTML =  '<img style=\'margin-left:auto; margin-right:auto;width:50%;    height:50%;   background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/specials/icons/'+jsonS.outer.xml.user.DTopSpecialsIcon+'\'/>';
	*/
	 if(jsonS.outer.xml.user.DTopSpecialsName){
	ItemTopFight(jsonS.outer.xml.user.DTopSpecialsIcon,"http://www.bigideastech.com/crime/images/specials/icons/",jsonS.outer.xml.user.DTopSpecialsName,l_mainTabletr2);
	}
	
	
	/*
		var l_mainTabletr2 =   document.createElement("tr");
	l_mainTabletbody.appendChild(l_mainTabletr2);
	
	var l_mainTabletd10 =   document.createElement("td");
	
	l_mainTabletr.appendChild(l_mainTabletd10);
	l_mainTabletd10.innerHTML = '<img style=\'margin-left:auto; margin-right:auto; background-repeat: repeat-x;\' src=\'http://www.laasex.com/crime/images/UI/stats/D2.png\'/> ';
	
	var l_mainTabletd11 =   document.createElement("td");
			l_mainTabletr2.appendChild(l_mainTabletd11);
			l_mainTabletd11.innerHTML = 'Guns: ' + jsonS.outer.xml.user.DDamageGuns + '<img style=\'margin-left:auto; margin-right:auto; width:50px; width:50px; height:33px;  background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/weapons/icons/'+jsonS.outer.xml.user.DTopWeaponIcon+'\'/>';
	
	var l_mainTabletd12 =   document.createElement("td");
	l_mainTabletr2.appendChild(l_mainTabletd12);
	
	l_mainTabletd12.innerHTML = 'Armor: ' + jsonS.outer.xml.user.DDamageArmor + '<img style=\'margin-left:auto; margin-right:auto; width:50px; width:50px; height:33px;  background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/armor/icons/'+jsonS.outer.xml.user.DTopArmorIcon+'\'/>';
	
	var l_mainTabletd13 =   document.createElement("td");
	l_mainTabletr2.appendChild(l_mainTabletd13);
	l_mainTabletd13.innerHTML = 'Vehicles: ' + jsonS.outer.xml.user.DDamageVehicles + '<img style=\'margin-left:auto; margin-right:auto; width:50px; width:50px; height:33px;  background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/cars/icons/'+jsonS.outer.xml.user.DTopVehiclesIcon+'\'/>';
	
	
	var l_mainTabletd14 =   document.createElement("td");
	l_mainTabletr2.appendChild(l_mainTabletd14);
	l_mainTabletd14.innerHTML = 'Items: ' + jsonS.outer.xml.user.DDamageItems + '<img style=\'margin-left:auto; margin-right:auto; width:50px; width:50px; height:33px;  background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/items/icon/'+jsonS.outer.xml.user.DTopItemsIcon+'\'/>';
	
	    
	
	var l_mainTabletd15 =   document.createElement("td");
	l_mainTabletr2.appendChild(l_mainTabletd15);
	l_mainTabletd15.innerHTML = 'Pets: ' + jsonS.outer.xml.user.DDamagePets + '<img style=\'margin-left:auto; margin-right:auto; width:50px; width:50px; height:33px;  background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/pets/icons/'+jsonS.outer.xml.user.DTopPetsIcon+'\'/>';
	 
	
	   
		var l_mainTabletd16 =   document.createElement("td");
	l_mainTabletr2.appendChild(l_mainTabletd16);
	l_mainTabletd16.innerHTML = 'Specials: ' + jsonS.outer.xml.user.DDamageSpecials + '<img style=\'margin-left:auto; margin-right:auto; width:50px; width:50px; height:33px;  background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/specials/icons/'+jsonS.outer.xml.user.DTopSpecialsIcon+'\'/>';
	
	
	
	 var l_mainTabletd17 =   document.createElement("td");
	l_mainTabletr2.appendChild(l_mainTabletd17);
	l_mainTabletd17.innerHTML = 'Land: ' + jsonS.outer.xml.user.DDamageLand + '<img style=\'margin-left:auto; margin-right:auto; width:50px; width:50px; height:33px;  background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/Properties/icons/'+jsonS.outer.xml.user.DTopLandIcon+'\'/>';
	*/
		var l_mainTabletr3 =   document.createElement("tr");
	l_mainTabletbody.appendChild(l_mainTabletr3);
	
	var l_mainTabletd20 =   document.createElement("td");
	
	l_mainTabletr3.appendChild(l_mainTabletd20);
	l_mainTabletd20.innerHTML = '<img style=\'margin-left:auto; margin-right:auto; background-repeat: repeat-x;\' src=\'http://www.laasex.com/crime/images/UI/stats/f.png\'/><span style=\'font-size:10px;color:#0CC041; font-weight:bold;\'><b>Organization:</b></span><span style=\'font-size:10px;color:#FFFFFF; font-weight:bold;\'><b>' + jsonS.outer.xml.numfriends + '</b></span>';// '+jsonS.outer.xml.user.NumItemsA,jsonS.outer.xml.numfriends;
	//<span style=\'font-size:10px;color:#2F1ED0; font-weight:bold;\'><b>Defense:</b></span><span style=\'font-size:10px;color:#FFFFFF; font-weight:bold;\'><b>
	//	l_mainTabletr3.appendChild(l_mainTabletd20);
	//l_mainTabletd20.innerHTML = '<img style=\'margin-left:auto; margin-right:auto; background-repeat: repeat-x;\' src=\'http://www.laasex.com/crime/images/UI/stats/f.png\'/> '+jsonS.outer.xml.user.NumItemsA,jsonS.outer.xml.numfriends;
	/*
	,{"mob_class":"Mogul","UCT":"8","TN":"http://a60.ac-images.myspacecdn.com/images01/32/s_429b1dc4f16b3c47fd63c744bd82d52b.jpg","mob_name":"djajich","userid":"53541900","level":"167","mob_size":"63","usernetworkid":"2","ProfileURL":"http://www.myspace.com/Cory_Djajich"},{"mob_class":"Physco","UCT":"7","TN":"http://c2.ac-images.myspacecdn.com/images02/79/s_9d14db4e87154170bff21be50fd33b91.jpg","mob_name":"Str8","userid":"231695088","level":"168","mob_size":"58","usernetworkid":"2","ProfileURL":"http://www.myspace.com/nocchitloose"}]},"numfriends":"152","friends":{"Username":["LADY CAPONE","Wish you would","badangel","Pepper","Dark Crime Boss","cmobsta","Curtis Jackson","okok","funkyponger","nikkerbokker"],"TN":["http://c1.ac-images.myspacecdn.com/images01/21/s_401481f9dc9680fa4ecef26acf62b938.jpg","http://c1.ac-images.myspacecdn.com/images02/39/s_dc9e5c5a78164ace862294345442e174.jpg","http://a584.ac-images.myspacecdn.com/images01/44/s_dcbd27ac515cef1471e746a3fbc4bc17.jpg","http://a514.ac-images.myspacecdn.com/images01/93/s_69f9f30cd93ae37acbaa4d8f5b66b969.jpg","http://c3.ac-images.myspacecdn.com/images01/87/s_77db4ee6089cf422bf224e6733475426.jpg","http://c1.ac-images.myspacecdn.com/images02/42/s_3203d2dacf654217babb39618460ae48.jpg","http://a173.ac-images.myspacecdn.com/images01/88/s_060c995cd37d667bda13106f5ca4162c.jpg","http://x.myspacecdn.com/images/no_pic.gif","http://x.myspacecdn.com/images/no_pic.gif","http://a196.ac-images.myspacecdn.com/images01/50/s_65fb658da7117f9bd37681df95037efb.jpg"],"UCT":["1","1","5","8","5","7","10","2","7","8"],"lastlogin":["2009-10-31T13:52:34.880","2009-10-31T13:35:04.887","2009-10-31T02:21:08.167","2009-10-29T23:33:15.427","2009-10-28T11:10:56.303","2009-10-28T00:29:58.530","2009-10-26T00:31:12.230","2009-10-23T03:19:40.417","2009-10-22T23:43:35.617","2009-10-21T06:11:14.547"]}}}}
	*/
	if(jsonS.outer.xml.friends)
	{
	if(jsonS.outer.xml.numfriends > 2)
	{
	for(var i = 0; i < jsonS.outer.xml.friends.Username.length; i++)
	{
	var l_mainTableFriendTD =  document.createElement("td");
	
	var gentitle = jsonS.outer.xml.friends.Username[i] +" Last logged on: "+ jsonS.outer.xml.friends.lastlogin[i];
	//l_mainTableFriendTD.style.width = "80px";
	//l_mainTableFriendTD.style.height = "60px";
	
	l_mainTableFriendTD.innerHTML = "<span style='font-size:10px;color:#FFD927; font-weight:bold;'>"+ jsonS.outer.xml.friends.Username[i] + "</span><BR/>" + "<img style='margin-left:auto; margin-right:auto; width:50px; height:50px;' title='"+gentitle+"' alt='"+gentitle + "' "+"' src='"+jsonS.outer.xml.friends.TN[i]+"' />";
	
	//l_mainTableFriendTD.innerHTML = '<span style=\'font-size:10px;color:#FFD927; font-weight:bold;\'>'+ jsonS.outer.xml.friends.Username[i] + '</span><BR/><img title=\''+gentitle+'\' alt=\''+gentitle + '\' src=\''+jsonS.outer.xml.friends.TN[i]+'\' />';
	
	l_mainTabletr3.appendChild(l_mainTableFriendTD);
	
	}
	}
	else
	{
	
		var l_mainTableFriendTD =  document.createElement("td");
	
	var gentitle = jsonS.outer.xml.friends.Username +" Last logged on: "+ jsonS.outer.xml.friends.lastlogin;
	//l_mainTableFriendTD.style.width = "80px";
	//l_mainTableFriendTD.style.height = "60px";
	 
	l_mainTableFriendTD.innerHTML = "<span style='font-size:10px;color:#FFD927; font-weight:bold;'>"+ jsonS.outer.xml.friends.Username + "</span><BR/>" + "<img style='margin-left:auto; margin-right:auto; width:50px; height:50px;' title='"+gentitle+"' alt='"+gentitle + "' "+"' src='"+jsonS.outer.xml.friends.TN+"' />";
	
	//l_mainTableFriendTD.innerHTML = '<span style=\'font-size:10px;color:#FFD927; font-weight:bold;\'>'+ jsonS.outer.xml.friends.Username[i] + '</span><BR/><img title=\''+gentitle+'\' alt=\''+gentitle + '\' src=\''+jsonS.outer.xml.friends.TN[i]+'\' />';
	
	l_mainTabletr3.appendChild(l_mainTableFriendTD);
	
	
	
	}
	
	}
	
            try{
               // l_numTargets = parseInt(getXMLNodeValue(l_xmlDoc, "num_targets"));                

         //       var l_targetUserNodes = l_xmlDoc.getElementsByTagName("user");
		var count = 0;
		
		
                for(var l_index = 0; l_index < jsonS.outer.xml.users.length; l_index++){
                  //  var l_friendUser = new User(undefined);
		     var l_enemyUser = new User(undefined);
		 //    var l_gain = '';
		 //    var l_timeago = '';
		     /*
		       l_friendUser.m_userId = jsonS.outer.xml.targets.user[l_index].fn_id;
		      l_friendUser.m_usernetworkid = jsonS.outer.xml.targets.user[l_index].fu_nd;
		     l_friendUser.m_mobName = jsonS.outer.xml.targets.user[l_index].fu_un;
		     l_friendUser.m_thumbnail_url = jsonS.outer.xml.targets.user[l_index].fu_tn;
		     */
		     
		     l_enemyUser.m_userId = jsonS.outer.xml.users[l_index].u.user_id;
		     l_enemyUser.m_usernetworkid = jsonS.outer.xml.users[l_index].u.networktype;
		       l_enemyUser.m_mobName = jsonS.outer.xml.users[l_index].u.username;
		       l_enemyUser.m_thumbnail_url = jsonS.outer.xml.users[l_index].u.tn;
		        
			  a_contentTBody.appendChild(this.createContentElementR(l_enemyUser));
		   
		   
		   
		   
		   		var l_icarCounter = 0;
			var l_carGTA = "";
			 
			for(var p_index = 0; p_index < jsonS.outer.xml.users[l_index].u.land.length; p_index++){
			
			var altgen = jsonS.outer.xml.users[l_index].u.land[p_index].LandName + ' x ' + jsonS.outer.xml.users[l_index].u.land[p_index].Number;
			 l_icarCounter++;
			 if(!(l_icarCounter%4)) 
			 {
			 	var l_userCarsTR = document.createElement('tr');
			var l_userCarsTD = document.createElement('td');
			 l_userCarsTD.innerHTML = l_carGTA; 
			 l_userCarsTR.appendChild(l_userCarsTD);
			   
			
			a_contentTBody.appendChild(l_userCarsTR);
			 l_carGTA = "";
			 }
			    l_carGTA += "<img style='margin-left:auto; margin-right:auto;' title='"+altgen+"' alt='"+altgen + "' src='"+jsonS.outer.xml.users[l_index].u.land[p_index].Icon+"'/>";
			   //  a_contentTBody.appendChild(this.createContentElementC(jsonS.outer.xml.targets[l_index].u.cars[p_index]));
			   
			}
			
				var l_userCarsTR = document.createElement('tr');
			var l_userCarsTD = document.createElement('td');
			 l_userCarsTD.innerHTML = l_carGTA; 
			 l_userCarsTR.appendChild(l_userCarsTD);
			 
			 
			a_contentTBody.appendChild(l_userCarsTR);
			
			/*
			for(var p_index = 0; p_index < jsonS.root.users[l_index].u.land.length; p_index++){
			    
			     a_contentTBody.appendChild(this.createContentElementL(jsonS.root.users[l_index].u.land[p_index]));
			    
			}*/
		       
		     /*
		      l_enemyUser.m_usernetworkid = jsonS.outer.xml.targets.user[l_index].eu_nd;
		     l_enemyUser.m_mobName = jsonS.outer.xml.targets.user[l_index].eu_un;
		     l_enemyUser.m_thumbnail_url = jsonS.outer.xml.targets.user[l_index].eu_tn;
		    try{
			l_gain  = jsonS.outer.xml.targets.user[l_index].gain;
			}
			catch (err)
			{
			    
			    
			}
		     l_timeago  = jsonS.outer.xml.targets.user[l_index].date_ago;
		     */
                 //   l_targetUser.createJSONUser(jsonS.outer.xml.targets.user[l_index]);
		 /*
		    l_targetUser.m_mobClass = jsonS.outer.xml.targets.user[l_index].mob_class;
      l_targetUser.m_thumbnail_url = jsonS.outer.xml.targets.user[l_index].TN;
     l_targetUser.m_mobName =  jsonS.outer.xml.targets.user[l_index].mob_name;
        // m_mobClass , m_mobName, m_mobSize
	   l_targetUser.m_userId = jsonS.outer.xml.targets.user[l_index].userid;
	   l_targetUser.m_level = jsonS.outer.xml.targets.user[l_index].level;
	     
     
      
       l_targetUser.m_profile_url = jsonS.outer.xml.targets.user[l_index].ProfileURL;
        
	 
	     l_targetUser.m_mobSize =  jsonS.outer.xml.targets.user[l_index].mob_size;
	      l_targetUser.m_usernetworkid = jsonS.outer.xml.targets.user[l_index].usernetworkid;
		 
		 */
                   count++;
		    
		    if(!(count % 20))
		    {
			
			        var l_tr = document.createElement("tr");

        var l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.color = "#FFFFFF";
     //   l_td.style.padding = "5px 10px 5px 10px";
    //    l_td.innerHTML = "<a target=\"_blank\" href=\""+ GBL.APP_CANVAS_URL + "appParams=%7B%22"+GBL.SHOW_USER_ID+"%22%3A%22"+a_targetUser.getUserId()+"%22%7D\" >" + "<span style='color:#3E99C3; font-weight:bold;'> <img width=\"50\" height=\"50\" src=\'" + a_targetUser.getThumbnailUrl() + "\'/>" + a_targetUser.getMobName() + " </span>, Level " + a_targetUser.getLevel() + " " + a_targetUser.getMobClass() + "</span></a>";
        l_td.style.cursor = "pointer";
	
			//var AdDiv = document.createElement("div"); 
		 l_td.innerHTML  = getadtype2();;
		//	AdDiv.style.textAlign = "center";
		/*
		            tabContentDiv.style.position = "absolute";
            tabContentDiv.style.top = m_hideContentDivTopPosition;
            tabContentDiv.style.left = "55px";
            tabContentDiv.style.width = "860px";
            tabContentDiv.style.zIndex = "1";*/
		a_contentTBody.appendChild(l_tr);
		
		//	this.m_containerDiv.appendChild(AdDiv);
		    }
                }
            } catch (err) { outputAlert("onGetJobList " + err);}
    //    }

        /*if(!isValid(l_numTargets) || l_numTargets <= 0){
            var l_noteDiv = createWhiteDiv(this.m_tableDiv);
            l_noteDiv.style.textAlign = "center";
            l_noteDiv.innerHTML = this.m_emptyMessage;
        }*/
	// $("hey1223").innerHTML ="tesT";
	 //   $("hey1223").hide("slide", { direction: "up" }, 0);
	  //  this.m_contentTBody.style.display = "none";
	//    $(this.m_contentTBody).hide();
	    
	//  $(this.m_contentTBody).slideDown(10000);


   //   $(this.m_contentTBody).show("slide", { direction: "down" }, 10000);
    }
    
    
    
  FightListDiv.prototype.onGetFightList3 = function(a_responseData, a_contentTBody){
  //  a_contentTBody.id ="hey1223";
 
jsonS = parseJSON2(a_responseData.text);//.parseJSON();
       // var l_xmlDoc = getGadgetResponseData(a_responseData);
       // var l_numTargets = undefined;
        //if(isValid(jsonS)){
            try{
               // l_numTargets = parseInt(getXMLNodeValue(l_xmlDoc, "num_targets"));                

         //       var l_targetUserNodes = l_xmlDoc.getElementsByTagName("user");
		var count = 0;
		
		
                for(var l_index = 0; l_index < jsonS.outer.xml.targets.user.length; l_index++){
                    var l_friendUser = new User(undefined);
		     var l_enemyUser = new User(undefined);
		     var l_gain = '';
		     var l_timeago = '';
		     
		       l_friendUser.m_userId = jsonS.outer.xml.targets.user[l_index].fn_id;
		      l_friendUser.m_usernetworkid = jsonS.outer.xml.targets.user[l_index].fu_nd;
		     l_friendUser.m_mobName = jsonS.outer.xml.targets.user[l_index].fu_un;
		     l_friendUser.m_thumbnail_url = jsonS.outer.xml.targets.user[l_index].fu_tn;
		     
		     l_enemyUser.m_userId = jsonS.outer.xml.targets.user[l_index].eu_id;
		      l_enemyUser.m_usernetworkid = jsonS.outer.xml.targets.user[l_index].eu_nd;
		     l_enemyUser.m_mobName = jsonS.outer.xml.targets.user[l_index].eu_un;
		     l_enemyUser.m_thumbnail_url = jsonS.outer.xml.targets.user[l_index].eu_tn;
		    try{
			l_gain  = jsonS.outer.xml.targets.user[l_index].gain;
			}
			catch (err)
			{
			    
			    
			}
		     l_timeago  = jsonS.outer.xml.targets.user[l_index].date_ago;
		     
                 //   l_targetUser.createJSONUser(jsonS.outer.xml.targets.user[l_index]);
		 /*
		    l_targetUser.m_mobClass = jsonS.outer.xml.targets.user[l_index].mob_class;
      l_targetUser.m_thumbnail_url = jsonS.outer.xml.targets.user[l_index].TN;
     l_targetUser.m_mobName =  jsonS.outer.xml.targets.user[l_index].mob_name;
        // m_mobClass , m_mobName, m_mobSize
	   l_targetUser.m_userId = jsonS.outer.xml.targets.user[l_index].userid;
	   l_targetUser.m_level = jsonS.outer.xml.targets.user[l_index].level;
	     
     
      
       l_targetUser.m_profile_url = jsonS.outer.xml.targets.user[l_index].ProfileURL;
        
	 
	     l_targetUser.m_mobSize =  jsonS.outer.xml.targets.user[l_index].mob_size;
	      l_targetUser.m_usernetworkid = jsonS.outer.xml.targets.user[l_index].usernetworkid;
		 
		 */
                    a_contentTBody.appendChild(this.createContentElementF(l_friendUser,l_enemyUser,l_gain,l_timeago));
		    count++;
		    
		    if(!(count % 20))
		    {
			
			        var l_tr = document.createElement("tr");

        var l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.color = "#FFFFFF";
     //   l_td.style.padding = "5px 10px 5px 10px";
    //    l_td.innerHTML = "<a target=\"_blank\" href=\""+ GBL.APP_CANVAS_URL + "appParams=%7B%22"+GBL.SHOW_USER_ID+"%22%3A%22"+a_targetUser.getUserId()+"%22%7D\" >" + "<span style='color:#3E99C3; font-weight:bold;'> <img width=\"50\" height=\"50\" src=\'" + a_targetUser.getThumbnailUrl() + "\'/>" + a_targetUser.getMobName() + " </span>, Level " + a_targetUser.getLevel() + " " + a_targetUser.getMobClass() + "</span></a>";
        l_td.style.cursor = "pointer";
	
			//var AdDiv = document.createElement("div"); 
		 l_td.innerHTML  = getadtype2();;
		//	AdDiv.style.textAlign = "center";
		/*
		            tabContentDiv.style.position = "absolute";
            tabContentDiv.style.top = m_hideContentDivTopPosition;
            tabContentDiv.style.left = "55px";
            tabContentDiv.style.width = "860px";
            tabContentDiv.style.zIndex = "1";*/
		a_contentTBody.appendChild(l_tr);
		
		//	this.m_containerDiv.appendChild(AdDiv);
		    }
                }
            } catch (err) { outputAlert("onGetJobList " + err);}
    //    }

        /*if(!isValid(l_numTargets) || l_numTargets <= 0){
            var l_noteDiv = createWhiteDiv(this.m_tableDiv);
            l_noteDiv.style.textAlign = "center";
            l_noteDiv.innerHTML = this.m_emptyMessage;
        }*/
	// $("hey1223").innerHTML ="tesT";
	 //   $("hey1223").hide("slide", { direction: "up" }, 0);
	  //  this.m_contentTBody.style.display = "none";
	//    $(this.m_contentTBody).hide();
	    
	//  $(this.m_contentTBody).slideDown(10000);


   //   $(this.m_contentTBody).show("slide", { direction: "down" }, 10000);
    }


	FightListDiv.prototype.onGetFightList52 = function(a_responseData, a_contentTBody){
  //  a_contentTBody.id ="hey1223";
 ////outputDebug("onGetFightList42");
 
 while(a_contentTBody.hasChildNodes())
{
a_contentTBody.removeChild(a_contentTBody.firstChild);
}
 
 
jsonS = parseJSON2(a_responseData.text);//.parseJSON();
       // var l_xmlDoc = getGadgetResponseData(a_responseData);
       // var l_numTargets = undefined;
        //if(isValid(jsonS)){
		
		  var l_enemyUser = new User(undefined);
		
		     l_enemyUser.m_userId = jsonS.root.users.u.user_id;
			  //outputDebug("onGetFightList42 l_enemyUser.m_userId" + l_enemyUser.m_userId);
		     l_enemyUser.m_usernetworkid = jsonS.root.users.u.networktype;
		       l_enemyUser.m_mobName = jsonS.root.users.u.username;
		       l_enemyUser.m_thumbnail_url = jsonS.root.users.u.tn;
		        
			  a_contentTBody.appendChild(this.createContentElementU(l_enemyUser));
		   
		   
		   
		   
		   	
			
			for(var p_index = 0; p_index < jsonS.root.users.u.cars.length; p_index++){
			    
				 a_contentTBody.appendChild(this.createContentElementC(jsonS.root.users.u.cars[p_index],l_enemyUser));
			     // //outputDebug("onGetFightList52 jsonS.root.users.u.car[p_index].LandName" + jsonS.root.users.u.cars[p_index].LandName);
				  
			//     a_contentTBody.appendChild(this.createContentElementL(jsonS.root.users.u.land[p_index],l_enemyUser));
			   //   //outputDebug("onGetFightList42 jsonS.root.users.u.land[p_index].LandName" + jsonS.root.users.u.land[p_index].LandName);
			}
			
		/*{"root":{"users":{"i":"1","u":{"user_id":"121731160","networktype":"2","username":"Shady B","tn":
		"http://a699.ac-images.myspacecdn.com/images01/31/s_26a593d86090c4b87a29416f9efc9ab2.jpg","land":
		[{"UserLandID":"6119","Icon":"http://www.bigideastech.com/crime/images/Properties/icons/Shipyard-120x80.jpg","LandID":"8","LandName":"Shipyard","Number":"50"},{"UserLandID":"6120","Icon":"http://www.bigideastech.com/crime/images/Properties/icons/skyofficebuilding-120x80.jpg","LandID":"6","LandName":"Sky Skraper Office","Number":"34764"},{"UserLandID":"6121","Icon":"http://www.bigideastech.com/crime/images/Properties/icons/store_rims-120x80.jpg","LandID":"9","LandName":"Rims Shop","Number":"5794"},{"UserLandID":"6122","Icon":"http://www.bigideastech.com/crime/images/Properties/icons/Old-shack-120x80.jpg","LandID":"1","LandName":"Old shack","Number":"27"}]}}}}
		*/
		
    }
	
  FightListDiv.prototype.onGetFightList42 = function(a_responseData, a_contentTBody){
  //  a_contentTBody.id ="hey1223";
 ////outputDebug("onGetFightList42");
 
 while(a_contentTBody.hasChildNodes())
{
a_contentTBody.removeChild(a_contentTBody.firstChild);
}
 
 
jsonS = parseJSON2(a_responseData.text);//.parseJSON();
       // var l_xmlDoc = getGadgetResponseData(a_responseData);
       // var l_numTargets = undefined;
        //if(isValid(jsonS)){
		
		  var l_enemyUser = new User(undefined);
		
		     l_enemyUser.m_userId = jsonS.root.users.u.user_id;
			  //outputDebug("onGetFightList42 l_enemyUser.m_userId" + l_enemyUser.m_userId);
		     l_enemyUser.m_usernetworkid = jsonS.root.users.u.networktype;
		       l_enemyUser.m_mobName = jsonS.root.users.u.username;
		       l_enemyUser.m_thumbnail_url = jsonS.root.users.u.tn;
		        
			  a_contentTBody.appendChild(this.createContentElementU(l_enemyUser));
		   
		   
		   
		   
		   	
			
			for(var p_index = 0; p_index < jsonS.root.users.u.land.length; p_index++){
			    
			     a_contentTBody.appendChild(this.createContentElementL(jsonS.root.users.u.land[p_index],l_enemyUser));
			      //outputDebug("onGetFightList42 jsonS.root.users.u.land[p_index].LandName" + jsonS.root.users.u.land[p_index].LandName);
			}
			
		/*{"root":{"users":{"i":"1","u":{"user_id":"121731160","networktype":"2","username":"Shady B","tn":
		"http://a699.ac-images.myspacecdn.com/images01/31/s_26a593d86090c4b87a29416f9efc9ab2.jpg","land":
		[{"UserLandID":"6119","Icon":"http://www.bigideastech.com/crime/images/Properties/icons/Shipyard-120x80.jpg","LandID":"8","LandName":"Shipyard","Number":"50"},{"UserLandID":"6120","Icon":"http://www.bigideastech.com/crime/images/Properties/icons/skyofficebuilding-120x80.jpg","LandID":"6","LandName":"Sky Skraper Office","Number":"34764"},{"UserLandID":"6121","Icon":"http://www.bigideastech.com/crime/images/Properties/icons/store_rims-120x80.jpg","LandID":"9","LandName":"Rims Shop","Number":"5794"},{"UserLandID":"6122","Icon":"http://www.bigideastech.com/crime/images/Properties/icons/Old-shack-120x80.jpg","LandID":"1","LandName":"Old shack","Number":"27"}]}}}}
		*/
		
    }
    
    
    
  FightListDiv.prototype.onGetFightList3 = function(a_responseData, a_contentTBody){
  //  a_contentTBody.id ="hey1223";
 
jsonS = parseJSON2(a_responseData.text);//.parseJSON();
       // var l_xmlDoc = getGadgetResponseData(a_responseData);
       // var l_numTargets = undefined;
        //if(isValid(jsonS)){
            try{
               // l_numTargets = parseInt(getXMLNodeValue(l_xmlDoc, "num_targets"));                

         //       var l_targetUserNodes = l_xmlDoc.getElementsByTagName("user");
		var count = 0;
		
		
                for(var l_index = 0; l_index < jsonS.outer.xml.targets.user.length; l_index++){
                    var l_friendUser = new User(undefined);
		     var l_enemyUser = new User(undefined);
		     var l_gain = '';
		     var l_timeago = '';
		     
		       l_friendUser.m_userId = jsonS.outer.xml.targets.user[l_index].fn_id;
		      l_friendUser.m_usernetworkid = jsonS.outer.xml.targets.user[l_index].fu_nd;
		     l_friendUser.m_mobName = jsonS.outer.xml.targets.user[l_index].fu_un;
		     l_friendUser.m_thumbnail_url = jsonS.outer.xml.targets.user[l_index].fu_tn;
		     
		     l_enemyUser.m_userId = jsonS.outer.xml.targets.user[l_index].eu_id;
		      l_enemyUser.m_usernetworkid = jsonS.outer.xml.targets.user[l_index].eu_nd;
		     l_enemyUser.m_mobName = jsonS.outer.xml.targets.user[l_index].eu_un;
		     l_enemyUser.m_thumbnail_url = jsonS.outer.xml.targets.user[l_index].eu_tn;
		    try{
			l_gain  = jsonS.outer.xml.targets.user[l_index].gain;
			}
			catch (err)
			{
			    
			    
			}
		     l_timeago  = jsonS.outer.xml.targets.user[l_index].date_ago;
		     
                 //   l_targetUser.createJSONUser(jsonS.outer.xml.targets.user[l_index]);
		 /*
		    l_targetUser.m_mobClass = jsonS.outer.xml.targets.user[l_index].mob_class;
      l_targetUser.m_thumbnail_url = jsonS.outer.xml.targets.user[l_index].TN;
     l_targetUser.m_mobName =  jsonS.outer.xml.targets.user[l_index].mob_name;
        // m_mobClass , m_mobName, m_mobSize
	   l_targetUser.m_userId = jsonS.outer.xml.targets.user[l_index].userid;
	   l_targetUser.m_level = jsonS.outer.xml.targets.user[l_index].level;
	     
     
      
       l_targetUser.m_profile_url = jsonS.outer.xml.targets.user[l_index].ProfileURL;
        
	 
	     l_targetUser.m_mobSize =  jsonS.outer.xml.targets.user[l_index].mob_size;
	      l_targetUser.m_usernetworkid = jsonS.outer.xml.targets.user[l_index].usernetworkid;
		 
		 */
                    a_contentTBody.appendChild(this.createContentElementF(l_friendUser,l_enemyUser,l_gain,l_timeago));
		    count++;
		    
		    if(!(count % 20))
		    {
			
			        var l_tr = document.createElement("tr");

        var l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.color = "#FFFFFF";
     //   l_td.style.padding = "5px 10px 5px 10px";
    //    l_td.innerHTML = "<a target=\"_blank\" href=\""+ GBL.APP_CANVAS_URL + "appParams=%7B%22"+GBL.SHOW_USER_ID+"%22%3A%22"+a_targetUser.getUserId()+"%22%7D\" >" + "<span style='color:#3E99C3; font-weight:bold;'> <img width=\"50\" height=\"50\" src=\'" + a_targetUser.getThumbnailUrl() + "\'/>" + a_targetUser.getMobName() + " </span>, Level " + a_targetUser.getLevel() + " " + a_targetUser.getMobClass() + "</span></a>";
        l_td.style.cursor = "pointer";
	
			//var AdDiv = document.createElement("div"); 
		 l_td.innerHTML  = getadtype2();;
		//	AdDiv.style.textAlign = "center";
		/*
		            tabContentDiv.style.position = "absolute";
            tabContentDiv.style.top = m_hideContentDivTopPosition;
            tabContentDiv.style.left = "55px";
            tabContentDiv.style.width = "860px";
            tabContentDiv.style.zIndex = "1";*/
		a_contentTBody.appendChild(l_tr);
		
		//	this.m_containerDiv.appendChild(AdDiv);
		    }
                }
            } catch (err) { outputAlert("onGetJobList " + err);}
    //    }

        /*if(!isValid(l_numTargets) || l_numTargets <= 0){
            var l_noteDiv = createWhiteDiv(this.m_tableDiv);
            l_noteDiv.style.textAlign = "center";
            l_noteDiv.innerHTML = this.m_emptyMessage;
        }*/
	// $("hey1223").innerHTML ="tesT";
	 //   $("hey1223").hide("slide", { direction: "up" }, 0);
	  //  this.m_contentTBody.style.display = "none";
	//    $(this.m_contentTBody).hide();
	    
	//  $(this.m_contentTBody).slideDown(10000);


   //   $(this.m_contentTBody).show("slide", { direction: "down" }, 10000);
    }

  FightListDiv.prototype.onGetFightList2 = function(a_responseData, a_contentTBody,io,id){
  //  a_contentTBody.id ="hey1223";
 
 while(a_contentTBody.hasChildNodes())
{
a_contentTBody.removeChild(a_contentTBody.firstChild);
}

jsonS = parseJSON2(a_responseData.text);//.parseJSON();

/*
this.m_title
*/


       // var l_xmlDoc = getGadgetResponseData(a_responseData);
       // var l_numTargets = undefined;
        //if(isValid(jsonS)){ 
		
        //    try{
			
			var l_StatsInfo = document.createElement("table");
			
				while(this.m_title.hasChildNodes())
				{
				this.m_title.removeChild(this.m_title.firstChild);
				}
			
			this.m_title.appendChild(l_StatsInfo);
			
			
			
			
			var l_mainTabletbody=   document.createElement("tbody");
			l_StatsInfo.appendChild(l_mainTabletbody);
			
	var l_mainTabletr =   document.createElement("tr");
	l_mainTabletbody.appendChild(l_mainTabletr);
	
	//var l_mainTabletr2 =   document.createElement("tr");
	var l_mainTabletd1 =   document.createElement("td");
	
	l_mainTabletr.appendChild(l_mainTabletd1);
	l_mainTabletd1.innerHTML = ' <img style=\'margin-left:auto; margin-right:auto; background-repeat: repeat-x;\' src=\''+io+'\'/><span style=\'font-size:10px;color:#E70707; font-weight:bold;\'><b>Attack:</b></span><span style=\'font-size:10px;color:#FFFFFF; font-weight:bold;\'><b>' + jsonS.outer.xml.user.Attack + '</b></span>';
	
	
	// this.Kimg.innerHTML = "<img style='margin-left:auto; margin-right:auto; background-repeat: repeat-x;' src='http://www.laasex.com/crime/images/UI/icons/bullet-holes1.png'/> ";
	
	//jsonS.outer.xml.ADamageGuns
	//jsonS.outer.xml.ATopWeaponIcon
	/*
		{"outer":{"xml":{"user":{"ADamageGuns":"9120","ADamageArmor":"1937","ADamageVehicles":"262","ADamageItems":"691","ADamagePets":"1307","ADamageSpecials":"117","ADamageLand":"0","DDamageGuns":"6472","DDamageArmor":"2137","DDamageVehicles":"15100","DDamageItems":"3171","DDamagePets":"1186","DDamageLand":"0","NumWeaponsA":"151","NumWeaponsD":"151","NumVehiclesA":"151","NumVehiclesD":"151","NumArmorA":"132","NumArmorD":"132","NumItemsA":"151","NumItemsD":"151","NumLandA":"0","NumLandD":"0","NumPetsA":"151","NumPetsD":"151","NumSpecialsA":"18","NumSpecialsD":"18","ATopWeaponIcon":"big-hammer-120x80.png","ATopWeaponName":"Big Hammer","DTopWeaponIcon":"brass_knucles-120x80.png","DTopWeaponName":"brass_knucles-120x80.png","ATopVehiclesIcon":"Oka.png","ATopVehiclesName":"Oka","DTopVehiclesIcon":"quad.png","DTopVehiclesName":"quad.png","ATopArmorIcon":"http://bigideastech.com/c","ATopArmorName":"Bullet Proof vest","DTopArmorIcon":"http://bigideastech.com/c","DTopArmorName":"http://bigideastech.com/c","ATopItemsIcon":"http://www.bigideastech.c","ATopItemsName":"Bullet Proof Folder","DTopItemsIcon":"http://www.bigideastech.c","DTopItemsName":"http://www.bigideastech.c","ATopPetsIcon":"Yorkie-120x80.jpg","ATopPetsName":"Yorkie","DTopPetsIcon":"Yorkie-120x80.jpg","DTopPetsName":"Yorkie-120x80.jpg","ATopSpecialsIcon":"http://p.laasex.com/pimpw","ATopSpecialsName":"Speicial Item","DTopSpecialsIcon":"http://p.laasex.com/pimpw","DTopSpecialsName":"http://p.laasex.com/pimpw"}
		   
		*/   
		// calcpercent
		//this.m_sidestats.innerHTML = 'NumGuns: ' + jsonS.outer.xml.numfriends + ' guns: ' + jsonS.outer.xml.user.NumWeaponsA  + ' armor: ' + jsonS.outer.xml.user.NumArmorA; 
		
	/*	var l_gunsInfo =  document.createElement("div");
		l_gunsInfo.innerHTML =  + jsonS.outer.xml.user.NumWeaponsA + '/' + jsonS.outer.xml.numfriends + ' weapons '; 
		      l_gunsInfo.style.color = "#E7CF07";
        l_gunsInfo.style.textAlign = "center";
        l_gunsInfo.style.fontSize = "10px";
        l_gunsInfo.style.fontWeight = "bold";
		
		
			var l_gunsBar =  document.createElement("div");
			
			l_gunsBar.style.width =  "138px";
			l_gunsBar.style.height =  "25px";
			
			var l_gunsBar2 =  document.createElement("div");
			l_gunsBar.appendChild(l_gunsBar2);
			var p = calcpercent(jsonS.outer.xml.user.NumWeaponsA,jsonS.outer.xml.numfriends);
		
			l_gunsBar2.style.backgroundImage = "url('http://www.bigideastech.com/crime/images/UI/buttons/progressR.png')";
			l_gunsBar2.style.width =  p+"%";
			l_gunsBar2.style.height =  "25px";
		
			
		this.m_sidestats.appendChild(l_gunsInfo);
			this.m_sidestats.appendChild(l_gunsBar);
			*/
			//equipment.png
		var	l_headersidestats =  document.createElement("div");
			
			l_headersidestats.style.backgroundImage = "url('http://www.bigideastech.com/crime/images/UI/buttons/equipment.png')";
			l_headersidestats.style.width =  "100px";
			l_headersidestats.style.height =  "25px";
			
			while(this.m_sidestats.hasChildNodes())
			{
				this.m_sidestats.removeChild(this.m_sidestats.firstChild);
			}
			
			//this.m_sidestats.innerHTML = 'sdf';

			
			this.m_sidestats.appendChild(l_headersidestats);
			
		this.m_sidestats.appendChild(ItemInfoFight(jsonS.outer.xml.user.NumWeaponsA,jsonS.outer.xml.numfriends,'Weapons'));
	 this.m_sidestats.appendChild(ItemBarFight(jsonS.outer.xml.user.NumWeaponsA,jsonS.outer.xml.numfriends));
// NumWeaponsA":"151","NumWeaponsD":"151","NumVehiclesA":"151","NumVehiclesD":"151",
//"NumArmorA":"132","NumArmorD":"132","NumItemsA":"151","NumItemsD":"151","NumLandA":"0","NumLandD":"0","NumPetsA":"151","NumPetsD":"151","NumSpecialsA
	 
				this.m_sidestats.appendChild(ItemInfoFight(jsonS.outer.xml.user.NumArmorA,jsonS.outer.xml.numfriends,'Armors'));
	 this.m_sidestats.appendChild(ItemBarFight(jsonS.outer.xml.user.NumArmorA,jsonS.outer.xml.numfriends));
	 
	 		this.m_sidestats.appendChild(ItemInfoFight(jsonS.outer.xml.user.NumArmorA,jsonS.outer.xml.numfriends,'Vehicles'));
	 this.m_sidestats.appendChild(ItemBarFight(jsonS.outer.xml.user.NumArmorA,jsonS.outer.xml.numfriends));
	 
	 	 		this.m_sidestats.appendChild(ItemInfoFight(jsonS.outer.xml.user.NumItemsA,jsonS.outer.xml.numfriends,'Items'));
	 this.m_sidestats.appendChild(ItemBarFight(jsonS.outer.xml.user.NumItemsA,jsonS.outer.xml.numfriends));
	 
			 		this.m_sidestats.appendChild(ItemInfoFight(jsonS.outer.xml.user.NumPetsA,jsonS.outer.xml.numfriends,'Pets'));
	 this.m_sidestats.appendChild(ItemBarFight(jsonS.outer.xml.user.NumPetsA,jsonS.outer.xml.numfriends));
		
			 		this.m_sidestats.appendChild(ItemInfoFight(jsonS.outer.xml.user.NumSpecialsA,jsonS.outer.xml.numfriends,'Specials'));
	 this.m_sidestats.appendChild(ItemBarFight(jsonS.outer.xml.user.NumSpecialsA,jsonS.outer.xml.numfriends));
		
			var l_addiv = document.createElement('div');
	l_addiv.innerHTML += '<iframe marginwidth="0" marginheight="0" src="http://www.sandiegorhythmicgymnastics.com/2/adparlor120x600.htm" scrolling="no" width="120" frameborder="0" height="600"></iframe><br/>';
	l_addiv.innerHTML += '<iframe marginwidth="0" marginheight="0" src="http://www.sandiegorhythmicgymnastics.com/2/cubics120x600.htm" scrolling="no" width="120" frameborder="0" height="600"></iframe><br/>';
	l_addiv.innerHTML += '<iframe marginwidth="0" marginheight="0" src="http://www.sandiegorhythmicgymnastics.com/2/clicksor120x600.htm" scrolling="no" width="120" frameborder="0" height="600"></iframe><br/>';
	l_addiv.innerHTML += '<iframe marginwidth="0" marginheight="0" src="http://www.sandiegorhythmicgymnastics.com/2/google120x600.htm" scrolling="no" width="120" frameborder="0" height="600"></iframe><br/>';
	l_addiv.innerHTML += '<iframe marginwidth="0" marginheight="0" src="http://www.sandiegorhythmicgymnastics.com/2/adparlor125x125.htm" scrolling="no" width="125" frameborder="0" height="125"></iframe><br/>';
		l_addiv.innerHTML += '<iframe marginwidth="0" marginheight="0" src="http://www.sandiegorhythmicgymnastics.com/2/cubics125x125.htm" scrolling="no" width="125" frameborder="0" height="125"></iframe><br/>';
	l_addiv.innerHTML += '<iframe marginwidth="0" marginheight="0" src="http://www.sandiegorhythmicgymnastics.com/2/google120x240.htm" scrolling="no" width="120" frameborder="0" height="240"></iframe><br/>';
		l_addiv.innerHTML += '<iframe marginwidth="0" marginheight="0" src="http://www.sandiegorhythmicgymnastics.com/2/adparlor125x60.htm" scrolling="no" width="125" frameborder="0" height="60"></iframe><br/>';
		l_addiv.innerHTML += '<iframe marginwidth="0" marginheight="0" src="http://www.sandiegorhythmicgymnastics.com/2/clicksor120x240.htm" scrolling="no" width="120" frameborder="0" height="240"></iframe><br/>';
	
	//google120x600.htm
	//
	this.m_sidestats.appendChild(l_addiv);
		
		
		if(jsonS.outer.xml.user.ATopWeaponName){
		ItemTopFight(jsonS.outer.xml.user.ATopWeaponIcon,"http://www.bigideastech.com/crime/images/weapons/icons/",jsonS.outer.xml.user.ATopWeaponName,l_mainTabletr);
	}
	
	/*var l_mainTabletd3 =   document.createElement("td");
	l_mainTabletr.appendChild(l_mainTabletd3); 
	
	l_mainTabletd3.innerHTML =  '<img style=\'margin-left:auto; margin-right:auto; width:50%;   height:50%;   background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/armor/icons/'+jsonS.outer.xml.user.ATopArmorIcon+'\'/>';
	*/
	if(jsonS.outer.xml.user.ATopArmorName){
	ItemTopFight(jsonS.outer.xml.user.ATopArmorIcon,"http://www.bigideastech.com/crime/images/armor/icons/",jsonS.outer.xml.user.ATopArmorName,l_mainTabletr);
	}
	
	
	
	/*var l_mainTabletd4 =   document.createElement("td");
	l_mainTabletr.appendChild(l_mainTabletd4);
	l_mainTabletd4.innerHTML =  '<img style=\'margin-left:auto; margin-right:auto; width:50%;   height:50%;   background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/cars/icons/'+jsonS.outer.xml.user.ATopVehiclesIcon+'\'/>';
	*/
	if(jsonS.outer.xml.user.ATopVehiclesName){
	ItemTopFight(jsonS.outer.xml.user.ATopVehiclesIcon,"http://www.bigideastech.com/crime/images/cars/icons/",jsonS.outer.xml.user.ATopVehiclesName,l_mainTabletr);
	}
	
	/*var l_mainTabletd5 =   document.createElement("td");
	l_mainTabletr.appendChild(l_mainTabletd5);
	l_mainTabletd5.innerHTML = '<img style=\'margin-left:auto; margin-right:auto; width:50%;   height:50%;   background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/items/icon/'+jsonS.outer.xml.user.ATopItemsIcon+'\'/>';
	*/
	if(jsonS.outer.xml.user.ATopItemsName){
	  ItemTopFight(jsonS.outer.xml.user.ATopItemsIcon,"http://www.bigideastech.com/crime/images/items/icon/",jsonS.outer.xml.user.ATopItemsName,l_mainTabletr);
	}
	/*
	var l_mainTabletd6 =   document.createElement("td");
	l_mainTabletr.appendChild(l_mainTabletd6);
	l_mainTabletd6.innerHTML =  '<img style=\'margin-left:auto; margin-right:auto; width:50%;   height:50%;   background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/pets/icons/'+jsonS.outer.xml.user.ATopPetsIcon+'\'/>';
	*/
	if(jsonS.outer.xml.user.ATopPetsName)
	{
	ItemTopFight(jsonS.outer.xml.user.ATopPetsIcon,"http://www.bigideastech.com/crime/images/pets/icons/",jsonS.outer.xml.user.ATopPetsName,l_mainTabletr);
	}
	
	
	/*	var l_mainTabletd7 =   document.createElement("td");
	l_mainTabletr.appendChild(l_mainTabletd7);
	l_mainTabletd7.innerHTML =  '<img style=\'margin-left:auto; margin-right:auto; width:50%;   height:50%;   background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/specials/icons/'+jsonS.outer.xml.user.ATopSpecialsIcon+'\'/>';
	
	*/
	if(jsonS.outer.xml.user.ATopSpecialsName){
	ItemTopFight(jsonS.outer.xml.user.ATopSpecialsIcon,"http://www.bigideastech.com/crime/images/specials/icons/",jsonS.outer.xml.user.ATopSpecialsName,l_mainTabletr);
	}
	
	/*
	 var l_mainTabletd8 =   document.createElement("td");
	l_mainTabletr.appendChild(l_mainTabletd8);
	l_mainTabletd8.innerHTML = 'Land: ' + jsonS.outer.xml.user.ADamageLand + '<img style=\'margin-left:auto; margin-right:auto; width:50%;   height:50%;   background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/land/icons/'+jsonS.outer.xml.user.ATopLandIcon+'\'/>';
	*/
	
	
	
		var l_mainTabletr2 =   document.createElement("tr");
	l_mainTabletbody.appendChild(l_mainTabletr2);
	//l_mainTabletr2.height = "100px";
	//l_mainTabletr2.style.height = "100px";
	var l_mainTabletd10 =   document.createElement("td");
	
	l_mainTabletr2.appendChild(l_mainTabletd10);
	
	l_mainTabletd10.innerHTML = '<img style=\'margin-left:auto; margin-right:auto; background-repeat: repeat-x;\' src=\''+id+'\'/><span style=\'font-size:10px;color:#2F1ED0; font-weight:bold;\'><b>Defense:</b></span><span style=\'font-size:10px;color:#FFFFFF; font-weight:bold;\'><b>' + jsonS.outer.xml.user.Defense + '</b></span>';
	
	/*
	var l_mainTabletd11 =   document.createElement("td");
			l_mainTabletr2.appendChild(l_mainTabletd11);
			l_mainTabletd11.innerHTML =  '<img style=\'margin-left:auto; margin-right:auto; width:70%;   height:70%;   background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/weapons/icons/'+jsonS.outer.xml.user.DTopWeaponIcon+'\'/>';
	*/
	if(jsonS.outer.xml.user.DTopWeaponName){
	ItemTopFight(jsonS.outer.xml.user.DTopWeaponIcon,"http://www.bigideastech.com/crime/images/weapons/icons/",jsonS.outer.xml.user.DTopWeaponName,l_mainTabletr2);
	}
	
	/*
	var l_mainTabletd12 =   document.createElement("td");
	l_mainTabletr2.appendChild(l_mainTabletd12);
	
	l_mainTabletd12.innerHTML =  '<img style=\'margin-left:auto; margin-right:auto; width:50%;   height:50%;   background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/armor/icons/'+jsonS.outer.xml.user.DTopArmorIcon+'\'/>';
	*/
	if(jsonS.outer.xml.user.DTopArmorName){
	ItemTopFight(jsonS.outer.xml.user.DTopArmorIcon,"http://www.bigideastech.com/crime/images/armor/icons/",jsonS.outer.xml.user.DTopArmorName,l_mainTabletr2);
	}
	
	/*
	var l_mainTabletd13 =   document.createElement("td");
	l_mainTabletr2.appendChild(l_mainTabletd13);
	l_mainTabletd13.innerHTML =  '<img style=\'margin-left:auto; margin-right:auto; width:50%;   height:50%;   background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/cars/icons/'+jsonS.outer.xml.user.DTopVehiclesIcon+'\'/>';
	*/
	if(jsonS.outer.xml.user.DTopVehiclesName){
	ItemTopFight(jsonS.outer.xml.user.DTopVehiclesIcon,"http://www.bigideastech.com/crime/images/cars/icons/",jsonS.outer.xml.user.DTopVehiclesName,l_mainTabletr2);
	}
	
	/*var l_mainTabletd14 =   document.createElement("td");
	l_mainTabletr2.appendChild(l_mainTabletd14);
	l_mainTabletd14.innerHTML = '<img style=\'margin-left:auto; margin-right:auto; width:50%;   height:50%;   background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/items/icon/'+jsonS.outer.xml.user.DTopItemsIcon+'\'/>';
	*/
	if(jsonS.outer.xml.user.DTopItemsName){
	ItemTopFight(jsonS.outer.xml.user.DTopItemsIcon,"http://www.bigideastech.com/crime/images/items/icon/",jsonS.outer.xml.user.DTopItemsName,l_mainTabletr2);
	}
	    
	/*
	var l_mainTabletd15 =   document.createElement("td");
	l_mainTabletr2.appendChild(l_mainTabletd15);
	l_mainTabletd15.innerHTML =  '<img style=\'margin-left:auto; margin-right:auto; width:50%;    height:50%;  background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/pets/icons/'+jsonS.outer.xml.user.DTopPetsIcon+'\'/>';
	 */
	 if(jsonS.outer.xml.user.DTopPetsName){
	 ItemTopFight(jsonS.outer.xml.user.DTopPetsIcon,"http://www.bigideastech.com/crime/images/pets/icons/",jsonS.outer.xml.user.DTopPetsName,l_mainTabletr2);
	}
	   
	
	   /*
		var l_mainTabletd16 =   document.createElement("td");
	l_mainTabletr2.appendChild(l_mainTabletd16);
	l_mainTabletd16.innerHTML =  '<img style=\'margin-left:auto; margin-right:auto;width:50%;    height:50%;   background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/specials/icons/'+jsonS.outer.xml.user.DTopSpecialsIcon+'\'/>';
	*/
	 if(jsonS.outer.xml.user.DTopSpecialsName){
	ItemTopFight(jsonS.outer.xml.user.DTopSpecialsIcon,"http://www.bigideastech.com/crime/images/specials/icons/",jsonS.outer.xml.user.DTopSpecialsName,l_mainTabletr2);
	}
	
	/*
		var l_mainTabletr2 =   document.createElement("tr");
	l_mainTabletbody.appendChild(l_mainTabletr2);
	
	var l_mainTabletd10 =   document.createElement("td");
	
	l_mainTabletr.appendChild(l_mainTabletd10);
	l_mainTabletd10.innerHTML = '<img style=\'margin-left:auto; margin-right:auto; background-repeat: repeat-x;\' src=\'http://www.laasex.com/crime/images/UI/stats/D2.png\'/> ';
	
	var l_mainTabletd11 =   document.createElement("td");
			l_mainTabletr2.appendChild(l_mainTabletd11);
			l_mainTabletd11.innerHTML = 'Guns: ' + jsonS.outer.xml.user.DDamageGuns + '<img style=\'margin-left:auto; margin-right:auto; width:50px; width:50px; height:33px;  background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/weapons/icons/'+jsonS.outer.xml.user.DTopWeaponIcon+'\'/>';
	
	var l_mainTabletd12 =   document.createElement("td");
	l_mainTabletr2.appendChild(l_mainTabletd12);
	
	l_mainTabletd12.innerHTML = 'Armor: ' + jsonS.outer.xml.user.DDamageArmor + '<img style=\'margin-left:auto; margin-right:auto; width:50px; width:50px; height:33px;  background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/armor/icons/'+jsonS.outer.xml.user.DTopArmorIcon+'\'/>';
	
	var l_mainTabletd13 =   document.createElement("td");
	l_mainTabletr2.appendChild(l_mainTabletd13);
	l_mainTabletd13.innerHTML = 'Vehicles: ' + jsonS.outer.xml.user.DDamageVehicles + '<img style=\'margin-left:auto; margin-right:auto; width:50px; width:50px; height:33px;  background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/cars/icons/'+jsonS.outer.xml.user.DTopVehiclesIcon+'\'/>';
	
	
	var l_mainTabletd14 =   document.createElement("td");
	l_mainTabletr2.appendChild(l_mainTabletd14);
	l_mainTabletd14.innerHTML = 'Items: ' + jsonS.outer.xml.user.DDamageItems + '<img style=\'margin-left:auto; margin-right:auto; width:50px; width:50px; height:33px;  background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/items/icon/'+jsonS.outer.xml.user.DTopItemsIcon+'\'/>';
	
	    
	
	var l_mainTabletd15 =   document.createElement("td");
	l_mainTabletr2.appendChild(l_mainTabletd15);
	l_mainTabletd15.innerHTML = 'Pets: ' + jsonS.outer.xml.user.DDamagePets + '<img style=\'margin-left:auto; margin-right:auto; width:50px; width:50px; height:33px;  background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/pets/icons/'+jsonS.outer.xml.user.DTopPetsIcon+'\'/>';
	 
	
	   
		var l_mainTabletd16 =   document.createElement("td");
	l_mainTabletr2.appendChild(l_mainTabletd16);
	l_mainTabletd16.innerHTML = 'Specials: ' + jsonS.outer.xml.user.DDamageSpecials + '<img style=\'margin-left:auto; margin-right:auto; width:50px; width:50px; height:33px;  background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/specials/icons/'+jsonS.outer.xml.user.DTopSpecialsIcon+'\'/>';
	
	
	
	 var l_mainTabletd17 =   document.createElement("td");
	l_mainTabletr2.appendChild(l_mainTabletd17);
	l_mainTabletd17.innerHTML = 'Land: ' + jsonS.outer.xml.user.DDamageLand + '<img style=\'margin-left:auto; margin-right:auto; width:50px; width:50px; height:33px;  background-repeat: repeat-x;\' src=\'http://www.bigideastech.com/crime/images/Properties/icons/'+jsonS.outer.xml.user.DTopLandIcon+'\'/>';
	*/
		var l_mainTabletr3 =   document.createElement("tr");
	l_mainTabletbody.appendChild(l_mainTabletr3);
	
	var l_mainTabletd20 =   document.createElement("td");
	
	l_mainTabletr3.appendChild(l_mainTabletd20);
	l_mainTabletd20.innerHTML = '<img style=\'margin-left:auto; margin-right:auto; background-repeat: repeat-x;\' src=\'http://www.laasex.com/crime/images/UI/stats/f.png\'/><span style=\'font-size:10px;color:#0CC041; font-weight:bold;\'><b>Organization:</b></span><span style=\'font-size:10px;color:#FFFFFF; font-weight:bold;\'><b>' + jsonS.outer.xml.numfriends + '</b></span>';// '+jsonS.outer.xml.user.NumItemsA,jsonS.outer.xml.numfriends;
	//<span style=\'font-size:10px;color:#2F1ED0; font-weight:bold;\'><b>Defense:</b></span><span style=\'font-size:10px;color:#FFFFFF; font-weight:bold;\'><b>
	//	l_mainTabletr3.appendChild(l_mainTabletd20);
	//l_mainTabletd20.innerHTML = '<img style=\'margin-left:auto; margin-right:auto; background-repeat: repeat-x;\' src=\'http://www.laasex.com/crime/images/UI/stats/f.png\'/> '+jsonS.outer.xml.user.NumItemsA,jsonS.outer.xml.numfriends;
	/*
	,{"mob_class":"Mogul","UCT":"8","TN":"http://a60.ac-images.myspacecdn.com/images01/32/s_429b1dc4f16b3c47fd63c744bd82d52b.jpg","mob_name":"djajich","userid":"53541900","level":"167","mob_size":"63","usernetworkid":"2","ProfileURL":"http://www.myspace.com/Cory_Djajich"},{"mob_class":"Physco","UCT":"7","TN":"http://c2.ac-images.myspacecdn.com/images02/79/s_9d14db4e87154170bff21be50fd33b91.jpg","mob_name":"Str8","userid":"231695088","level":"168","mob_size":"58","usernetworkid":"2","ProfileURL":"http://www.myspace.com/nocchitloose"}]},"numfriends":"152","friends":{"Username":["LADY CAPONE","Wish you would","badangel","Pepper","Dark Crime Boss","cmobsta","Curtis Jackson","okok","funkyponger","nikkerbokker"],"TN":["http://c1.ac-images.myspacecdn.com/images01/21/s_401481f9dc9680fa4ecef26acf62b938.jpg","http://c1.ac-images.myspacecdn.com/images02/39/s_dc9e5c5a78164ace862294345442e174.jpg","http://a584.ac-images.myspacecdn.com/images01/44/s_dcbd27ac515cef1471e746a3fbc4bc17.jpg","http://a514.ac-images.myspacecdn.com/images01/93/s_69f9f30cd93ae37acbaa4d8f5b66b969.jpg","http://c3.ac-images.myspacecdn.com/images01/87/s_77db4ee6089cf422bf224e6733475426.jpg","http://c1.ac-images.myspacecdn.com/images02/42/s_3203d2dacf654217babb39618460ae48.jpg","http://a173.ac-images.myspacecdn.com/images01/88/s_060c995cd37d667bda13106f5ca4162c.jpg","http://x.myspacecdn.com/images/no_pic.gif","http://x.myspacecdn.com/images/no_pic.gif","http://a196.ac-images.myspacecdn.com/images01/50/s_65fb658da7117f9bd37681df95037efb.jpg"],"UCT":["1","1","5","8","5","7","10","2","7","8"],"lastlogin":["2009-10-31T13:52:34.880","2009-10-31T13:35:04.887","2009-10-31T02:21:08.167","2009-10-29T23:33:15.427","2009-10-28T11:10:56.303","2009-10-28T00:29:58.530","2009-10-26T00:31:12.230","2009-10-23T03:19:40.417","2009-10-22T23:43:35.617","2009-10-21T06:11:14.547"]}}}}
	*/
	if(jsonS.outer.xml.friends)
	{
	if(jsonS.outer.xml.numfriends > 2)
	{
	for(var i = 0; i < jsonS.outer.xml.friends.Username.length; i++)
	{
	var l_mainTableFriendTD =  document.createElement("td");
	
	var gentitle = jsonS.outer.xml.friends.Username[i] +" Last logged on: "+ jsonS.outer.xml.friends.lastlogin[i];
	//l_mainTableFriendTD.style.width = "80px";
	//l_mainTableFriendTD.style.height = "60px";
	
	l_mainTableFriendTD.innerHTML = "<span style='font-size:10px;color:#FFD927; font-weight:bold;'>"+ jsonS.outer.xml.friends.Username[i] + "</span><BR/>" + "<img style='margin-left:auto; margin-right:auto; width:50px; height:50px;' title='"+gentitle+"' alt='"+gentitle + "' "+"' src='"+jsonS.outer.xml.friends.TN[i]+"' />";
	
	//l_mainTableFriendTD.innerHTML = '<span style=\'font-size:10px;color:#FFD927; font-weight:bold;\'>'+ jsonS.outer.xml.friends.Username[i] + '</span><BR/><img title=\''+gentitle+'\' alt=\''+gentitle + '\' src=\''+jsonS.outer.xml.friends.TN[i]+'\' />';
	
	l_mainTabletr3.appendChild(l_mainTableFriendTD);
	
	}
	}
	else
	{
	
		var l_mainTableFriendTD =  document.createElement("td");
	
	var gentitle = jsonS.outer.xml.friends.Username +" Last logged on: "+ jsonS.outer.xml.friends.lastlogin;
	//l_mainTableFriendTD.style.width = "80px";
	//l_mainTableFriendTD.style.height = "60px";
	 
	l_mainTableFriendTD.innerHTML = "<span style='font-size:10px;color:#FFD927; font-weight:bold;'>"+ jsonS.outer.xml.friends.Username + "</span><BR/>" + "<img style='margin-left:auto; margin-right:auto; width:50px; height:50px;' title='"+gentitle+"' alt='"+gentitle + "' "+"' src='"+jsonS.outer.xml.friends.TN+"' />";
	
	//l_mainTableFriendTD.innerHTML = '<span style=\'font-size:10px;color:#FFD927; font-weight:bold;\'>'+ jsonS.outer.xml.friends.Username[i] + '</span><BR/><img title=\''+gentitle+'\' alt=\''+gentitle + '\' src=\''+jsonS.outer.xml.friends.TN[i]+'\' />';
	
	l_mainTabletr3.appendChild(l_mainTableFriendTD);
	
	
	
	}
	
	}
	
	
			//jsonS.outer.xml.user.ADamageGuns
			
               // l_numTargets = parseInt(getXMLNodeValue(l_xmlDoc, "num_targets"));                

         //       var l_targetUserNodes = l_xmlDoc.getElementsByTagName("user");
		var count = 0;
		
			var displaytype = 0;
		
		
		if(io==="http://www.laasex.com/crime/images/UI/buttons/DByA3.png")
		{
		
		displaytype = 2;
		}
		else if(io === "http://www.laasex.com/crime/images/UI/buttons/ASSA2.png")
		{
		displaytype = 1;
		}
		
                for(var l_index = 0; l_index < jsonS.outer.xml.targets.user.length; l_index++){
                    var l_targetUser = new User(undefined);
                 //   l_targetUser.createJSONUser(jsonS.outer.xml.targets.user[l_index]);
		    l_targetUser.m_mobClass = jsonS.outer.xml.targets.user[l_index].mob_class;
      l_targetUser.m_thumbnail_url = jsonS.outer.xml.targets.user[l_index].TN;
     l_targetUser.m_mobName =  jsonS.outer.xml.targets.user[l_index].mob_name;
        // m_mobClass , m_mobName, m_mobSize
	   l_targetUser.m_userId = jsonS.outer.xml.targets.user[l_index].userid;
	   l_targetUser.m_level = jsonS.outer.xml.targets.user[l_index].level;
	     
     
      
       l_targetUser.m_profile_url = jsonS.outer.xml.targets.user[l_index].ProfileURL;
        
	 
	     l_targetUser.m_mobSize =  jsonS.outer.xml.targets.user[l_index].mob_size;
	      l_targetUser.m_usernetworkid = jsonS.outer.xml.targets.user[l_index].usernetworkid;
		 
		 	 if(displaytype == 0)
		 {
                    a_contentTBody.appendChild(this.createContentElement(l_targetUser));
					}
					if(displaytype == 1)
					{
					 a_contentTBody.appendChild(this.createContentElementA(l_targetUser));
					
					}
					if(displaytype == 2)
					{
					 a_contentTBody.appendChild(this.createContentElementD(l_targetUser));
					
					}
		 
                  
		    count++;
		    
		    if(!(count % 20))
		    {
			
			        var l_tr = document.createElement("tr");

        var l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.color = "#FFFFFF";
     //   l_td.style.padding = "5px 10px 5px 10px";
    //    l_td.innerHTML = "<a target=\"_blank\" href=\""+ GBL.APP_CANVAS_URL + "appParams=%7B%22"+GBL.SHOW_USER_ID+"%22%3A%22"+a_targetUser.getUserId()+"%22%7D\" >" + "<span style='color:#3E99C3; font-weight:bold;'> <img width=\"50\" height=\"50\" src=\'" + a_targetUser.getThumbnailUrl() + "\'/>" + a_targetUser.getMobName() + " </span>, Level " + a_targetUser.getLevel() + " " + a_targetUser.getMobClass() + "</span></a>";
        l_td.style.cursor = "pointer";
	
			//var AdDiv = document.createElement("div"); 
		 l_td.innerHTML  = getadtype2();;
		//	AdDiv.style.textAlign = "center";
		/*
		            tabContentDiv.style.position = "absolute";
            tabContentDiv.style.top = m_hideContentDivTopPosition;
            tabContentDiv.style.left = "55px";
            tabContentDiv.style.width = "860px";
            tabContentDiv.style.zIndex = "1";*/
		a_contentTBody.appendChild(l_tr);
		
		//	this.m_containerDiv.appendChild(AdDiv);
		    }
                }
				
         //   } catch (err) { outputAlert("onGetJobList " + err);}
    //    }

        /*if(!isValid(l_numTargets) || l_numTargets <= 0){
            var l_noteDiv = createWhiteDiv(this.m_tableDiv);
            l_noteDiv.style.textAlign = "center";  
            l_noteDiv.innerHTML = this.m_emptyMessage;
        }*/
	// $("hey1223").innerHTML ="tesT";
	 //   $("hey1223").hide("slide", { direction: "up" }, 0);
	  //  this.m_contentTBody.style.display = "none";
	//    $(this.m_contentTBody).hide();
	    
//	  $(this.m_contentTBody).slideDown(10000);


   //   $(this.m_contentTBody).show("slide", { direction: "down" }, 10000);
    }

  FightListDiv.prototype.onGetFightList6 = function(a_responseData, a_contentTBody){
  //  a_contentTBody.id ="hey1223";
 while(a_contentTBody.hasChildNodes())
{
a_contentTBody.removeChild(a_contentTBody.firstChild);
}
jsonS = parseJSON2(a_responseData.text);//.parseJSON();


		
	
	
	
			//jsonS.outer.xml.user.ADamageGuns
			
               // l_numTargets = parseInt(getXMLNodeValue(l_xmlDoc, "num_targets"));                

         //       var l_targetUserNodes = l_xmlDoc.getElementsByTagName("user");
		var count = 0;
	
                for(var l_index = 0; l_index < jsonS.outer.xml.targets.user.length; l_index++){
                    var l_targetUser = new User(undefined);
                 //   l_targetUser.createJSONUser(jsonS.outer.xml.targets.user[l_index]);
		    l_targetUser.m_mobClass = jsonS.outer.xml.targets.user[l_index].mob_class;
      l_targetUser.m_thumbnail_url = jsonS.outer.xml.targets.user[l_index].TN;
     l_targetUser.m_mobName =  jsonS.outer.xml.targets.user[l_index].mob_name;
        // m_mobClass , m_mobName, m_mobSize
	   l_targetUser.m_userId = jsonS.outer.xml.targets.user[l_index].userid;
	   l_targetUser.m_level = jsonS.outer.xml.targets.user[l_index].level;
	     
     
      
       l_targetUser.m_profile_url = jsonS.outer.xml.targets.user[l_index].ProfileURL;
        
	 
	     l_targetUser.m_mobSize =  jsonS.outer.xml.targets.user[l_index].mob_size;
	      l_targetUser.m_usernetworkid = jsonS.outer.xml.targets.user[l_index].usernetworkid;
		  
		  a_contentTBody.appendChild(this.createContentElement(l_targetUser));
		  
	
		    count++;
		    
		    if(!(count % 20))
		    {
			
			        var l_tr = document.createElement("tr");

        var l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.color = "#FFFFFF";
     //   l_td.style.padding = "5px 10px 5px 10px";
    //    l_td.innerHTML = "<a target=\"_blank\" href=\""+ GBL.APP_CANVAS_URL + "appParams=%7B%22"+GBL.SHOW_USER_ID+"%22%3A%22"+a_targetUser.getUserId()+"%22%7D\" >" + "<span style='color:#3E99C3; font-weight:bold;'> <img width=\"50\" height=\"50\" src=\'" + a_targetUser.getThumbnailUrl() + "\'/>" + a_targetUser.getMobName() + " </span>, Level " + a_targetUser.getLevel() + " " + a_targetUser.getMobClass() + "</span></a>";
        l_td.style.cursor = "pointer";
	
			//var AdDiv = document.createElement("div"); 
		 l_td.innerHTML  = getadtype2();;
		//	AdDiv.style.textAlign = "center";
		/*
		            tabContentDiv.style.position = "absolute";
            tabContentDiv.style.top = m_hideContentDivTopPosition;
            tabContentDiv.style.left = "55px";
            tabContentDiv.style.width = "860px";
            tabContentDiv.style.zIndex = "1";*/
		a_contentTBody.appendChild(l_tr);
		
		//	this.m_containerDiv.appendChild(AdDiv);
		    }
                }

    }
	

	

    FightListDiv.prototype.onGetFightList = function(a_responseData, a_contentTBody){

        var l_xmlDoc = getGadgetResponseData(a_responseData);
        var l_numTargets = undefined;
	    
	 
	 
        if(isValid(l_xmlDoc)){
            try{
                l_numTargets = parseInt(getXMLNodeValue(l_xmlDoc, "num_targets"));                

                var l_targetUserNodes = l_xmlDoc.getElementsByTagName("user");
		var count = 0;
		
		
                for(var l_index = 0; l_index < l_targetUserNodes.length; l_index++){
                    var l_targetUser = new User(undefined);
                    l_targetUser.createXMLUser(l_targetUserNodes[l_index]);
                    a_contentTBody.appendChild(this.createContentElement(l_targetUser));
		    count++;
		    
		    if(!(count % 20))
		    {
			
			        var l_tr = document.createElement("tr");

        var l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.color = "#FFFFFF";
     //   l_td.style.padding = "5px 10px 5px 10px";
    //    l_td.innerHTML = "<a target=\"_blank\" href=\""+ GBL.APP_CANVAS_URL + "appParams=%7B%22"+GBL.SHOW_USER_ID+"%22%3A%22"+a_targetUser.getUserId()+"%22%7D\" >" + "<span style='color:#3E99C3; font-weight:bold;'> <img width=\"50\" height=\"50\" src=\'" + a_targetUser.getThumbnailUrl() + "\'/>" + a_targetUser.getMobName() + " </span>, Level " + a_targetUser.getLevel() + " " + a_targetUser.getMobClass() + "</span></a>";
        l_td.style.cursor = "pointer";
	
			//var AdDiv = document.createElement("div"); 
		 l_td.innerHTML  = getadtype2();;
		//	AdDiv.style.textAlign = "center";
		/*
		            tabContentDiv.style.position = "absolute";
            tabContentDiv.style.top = m_hideContentDivTopPosition;
            tabContentDiv.style.left = "55px";
            tabContentDiv.style.width = "860px";
            tabContentDiv.style.zIndex = "1";*/
		// a_contentTBody.appendChild(l_tr);
		
		//	this.m_containerDiv.appendChild(AdDiv);
		    }
                }
            } catch (err) { outputAlert("onGetJobList " + err);}
        }

        if(!isValid(l_numTargets) || l_numTargets <= 0){
            var l_noteDiv = createWhiteDiv(this.m_tableDiv);
            l_noteDiv.style.textAlign = "center";
            l_noteDiv.innerHTML = this.m_emptyMessage;
        }
//	 $(this.m_tableDiv).slideDown("slow");
 // $(this.m_tableDiv).hide();
        //$("div").show("slow");
	//    this.m_contentTBody.style.display = "none";
	//  $(this.m_contentTBody).show("slow");
    }
	
	 FightListDiv.prototype.attackUser = function(userid,networkid){
 
 var l_self = this;
 var l_params = {};
           l_params.aNID = GBL.MAIN_DATA.getViewer().getUserId();
           l_params.tNID =userid;
		   		   l_params.aT ="2"; 
		   l_params.tT=networkid; 	
		    l_params.f = "JGetAttackFight"
		   /*
		    l_params.f = "JGetTopPlayers3";
        var l_self = this;
	// http://crime.servegame.com/JSonService.aspx?f=JGetTopPlayers3&Page=2
	// 
        makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx"
		   */
           makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx",
                   function(a_response){handleResultJSON(a_response, l_self.m_resultDiv, function(){l_self.refresh();})},
                   l_params, 0);
					
 
 
 }
 
 
 //createContentElementG
  FightListDiv.prototype.createContentElementG = function(l_enemyUser){
// NewUser

        var l_tr = document.createElement("tr");

        var l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.color = "#FFFFFF";
        l_td.style.padding = "5px 10px 5px 10px";
        l_td.style.fontSize ="10px";
	
        l_td.innerHTML =  "<a target=\"_blank\" href=\""+ GBL.APP_CANVAS_URL + "appParams=%7B%22"+GBL.SHOW_USER_ID+"%22%3A%22"+l_enemyUser.getUserId()+"%22%7D\" >" + "<span style='color:#3E99C3; font-weight:bold;'><img width=\"50\" height=\"50\" src=\'" + l_enemyUser.getThumbnailUrl() + "\'/>" + l_enemyUser.getMobName() + " </span></a></span>";
      ;
      // l_td.innerHTML += "<a target=\"_blank\" href=\""+ GBL.APP_CANVAS_URL + "appParams=%7B%22"+GBL.SHOW_USER_ID+"%22%3A%22"+l_enemyUser.getUserId()+"%22%7D\" >" + "<span style='color:#3E99C3; font-weight:bold;'> <img width=\"50\" height=\"50\" src=\'" + l_enemyUser.getThumbnailUrl() + "\'/>" + l_enemyUser.getMobName() + " </span></a> with gain "+ l_gain+"</span>";
      
      
      
        l_td.style.cursor = "pointer";
      /*  addEvent(l_td, "click", function(){
            showUserStats(a_targetUser.getUserId());
        });
*/

        l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.color = "#FFFFFF";
        l_td.style.padding = "5px 10px 5px 10px";
        l_td.innerHTML = "Different Cars:"+ l_enemyUser.getNumCars();
/*

l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.color = "#FFFFFF";
        l_td.style.padding = "5px 10px 5px 10px";
	 l_td.innerHTML = l_enemyUser.getUserNetworkID();
         
         
	if( l_enemyUser.getUserNetworkID() == 2)
	{
	     l_td.innerHTML = "MySpace";
	    
	}
        else if ( l_enemyUser.getUserNetworkID() == 4)
	{
	     l_td.innerHTML = "Facebook";
	    
	}
        else if ( l_enemyUser.getUserNetworkID() == 8)
	{
	     l_td.innerHTML = "Hi5";
	    
	}
        else if ( l_enemyUser.getUserNetworkID() == 16)
	{
	     l_td.innerHTML = "Friendster";
	    
	}
	else if ( l_enemyUser.getUserNetworkID() == 1024)
	{
	     l_td.innerHTML = "Orkut";
	    
	}*/
        l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.padding = "5px 10px 5px 10px";

        var l_self = this;
	

        new DivButton(l_td, "GTA", function(){
		/*
var params = {};
params[opensocial.Activity.Field.TITLE_ID] = "Template_1";
params[opensocial.Activity.Field.TEMPLATE_PARAMS] = {};

var mediaItemArray = [];
mediaItemArray.push(opensocial.newMediaItem("", "http://api.myspace.com/v1/users/152564710"));
mediaItemArray.push(opensocial.newMediaItem("", "http://api.myspace.com/v1/users/152564710/albums/1639487/photos/895431"));
mediaItemArray.push(opensocial.newMediaItem("", "http://api.myspace.com/v1/users/152564710/albums/1639487/photos/895606"));
params[opensocial.Activity.Field.MEDIA_ITEMS] = mediaItemArray;

var activity = opensocial.newActivity(params);
opensocial.requestCreateActivity(activity, opensocial.CreateActivityPriority.HIGH, function(){});
 */
 
 // sendEmail(l_enemyUser.getUserId(),"Thanks for the car","I stole your buggatti",function(){});
      
// sendMessage(l_enemyUser.getUserId(),"Thanks for the car","I stole your buggatti",function(){}); 


     var l_params = {};
        l_params.aNID = GBL.MAIN_DATA.getViewer().getUserId();
	l_params.aT = "2";
	l_params.f = "JGetGTAListLevelNetworkSingle";
	l_params.TT = l_enemyUser.getUserId();
	l_params.TN = l_enemyUser.getUserNetworkID();
       /*l_enemyUser.getUserId(); 
					   l_params.attacteruseridNetwork ="2";
		  l_params.attackeduseridNetwork= l_enemyUser.getUserNetworkID();
        	l_params.f = "JGetTopPlayers3";
        var l_self = this;
	// http://crime.servegame.com/JSonService.aspx?f=JGetTopPlayers3&Page=2
	// 
        makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx", function(a_responseData){l_self.onGetMadeMen(a_responseData);}, l_params);
   
       */ 
	         l_self.m_resultDiv.showMessage(undefined, "Getting Car Listing for " + l_enemyUser.getMobName() + " ...");
            goToPageTop();
			
    //    makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/get_fight_list", function(a_responseData){
	makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx", function(a_responseData){
//           l_loadingDiv.style.display = "none";
           l_self.onGetFightList52(a_responseData, l_self.m_contentTBody);
        },l_params);


 /*
var params = {};
params[opensocial.Activity.Field.TITLE_ID] = "levelup1";
params[opensocial.Activity.Field.TEMPLATE_PARAMS] = {"username":""+GBL.MAIN_DATA.getViewer().getMobName(),
"level":"level "+GBL.MAIN_DATA.getViewer().getLevel(),"kills":""+GBL.MAIN_DATA.getViewer().getLevel()};

var mediaItemArray = [];
mediaItemArray.push(opensocial.newMediaItem("", "http://api.myspace.com/v1/users/"+GBL.MAIN_DATA.getViewer().getUserId()));
mediaItemArray.push(opensocial.newMediaItem("", "http://api.myspace.com/v1/users/152564710/albums/1639487/photos/39456380"));
params[opensocial.Activity.Field.MEDIA_ITEMS] = mediaItemArray;

var activity = opensocial.newActivity(params);
opensocial.requestCreateActivity(activity, opensocial.CreateActivityPriority.HIGH, function(){}); 
*/
 
      
/*
            var l_params = {};
            l_params.attacteruserid = GBL.MAIN_DATA.getViewer().getUserId();
            l_params.attackeduserid = l_enemyUser.getUserId();
					   l_params.attacteruseridNetwork ="2";
		  l_params.attackeduseridNetwork= l_enemyUser.getUserNetworkID();
		   
            l_params.level = GBL.MAIN_DATA.getViewer().getLevel();
            makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/JGetAttackRob",
                    function(a_response){handleResult(a_response, l_self.m_resultDiv, function(){
			
			})},
                    l_params, 0);
					*/
        });

        return l_tr;
    }
// createContentElementR

  FightListDiv.prototype.createContentElementR = function(l_enemyUser){
// NewUser

        var l_tr = document.createElement("tr");

        var l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.color = "#FFFFFF";
        l_td.style.padding = "5px 10px 5px 10px";
        l_td.style.fontSize ="10px";
	
        l_td.innerHTML =  "<a target=\"_blank\" href=\""+ GBL.APP_CANVAS_URL + "appParams=%7B%22"+GBL.SHOW_USER_ID+"%22%3A%22"+l_enemyUser.getUserId()+"%22%7D\" >" + "<span style='color:#3E99C3; font-weight:bold;'><img width=\"50\" height=\"50\" src=\'" + l_enemyUser.getThumbnailUrl() + "\'/>" + l_enemyUser.getMobName() + " </span></a> with </span>";
      ;
      // l_td.innerHTML += "<a target=\"_blank\" href=\""+ GBL.APP_CANVAS_URL + "appParams=%7B%22"+GBL.SHOW_USER_ID+"%22%3A%22"+l_enemyUser.getUserId()+"%22%7D\" >" + "<span style='color:#3E99C3; font-weight:bold;'> <img width=\"50\" height=\"50\" src=\'" + l_enemyUser.getThumbnailUrl() + "\'/>" + l_enemyUser.getMobName() + " </span></a> with gain "+ l_gain+"</span>";
      
      
      
        l_td.style.cursor = "pointer";
      /*  addEvent(l_td, "click", function(){
            showUserStats(a_targetUser.getUserId());
        });
*/

        l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.color = "#FFFFFF";
        l_td.style.padding = "5px 10px 5px 10px";
        l_td.innerHTML = "";


l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.color = "#FFFFFF";
        l_td.style.padding = "5px 10px 5px 10px";
	 l_td.innerHTML = l_enemyUser.getUserNetworkID();
         
         
	if( l_enemyUser.getUserNetworkID() == 2)
	{
	     l_td.innerHTML = "MySpace";
	    
	}
        else if ( l_enemyUser.getUserNetworkID() == 4)
	{
	     l_td.innerHTML = "Facebook";
	    
	}
        else if ( l_enemyUser.getUserNetworkID() == 8)
	{
	     l_td.innerHTML = "Hi5";
	    
	}
        else if ( l_enemyUser.getUserNetworkID() == 16)
	{
	     l_td.innerHTML = "Friendster";
	    
	}
	else if ( l_enemyUser.getUserNetworkID() == 1024)
	{
	     l_td.innerHTML = "Orkut";
	    
	}
        l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.padding = "5px 10px 5px 10px";

        var l_self = this;
	

        new DivButton(l_td, "Rob", function(){
		/*
var params = {};
params[opensocial.Activity.Field.TITLE_ID] = "Template_1";
params[opensocial.Activity.Field.TEMPLATE_PARAMS] = {};

var mediaItemArray = [];
mediaItemArray.push(opensocial.newMediaItem("", "http://api.myspace.com/v1/users/152564710"));
mediaItemArray.push(opensocial.newMediaItem("", "http://api.myspace.com/v1/users/152564710/albums/1639487/photos/895431"));
mediaItemArray.push(opensocial.newMediaItem("", "http://api.myspace.com/v1/users/152564710/albums/1639487/photos/895606"));
params[opensocial.Activity.Field.MEDIA_ITEMS] = mediaItemArray;

var activity = opensocial.newActivity(params);
opensocial.requestCreateActivity(activity, opensocial.CreateActivityPriority.HIGH, function(){});
 */
 
 // sendEmail(l_enemyUser.getUserId(),"Thanks for the car","I stole your buggatti",function(){});
      
// sendMessage(l_enemyUser.getUserId(),"Thanks for the car","I stole your buggatti",function(){}); 


     var l_params = {};
        l_params.aNID = GBL.MAIN_DATA.getViewer().getUserId();
	l_params.aT = "2";
	l_params.f = "JGetRobListLevelNetworkSingle";
	l_params.TT = l_enemyUser.getUserId();
	l_params.TN = l_enemyUser.getUserNetworkID();
       /*l_enemyUser.getUserId(); 
					   l_params.attacteruseridNetwork ="2";
		  l_params.attackeduseridNetwork= l_enemyUser.getUserNetworkID();
        	l_params.f = "JGetTopPlayers3";
        var l_self = this;
	// http://crime.servegame.com/JSonService.aspx?f=JGetTopPlayers3&Page=2
	// 
        makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx", function(a_responseData){l_self.onGetMadeMen(a_responseData);}, l_params);
   
       */ 
	         l_self.m_resultDiv.showMessage(undefined, "Getting Property Listing for " + l_enemyUser.getMobName() + " ...");
            goToPageTop();
			
    //    makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/get_fight_list", function(a_responseData){
	makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx", function(a_responseData){
//           l_loadingDiv.style.display = "none";
           l_self.onGetFightList42(a_responseData, l_self.m_contentTBody);
        },l_params);


 /*
var params = {};
params[opensocial.Activity.Field.TITLE_ID] = "levelup1";
params[opensocial.Activity.Field.TEMPLATE_PARAMS] = {"username":""+GBL.MAIN_DATA.getViewer().getMobName(),
"level":"level "+GBL.MAIN_DATA.getViewer().getLevel(),"kills":""+GBL.MAIN_DATA.getViewer().getLevel()};

var mediaItemArray = [];
mediaItemArray.push(opensocial.newMediaItem("", "http://api.myspace.com/v1/users/"+GBL.MAIN_DATA.getViewer().getUserId()));
mediaItemArray.push(opensocial.newMediaItem("", "http://api.myspace.com/v1/users/152564710/albums/1639487/photos/39456380"));
params[opensocial.Activity.Field.MEDIA_ITEMS] = mediaItemArray;

var activity = opensocial.newActivity(params);
opensocial.requestCreateActivity(activity, opensocial.CreateActivityPriority.HIGH, function(){}); 
*/
 
      
/*
            var l_params = {};
            l_params.attacteruserid = GBL.MAIN_DATA.getViewer().getUserId();
            l_params.attackeduserid = l_enemyUser.getUserId();
					   l_params.attacteruseridNetwork ="2";
		  l_params.attackeduseridNetwork= l_enemyUser.getUserNetworkID();
		   
            l_params.level = GBL.MAIN_DATA.getViewer().getLevel();
            makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/JGetAttackRob",
                    function(a_response){handleResult(a_response, l_self.m_resultDiv, function(){
			
			})},
                    l_params, 0);
					*/
        });

        return l_tr;
    }

	FightListDiv.prototype.createContentElementU = function(l_enemyUser){
// NewUser

        var l_tr = document.createElement("tr");

        var l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.color = "#FFFFFF";
        l_td.style.padding = "5px 10px 5px 10px";
        l_td.style.fontSize ="10px";
	
        l_td.innerHTML =  "<a target=\"_blank\" href=\""+ GBL.APP_CANVAS_URL + "appParams=%7B%22"+GBL.SHOW_USER_ID+"%22%3A%22"+l_enemyUser.getUserId()+"%22%7D\" >" + "<span style='color:#3E99C3; font-weight:bold;'><img width=\"50\" height=\"50\" src=\'" + l_enemyUser.getThumbnailUrl() + "\'/>" + l_enemyUser.getMobName() + " </span></a> with </span>";
      ;
      // l_td.innerHTML += "<a target=\"_blank\" href=\""+ GBL.APP_CANVAS_URL + "appParams=%7B%22"+GBL.SHOW_USER_ID+"%22%3A%22"+l_enemyUser.getUserId()+"%22%7D\" >" + "<span style='color:#3E99C3; font-weight:bold;'> <img width=\"50\" height=\"50\" src=\'" + l_enemyUser.getThumbnailUrl() + "\'/>" + l_enemyUser.getMobName() + " </span></a> with gain "+ l_gain+"</span>";
      
      
      
        l_td.style.cursor = "pointer";
      /*  addEvent(l_td, "click", function(){
            showUserStats(a_targetUser.getUserId());
        });
*/


        l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.color = "#FFFFFF";
        l_td.style.padding = "5px 10px 5px 10px";
        l_td.innerHTML = "";

/*
l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.color = "#FFFFFF";
        l_td.style.padding = "5px 10px 5px 10px";
	 l_td.innerHTML = l_enemyUser.getUserNetworkID();
         
         
	if( l_enemyUser.getUserNetworkID() == 2)
	{
	     l_td.innerHTML = "MySpace";
	    
	}
        else if ( l_enemyUser.getUserNetworkID() == 4)
	{
	     l_td.innerHTML = "Facebook";
	    
	}
        else if ( l_enemyUser.getUserNetworkID() == 8)
	{
	     l_td.innerHTML = "Hi5";
	    
	}
        else if ( l_enemyUser.getUserNetworkID() == 16)
	{
	     l_td.innerHTML = "Friendster";
	    
	}
	else if ( l_enemyUser.getUserNetworkID() == 1024)
	{
	     l_td.innerHTML = "Orkut";
	    
	}
	*/
        l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.padding = "5px 10px 5px 10px";

        var l_self = this;
	

    

        return l_tr;
    }
	
	
	
 FightListDiv.prototype.createContentElementC = function(l_car,targetuser){
// NewUser

        var l_tr = document.createElement("tr");

        var l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.color = "#FFFFFF";
        l_td.style.padding = "5px 10px 5px 10px";
        l_td.style.fontSize ="10px";
	
        l_td.innerHTML =  "<span style='color:#3E99C3; font-weight:bold;'><img width=\"120\" height=\"80\" src=\'" + l_car.Icon + "\'/>" + l_car.CarName + " </span> </span>";
      ;
      // l_td.innerHTML += "<a target=\"_blank\" href=\""+ GBL.APP_CANVAS_URL + "appParams=%7B%22"+GBL.SHOW_USER_ID+"%22%3A%22"+l_enemyUser.getUserId()+"%22%7D\" >" + "<span style='color:#3E99C3; font-weight:bold;'> <img width=\"50\" height=\"50\" src=\'" + l_enemyUser.getThumbnailUrl() + "\'/>" + l_enemyUser.getMobName() + " </span></a> with gain "+ l_gain+"</span>";
      
      
      
        l_td.style.cursor = "pointer";
      /*  addEvent(l_td, "click", function(){
            showUserStats(a_targetUser.getUserId());
        });
*/

        l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.color = "#FFFFFF";
        l_td.style.padding = "5px 10px 5px 10px";
        l_td.innerHTML = l_car.Number;


l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.color = "#FFFFFF";
        l_td.style.padding = "5px 10px 5px 10px";
	 l_td.innerHTML = "";
         
         /*
	if( l_enemyUser.getUserNetworkID() == 2)
	{
	     l_td.innerHTML = "MySpace";
	    
	}
        else if ( l_enemyUser.getUserNetworkID() == 4)
	{
	     l_td.innerHTML = "Facebook";
	    
	}
        else if ( l_enemyUser.getUserNetworkID() == 8)
	{
	     l_td.innerHTML = "Hi5";
	    
	}
        else if ( l_enemyUser.getUserNetworkID() == 16)
	{
	     l_td.innerHTML = "Friendster";
	    
	}
	else if ( l_enemyUser.getUserNetworkID() == 1024)
	{
	     l_td.innerHTML = "Orkut";
	    
	}
        l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.padding = "5px 10px 5px 10px";
	 */
        var l_self = this;
	
l_td.style.width = "400px"; 
        new DivButton(l_td, "GTA "+l_car.CarName, function(){
            l_self.m_resultDiv.showMessage(undefined, "GTA " + l_car.CarName + " ...");
            goToPageTop();

            var l_params = {};
            l_params.anid = GBL.MAIN_DATA.getViewer().getUserId();
        //    l_params.attackeduserid = l_car.UserVehiclesID;
	    l_params.at ="2";
		 // l_params.attackeduseridNetwork= "2";
		    	l_params.tnid = targetuser.getUserId();
	l_params.tt = targetuser.getUserNetworkID();
	l_params.f = "JGetAttackGTA";
		   l_params.vid = l_car.CarID; 
		   l_params.city = "1"; 
          //  l_params.level = GBL.MAIN_DATA.getViewer().getLevel();
		  /*
            makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/JGetAttackGTA",
                    function(a_response){handleResult(a_response, l_self.m_resultDiv, function(){
			
			})},
                    l_params, 0);
					*/
					makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx",
						 function(a_response){handleResultJSON(a_response, l_self.m_resultDiv, function(){l_self.refresh();})}
						 ,l_params);
		
        });

        return l_tr;
    }


 FightListDiv.prototype.createContentElementL = function(l_land,targetuser){
// NewUser
 
        var l_tr = document.createElement("tr");

        var l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.color = "#FFFFFF";
        l_td.style.padding = "5px 10px 5px 10px";
        l_td.style.fontSize ="10px";
	
        l_td.innerHTML =  "<span style='color:#3E99C3; font-weight:bold;'><img width=\"120\" height=\"80\" src=\'" + l_land.Icon + "\'/>" + l_land.LandName + " </span></span>";
      ;
      // l_td.innerHTML += "<a target=\"_blank\" href=\""+ GBL.APP_CANVAS_URL + "appParams=%7B%22"+GBL.SHOW_USER_ID+"%22%3A%22"+l_enemyUser.getUserId()+"%22%7D\" >" + "<span style='color:#3E99C3; font-weight:bold;'> <img width=\"50\" height=\"50\" src=\'" + l_enemyUser.getThumbnailUrl() + "\'/>" + l_enemyUser.getMobName() + " </span></a> with gain "+ l_gain+"</span>";
      
      
      
        l_td.style.cursor = "pointer";
      /*  addEvent(l_td, "click", function(){
            showUserStats(a_targetUser.getUserId());
        });
*/ 

        l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.color = "#FFFFFF";
        l_td.style.padding = "5px 10px 5px 10px";
        l_td.innerHTML = l_land.Health + "/100 " + l_land.LandProtected + "/100";


l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.color = "#FFFFFF";
        l_td.style.padding = "5px 10px 5px 10px";
	 l_td.innerHTML = l_land.Number;
         
         /*
	if( l_enemyUser.getUserNetworkID() == 2)
	{
	     l_td.innerHTML = "MySpace";
	    
	}
        else if ( l_enemyUser.getUserNetworkID() == 4)
	{
	     l_td.innerHTML = "Facebook";
	    
	}
        else if ( l_enemyUser.getUserNetworkID() == 8)
	{
	     l_td.innerHTML = "Hi5";
	    
	}
        else if ( l_enemyUser.getUserNetworkID() == 16)
	{
	     l_td.innerHTML = "Friendster";
	    
	}
	else if ( l_enemyUser.getUserNetworkID() == 1024)
	{
	     l_td.innerHTML = "Orkut";
	    
	}
        l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.padding = "5px 10px 5px 10px";
	 */
        var l_self = this;
		
	l_td = document.createElement("td");
        l_tr.appendChild(l_td);
l_td = document.createElement("td");
        l_tr.appendChild(l_td);
		l_td.style.width = "120px";
        new DivButton(l_td, "Rob Land", function(){
            l_self.m_resultDiv.showMessage(undefined, "Attacking " + targetuser.getMobName() + " ...");
            goToPageTop();

            var l_params = {};
           
l_params.f ="JGetAttackRob";
		   l_params.anid = GBL.MAIN_DATA.getViewer().getUserId();
			 l_params.at ="2";
           
		  	l_params.tnid = targetuser.getUserId();
	l_params.tt = targetuser.getUserNetworkID();
	
		   l_params.lid = l_land.LandID; 
		    
            l_params.level = GBL.MAIN_DATA.getViewer().getLevel();
            makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx",
                    function(a_response){JhandleResult(a_response, l_self.m_resultDiv, function(){
			
			})},
                    l_params, 0);
        });

        return l_tr;
    }

	
	
// this.createContentElementF(l_friendUser,l_enemyUser,l_gain,l_timeago)
   FightListDiv.prototype.createContentElementF = function(l_friendUser,l_enemyUser,l_gain,l_timeago){
// NewUser

        var l_tr = document.createElement("tr");

        var l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.color = "#FFFFFF";
        l_td.style.padding = "5px 10px 5px 10px";
        l_td.style.fontSize ="10px";
	if(l_gain != undefined)
	{
	
        l_td.innerHTML = "Your Friend <a target=\"_blank\" href=\""+ GBL.APP_CANVAS_URL + "appParams=%7B%22"+GBL.SHOW_USER_ID+"%22%3A%22"+l_friendUser.getUserId()+"%22%7D\" >" + "<span style='color:#3E99C3; font-weight:bold;'> <img width=\"50\" height=\"50\" src=\'" + l_friendUser.getThumbnailUrl() + "\'/>" + l_friendUser.getMobName() + " </span></a> has lost to </span>" + "<a target=\"_blank\" href=\""+ GBL.APP_CANVAS_URL + "appParams=%7B%22"+GBL.SHOW_USER_ID+"%22%3A%22"+l_enemyUser.getUserId()+"%22%7D\" >" + "<span style='color:#3E99C3; font-weight:bold;'><img width=\"50\" height=\"50\" src=\'" + l_enemyUser.getThumbnailUrl() + "\'/>" + l_enemyUser.getMobName() + " </span></a> with losing "+ l_gain+"</span>";
      ;
	  }
	  else
	  {
	    l_td.innerHTML = "Your Friend <a target=\"_blank\" href=\""+ GBL.APP_CANVAS_URL + "appParams=%7B%22"+GBL.SHOW_USER_ID+"%22%3A%22"+l_friendUser.getUserId()+"%22%7D\" >" + "<span style='color:#3E99C3; font-weight:bold;'> <img width=\"50\" height=\"50\" src=\'" + l_friendUser.getThumbnailUrl() + "\'/>" + l_friendUser.getMobName() + " </span></a> has lost to </span>" + "<a target=\"_blank\" href=\""+ GBL.APP_CANVAS_URL + "appParams=%7B%22"+GBL.SHOW_USER_ID+"%22%3A%22"+l_enemyUser.getUserId()+"%22%7D\" >" + "<span style='color:#3E99C3; font-weight:bold;'><img width=\"50\" height=\"50\" src=\'" + l_enemyUser.getThumbnailUrl() + "\'/>" + l_enemyUser.getMobName() + " </span></a></span>";
      ;
	  }
      // l_td.innerHTML += "<a target=\"_blank\" href=\""+ GBL.APP_CANVAS_URL + "appParams=%7B%22"+GBL.SHOW_USER_ID+"%22%3A%22"+l_enemyUser.getUserId()+"%22%7D\" >" + "<span style='color:#3E99C3; font-weight:bold;'> <img width=\"50\" height=\"50\" src=\'" + l_enemyUser.getThumbnailUrl() + "\'/>" + l_enemyUser.getMobName() + " </span></a> with gain "+ l_gain+"</span>";
      
      
      
        l_td.style.cursor = "pointer";
      /*  addEvent(l_td, "click", function(){
            showUserStats(a_targetUser.getUserId());
        });
*/

        l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.color = "#FFFFFF";
        l_td.style.padding = "5px 10px 5px 10px";
        l_td.innerHTML = l_timeago;

/*
l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.color = "#FFFFFF";
        l_td.style.padding = "5px 10px 5px 10px";
	 l_td.innerHTML = l_enemyUser.getUserNetworkID();
         
         
	if( l_enemyUser.getUserNetworkID() == 2)
	{
	     l_td.innerHTML = "MySpace";
	    
	}
        else if ( l_enemyUser.getUserNetworkID() == 4)
	{
	     l_td.innerHTML = "Facebook";
	    
	}
        else if ( l_enemyUser.getUserNetworkID() == 8)
	{
	     l_td.innerHTML = "Hi5";
	    
	}
        else if ( l_enemyUser.getUserNetworkID() == 16)
	{
	     l_td.innerHTML = "Friendster";
	    
	}
	else if ( l_enemyUser.getUserNetworkID() == 1024)
	{
	     l_td.innerHTML = "Orkut";
	    
	}*/
        l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.padding = "5px 10px 5px 10px";

        var l_self = this;
	

        new DivButton(l_td, "Attack", function(){
            l_self.m_resultDiv.showMessage(undefined, "Attacking " + l_enemyUser.getMobName() + " ...");
            goToPageTop();
	    
	    
	     var l_params = {};
           l_params.aNID = GBL.MAIN_DATA.getViewer().getUserId();
           l_params.tNID = l_enemyUser.getUserId();
		   		   l_params.aT ="2";
		   l_params.tT=l_enemyUser.getUserNetworkID();;
		    l_params.f = "JGetAttackFight"
		   /*
		    l_params.f = "JGetTopPlayers3";
        var l_self = this;
	// http://crime.servegame.com/JSonService.aspx?f=JGetTopPlayers3&Page=2
	// 
        makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx"
		   */
           makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx",
                   function(a_response){handleResultJSON(a_response, l_self.m_resultDiv, function(){l_self.refresh();})},
                   l_params, 0);
/*
            var l_params = {};
            l_params.attacteruserid = GBL.MAIN_DATA.getViewer().getUserId();
            l_params.attackeduserid = l_enemyUser.getUserId();
					   l_params.attacteruseridNetwork ="2";
		  l_params.attackeduseridNetwork= l_enemyUser.getUserNetworkID();
		   
            l_params.level = GBL.MAIN_DATA.getViewer().getLevel();
            makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/GetAttackFight",
                    function(a_response){handleResult(a_response, l_self.m_resultDiv, function(){
			
			})},
                    l_params, 0);
	    */
        });

        return l_tr;
    }
    
    
    FightListDiv.prototype.createContentElement = function(a_targetUser){
// NewUser

        var l_tr = document.createElement("tr");

        var l_td = document.createElement("td");
        
        l_td.style.color = "#FFFFFF";
        l_td.style.padding = "5px 10px 5px 10px";
        
     //   l_td.innerHTML = "<a target=\"_blank\" href=\""+ GBL.APP_CANVAS_URL + "appParams=%7B%22"+GBL.SHOW_USER_ID+"%22%3A%22"+a_targetUser.getUserId()+"%22%7D\" >" + "<span style='color:#3E99C3; font-weight:bold; font-size:9px'> <img width=\"50\" height=\"50\" src=\'" + a_targetUser.getThumbnailUrl() + "\'/>" + a_targetUser.getMobName() + " </span></a>, Level " + a_targetUser.getLevel() + " " + a_targetUser.getMobClass() + "</span>";
        var l_usertable = document.createElement("table");
		var l_usertabletbody = document.createElement("tbody");
		var l_usertabletr1 = document.createElement("tr");
		var l_usertabletd1 = document.createElement("td");
		//var l_usertabletr2 = document.createElement("tr");
		var l_usertabletd2 = document.createElement("td");
		l_td.appendChild(l_usertable);
		l_usertable.appendChild(l_usertabletbody);
		l_usertabletbody.appendChild(l_usertabletr1);
	
		// l_td.innerHTML = "<a target=\"_blank\" href=\""+ GBL.APP_CANVAS_URL + "appParams=%7B%22"+GBL.SHOW_USER_ID+"%22%3A%22"+a_targetUser.getUserId()+"%22%7D\" >" + "<span style='color:#3E99C3; font-weight:bold;'> " + a_targetUser.getMobName() + " </span></a>";
        
		l_usertabletd1.innerHTML = "<a target=\"_blank\" href=\""+ GBL.APP_CANVAS_URL + "appParams=%7B%22"+GBL.SHOW_USER_ID+"%22%3A%22"+a_targetUser.getUserId()+"%22%7D\" ><img width='50' height='50' src='" + a_targetUser.getThumbnailUrl() + "'/></a>";
			l_usertabletr1.appendChild(l_usertabletd1);
		l_usertabletr1.appendChild(l_usertabletd2);
		
		    var l_usertable2 = document.createElement("table");
		var l_usertabletbody2 = document.createElement("tbody");
		var l_usertabletr3 = document.createElement("tr");
		var l_usertabletd3 = document.createElement("td");
				var l_usertabletr4 = document.createElement("tr");
		var l_usertabletd4 = document.createElement("td");
		
		l_usertabletd2.appendChild(l_usertable2);
		l_usertable2.appendChild(l_usertabletbody2);
		l_usertabletbody2.appendChild(l_usertabletr3);
		
		l_usertabletd3.innerHTML = "<span style='color:#3E99C3; font-weight:bold; font-size:9px'>" + a_targetUser.getMobName() + " </span>";
		l_usertabletr3.appendChild(l_usertabletd3);
		
		l_usertabletbody2.appendChild(l_usertabletr4);
		
		l_usertabletd4.innerHTML = "Level " + a_targetUser.getLevel() + " " + a_targetUser.getMobClass() ;
		l_usertabletr4.appendChild(l_usertabletd4);
		
		//l_td.appendChild();
		l_usertabletd1.style.cursor = "pointer";
		l_usertabletd4.style.cursor = "pointer";
		
      /*  addEvent(l_td, "click", function(){
            showUserStats(a_targetUser.getUserId());
        });
*/
l_tr.appendChild(l_td);

        l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.color = "#FFFFFF";
        l_td.style.padding = "5px 10px 5px 10px";
        l_td.innerHTML = '<img src="http://www.laasex.com/crime/images/UI/buttons/M.png"/>'+ a_targetUser.getMobSize();

/*
l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.color = "#FFFFFF";
        l_td.style.padding = "5px 10px 5px 10px";
	 l_td.innerHTML = a_targetUser.getUserNetworkID();
         
         
	if( a_targetUser.getUserNetworkID() == 2)
	{
	     l_td.innerHTML = "MySpace";
	    
	}
        else if ( a_targetUser.getUserNetworkID() == 4)
	{
	     l_td.innerHTML = "Facebook";
	    
	}
        else if ( a_targetUser.getUserNetworkID() == 8)
	{
	     l_td.innerHTML = "Hi5";
	    
	}
        else if ( a_targetUser.getUserNetworkID() == 16)
	{
	     l_td.innerHTML = "Friendster";
	    
	}
	else if ( a_targetUser.getUserNetworkID() == 1024)
	{
	     l_td.innerHTML = "Orkut";
	    
	}*/
        l_td = document.createElement("td");
        l_tr.appendChild(l_td);
        l_td.style.padding = "5px 10px 5px 10px";

        var l_self = this;

        new DivButton(l_td, "Attack", function(){
		/*
            l_self.m_resultDiv.showMessage(undefined, "Attacking " + a_targetUser.getMobName() + " ...");
            goToPageTop();

            var l_params = {};
            l_params.attacteruserid = GBL.MAIN_DATA.getViewer().getUserId();
            l_params.attackeduserid = a_targetUser.getUserId();
					   l_params.attacteruseridNetwork ="2";
		  l_params.attackeduseridNetwork= a_targetUser.getUserNetworkID();
		   
            l_params.level = GBL.MAIN_DATA.getViewer().getLevel();
            makeXMLNotCachedRequest(REQUEST_DESTINATION_URL+"/GetAttackFight",
                    function(a_response){handleResult(a_response, l_self.m_resultDiv, function(){l_self.refresh();})},
                    l_params, 0);
					*/
					var l_params = {};
           l_params.anid = GBL.MAIN_DATA.getViewer().getUserId();
           l_params.tnid = a_targetUser.getUserId();
		   		   l_params.at ="2";
		   l_params.tt=a_targetUser.getUserNetworkID();;
		    l_params.f = "JGetAttackFight"
		   /*
		    l_params.f = "JGetTopPlayers3";
        var l_self = this;
	// http://crime.servegame.com/JSonService.aspx?f=JGetTopPlayers3&Page=2
	// 
        makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx"
		   */
           makeXMLNotCachedRequest("http://crime.servegame.com/JSonService.aspx",
                   function(a_response){handleResultJSON(a_response, l_self.m_resultDiv, function(){l_self.refresh();})},
                   l_params, 0);
        });

        return l_tr;
    }
	
	
    FightListDiv.prototype.createContentElementA = function(a_targetUser){
// NewUser

        var l_tr = document.createElement("tr");

        var l_td = document.createElement("td");
        
        l_td.style.color = "#FFFFFF";
        l_td.style.padding = "5px 10px 5px 10px";
        
     //   l_td.innerHTML = "<a target=\"_blank\" href=\""+ GBL.APP_CANVAS_URL + "appParams=%7B%22"+GBL.SHOW_USER_ID+"%22%3A%22"+a_targetUser.getUserId()+"%22%7D\" >" + "<span style='color:#3E99C3; font-weight:bold; font-size:9px'> <img width=\"50\" height=\"50\" src=\'" + a_targetUser.getThumbnailUrl() + "\'/>" + a_targetUser.getMobName() + " </span></a>, Level " + a_targetUser.getLevel() + " " + a_targetUser.getMobClass() + "</span>";
        var l_usertable = document.createElement("table");
		var l_usertabletbody = document.createElement("tbody");
		var l_usertabletr1 = document.createElement("tr");
		var l_usertabletd1 = document.createElement("td");
		//var l_usertabletr2 = document.createElement("tr");
		var l_usertabletd2 = document.createElement("td");
		l_td.appendChild(l_usertable);
		l_usertable.appendChild(l_usertabletbody);
		l_usertabletbody.appendChild(l_usertabletr1);
	
		// l_td.innerHTML = "<a target=\"_blank\" href=\""+ GBL.APP_CANVAS_URL + "appParams=%7B%22"+GBL.SHOW_USER_ID+"%22%3A%22"+a_targetUser.getUserId()+"%22%7D\" >" + "<span style='color:#3E99C3; font-weight:bold;'> " + a_targetUser.getMobName() + " </span></a>";
        
		l_usertabletd1.innerHTML = "<a target=\"_blank\" href=\""+ GBL.APP_CANVAS_URL + "appParams=%7B%22"+GBL.SHOW_USER_ID+"%22%3A%22"+a_targetUser.getUserId()+"%22%7D\" ><img width='50' height='50' src='" + a_targetUser.getThumbnailUrl() + "'/></a>";
			l_usertabletr1.appendChild(l_usertabletd1);
		l_usertabletr1.appendChild(l_usertabletd2);
		
		    var l_usertable2