var enablepersist="on" 

if (document.getElementById){
document.write('<style type="text/css">')
document.write('.switchcontent{display: none;}')
document.write('</style>')
}

function getElementbyClass(classname){
ccollect=new Array()
var inc=0
var alltags=document.all? document.all : document.getElementsByTagName("*")
for (i=0; i<alltags.length; i++){
if (alltags[i].className==classname)
ccollect[inc++]=alltags[i]
}
}

function contractcontent(omit){
var inc=0
while (ccollect[inc]){
if (ccollect[inc].id!=omit)
ccollect[inc].style.display="none"
inc++
}
}

function expandcontent(cid){
	if (typeof ccollect!="undefined"){
		contractcontent(cid)
		document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="block")? "block" : "none"
		selectedItem=cid+"|"+document.getElementById(cid).style.display
	}
	//esto es mio (mespi)
	if (cid=='sc2') {
		initiateFade();
	} //aqui termino
}

function initiateFade() {
	img1fader=new alphaAPI('img1',20,35,100,40,null,5);
	img1fader.norepeat();
	img2fader=new alphaAPI('img2',20,35,100,40,null,5);
	img2fader.norepeat();
	img3fader=new alphaAPI('img3',20,35,100,40,null,5);
	img3fader.norepeat();
	img4fader=new alphaAPI('img4',20,35,100,40,null,5);
	img4fader.norepeat();
	img5fader=new alphaAPI('img5',20,35,100,40,null,5);
	img5fader.norepeat();
	img6fader=new alphaAPI('img6',20,35,100,40,null,5);
	img6fader.norepeat();
	img7fader=new alphaAPI('img7',20,35,100,40,null,5);
	img7fader.norepeat();
	img8fader=new alphaAPI('img8',20,35,100,40,null,5);
	img8fader.norepeat();
	img9fader=new alphaAPI('img9',20,35,100,40,null,5);
	img9fader.norepeat();
	img10fader=new alphaAPI('img10',20,35,100,40,null,5);
	img10fader.norepeat();
	img11fader=new alphaAPI('img11',20,35,100,40,null,5);
	img11fader.norepeat();
	img12fader=new alphaAPI('img12',20,35,100,40,null,5);
	img12fader.norepeat();
	img13fader=new alphaAPI('img13',20,35,100,40,null,5);
	img13fader.norepeat();
	img14fader=new alphaAPI('img14',20,35,100,40,null,5);
	img14fader.norepeat();
	img15fader=new alphaAPI('img15',20,35,100,40,null,5);
	img15fader.norepeat();
	img16fader=new alphaAPI('img16',20,35,100,40,null,5);
	img16fader.norepeat();
	img17fader=new alphaAPI('img17',20,35,100,40,null,5);
	img17fader.norepeat();
	img18fader=new alphaAPI('img18',20,35,100,40,null,5);
	img18fader.norepeat();
	img19fader=new alphaAPI('img19',20,35,100,40,null,5);
	img19fader.norepeat();
	img20fader=new alphaAPI('img20',20,35,100,40,null,5);
	img20fader.norepeat();
	img21fader=new alphaAPI('img21',20,35,100,40,null,5);
	img21fader.norepeat();
	img22fader=new alphaAPI('img22',20,35,100,40,null,5);
	img22fader.norepeat();
	img23fader=new alphaAPI('img23',20,35,100,40,null,5);
	img23fader.norepeat();
	img24fader=new alphaAPI('img24',20,35,100,40,null,5);
	img24fader.norepeat();
	img25fader=new alphaAPI('img25',20,35,100,40,null,5);
	img25fader.norepeat();
	img26fader=new alphaAPI('img26',20,35,100,40,null,5);
	img26fader.norepeat();
	img27fader=new alphaAPI('img27',20,35,100,40,null,5);
	img27fader.norepeat();
	img28fader=new alphaAPI('img28',20,35,100,40,null,5);
	img28fader.norepeat();
	img29fader=new alphaAPI('img29',20,35,100,40,null,5);
	img29fader.norepeat();
	img30fader=new alphaAPI('img30',20,35,100,40,null,5);
	img30fader.norepeat();
}

function revivecontent(){
selectedItem=getselectedItem()
selectedComponents=selectedItem.split("|")
contractcontent(selectedComponents[0])
document.getElementById(selectedComponents[0]).style.display=selectedComponents[1]
//esto es lo que carga la funcion si la cookie marca la seccion de clientes
	if (selectedComponents[0]=='sc2') {
		initiateFade();
	} //aqui termino

}

function get_cookie(Name) { 
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { 
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function getselectedItem(){
if (get_cookie(window.location.pathname) != ""){
selectedItem=get_cookie(window.location.pathname)
return selectedItem
}
else
return ""
}

function saveswitchstate(){
if (typeof selectedItem!="undefined")
document.cookie=window.location.pathname+"="+selectedItem
}

function do_onload(){
getElementbyClass("switchcontent")
if (enablepersist=="on" && getselectedItem()!="")
revivecontent()
}


if (window.addEventListener)
window.addEventListener("load", do_onload, false)
else if (window.attachEvent)
window.attachEvent("onload", do_onload)
else if (document.getElementById)
window.onload=do_onload

if (enablepersist=="on" && document.getElementById)
window.onunload=saveswitchstate
