var ie4=document.all    // Microsoft Internet Explorer
var ns4=document.layers // Netscape Navigator
var ns_gecko=document.getElementById&&!document.all //Netscape Gecko,Mozilla..
var ieop=0;
var op_id=0;
var sobj,ch;
var premeir=null;
var scrolltimer=null;
function getRef(id) {
bounce=ie4?document.all[id]:ns_gecko?document.getElementById(id):document.layers[id];
return bounce;
}
 function getSty(id) {
 styleobj=ns4 ? getRef(id) : getRef(id).style;
 return styleobj;
                     }
 function getOffsetPos(which,el,tagName) {
 var pos = 0
 while (el.tagName!=tagName) {
              pos+=el["offset" + which]
              el = el.offsetParent
  } return pos  }	

 function visualize(obj) { document.writeln(obj);}
function setMenuRequireMents()  {
          this.tblColor="#558755"//"#222234"
          this.bgColor="rgb(120,50,70)"//rgb(155,0,50)"//"#223354"
          this.color="aliceblue"
          this.onColor="ivory"
          this.onBg="rgb(99,137,127)"
          this.ofColor=this.color
          this.ofBg=this.bgColor
          this.fontFamily="Ms Sans Serif"
          this.fontSize="11px"
          this.fontWeight="bold"
          this.width=165
          this.height=50
          this.Cursor=document.all?"hand":"pointer"; 
          this.Padding="10px"
          this.lineHeight="12pt"
          this.Appearance=ie4?"filter:progid.DXImageTransform.Microsoft.alpha(Opacity=80)":"-moz-opacity:0.8"
          this.textAlign="justify"
           
         }
 cb=new setMenuRequireMents();

 function resolve(ns,dom) { return (ns4?ns:dom);}
 function handle() {getSty('nsmenu').visibility=ns4?"hide":"hidden";}
 function Menu() {javascript:void(0)} 
 function getColor() {
 clrs=new Array("Red","Blue","Green","Maroon","Purple","sienna","black","navy","teal")
 retc=Math.round(Math.random()*clrs.length-1); return clrs[retc]; }

 function loca(urls,tgt) { 
 if(urls=="javascript:void(0)") return;
 else { if(tgt=="New") open(urls);
 else ie4?navigate(urls):location.replace(urls);
 hidemenu();
 }
 }

 function Menu() {
                 this.length=Menu.arguments.length
                 for (var i=0;i<this.length;i++)
                       this[i]=Menu.arguments[i]
                 return this;
                 }

 function buildMenu(n) {
                       var i=0;  
                       this.length=n;
                       while(i++<n)   this[i]=" ";
                       return (this);
                       }

 var newMenu=new Object();
 var menuCount=0;
 var samsungMenu
 function insertMenuList(menuname,item,menuAction) {
 if(!newMenu[menuname]) {
              samsungMenu=new Object();
                        samsungMenu.name=menuname;
                        samsungMenu.num=menuCount++;
                        samsungMenu.items=new Array();
                        samsungMenu.actions=new Array();
              newMenu[menuname]=samsungMenu;
                        }      
 if(!ns4) { 
      newMenu[menuname].items[newMenu[menuname].items.length]=item;
      newMenu[menuname].actions[newMenu[menuname].actions.length]=menuAction;              
      } else {
      newMenu[menuname].items.push(item);
      newMenu[menuname].actions.push(menuAction);
             }
  }

 function makeDiv(title) {
 var tagg=(ns4) ? "Layer" : "Div"
 var ind=(ns4 || ns_gecko) ? "<b>&raquo;</b>" : "4";
 var cls=( !ns4 ) ? "mores" : "pos"
 sty=( !ns4 ) ? " style='top:1pt;font-family:webdings;font-size:12px;float:right'" : ""
 indicator="<"+tagg+" class="+cls+sty+" title='Next'>"+ind+"</"+tagg+">"
 return (indicator+"<"+tagg+" class=manc position=relative onmouseover=msap(event,'"+title+"',this); onmouseout=getpos(event); title='"+title+"'>"+title+"</"+tagg+">")
 }
 function genMenu(Caption,urls) {
 var secr=ns4?"A":"Div"
 return("<"+secr+" class=manc href='"+urls+"' onmouseover=handles();  onmouseout='return false' title='"+Caption+"'>"+Caption+"</"+secr+">")
 }

 function hidemenu() {
	 getSty('nsmenu').display=getSty('msap2').display=ns4?"hide":"none"
 }

 function delayhide() {
 setStatus();
 hf=setTimeout('hidemenu()',500);
 ieop=0;
 }

 function clearHide() { if (window.hf) clearTimeout(hf);}

 function incropacity() {
  if(ieop<=100) {
                ieop+=7;
				getSty('msap2')[ie4?"filter":"MozOpacity"]=ie4?"alpha(style=1,startX="+(ieop-45)+")":ieop/100;
                op_id=setTimeout('incropacity()', 1);
                } 
				}
 function setStatus() {
 if(window.scrolltimer) clearTimeout(scrolltimer);
 status=ie4?"Done":"Document: Done"; return true;}

 function scrollMenu(temp) {var spc=" "
 for(k=0;k<30;k++) spc+="  "
 sobj=spc+temp.substring(1)+" Menu "+spc
 scrolltimer=setInterval("scrollnow()",10); return true;}

 function scrollnow() {
 ch=sobj.charAt(0); sobj=sobj.substring(1,sobj.length);
 sobj+=ch; status=sobj; }

 function highlightmenu(e,state){
 if (ie4) source_el=event.srcElement
 else if (ns_gecko) source_el=e.target
 if (source_el.className=="menuitem"){
 source_el.style.backgroundColor=(state=="on")?cb.onBg:cb.ofBg;
 source_el.style.color=(state=="on")?cb.onColor:cb.ofColor }
 else{ while(source_el.tagName!="TABLE"){
       source_el=ns_gecko? source_el.parentNode : source_el.parentElement
        if (source_el.className=="menuitem"){
        source_el.style.backgroundColor=(state=="on")?cb.onBg:cb.ofBg;
        source_el.style.color=(state=="on")?cb.onColor:cb.ofColor;}
                             } //for while
                         } //for else
                      } //for Function
function rollout() {
obj=arguments[0];
if(getRef('msap2').currentStyle.visibility=="visible") {}
}

 function contains_ns6(a,b) {// check slave is contained by master 
 while(b.parentNode) //a is master,b is slave
       if((b=b.parentNode)==a)  return true;
       return false;}

 function dynamichide(evt) {
 if(ns_gecko && evt.currentTarget!=evt.relatedTarget&&!contains_ns6(evt.currentTarget,evt.relatedTarget))
 setTimeout("hidemenu()",500); }

 function getpos(evt) {
 if (ns4||ns_gecko) return;
 if(ie4 && !getRef('msap2').contains(evt.toElement) && !getRef('nsmenu').contains(evt.toElement))
 setTimeout("hidemenu()",500);
}
 var mearray=new Array("Home","Services","Search-Resume","Post-Jobs","Manage-Jobs","Personal-Settings")
 var errmsgs="Sorry!  Page is Under Construction";
 uc_msg=document.all?"vbscript:caution(\""+errmsgs+"\")":"javascript:alert(\""+errmsgs+"\")";
 systems=makeDiv("Systems");
 insertMenuList("Home","Home",path+"pages/index.jsp");
  insertMenuList("Home","Employers Home",path+"pages/employer/emp.jsp");
 insertMenuList("Home","Logout",path+"pages/global/signout.jsp");

 insertMenuList("Services","Database Access","javascript:void(0)")
 insertMenuList("Services","Job Listings","javascript:void(0)")
 insertMenuList("Services","Stingers","javascript:void(0)")
 insertMenuList("Services","Advertise","javascript:void(0)")

 insertMenuList("Search-Resume","Resume Search",path+"pages/employer/empsrchresumes.jsp");
 insertMenuList("Search-Resume","IT Resumes","javascript:void(0)");
 insertMenuList("Search-Resume","Non IT Resumes","javascript:void(0)");
 insertMenuList("Search-Resume","Advanced Search","javascript:void(0)");

 insertMenuList("Manage-Jobs","Post a Job","http://localhost/emppj-new.asp")
 insertMenuList("Manage-Jobs","View Profile By Id","srchbyid_emp.asp")
  insertMenuList("Manage-Jobs","Track Applications","javascript:void(0)")
 insertMenuList("Manage-Jobs","Manage Jobs","javascript:void(0)")
 insertMenuList("Manage-Jobs","Download Resume Summary","javascript:void(0)")

 insertMenuList("Personal-Settings","Cusomize Emails","javascript:void(0)")
 insertMenuList("Personal-Settings","Edit Company Profile","javascript:void(0)")
 insertMenuList("Personal-Settings","Change Password","chng_password.html")

 insertMenuList("Post-Jobs","Post a Job Now",path+"pages/employer/emppj.jsp")
 insertMenuList("Post-Jobs","Shortlist Resumes",path+"pages/employer/empsl.jsp")
 
 //insertMenuList("Search Resumes","Save Search","http://localhost/empadvsrch.asp")
 //insertMenuList("Search Resumes","Save 2 Search","http://localhost/empadvsrch.asp")



 aobj="background-color:"+cb.bgColor+";color:"+cb.color+";width:"+cb.width+";font-size:"+cb.fontSize+";font-family:"+cb.fontFamily+";line-height:"+cb.lineHeight+";font-weight:"+cb.fontWeight
 aobj+=ns4?"":";cursor:"+cb.Cursor+";padding-left:"+cb.Padding;
 visualize("<style>\n #nsmenu,#msap2 {position:absolute;width:"+cb.width+"}\n");
 visualize(".menuitem {"+aobj+"}\n</style>\n\n");

 function msap(evt,menus,topp){
 themenuoffsetX=(ie4)?document.body.scrollLeft:window.pageXOffset // themenuoffsetX+evt.clientX-evt.offsetX-3 
 themenuoffsetY=(ie4)?document.body.scrollTop:window.pageYOffset //themenuoffsetY+evt.clientY-evt.offsetY-3
 mtable=buildPat(newMenu[menus])
 Item=(ie4)?evt.srcElement.innerText:evt.target.text;
 cftag=resolve("Layer","Div");cname=resolve("lh","mydiv")
 var ldiv="<"+cftag+" class="+cname+" onmouseover='clearHide()' onmouseout='delayhide()'>"+mtable+"</"+cftag+">";
 cur=(topp==null)?getRef('msap2'):getRef('nsmenu')
 if(topp==null) { clearHide(); 
				  if(ie4) { setStatus(); scrollMenu(Item);} 
				  incropacity();				   
				}
 reqtop=((topp!=null && !ns4) ? getRef('msap2').offsetTop+getRef('msap2').offsetParent.offsetTop-3+getOffsetPos("Top",topp,"TABLE"):"") 
 mLeft=ns4 ? evt.pageX-evt.layerX-4 :((topp==null)?document.all?getRef(menus).getClientRects()[0].left-3 :getRef(menus).offsetLeft-1:"")
 mTop=ns4 ? evt.pageY-evt.layerY+15 : getRef('tab1').offsetTop+getRef('tab1').offsetHeight-1;
 nesTop=ns4 ? evt.pageY-evt.layerY-6 :reqtop;
 nesLeft=ns4 ? parseInt(getRef('msap2').clip.width+getRef('msap2').left-4):getRef('msap2').offsetLeft+getRef('msap2').offsetWidth-1
 cur.innerHTML="";
 mnTop=(topp==null)?mTop:nesTop
 mnLeft=(topp==null)?mLeft:nesLeft;
 if(ie4) cur.insertAdjacentHTML("afterBegin",mtable);
 else if(ns_gecko) cur.innerHTML=ldiv
 else { with(cur) {
				   document.write(ldiv);document.close();
                   clip.width=cb.width;
				   }
     }
 with(ns4?cur:cur.style) {left=mnLeft;top=mnTop;
                          display=ns4 ? "show" :"block";}
 } 

 function pointer() {
 var no=ie4?6:'<B>%</B>'
 return "<span style='padding:0px;float:right;top:-1pt;font-family:webdings;font-size:12px'>"+no+"</span>"
 } 
 point=pointer();
 function buildMenu() {
 ref=resolve("A","Div")
 var eff=ns4?'<ilayer><layer bgColor='+cb.bgColor+' visibility=show clip=-1,-1,87,15  onmouseover="bgColor=cb.onBg" onmouseout="bgColor=cb.ofBg" >':"";
 var endd=ns4?"</layer></ilayer>":"";
 visualize("<layer  id=mcont clip=0,0,631,19 left=3  bgcolor=black><TABLE bgcolor="+cb.tblColor+" align=center CellPadding=1 CellSpacing=1 id=tab1 OnMouseOut=highlightmenu(event,'off'); OnMouseOver=highlightmenu(event,'on'); width='780' border=0>");
 visualize("<TR id=tabs1>");
 for(var item in mearray) 
 visualize('<TD width=10% onselectstart="return false" id='+mearray[item]+' class=menuitem title="'+mearray[item]+'" oncontextmenu="return false">'+eff+'<'+ref+' class=menu href="javascript:Menu()" onfocus=this.blur(); onmouseover=msap(event,"'+mearray[item]+'",null); onmouseout=delayhide();>'+point+mearray[item]+'</'+ref+'>'+endd+'</td>');
 visualize("</TR></TBODY></TABLE></layer>");
 if(ie4)  pointer();
 }

function buildPat(menus) {
 var nss=ns4?"<ilayer><layer clip=-1,-2,125,16  bgColor="+cb.bgColor+" onmouseover='bgColor=cb.onBg' onmouseout='bgColor=cb.ofBg'>":""
 if(ns4) applied="<table  cellspacing=1 border=0 cellpadding=5>"
 else applied="<table cellspacing=0 cellpadding=3 onMouseover=highlightmenu(event,'on'); onMouseout=highlightmenu(event,'off'); oncontextmenu='return false'>"
 for(var Menu in menus.items) { 
        loc=menus.actions[Menu];fresh=menus.items[Menu];
        rfresh=(fresh.indexOf("<")!=-1)?"Right Click To Open In New Window":fresh;
        if(!ns4) applied+='<tr><td nowrap onselectstart="return false" title="'+rfresh+'" class=menuitem onclick=loca("'+loc+'","self"); oncontextmenu=loca("'+loc+'","New"); onclick=loca("'+loc+'","Self");>'+fresh+'</tr>' 
        else applied+='<tr><td nowrap class=menuitem>'+nss+'<a class=manc onmouseover="return true;" onmouseout="return true;" href="'+loc+'">&nbsp;&nbsp;&nbsp;&nbsp;'+fresh+'</layer></ilayer></td></tr>' 
        } applied+="</table>" 
 return applied; }
 visualize("<SPAN id=msap2 onmouseout=getpos(event); onmouseover=clearHide();></SPAN>");
 visualize("<SPAN id=nsmenu onmouseout=getpos(event); onmouseover=clearHide();></SPAN>");

function employerMenu() {
		var emp_tabb=["Home","View Profile","Update Profile","Delete Profile","Post a Job","Search Resumes","Signout"];
		var emp_links=[path+"pages/index.jsp",path+"pages/employer/company_profile.jsp",path+"pages/employer/update_empreg.jsp",path+"pages/employer/delete_profile.jsp","http://localhost/emppj-new.asp",path+"pages/employer/empsrchresumes.jsp",path+"pages/global/signout.jsp"];
		document.write("<TABLE ALIGN=center width=780 cellspacing=1 cellpadding=0><TR>");
		var ht=document.all?20:15;
		var emp_cursor=document.all?"hand":"pointer";
		style1="style='font:bold 11px tahoma;width:100px;height:"+ht+"px;padding:3px;text-align:center;-moz-outline:5px dashed gray;-moz-border-radius-bottomleft:0px;-moz-border-radius-bottomright:20px;-moz-border-radius-topleft:20px;-moz-border-radius-topright:0px;color:aliceblue;background:#934759;cursor:"+emp_cursor+"'"
		style2="style='font:bold 11px tahoma;width:100px;height:"+ht+"px;padding:3px;text-align:center;-moz-outline:5px dashed gray;-moz-border-radius:20px;color:aliceblue;background:steelblue;cursor:"+emp_cursor+"'"
		for(var i=0;i<emp_tabb.length;i++) {
			if(emp_pane==emp_tabb[i]) document.write("<TD "+style2+" ondblclick='return false' url='"+emp_links[i]+"'  onclick=getNavigate(this);>"+emp_tabb[i]+"</TD>");
			else document.write("<TD "+style1+" ondblclick='return false' onmouseover=setOpacity(this); url='"+emp_links[i]+"'  onmouseout=clearOpacity(this); oonmousedown=mouseDown(this); oonmouseup=mouseUp(this); onclick=getNavigate(this);>"+emp_tabb[i]+"</TD>");
		 } document.write("</TABLE>");
}
 
try {
	//buildMenu();
	employerMenu();
	} catch(exception) { status=exception.toString();document.clear();}

var topic=new Array();
topic[0]=new Array("Post a Job","http://localhost/emppj-new.asp");
topic[1]=new Array("Search Resumes",path+"pages/employer/empsrchresumes.jsp");
topic[2]=new Array("Shortlist Jobs",path+"pages/employer/shortlist.jsp");
topic[3]=new Array("Company Profile",path+"pages/employer/compprof.jsp");
topic[4]=new Array("Signout",path+"pages/global/signout.jsp");

//added on 9/2/08 to include save search

insertMenuList("Search Resumes","Save Search1","http://localhost/empadvsrch1.asp");
insertMenuList("Search Resumes","Save Search2","http://localhost/empadvsrch2.asp"); 

 var fadeini=0,fading;
 var fadecolors=new Array( "eeeeff", "ddddff", "ccccff", "bbbbff", "aaaaff","eeffee","ddffdd","ccffcc", "bbffbb", "aaffaa","ffeeee", "ffdddd", "ffcccc", "ffbbbb", "ffaaaa","aaaaaa","bbbbbb","cccccc","dddddd","eeeeee");      
 function applyFade(obj) {
 objt=eval(obj);
 fadeini++;
 objt.style.backgroundColor=fadecolors[fadeini];
 if(fadeini==fadecolors.length) fadeini=1;
 fading=setTimeout("applyFade(objt)",50);
 }
 function clearFade(obj) {clearTimeout(fading);
 obj.style.background="teal"}

 
function setFadeBar() {
    document.write("<table width=600 cellspacing=3 cellpadding=5 align=center><TR>");
    for(var tpc=0;tpc<topic.length;tpc++)
    document.write("<th nowrap width=110 style='cursor:"+cb.Cursor+";background:teal;color:aliceblue' onmouseover=applyFade(this); onmouseout=clearFade(this); onclick=location.replace('"+topic[tpc][1]+"');>"+topic[tpc][0]+"</th>");
    document.write("</TR></TABLE>");
}

//modified on 23/8/2008 to change the side menu of employer module
//it is like - SEARCH:keyword search, filtered search, advanced search, resume search
var panes_search = ["Keyword Search","Filtered Search","Regular Search","Advanced Search","View Profile By Id"];

var pane_search_links = ["emp_keywordsrch.asp","empadvsrch.asp","emp_regularsrch.asp","empadvsrch.asp","srchbyid_emp.asp"];

//var panes=["Post a Job","View Profile By Id","Resume Search","Advanced Search","Filtered Search","Company Profile","Change Password","Track Applications","Manage Jobs","Set Jobs Requirements","Resume Export","Advertise"];
var panes=["Post a Job","Company Profile","Change Password","Track Applications","Manage Jobs","Set Jobs","Resume Export","Advertise"];

/*var c_msg=function(e) {
						var tgt=document.all?event.srcElement:e.target;
						var errmsgs="Sorry! "+tgt.innerHTML+" Page is Under Construction";
						return document.all?"vbscript:caution('"+errmsgs+"')":"javascript:alert('"+errmsgs+"')";
}
var elmt=function(e) {
					return document.all?event.srcElement:e.target;
}*/
var pane_links=["emppj-new.asp",uc_msg,"chng_password.html","trackapps.asp","emp_mngjobs.asp","emp-job-req.asp",uc_msg,uc_msg];




function setSlidePane(employer) {
var qrystring = "?employer="+employer;
document.write("<TABLE ALIGN=left width=150 cellspacing=0 cellpadding=4 style='border:1px solid gray'><TR>");
document.write("<TH class=title>Search</TH></TR>");
for(var j=0;j<panes_search.length;j++) 
document.write("<TR bgcolor=#fbfaf8><TD><A class=menulink href='"+pane_search_links[j]+qrystring+"'>"+panes_search[j]+"</a></TD>");

document.write("<TR><TH class=title>Employer Options</TH></TR>");
for(var i=0;i<panes.length;i++) document.write("<TR bgcolor=#fbfaf8><TD><A class=menulink href='"+pane_links[i]+qrystring+"'>"+panes[i]+"</a></TD>");

document.write("</TABLE>");
}



var bulletimg='<span id="bullet" style="position:absolute;left:-200px;" src="mybullet.gif"><font style="font:bold 11px webdings">'+(document.all?"4":"*")+'</font>&nbsp;&nbsp;&nbsp;&nbsp;</span>'
var bulletoffX=-10 //Set horizontal offset of bullet image from link's root. (ie: -2 or 5)
var bulletoffY=6.5 //Set vertical offset of bullet image from link's root. (ie: -2 or 5)
function caloffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;}
return totaloffset;
}
function displaybullet(linkobj){
bulletobj.style.left=caloffset(linkobj, "left")-bulletobj.style.width-bulletoffX+"px" //for image bulletobj.width;
bulletobj.style.top=caloffset(linkobj, "top")-bulletoffY+linkobj.offsetHeight/3+"px"
bulletobj.style.visibility="visible"
}
function modifylinks(){
bulletobj=document.all? document.all.bullet : document.getElementById("bullet")
for (i=0; i<document.links.length; i++){
if (document.links[i].className=="menulink"){
document.links[i].onmouseover=function(){displaybullet(this)}
document.links[i].onmouseout=function(){bulletobj.style.visibility="hidden"}
}
}
}
if (document.all || document.getElementById)
document.write(bulletimg)
if (window.addEventListener)
window.addEventListener("load", modifylinks, false)
else if (window.attachEvent)
window.attachEvent("onload", modifylinks)
else if (document.getElementById || document.all)
window.onload=modifylinks

