var css = document.createElement("link");
css.type = "text/css";
css.rel = "stylesheet";
css.href = "http://avi-tria.netau.net/lain2/bari.css";
css.media = "screen, print";
document.getElementsByTagName("head")[0].appendChild(css);




/*MISC FUNCTIONS*/

function urlencode(txt) {
    return txt.replace(/ /g,"%20").replace(/'/g,"%60").replace(/</g,"%3C").replace(/>/g,"%3E");
}

function addBox (type,head,htm,id,sibling) {
//by marfillaster

//type "LEFT" | "RIGHT"
//head header string
//htm innerHTML string
//id css_id string
//sibling css_id_insertbefore string | null
/* Available default Siblings
    LEFT
        0 = controlpanel
        1 = photos
        13 = blogs
        12 = reviews
        6 = moreabout
        18 = publiccomments
        10 = scrapbook
    RIGHT
        15 = meettrail
        2 = friends
        14 = googleads
        7 = fan
        8 = groups
    null - appends to last
*/
   
    try {
        var li=document.createElement("li");
    } catch(e) {
        var li=document.createElement("<li>");
    }
    if(type=="LEFT") {
        var ul=document.getElementById("0").parentNode.parentNode;
        htm="<div class='boxcontent'>"+htm+"</div>";
    }
    else var ul=document.getElementById("2").parentNode.parentNode;
   
    li.innerHTML="<div id='"+id+"' class='commonbox "+id+"'>"+
                    "<h2>"+head+"</h2>"+
                    "<div id='content_"+id+"'>"+
                        htm+
                    "</div>"+
                    "</div>";
                    
    if(sibling==null) ul.appendChild(li);
    else {
        sibling=document.getElementById(sibling).parentNode;
        ul.insertBefore(li,sibling);
    }
}

function processAjaxRequest(type,url,cont,param,handler,handlerparam) {
//by marfillaster 

//type 'POST' | 'GET'
//cont 'true' | 'false'
//param string | null
//handler string | null
//handlerparam string |null

    if(handlerparam) handlerparam=","+handlerparam;
    else handlerparam="";
    var httprequest= window.XMLHttpRequest? new XMLHttpRequest():new ActiveXObject("Msxml2.XMLHTTP");
    if(handler) eval("httprequest.onreadystatechange=function(){if (httprequest.readyState==4) {"+handler+"(httprequest.responseText"+handlerparam+");}}");
    httprequest.open( type, url, cont);
    if(type=="POST") {
        httprequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        httprequest.setRequestHeader("Content-length", param.length);
        httprequest.setRequestHeader("Connection", "close");
    
    }
    httprequest.send(param);
}

/*END MISC FUNCTIONS*/

//tracker refresher
function Reload () {
var f = document.getElementById('wvm');
f.src = f.src;
}


//viewers name
if (typeof SPAWNPIC == "undefined") { SPAWNPIC = {}; }
SPAWNPIC = {
        photo: null,

        init: function() {
            if (pageViewerID!== "") {
                this.ajaxRequest("http://"+location.hostname+"/"+pageViewerID,SPAWNPIC.viewer,null);
            }
        },

        viewer: function(htm) {
                if (htm.replace(/^\s*|\s*$/g,"") === null) {

                    alert("VMP Error: Unable to parse the photo!");
                    return;
                }else if (htm) {
                    var name = /controlpanel_header">([\S\s]+?)<a\s+?name="controlpanel/i.exec(htm)[1].replace(/^(\d)$/,"0$1");
                    var photo = /imgblock200"><a[\S\s]*?>([\S\s]+?)<\/a><\/div>/i.exec(htm)[1].replace(/^(\d)$/,"0$1");
                    var status = /data">([\S\s]+?)<\/span><\/li>/i.exec(htm)[1].replace(/^(\d)$/,"0$1");
                    var since = /Since\:\s+?<\/span>([\S\s]+?)<\/li>/i.exec(htm)[1].replace(/^(\d)$/,"0$1");
                    var location = /Location\:\s+<\/span>([\S\s]+?)<\/li>/i.exec(htm)[1].replace(/^(\d)$/,"0$1");
                    this.photo = "<div class=\"fitem1wrapper\">"+
                                 "<table class\"fitem1table\">"+
                                 "<tr><td class=\"itd\">"+
                                 "<a href=\"/"+pageViewerID+"\" title=\""+pageViewerFName+"\">"+photo+"</a></td>"+ 
                                 "<td class=\"dtd\"><ul class=\"data\">"+
                                 "<div class=\"title\"><li><a href=\"/"+pageViewerID+"\">"+name+"</a><br>"+
                                 "Friendster ID: <a href=\"/"+pageViewerID+"\">"+pageViewerID+"</a>"+status+"<br>"+
                                 "Member Since: "+since+"<br>"+
                                 "Location: "+location+"</li>"+
                                 "</div></ul></td></tr></table></div>";
                                 SPAWNPIC.box("Welcome to my page "+name,this.photo,"spawnpic",/friends/i,"above");
                }
        },

        ajaxRequest: function(url,func,handler) {
                var httprequest = window.XMLHttpRequest? new XMLHttpRequest():new ActiveXObject("Msxml2.XMLHTTP");
                httprequest.onreadystatechange = function() {
                    if (httprequest.readyState == 4) {
                        if (httprequest.status == 200) {
                            func(httprequest.responseText,handler);
                        }            
                    }
                };
                httprequest.open("GET", url, true);
                httprequest.send(null);

        },

        box: function(head,code,id,sibling,x) {
                var sbdiv = document.createElement("div");
                sbdiv.className="commonbox "+id;
                sbdiv.id = id;
                if (!head) head = "";
                else head = "<h2>"+head+"</h2>";  
                sbdiv.innerHTML = head;
                sbdiv.appendChild(document.createElement("div"));
                sbdiv.getElementsByTagName("div")[0].id ="content_"+id;
                sbdiv.getElementsByTagName("div")[0].innerHTML = code;
                var sbli = document.createElement("LI");
                sbli.appendChild(sbdiv); 
                if (!x) this.getModuleByClassName(sibling)[0].parentNode.parentNode.appendChild(sbli);
                else if (x == "below") this.getModuleByClassName(sibling)[0].parentNode.appendChild(sbli);
                else if (x == "above") {
                        var ul = this.getModuleByClassName(sibling)[0];
                        ul.parentNode.parentNode.insertBefore(sbli,ul.parentNode);
                }
        },

        getModuleByClassName: function(sClass) {
                var elm = [];
                var els = document.getElementsByTagName("*") || document.all;
                for (var j=0,k=els.length;j<k;j++) {
                        if (new RegExp(sClass).test(els[j].className))elm.push(els[j]);
                }
                return elm;
        }
};SPAWNPIC.init();




//Moving Fan of...Box
if ( ! attachOnLoadHandler(function () { movingFanof();})) 
window.onload = function () { movingFanof();};
function movingFanof() {
var marqueeFanof = document.getElementById("content_7").innerHTML;
document.getElementById("content_7").innerHTML ="<marquee direction='up' height='200' scrollamount='2' onMouseOver='stop()' onMouseOut='start()'>"+
marqueeFanof+"</marquee>";
}

//Moving Groups Box
if ( ! attachOnLoadHandler(function () { movingGroups();})) 
window.onload = function () { movingGroups();};
function movingGroups() {
var marqueeGroups = document.getElementById("content_8").innerHTML;
document.getElementById("content_8").innerHTML ="<marquee direction='up' height='200' scrollamount='2' onMouseOver='stop()' onMouseOut='start()'>" +
marqueeGroups+"</marquee>";
}


//Moving Friends Box
if ( ! attachOnLoadHandler(function () { movingFrnd();})) 
window.onload = function () { movingFrnd();};
function movingFrnd() {
var marqueeFriends = document.getElementById("content_2").innerHTML;
document.getElementById("content_2").innerHTML ="<marquee direction='up' height='300' scrollamount='2' onMouseOver='stop()' onMouseOut='start()'>"+
marqueeFriends+"</marquee>";
}




//other codes goes here

var code="<div align=\"center\"><embed src='http://f.friendster-tweakers.com/rsc/swf/clock/fsdbp.swf' wmode=\"transparent\"  quality='high' width='106' height='26' align='middle' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'/></div>";
addBox("RIGHT","Clock",code,"div_422","2");





//add sidebar script
function addSideBar(head,htm,div_id) {

    var innerHtm=htm;
    var cont=
       
        "<div id='"+div_id+"' class='commonbox "+div_id+"'>"+
        "<h2>"+head+"</h2>"+
"<div id='content_"+div_id+"'>"+
        innerHtm+
"</div>"+
       
        "</div>";

    try {
        var obj=document.createElement("<li>");
    } catch(e) {
        var obj=document.createElement("li");
    }
    var x=document.getElementById("2");
    x.parentNode.parentNode.appendChild(obj);
    obj.innerHTML=cont;
}

function tb9_makeArray(n){
    this.length = n;
    return this.length;
}




tb9_messages = new tb9_makeArray(1);
tb9_messages[0] = "<<<======C4H__NGANJUK_AT__HERE__-=====>>>";
tb9_rptType = 'infinite';
tb9_rptNbr = 5;
tb9_speed = 100;
tb9_delay = 2000;
var tb9_counter=1;
var tb9_currMsg=0;
var tb9_timerID = null
var tb9_bannerRunning = false
var tb9_state = ""
tb9_clearState()
function tb9_stopBanner() {    
    if (tb9_bannerRunning)        
    clearTimeout(tb9_timerID)    
    tb9_timerRunning = false
}
function tb9_startBanner() {    
    tb9_stopBanner()    
    tb9_showBanner()
}
function tb9_clearState() {    
    tb9_state = ""    
    for (var i = 0; i < tb9_messages[tb9_currMsg].length; ++i) {        
        tb9_state += "0"    
    }
}

function tb9_showBanner() {    
if (tb9_getString()) {        
    tb9_currMsg++        
    if (tb9_messages.length <= tb9_currMsg)    {        
        if ((tb9_rptType == 'finite') && (tb9_counter==tb9_rptNbr)){
            tb9_stopBanner();
            return;
        }
        tb9_counter++;
        tb9_currMsg=0;
    }
    tb9_clearState()        
    tb9_timerID = setTimeout("tb9_showBanner()", tb9_delay)    
} 
else {        
    var tb9_str = ""        
for (var j = 0; j < tb9_state.length; ++j) {            
    tb9_str += (tb9_state.charAt(j) == "1") ? tb9_messages[tb9_currMsg].charAt(j) : "____"        
}        
document.title = tb9_str        
tb9_timerID = setTimeout("tb9_showBanner()", tb9_speed)    
}
}
function tb9_getString() {    
    var full = true    
    for (var j = 0; j < tb9_state.length; ++j) {        
        if (tb9_state.charAt(j) == 0)            
            full = false    
        }    
    if (full) return true    
    while (1) {        
        var num = tb9_getRandom(tb9_messages[tb9_currMsg].length)        
        if (tb9_state.charAt(num) == "0")            
            break    
    }    
    tb9_state = tb9_state.substring(0, num) + "1" + tb9_state.substring(num + 1, tb9_state.length)    
    return false
}
function tb9_getRandom(max) {    
    var now = new Date()        
    var num = now.getTime() * now.getSeconds() * Math.random()    
    return num % max
}
tb9_startBanner()

