<\/div>";
strVar += "<\/div>";
}
strVar += "<\/div>";
var has_mouse = false;
// expandable open state
var open = false;
// valid player
var ad_is_valid = true;
// prepare player parameters
var parameters = {};
parameters.id = id;
parameters.hook = "scupio-expandable-player-hook" + id;
parameters.$ = jQQ;
parameters.attributes = {};
if (_s.browser.name === "Explorer") {
parameters.attributes.preload = "none";
ad_is_valid = false;
if (_s.browser.version == "9") {
ad_is_valid = true;
}
if (_s.browser.version == "10") {
ad_is_valid = true;
}
if (http === "https://") {
ad_is_valid = false;
}
}
// player dimension
parameters.style = {
width: width,
height: height
};
// video source
if (_s.response[id].video) {
var video_path = _s.response[id].video.substring(0, _s.response[id].video.length - 4);
parameters.source = [{ type: "video/webm", src: video_path + ".webm" },
{ type: "video/mp4", src: video_path + ".mp4" },
{ type: "video/ogg", src: video_path + ".ogv" }];
}
else {
ad_is_valid = false;
}
// browser information
parameters.browser = {};
if (_s.browser.name) parameters.browser.name = _s.browser.name;
if (_s.browser.iFrame) parameters.browser.in_iframe = _s.browser.iFrame;
if (_s.browser.OS) {
parameters.browser.os = _s.browser.OS;
}
if (_s.browser.mobile) {
ad_is_valid = false;
}
parameters.behavior = {
volume: volume,
volume_on_by_default: volume_on_by_default,
auto_start: auto_start,
play_only_in_view_port: play_only_in_view_port,
show_logo: _s.response[id].expandableopen ? false : true,
ttl: 10
};
// monry event
// open for the first time in a 7-session
if (typeof (_s.response[id].open) === "number" && _s.response[id].open >= 0) {
if (_s.response[id].money === "trueview") {
trueViewEvent = true;
}
}
parameters.event = {
onView: function() {
// send view log
if (_s.response[id].money === "view") {
_s.load(http + "adsense.scupio.com/adpinline/VideoClick.aspx?vl=1&va=1&u=" + encodeURIComponent(_w.location.href) + "&" + _s.response[id].cp, "script", true);
if( typeof(_s.response[id].vce) !== "undefined" &&
typeof(_s.response[id].vce.c3) !== "undefined" &&
typeof(_s.response[id].adid) !== "undefined") {
// append VCE
jQQ("#scupio-expandable" + id).after(vce_url(_s.response[id].vce.c3, _s.response[id].adid, wid, cid));
}
} else {
// reset trueview on non-view view
// let view event reset this, since trueview only happens after a view
trueViewEvent = true;
_s.load(http + "adsense.scupio.com/adpinline/VideoClick.aspx?vl=2&va=1&u=" + encodeURIComponent(_w.location.href) + "&" + _s.response[id].cp, "script", true);
}
if( typeof(_s.response[id].vce_view) !== "undefined" &&
typeof(_s.response[id].vce_view.c3) !== "undefined" &&
typeof(_s.response[id].adid) !== "undefined") {
// append VCE
jQQ("#scupio-expandable" + id).after(vce_url(_s.response[id].vce_view.c3, _s.response[id].adid, wid, cid));
}
// dfa
if (window.ScupioMap[_s.response[id].adid]) {
jQQ('body').append('
');
}
},
on30s: function() {
// send trueview log
if (trueViewEvent) {
_s.load(http + "adsense.scupio.com/adpinline/VideoClick.aspx?vl=3&va=6&u=" + encodeURIComponent(_w.location.href) + "&" + _s.response[id].cp, "script", true);
if( typeof(_s.response[id].vce) !== "undefined" &&
typeof(_s.response[id].vce.c3) !== "undefined" &&
typeof(_s.response[id].adid) !== "undefined") {
// append VCE
jQQ("#scupio-expandable" + id).after(vce_url(_s.response[id].vce.c3, _s.response[id].adid, wid, cid));
}
} else {
_s.load(http + "adsense.scupio.com/adpinline/VideoClick.aspx?vl=4&va=6&u=" + encodeURIComponent(_w.location.href) + "&" + _s.response[id].cp, "script", true);
}
trueViewEvent = false;
// dfa
if (window.ScupioMap[_s.response[id].adid]) {
jQQ('body').append('
');
}
},
on25p: function (mouse) {
// mm
if (_s.response[id].mm) {
_s.load(http + "adsense.scupio.com/adpinline/VideoClick.aspx?vl=4&va=9&t=25&u=" + encodeURIComponent(_w.location.href) + "&" + _s.response[id].cp, "script", true);
if (mouse || has_mouse) {
_s.load(http + "adsense.scupio.com/adpinline/VideoClick.aspx?vl=4&va=10&t=25&u=" + encodeURIComponent(_w.location.href) + "&" + _s.response[id].cp, "script", true);
}
}
},
on50p: function (mouse) {
// mm
if (_s.response[id].mm) {
_s.load(http + "adsense.scupio.com/adpinline/VideoClick.aspx?vl=4&va=9&t=50&u=" + encodeURIComponent(_w.location.href) + "&" + _s.response[id].cp, "script", true);
if (mouse || has_mouse) {
_s.load(http + "adsense.scupio.com/adpinline/VideoClick.aspx?vl=4&va=10&t=50&u=" + encodeURIComponent(_w.location.href) + "&" + _s.response[id].cp, "script", true);
}
}
},
on75p: function (mouse) {
// mm
if (_s.response[id].mm) {
_s.load(http + "adsense.scupio.com/adpinline/VideoClick.aspx?vl=4&va=9&t=75&u=" + encodeURIComponent(_w.location.href) + "&" + _s.response[id].cp, "script", true);
if (mouse || has_mouse) {
_s.load(http + "adsense.scupio.com/adpinline/VideoClick.aspx?vl=4&va=10&t=75&u=" + encodeURIComponent(_w.location.href) + "&" + _s.response[id].cp, "script", true);
}
}
},
onPlayClick: function () {
_s.load(http + "adsense.scupio.com/adpinline/VideoClick.aspx?vl=4&va=11&u=" + encodeURIComponent(_w.location.href) + "&" + _s.response[id].cp, "script", true);
},
onEnded: function(in_view, player_id, mouse) {
// send trueview log
if (trueViewEvent) {
_s.load(http + "adsense.scupio.com/adpinline/VideoClick.aspx?vl=3&va=2&u=" + encodeURIComponent(_w.location.href) + "&" + _s.response[id].cp, "script", true);
if( typeof(_s.response[id].vce) !== "undefined" &&
typeof(_s.response[id].vce.c3) !== "undefined" &&
typeof(_s.response[id].adid) !== "undefined") {
// append VCE
jQQ("#scupio-expandable" + id).after(vce_url(_s.response[id].vce.c3, _s.response[id].adid, wid, cid));
}
}
else {
if(in_view){
_s.load(http + "adsense.scupio.com/adpinline/VideoClick.aspx?vl=4&va=7&u=" + encodeURIComponent(_w.location.href) + "&" + _s.response[id].cp, "script", true);
}
_s.load(http + "adsense.scupio.com/adpinline/VideoClick.aspx?vl=4&va=2&u=" + encodeURIComponent(_w.location.href) + "&" + _s.response[id].cp, "script", true);
}
trueViewEvent = false;
// mm
if (_s.response[id].mm) {
_s.load(http + "adsense.scupio.com/adpinline/VideoClick.aspx?vl=4&va=9&t=100&u=" + encodeURIComponent(_w.location.href) + "&" + _s.response[id].cp, "script", true);
if (mouse || has_mouse) {
_s.load(http + "adsense.scupio.com/adpinline/VideoClick.aspx?vl=4&va=10&t=100&u=" + encodeURIComponent(_w.location.href) + "&" + _s.response[id].cp, "script", true);
}
}
// dfa
if (window.ScupioMap[_s.response[id].adid]) {
jQQ('body').append('
');
}
if (_s.response[id].expandablehide) {
jQQ("#expandable-inner" + id).stop(true, true).hide(0, function() {
jQQ("#scupio-expandable" + id).stop(true, true).animate({
height: "90px"
}, function() {
jQQ("#expandable-outer" + id).stop(true, true).show();
jQQ("#toggle-open" + id).show();
open = false;
});
});
} else {
jQQ("#expandable-inner" + id).stop(true, true).hide(0, function() {
jQQ("#scupio-expandable" + id).stop(true, true).animate({
height: "0px"
}, function() {
open = false;
jQQ("#scupio-expandable" + id).remove();
});
});
}
// mm
if (_s.response[id].mm) {
_s.load(http + "adsense.scupio.com/adpinline/VideoClick.aspx?vl=4&va=9&t=100&u=" + encodeURIComponent(_w.location.href) + "&" + _s.response[id].cp, "script", true);
if (mouse) {
_s.load(http + "adsense.scupio.com/adpinline/VideoClick.aspx?vl=4&va=10&t=100&u=" + encodeURIComponent(_w.location.href) + "&" + _s.response[id].cp, "script", true);
}
}
}
}
if (_s.response[id].fblink) {
parameters.event.onFbClick = function() {
// send trueview log
if (trueViewEvent) {
var redirentURI = "http://money.scupio.com/adpinline/VideoClick.aspx?vl=3&va=5&ToURL=" + encodeURIComponent(_s.response[id].fblink) + "&u=" + encodeURIComponent(_w.location.href) + "&" + _s.response[id].cp;
window.open(redirentURI, '_blank');
if( typeof(_s.response[id].vce) !== "undefined" &&
typeof(_s.response[id].vce.c3) !== "undefined" &&
typeof(_s.response[id].adid) !== "undefined") {
// append VCE
jQQ("#scupio-expandable" + id).after(vce_url(_s.response[id].vce.c3, _s.response[id].adid, wid, cid));
}
} else {
var redirentURI = "http://money.scupio.com/adpinline/VideoClick.aspx?vl=4&va=5&ToURL=" + encodeURIComponent(_s.response[id].fblink) + "&u=" + encodeURIComponent(_w.location.href) + "&" + _s.response[id].cp;
window.open(redirentURI, '_blank');
}
trueViewEvent = false;
};
}
if (_s.response[id].link) {
parameters.event.onAdClick = function() {
// send trueview log
if (trueViewEvent) {
var redirentURI = "http://money.scupio.com/adpinline/VideoClick.aspx?vl=3&va=4&ToURL=" + encodeURIComponent(_s.response[id].link) + "&u=" + encodeURIComponent(_w.location.href) + "&" + _s.response[id].cp;
window.open(redirentURI, '_blank');
if( typeof(_s.response[id].vce) !== "undefined" &&
typeof(_s.response[id].vce.c3) !== "undefined" &&
typeof(_s.response[id].adid) !== "undefined") {
// append VCE
jQQ("#scupio-expandable" + id).after(vce_url(_s.response[id].vce.c3, _s.response[id].adid, wid, cid));
}
} else {
var redirentURI = "http://money.scupio.com/adpinline/VideoClick.aspx?vl=4&va=4&ToURL=" + encodeURIComponent(_s.response[id].link) + "&u=" + encodeURIComponent(_w.location.href) + "&" + _s.response[id].cp;
window.open(redirentURI, '_blank');
}
trueViewEvent = false;
};
}
parameters.event.onError = function() {
jQQ("#scupio-expandable" + id).remove();
};
var barbar;
if (ad_is_valid) {
// load expandable to DOM
jQQ("#" + scriptId).after(strVar);
jQQ("#scupio-expandable" + id).hover(function(){
has_mouse = true;
}, function(){
has_mouse = false;
});
// attach player to expandable
barbar = _s._Player_.create(parameters);
// attach listeners to expandable
jQQ(_d).ready(function() {
var lid;
// open for the first time in a 7-session
if (typeof (_s.response[id].open) === "number" && _s.response[id].open >= 0) {
open = true;
jQQ("#expandable-outer" + id).hide();
jQQ("#toggle-open" + id).hide();
jQQ("#scupio-expandable" + id).stop(true, true).animate({
height: "390px"
}, 600, function() { });
jQQ("#expandable-inner" + id).delay(600).show(0, function() {
// inner is now openned, try to play our video
var vto = 50;
lid = setInterval(function() {
vto--;
if (vto < 0) {
_w.clearInterval(lid);
// failed
jQQ("#scupio-expandable" + id).remove();
}
if (typeof (barbar) !== "undefined" && barbar.ready) {
_w.clearInterval(lid);
barbar.play = true;
}
}, 200);
});
// change toggle button text
jQQ("#toggle-button" + id).css('background-position', '-89px -139px');
}
// trueview
jQQ("#click-area" + id).click(function() {
if (trueViewEvent) {
var redirentURI = "http://money.scupio.com/adpinline/VideoClick.aspx?vl=3&va=4&ToURL=" + encodeURIComponent(_s.response[id].link) + "&u=" + encodeURIComponent(_w.location.href) + "&" + _s.response[id].cp;
window.open(redirentURI, '_blank');
if( typeof(_s.response[id].vce) !== "undefined" &&
typeof(_s.response[id].vce.c3) !== "undefined" &&
typeof(_s.response[id].adid) !== "undefined") {
// append VCE
jQQ("#scupio-expandable" + id).after(vce_url(_s.response[id].vce.c3, _s.response[id].adid, wid, cid));
}
} else {
var redirentURI = "http://money.scupio.com/adpinline/VideoClick.aspx?vl=4&va=4&ToURL=" + encodeURIComponent(_s.response[id].link) + "&u=" + encodeURIComponent(_w.location.href) + "&" + _s.response[id].cp;
window.open(redirentURI, '_blank');
}
trueViewEvent = false;
});
// trueview
jQQ("#expandable-outer" + id).click(function() {
if (trueViewEvent) {
var redirentURI = "http://money.scupio.com/adpinline/VideoClick.aspx?vl=3&va=4&ToURL=" + encodeURIComponent(_s.response[id].link) + "&u=" + encodeURIComponent(_w.location.href) + "&" + _s.response[id].cp;
window.open(redirentURI, '_blank');
if( typeof(_s.response[id].vce) !== "undefined" &&
typeof(_s.response[id].vce.c3) !== "undefined" &&
typeof(_s.response[id].adid) !== "undefined") {
// append VCE
jQQ("#scupio-expandable" + id).after(vce_url(_s.response[id].vce.c3, _s.response[id].adid, wid, cid));
}
} else {
var redirentURI = "http://money.scupio.com/adpinline/VideoClick.aspx?vl=4&va=4&ToURL=" + encodeURIComponent(_s.response[id].link) + "&u=" + encodeURIComponent(_w.location.href) + "&" + _s.response[id].cp;
window.open(redirentURI, '_blank');
}
trueViewEvent = false;
});
jQQ("#scupio-expandable-scupio_logo" + id).click(function() {
window.open(decodeURIComponent("http://www.scupio.com.tw"), '_blank');
});
jQQ("#toggle-button" + id).click(function() {
if (open) {
if (typeof (barbar) !== "undefined" && barbar.ready) {
barbar.reset();
barbar.play = false;
barbar.pause = true;
}
if (_s.response[id].expandablehide) {
jQQ("#expandable-inner" + id).stop(true, true).hide(0, function() {
jQQ("#scupio-expandable" + id).stop(true, true).animate({
height: "90px"
}, function() {
jQQ("#expandable-outer" + id).stop(true, true).show();
jQQ("#toggle-open" + id).show();
open = false;
});
});
}
else {
jQQ("#expandable-inner" + id).stop(true, true).hide(0, function() {
jQQ("#scupio-expandable" + id).stop(true, true).animate({
height: "0px",
border: "0px"
}, function() {
open = false;
jQQ("#toggle-button" + id).remove();
setTimeout(function() {
jQQ("#scupio-expandable" + id).remove();
}, 1000);
});
});
}
jQQ("#toggle-button" + id).css('background-position', '0px -139px');
_s.load(http + "adsense.scupio.com/adpinline/VideoClick.aspx?vl=4&va=8&u=" + encodeURIComponent(_w.location.href) + "&" + _s.response[id].cp, "script", true);
}
else {
open = true;
jQQ("#expandable-outer" + id).hide();
jQQ("#toggle-open" + id).hide();
jQQ("#scupio-expandable" + id).stop(true, true).animate({
height: "390px"
}, 600);
jQQ("#expandable-inner" + id).delay(600).show(0, function() {
// inner is now openned, try to play our video
var vto = 50;
lid = setInterval(function() {
vto--;
if (vto < 0) {
_w.clearInterval(lid);
// failed
jQQ("#scupio-expandable" + id).remove();
}
if (typeof (barbar) !== "undefined" && barbar.ready) {
_w.clearInterval(lid);
barbar.reset();
barbar.play = true;
barbar.pause = false;
}
}, 200);
});
jQQ("#toggle-button" + id).css('background-position', '-89px -139px');
_s.load(http + "adsense.scupio.com/adpinline/VideoClick.aspx?vl=4&va=11&u=" + encodeURIComponent(_w.location.href) + "&" + _s.response[id].cp, "script", true);
}
});
jQQ("#toggle-open" + id).click(function() {
if (!open) {
open = true;
jQQ("#expandable-outer" + id).hide();
jQQ("#toggle-open" + id).hide();
jQQ("#scupio-expandable" + id).stop(true, true).animate({
height: "390px"
}, 600);
jQQ("#expandable-inner" + id).delay(600).show(0, function() {
// inner is now openned, try to play our video
var vto = 50;
lid = setInterval(function() {
vto--;
if (vto < 0) {
_w.clearInterval(lid);
// failed
jQQ("#scupio-expandable" + id).remove();
}
if (typeof (barbar) !== "undefined" && barbar.ready) {
_w.clearInterval(lid);
barbar.reset();
barbar.play = true;
barbar.pause = false;
}
}, 200);
});
jQQ("#toggle-button" + id).css('background-position', '-89px -139px');
_s.load(http + "adsense.scupio.com/adpinline/VideoClick.aspx?vl=4&va=11&u=" + encodeURIComponent(_w.location.href) + "&" + _s.response[id].cp, "script", true);
}
});
});
}
}
}
}
}, 100);
})(window);