
/*************************************
code de switch d'affichage des blocks 
basé sur le code de :
#####################################
# SOURCE: Nukecops 
# POST: 5299 
# AUTEUR: djmaze 
# SITE: http://www.cpgnuke.com 
#####################################
**************************************/


// ################ PARAMETRES ! 

// emplacement des images plus et minus par défaut si non renseigné dans doblock !
var imagepath = "themes/aragua/images/"; 
// Exemple: Expire cookie 1 heure = 60,000 millisecondes dans le future. 
// Augmenter cette valeur si besoin !
var expirationck = new Date();
expirationck.setTime(expirationck.getTime() + 60000);

// ############### FIN PARAMETRES 


blockarray = new Array(); 
var blockarrayint = -1; 

function doblocks(imgpath) { 
var imgpath;
if (imgpath != null) imagepath = imgpath; 
for (var q = 0; q < blockarray.length; q++) { 
xyzswitch(blockarray[q]); 
} 
} 

function xswitch(listID) { 

if(listID.style.display=="none") { 
listID.style.display=""; 
} else { 
listID.style.display="none"; 
} 
} 
function icoswitch(bid) { 

icoID = document.getElementById('pic'+bid); 
if(icoID.src.indexOf("minus") != -1) { 
icoID.src = imagepath+"plus.gif"; 
SetCookie('block'+bid+'','yes',expirationck); 
} else { 
icoID.src = imagepath+"minus.gif"; 
DeleteCookie('block'+bid); 
} 
} 
function xyzswitch(bid) { 

xswitch(document.getElementById('ph'+bid+'')); 
xswitch(document.getElementById('pe'+bid+'')); 
icoswitch(bid); 

}

//--------------- Gestion du cookie !

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));
}

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 SetCookie(name, value, expires, path, domain, secure)
{
document.cookie= name + "=" + escape(value) +
((expires) ? "; expires=" + expires.toGMTString() : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
}
