﻿//<!--
function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function() {
            if (oldonload) {
                oldonload();
            }
            func();
        }
    }
}

function setSize() {
    // calculate available height
    if (typeof (window.innerWidth) == 'number') {
        //not ie
        myWidth = window.innerWidth;
        myHeight = window.innerHeight;
    } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
        // ie 6+ 
        myWidth = document.documentElement.clientWidth;
        myHeight = document.documentElement.clientHeight;
    } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
        // ie 4 compatible
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
    }
    //var fl = document.getElementById("fl");
    //fl.style.marginTop = '1px';
    //fl.style.marginLeft = '1px';
    //if(myHeight > 582) fl.style.marginTop = (myHeight - 582)/2 +'px';
    //if(myWidth > 1024) fl.style.marginLeft = (myWidth - 1022)/2+'px';
    var bb = document.getElementById("barebody");
    bb.style.width = myWidth + 'px';
    bb.style.height = myHeight + 'px';
}
addLoadEvent(setSize);
window.onresize = setSize;

function popup(url) {
    var width = 630;
    var height = 500;
    var left = parseInt((screen.availWidth / 2) - (width / 2));
    var top = parseInt((screen.availHeight / 2) - (height / 2));
    var windowFeatures = "width=" + width + ",height=" + height +
        ",scrollbars=yes,resizable=1,menubar=0,toolbar=0,status=0,left=" + left + ",top=" + top + "screenX=" + left + ",screenY=" + top;
    window.open(url, "form", windowFeatures);
}

function fbs_click(u, t) {
    //alert("Video Share " + u + " -- " + t);
    //window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');
    /*	
    //var realLink = "&lt;object width=&quot;546&quot; height=&quot;330&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;"+u+";hl=it&amp;fs=1&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;false&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot;&gt;&lt;/param&gt;&lt;embed src=&quot;"+u+"&amp;hl=it&amp;fs=1&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; width=&quot;546&quot; height=&quot;330&quot;&gt;&lt;/embed&gt;&lt;/object&gt;";
    //var realLink = "&lt;embed src=&quot;http://77.220.84.90/_resources/_events/_Video/Cow.swf&quot; width=&quot;300&quot; height=&quot;200&quot; type=&quot;application/x-shockwave-flash&quot; /&lt;";				
		
		
		
        */
}

function socialnetwork_click(networkID, u, t) {

    //
    var width = 425;
    var height = 355;
    //alert("NETWORKID " + networkID);
    //
    //Array
    var arr_sn = new Array();
    //Push FaceBook
    arr_sn.push("");
    //Push MySpace
    var realLink = '<object width%3D"' + width + '" height%3D"' + height + '"><param name%3D"movie" value%3D"' + u + '"><\/param><param name%3D"allowFullScreen" value%3D"true"></param><param name%3D"allowscriptaccess" value%3D"always"></param><embed src%3D"' + u + '" type%3D"application/x-shockwave-flash" allowscriptaccess%3D"always" allowfullscreen%3D"true" width%3D"' + width + '" height%3D"' + height + '"><\/embed><\/object>';
    arr_sn.push(realLink);
    //Push LIVE SPACE
    var realLink2 = "&lt;object width%3D&quot;546&quot; height%3D&quot;330&quot;&gt;&lt;param name%3D&quot;movie&quot; value%3D&quot;" + u + ";hl%3Dit&amp;fs%3D1&quot;&gt;&lt;%3Eparam&gt;&lt;param name%3D&quot;allowFullScreen&quot; value%3D&quot;false&quot;&gt;&lt;%3Eparam&gt;&lt;param name%3D&quot;allowscriptaccess&quot; value%3D&quot;always&quot;&gt;&lt;%3Eparam&gt;&lt;embed src%3D&quot;" + u + "&amp;hl%3Dit&amp;fs%3D1&quot; type%3D&quot;application%3Ex-shockwave-flash&quot; allowscriptaccess%3D&quot;always&quot; allowfullscreen%3D&quot;true&quot; width%3D&quot;546&quot; height%3D&quot;330&quot;&gt;&lt;%3Eembed&gt;&lt;%3Eobject&gt;";
    arr_sn.push(realLink2);
    //Push DEL.ICIO.US
    arr_sn.push("");
    //Titolo
    if (t == undefined) {
        t = "RAY-BAN VIDEO";
    }
    //
    switch (networkID) {
        //FACEBOOK    
        case 0:
            //alert("FaceBook: " + u + " --> ");
            window.open('http://www.facebook.com/sharer.php?u=' + encodeURIComponent(u) + '&t=' + encodeURIComponent(t), 'sharer', 'toolbar=0,status=0,width=626,height=436');
            break;
        //MYSPACE    
        case 1:
            //alert("MySpace: " + arr_sn[parseInt(networkID)]);
            window.open('http://www.myspace.com/Modules/PostTo/Pages/?t=' + encodeURIComponent(t) + '&c=' + arr_sn[parseInt(networkID)] + '&u=' + encodeURIComponent(u), 'sharer', 'toolbar=0,status=0,width=626,height=536');
            break;
        //LIVE MSN    
        case 2:
            //alert("MSN: " + arr_sn[parseInt(networkID)]);
            window.open('http://spaces.live.com/BlogIt.aspx?Title=' + encodeURIComponent(t) + '&SourceURL=' + encodeURIComponent(u) + '&description=' + arr_sn[parseInt(networkID)], 'sharer', 'toolbar=0,status=0,width=626,height=436,scrollbars=yes,resizable=yes');
            //&description
            break;
        //DEL.ICIO.US    
        case 3:
            //alert("DELICIOUS: " + arr_sn[parseInt(networkID)]);
            window.open('http://del.icio.us/post?url=' + encodeURIComponent(u) + '&title=' + encodeURIComponent(t), 'sharer', 'toolbar=0,status=0,width=626,height=436scrollbars=yes,resizable=yes');
            break;
        //TWITTER   
        case 4:
            //alert("TWITTER: " + u);
            //
            window.open("http://twitthis.com/twit?url=" + encodeURIComponent(u) + "&title=" + encodeURIComponent(t), "sharer", "width=600, height=500, location, status, scrollbars, resizable");
            //
            break;
        //DIGG   
        case 5:
            //
            window.open("http://digg.com/submit?url=" + encodeURIComponent(u) + "&title=" + encodeURIComponent(t) + "&bodytext=" + encodeURIComponent(t) + "&media=video&topic=movies&thumbnails=0", "sharer", "toolbar=0,status=0,width=626,height=436,scrollbars=yes,resizable=yes");
            //
            break;

    }
}
//Function Share on Facebook on ColorizeYourself event
function FB_colorizeYourself(u) {
    //alert("FaceBook: " + u + " --> ");
    window.open('http://www.facebook.com/sharer.php?u=' + encodeURIComponent(u), 'sharer', 'toolbar=0,status=0,width=626,height=436');
}

//-->