//shared functions to build the menu on student, young and main websites. 
r="'>";
c="</a>";

m=new Array();
n=new Array();
s=new Array();
Sub_Menu_Width=new Array();
su=new Array();
st=new Array();
Top_Width=new Array();
ADJ=new Array();


function DETECT()  
{
this.ver=navigator.appVersion;
this.agent=navigator.userAgent;
this.dom=document.getElementById?1:0;
this.opera5=this.agent.indexOf("Opera 5")>-1;


this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0;
this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
this.ie7=(this.ver.indexOf("MSIE 7")>-1 && this.dom && !this.opera5)?1:0;
this.ie8=(this.ver.indexOf("MSIE 8")>-1 && this.dom && !this.opera5)?1:0;
this.ie9=(this.ver.indexOf("MSIE 9")>-1 && this.dom && !this.opera5)?1:0;
this.ie =(this.ver.indexOf("MSIE " )>-1 && this.dom && !this.opera5)?1:0;

this.op =this.agent.indexOf("Opera ")>-1;


this.ie4=(document.all && !this.dom && !this.opera5)?1:0;

//this.ie=this.ie4||this.ie5||this.ie6||this.ie7||this.ie8;

this.mac=this.agent.indexOf("Mac")>-1;
this.ns6=(this.dom && parseInt(this.ver)>=5)?1:0;
this.ns4=(document.layers && !this.dom)?1:0;
this.BWD=(this.ie7||this.ie6||this.ie5||this.ie4||this.ns4||this.ns6||this.opera5);

return this;
}




//pte pasarle parametros a submenu o que los coja de params
/*

browser_version= parseInt(navigator.appVersion);
browser_type   = navigator.appName;
if (browser_type == "Netscape") 
{
l="<a class='menu_SUB' style='height:"+SMH+"; color:#"+SMC+"; background-color:#"+SMBC+"; font-size:"+SMFS+"pt; font-weight:"+SMFW+"; font-family: "+SMFF+";"+spn+"' href='";
}
else 
{
l="<a class='menu_SUB' style='height:"+SMH+"; color:#"+SMC+"; background-color:#"+SMBC+"; font-size:"+SMFS+"pt; font-weight:"+SMFW+"; font-family: "+SMFF+";"+spn+"' onmouseover=\"this.style.backgroundColor='#"+SMHBC+"';this.style.color='"+SMHC+"'\"  onmouseout=\"this.style.backgroundColor='#"+SMBC+"';this.style.color='"+SMC+"'\" href='";
}

*/

function mount_parameters()
{
BWD=new DETECT();z=0;b=0;
spn="";
if(BWD.opera5||BWD.ns6)
{
	b=2;
}

if(BWD.ie)
{
	spn=" width: 100%;"; 	//2010sep+
//spn=" width: 1000";		//2010sep-
	
}
else
{
	z=6;
}
}

function mount_parameter_l()
{
var other_class="";


if (params.student)	{	other_class="menu-sub-student-nl";	}


l="<a class='menu_SUB "+other_class+"'";

//if (navigator.appName == "Netscape") 
//{
// l+=" style='height:"+SMH+"; color:#"+SMC+"; background-color:#"+SMBC+"; font-size:"+SMFS+"pt; font-weight:"+SMFW+"; font-family: "+SMFF+";"+spn+"' href='";
// alert("sin efecto");
//}
//else 
//{
 l+=" style='height:"+SMH+"; color:#"+SMC+"; background-color:#"+SMBC+"; font-size:"+SMFS+"pt; font-weight:"+SMFW+"; font-family: "+SMFF+";"+spn+"' onmouseover=\"this.style.backgroundColor='#"+SMHBC+"';this.style.color='"+SMHC+"'\"  onmouseout=\"this.style.backgroundColor='#"+SMBC+"';this.style.color='"+SMC+"'\" href='";
//}



} 



/*
















*/
//pte pasarle parametros a submenu o que los coja de params

/*
function SubMenu()
{
var i,html="";

//html+="<div width='1000' style='height:"+params.height_menu+";"+csspos+"width:1000;background-image: url("+TMBI+"); background-color:#"+TMBC+";z-level:-2'></div>";

// Container for the menu
html+="<div style='position:relative; width:1000px; border:0px solid blue; margin:0; padding:0; height:"+params.height_menu+"px;";
html+=" background-image: url("+TMBI+"); ";  //background-color:#"+TMBC+";"
html+=" ' >";

document.write(html);
}

*/




function create_menu()
{
var i,html="",csspos,csspos2;


//MO		= params.height_menu-2;				// Y MENU OVERLAP CHANGE NUMBER VALUE

//Using absolute absolute positioning 
//csspos		=	"position: absolute; top:" + params.fromtop_menu      +";";
//csspos2 	= "position: absolute; top:" + (params.fromtop_menu+params.height_menu-2) +";";

//Using relative absolute positioning 
csspos		=	"position: absolute; top:" + 0                          +";";
csspos2 	= "position: absolute; top:" + (params.height_menu - 2)   +";";

if (params.width_menu==undefined) { params.width_menu="1000"; } //main site: 1055 , young and student:1000

//se hace en submenu html+="<div width='1000' style='height:"+params.height_menu+";"+csspos+"width:1000;background-image: url("+TMBI+"); background-color:#"+TMBC+";z-level:-2'></div>";

// Container for the menu
html+="<div style='position:relative; width:"+params.width_menu+"px; border:0px solid blue; margin:0; padding:0; height:"+params.height_menu+"px;";
html+=" background-image: url("+TMBI+"); ";  //background-color:#"+TMBC+";"
html+=" ' >";


for (i=0; i < m.length; i++)		// START WRITING TOP LEVEL MENUS
{
	html+="<div style='"+csspos +   params.align+":"+ADJ[i]+"; width:"+Top_Width[i]+"' onmouseover='o["+i+"].ShowMenu()' onmouseout='o["+i+"].HideMenu()'>";

	html+="<a class='menu_TOP' style='height:"+params.height_menu+"; color:#"+TMC+"; background-image: url("+TMBI+"); background-color:#"+TMBC+"; font-size:"+TMFS+"pt; font-weight:"+TMFW+"; font-family: "+TMFF+"; "+spn+"' ";
	
	if (navigator.appName != "Netscape")	
	{	
	 	html+=" onmouseover=\"this.style.backgroundColor='#"+params.height_menuBC+"';this.style.color='"+params.height_menuC+"';this.style.backgroundImage='URL("+params.height_menuBI+")'\"  onmouseout=\"this.style.backgroundColor='#"+TMBC+"';this.style.color='"+TMC+"';this.style.backgroundImage='URL("+TMBI+")'\" "; 
	}
	html+=" href='" + n[i] + "'>" + m[i] + "</a></div>";

/*
if (navigator.appName == "Netscape"){html+="<a class='menu_TOP' style='height:"+params.height_menu+"; color:#"+TMC+"; background-image: url("+TMBI+"); background-color:#"+TMBC+"; font-size:"+TMFS+"pt; font-weight:"+TMFW+"; font-family: "+TMFF+"; "+spn+"' href='"+n[i]+"'>"+m[i]+"</a></div>";
}else {document.write("<a class='menu_TOP' style='height:"+params.height_menu+"; color:#"+TMC+"; background-image: url("+TMBI+"); background-color:#"+TMBC+"; font-size:"+TMFS+"pt; font-weight:"+TMFW+"; font-family: "+TMFF+"; "+spn+"' onmouseover=\"this.style.backgroundColor='#"+params.height_menuBC+"';this.style.color='"+params.height_menuC+"';this.style.backgroundImage='URL("+params.height_menuBI+")'\"  onmouseout=\"this.style.backgroundColor='#"+TMBC+"';this.style.color='"+TMC+"';this.style.backgroundImage='URL("+TMBI+")'\" href='"+n[i]+"'>"+m[i]+"</a></div>")
}
*/

}

for (i=0; i < m.length; i++)	// START WRITING SUB MENUS
{
	html+="<div id='SUB"+i+"' class='menu_DIV' style='"+csspos2  +params.align+":"+(ADJ[i]+SUBshift)+";width:"+Sub_Menu_Width[i]+";background-color:#"+SMBC+";' onmouseover='o["+i+"].ShowMenu()' onmouseout='o["+i+"].HideMenu()'>"+s[i]+"</div>";
	//document.write("<div id='SUB"+i+"' class='menu_DIV' style='"+csspos2  +params.align+":"+(ADJ[i]+SUBshift)+";width:"+Sub_Menu_Width[i]+";background-color:#"+SMBC+";' onmouseover='o["+i+"].ShowMenu()' onmouseout='o["+i+"].HideMenu()'>"+s[i]+"</div>")

}


html+="<div style='border:0px solid red; margin:0; padding:0; clear:both;'></div></div>";	//2010sep+
//#div-1c { clear:both; }

document.write(html);

libinit();
}


function lib_obj(obj,nest){nest=(!nest) ? "":'document.'+nest+'.';this.evnt=BWD.dom? document.getElementById(obj):BWD.ie4?document.all[obj]:BWD.ns4?eval(nest+"document.layers." +obj):0;this.css=BWD.dom||BWD.ie4?this.evnt.style:this.evnt;this.ref=BWD.dom||BWD.ie4?document:this.css.document;this.x=parseInt(this.css.top)||this.css.pixeltop||this.evnt.offsettop||0;this.y=parseInt(this.css.left)||this.css.pixelleft||this.evnt.offsetleft||0;return this}
function lib_doc_size(){this.x=0;this.x2=BWD.ie && document.body.offsetWidth-20||innerWidth||0;this.y=0;this.y2=BWD.ie && document.body.offsetHeight-5||innerHeight||0;this.x50=this.x2/2;this.y50=this.y2/2;return this;}
lib_obj.prototype.ShowMenu = function(){this.css.visibility="visible"}
lib_obj.prototype.HideMenu = function(){this.css.visibility="hidden"}

function libinit()
{
	page=new lib_doc_size();
	o=new Array();
	for (i=0; i < m.length; i++)  // MENU = m.length
	{
		o[i]=new lib_obj('SUB'+i);
		o[i].HideMenu();
	}
}


mount_parameters();

//2003 Allwebco Design
//2010 Massive reorganization of code (Ross softwareds[at]yahoo[dot]com) 

