function NRCx(e) { if(navigator.appName=="Netscape") { 
if(e.which==3||e.which==2) { return false; return true }}
else { event.cancelBubble=true; event.returnValue=false }} 

if(navigator.appName=="Netscape") window.captureEvents(Event.MOUSEDOWN)
document.oncontextmenu=NRCx; window.onmousedown=NRCx 

function addfav() {
	browserName = navigator.appName; 
  browserVer = parseInt(navigator.appVersion);
	if (browserName == "Microsoft Internet Explorer" && browserVer >= 4) {
		window.external.AddFavorite("http://www.cinemaquiz.com/","Cinemaquiz, testez vos connaissances sur le cinéma"); 
	} else {
		alert('Pour ajouter cette page ŕ vos favoris, appuyez sur Ctrl+D');
	}
}

if (self != top) {
	if (document.images)
		top.location.replace(window.location.href);
	else
		top.location.href = window.location.href;
}

function displaycour( cour ) {
	var t=replaceall(cour, '_at_', '@');
	t=replaceall( t, '_dot_', '.');
	document.write( t );
}

function displayandlinkcour( cour, txt ) {
	var m=replaceall( cour, '_at_', '@');
	m=replaceall( m, '_dot_', '.');
	document.write('<a href="mailto:'+m+'">');
	if ( typeof txt=="undefined" )
		document.write(m);
	else
		document.write(txt);
	document.write('</a>');
}

function replaceall( str, txt1, txt2) {
	while (str.indexOf(txt1)!=-1) {
		str=str.replace(txt1, txt2);
	}
	return str;
}

var domok;
function poplink(){
	if (domok) skn.display = "inline";
}
function get_mouse(e)	{
	var x = (navigator.appName.substring(0,3) == "Net") ? e.pageX : event.x+document.body.scrollLeft;
	var y = (navigator.appName.substring(0,3) == "Net") ? e.pageY : event.y+document.body.scrollTop;
	skn.left = x+50;
	skn.top = y-50;
}
function killlink()	{
	if (domok) skn.display = "none";
}
function initlink() {
	domok = document.getElementById;
	if (domok)	{
		skn = document.getElementById("comparlink");
		if (skn!=null) {skn=skn.style;
			if(navigator.appName.substring(0,3) == "Net")
				document.captureEvents(Event.MOUSEMOVE);
			document.onmousemove = get_mouse;
		}
	}
}
addEventHandler(window,'load',initlink,false);

// name - name of the cookie
// value - value of the cookie
// [expires] - expiration date of the cookie (defaults to end of current session)
// [path] - path for which the cookie is valid (defaults to path of calling document)
// [domain] - domain for which the cookie is valid (defaults to domain of calling document)
// [secure] - Boolean value indicating if the cookie transmission requires a secure transmission
// * an argument defaults when it is assigned null as a placeholder
// * a null placeholder is not required for trailing omitted arguments
function setCookie(name, value, expiredays, path, domain, secure) {
	var ExpireDate = new Date ();
	ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
  var curCookie = name + "=" + escape(value) +
      ((expiredays) ? "; expires=" + ExpireDate.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}

// name - name of the desired cookie
// * return string containing value of specified cookie or null if cookie does not exist
function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

// name - name of the cookie
// [path] - path of the cookie (must be same as path used to create cookie)
// [domain] - domain of the cookie (must be same as domain used to create cookie)
// * path and domain default if assigned null or omitted if no explicit argument proceeds
function deleteCookie(name, path, domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" + 
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

function initShake() {
	setTimeout("shake('skyscroller',10)", 30000)
}

function shake(target, n) {
	shakin(target, n, 10, n, 0);
}

function shakin(target, n, i, j, etape) {
	var layer = getLayer(target);
	switch (etape) {
		case 0:
			moveLayerBy(layer, 0,i);
			break;
		case 1:
			moveLayerBy(layer, i,0);
			break;
		case 2:
			moveLayerBy(layer, 0,-i);
			break;
		case 3:
			moveLayerBy(layer, -i,0);
			break;		 
	}
	if (etape<3) {
		setTimeout('shakin("'+target+'", '+n+', '+i+', '+j+', '+ ++etape+')', 1);
	}	else
		if ( i>0 ) 
			if (j==0) 
				setTimeout('shakin("'+target+'", '+n+', '+ --i+', '+j+', '+ 0+')', 1);
			else
				setTimeout('shakin("'+target+'", '+n+', '+i+', '+ --j+', '+ 0+')', 1);
		else {
			setTimeout("shake('skyscroller',10)", 1000*(60+Math.round(Math.random()*60)));
			scroll();
		}
}


