    /*
        RATINGS RELATED
    */
    function rateMe(rating,pid,ptype){        
        if(!rated){
            rated = true;
            
            show('loading');                
            (new AjaxRequest).send({
                url     : "ajax/",
                data    : {
                    action: 'ratePage',
                    id:     pid,
                    type:   ptype,
                    rate:   rating
                },
                
                onSuccess  : function(data, info)
                {                
                    Fat.fade_element('pageRating',10,3000,"#ffffaa");
                    hide('loading');  
                }
              });
        }
    }
    
    function shineMe(v){
        if(!rated){
            for(i=1; i <= v; i++){
                document.getElementById('shine_'+i).className = 'star_on';
            }
            
            for(i=v+1; i <= 5; i++){
                if(shine[i] == 1){
                    document.getElementById('shine_'+i).className = 'star_sel';
                }else{
                    document.getElementById('shine_'+i).className = 'star_off';
                }
            }
        }
        return true;
    }
    
    
    function unShine(){
        if(!rated){
            for(i=1; i <= 5; i++){
                if(shine[i] == 1){
                    document.getElementById('shine_'+i).className = 'star_sel';
                }else{
                    document.getElementById('shine_'+i).className = 'star_off';
                }
            }
        }
    }
    
    
    /*
        COMMON FUNCTIONS
    */
    function hide(id){
        if(document.getElementById(id)){
            document.getElementById(id).style.display="none";
        }
    }
    
    
    function show(id){
        if(document.getElementById(id)){
            document.getElementById(id).style.display="";
        }
    }
    
    
    function enable(id){
        if(document.getElementById(id)){
            document.getElementById(id).disabled=false;
        }
    }
    
    
    function disable(id){
        if(document.getElementById(id)){
            document.getElementById(id).disabled=true;
        }
    }
    
    
    function dropElement(id){
        if(document.getElementById(id)){
            var em=document.getElementById(id);
            return em.parentNode.removeChild(em);
        }
    }
    
    function giveKarma(pageid){
        (new AjaxRequest).send({
            url     : "ajax/",
            data    : {
                action: 'karmaPage',
                id:     pageid,
                type:   'give'
            },
            
            onSuccess  : function(data, info)
            {                
                //alert(data.karma);
                $('karma_'+pageid+'_un').hide();
                $('karma_'+pageid+'_up').show();
                $('karma_'+pageid).innerHTML = data.karma;
            }
          });
    }
    
    function takeKarma(pageid){
        (new AjaxRequest).send({
            url     : "ajax/",
            data    : {
                action: 'karmaPage',
                id:     pageid,
                type:   'take'
            },
            
            onSuccess  : function(data, info)
            {                
                //alert(data.karma);
                $('karma_'+pageid+'_un').hide();
                $('karma_'+pageid+'_down').show();
                $('karma_'+pageid).innerHTML = data.karma;
            }
          });
    }
    
    function openWin(URL,height,width,scrollbars){
        if(!height) height = 640;
        if(!width) width = 640;
        if(!scrollbars) scrollbars = 'no'; else scrollbars = 'yes';
        window.open(URL,'','scrollbars='+scrollbars+',menubar=no,height='+height+',width='+width+',resizable=yes,toolbar=no,location=no,status=no');
    }

