var indexer=1
var threadd;
var statusflg=0;
var dtCh= "/";
var minYear=1900;
var maxYear=2100;

var hilite_threadd;
var timethread;
function logindynacolor(obj,i)
{
  if(i==0)
  {
    obj.style.background="transparent url(/images/bgselectmenu.gif) repeat-x";
    obj.style.color="#000000"
  }
  else
  {
    obj.style.background="";
    obj.style.color="#ffffff"
    obj.style.backgroundColor="#ffb755";
  }
}
/////////////////////////////////////////////////////////////////////////////////////////////

 function flasher()
 {
    document.getElementById("choose").style.color="#ff0000"
    setTimeout('colorflash()',1000)  
 }

/////////////////////////////////////////////////////////////////////////////////////////////

 function colorflash()
  {
    val="" + document.getElementById("choose").style.color
    if(val=="rgb(0, 0, 0)" || val=="#000000")
       document.getElementById("choose").style.color="#ff0000"
    else
       document.getElementById("choose").style.color="#000000"
 
    setTimeout('colorflash()',1000)  
  } 

/////////////////////////////////////////////////////////////////////////////////////////////
function setactiveresume(filname)
{
   trigger(3)
   window.location='/seeker/myresume?activefile=' + filname
}
////////////////////////////////////////////

function delfiles(filename)
{
       var fRet; 

         msg='Are you sure you want to delete this resume?'

       fRet = confirm(msg); 
                            
       if(fRet==true) 
        {
           trigger(3)        
           window.location='/seeker/myresume?delid=' +  filename 
        }
       else
         return false;
 } 

/////////////////////////////////////////////////////////////////////////////////////////////

  function chkfile()
  {
     if(document.getElementById("ftyp").value.replace(/ /g,"").length==0)
      {
         alert("Error! Please select a file")
         return false
      }
     else
      {
         if(document.getElementById("ftyp").value.split(".")[1]=="ics")
           document.getElementById("filetypes").value="0"
         else
           document.getElementById("filetypes").value="1"

         return true
      }
  }

////////////////////////////////////////////////////////////////////////////////////////////////
function stripoffspecial(obj)
{
   var temp=document.getElementById(obj)
   temp.value=temp.value.replace(/[^a-zA-Z 0-9]/g,'').replace(/\s /g,'')
}

////////////////////////////////////////////////////////////////////////////////////////////
   function reset_timezone()
   {
         clearTimeout(timethread)
         d = new Date();
         document.getElementById("yorzonetime").innerHTML=d.toLocaleString()
         yourzonetimer()
   }
////////////////////////////////////////////////////////////////////////////////////////////
   function yourzonetimer()
   {
     
       if(document.getElementById("yorzonetime").innerHTML.length==0)
         d = new Date();
       else
         d = new Date(document.getElementById("yorzonetime").innerHTML);

         d.setSeconds(d.getSeconds()+1) 
       document.getElementById("yorzonetime").innerHTML=d.toLocaleString()
       timethread=setTimeout("yourzonetimer()",1000)
   }

////////////////////////////////////////////////////////////////////////////////////////////
  function sendtohome()
  {
    document.getElementById("unfinish").value="1"
    window.location="/"
  }

////////////////////////////////////////////////////////////////////////////////////////////
   function openjobpage(link)
   {
     window.open(link)
   }
////////////////////////////////////////////////////////////////////////////////////////////

function highlite()
{
  var topstr=document.getElementById("messgr_text2")
  if(topstr.innerHTML=="Offline" || topstr.innerHTML.indexOf("to use the messenger")!=-1)
   {
     if(!hilite_threadd)
      hilite_threadd=setTimeout("colorscript()",500)
     else
      hilite_threadd=null
   }
}

//////////////////////////////////////////////////////////////////////////////////////////////
  function back2home()
  {
     setTimeout("timerhome()",5000)
  }

  function timerhome()
  {
      window.location="http://www.lucidjobs.com"
  }
//////////////////////////////////////////////////////////////////////////////////////////////
function fixtheboxx()
{
  var widthtemp=document.documentElement.clientWidth

   if(widthtemp<1024)
   {
      document.getElementById("bodies").style.width="990px" 
      document.getElementById("page_wrapper").style.width="974px"
   }
   else
   {
      document.getElementById("bodies").style.width="auto" 
      document.getElementById("page_wrapper").style.width="98.5%"
   }

       /*if(window.console && window.console.firebug)
        {
            alert("you are using firebug");
        }*/

   if (! ('console' in window) || !('firebug' in console)) {
    var names = ['log', 'debug', 'info', 'warn', 'error', 'assert', 'dir', 'dirxml', 'group', 'groupEnd', 'time', 'timeEnd', 'count', 'trace', 'profile', 'profileEnd'];
    window.console = {};
    for (var i = 0; i < names.length; ++i) window.console[names[i]] = function() {};
   }
}

/////////////////////////////////////////////////////////////////////////////////////////////

  function colorscript()
  {

      hilite_threadd=setTimeout("colorscript()",500)
    flagg=0
    var topstr=document.getElementById("messgr_text2")

     if(topstr.style.color=="#ffffff" || topstr.style.color=="rgb(255, 255, 255)")
       {
          topstr.style.color="#ff8313"
         try{
               //if(flagg==1)
                 //topstr.firstChild.style.color="#ff8313"
            }catch(ert){}
       }
     else
       {
          topstr.style.color="#ffffff"
         try{
               //if(flagg==1)
                 //topstr.firstChild.style.color="#ffffff"
            }catch(ert){}
       }

  }

//////////////////////////////////////////////////////////////////////////////////////////////

   function rollmessages()
   {
      setTimeout('keeprolls()',1000)
   }
/////////////////////////////////////////////////////////////////////////////////////////////
function countryvalue(obj)
{
    if(obj.value>0)
	window.location="http://www.lucidjobs.com/findlocation/" + obj.value
}
/////////////////////////////////////////////////////////////////////////////////////////////
function backward()
{
  var inddex=whichone()

   if(inddex==1)
    inddex=5
   else
    inddex=inddex-1

        document.getElementById("start1").style.display="block"
        document.getElementById("start2").style.display="none"

  clearTimeout(threadd);
  indexer=inddex 
  switcher_content(inddex)
}

/////////////////////////////////////////////////////////////////////////////////////////////

function recheckmail()
{
     var ttemp1=document.getElementById("username").value
     var ttemp2=document.getElementById("reusername").value

     if(ttemp1==ttemp2)
      {
         var tempvar=document.getElementById("username").value.split("@")[1]
         document.getElementById("urlink").value="http://www." + tempvar
      }
     else
      alert("Please check your email id again")
}

//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////
   function checkfeed()
   {
       if(xmlfeedcheck()==1)
         return true
       else
        {
            alert("Please check the feed url")
            return false 
        } 
   }    
//////////////////////////////////////////////////////////////////////////////////////////////
    function xmlfeedcheck()
    {
      var v = new RegExp();
      v.compile("^[A-Za-z]+://[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$");
      var field=document.getElementById("urlink")
      var flag=0

      if (!v.test(field.value))
         flag=0
      else
       {
          var chk=field.value.split(".")
           if(chk.length>2)
           {
             if(field.value.charAt(field.value.length-1)!="." && field.value.charAt(field.value.length-2)!="." && field.value.substr(0,7)=="http://")
               flag=1
             else
               flag=0
           }
           else
           {
               flag=0
           }
       }
        if(flag==0)
          return 0
        else
          return 1      
    }

///////////////////////////////////////////////////////////////////////////////////////////////   
    function urlcheck()
    {
      var v = new RegExp();
      v.compile("^[A-Za-z]+://[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$");
      var field=document.getElementById("urlink")
      var flag=0

      if (!v.test(field.value))
         flag=0
      else
       {
          var chk=field.value.split(".")
           if(chk.length>2)
           {
             if(field.value.charAt(field.value.length-1)!="." && field.value.charAt(field.value.length-2)!="." && field.value.substr(0,11)=="http://www.")
               flag=1
             else
               flag=0
           }
           else
           {
               flag=0
           }
       }
        if(flag==0)
          return 0
        else
          return 1      
    }

///////////////////////////////////////////////////////////////////////////////////////////////
    function urlblurcheck()
    {
      var v = new RegExp();
      v.compile("^[A-Za-z]+://[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$");
      var field=document.getElementById("urlink")
      var flag=0
      if (!v.test(field.value)) {
        flag=0         
        }
      else
       {
          var chk=field.value.split(".")
           if(chk.length>2)
           {
             if(field.value.charAt(field.value.length-1)!="." && field.value.charAt(field.value.length-2)!=".")
               flag=1
             else
               flag=0
           }
           else
           {
               flag=0
           }
       }

        if(flag==0)
          alert("invalid URL format\nMust be of http://www.example.com format")
    }
///////////////////////////////////////////////////////////////////////////////////////////////
function showroles(obj)
{

  if(obj.value==-1)
   {
      document.getElementById("jseeker").style.display="none"
   }
  else if(obj.value==0)
   {
      document.getElementById("rolestype").value="0"
      document.getElementById("jseeker").style.display="block"
      document.getElementById("note_strip1").style.display="block"
      document.getElementById("note_strip2").style.display="none"
      document.getElementById("empsection").style.display="none"
      security()
      document.getElementById("username").focus()
   }
  else
   {
      document.getElementById("rolestype").value="1"
      document.getElementById("jseeker").style.display="block"
      document.getElementById("note_strip2").style.display="block"
      document.getElementById("note_strip1").style.display="none"
      document.getElementById("empsection").style.display="block"
      security()
      document.getElementById("username").focus()
   }

}

/////////////////////////////////////////////////////////////////////////////////////////////

function switcher_content(num)
{
        for(i=1;i<6;i++)
        {
           if(i==num)
            {
              document.getElementById("small_" + i).style.display="block"
	       var tempobj=document.getElementById("menu_" + i).parentNode
	       tempobj=tempobj.parentNode
	       tempobj.id="active"
              document.getElementById("text_" + i).style.color="#000000" 
            }
           else
            {
              document.getElementById("small_" + i).style.display="none"
	       var tempobj=document.getElementById("menu_" + i).parentNode
	       tempobj=tempobj.parentNode
	       tempobj.id=""
              document.getElementById("text_" + i).style.color="#666666"
            }
        }
       clearTimeout(threadd); 
       threadd=setTimeout('keeprolls()',2000)
}
/////////////////////////////////////////////////////////////////////////////////////////////
function forward()
{

  var inddex=whichone()
   if(inddex==5)
    inddex=1
   else
    inddex=inddex+1

        document.getElementById("start1").style.display="block"
        document.getElementById("start2").style.display="none"

  clearTimeout(threadd); 
  indexer=inddex
  switcher_content(inddex)
}
/////////////////////////////////////////////////////////////////////////////////////////////

  function whichone()
  {
     var inddex=0;

        for(i=1;i<6;i++)
        {
           var tobj=document.getElementById("small_" + i)
             if(tobj.style.display=="block")
             {
               inddex=i
               break
             } 
        }

    return inddex
  }

/////////////////////////////////////////////////////////////////////////////////////////////
function startstop()
{
 var tempp=document.getElementById("start1")

   if(tempp.style.display=="block")
     {
        document.getElementById("start1").style.display="none"
        document.getElementById("start2").style.display="block"
        clearTimeout(threadd);
     }
   else
     {
        document.getElementById("start1").style.display="block"
        document.getElementById("start2").style.display="none"
        switches_content(indexer)
     }

}
/////////////////////////////////////////////////////////////////////////////////////////////
    function keeprolls()
    {
        for(i=1;i<6;i++)
        {
           if(i==indexer)
            {
              document.getElementById("small_" + i).style.display="block"
	       var tempobj=document.getElementById("menu_" + i).parentNode
	       tempobj=tempobj.parentNode
	       tempobj.id="active"
              document.getElementById("text_" + i).style.color="#000000" 
            }
           else
            {
              document.getElementById("small_" + i).style.display="none"
	       var tempobj=document.getElementById("menu_" + i).parentNode
	       tempobj=tempobj.parentNode
	       tempobj.id=""
              document.getElementById("text_" + i).style.color="#666666"
            }
        }
       indexer=indexer+1
       if(indexer==6)
         indexer=1

       threadd=setTimeout('keeprolls()',2000)
    }
 
/////////////////////////////////////////////////////////////////////////////////////////////

function bookmark()
{
  url="http://www.lucidjobs.com"
  title="Lucid Jobs"

  if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) 
  {
    window.external.AddFavorite(url,title);
  } 
  //else if (navigator.appName == "Netscape") 
  //{
  //  window.sidebar.addPanel(title,url,"");
  //} 
  else 
  {
    alert("Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark");
  }
}

/////////////////////////////////////////////////////////////////////////////////////////////

function set_color_cookie(color_code)
{
    var date = new Date();

    var flag=getCookie('colorcode')
      if(flag!=null && flag!="")  
      {
       date.setTime(date.getTime()+(-1*24*60*60*1000));
       var expires = "; expires=" + date.toGMTString();
         document.cookie = 'colorcode' + "=" + color_code + expires + "; path=/; domain=.lucidjobs.com"       
      }
     // else 
      {
         date.setTime(date.getTime()+(365*24*60*60*1000));  
         var expires = "; expires=" + date.toGMTString(); 
         document.cookie = 'colorcode' + "=" + color_code + expires +  "; path=/; domain=.lucidjobs.com";       
      }

}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1 ;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length
    return unescape(document.cookie.substring(c_start,c_end));
    } 
  }
return ""
}

/////////////////////////////////////////////////////////////////////////////////////////////

function bringfocus(str)
{
  document.getElementById(str).focus()
}

/////////////////////////////////////////////////////////////////////////////////////////////

 function checkprofile()
 {
	    var flag=""
           var prefvaluer=""
		/*var temp1=document.getElementById("eligibility").value
		temp1=temp1.replace(/ /g,"")
		if(temp1.length==0)
		{
			document.getElementById("eligibility").style.background="#FFF1BF"
			flag="Please enter the eligibility field\n"
		}
		else
		{
			document.getElementById("eligibility").style.background="#FFFFFF"
		}*/

        var counter=0
        for(i=1;i<6;i++)
        {
           var str=document.getElementById("chkbox" + i)
           if(str.checked)
           {
             counter=counter+1
             prefvaluer=prefvaluer + "1"
           }  
           else
             prefvaluer=prefvaluer + "0"
        }
        
        if(counter==0)
         flag=flag + "Please select at least one preferred job\n"
        else
         document.getElementById("prefjobs").value=prefvaluer

	/*if(flag.length>0)
	{
		alert(flag)
		//return false
	}
	else*/
        {
                          window.scrollTo(0,0); 

         document.getElementById("boxtitle").innerHTML="<div id=\"progbar\" style=\"display:none\"><img id=\"rollimg\" src=\"/images/circleimage.gif\" /><div id=\"progmsg\">Please Wait....</div></div>"
         document.getElementById("progbar").style.display="block"
          var params=Form.serialize('myprofiles')
          var updajax=new Ajax.Updater('boxtitle', '/seeker/myprofile', {asynchronous:true, evalScripts:true, parameters: params, method: 'post', frequency: 0.01})	   		
        } 
 }

/////////////////////////////////////////////////////////////////////////////////////////////

function fixthebox()
{
  var widthtemp=document.documentElement.clientWidth

   if(widthtemp<1024)
   {
      document.getElementById("body").style.width="990px" 
      document.getElementById("page_wrapper").style.width="974px"
      document.getElementById("header_wrapper").style.width="974px"
   }
   else
   {
      document.getElementById("body").style.width="auto" 
      document.getElementById("page_wrapper").style.width="98.5%"
      document.getElementById("header_wrapper").style.width="auto"
   }

       /*if(window.console && window.console.firebug)
        {
            alert("you are using firebug");
        }*/

   if (! ('console' in window) || !('firebug' in console)) {
    var names = ['log', 'debug', 'info', 'warn', 'error', 'assert', 'dir', 'dirxml', 'group', 'groupEnd', 'time', 'timeEnd', 'count', 'trace', 'profile', 'profileEnd'];
    window.console = {};
    for (var i = 0; i < names.length; ++i) window.console[names[i]] = function() {};
   }
}

/////////////////////////////////////////////////////////////////////////////////////////////

function openparts(objstr)
{
  var temp=document.getElementById(objstr)

  if(temp.style.display=="block")
   {
    temp.style.display="none"
   }
  else
  {
    temp.style.display="block"
    document.getElementById("termline").innerHTML=""
  }
}

/////////////////////////////////////////////////////////////////////////////////////////////
function security()
{
          //var updajax=new Ajax.Updater('numholder', '/securitykey', {asynchronous:true, evalScripts:true, method: 'get', frequency: 0.01}) 
      try{
           $("#numholder").load('/securitykey');
         }catch(erty){}
}

/////////////////////////////////////////////////////////////////////////////////////////////
function plainsecurity()
{
   document.getElementById('secutext').value=""
   var updajax=new Ajax.Updater('numholder', '/securitykey', {asynchronous:true, evalScripts:true, method: 'get', frequency: 0.01}) 
}
/////////////////////////////////////////////////////////////////////////////////////////////
function paymentsecurity()
{
       document.getElementById('secutext').value=""
       var updajax=new Ajax.Updater('numholder', '/employer/securitykey', {asynchronous:true, evalScripts:true, method: 'get', frequency: 0.01}) 
}

////////////////////////////////////////////////////////////////////////////////////////////

 function getaddress(i)
 {
 	if(i==0)
	  document.getElementById("addressbox").style.display="block"
	else
	  document.getElementById("addressbox").style.display="none"	
 }

////////////////////////////////////////////////////////////////////////

function clearoff(obj)
{
  obj.value=""
}

////////////////////////////////////////////////////////////////////////////////////////////
function validatemail(fld) 
{
    var error="";
    var tfld = str_trim(fld);                        // value of field with whitespace trimmed off
    var emailFilter = /^[^@]+@[^@.]+\.[^@]*\w\w$/ ;
    var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/ ;
   
    if (fld == "") 
    {
       return 1;
    } 
    else if (!emailFilter.test(tfld)) 
    {              
       return 1;
    } 
    else if (fld.match(illegalChars)) 
    {
       return 1;
    } 
    else 
    {
       return 0;
    }
}

////////////////////////////////////////////////////////////////////////
function str_trim(s)
{
  return s.replace(/^\s+|\s+$/, '');
}

////////////////////////////////////////////////////////////////////////

function check_form_data()
{
  var flag=""
  var temp1=document.getElementById("cname").value
  temp1=temp1.replace(/ /g,"")
 
		if(temp1.length==0)
		{
			document.getElementById("cname").style.background="#FFF1BF"
			flag="Please enter the company name\n"
		}
		else
		{
			document.getElementById("cname").style.background="#FFFFFF"
		}

		var temp2=document.getElementById("email").value
		temp2=temp2.replace(/ /g,"")
		temflag=validatemail(temp2)	
		if(temp2.length==0 || temflag==1)
		{
			document.getElementById("email").style.background="#FFF1BF"
			flag=flag + "Please enter a valid email id\n"
		}
		else
		{
			document.getElementById("email").style.background="#FFFFFF"
		}

             var temp3=document.getElementById("phone").value
             temp3=temp3.replace(/ /g,"")

		if(temp3.length==0)
		{
			document.getElementById("phone").style.background="#FFF1BF"
			flag=flag + "Please enter the phone number\n"
		}
		else
		{
			document.getElementById("phone").style.background="#FFFFFF"
		}

             var temp4=document.getElementById("phone").value
             temp4=temp4.replace(/ /g,"")

		if(temp4.length==0)
		{
			document.getElementById("descript").style.background="#FFF1BF"
			flag=flag + "Please enter the description\n"
		}
		else
		{
			document.getElementById("descript").style.background="#FFFFFF"
		}

             var temp5=document.getElementById("secutext").value
             temp5=temp5.replace(/ /g,"")

		if(temp5.length==0)
		{
			document.getElementById("secutext").style.background="#FFF1BF"
			flag=flag + "Please enter the security text\n"
		}
		else
		{
			document.getElementById("secutext").style.background="#FFFFFF" 
		}

	if(flag.length>0)
	{
		alert(flag)
		return false
	}
	else
	   return true 

}

/////////////////////////////////////////////////////////////////////////////////////////////

/*function chklinkjob()
{
  var temp1=document.getElementById("jtitle").value
  temp1=temp1.gsub(/ /g,"")
  var flag=""
		if(temp1.length==0)
		{
			document.getElementById("jtitle").style.background="#FFF1BF"
			flag="Please enter a job title\n"
		}
		else
		{
			document.getElementById("jtitle").style.background="#FFFFFF"
		}
                                          
  var temp2=document.getElementById("link").value
  temp2=temp2.gsub(/ /g,"")

		if(temp2.length==0)
		{
			document.getElementById("link").style.background="#FFF1BF"
			flag=flag + "Please enter the job url\n"
		}
		else
		{
			document.getElementById("link").style.background="#FFFFFF"
		}


	if(flag.length>0)
	{
		alert(flag)
		return false
	}
	else
	   return true 

}
*/
////////////////////////////////////////////////////////////////////////

function validateemployer()
{
	    var flag=""
		var temp1=document.getElementById("username").value
		temp1=temp1.replace(/ /g,"")
		temflag=validatemail(temp1)	
		if(temp1.length==0 || temflag==1)
		{
			document.getElementById("username").style.background="#FFF1BF"
			flag="Please enter a valid username\n"
		}
		else
		{
			document.getElementById("username").style.background="#FFFFFF"
		}

              var tempcheck=document.getElementById("reusername").value
		tempcheck=tempcheck.replace(/ /g,"")
              if(temp1!=tempcheck)
		{
			document.getElementById("reusername").style.background="#FFF1BF"
			flag=flag + "Username doesnt match\n"
		}
		else
		{
			document.getElementById("reusername").style.background="#FFFFFF"
		}

		
		var temp2=document.getElementById("passwd").value
		temp2=temp2.replace(/ /g,"")		
		if(temp2.length==0)
		{
			document.getElementById("passwd").style.background="#FFF1BF"
			flag=flag + "Please enter a password\n"
		}
		else
		{
			document.getElementById("passwd").style.background="#FFFFFF"
		}

		/*var temp3=document.getElementById("nickname").value
		temp3=temp3.replace(/ /g,"")		
		if(temp3.length==0)
		{
			document.getElementById("nickname").style.background="#FFF1BF"
			flag=flag + "Please enter a nickname\n"
		}
		else
		{
			document.getElementById("nickname").style.background="#FFFFFF"
		}*/

		var temp4=document.getElementById("fname").value
		temp4=temp4.replace(/ /g,"")		
		if(temp4.length==0)
		{
			document.getElementById("fname").style.background="#FFF1BF"
			flag=flag + "Please enter a first name\n"
		}
		else
		{
			document.getElementById("fname").style.background="#FFFFFF"
		}				

		var temp5=document.getElementById("lname").value
		temp5=temp5.replace(/ /g,"")		
		if(temp5.length==0)
		{
			document.getElementById("lname").style.background="#FFF1BF"
			flag=flag + "Please enter a last name\n"
		}
		else
		{
			document.getElementById("lname").style.background="#FFFFFF"
		}


		var temp8=document.getElementById("compname").value
		temp8=temp8.replace(/ /g,"")		
		if(temp8.length==0)
		{
			document.getElementById("compname").style.background="#FFF1BF"
			flag=flag + "Please enter the company name\n"
		}
		else
		{
			document.getElementById("compname").style.background="#FFFFFF"
		}

		var temp9=document.getElementById("urlink").value
		temp9=temp9.replace(/ /g,"")		
		if(temp9.length==0)
		{
			document.getElementById("urlink").style.background="#FFF1BF"
			flag=flag + "Please enter the url\n"
		}
		else
		{
			document.getElementById("urlink").style.background="#FFFFFF"
		}

		var temp6=document.getElementById("location").value
		temp6=temp6.replace(/ /g,"")		
		if(temp6=="0")
		{
			document.getElementById("location").style.background="#FFF1BF"
			flag=flag + "Please select a country\n"
		}
		else
		{
			document.getElementById("location").style.background="#FFFFFF"
		}
				
		var temp7=document.getElementById("secutext").value
		temp7=temp7.replace(/ /g,"")		
		if(temp7.length==0)
		{
			document.getElementById("secutext").style.background="#FFF1BF"
			flag=flag + "Please enter the security text\n"
		}
		else
		{
			document.getElementById("secutext").style.background="#FFFFFF"
		}
		
              if(document.getElementById("termss").checked)
              {
			document.getElementById("termss").style.background="#FFFFFF"

              }
              else
              {
			document.getElementById("termss").style.background="#FFF1BF"
			flag=flag + "You must agree to the terms to finish the registration process"
              }

	if(flag.length>0)
	{
		alert(flag)
		return false
	}
	else
	   return true		
	
}
////////////////////////////////////////////////////////////////////////

function validateseeker()
{
	    var flag=""
		var temp1=document.getElementById("username").value
		temp1=temp1.replace(/ /g,"")
		temflag=validatemail(temp1)	
		if(temp1.length==0 || temflag==1)
		{
			document.getElementById("username").style.background="#FFF1BF"
			flag="Please enter a valid username\n"
		}
		else
		{
			document.getElementById("username").style.background="#FFFFFF"
		}
		
              var tempcheck=document.getElementById("reusername").value
		tempcheck=tempcheck.replace(/ /g,"")
              if(temp1!=tempcheck)
		{
			document.getElementById("reusername").style.background="#FFF1BF"
			flag=flag + "Username doesnt match\n"
		}
		else
		{
			document.getElementById("reusername").style.background="#FFFFFF"
		}

		var temp2=document.getElementById("passwd").value
		temp2=temp2.replace(/ /g,"")		
		if(temp2.length==0)
		{
			document.getElementById("passwd").style.background="#FFF1BF"
			flag=flag + "Please enter a password\n"
		}
		else
		{
			document.getElementById("passwd").style.background="#FFFFFF"
		}

		/*var temp3=document.getElementById("nickname").value
		temp3=temp3.replace(/ /g,"")		
		if(temp3.length==0)
		{
			document.getElementById("nickname").style.background="#FFF1BF"
			flag=flag + "Please enter a nickname\n"
		}
		else
		{
			document.getElementById("nickname").style.background="#FFFFFF"
		}*/

		var temp4=document.getElementById("fname").value
		temp4=temp4.replace(/ /g,"")		
		if(temp4.length==0)
		{
			document.getElementById("fname").style.background="#FFF1BF"
			flag=flag + "Please enter a first name\n"
		}
		else
		{
			document.getElementById("fname").style.background="#FFFFFF"
		}				

		var temp5=document.getElementById("lname").value
		temp5=temp5.replace(/ /g,"")		
		if(temp5.length==0)
		{
			document.getElementById("lname").style.background="#FFF1BF"
			flag=flag + "Please enter a last name\n"
		}
		else
		{
			document.getElementById("lname").style.background="#FFFFFF"
		}

              if(document.getElementById("rolestype").value==1)
              {

				var temp8=document.getElementById("compname").value
				temp8=temp8.replace(/ /g,"")		
				if(temp8.length==0)
				{
					document.getElementById("compname").style.background="#FFF1BF"
					flag=flag + "Please enter the company name\n"
				}
				else
				{
					document.getElementById("compname").style.background="#FFFFFF"
                                  document.getElementById("compname").value.replace(/[^a-zA-Z 0-9]/g,'').replace(/\s /g,'') 
				}

				//var temp9=document.getElementById("urlink").value
				//temp9=temp9.replace(/ /g,"")
                           urrl=urlcheck()		
				//if(temp9.length==0 && urrl==0)
                           if(urrl==0)
				{
					document.getElementById("urlink").style.background="#FFF1BF"
					flag=flag + "Please enter a valid url [eg: http://www. ]\n"
				}
				else
				{
					document.getElementById("urlink").style.background="#FFFFFF"
				}

              } 


		var temp6=document.getElementById("location").value
		temp6=temp6.replace(/ /g,"")		
		if(temp6=="0")
		{
			document.getElementById("location").style.background="#FFF1BF"
			flag=flag + "Please select a country\n"
		}
		else
		{
			document.getElementById("location").style.background="#FFFFFF"
		}
				
		var temp7=document.getElementById("secutext").value
		temp7=temp7.replace(/ /g,"")		
		if(temp7.length==0)
		{
			document.getElementById("secutext").style.background="#FFF1BF"
			flag=flag + "Please enter the security text\n"
		}
		else
		{
			document.getElementById("secutext").style.background="#FFFFFF"
		}
		
              if(document.getElementById("termss").checked)
              {
			document.getElementById("termss").style.background="#FFFFFF"

              }
              else
              {
			document.getElementById("termss").style.background="#FFF1BF"
			flag=flag + "You must agree to the terms to finish the registration process"
              }

	if(flag.length>0)
	{
		alert(flag)
		return false
	}
	else
	   return true		
		
}
//////////////////////////////////////////////////////////////////////////////////////////

function checkvail(uid)
{
	var temp=document.getElementById(uid).value
	temp=temp.replace(/ /g,"")
	
	temflag=validatemail(temp)	
	if (temflag == 0) {
		var param = "username=" + temp
		/*var updajax = new Ajax.Updater('dummy', '/checkid', {
			asynchronous: true,
			evalScripts: true,
			method: 'get',
			parameters: param,
			frequency: 0.01
		})*/

	      try{
       	    $("#dummy").load('/checkid?username=' + temp);
	         }catch(erty){}
		
	}
	else 
	{
		//alert("Error! Invalid username")
		document.getElementById("username").value=""
	}	
}

//////////////////////////////////////////////////////////////////////////////////
function forgetemppassword()
{
	var temp=document.getElementById("uname").value
	temp=temp.replace(/ /g,"")
	
	temflag=validatemail(temp)	
	if (temflag == 0) {
		var param = "username=" + temp
		var updajax = new Ajax.Updater('regbox_top', '/employer/resetpass', {
			asynchronous: true,
			evalScripts: true,
			method: 'get',
			parameters: param,
			frequency: 0.01
		})
		
	}
	else 
	{
		alert("Error! Invalid username")
		document.getElementById("uname").value=""
	}	
}
////////////////////////////////////////////////////////////////////////////////////
function forgetpassword()
{
	var temp=document.getElementById("uname").value
	temp=temp.replace(/ /g,"")
	
	temflag=validatemail(temp)	
	if (temflag == 0) {
		var param = "username=" + temp
		var updajax = new Ajax.Updater('regbox_top', '/resetpass', {
			asynchronous: true,
			evalScripts: true,
			method: 'get',
			parameters: param,
			frequency: 0.01
		})
		
	}
	else 
	{
		alert("Error! Invalid username")
		document.getElementById("uname").value=""
	}	
}
////////////////////////////////////////////////////////////////////////////////////

function log_validate()
{
	    var flag=""
		var temp1=document.getElementById("username").value
		temp1=temp1.replace(/ /g,"")
		temflag=validatemail(temp1)	
		if(temp1.length==0 || temflag==1)
		{
			document.getElementById("username").style.background="#FFF1BF"
			flag="Please enter a valid username\n"
		}
		else
		{
			document.getElementById("username").style.background="#FFFFFF"
		}
		
		var temp2=document.getElementById("passwd").value
		temp2=temp2.replace(/ /g,"")		
		if(temp2.length==0)
		{
			document.getElementById("passwd").style.background="#FFF1BF"
			flag=flag + "Please enter a password\n"
		}
		else
		{
			document.getElementById("passwd").style.background="#FFFFFF"
		}

			if(flag.length>0)
			{
				alert(flag)
				return false
			}
			else
			   return true		
}
////////////////////////////////////////////////////////////////////////////////////////////

/*function saveprofile()
{
	    var flag=""

		var temp1=document.getElementById("fname").value
		temp1=temp1.replace(/ /g,"")
		if(temp1.length==0)
		{
			document.getElementById("fname").style.background="#FFF1BF"
			flag="Please enter your first name\n"
		}
		else
		{
			document.getElementById("fname").style.background="#FFFFFF"
		}

		var temp2=document.getElementById("lname").value
		temp2=temp2.replace(/ /g,"")
		if(temp2.length==0)
		{
			document.getElementById("lname").style.background="#FFF1BF"
			flag=flag + "Please enter your last name\n"
		}
		else
		{
			document.getElementById("lname").style.background="#FFFFFF"
		}

		var temp4=document.getElementById("location").value

		if(temp4.value=="0")
		{
			document.getElementById("location").style.background="#FFF1BF"
			flag=flag + "Please select your location\n"
		}
		else
		{
			document.getElementById("location").style.background="#FFFFFF"
		}

			if(flag.length>0)
			{
			   alert(flag)
			}
			else
			{
                          window.scrollTo(0,0); 
                          document.getElementById("boxtitle").innerHTML="<div id=\"progbar\" style=\"display:none\"><img id=\"rollimg\" src=\"/images/circleimage.gif\" /><div id=\"progmsg\">Please Wait....</div></div>"
                          document.getElementById("progbar").style.display="block"
 		            var param = "fname=" + document.getElementById("fname").value + "&lname=" + document.getElementById("lname").value
                          param=param + "&nickname=" + document.getElementById("nickname").value + "&phone=" + document.getElementById("phone").value + "&country=" + document.getElementById("location").options[document.getElementById("location").selectedIndex].value
		            var updajax = new Ajax.Updater('boxtitle', '/seeker/saveaccount', {asynchronous: true, evalScripts: true, method: 'get', parameters: param, frequency: 0.01})
                     }  

}*/
//////////////////////////////////////////////////////////////////////////////////////////////

function saveempprofile()
{
	    var flag=""

		var temp1=document.getElementById("fname").value
		temp1=temp1.replace(/ /g,"")
		if(temp1.length==0)
		{
			document.getElementById("fname").style.background="#FFF1BF"
			flag="Please enter your first name\n"
		}
		else
		{
			document.getElementById("fname").style.background="#FFFFFF"
		}

		var temp2=document.getElementById("lname").value
		temp2=temp2.replace(/ /g,"")
		if(temp2.length==0)
		{
			document.getElementById("lname").style.background="#FFF1BF"
			flag=flag + "Please enter your last name\n"
		}
		else
		{
			document.getElementById("lname").style.background="#FFFFFF"
		}

		/*var temp3=document.getElementById("nickname").value
		temp3=temp3.replace(/ /g,"")
		if(temp3.length==0)
		{
			document.getElementById("nickname").style.background="#FFF1BF"
			flag=flag + "Please enter your nick name\n"
		}
		else
		{
			document.getElementById("nickname").style.background="#FFFFFF"
		}*/

		var temp5=document.getElementById("compname").value
		temp5=temp5.replace(/ /g,"")
		if(temp5.length==0)
		{
			document.getElementById("compname").style.background="#FFF1BF"
			flag=flag + "Please enter your company name\n"
		}
		else
		{
			document.getElementById("compname").style.background="#FFFFFF"
                     document.getElementById("compname").value.replace(/[^a-zA-Z 0-9]/g,'').replace(/\s /g,'')
		}

		//var temp6=document.getElementById("urlink").value
		//temp6=temp6.replace(/ /g,"")
              urrl=urlcheck()
		if(urrl==0)
		{
			document.getElementById("urlink").style.background="#FFF1BF"
			flag=flag + "Please enter a valid url [eg. http://www] \n"
		}
		else
		{
			document.getElementById("urlink").style.background="#FFFFFF"
		}


		var temp4=document.getElementById("location").value

		if(temp4.value=="0")
		{
			document.getElementById("location").style.background="#FFF1BF"
			flag=flag + "Please select your location\n"
		}
		else
		{
			document.getElementById("location").style.background="#FFFFFF"
		}

			if(flag.length>0)
			{
			   alert(flag)
			}
			else
			{
                          window.scrollTo(0,0); 

                          document.getElementById("boxtitle").innerHTML="<div id=\"progbar\" style=\"display:none\"><img id=\"rollimg\" src=\"/images/circleimage.gif\" /><div id=\"progmsg\">Please Wait....</div></div>"
                          document.getElementById("progbar").style.display="block"
 		            var param = "fname=" + document.getElementById("fname").value + "&lname=" + document.getElementById("lname").value
                          param=param + "&nickname=" + document.getElementById("nickname").value + "&phone=" + document.getElementById("phone").value + "&country=" + document.getElementById("location").options[document.getElementById("location").selectedIndex].value
                          param=param + "&compname=" + document.getElementById("compname").value + "&urlink=" + document.getElementById("urlink").value
		            var updajax = new Ajax.Updater('boxtitle', '/employer/saveaccount', {asynchronous: true, evalScripts: true, method: 'get', parameters: param, frequency: 0.01})
                     }  

}
//////////////////////////////////////////////////////////////////////////////////////////////

function savepassword()
{
                var flag=""

		var temp1=document.getElementById("oldpass").value
		temp1=temp1.replace(/ /g,"")
		if(temp1.length==0)
		{
			document.getElementById("oldpass").style.background="#FFF1BF"
			flag="Please enter your old password\n"
		}
		else
		{
			document.getElementById("oldpass").style.background="#FFFFFF"
		}

		var temp2=document.getElementById("newpass").value
		temp2=temp2.replace(/ /g,"")
		if(temp2.length==0)
		{
			document.getElementById("newpass").style.background="#FFF1BF"
			flag=flag + "Please enter a new password\n"
		}
		else
		{
			document.getElementById("newpass").style.background="#FFFFFF"
		}

		var temp3=document.getElementById("chknewpass").value
		temp3=temp3.replace(/ /g,"")
		if(temp3.length==0)
		{
			document.getElementById("chknewpass").style.background="#FFF1BF"
			flag=flag + "Please re-enter the new password\n"
		}
		else
		{
			document.getElementById("chknewpass").style.background="#FFFFFF"
		}

                     if(temp2!=temp3)
                       flag=flag + "Please ensure that new password and confirm password are the same\n" 

			if(flag.length>0 || temp2!=temp3)
			{
			   alert(flag)
			}
			else
			{
                          window.scrollTo(0,0); 
                          document.getElementById("boxtitle").innerHTML="<div id=\"progbar\" style=\"display:none\"><img id=\"rollimg\" src=\"/images/circleimage.gif\" /><div id=\"progmsg\">Please Wait....</div></div>"
                          document.getElementById("progbar").style.display="block"
 		            var param = "oldpassword=" + document.getElementById("oldpass").value + "&newpassword=" + document.getElementById("newpass").value
		            var updajax = new Ajax.Updater('boxtitle', '/seeker/savepassword', {asynchronous: true, evalScripts: true, method: 'post', parameters: param, frequency: 0.01})
                        } 

}
//////////////////////////////////////////////////////////////////////////////////////////////

function saveemppassword()
{
                var flag=""

		var temp1=document.getElementById("oldpass").value
		temp1=temp1.replace(/ /g,"")
		if(temp1.length==0)
		{
			document.getElementById("oldpass").style.background="#FFF1BF"
			flag="Please enter your old password\n"
		}
		else
		{
			document.getElementById("oldpass").style.background="#FFFFFF"
		}

		var temp2=document.getElementById("newpass").value
		temp2=temp2.replace(/ /g,"")
		if(temp2.length==0)
		{
			document.getElementById("newpass").style.background="#FFF1BF"
			flag=flag + "Please enter a new password\n"
		}
		else
		{
			document.getElementById("newpass").style.background="#FFFFFF"
		}

		var temp3=document.getElementById("chknewpass").value
		temp3=temp3.replace(/ /g,"")
		if(temp3.length==0)
		{
			document.getElementById("chknewpass").style.background="#FFF1BF"
			flag=flag + "Please re-enter the new password\n"
		}
		else
		{
			document.getElementById("chknewpass").style.background="#FFFFFF"
		}

                     if(temp2!=temp3)
                       flag=flag + "Please ensure that new password and confirm password are the same\n" 

			if(flag.length>0 || temp2!=temp3)
			{
			   alert(flag)
			}
			else
			{
                         window.scrollTo(0,0);
                          document.getElementById("boxtitle").innerHTML="<div id=\"progbar\" style=\"display:none\"><img id=\"rollimg\" src=\"/images/circleimage.gif\" /><div id=\"progmsg\">Please Wait....</div></div>"
                          document.getElementById("progbar").style.display="block"
 		            var param = "oldpassword=" + document.getElementById("oldpass").value + "&newpassword=" + document.getElementById("newpass").value
		            var updajax = new Ajax.Updater('boxtitle', '/employer/savepassword', {asynchronous: true, evalScripts: true, method: 'post', parameters: param, frequency: 0.01})
                        } 

}

////////////////////////////////////////////////////////////////////////////////////////////

function statevalue(obj)
{
	var params="country=" + obj.value
	var updajax = new Ajax.Updater('strip_sel_state', '/employer/pullstates', {
		asynchronous: true,
		method: 'get',
		parameters: params,
		evalScripts: true,
		frequency: 0.01
	})	
}
////////////////////////////////////////////////////////////////////////

function statevalueindex(obj)
{
	var params="country=" + obj.value
	var updajax = new Ajax.Updater('strip_sel_state', '/pullstates', {
		asynchronous: true,
		method: 'get',
		parameters: params,
		evalScripts: true,
		frequency: 0.01
	})	
}

////////////////////////////////////////////////////////////////////////

function fetchstate(objj)
{
  document.getElementById("state_names").value="" + objj.value
}

////////////////////////////////////////////////////////////////////////

function getcityname()
{
	var country=document.getElementById("country").value
	//var state=document.getElementById("state").value
       var state=document.getElementById("state_names").value

       if(country!=0 && state!=0)
       {
          var pars="country=" + country + "&state=" + state + "&city=" + document.getElementById("city").value;
          var message_to_auto_completer = new Ajax.Autocompleter('city', 'message_to_auto_complete1', '/employer/autolocation' , {asynchronous:true, evalScripts:true, method: 'get', parameters:pars, frequency: 0.01})	
       } 
}

/*/////////////////////////////////////////////////////////////////////////
function checkpubjob()
{

                var flag=""

		var temp1=document.getElementById("jobtitles").value
		temp1=temp1.replace(/ /g,"")
		if(temp1.length==0)
		{
			document.getElementById("jobtitles").style.background="#FFF1BF"
			flag="Please enter a job title\n"
		}
		else
		{
			document.getElementById("jobtitles").style.background="#FFFFFF"
		}

		var temp2=document.getElementById("country").selectedIndex
		if(temp2==0)
		{
			document.getElementById("country").style.background="#FFF1BF"
			flag=flag + "Please select the country\n"
		}
		else
		{
			document.getElementById("country").style.background="#FFFFFF"
		}

		var temp3=document.getElementById("state_names").value
		if(temp3==0)
		{
			document.getElementById("state").style.background="#FFF1BF"
			flag=flag + "Please select the state/region/province\n"
		}
		else
		{
			document.getElementById("state").style.background="#FFFFFF"
		}

		var temp4=document.getElementById("city").value
		temp4=temp4.replace(/ /g,"")
		if(temp4.length==0)
		{
			document.getElementById("city").style.background="#FFF1BF"
			flag=flag + "Please enter a job title\n"
		}
		else
		{
			document.getElementById("city").style.background="#FFFFFF"
		}

		var temp5=document.getElementById("industry").selectedIndex
		if(temp5==0)
		{
			document.getElementById("industry").style.background="#FFF1BF"
			flag=flag + "Please select an industry\n"
		}
		else
		{
			document.getElementById("industry").style.background="#FFFFFF"
		}

		var temp6=document.getElementById("description").value
		temp6=temp6.replace(/ /g,"")
		if(temp6.length==0)
		{
			document.getElementById("description").style.background="#FFF1BF"
			flag=flag + "Please enter the job description\n"
		}
		else
		{
			document.getElementById("description").style.background="#FFFFFF"
		}

              var temp7=document.getElementById("addval").value

              if(temp7=="0")
              {
                 var temp8=document.getElementById("address").value
                 temp8=temp8.replace(/ /g,"")
                 if(temp8.length==0)
                 {
			document.getElementById("address").style.background="#FFF1BF"
			flag=flag + "Please enter the street details\n"
                 }
                 else
                 {
			document.getElementById("address").style.background="#FFFFFF"
                 } 
              }
   
			if(flag.length>0)
			{
				alert(flag)
				return false
			}
			else
			   return true

}
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////
   function setvals(index)
   {
      document.getElementById("addval").value="" + index      
   }

////////////////////////////////////////////////////////////////////////////////////////////////////////

   function color_rating(index)
   {
       var color=""

/*       if(index==1)
         color="#cc002b"
       else if(index==2)
         color="#f2984c"
       else if(index==3)
         color="#ffff66"
       else if(index==4)
         color="#caf99b"
       else if(index==5)
         color="#00ff80"
       else
         color="#2276F4"
*/

       if(index==1)
         color="#FA5858"
       else if(index==2)
         color="#FAAC58"
       else if(index==3)
         color="#F4FA58"
       else if(index==4)
         color="#caf99b"
       else if(index==5)
         color="#00ff80"
       else
         color="#2276F4"


      for(i=1;i<7;i++)
       {
           if(i<=index)
           {
            document.getElementById("color" + i).style.backgroundColor=color;          
           }  
       }

       if(index==1)
        document.getElementById("texttype").innerHTML="SPAM"
       else if(index==2)
        document.getElementById("texttype").innerHTML="V BAD"
       else if(index==3)
        document.getElementById("texttype").innerHTML="BAD"
       else if(index==4)
        document.getElementById("texttype").innerHTML="Fair"
       else if(index==5)
        document.getElementById("texttype").innerHTML="Good"
       else
        document.getElementById("texttype").innerHTML="V Good" 
   }

////////////////////////////////////////////////////////////////////////////////////////////////////////
  function color_fade()
  {
      for(i=1;i<7;i++)
         document.getElementById("color" + i).style.backgroundColor="#ffffff"; 

      document.getElementById("texttype").innerHTML="Double click on boxes to rate this post"         
  }
//////////////////////////////////////
function switches_content(num)
{
        for(i=1;i<6;i++)
        {
           if(i==num)
            {
              document.getElementById("small_" + i).style.display="block"
	       var tempobj=document.getElementById("menu_" + i).parentNode
	       tempobj=tempobj.parentNode
	       tempobj.id="active"
              document.getElementById("text_" + i).style.color="#000000" 

                if(num==5)
                  indexer=1
                else  
                  indexer=i+1
            }
           else
            {
              document.getElementById("small_" + i).style.display="none"
	       var tempobj=document.getElementById("menu_" + i).parentNode
	       tempobj=tempobj.parentNode
	       tempobj.id=""
              document.getElementById("text_" + i).style.color="#666666"
              //indexer=i
            }
        }

        document.getElementById("start1").style.display="block"
        document.getElementById("start2").style.display="none"
       clearTimeout(threadd); 
       threadd=setTimeout('keeprolls()',2000)
}
///////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////
function backward1()
{
  var inddex=whichone1()

   if(inddex==1)
    inddex=5
   else
    inddex=inddex-1

        document.getElementById("start1").style.display="block"
        document.getElementById("start2").style.display="none"

  clearTimeout(threadd);
  indexer=inddex 
  switcher_content1(inddex)
}
/////////////////////////////////////////////////////////////////////////////////////////////
function switcher_content1(num)
{
        for(i=1;i<6;i++)
        {
           if(i==num)
            {
              document.getElementById("small_" + i).style.display="block"
	       var tempobj=document.getElementById("menu_" + i).parentNode
	       tempobj=tempobj.parentNode
	       tempobj.id="active"
              document.getElementById("text_" + i).style.color="#000000" 
            }
           else
            {
              document.getElementById("small_" + i).style.display="none"
	       var tempobj=document.getElementById("menu_" + i).parentNode
	       tempobj=tempobj.parentNode
	       tempobj.id=""
              document.getElementById("text_" + i).style.color="#666666"
            }
        }
       clearTimeout(threadd); 
       threadd=setTimeout('keeprolls1()',2000)
}
/////////////////////////////////////////////////////////////////////////////////////////////
function forward1()
{

  var inddex=whichone1()

   if(inddex==5)
    inddex=1
   else
    inddex=inddex+1

        document.getElementById("start1").style.display="block"
        document.getElementById("start2").style.display="none"

  clearTimeout(threadd); 
  indexer=inddex
  switcher_content1(inddex)
}
/////////////////////////////////////////////////////////////////////////////////////////////

  function whichone1()
  {
     var inddex=0;

        for(i=1;i<6;i++)
        {
           var tobj=document.getElementById("small_" + i)
             if(tobj.style.display=="block")
             {
               inddex=i
               break
             } 
        }

    return inddex
  }

/////////////////////////////////////////////////////////////////////////////////////////////
function startstop1()
{
 var tempp=document.getElementById("start1")

   if(tempp.style.display=="block")
     {
        document.getElementById("start1").style.display="none"
        document.getElementById("start2").style.display="block"
        clearTimeout(threadd);
     }
   else
     {
        document.getElementById("start1").style.display="block"
        document.getElementById("start2").style.display="none"
        switches_content1(indexer)
     }

}
/////////////////////////////////////////////////////////////////////////////////////////////
    function keeprolls1()
    {
        for(i=1;i<6;i++)
        {
           if(i==indexer)
            {
              document.getElementById("small_" + i).style.display="block"
	       var tempobj=document.getElementById("menu_" + i).parentNode
	       tempobj=tempobj.parentNode
	       tempobj.id="active"
              document.getElementById("text_" + i).style.color="#000000" 
            }
           else
            {
              document.getElementById("small_" + i).style.display="none"
	       var tempobj=document.getElementById("menu_" + i).parentNode
	       tempobj=tempobj.parentNode
	       tempobj.id=""
              document.getElementById("text_" + i).style.color="#666666"
            }
        }
       indexer=indexer+1
       if(indexer==6)
         indexer=1

       threadd=setTimeout('keeprolls1()',2000)
    }
 
//////////////////////////////////////
function switches_content1(num)
{
        for(i=1;i<6;i++)
        {
           if(i==num)
            {
              document.getElementById("small_" + i).style.display="block"
	       var tempobj=document.getElementById("menu_" + i).parentNode
	       tempobj=tempobj.parentNode
	       tempobj.id="active"
              document.getElementById("text_" + i).style.color="#000000" 

               if(num==5)
                 indexer=1
               else
                 indexer=i+1
            }
           else
            {
              document.getElementById("small_" + i).style.display="none"
	       var tempobj=document.getElementById("menu_" + i).parentNode
	       tempobj=tempobj.parentNode
	       tempobj.id=""
              document.getElementById("text_" + i).style.color="#666666"
              //indexer=i
            }
        }
        
        document.getElementById("start1").style.display="block"
        document.getElementById("start2").style.display="none"
       clearTimeout(threadd); 
       threadd=setTimeout('keeprolls1()',2000)
}
///////////////////////////////////////////////////////////////////////////////////////////////////////
function onBlur() {
       statusflg=0
};

function onFocus(){
  try{
   if(document.getElementById("invlink").value==1)
    {
        if(statusflg==0)
        {            
            statusvalue(getCookie('messenger').split("~")[2])  
            statusflg=statusflg+1
        }        
    }
   }catch(ep){}
};

if (/*@cc_on!@*/false) { // check for Internet Explorer
	document.onfocusin = onFocus;
	document.onfocusout = onBlur;
} else {
	window.onfocus = onFocus;
	window.onblur = onBlur;
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////

function fetchstatus()
{
  var valcook=getCookie('messenger')
  if(valcook)
   {
     if(valcook.length>0)
      {
        var strvalue=valcook
        tempstatus=strvalue.split("~")
        statusvalue(tempstatus[2]) 
      } 
   }
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////
       function openwind()
       {  
          //name=window.opener  
          //// if(getCookie('windpop')==null || getCookie('windpop')=="")
            {  
              try{
                   windd=window.open('http://messenger.lucidjobs.com', 'printview', 'width=' + screen.width + ', height=' + screen.height + ', resizable=1,scrollbars=yes,toolbar=0, scrollbars=0, menubar=0')
                 }
                 catch(errr){alert("Another instance of messenger is open, please close it")} 
           //myRef = window.open('http://messenger.lucidjobs.com/messenger.html','mywin','left=20,top=20,width=500,height=500,toolbar=1,resizable=0');
//myRef.focus();
             //window.open('http://messenger.lucidjobs.com/messenger.html', 'PrintView', 'width=' + screen.width + ', height=' + screen.height + ', resizable=1,scrollbars=yes,toolbar=0, scrollbars=1, menubar=0, location=0')              
                 str=""

                 for(i=0;i<8;i++)
                   str=str + Math.floor(Math.random()*10)

              set_cookie(1)
              stat_changer(1)
              set_messenger_id(str)
              document.getElementById("messgr_text1").innerHTML="<img id=\"messicon\" src=\"http://www.lucidjobs.com/images/icon_available.png\" />"
              document.getElementById("messgr_text2").innerHTML="Online"
              document.getElementById("messgr_text3").style.display="none"
            } 
       }

///////////////////////////////////////////////////////////////////////////////////////////////////////////////

function set_cookie(value)
{
    var date = new Date();

     if(value==0)  
      {
         date.setTime(date.getTime()+(-1*24*60*60*1000));
         var expires = "; expires=" + date.toGMTString();       
         document.cookie = 'windpop' + "=" + "0" + expires + "; path=/; domain=.lucidjobs.com"       
      }
      else 
      {
       date.setTime(date.getTime()+(1*24*60*60*1000));
       var expires = "; expires=" + date.toGMTString();
       document.cookie = 'windpop' + "=" + "1"  + "; path=/; domain=.lucidjobs.com"
      } 
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
   function set_messenger_id(str)
   {


              ////var updajax=new Ajax.Updater('dummys', '/messengerid?value=' + str, {asynchronous:true, evalScripts:true, method: 'get', frequency: 0.01}) 
          try{
                 var updajax=new Ajax.Updater('dummys', '/messengerid?value=' + str, {asynchronous:true, evalScripts:true, method: 'get', frequency: 0.01})
             }catch(er){
		               $("#dummys").load('/messengerid?value=' + str);
                       }


   }

///////////////////////////////////////////////////////////////////////////////////////////////////////////////

  function stat_changer(j)
  {  
        var valcook=getCookie('messenger') 
            if(valcook)
            {
              try{
                    if(valcook.length>0) 
                     {
                       try{   
                             var updajax=new Ajax.Updater('dummys', '/changestatus?status=' + j, {asynchronous:true, evalScripts:true, method: 'get', frequency: 0.01}) 
                          }catch(tt){
                                       $("#dummys").load('/changestatus?status=' + j);
                                    }
                     }
                 }catch(err){}
            }
  }

///////////////////////////////////////////////////////////////////////////////////////////////////////////////

function statusvalue(i)
{

  try{
        if(i)
	 {
	   if(i=="unavailable")
	    {
	     	   if(!hilite_threadd)
		      hilite_threadd=setTimeout("colorscript()",300)

	     document.getElementById("messgr_text1").innerHTML="<img id=\"messicon\" src=\"http://www.lucidjobs.com/images/icon_unavailable.png\" />"
	     document.getElementById("messgr_text2").innerHTML="<div id=\"smalldiv\"></div>Offline"
	     document.getElementById("messgr_text3").style.display="block"
            stat_changer(0)
	    }
	   else
	    {
	     sstr="http://www.lucidjobs.com/images/icon_" + i + ".png"
	     document.getElementById("messgr_text1").innerHTML="<img id=\"messicon\" src=\"" + sstr + "\" />"
	     document.getElementById("messgr_text3").style.display="none"            

	     	   if(hilite_threadd)
                  {
		      clearTimeout(hilite_threadd)
                    hilite_threadd=null
                  }

		document.getElementById("messgr_text2").style.color="#ffffff"
              //document.getElementById("messgr_text2").firstChild.style.color="#ff8313"

	       if(i=="available")
	       {
	        document.getElementById("messgr_text2").innerHTML="<div id=\"smalldiv\"></div>Online"
       	 stat_changer(1)
	       }
       	else if(i=="away")
	       {
       	 document.getElementById("messgr_text2").innerHTML="<div id=\"smalldiv\"></div>Away"
	        stat_changer(2)
       	}
	       else if(i=="dnd")
       	{
	        document.getElementById("messgr_text2").innerHTML="<div id=\"smalldiv\"></div>Busy"
       	 stat_changer(3)
	       }
	       else
       	{
	       document.getElementById("messgr_text2").innerHTML="<div id=\"smalldiv\"></div>Extended Away"
       	 stat_changer(4)
       	}

      	     }  
          }
    }
   catch(eer){}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////
function setcvmode(index)
{
  $("#boxtitle").load('/seeker/setcvmode?id=' + index);
}

////////////////////////////////////////////
function setmode(index)
{
  //document.getElementById("resumemode").value=index
  $("#boxtitle").load('/seeker/setresumemode?id=' + index);

}


////////////////////////////////////////////
function pullresume()
{
   var temp=parseInt(document.getElementById("resumemode").value)
   var tempp="" 
   if(temp==0)
   {
     tempp="<div id=\"bigtitles\">Contact Details</div><br/>" + document.getElementById("contact").value.replace(/\n/g,"<br />") + "<br/><br/>"
   }    

   if(temp==2)
   {
     document.getElementById("strips_reg").innerHTML=""
   }
    
   if(temp==0 || temp==2)
   {
          tempp=tempp + "<div id=\"bigtitles\">Resume</div><br/>" + document.getElementById("resume").value.replace(/\n/g,"<br />") + "<br/><br/>"
          if(document.getElementById("reference").value.replace(/ /g,"").length>0) 
          tempp=tempp + "<div id=\"bigtitles\">Reference</div><br/>" + "<br/><br/>" + document.getElementById("reference").value.replace(/\n/g,"<br />")
          document.getElementById("strips_reg").innerHTML=tempp

   } 
   else
   {
         document.getElementById("strips_reg").innerHTML=""
         document.getElementById("strips_reg").innerHTML="You have set your resume visibility to \"Not Searchable\" and hence employers cannot view your resume";
   }

}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////
 
    function fetchcalreminder()
    {
                 d=new Date();
                 d=new Date(d.toGMTString())
                 d.setDate(d.getDate()+1)

		   var checkdate="" + d.getFullYear() + "-" + (d.getMonth() + 1) + "-" + d.getDate()

          try{
                  var updajax=new Ajax.Updater('caldummy', '/reminders?fdate=' + checkdate, {asynchronous:true, evalScripts:true, method: 'get', frequency: 0.01})
             }catch(er)
             {
		  $("#caldummy").load('/reminders?fdate=' + checkdate); 
             }
                       
       try{
             clearTimeout(popthread)
          }catch(err){}        
         
       try{
        clearTimeout(remthread)
          }catch(err){}

       try{
        remthread=setTimeout("fetchcalreminder()",15*60000)
          }catch(err){}
    }

////////////////////////////////////////////////////////////////////////////
   function showcalen()
   {
       list_of_alert="List of Events Scheduled [View detailed information in ATS]\n\n"
       todcount=0

       for(i=0;i<reminderss.length;i++)
       {
          d1=new Date(reminderss[i])
          d1=new Date(d1.toString())
          d2=new Date()

            todstr=d2.getFullYear() + "-" + d2.getMonth() + d2.getDate()
            datstr=d1.getFullYear() + "-" + d1.getMonth() + d1.getDate()

            if(datstr==todstr)
             {
                  list_of_alert=list_of_alert + msg_reminder[i].replace("Reminder","Event") + "\n"
             }
       } 
 
         if(list_of_alert.length>0)
          alert(list_of_alert) 

   }
////////////////////////////////////////////////////////////////////////////
   function checkcalreminder()
   {
       list_of_alert=""
       cal_id_alert=""  
       todcount=0

       for(i=0;i<reminderss.length;i++)
       {
          d1=new Date(reminderss[i])
          d1=new Date(d1.toString())
          d2=new Date()

            if(d2>=d1)
             {
                  list_of_alert=list_of_alert + msg_reminder[i] + "\n"
                  cal_id_alert=cal_id_alert + cal_reminder[i] + ","
             }

            todstr=d2.getFullYear() + "-" + d2.getMonth() + d2.getDate()
            datstr=d1.getFullYear() + "-" + d1.getMonth() + d1.getDate()

            if(datstr==todstr)
             todcount=todcount + 1
       }      

         if(todcount>0)
          {
            if(document.getElementById("room_mate_loggedin"))
             {
                document.getElementById("sub_header").innerHTML="<div id=\"menu\">" + document.getElementById("menu").innerHTML + "</div><div id=\"toptext\"><img onclick=\"showcalen()\" id=\"imgcal\" src=\"http://www.lucidjobs.com/images/calendar_icon.png\"/></div> <div id=\"toptext\">( " + todcount + " )</div><div id=\"room_mate_loggedin\">" + document.getElementById("room_mate_loggedin").innerHTML + "</div>"
             }
            else if(document.getElementById("seekerarea"))
            {
                document.getElementById("sub_header").innerHTML="<div id=\"menu\">" + document.getElementById("menu").innerHTML + "</div><div id=\"toptext\"><img onclick=\"showcalen()\" id=\"imgcal\" src=\"http://www.lucidjobs.com/images/calendar_icon.png\"/></div> <div id=\"toptext\">( " + todcount + " )</div><div id=\"seekerarea\">" + document.getElementById("seekerarea").innerHTML + "</div>"
            }
            else if(document.getElementById("employerarea")) 
            {
                document.getElementById("sub_header").innerHTML="<div id=\"menu\">" + document.getElementById("menu").innerHTML + "</div><div id=\"toptext\"><img onclick=\"showcalen()\" id=\"imgcal\" src=\"http://www.lucidjobs.com/images/calendar_icon.png\"/></div> <div id=\"toptext\">( " + todcount + " )</div><div id=\"employerarea\">" + document.getElementById("employerarea").innerHTML + "</div>"
            } 
            else 
            document.getElementById("sub_header").innerHTML="<div id=\"menu\">" + document.getElementById("menu").innerHTML + "</div><div id=\"toptext\"><img onclick=\"showcalen()\" id=\"imgcal\" src=\"http://www.lucidjobs.com/images/calendar_icon.png\"/></div> <div id=\"toptext\">( " + todcount + " )</div><div id=\"emp_seeker_login\"></div>"
          }
         else
          {
            if(document.getElementById("room_mate_loggedin"))
             {
                document.getElementById("sub_header").innerHTML="<div id=\"menu\">" + document.getElementById("menu").innerHTML + "</div><div id=\"room_mate_loggedin\">" + document.getElementById("room_mate_loggedin").innerHTML + "</div>"
             }
            else if(document.getElementById("seekerarea"))
            {
                document.getElementById("sub_header").innerHTML="<div id=\"menu\">" + document.getElementById("menu").innerHTML + "</div><div id=\"seekerarea\">" + document.getElementById("seekerarea").innerHTML + "</div>"
            }
            else if(document.getElementById("employerarea")) 
            {
                document.getElementById("sub_header").innerHTML="<div id=\"menu\">" + document.getElementById("menu").innerHTML + "</div><div id=\"employerarea\">" + document.getElementById("employerarea").innerHTML + "</div>"
            } 
            else 
            document.getElementById("sub_header").innerHTML="<div id=\"menu\">" + document.getElementById("menu").innerHTML + "</div><div id=\"emp_seeker_login\"></div>"
          }

          if(list_of_alert.length>0)
          {
            alert(list_of_alert)
            //$("#caldummy").load('http://www.lucidjobs.com/removalert?remid=' + cal_id_alert);
            
          try{
                  var updajax=new Ajax.Updater('caldummy', '/removalert?remid=' + cal_id_alert, {asynchronous:true, evalScripts:true, method: 'get', frequency: 0.01})
             }catch(er)
             {
		  $("#caldummy").load('/removalert?remid=' + cal_id_alert); 
             }            
            
          }


        popthread=setTimeout("checkcalreminder()",60000)
   }
////////////////////////////////////////////////////////////////////////////
function savemailoption()
{
                          window.scrollTo(0,0); 
                          document.getElementById("boxtitle").innerHTML="<div id=\"progbar\" style=\"display:none\"><img id=\"rollimg\" src=\"/images/circleimage.gif\" /><div id=\"progmsg\">Please Wait....</div></div>"
                          document.getElementById("progbar").style.display="block"
		            var updajax = new Ajax.Updater('boxtitle', '/seeker/savemailpref?id=' + document.getElementById("jobalerts").value, {asynchronous: true, evalScripts: true, method: 'get', frequency: 0.01})
}

//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////

function changemailpref(name,idd)
{
                          window.scrollTo(0,0); 
                          document.getElementById("boxtitle").innerHTML="<div id=\"progbar\" style=\"display:none\"><img id=\"rollimg\" src=\"/images/circleimage.gif\" /><div id=\"progmsg\">Please Wait....</div></div>"
                          document.getElementById("progbar").style.display="block"
		            var updajax = new Ajax.Updater('boxtitle', '/seeker/mailprefsave?name=' + name + "&index=" + idd + "&value="+ document.getElementById(name.toLowerCase()).value, {asynchronous: true, evalScripts: true, method: 'get', frequency: 0.01})
}

//////////////////////////////////////////////////////////////////////////////////////////////

function empchangemailpref(name,idd)
{
                          window.scrollTo(0,0); 
                          document.getElementById("boxtitle").innerHTML="<div id=\"progbar\" style=\"display:none\"><img id=\"rollimg\" src=\"/images/circleimage.gif\" /><div id=\"progmsg\">Please Wait....</div></div>"
                          document.getElementById("progbar").style.display="block"
		            var updajax = new Ajax.Updater('boxtitle', '/employer/mailprefsave?name=' + name + "&index=" + idd + "&value="+ document.getElementById(name.toLowerCase()).value, {asynchronous: true, evalScripts: true, method: 'get', frequency: 0.01})
}

//////////////////////////////////////////////////////////////////////////////////////////////
function  listoption(ii)
{
  emails=document.getElementById("username" + ii).value.replace(/ /g,"")
  chkflag=validatemail(emails)
  if(chkflag==0)
    window.location='/mailinglist?id=' + emails + "&value=" + ii
}

/////////////////////////////////////////////////////////////////////////////////////////////

   function hidebox(obj,img)
   {
     if(document.getElementById(obj).style.display=="block")
      {
       document.getElementById(obj).style.display="none"
       document.getElementById(img).src="http://www.lucidjobs.com/images/plus.gif"
      }
     else
      {
       document.getElementById(obj).style.display="block"
       document.getElementById(img).src="http://www.lucidjobs.com/images/minus.gif"
      }
   }
///////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////
function seltstates(obj)
{
  if(obj.value>0)
  {
           var updajax=new Ajax.Updater('profile_text_state', '/seeker/fetchstates?id=' + obj.value, {asynchronous:true, evalScripts:true, method: 'get', frequency: 0.01})
           /////$("#profile_text_state").load('/seeker/fetchstates?id=' + obj.value);
  }
  else
  {
    document.getElementById("states").options.length=1
    document.getElementById("city").options.length=1
  }
}

////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////

function seltcities(obj)
{
  if(obj.value>0)
  {
           var updajax=new Ajax.Updater('profile_text_city', '/seeker/fetchcities?id=' + obj.value, {asynchronous:true, evalScripts:true, method: 'get', frequency: 0.01})
           ////$("#profile_text_city").load('/seeker/fetchcities?id=' + obj.value);
  }
  else
  {
    document.getElementById("city").options.length=1
  }
}

////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////

function savemainoption()
{
                          window.scrollTo(0,0); 
                          document.getElementById("boxtitle").innerHTML="<div id=\"progbar\" style=\"display:none\"><img id=\"rollimg\" src=\"/images/circleimage.gif\" /><div id=\"progmsg\">Please Wait....</div></div>"
                          document.getElementById("progbar").style.display="block"
		            var updajax = new Ajax.Updater('boxtitle', '/seeker/savemainpref?id=' + document.getElementById("mainalerts").value, {asynchronous: true, evalScripts: true, method: 'get', frequency: 0.01})
}
//////////////////////////////////////////////////////////////////////////////////////////////
function saveprofile()
{
	    var flag=""

		var temp1=document.getElementById("fname").value
		temp1=temp1.replace(/ /g,"")
		if(temp1.length==0)
		{
			document.getElementById("fname").style.background="#FFF1BF"
			flag="Please enter your first name\n"
		}
		else
		{
			document.getElementById("fname").style.background="#FFFFFF"
		}

		var temp2=document.getElementById("lname").value
		temp2=temp2.replace(/ /g,"")
		if(temp2.length==0)
		{
			document.getElementById("lname").style.background="#FFF1BF"
			flag=flag + "Please enter your last name\n"
		}
		else
		{
			document.getElementById("lname").style.background="#FFFFFF"
		}

		/*var temp3=document.getElementById("nickname").value
		temp3=temp3.replace(/ /g,"")
		if(temp3.length==0)
		{
			document.getElementById("nickname").style.background="#FFF1BF"
			flag=flag + "Please enter your nick name\n"
		}
		else
		{
			document.getElementById("nickname").style.background="#FFFFFF"
		}*/

		var temp4=document.getElementById("location").value

		if(temp4.value=="0")
		{
			document.getElementById("location").style.background="#FFF1BF"
			flag=flag + "Please select your location\n"
		}
		else
		{
			document.getElementById("location").style.background="#FFFFFF"
		}

			if(flag.length>0)
			{
			   alert(flag)
			}
			else
			{
                          window.scrollTo(0,0); 
                          document.getElementById("boxtitle").innerHTML="<div id=\"progbar\" style=\"display:none\"><img id=\"rollimg\" src=\"/images/circleimage.gif\" /><div id=\"progmsg\">Please Wait....</div></div>"
                          document.getElementById("progbar").style.display="block"

                          var reloc=0
                          if(document.getElementById("reloc2").checked)
                            reloc=1

 		            var param = "fname=" + document.getElementById("fname").value + "&lname=" + document.getElementById("lname").value
                          param=param + "&nickname=" + document.getElementById("nickname").value + "&phone=" + document.getElementById("phone").value + "&country=" + document.getElementById("location").options[document.getElementById("location").selectedIndex].value
                          param=param + "&state=" + document.getElementById("states").options[document.getElementById("states").selectedIndex].value + "&city=" + document.getElementById("city").options[document.getElementById("city").selectedIndex].value  + "&reloc=" + reloc
		            var updajax = new Ajax.Updater('boxtitle', '/seeker/saveaccount', {asynchronous: true, evalScripts: true, method: 'get', parameters: param, frequency: 0.01})
                     }  

}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function saveempmainoption()
{
                          window.scrollTo(0,0); 
                          document.getElementById("boxtitle").innerHTML="<div id=\"progbar\" style=\"display:none\"><img id=\"rollimg\" src=\"/images/circleimage.gif\" /><div id=\"progmsg\">Please Wait....</div></div>"
                          document.getElementById("progbar").style.display="block"
		            var updajax = new Ajax.Updater('boxtitle', '/employer/savemainpref?id=' + document.getElementById("mainalerts").value, {asynchronous: true, evalScripts: true, method: 'get', frequency: 0.01})
}

//////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////
    function clearrand()
    {
       $("#randid").val("")
    }
////////////////////////////////////////////////////////////////////////////////////////////
    function eclearrand()
    {
       $("#erandid").val("")
    }
////////////////////////////////////////////////////////////////////////////////////////////
    function vidclearrand(index)
    {
       $("#vrandid1").val("")
       $("#vrandid2").val("")
       $("#vrandid3").val("")

       for(i=1;i<4;i++)
       {
          if(i==index)
          {
             document.getElementById("outbox" + i).style.display="block"
          }
          else
          {
             document.getElementById("outbox" + i).style.display="none"
          }  
       }

    }
////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////
    function del_edu(rand_id)
    {
       var fRet; 

         msg='Are you sure you want to delete this?'

       fRet = confirm(msg); 
                            
       if(fRet==true) 
        {
          trigger(3)
          window.location="http://usa.lucidjobs.com/seeker/onlineprofile?remedu=" + rand_id 
        }
       else
         return false;
    } 
////////////////////////////////////////////////////////////////////////////////////////////
    function del_work(rand_id)
    {
       var fRet; 

         msg='Are you sure you want to delete this?'

       fRet = confirm(msg); 
                            
       if(fRet==true) 
        {
          trigger(3)
          window.location="http://usa.lucidjobs.com/seeker/onlineprofile?remwork=" + rand_id 
        }
       else
         return false;
    } 
////////////////////////////////////////////////////////////////////////////////////////////
    function del_video(rand_id)
    {
       var fRet; 

         msg='Are you sure you want to delete this?'

       fRet = confirm(msg); 
                            
       if(fRet==true) 
        {
          trigger(3)
          window.location="http://usa.lucidjobs.com/seeker/onlineprofile?remvideo=" + rand_id 
        }
       else
         return false;
    }    
////////////////////////////////////////////////////////////////////////////////////////////
    function editvideo(rand_id,index)
    {
       $("#vrandid" + index).val(rand_id)

      if(index==1)  
      {
        $("#videolink").val($("#var_" + rand_id).val())
        $("#videotitle").val($("#url_" + rand_id).html())
      }
      else if(index==2)
      {
        $("#twitname").val($("#objnam_" + rand_id).html())
      }
      else
      {
        var decod=$("#var_" + rand_id).val().replace(/&quote;/g,"\'")
        $("#slidelink").val(decod)
        //$("#slidelink").val($("#var_" + rand_id).val())        
        $("#slidetitle").val($("#objnam_" + rand_id).html())
      } 

       for(i=1;i<4;i++)
       {
          if(i==index)
          {
             document.getElementById("outbox" + i).style.display="block"
          }
          else
          {
             document.getElementById("outbox" + i).style.display="none"
          }  
       }        

       trigger(4)
    }
////////////////////////////////////////////////////////////////////////////////////////////

    function editwork(rand_id)
    {
       $("#randid").val(rand_id)
       $("#cname").val($("#workcompany_" + rand_id).html())
       $("#title").val($("#comp_" + rand_id).html())
       $("#sdate").val($("#workstart_" + rand_id).html().replace("(","").replace("-","").replace(/ /g,""))
       if($("#workend_" + rand_id).html()!="Present)")
       $("#edate").val($("#workend_" + rand_id).html().replace(")",""))

     try{ 
        
         if(navigator.appName=="Netscape")
           tempp=$("#workdesc_" + rand_id).html().replace(/\n/g,"").replace(/<br>/g,"\n").split("\n") 
         else
           tempp=$("#workdesc_" + rand_id).html().replace(/\n/g,"").replace(/<BR>/g,"\n").split("\n")

         temmp=""
         flag=0 

         for(k=0;k<tempp.length;k++)
          {
              if(tempp[k].replace(/ /g,"").length==0)
              {
                flag=flag+1
              }
              else
              {
                 flag=0
              }

              if(flag<2)
              {
                temmp=temmp + tempp[k] + "\n"   
              } 

          }

       $("#cdesc").val(temmp)
        }catch(errr){$("#cdesc").val("")}
       trigger(1)
    }
////////////////////////////////////////////////////////////////////////////////////////////
    function editedu(rand_id)
    {
       $("#erandid").val(rand_id)
       $("#degree").val($("#educompany_" + rand_id).html())        
       $("#ename").val($("#univ_" + rand_id).html())
       $("#esdate").val($("#edustart_" + rand_id).html().replace("(","").replace("-","").replace(/ /g,""))
       if($("#eduend_" + rand_id).html()!="Present)")
       $("#eedate").val($("#eduend_" + rand_id).html().replace(")",""))

     try{ 

         tempp=$("#edudesc_" + rand_id).html().replace(/\n/g,"").replace(/<br>/g,"\n").replace(/<BR>/g,"\n").split("\n")
         temmp=""

         flag=0 
         for(k=0;k<tempp.length;k++)
          {
              if(tempp[k].replace(/ /g,"").length==0)
              {
                flag=flag+1
              }
              else
              {
                 flag=0
              }

              if(flag<2)
              {
                temmp=temmp + tempp[k] + "\n"   
              } 

          }

          $("#edesc").val(temmp)
        }catch(errr){$("#edesc").val("")} 


       trigger(2)
    }
////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////

function limitChars(textid, limit, infodiv)
    {
	var text = $('#'+textid).val(); 
	var textlength = text.length;
	if(textlength > limit)
	{
	  $('#' + infodiv).html('(You cannot write more then '+limit+' characters!)');
	  $('#'+textid).val(text.substr(0,limit));
          return false;
         }
         else
         {
           $('#' + infodiv).html('(You have '+ (limit - textlength) +' characters left.)');
           return true;
          }
      }

/////////////////////////////////////////////////////////////////////////////////////////////

function getprofiledata()
{
   $("#hidsummary").val($("#summary").val())
   $("#hidaddinfo").val($("#addinfo").val())
   $("#hidspecial").val($("#speciality").val())
   trigger(3) 
}

/////////////////////////////////////////////////////////////////////////////////////////////
function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}
/////////////////////////////////////////////////////////////////////////////////////////////

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}
/////////////////////////////////////////////////////////////////////////////////////////////

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
/////////////////////////////////////////////////////////////////////////////////////////////

function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}
/////////////////////////////////////////////////////////////////////////////////////////////

function isDate(dtStr){
	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strMonth=dtStr.substring(0,pos1)
	//var strDay=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos1+1)
	strYr=strYear
	//if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	//day=parseInt(strDay)
	year=parseInt(strYr)
	/*if (pos1==-1 || pos2==-1){
		//alert("The date format should be : mm/dd/yyyy")
		return false
	}*/
	if (strMonth.length<1 || month<1 || month>12){
		//alert("Please enter a valid month")
		return false
	}
	/*if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		//alert("Please enter a valid day")
		return false
	}*/
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		//alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear)
		return false
	}
	/*if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		//alert("Please enter a valid date")
		return false
	}*/
return true
}

/////////////////////////////////////////////////////////////////////////////////////////////

function checkdates(sdate,edate)
{

  tempd=sdate.split("/")
  var d1 = new Date(tempd[1], tempd[0]-1, 1, 0, 0, 0, 0);

  tempd=edate.split("/")
  var d2 = new Date(tempd[1], tempd[0]-1, 1, 0, 0, 0, 0);

  if(d2>=d1)
   return 1 
  else
   return 0

}

/////////////////////////////////////////////////////////////////////////////////////////////
function getcompanydata()
{
cname=$("#cname").val().replace(/ /g,"")
title=$("#title").val().replace(/ /g,"")
sdate=$("#sdate").val().replace(/ /g,"")
edate=$("#edate").val().replace(/ /g,"")

      if(cname.length>0 && title.length>0 && isDate(sdate) && (isDate(edate) || edate.length==0))
       {
          cdate=checkdates(sdate,edate)
          if(cdate==1 || edate.length==0)
          {
            trigger(3)
            return true
          }
          else
          {
          alert("End date must be equal to  or greater than start date") 
          return false 
          } 
       }       
      else
       {
          alert("Incomplete Data") 
          return false 
       }
}
//////////////////////////////////////////////////////////////////////////////////////////////////

function getunivdata()
{
title=$("#ename").val().replace(/ /g,"")
cname=$("#degree").val().replace(/ /g,"")
sdate=$("#esdate").val().replace(/ /g,"")
edate=$("#eedate").val().replace(/ /g,"")

      if(cname.length>0 && title.length>0 && isDate(sdate) && (isDate(edate) || edate.length==0))
       {
          cdate=checkdates(sdate,edate)
          if(cdate==1 || edate.length==0)
          {
            trigger(3)
            return true
          }
          else
          {
          alert("End date must be equal to  or greater than start date") 
          return false 
          }
       }       
      else
       {
          alert("Incomplete Data") 
          return false 
       }
}
//////////////////////////////////////////////////////////////////////////////////////////////////
    function webcvcheck(obj)
    {
      var v = new RegExp();
      v.compile("^[A-Za-z]+://[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$");
      var field=document.getElementById(obj)
      var flag=0

      if (!v.test(field.value))
         flag=0
      else
       {
          var chk=field.value.replace(/ /g,"").split(".")
           if(chk.length>2)
           {
             if(field.value.charAt(field.value.length-1)!="." && field.value.charAt(field.value.length-2)!="." && field.value.substr(0,7)=="http://")
               flag=1
             else
               flag=0
           }
           else
           {
               flag=0
           }
       }
        if(flag==0)
          return 0
        else
          return 1      
    }

///////////////////////////////////////////////////////////////////////////////////////////////////
function getvideodata()
{
  if(webcvcheck('videolink')==1)
  { 
     if($("#videolink").val().replace(/ /g,"").length>0 && $("#videotitle").val().replace(/ /g,"").length>0 && document.getElementById("videolink").value.indexOf("youtube.com/watch?")!=-1)
      {
        $("#videolink").val($("#videolink").val().replace(/ /g,"")) 
        trigger(3)
        return true
      } 
      else
       {
          alert("Incomplete Data") 
          return false 
       }
  }
  else
  {
          alert("Youtube link must start with  http://")  
          return false 
  }
}
/////////////////////////////////////////////////////////////////////////////////////////////////////

function gettwitter()
{
     if($("#twitname").val().replace(/ /g,"").length>0)
      {
        trigger(3)
        return true
      } 
      else
       {
          alert("Incomplete Data") 
          return false 
       }
}

/////////////////////////////////////////////////////////////////////////////////////////////

function getslideshare()
{
  if(webcvcheck('slidelink')==1)
  {
     if($("#slidetitle").val().replace(/ /g,"").length>0 && $("#slidelink").val().replace(/ /g,"").length>0)
      {
        $("#slidelink").val($("#slidelink").val().replace(/ /g,""))
        trigger(3)
        return true
      } 
      else
       {
          alert("Incomplete Data") 
          return false 
       }
  }
  else
  {
          alert("Youtube link must start with  http://")  
          return false 
  }
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////
function resumestates(obj)
{
  if(obj.value>0)
  {
     //var updajax=new Ajax.Updater('roomtext_state', '/seeker/fetchstates?id=' + obj.value, {asynchronous:true, evalScripts:true, method: 'get', frequency: 0.01})
     $("#roomtext_state").load('/seeker/myskillstates?id=' + obj.value);
  }
  else
  {
    document.getElementById("stateval").options.length=1
    document.getElementById("cityval").options.length=1
  }
}

//////////////////////////////////////////////////////////////////////////

function resumecities(obj)
{
  if(obj.value>0)
  {
     //var updajax=new Ajax.Updater('roomtext_city', '/seeker/fetchcities?id=' + obj.value, {asynchronous:true, evalScripts:true, method: 'get', frequency: 0.01})
     $("#roomtext_city").load('/seeker/myskillcity?id=' + obj.value);
  }
  else
  {
    document.getElementById("cityval").options.length=1
  }
}

//////////////////////////////////////////////////////////////////////////

function checkskillsdata()
{
  var flag=0
  if($("#mustkey").val().replace(/ /g,"").length>0)
   flag=flag+1
  if($("#goodkey").val().replace(/ /g,"").length>0)
   flag=flag+1

  if(flag>0)
   {
       if(document.getElementById("alerts").checked)
          document.getElementById("alertflag").value="0"
	else
          document.getElementById("alertflag").value="1"

     return true
   }
  else
   {
     alert("Error! You need to provide atleast one keyword")
     return false
   } 
}