Ver Mensaje Individual
  #7 (permalink)  
Antiguo 30/01/2004, 15:06
Myaga
 
Fecha de Ingreso: enero-2004
Mensajes: 6
Antigüedad: 21 años
Puntos: 0
/************************************************** ******************************
Function to create the objects and the divs
************************************************** ******************************/
createSlideMenu.prototype.makeMenu = function(type,text,lnk,target,end){
var str="",tg="",parent,m,cl
m = this.menus[this.curr] = new Object()
this.lasttype[type] = this.curr; if(!lnk) lnk="#"
m.lev = 0; m.type = type; m.childs = new Array()
m.num = this.curr; m.parent = -1; m.nextel = -1
m.nexttop = -1; parent = 0
//DEBUGGING::::::
m.text = text

if(type.indexOf("sub")>-1){ //Find parent type
if(type.length == 3){ //sub
parent = "top"; m.lev = 1
}else{
parent = type.substr(3,1) //sub2+
m.lev = parent; parent--
if(parent==1){
parent = "sub"; m.lev = 2
}else parent = "sub"+parent
}
}
if(m.lev>=this.l.length){//Level control (same as CM4)
var p1,p2=0;
if(m.lev>=this.level.length) p1=this.l[this.level.length-1];
else p1=this.level[m.lev];
this.l[m.lev]=new Array();
if(!p2) p2=this.l[m.lev-1]
if(m.lev!=0 && p1){
for(i in p1){ //Copying an entire object
if(p1[i]==null) this.l[m.lev][i]=p2[i];
else this.l[m.lev][i]=p1[i]
}
}else{
this.l[m.lev]=this.level[0];
}
this.level[m.lev]=p1=p2=null
}
this.active[m.lev] = -1
if(parent){ //Find parent element
m.parent = this.lasttype[parent]
parent = this.menus[this.lasttype[parent]]
parent.childs[parent.childs.length] = m
if(this.arrow && parent.childs.length==1){str='<span class="'+this.arrow+'">4</span>'
if(document.getElementById && document.getElementById(parent.id).childNodes){
parent.ar = document.getElementById(parent.id).childNodes[this.useImage?1:0].childNodes[0]
parent.ar.innerHTML = str+parent.ar.innerHTML; parent.ar=parent.ar.childNodes[0]} else this.arrow=""
}
}else this.topmenus[this.topmenus.length] = this.curr
if(!this.writesubsonly || type!="top"){
cl = this.l[m.lev].className
m.id = id = this.name + "_" + this.curr
str= '<div id="'+id+'" class="'+cl+'">' //main div start
if(this.useImages){
str+='<div class="'+this.bgClass+'">'//bgdiv
str+='<img id="'+id+'_img" src="'+this.l[m.lev].regImage+'" />'
str+='</div>' //bgdiv
}
if(target) tg =' target="'+target+'" '
str+='<div class="'+this.txtClass+'"><a href="'+lnk+'" '+tg+' onclick="'+this.name+'.switchMenu('+this.curr+'); if(document.getElementById) this.blur(); '
if(lnk=="#") str+='return false'
str+='" class="'+this.l[m.lev].classNameA+'"> '+text+'</a><br /></div>\n'
str+="</div>\n\n" //main div end
document.write(str)
}
this.curr++
}

/************************************************** ******************************
Level object
************************************************** ******************************/
function slideMenu_makeLevel(){
var c=this, a=arguments;
c.left=a[0]||0; c.width=a[1]||null; c.height=a[2]||null;
c.between=a[3]||null; c.className=a[4]||null; c.classNameA=a[5]||null;
c.regImage=a[6]||null; c.roundImg=a[7]||null; c.roundImg2=a[8]||null;
c.subImg=a[9]||null; c.subRound=a[10]||null; return c
}
/************************************************** ******************************
Preloading images
************************************************** ******************************/
function preLoadBackgrounds(){
for(i=0;i<arguments.length;i++){
this[i]=new Image()
this[i].src=arguments[i]
}
return this
}