///// this is for Admin module

// JavaScript Document


/*PopupMenu.prototype.checkItem = function(text, url, type) {
if (url != location.pathname) this.addItem(text, url, type,Enable);
 else this.addItem(text, url, type, blue);
} 

*/



//var button = new ItemStyle(75, 15, '', 15, 0, '10#336699', '10#E2E68A', 'highText', 'lowText',
// '', '', null, null, 'hand', 'default');

//var subM2 = new ItemStyle(75, 2, '', 15, 0, '#E2E68A', '#336699', 'lowText', 'highText',
// 'itemBorder', 'itemBorder', null, null, 'hand', 'default');

var url_path = 'http://www.vision.edu.my/';

// var hBar7 = new ItemStyle(70, 20, '', 15, 0, 'img/adm/tab_off2.gif', 'img/adm/tab_on2.gif', 'lowText', 'highText',
 //'', '', null, null, 'hand', 'default');  

var hBar = new ItemStyle(80, 20, '', 15, 0,  '', '#542410', 'lowText', 'high2Text',
 '', '', null, null, 'hand', 'default');
 
var hBar2 = new ItemStyle(120, 20, '', 15, 0,  '', '#542410', 'lowText', 'high2Text',
 '', '', null, null, 'hand', 'default');

var hBar3 = new ItemStyle(100, 20, '', 15, 0,  '', '#542410', 'lowText', 'high2Text',
 '', '', null, null, 'hand', 'default');  

var hBar31 = new ItemStyle(75, 20, '', 15, 0,  '', '#542410', 'lowText', 'high2Text',
 '', '', null, null, 'hand', 'default');  
 
var hBar4 = new ItemStyle(60, 20, '', 15, 0,  '', '#542410', 'lowText', 'high2Text',
 '', '', null, null, 'hand', 'default');  
 
var hBar5 = new ItemStyle(40, 20, '', 15, 0,  '', '#542410', 'lowText', 'high2Text',
 '', '', null, null, 'hand', 'default');  
 
var hBar6 = new ItemStyle(130, 20, '', 15, 0,  '', '#542410', 'lowText', 'high2Text',
 '', '', null, null, 'hand', 'default');  
 
 var hBar7 = new ItemStyle(70, 20, '', 15, 0,  '', '#542410', 'lowText', 'high2Text',
 '', '', null, null, 'hand', 'default');  

var subM = new ItemStyle(105, -1, '<img src="' + url_path + 'img/ico_arrow.gif">', -15, 3, '#E4E0D4', '#542410', 'low2Text', 'high2Text', 'itemBorder', 'itemBorder', null, null, 'hand', 'default');
var subM2 = new ItemStyle(105, -1, '<img src="' + url_path + 'img/ico_arrow.gif">', -15, 3, '#E4E0D4', '#542410', 'low2Text', 'high2Text',  'itemBorder', 'itemBorder', null, null, 'hand', 'hand'); 
 var subM3 = new ItemStyle(105, -1, '<img src="' + url_path + 'img/ico_arrow.gif">', -15, 3, '#E4E0D4', '#542410', 'low2Text', 'high2Text', 'itemBorder', 'itemBorder', null, null, 'hand', 'hand'); 
  //for main menu 3 setting
  var subM4 = new ItemStyle(85, -1, '<img src="' + url_path + 'img/ico_arrow.gif">', -15, 3, '#E4E0D4', '#542410', 'low2Text', 'high2Text', 'itemBorder', 'itemBorder', null, null, 'hand', 'hand'); 
  //for main menu 4 setting
  var subM5 = new ItemStyle(150, -1, '<img src="' + url_path + 'img/ico_arrow.gif">', -15, 3, '#E4E0D4', '#542410', 'low2Text', 'high2Text', 'itemBorder', 'itemBorder', null, null, 'hand', 'hand'); 

var subBlank = new ItemStyle(22, 0, '&gt;', -15, 3, '#E2E68A', '#336699', 'lowText', 'highText',
 'itemBorderBlank', 'itemBorder', null, null, 'hand', 'default');

var button = new ItemStyle(22, 0, '&gt;', -15, 3, '#336699', '#E2E68A', 'buttonText', 'buttonHover',
 'buttonBorder', 'buttonBorderOver', 80, 95, 'crosshair', 'default');

var menu1 = 20;

var pMenu = new PopupMenu('pMenu');
with (pMenu)
{

// startmenu root =?? = ?? 0 = x coord of  menu, 35 = y coord of menu
startMenu('root', false, 189, 127, 15, hBar, '', false);
addItem('<div align="center">About Us</div>', 'aAU','sm:',hBar4);
addItem('<div align="center">Our College</div>', 'aIOC', 'sm:',hBar);
addItem('<div align="center">Financial Assistance</div>', 'aSFA', 'sm:',hBar2);
addItem('<div align="center">Our Programmes</div>', 'aOP', 'sm:',hBar3);
addItem('<div align="center">Student Affair</div>', 'aSA', 'sm:',hBar3);
addItem('<div align="center">News</div>', 'aH', 'sm:',hBar5);
//addItem('<div align="center">Forms</div>', 'aF', 'sm:',hBar5);
//addItem('<div align="center">FAQs</div>', url_path + 'faqs.htm', '',hBar5);
//addItem('<div align="center">Others</div>', 'aO', 'sm:',hBar5);
addItem('<div align="center">Links</div>', url_path + 'link.htm', '',hBar5);
addItem('<div align="center">Brain Teaser</div>', url_path + 'intro_quiz.htm', '',hBar31);
//addItem('<div align="center">Contact Us</div>', url_path + 'contact.htm', '',hBar7);

/*backup 
// startmenu root =?? = ?? 0 = x coord of  menu, 35 = y coord of menu
startMenu('root', false, 185, 93, 18, hBar, '', false);
addItem('<div align="center">Vision College&nbsp;&nbsp;|</div>', 'aVC', 'sm:',hBar);
addItem('<div align="center">Vision Medical Centre&nbsp;&nbsp;|</div>', 'aVMC', 'sm:',hBar2);
addItem('<div align="center">News & Events&nbsp;&nbsp;|</div>', 'aNE', 'sm:',hBar3);
addItem('<div align="center">Highlights&nbsp;&nbsp;|</div>', 'aH', 'sm:',hBar4);
addItem('<div align="center">Prospective Students&nbsp;&nbsp;|</div>', 'pros.htm', '',hBar5);
addItem('<div align="center">Medical Services&nbsp;&nbsp;|</div>', 'pros.htm', '',hBar6);
addItem('<div align="center">Contact Us    </div>', 'contact.htm', '',hBar7);
*/


/////////////////about us
startMenu('aAU', false, 0, menu1, 30, subM, '', false);
addItem('Director&acute;s Message', url_path + 'vc/msg_frm_ceo.htm', '');
addItem('Who Are We?', url_path + 'vc/about_vc.htm', '');
addItem('Our Vision & Mission', url_path + 'vmc/vision_n_mission_vmc.htm', '');
addItem('Why We Are Different', url_path + 'vc/y_different.htm', '');
addItem('Contact Us', url_path + 'contact.htm', '');

/////////////////In Our College
startMenu('aIOC', false, 0, menu1, 30, subM, '', false);
addItem('Our Facilities', url_path + 'vc/facilities.htm', '');
addItem('Our Lecturers', url_path + 'vc/our_lecturers.htm', '');
addItem('Our Diagnostic Centre', 'aIOC_DC', 'sm:',subM2);
//addItem('Scholarships & F.A.', url_path + 'vc/scholarships_fa.htm', '');
//addItem('Our Programmes', 'aVC_OP', 'sm:',subM2).onClick=url_path +'programmes.htm';
//addItem('Student Affairs', 'aVC_SA', 'sm:',subM2);

///////// Our Diagnostic Centre
startMenu('aIOC_DC', false, 0, 30, 50, subM, '', false);
addItem('About the Diagnostic Centre', url_path + 'vc/dc/about.htm', '');
addItem('Patient Guide', url_path + 'vc/dc/patient_guide.htm', '');

/////////////////Scholarships and Financial Assistance
startMenu('aSFA', false, 0, menu1, 42, subM, '', false);
addItem('Scholarships', url_path + 'vc/scholarships.htm', '');
addItem('Financial Assistance', url_path + 'vc/financial.htm', '');
//addItem('Scholarships & F.A.', url_path + 'vc/scholarships_fa.htm', '');

///////// Our Programme
startMenu('aOP', false, 0, menu1, 50, subM5, '', false);
addItem('Diploma of Medical Ultrasonography (Asia)', 'aOP_DMU', 'sm:',subM5);
addItem('Diploma Health Science', 'aOP_DHS', 'sm:',subM);
addItem('Diploma Health Science (Health Administration)', 'aOP_DHA', 'sm:',subM);
addItem('Diploma of Medical Imaging', 'aOP_DMI', 'sm:',subM);
addItem('Foundation In Science', url_path + 'vc/fis/fis.htm', '');
addItem('Diploma In Nursing', url_path + 'vc/nursing/nursing.htm', '');

///////// DMU
startMenu('aOP_DMU', false, -207, 50, 30, subM, '', false);
addItem('About DMU', url_path + 'vc/dmu/dmu.htm', '');
addItem('About ASUM', url_path + 'vc/about_ASUM.htm', '');
addItem('Admission details', url_path + 'vc/dmu/dmu_admission.htm', '');
addItem('Future of our graduates', url_path + 'vc/dmu/dmu_fog.htm', '');
addItem('Programme Description', url_path + 'vc/dmu/dmu_course.htm', '');
addItem('FAQ', url_path + 'dmu_faqs.htm', '');

///////// DHS
startMenu('aOP_DHS', false, -411, 50, 30, subM, '', false);
addItem('About DHS', url_path + 'vc/dhs/dhs.htm', '');
addItem('Admission details', url_path + 'vc/dhs/dhs_admission.htm', '');
addItem('Future of our graduates', url_path + 'vc/dhs/dhs_fog.htm', '');
addItem('Programme Description', url_path + 'vc/dhs/dhs_course.htm', '');
addItem('Brochure', url_path + 'pdf/DHSBrochure.pdf', '');
addItem('FAQ', url_path + 'vc/dhs/dhs_faqs.htm', '');

///////// DHA
startMenu('aOP_DHA', false, -515, 50, 30, subM, '', false);
addItem('About DHA', url_path + 'vc/dhs_ha/dhs_ha.htm', '');
addItem('Admission details', url_path + 'vc/dhs_ha/dhs_ha_admission.htm', '');
addItem('Future of our graduates', url_path + 'vc/dhs_ha/dhs_ha_fog.htm', '');
addItem('Programme Description', url_path + 'vc/dhs_ha/dhs_ha_course.htm', '');
addItem('Brochure', url_path + 'pdf/DHABrochure.pdf', '');
addItem('FAQ', url_path + 'vc/dhs/dhs_faqs.htm', '');

///////// DMI
startMenu('aOP_DMI', false, -411, 50, 30, subM, '', false);
addItem('About DMI', url_path + 'vc/dmi/dmi.htm', '');
addItem('Admission details', url_path + 'vc/dmi/dmi_admission.htm', '');
addItem('Future of our graduates', url_path + 'vc/dmi/dmi_fog.htm', '');
addItem('Programme Description', url_path + 'vc/dmi/dmi_course.htm', '');
addItem('FAQ', url_path + 'vc/dmi/dmi_faqs.htm', '');

///////// FIS
//startMenu('aOP_FIS', false, -411, 50, 30, subM, '', false);
//addItem('About FIS', url_path + 'vc/fis/fis.htm', '');

///////// Student Affairs
startMenu('aSA', false, -350, menu1, 30, subM5, '', false);
addItem('Studying at Vision', url_path + 'vc/student_affairs.htm', '');
addItem('Vision Society', 'aSA_VS', 'sm:',subM);
addItem('Vision Alumni', 'aSA_VA', 'sm:',subM);
addItem('Vision Newsletter', url_path + 'vc/newsletter.htm', '');
addItem('Career Placement Programme (CPP)', url_path + 'vc/cpp.htm', '');

///////// Vision Society
startMenu('aSA_VS', false, 0, 30, 30, subM, '', false);
addItem('Activities', url_path + 'vc/activities.htm', '');
addItem('Around Vision College', url_path + 'vc/around_college.htm', '');

///////// Vision Alumni
startMenu('aSA_VA', false, 0, 30, 30, subM, '', false);
addItem('Graduates &acute; Testimonials', url_path + 'vc/dmu/dmu_grad_testimonials.htm', '');
addItem('Our Graduates', url_path + 'vc/vision_alumni.htm', '');


///////Vision Medical Centre
startMenu('aVMC', false, -100, 20, 30, subM4, '', false);
addItem('About VMC', url_path + 'vmc/about_vmc.htm', '');
addItem('Vision & Mission', url_path + 'vmc/vision_n_mission_vmc.htm', '');
addItem('About ASUM', url_path + 'vmc/mab_vmc.htm', '');
addItem('Vision Medical Services', url_path + 'vmc/services_vmc.htm', '');
addItem('Facilities', url_path + 'vmc/fac_vmc.htm', '');
addItem('Patient Guides', url_path + 'vmc/patients_vmc.htm', '');
addItem('Health Forum', url_path + 'vmc/forum_vmc.htm', '');
addItem('Make an Appointment', url_path + 'vmc/appointment_vmc.htm', '');
addItem('FAQs', url_path + 'vmc/faqs.htm', '');

/// News & events
startMenu('aNE', false, 10, menu1, 30, subM, '', false);
addItem('Current Media Topics', url_path + 'vc/about_vc.htm', '');
addItem('Vision in News', url_path + 'vc/about_vc.htm', '');
addItem('Gallery', url_path + 'vc/about_vc.htm', '');

/// highlights
startMenu('aH', false, -210, menu1, 30, subM, '', false);
addItem('Events Calendar', url_path + 'events/upcoming.htm', '');
addItem('College Events', url_path + 'events/past.htm', '');
addItem('Vision in the News', url_path + 'events/news.htm', '');
addItem('Gallery', 'aH_G', 'sm:', subM);


///////// Gallery
startMenu('aH_G', false, -102, 30, 30, subM, '', false);
addItem('Events', url_path + 'events/gallery.htm', '');
addItem('Ultrasound Cases', url_path + 'vc/dmu/dmu_ultrasound_cases.htm', '');

/// Forms
//startMenu('aF', false, -100, menu1, 30, subM, '', false);
//addItem('Enquiry', url_path + 'php/enquiry.htm', '');
//addItem('Application', url_path + 'php/registration.html', '');

/// Others
//startMenu('aO', false, -100, 30, 30, subM, '', false);
//addItem('Links', url_path + 'link.htm', '');
//addItem('Test Your Knowledge', url_path + 'quiz.htm', '');


}



addMenuBorder(pMenu, window.subBlank,
 null, '#666666', 1, '#CCCCDD', 2);


addDropShadow(pMenu, window.subM,
 [40,"#7E4933",6,6,-4,-4], [40,"#CBB6AD",4,4,0,0]);
addDropShadow(pMenu, window.subBlank,
 [40,"#333333",6,6,-4,-4], [40,"#666666",4,4,0,0]);


if (navigator.userAgent.indexOf('rv:0.')==-1 && !(isOp&&!document.documentElement))
{
 pMenu.showMenu = new Function('mN','menuAnim(this, mN, 10)');
 pMenu.hideMenu = new Function('mN','menuAnim(this, mN, -10)');
}

page.elmPos=function(e,p)
{
 var x=0,y=0,w=p?p:this.win;
 e=e?(e.substr?(isNS4?w.document.anchors[e]:getRef(e,w)):e):p;
 if(isNS4){if(e&&(e!=p)){x=e.x;y=e.y};if(p){x+=p.pageX;y+=p.pageY}}
 else if (e && e.focus && e.href && this.MS && /Mac/.test(navigator.platform))
 {
  e.onfocus = new Function('with(event){self.tmpX=clientX-offsetX;' +
   'self.tmpY=clientY-offsetY}');
  e.focus();x=tmpX;y=tmpY;e.blur()
 }
 else while(e){x+=e.offsetLeft;y+=e.offsetTop;e=e.offsetParent}
 return{x:x,y:y};
};

function menuAnim(menuObj, menuName, dir)
{
 var mD = menuObj.menu[menuName][0];
 if (!mD.timer) mD.timer = 0;
 if (!mD.counter) mD.counter = 0;
 with (mD)
 {
  clearTimeout(timer);
  if (!lyr || !lyr.ref) return;
  if (!visNow && dir>0) dir = 0-dir;
  if (dir>0) lyr.vis('visible');
  lyr.sty.zIndex = dir>0 ? mD.zIndex + 1 : 1001;

  lyr.clip(0, 0, menuW+2, (menuH+2)*Math.pow(Math.sin(Math.PI*counter/200),0.75) );
  
  //lyr.clip(0, (menuH+2)-(menuH+2)*Math.pow(Math.sin(Math.PI*counter/200),0.75), menuW+2, menuH+2);
  
  //if (!counter) mD.origY = lyr.y();
  //var newY = (menuH+2)-(menuH+2)*Math.pow(Math.sin(Math.PI*counter/200),0.75);
  //lyr.clip(0, newY, menuW+2, menuH+2);
  //lyr.y(mD.origY - newY);

  counter += dir;
  if (counter>100) { counter = 100; lyr.sty.zIndex = mD.zIndex }
  else if (counter<0) { counter = 0; lyr.vis('hidden') }
  else timer = setTimeout('menuAnim('+menuObj.myName+',"'+menuName+'",'+dir+')', 40);
 }
};

function addMenuBorder(mObj, iS, alpha, bordCol, bordW, backCol, backW)
{
 for (var mN in mObj.menu)
 {
  var mR=mObj.menu[mN], dS='<div style="position:absolute; background:';
  if (mR[0].itemSty != iS) continue;
  for (var mI=1; mI<mR.length; mI++)
  {
   mR[mI].iX += bordW+backW;
   mR[mI].iY += bordW+backW;
  }
  mW = mR[0].menuW += 2*(bordW+backW);
  mH = mR[0].menuH += 2*(bordW+backW);

  if (isNS4) mR[0].extraHTML += '<layer bgcolor="'+bordCol+'" left="0" top="0" width="'+mW+
   '" height="'+mH+'" z-index="980"><layer bgcolor="'+backCol+'" left="'+bordW+'" top="'+
   bordW+'" width="'+(mW-2*bordW)+'" height="'+(mH-2*bordW)+'" z-index="990"></layer></layer>';
  else mR[0].extraHTML += dS+bordCol+'; left:0px; top:0px; width:'+mW+'px; height:'+mH+
   'px; z-index:980; '+(alpha!=null?'filter:alpha(opacity='+alpha+'); -moz-opacity:'+(alpha/100):'')+
   '">'+dS+backCol+'; left:'+bordW+'px; top:'+bordW+'px; width:'+(mW-2*bordW)+'px; height:'+
   (mH-2*bordW)+'px; z-index:990"></div></div>';
 }
};

function addDropShadow(mObj, iS)
{
 for (var mN in mObj.menu)
 {
  var a=arguments, mD=mObj.menu[mN][0], addW=addH=0;
  if (mD.itemSty != iS) continue;
  for (var shad=2; shad<a.length; shad++)
  {
   var s = a[shad];
   var alpha = (s[0]!=null && navigator.userAgent.indexOf('AppleWebKit') == -1);
   if (isNS4) mD.extraHTML += '<layer bgcolor="'+s[1]+'" left="'+s[2]+'" top="'+s[3]+'" width="'+
    (mD.menuW+s[4])+'" height="'+(mD.menuH+s[5])+'" z-index="'+(arguments.length-shad)+'"></layer>';
   else mD.extraHTML += '<div style="position:absolute; background:'+s[1]+'; left:'+s[2]+
    'px; top:'+s[3]+'px; width:'+(mD.menuW+s[4])+'px; height:'+(mD.menuH+s[5])+'px; -z-index:'+
    (a.length-shad)+'; '+
    (alpha?'filter:alpha(opacity='+s[0]+'); -moz-opacity:'+s[0]+'%; opacity:'+(s[0]/100):'')+
    '"></div>';
   addW=Math.max(addW, s[2]+s[4]);
   addH=Math.max(addH, s[3]+s[5]);
  }
  mD.menuW+=addW; mD.menuH+=addH;
 }
};

PopupMenu.prototype.elementHide = function(mN, show)
{
 var hideTags = [];
 // <select> is hidden in all IE versions, and Opera < 7.0.
 if ((isIE && !isOp) || (isOp && !document.documentElement))
  hideTags[hideTags.length] = 'SELECT';
 // <iframe> is hidden in IE < 5.5, all Opera versions, and Mozilla < 1.0.
 if ((isIE && !isOp && !window.createPopup) || isOp ||
  navigator.userAgent.match('rv:0.')) hideTags[hideTags.length] = 'IFRAME';
 // <object> and <applet> are hidden in all browsers.
 //hideTags[hideTags.length] = 'OBJECT';
 hideTags[hideTags.length] = 'APPLET';

 with (this.menu[mN][0])
 {
  if (!lyr || !lyr.ref) return;

  var oldFn = show ? 'ehShow' : 'ehHide';
  if (this[oldFn]) this[oldFn](mN);
  else this.menu[mN][0].lyr.vis(show ? 'visible' : 'hidden');
  if (!isDOM && !isIE) return;
  if (hideTags.length == -1) return;

  var w = par?eval(par):self;
  if (!w.hideElms) w.hideElms = [];
  var hE = w.hideElms;

  if (show)
  {
   var elms = [];
   for (var t = 0; t < hideTags.length; t++)
   {
    var tags = isDOM ? w.document.getElementsByTagName(hideTags[t]) :
     isIE ? w.document.all.tags(hideTags[t]) : null;
    for (var i = 0; i < tags.length; i++) elms[elms.length] = tags[i];
   }
   for (var eN = 0; eN < elms.length; eN++)
   {
    var eRef = elms[eN];
    with (w.page.elmPos(eRef)) var eX = x, eY = y;
    if (!(lyr.x()+menuW<eX || lyr.x()>eX+eRef.offsetWidth) &&
        !(lyr.y()+menuH<eY || lyr.y()>eY+eRef.offsetHeight))
    {
     if (!hE[eN]) hE[eN] = { ref: eRef, menus: [] };
     hE[eN].menus[mN] = true;
     eRef.style.visibility = 'hidden';
    }
   }
  }
  else for (var eN in hE)
  {
   var reShow = 1, eD = hE[eN];
   eD.menus[mN] = false;
   for (var eM in eD.menus) reShow &= !eD.menus[eM];
   if (reShow && eD.ref)
   {
    eD.ref.style.visibility = 'visible';
    delete hE[eN];
   }
  }
 }
 return;
}
for (var p in PopupMenu.list)
{
 var pm = PopupMenu.list[p];
 pm.ehShow = pm.showMenu;
 pm.showMenu = new Function('mN','this.elementHide(mN, true)');
 pm.ehHide = pm.hideMenu;
 pm.hideMenu = new Function('mN','this.elementHide(mN, false)');
}


// JavaScript Document