﻿//<!--

function closeEventEffect() {
    var winWidth = $(window).width();
    var winHeight = $(window).height();
    //SET Default VAR
    var myW = 990;
    var myH = 550;
    //INSERISCO NEL MIO DIV IL COLORE
    var colorBck = "transparent";
    //SET PROPERTIES OF DIV SOSTITUTE
    //$("#traspEventContainer").css("border","1px solid red");
    //$("#traspEventContainer").css("top", (winHeight / 2 - myH / 2) + "px");
    $("#traspEventContainer").css("top", "25px");
    $("#traspEventContainer").css("left", (winWidth / 2 - myW / 2) + "px");
    $("#traspEventContainer").css("background", colorBck);
    //SET MISURE
    $("#traspEventContainer").css("width", "990px");
    $("#traspEventContainer").css("height", "550px");
    $("#traspEventContainer").css("display", "block");
    //HIDE EVENT CONTAINER DIV
    $("#eventContainerAll").css("display", "none");
    //
    $("#traspEventContainer").animate({ width: myW / 2 + "px", height: myH / 2 + "px", top: (winHeight / 2 - myH / 4) - 150 + "px", left: (winWidth / 2 - myW / 4) + "px", opacity: .6 }, { "duration": 250, "easing": "linear" })
   .animate({ width: 1 + "px", height: 1 + "px", top: (winHeight / 2) + "px", left: (winWidth / 2) + "px", opacity: 1 }, { "duration": 250, "easing": "swing", "complete": function() { closeEvent() } })
}
function closeEvent() {
    $("#traspEventContainer").css("display", "none");
    $("#eventContainerAll").css("display", "none");
    $("#eventContainerAll").html("<div id='eventContainer'></div>");
}
	var sguid="";
	var cntry="";
	var logUrl = "";
	var section = "";
function CallTimeOut(){ openBaseEvent(sguid,cntry,logUrl,section);
}
function timeOutEvent(ev_sguid, ev_cntry, ev_logUrl, ev_sect){
	//
	sguid=ev_sguid;
	cntry=ev_cntry;
	logUrl = ev_logUrl;
	section = ev_sect;
	setTimeout("CallTimeOut()", 1000);
}

function openBaseEvent(ev_sguid, ev_cntry, ev_logUrl, ev_sect) {
    //FLASH VARS
    var flashvars = {
        sguid: ev_sguid,
        cntry: ev_cntry,
        logUrl: ev_logUrl,
        controller: "false",
        section: ev_sect
    };
    //FLASH PARAM
    var params = {
        wmode: "window",
        menu: "false"
    };
    //ATTRIBUTES
    var attributes = null;
    //GO
    //alert(ev_sguid+' - '+ev_cntry+' - '+ev_logUrl);
    swfobject.embedSWF("/_repository/_resources/_swf/autoEventContainer_v2.swf", "eventContainer", "990px", "550px", "8.0.0", "expressInstall.swf", flashvars, params, attributes);
    //
    //WIN SIZE
    var winWidth = $(window).width();
    var winHeight = $(window).height();
    //SET Default VAR
    var myW = 990;
    var myH = 550;
    //INSERISCO NEL MIO DIV IL COLORE
    var colorBck = "#000";
    //SET PROPERTIES OF DIV
    $("#eventContainerAll").css("display", "block");
    //$("#eventContainer").css("display", "none");
    //$("#eventContainer").css("border","1px solid red");
    //$("#eventContainer").css("top", (winHeight / 2) + "px");
    //$("#eventContainer").css("display", "block");
    $("#eventContainer").css("top", "40px");
    $("#eventContainer").css("left", (winWidth / 2) + "px");
    $("#eventContainer").css("background", colorBck);
    //SET MISURE
    //.animate({ width: myW + "px", height: myH + "px", top: (winHeight / 2 - myH / 2) + "px", left: (winWidth / 2 - myW / 2) + "px", opacity: 1 }, { "duration": 250, "easing": "swing", "complete": function() { loadEvent(ev_sguid, ev_cntry, ev_logUrl) } })
    $("#eventContainer").css("width", "1px");
    $("#eventContainer").css("height", "1px");
    //$("#eventContainer").animate({ width: myW / 2 + "px", height: myH / 2 + "px", top: (winHeight / 2 - myH / 4) - 150 + "px", left: (winWidth / 2 - myW / 4) + "px", opacity: 0.8 }, { "duration": 250, "easing": "linear" })
    //.animate({ width: myW + "px", height: myH + "px", top: "40px", left: (winWidth / 2 - myW / 2) + "px", opacity: 1 }, { "duration": 250, "easing": "swing" })
    $("#eventContainer").css("top", "45px");
    $("#eventContainer").css("left", (winWidth / 2 - myW / 2) + "px");
    $("#eventContainer").css("width", myW + "px");
    $("#eventContainer").css("height", myH + "px");
    $("#eventContainer").focus();

}
//FINISH EFFECT
function loadEvent(ev_sguid, ev_cntry, ev_logUrl, ev_sect) {
    //$("#eventContainer").css("top", (winHeight / 2 - myH / 2) + "px");
}

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');
}

//-->