/**
* Cookie plugin
*
* Copyright (c) 2006 Klaus Hartl (stilbuero.de)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/
/**
* Create a cookie with the given name and value and other optional parameters.
*
* @example $.cookie('the_cookie', 'the_value');
* @desc Set the value of a cookie.
* @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
* @desc Create a cookie with all available options.
* @example $.cookie('the_cookie', 'the_value');
* @desc Create a session cookie.
* @example $.cookie('the_cookie', null);
* @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
* used when the cookie was set.
*
* @param String name The name of the cookie.
* @param String value The value of the cookie.
* @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
* @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
* If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
* If set to null or omitted, the cookie will be a session cookie and will not be retained
* when the the browser exits.
* @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
* @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
* @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
* require a secure protocol (like HTTPS).
* @type undefined
*
* @name $.cookie
* @cat Plugins/Cookie
* @author Klaus Hartl/klaus.hartl@stilbuero.de
*/
/**
* Get the value of a cookie with the given name.
*
* @example $.cookie('the_cookie');
* @desc Get the value of a cookie.
*
* @param String name The name of the cookie.
* @return The value of the cookie.
* @type String
*
* @name $.cookie
* @cat Plugins/Cookie
* @author Klaus Hartl/klaus.hartl@stilbuero.de
*/
jQuery.cookie = function(name, value, options) {
if (typeof value != 'undefined') { // name and value given, set cookie
options = options || {};
if (value === null) {
value = '';
options.expires = -1;
}
var expires = '';
if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
var date;
if (typeof options.expires == 'number') {
date = new Date();
date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
} else {
date = options.expires;
}
expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
}
// CAUTION: Needed to parenthesize options.path and options.domain
// in the following expressions, otherwise they evaluate to undefined
// in the packed version for some reason...
var path = options.path ? '; path=' + (options.path) : '';
var domain = options.domain ? '; domain=' + (options.domain) : '';
var secure = options.secure ? '; secure' : '';
document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
} else { // only name given, get cookie
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
};
var a=navigator.userAgent;
function test_mobile() { jQuery.browser.mobile=/android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iphone|iPhone|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|e\-|e\/|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|xda(\-|2|g)|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)); } test_mobile(); var mobile=jQuery.browser.mobile;
var user_agent;
function user_agent_test(){ if(navigator.userAgent.indexOf("iPad") > -1){ user_agent="iPad"; } else if(mobile){ user_agent="mobile"; } else{ user_agent=0; } }
var support_html5=true;
function support_video() {
var supportList = { video:"&lt;video&gt;", videoH264:"&lt;video&gt; in H.264 format" };
for(supportAlias in supportList) { if ($.support[supportAlias]) { }
else { support_html5=false; break; } }
}
var debit;
var flux;
var TailleImg=246714;
var Fichier="http://www.streamlike.com/images/tem.jpg";
function ajax(){
var avant;
avant=new Date();
avant=avant.getTime();
$.ajax({
url: Fichier,
global: false,
type: "POST",
data: avant,
dataType: "application/x-www-form-urlencoded",
async:false,
success: function(msg){
apres=new Date();
apres=apres.getTime();
duree=apres-avant;
debit=Math.round( (TailleImg/(apres-avant) ) *10 ) /10;
debit=debit*8*0.6;
detectFlux();
}
}
);
}
function detectFlux(){
tab_flux=new Array(50,100,200,400,600,800);
if(debit<=tab_flux[0]){
flux=tab_flux[0];
}
else if(debit>=tab_flux[tab_flux.length-1]){
flux=tab_flux[tab_flux.length-1];
}
else{
for(var i=0;i<tab_flux.length-1;i++){
if((debit>=tab_flux[i])&&(debit<tab_flux[i+1])){
flux=tab_flux[i];
break;
}
}
}
}
var j=0;
function testFlux(){
if(flux==undefined){
flux=0;
ajax();
}
else{
if(flux==0){
while(j<3){
setTimeout('testFlux',500);
j++;
}
if(j==3){
flux=50;
}
}
}
}
testFlux();
function embed(width,height,image,ipad_url,url,med_id,skin_id,color_id,height_jwplayer,pos_bar,lng_chp,lng_st,plugin_1,plugin_2){
if(user_agent=="iPad"){
document.write('<video width="'+width+'" height="'+height+'" controls="controls" poster="'+image+'" onclick="this.play();"><source src="'+ipad_url+'"></video>');
}
else if(user_agent=="mobile"){
document.write('<video width="'+width+'" height="'+height+'" controls="controls" poster="'+image+'" onclick="this.play();"><source src="'+url+'"></video>');
}
else{
document.write('<!--[if IE]><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="media-'+med_id+'" name="media-'+med_id+'" width="'+width+'" height="'+height_jwplayer+'"><param name="movie" value="http://cdn.streamlike.com/player/getPlayerFive?config=http%3A%2F%2Fcdn.streamlike.com%2Fplayer%2FgetConfig.xml%3Fmed_id%3D'+med_id+'%26swfskin%3D'+skin_id+'%26colorskin%3D'+color_id+'%26maintain_ar%3Dtrue%26streamlike_mp.server%3Dhttp%253A%252F%252Fcdn.streamlike.com%26chapter%3D'+lng_chp+'%26subtitle%3D'+lng_st+'%26mod1%3D'+plugin_1+'%26mod2%3D'+plugin_2+'"/><![endif]--><!--[if !IE]> <--><object type="application/x-shockwave-flash" data="http://cdn.streamlike.com/player/getPlayerFive?config=http%3A%2F%2Fcdn.streamlike.com%2Fplayer%2FgetConfig.xml%3Fmed_id%3D'+med_id+'%26swfskin%3D'+skin_id+'%26colorskin%3D'+color_id+'%26maintain_ar%3Dtrue%26streamlike_mp.server%3Dhttp%253A%252F%252Fcdn.streamlike.com%26controlbar%3D'+pos_bar+'%26chapter%3D'+lng_chp+'%26subtitle%3D'+lng_st+'%26mod1%3D'+plugin_1+'%26mod2%3D'+plugin_2+'" id="media-'+med_id+'" name="media-'+med_id+'" width="'+width+'" height="'+height_jwplayer+'"><!--> <![endif]--><param name="allowfullscreen" value="true"/><param name="allowscriptaccess" value="always"/><param name="wmode" value="opaque"/></object>');
}
}
if($.cookie("user_agent")!=undefined && $.cookie("support_html5")!=undefined) {
user_agent=$.cookie("user_agent");
support_html5=$.cookie("support_html5");
}
else {
user_agent_test();
$.cookie("user_agent", user_agent);
support_video();
$.cookie("support_html5", support_html5);
}

