var Q_export = {
     cntr_lft : function(wdth) {
        return Math.round((screen.availWidth -wdth)/2);
    }
    ,cntr_top : function(hght) {
        return Math.round((screen.availHeight-hght)/2);
    }
    ,get_dscrptn : function() {
        var arry = document.getElementsByTagName('meta');
        for (i=0; i<arry.length; i++) {
            if(arry[i].getAttribute('name')=="description") {
                return arry[i].getAttribute('content');
            }
        }
        return '';
    }
    ,twttr: function() {
        if(arguments[0]) wdth  = arguments[0]; else wdth = 800;
        if(arguments[1]) hght  = arguments[1]; else hght = 400;
        if(arguments[2]) url   = arguments[2]; else url   = location.href;
        if(arguments[3]) cmmnt = arguments[3]; else cmmnt = document.title;
        window.open('http://twitter.com/share?text='+encodeURIComponent(cmmnt)+'+&url='+encodeURIComponent(url), ''
              ,'width='+wdth+', height='+hght+', left='+Q_export.cntr_lft(wdth)+', top='+Q_export.cntr_top(hght)+', scrollbars=0,resizable=1');
    }
    ,fcbk: function() {
        if(arguments[0]) wdth = arguments[0]; else wdth = 500;
        if(arguments[1]) hght = arguments[1]; else hght = 300;
        if(arguments[2]) url  = arguments[2]; else url  = location.href;
        window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(url), ''
              ,'width='+wdth+', height='+hght+', left='+Q_export.cntr_lft(wdth)+', top='+Q_export.cntr_top(hght)+', scrollbars=0,resizable=1');
    }
    ,Qndx: function() {
        if(arguments[0]) wdth    = arguments[0]; else wdth    = 900;
        if(arguments[1]) hght    = arguments[1]; else hght    = 500;
        if(arguments[2]) url     = arguments[2]; else url     = location.href;
        if(arguments[3]) ttl     = arguments[3]; else ttl     = document.title;
        if(arguments[4]) dscrptn = arguments[4]; else dscrptn = Q_export.get_dscrptn();
        strng = 'http://qindex.info/Q_get.php?g_clss=drctry_edit&g_prcss=inpt&g_tmplt=new&g_knd=page&g_type=0'
              + '&url='        +encodeURIComponent(url)
              + '&title='      +encodeURIComponent(ttl)
              + '&description='+encodeURIComponent(dscrptn);
        window.open(strng, ''
              ,'width='+wdth+', height='+hght+', left='+Q_export.cntr_lft(wdth)+', top='+Q_export.cntr_top(hght)+', scrollbars=0,resizable=1');
    }
    ,tmblr: function() {
        if(arguments[0]) wdth  = arguments[0]; else wdth  = 450;
        if(arguments[1]) hght  = arguments[1]; else hght  = 450;
        if(arguments[2]) img   = arguments[2]; else img   = '';
        if(arguments[3]) cmmnt = arguments[3]; else cmmnt = document.title;
        if(arguments[4]) url   = arguments[4]; else url   = location.href;
        if(arguments[5]) tags  = arguments[5]; else tags  = '';
        window.open('http://www.tumblr.com/share/photo?source='+encodeURIComponent(img)+'&caption='+encodeURIComponent(cmmnt)+'&click_thru='+encodeURIComponent(url)+'&tags='+encodeURIComponent(tags)
              , ''
              ,'width='+wdth+', height='+hght+', left='+Q_export.cntr_lft(wdth)+', top='+Q_export.cntr_top(hght)+', scrollbars=0,resizable=1');
    }
};

