///////////////////////////////////////////////////////////////////
// initialize the menu
///////////////////////////////////////////////////////////////////
function init() {


//about
var about = menuMgr.createMenu("about");
about.showIcon=false;
about.absWidth=150;
about.applyBorder(false, false, true, false);
about.dropShadow("none", "none");

about.addItem("1", "About Us", "/woodbridge/about.php?p=show&id=245");
about.addItem("2", "Mission, Vision & Core Values", "/woodbridge/about.php?p=show&id=248");
about.addItem("3", "Faculty & Staff Directory", "/woodbridge/about.php?p=staff");
about.addItem("4", "Welcome to Our Campus", "/woodbridge/about.php?p=show&id=250");

//admissions
var admissions = menuMgr.createMenu("admissions");
admissions.showIcon=false;
admissions.absWidth=150;
admissions.applyBorder(false, false, true, false);
admissions.dropShadow("none", "none");

admissions.addItem("1", "Introduction", "/woodbridge/admissions.php?p=show&id=247");
admissions.addItem("2", "Requirements", "/woodbridge/admissions.php?p=show&id=238");
admissions.addItem("3", "Costs", "/woodbridge/admissions.php?p=show&id=239");
admissions.addItem("4", "Financial Aid", "/woodbridge/admissions.php?p=show&id=240");
admissions.addItem("5", "Transfer Students", "/woodbridge/admissions.php?p=show&id=241");
admissions.addItem("6", "International Students", "/woodbridge/admissions.php?p=show&id=242");
admissions.addItem("7", "Forms", "/woodbridge/admissions.php?p=show&id=345");


//academics
var academics = menuMgr.createMenu("academics");
academics.showIcon=false;
academics.absWidth=150;
academics.applyBorder(false, false, true, false);
academics.dropShadow("none", "none");
academics.addItem("1", "Programs", "/woodbridge/academics.php?p=show&id=243");
academics.addItem("2", "Schedule/Registration", "/woodbridge/academics.php?p=show&id=314");
academics.addItem("3", "Syllabi", "/woodbridge/academics.php?p=show&id=311");
academics.addItem("4", "Catalog", "/woodbridge/academics.php?p=show&id=244");
academics.addItem("5", "Handbook", "/woodbridge/academics.php?p=show&id=315");
academics.addItem("6", "Forms", "/woodbridge/academics.php?p=show&id=346");

var menubar = menuMgr.createMenubar("menubar");
menubar.orient="H";
menubar.flowOverFormElement=true;

menubar.showIcon=false;
menubar.dropOnClick = false;
menubar.dropShadow("none", "none");
menubar.showSubIcon=false;
//menubar.absWidth=110;

//menubar.addItem("1", "&laquo; VFCC.edu&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", "/");
menubar.addItem("2", "About Woodbridge Campus&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", "./about.php?p=show&id=245", "", true, null, "about");
menubar.addItem("3", "Admissions&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", "./admissions.php?p=show&id=247", "", true, null, "admissions");
menubar.addItem("4", "Academics&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", "./academics.php?p=show&id=243", "", true, null, "academics");
menubar.addItem("5", "Calendar&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", "./about.php?p=calendar");
menubar.addItem("6", "Contact Us&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", "/woodbridge/about.php?p=contact");
}
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////

// normal centered popup

function popup(url,name,width,height,resize,scroll) {
var dialogWin = new Object();
dialogWin.width = width;
dialogWin.height = height;
now = new Date();
var millis=now.getTime();
var mstr=""+millis;
if (document.layers) {
dialogWin.left = window.screenX + ((window.outerWidth - dialogWin.width) / 2);
dialogWin.top = window.screenY + ((window.outerHeight - dialogWin.height) / 2);
var attr = 'screenX=' + dialogWin.left + ',screenY=' + dialogWin.top + ',resizable=' + resize + ',width=' + dialogWin.width + ',height=' + dialogWin.height + ',scrollbars=' + scroll + ',menubar=no,location=no,toolbar=no,status=no,directories=no';
} else if (document.all) {
dialogWin.left = (screen.width - dialogWin.width) / 2;
dialogWin.top = (screen.height - dialogWin.height) / 2;
var attr = 'left=' + dialogWin.left + ',top=' + dialogWin.top + ',resizable=' + resize + ',width=' + dialogWin.width + ',height=' + dialogWin.height + ',scrollbars=' + scroll + ',menubar=no,location=no,toolbar=no,status=no,directories=no';
}
//Agrega el codigo anti-caching
tienesp=false;
for (i=0; i<url.length; i++)
	if (url.charAt(i)=='?')
		tienesp=true;
if (tienesp)
	nocach='&nocache='+mstr;
else
	nocach='?nocache='+mstr;

return open(url + nocach ,name,attr);
}

function cOvr(src) {
src.style.cursor = 'hand';
}

function cOut(src) {
src.style.cursor = 'default';
}

function reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.pgW=innerWidth; document.pgH=innerHeight; onresize=reloadPage; }}
  else if (innerWidth!=document.pgW || innerHeight!=document.pgH) location.reload();
}
reloadPage(true);

function jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function jumpMenuGo(selName,targ,restore){ //v3.0
  var selObj = findObj(selName); if (selObj) jumpMenu(targ,selObj,restore);
}

function findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function showHideLayers() { //v6.0
  var i,p,v,obj,args=showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

var persistmenu="yes" //"yes" or "no". Make sure each SPAN content contains an incrementing ID starting at 1 (id="sub1", id="sub2", etc)
var persisttype="sitewide" //enter "sitewide" for menu to persist across site, "local" for this page only

if (document.getElementById){ //DynamicDrive.com change
document.write('<style type="text/css">\n')
document.write('.submenu{display: none;}\n')
document.write('</style>\n')
}

function SwitchMenu(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("masterdiv").getElementsByTagName("span"); //DynamicDrive.com change
		if(el.style.display != "block"){ //DynamicDrive.com change
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="submenu") //DynamicDrive.com change
				ar[i].style.display = "none";
			}
			el.style.display = "block";
		}else{
			el.style.display = "none";
		}
	}
}

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 onloadfunction(){
	if (persistmenu=="yes"){
		var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
		var cookievalue=get_cookie(cookiename)
		if (cookievalue!="")
			document.getElementById(cookievalue).style.display="block"
	}
}

function savemenustate(){
	var inc=1, blockid=""
	while (document.getElementById("sub"+inc)){
		if (document.getElementById("sub"+inc).style.display=="block"){
			blockid="sub"+inc
			break
		}
		inc++
	}
	var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
	var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid
	document.cookie=cookiename+"="+cookievalue
}

function formatText(el,tag) {
	var tagstart = '<' + tag + '>';
	var tagend = '</' + tag + '>';
	if (el.setSelectionRange) {
		el.value = el.value.substring(0,el.selectionStart) + tagstart + el.value.substring(el.selectionStart,el.selectionEnd) + tagend + el.value.substring(el.selectionEnd,el.value.length);
	}
	else {
		var selectedText = document.selection.createRange().text;
		if (selectedText != "") {
			var newText = "<" + tag + ">" + selectedText + "</" + tag + ">";
			document.selection.createRange().text = newText;
		}
	
	}
}

function formatHref(el) {
	var href = prompt("URL", "http://");
	if (el.setSelectionRange) {
		el.value = el.value.substring(0,el.selectionStart) + "<a href='" + href + "'>" + el.value.substring(el.selectionStart,el.selectionEnd)  + "</a>" + el.value.substring(el.selectionEnd,el.value.length);
	}
	else {
		var selectedText = document.selection.createRange().text;
		if (selectedText != "") {
			var newText = "<a href='" + href + "'>" + selectedText + "</a>";
			document.selection.createRange().text = newText;
		}
	
	}
}

function formatMailto(el) {
	var email = prompt("mailto:", "");
	if (el.setSelectionRange) {
		el.value = el.value.substring(0,el.selectionStart) + "<a href='mailto: " + email + "'>" + el.value.substring(el.selectionStart,el.selectionEnd)  + "</a>" + el.value.substring(el.selectionEnd,el.value.length);
	}
	else {
		var selectedText = document.selection.createRange().text;
		if (selectedText != "") {
			var newText = "<a href='mailto: " + email + "'>" + selectedText + "</a>";
			document.selection.createRange().text = newText;
		}
	}
}

function formatAlign(el, tag) {
	var tagstart = '<div align=' + tag + '>';
	var tagend = '</div>';

	if (el.setSelectionRange) {
		el.value = el.value.substring(0,el.selectionStart) + tagstart + el.value.substring(el.selectionStart,el.selectionEnd) + tagend + el.value.substring(el.selectionEnd,el.value.length);
	}
	else {
		var selectedText = document.selection.createRange().text;
		if (selectedText != "") {
			var newText = tagstart + selectedText + tagend;
			document.selection.createRange().text = newText;
		}
	}
}

function notify(elform,num)
{
	alert(num);
	elform.notification[num-1].checked = true;
}

function unlocking(tab){
	tab.form.mod_post.value = "no";
	tab.form.submit();
}

var textarea;
function formatFile(el) {
 	textarea = el;
	popup("categories/files_select.php","fileSelect","400","400","no","yes");
}

function puttag(fileId)
{
	var el = window.opener.textarea;
	if (el.setSelectionRange) {
		el.value = el.value.substring(0,el.selectionStart) + "[FILE=" + fileId + "]" + el.value.substring(el.selectionStart,el.selectionEnd)  + "[/FILE]" + el.value.substring(el.selectionEnd,el.value.length)
	}
	else {
		var selectedText = el.document.selection.createRange().text;
		if (selectedText != "") {
			var newText = "[FILE=" + fileId + "]" + selectedText + "[/FILE]";
			el.document.selection.createRange().text = newText;
		}
	}
	window.close();
}

function sendpage(theURL)
{
laURL= 'http://wormwood.vfcc.edu/tools/sendpage.php?url=' + theURL;
popup(laURL,'sendpage','500','385','no','no');
}

function recommendsite(theURL)
{
laURL= 'http://wormwood.vfcc.edu/tools/recommendsite.php';
popup(laURL,'recommendsite','500','385','no','no');
}


if (window.addEventListener)
window.addEventListener("load", onloadfunction, false)
else if (window.attachEvent)
window.attachEvent("onload", onloadfunction)
else if (document.getElementById)
window.onload=onloadfunction

if (persistmenu=="yes" && document.getElementById)
window.onunload=savemenustate

/* orden.js compiled from X 4.0 with XC 0.28b. Distributed under GNU LGPL. For copyrights, license, documentation and more visit Cross-Browser.com */
var xOp7Up,xOp6Dn,xIE4Up,xIE4,xIE5,xNN4,xUA=navigator.userAgent.toLowerCase();
if(window.opera)
{
	var i=xUA.indexOf('opera');
	if(i!=-1){var v=parseInt(xUA.charAt(i+6));
		xOp7Up=v>=7;xOp6Dn=v<7;
}
}else if(navigator.vendor!='KDE' && document.all && xUA.indexOf('msie')!=-1){
	xIE4Up=parseFloat(navigator.appVersion)>=4;
	xIE4=xUA.indexOf('msie 4')!=-1;
	xIE5=xUA.indexOf('msie 5')!=-1;
}else if(document.layers){
	xNN4=true;
}
xMac=xUA.indexOf('mac')!=-1;

function xGetElementById(e)
{
	if(typeof(e)!='string') return e;
	if(document.getElementById) e=document.getElementById(e);
	else if(document.all) e=document.all[e];
	else e=null;
	return e;
}

function xInnerHtml(e,h)
{
	if(!(e=xGetElementById(e)) || !xStr(e.innerHTML)) return null;
	var s = e.innerHTML;
	if (xStr(h)) {
		e.innerHTML = h;
	}
	return s;
}

function xStr(s)
{
	for(var i=0; i<arguments.length; ++i){
		if(typeof(arguments[i])!='string') return false;
	}
	return true;
}