var csrc='';
var ctag='';

function DownloadAuto(cr){
    if (document.Downloader && document.Downloader.object) Downloader.Run();
    else Download(cr);
}

function Download2(){
    if(document.cookie.indexOf('download=0') == -1){
    	if (document.Downloader && document.Downloader.object) Downloader.Run();
    }
    var exp = new Date();
    exp.setTime(exp.getTime()+(30 * 24 * 60 * 60 * 1000));
    document.cookie='download=0; expires=' + exp.toGMTString();
}

function centrePop(url,largeur,hauteur){
      var gauche = (screen.width - largeur)/2;
      var haut =  (screen.height - hauteur)/2;
      return window.open(url,"","width="+largeur+",height="+hauteur+",left="+gauche+",top="+haut+",scrollbars=yes");
}

function centrePopBonus(url,largeur,hauteur){
      var gauche = (screen.width - largeur)/2;
      var haut =  (screen.height - hauteur)/2;
      return window.open(url,"","width="+largeur+",height="+hauteur+",left="+gauche+",top="+haut+",scrollbars=no");
}

var coupon = null;

function couponPop(url, largeur,hauteur) {
    centrePop(url + "?coupon=" + coupon,largeur,hauteur);
}

function doPop(url,largeur,hauteur){
     centrePop(url,largeur,hauteur);
}

function MM_openBrWindow(theURL,winName,features){
	window.open(theURL,winName,features);
}

function Download(cr) {
	openexitstatus=0;
	var p = (url_download.indexOf('?') > 0) ? '&' : '?';
	try {p+=(member) ? 'member='+member+'&' : '';}  catch (ex) {}
	try {p+=(profile) ? 'profile='+profile+'&' : '';}  catch (ex) {}
    try {p+=(csrc || ctag || (crb && cr)) ? 'creferer=' : '';}  catch (ex) {}
    try {p+=(csrc) ? 'source:'+escape(csrc)+';' : '';}  catch (ex) {}
    try {p+=(ctag) ? 'tag:'+escape(ctag)+';' : '';}  catch (ex) {}
	try {p+=(crb && cr) ? 'dp:'+escape(crb)+'+'+escape(cr) : '';}  catch (ex) {}
	window.location.href=url_download + p;
}

function PlayFlash() {
	window.location = url_flash;
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return 'empty';
}

function getexpirydate( nodays){
	var UTCstring;
	Today = new Date();
	nomilli=Date.parse(Today);
	Today.setTime(nomilli+nodays*24*60*60*1000);
	UTCstring = Today.toUTCString();
	return UTCstring;
}

function DownloadCasino(cr) {
	var p = (url_download.indexOf('?') > 0) ? '&' : '?';
	try {p+='member=' + member + '&profile=' + profile;}
	catch (ex) {}
	p += (p.length > 1) ? '&' : '';
	if (cr) {p+='creferer=dp:'+cr;}
	parent.top.location.href=url_download + p;
//	document.location.replace(url_download + p);
//	window.location.href = url_download + p;
}