var spc_animating = false;
var spc_top_expand_position = spc_top_expand_position == null ? 'fixed' : spc_top_expand_position;
function spc_is_safari()
{
return (navigator.userAgent.indexOf("Safari") != -1);
}
function spc_is_gecko()
{
return (navigator.userAgent.indexOf("Gecko") != -1);
}
function spc_is_opera()
{
return (navigator.userAgent.indexOf("Opera") != -1);
}
function spc_is_ie()
{
return (document.all ? true : false);
}
function spc_host_blacklist()
{
var host_blacklist = new Array();
host_blacklist.push('.fr.tc');
host_blacklist.push('.fr.nr');
host_blacklist.push('.ca.gg');
host_blacklist.push('.sg.gg');
host_blacklist.push('.xdir.fr');
host_blacklist.push('.xdir.org');
for (i in host_blacklist)
if (window.location.host.indexOf(spc_host_blacklist[i]) != -1)
return false;
return true;
}
function spc_top_expand(iframe_src, collapsed_height, expanded_height)
{
if (!spc_host_blacklist())
return false;
var is_safari = spc_is_safari();
var is_gecko = spc_is_gecko();
var is_opera = spc_is_opera();
var is_ie = spc_is_ie();
//
// Body check and init
//
var d = document;
body_obj = d.getElementsByTagName("body")[0];
if (!body_obj)
return false;
body_obj.style["marginTop"] = 0;
//
// Iframe, top-expand's content
//
iframe_obj = d.createElement("iframe");
iframe_obj.id = "spc_top_expand";
iframe_obj.name = iframe_obj.id;
iframe_obj.src = iframe_src;
iframe_obj.height = collapsed_height;
iframe_obj.width = "100%";
iframe_obj.marginHeight = "0";
iframe_obj.marginWidth = "0";
iframe_obj.hspace = "0";
iframe_obj.vspace = "0";
iframe_obj.scrolling = "no";
iframe_obj.frameBorder = "0";
iframe_obj.allowTransparency = "no";
iframe_obj.style["border"] = "none";
iframe_obj.style["position"] = spc_top_expand_position;
iframe_obj.style["zIndex"] = "255";
iframe_obj.style["top"] = "0";
iframe_obj.style["left"] = "0";
// Events handlers
if (true || is_ie || is_gecko) {
iframe_obj.onmouseover = function () {
spc_animating = 1;
spc_animate_top_expand(collapsed_height, expanded_height, 1);
}
iframe_obj.onmouseout = function () {
spc_animating = -1;
spc_animate_top_expand(expanded_height, collapsed_height, -1);
}
}
//
// Top div placeholder
//
div_obj = d.createElement("div");
div_obj.id = "spc_top_expand_placeholder";
div_obj.style["backgroundColor"] = "transparent";
div_obj.style["fontSize"] = "1px";
div_obj.style["margin"] = "0";
div_obj.style["padding"] = "0";
div_obj.style["height"] = collapsed_height - 1 + "px";
//
// (Un)Expand buttons
//
if (is_gecko || is_safari || is_opera) {
var btn = d.createElement("div");
btn.style["backgroundColor"] = "#EEEEEE";
btn.style["font"] = "bold 1px arial, verdana, helvetica, sans-serif";
btn.style["margin"] = "0";
btn.style["padding"] = "0 5px";
btn.style["position"] = spc_top_expand_position;
btn.style["zIndex"] = "500";
btn.style["top"] = "0";
btn.innerHTML = '
';
var btn_left = btn.cloneNode(true);
btn_left.style["left"] = "50%";
btn_left.style["marginLeft"] = "-389px";
var btn_right = btn.cloneNode(true);
btn_right.style["right"] = "50%";
btn_right.style["marginRight"] = "-389px";
// Insert buttons into div placeholder
div_obj.appendChild(btn_left);
div_obj.appendChild(btn_right);
}
div_obj.appendChild(iframe_obj);
if (body_obj.hasChildNodes()) {
first_child = body_obj.firstChild;
//body_obj.insertBefore(iframe_obj, first_child);
//body_obj.insertBefore(div_obj, first_child);
body_obj.insertBefore(div_obj, first_child);
} else {
body_obj.appendChild(div_obj);
}
//
// Fixed lib
//
if (is_ie && window.spc_top_expand_position == 'fixed')
document.write('');
return (true);
}
function spc_animate_top_expand(start, finish, inc_sign)
{
var inc = 6 * inc_sign;
if (spc_animating && inc_sign != spc_animating)
return (false);
var d = document;
var container_obj = d.getElementById("spc_top_expand");
if (!container_obj)
return (false);
var current_height = parseInt(container_obj.height);
if ((current_height * inc_sign) < (finish * inc_sign)) {
container_obj.height = current_height + inc;
setTimeout("spc_animate_top_expand("+start+","+finish+","+inc_sign+")", 1);
} else {
spc_animating = false;
}
}
function spc_toggle_top_expand(expanded_height, collapsed_height) {
container_obj = document.getElementById("spc_top_expand");
if (container_obj) {
if (container_obj.height == collapsed_height) {
container_obj.height = expanded_height;
new_img_src = "http://planeteray.free.fr/pub/images/fleche_haut.gif";
} else {
container_obj.height = collapsed_height;
new_img_src = "http://planeteray.free.fr/pub/images/fleche_bas.gif";
}
placeholder_obj = document.getElementById("spc_top_expand_placeholder");
if (placeholder_obj) {
var img_list = placeholder_obj.getElementsByTagName("img");
for (i = 0; i < img_list.length; i++) {
if (img_list[i].src.indexOf("http://planeteray.free.fr/pub/") != -1)
img_list[i].src = new_img_src;
}
}
}
return false;
}
spc_top_expand(spc_top_expand_src, spc_top_expand_minheight, spc_top_expand_maxheight);