function rand() {
   return Math.floor(Math.random()*2147483647); 
}

//getCookie

function getCookie(name) 
{
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) 
  {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

function isEmail(emailError) {
   var positionOfAt;
   var positionOfat;
   positionOfAt = emailError.indexOf('@',1);
   positionOfat = emailError.indexOf('.',1);
   if((positionOfAt == -1)||(positionOfAt == (emailError.length-1))||(positionOfat == -1)||(positionOfat == (emailError.length-1))){
      return true;
   }else{
      return false;
   } 
}

function gbid(id) { 
   return document.getElementById(id); 
}

function StringBuffer(value)
{
    this.strings = new Array("");
    this.append(value);
}

// Appends the given value to the end of this instance.
StringBuffer.prototype.append = function (value)
{
    if (value)
    {
        this.strings.push(value);
    }
}

// Clears the string buffer
StringBuffer.prototype.clear = function ()
{
    this.strings.length = 1;
}

// Converts this instance to a String.
StringBuffer.prototype.toString = function ()
{
    return this.strings.join("");
}

function searchParams(stypeValue, kValue, locValue, ph1Value, ph2Value, kleastValue, kwoValue, ktValue, phtValue, kcompValue, phcompValue, stateValue, cityValue, locCCSDisplayValue, zipValue, mileValue, pdateValue, jtypeValue, jexpValue, jeduValue, jsalValue, sortValue ,encodedSearchUrlValue){
      
   this.stype = stypeValue;   
   this.loc = locValue;
   this.k = kValue;
   this.ph1 = ph1Value;
   this.ph2 = ph2Value;
   this.kleast = kleastValue;
   this.kwo= kwoValue;
   this.kt = ktValue;
   this.pht = phtValue;
   this.kcomp = kcompValue;
   this.phcomp = phcompValue;
   this.state = stateValue;
   this.city = cityValue;
   this.locCCSDisplay = locCCSDisplayValue;
   this.zip = zipValue;
   this.mile = mileValue;
   if(mileValue == "50"){
      this.mileValue = "within miles: 50";
   }else if(mileValue == "40"){
      this.mileValue = "within miles: 40";
   }else if(mileValue == "30"){
      this.mileValue = "within miles: 30";
   }else if(mileValue == "20"){
      this.mileValue = "within miles: 20";
   }else if(mileValue == "10"){
      this.mileValue = "within miles: 10";
   }else if(mileValue == "5"){
      this.mileValue = "within miles: 5";
   }else{
     this.mileValue = "within miles: N/A";
   }

   this.pdate = pdateValue;
   if(pdateValue == "1"){
      this.pdateValue = "Today";
    }else if(pdateValue == "2"){
      this.pdateValue = "Last 2 days";
    }else if(pdateValue == "3"){
      this.pdateValue = "Last 3 days";
    }else if(pdateValue == "4"){
      this.pdateValue = "Last 4 days";
    }else if(pdateValue == "5"){
      this.pdateValue = "Last 5 days";
    }else if(pdateValue == "6"){
      this.pdateValue = "Last 6 days";
    }else if(pdateValue == "7"){
      this.pdateValue = "Last 7 days";
    }else if(pdateValue == "14"){
      this.pdateValue = "Last 14 days";
    }else if(pdateValue == "30"){
      this.pdateValue = "Last 30 days";
    }else{
      this.pdateValue = "all days";
    }
   
   this.jtype = jtypeValue;
   if(jtypeValue == "1"){
       this.jtypeValue = "Full-time";
   }else if(jtypeValue == "2"){
       this.jtypeValue = "Part-time";
   }else if(jtypeValue == "3"){
       this.jtypeValue = "Contract";
   }else if(jtypeValue == "4"){
       this.jtypeValue = "Seasonal";
   }else if(jtypeValue == "5"){
       this.jtypeValue = "Permanent";
   }else if(jtypeValue == "6"){
       this.jtypeValue = "Temporary";
   }else if(jtypeValue == "7"){
       this.jtypeValue = "Internship";
   }else if(jtypeValue == "8"){
       this.jtypeValue = "Volunteer";
   }else{
        this.jtypeValue = "all Job Type";
   }
   
   this.jexp = jexpValue;
   if(jexpValue == "0"){
      this.jexpValue = "Intern";
   }else if(jexpValue == "0_2"){
      this.jexpValue = "0-2 Years";
   }else if(jexpValue == "2_5"){
      this.jexpValue = "2-5 Years";
   }else if(jexpValue == "5_7"){
      this.jexpValue = "5-7 Years";
   }else if(jexpValue == "7_10"){
      this.jexpValue = "7-10 Years";
   }else if(jexpValue == "10_15"){
      this.jexpValue = "10-15 Years";
   }else if(jexpValue == "15"){
      this.jexpValue = "15 Years more";
   }else{
      this.jexpValue = "all Work Experience";
   }

   this.jedu = jeduValue;
   if(jeduValue == "1"){
       this.jeduValue = "Some High School";
   }else if(jeduValue == "2"){
       this.jeduValue = "High School or equivalent";
   }else if(jeduValue == "3"){
       this.jeduValue = "Certification";
   }else if(jeduValue == "4"){
       this.jeduValue = "Some College";
   }else if(jeduValue == "5"){
       this.jeduValue = "Associate Degree";
   }else if(jeduValue == "6"){
       this.jeduValue = "Bachelor Degree";
   }else if(jeduValue == "7"){
       this.jeduValue = "Master Degree";
   }else if(jeduValue == "8"){
       this.jeduValue = "Doctorate";
   }else if(jeduValue == "9"){
       this.jeduValue = "Professional";
   }else{
       this.jeduValue = "all Education";
   }
   this.jsal = jsalValue;
   this.sort = sortValue;  
   this.encodedSearchUrl = encodedSearchUrlValue;
}

function showEmailAlertEditForm(allParams) {
 
   var emailAlertL = gbid('leftAlert');
   var emailAlert = gbid('alert');
   
   var buf = new StringBuffer();
   var searchKeyword = new StringBuffer();
   var location = new StringBuffer();
   var filter = new StringBuffer();
   var loginName = getCookie('loginName');
   var showall = '';
   if(loginName == null){
      showall = 'Alerts?op=listalerts&loginName=&sort=1';
   }else{
      showall = 'Alerts?op=listalerts&loginName='+loginName+'&sort=1';
   }
   if(allParams.k != ""){
      searchKeyword.append(allParams.k);
      searchKeyword.append(" ");
   }
   if(allParams.ph1 != ""){
      searchKeyword.append("\"");
      searchKeyword.append(allParams.ph1);
      searchKeyword.append("\"");
      searchKeyword.append(" ");
   }
   if(allParams.ph2 != ""){
      searchKeyword.append("\"");
      searchKeyword.append(allParams.ph2);
      searchKeyword.append("\"");
      searchKeyword.append(" ");
   }
  if(allParams.kleast != ""){
      searchKeyword.append("with one of:");
      searchKeyword.append(allParams.kleast);
      searchKeyword.append(" ");
   }
  if(allParams.kwo != ""){
      searchKeyword.append("without:");
      searchKeyword.append(allParams.kwo);
      searchKeyword.append(" ");
   }
   if(allParams.kt != ""){
      searchKeyword.append("title:");
      searchKeyword.append(allParams.kt);
      searchKeyword.append(" ");
   }
   if(allParams.pht != ""){
      searchKeyword.append("exact phase in job title:");
      searchKeyword.append(allParams.pht);
      searchKeyword.append(" ");
   }
   if(allParams.kcomp != ""){
      searchKeyword.append("company:");
      searchKeyword.append(allParams.kcomp);
      searchKeyword.append(" ");
   }
   if(allParams.phcomp != ""){
      searchKeyword.append("exact phase in company:");
      searchKeyword.append(allParams.phcomp);
   }
 
  if(allParams.city != ""){
      location.append(allParams.city);
      location.append(",");   
   }
   
   if(allParams.state != ""){
      location.append(allParams.state);
      location.append(",");   
   }

   if(allParams.locCCSDisplay != ""){
      location.append(allParams.locCCSDisplay);
      location.append(",");   
   }

   location.append("US");

   filter.append(allParams.pdateValue);
   filter.append(' | ');
   filter.append(allParams.jtypeValue);
   filter.append(' | ');
   filter.append(allParams.jexpValue);
   filter.append(' | ');
   filter.append(allParams.jeduValue);
   filter.append(' | ');
   filter.append(allParams.mileValue);

   buf.append('<table class="panel" cellspacing="1" cellpadding="2" align="left" border="0">'+
   '<tbody>'+
   '<tr>'+
   '<td class="panelTitle">'+
    '<tr>'+
    '<td>'+
   '<span id="editAlert"  class="sl" onclick="cancelAlert(\''+allParams.stype+'\',\''+allParams.k+'\',\''+allParams.loc+'\',\''+allParams.ph1+'\',\''+allParams.ph2+'\' ,\''+allParams.kleast+'\',\''+allParams.kwo+'\',\''+allParams.kt+'\',\''+allParams.pht+'\',\''+allParams.kcomp+'\',\''+allParams.phcomp+'\',\''+allParams.state+'\',\''+allParams.city+'\', \''+allParams.locCCSDisplay+'\', \''+allParams.zip+'\',\''+allParams.mile+'\',\''+allParams.pdate+'\',\''+allParams.jtype+'\',\''+allParams.jexp+'\',\''+allParams.jedu+'\',\''+allParams.jsal+'\',\''+allParams.sort+'\',\''+allParams.encodedSearchUrl+'\')" title="Edit Email alert.">'+
    '<img src="images/email.jpg" width="16" height="10">'+ 
    ' Save search as an '+
    '<b>'+
    'email job agent'+
    '</b>'+
    '</span>'+ 
   ' | <a href="'+showall+'">'+'Show all saved'+' '+'job agents'+'</a>'+
    '</td>'+
     '</tr>'+
     '<tr>'+
      '<td>'+
          '<span id="alertEmailError">'+'</span>'+
      '</td>'+
      '</tr>'+
     '</td>'+    
   '</tr>'+
   '<tr>'+
   '<td class="panelContent"> '+
      
              '<form name="alertform" id="alertform" method="post" onSubmit="return false">'+
                  '<table width="100%">'+
                     '<tbody>'+ 
                  '<tr>'+ 
                    '<td width="15%">'+'Job keywords:'+'</td>'+
                    '<td width="85%">'+searchKeyword.toString()+'</td>'+
                  '</tr>'+
                   '<tr>'+ 
                    '<td width="15%">'+'Location:'+'</td>'+
                    '<td width="85%">'+location.toString()+'</td>'+
                   '</tr>'+
                   '<tr>'+ 
                     '<td width="15%">'+'Filters:'+'</td>'+
                     '<td width="85%">'+filter.toString()+'</td>'+
                   '</tr>'+
                    '<tr>'+ 
                      '<td width="%">'+'&nbsp;'+'</td>'+
                      '<td width="78%">'+'&nbsp;'+'</td>'+
                    '</tr>'+
                    '<tr>'+ 
                     '<td width="22%">'+'How often:'+'</td>'+
                       '<td width="78%">'+ 
                           '<select name="howoften" id="howoften">'+
                           '<option value="1" selected>'+'Daily'+'</option>'+
                           '<option value="2">'+'Every 2 days'+'</option>'+
                           '<option value="3">'+'Every 3 days'+'</option>'+
                           '<option value="4">'+'Every 4 days'+'</option>'+
                           '<option value="5">'+'Every 5 days'+'</option>'+
                           '<option value="6">'+'Every 6 days'+'</option>'+
                           '<option value="7">'+'Weekly'+'</option>'+
                           '</select>'+
                       '</td>'+
                    '</tr>'+
                     '<tr>'+ 
                      '<td width="22%">'+'My email:'+'</td>');
      
        if(loginName == null){
              buf.append('<td with="78%">'+'<input type="text" name="email" id="email" size="16" maxlength="60">'+'</td>');
              buf.append('<input type="hidden" name="isLoginUser" id="isLoginUser" value="NO">');
         }else{
              buf.append( '<td width="78%">'+loginName+'</td>');   
              buf.append('<input type="hidden" name="isLoginUser" id="isLoginUser" value="YES">'+
                          '<input type="hidden" name="loginName" id="loginName" value="'+loginName+'">');           
         }
        var skeyword = escape(searchKeyword.toString());
         buf.append( '</tr>'+
                    '<tr>'+ 
                      '<td width="22%">'+'&nbsp;'+'</td>'+
                      '<td width="78%">'+                        
                        '<input type="hidden" name="alertSearchKeyword" id="alertSearchKeyword" value="'+skeyword+'">'+
                        '<input type="hidden" name="alertSearchLoc" id="alertSearchLoc" value="'+location.toString()+'">'+
                        '<input type="hidden" name="alertSearchFilter" id="alertSearchFilter" value="'+filter.toString()+'">'+
	               '</td>'+
                    '</tr>'+    
                     '<tr>'+            
                         '<td>'+                 
                             '<input type="button" name="alertSubmit" value="Create Alert" onclick="ajaxSubmit(\''+allParams.stype+'\',\''+allParams.k+'\',\''+allParams.loc+'\',\''+allParams.ph1+'\',\''+allParams.ph2+'\' ,\''+allParams.kleast+'\',\''+allParams.kwo+'\',\''+allParams.kt+'\',\''+allParams.pht+'\',\''+allParams.kcomp+'\',\''+allParams.phcomp+'\',\''+allParams.state+'\',\''+allParams.city+'\',\''+allParams.locCCSDisplay+'\',\''+allParams.zip+'\',\''+allParams.mile+'\',\''+allParams.pdate+'\',\''+allParams.jtype+'\',\''+allParams.jexp+'\',\''+allParams.jedu+'\',\''+allParams.jsal+'\',\''+allParams.sort+'\',\''+allParams.encodedSearchUrl+'\')">'+      
                          '</td>'+    
                          '<td>'+                      
                            '<input type="button" name="alertCancel" value="Cancel" onclick="cancelAlert(\''+allParams.stype+'\',\''+allParams.k+'\',\''+allParams.loc+'\',\''+allParams.ph1+'\',\''+allParams.ph2+'\' ,\''+allParams.kleast+'\',\''+allParams.kwo+'\',\''+allParams.kt+'\',\''+allParams.pht+'\',\''+allParams.kcomp+'\',\''+allParams.phcomp+'\',\''+allParams.state+'\',\''+allParams.city+'\',\''+allParams.locCCSDisplay+'\',\''+allParams.zip+'\',\''+allParams.mile+'\',\''+allParams.pdate+'\',\''+allParams.jtype+'\',\''+allParams.jexp+'\',\''+allParams.jedu+'\',\''+allParams.jsal+'\',\''+allParams.sort+'\',\''+allParams.encodedSearchUrl+'\')">'+ 
                          '</td>'+                                                                                  
                     '</tr>'+                                                                                                       
                  '</tbody>'+ 
             '</table>'+ 
            '</form>'+  
            '<font size="1">'+
                   'We will not share your email address with anyone. You can cancel email '+
                   'job agent at anytime. '+'</font>'+                    
        '</td>'+
      '</tr>'+
    '</tbody>'+
  '</table>');
      
     emailAlertL.innerHTML =  '<span class="sl" onclick="cancelAlert(\''+allParams.stype+'\',\''+allParams.k+'\',\''+allParams.loc+'\',\''+allParams.ph1+'\',\''+allParams.ph2+'\' ,\''+allParams.kleast+'\',\''+allParams.kwo+'\',\''+allParams.kt+'\',\''+allParams.pht+'\',\''+allParams.kcomp+'\',\''+allParams.phcomp+'\',\''+allParams.state+'\',\''+allParams.city+'\', \''+allParams.locCCSDisplay+'\', \''+allParams.zip+'\',\''+allParams.mile+'\',\''+allParams.pdate+'\',\''+allParams.jtype+'\',\''+allParams.jexp+'\',\''+allParams.jedu+'\',\''+allParams.jsal+'\',\''+allParams.sort+'\',\''+allParams.encodedSearchUrl+'\')" title="Edit Email alert.">'+  
        'Hide Email Alert'+   
        '</span>'   ;               
     emailAlert.innerHTML = buf.toString();     
     
     searchKeyword.clear();
     location.clear();
     filter.clear();        
}

function editEmailAlert(stype, k, loc, ph1, ph2, kleast, kwo, kt, pht, kcomp, phcomp, state, city, locCCSDisplay, zip, mile, pdate, jtype, jexp, jedu ,jsal, sort,encodedSearchUrl){
               
  var currSearch = new searchParams(stype, k, loc, ph1, ph2, kleast, kwo, kt, pht, kcomp, phcomp, state, city, locCCSDisplay, zip, mile, pdate, jtype, jexp, jedu ,jsal, sort,encodedSearchUrl);  
  showEmailAlertEditForm(currSearch);
}

var req = null;
function createXMLHttpRequest(){
   
   if (window.XMLHttpRequest) {
      req = new XMLHttpRequest();    
      if (req.overrideMimeType)
	 req.overrideMimeType('text/xml');  
   } else if (window.ActiveXObject) {       
      req = new ActiveXObject("Microsoft.XMLHTTP");
      if (req.overrideMimeType)
	 req.overrideMimeType('text/xml'); 
   }
}

function ajaxSubmit(stype, k, loc, ph1, ph2, kleast, kwo, kt, pht, kcomp, phcomp, state, city, locCCSDisplay, zip, mile, pdate, jtype, jexp, jedu ,jsal, sort,searchUrl){
   
   
   var alertForm = gbid("alertform"); 
   var emailError = gbid("alertEmailError");

   if(alertForm.isLoginUser.value == "YES"){
       if(isEmail(alertForm.loginName.value)){
           emailError.innerHTML = '<font color="#FF0000">'+'<b>'+'Hops! the Email field appears to have errors.'+'</b>'+'</font>';
           return;
       }else{
          loginName = alertForm.loginName.value;         
      }
   }else{
     if(isEmail(alertForm.email.value)){
          emailError.innerHTML = '<font color="#FF0000">'+'<b>'+'Hops! the Email field appears to have errors.'+'</b>'+'</font>';
          return;
      }else{
         loginName = alertForm.email.value;        
      }
   }   

   var emailAlert = gbid("alert");
   var url = site_top_dir_path + "Alerts?isrp="+rand(); 
   var skeyword = unescape(alertForm.alertSearchKeyword.value);
   var param = "loginName="+loginName+"&searchUrl="+
               searchUrl+"&searchKeyword="+skeyword+
               "&searchLoc="+alertForm.alertSearchLoc.value+"&searchFilter="+alertForm.alertSearchFilter.value+"&freqInDay="+
               alertForm.howoften.value+"&isLoginUser="+alertForm.isLoginUser.value+"&op=createAlert";

   createXMLHttpRequest();
   req.open("POST", url, true);
   req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
   req.onreadystatechange = function getResponse(){
      if (req.readyState == 4) {          
	 if (req.status == 200) {
           
           var message = req.responseText;
           var buf = new StringBuffer();            
           buf.append('<table class="panel" with="100%" cellspacing="1" cellpadding="2" align="left" border="0">'+
                                       '<tbody>'+
                                       '<tr>'+
                                       '<td class="panelTitle">'+
                                       '<span id="editAlert"  class="sl" onclick="editEmailAlert(\''+stype+'\',\''+k+'\',\''+loc+'\',\''+ph1+'\',\''+ph2+'\',\''+kleast+'\', \''+kwo+'\', \''+kt+'\', \''+pht+'\'  ,\''+kcomp+'\',\''+phcomp+'\',\''+state+'\',\''+city+'\',\''+locCCSDisplay+'\',\''+zip+'\',\''+mile+'\', \''+pdate+'\',\''+jtype+'\', \''+jexp+'\', \''+jedu+'\',\''+jsal+'\',\''+sort+'\',\''+searchUrl+'\')" title="Edit Email alert.">'+
                                       '<img src="images/email.jpg" width="16" height="10">'+ 
                                       ' Save search as an '+
                                        '<b>'+
                                        'email job agent'+
                                        '</b>'+
                                        '</span>'+ 
                                        ' | <a href="Alerts?op=listalerts&loginName='+loginName+'&sort=1">'+'Show all saved'+' '+'alerts'+'</a>'+
                                        '</td>'+
                                         '</tr>'+
                                         '<tr>'+
                                         '<td class="panelContent">');       
           
           if(message.indexOf("Email_Alert_OP_OK") == 0){
                if(alertForm.isLoginUser.value == "YES"){                   
                    buf.append('<font color="#00CC33">'+'<b>'+'Email job agent has been created successfully.'+'</b>'+'</font>');
                }else{
                    buf.append('<b>'+
                                  'We just sent you\'re an job agent confirmation email.'+ 
                                  ' Please check your email and click the link to activate this alert.'+
                                  ' We encourage you to'+'</b>'+
                                  '<a href="Account?op=create_account">'+' create an account'+ 
                                  '</a>'+
                                  '<b>'+
                                  ' to avoid this email job agent confirmation step.'+'</b>');
                }
           } 
           else if(message.indexOf("Email_Alert_OP_Error_Invalid_Params") == 0 ){
                 buf.append(message);
            }else if(message.indexOf("Email_Alert_Create_OP_Error_Duplicated_Alert_Exist") ==0){
                 buf.append('<font color="#FF0000">'+'<b>'+'Hops! Such an job agent has been created already.'+'</b>'+'</font>');
            }else if(message.indexOf("Email_Alert_OP_Error_reached_Max_Num_OF_Alerts") == 0){
                 buf.append(message);
            }else if(message.indexOf("Email_Alert_OP_Error") == 0){
                 buf.append(message);
            }else if(message.indexOf("Email_Alert_OP_Unkonow_Error") == 0){
                 buf.append(message);
            }
            buf.append('</td>'+
                       '</tr>'+                                           
                       '<tbody>'+
                       '</table>');         
         }
         emailAlert.innerHTML = buf.toString();
         buf.clear();
       }
   }

  req.send(param);
}

function cancelAlert(stype, k, loc, ph1, ph2, kleast, kwo, kt, pht, kcomp, phcomp, state, city, locCCSDisplay, zip, mile, pdate, jtype, jexp, jedu ,jsal, sort,searchUrl){
   
   var emailAlertL = gbid('leftAlert');
   var emailAlert = gbid('alert');  
   var loginName = getCookie('loginName');
   if(loginName == null){
      showall = 'Alerts?op=listalerts&loginName=&sort=1';
   }else{
      showall = 'Alerts?op=listalerts&loginName='+loginName+'&sort=1'
   }
   emailAlert.innerHTML = '<span id="editAlert"  class="sl" onclick="editEmailAlert(\''+stype+'\',\''+k+'\',\''+loc+'\',\''+ph1+'\',\''+ph2+'\',\''+kleast+'\', \''+kwo+'\', \''+kt+'\', \''+pht+'\'  ,\''+kcomp+'\',\''+phcomp+'\',\''+state+'\',\''+city+'\', \''+locCCSDisplay+'\', \''+zip+'\',\''+mile+'\', \''+pdate+'\',\''+jtype+'\', \''+jexp+'\', \''+jedu+'\',\''+jsal+'\',\''+sort+'\',\''+searchUrl+'\')" title="Edit Email alert.">'+
                          '<img src="images/email.jpg" width="16" height="10">'+ 
                          ' Save search as an '+
                          '<b>'+
                          'email job agent'+
                          '</b>'+
                          '</span>'+
                          ' | '+
                          '<a  href="'+showall+'">'+
                          'Show all saved '+
                           '<b>'+
                          'job agents'+
                           '</b>'+
                           '</a>';
    emailAlertL.innerHTML = '<span class="sl" onclick="editEmailAlert(\''+stype+'\',\''+k+'\',\''+loc+'\',\''+ph1+'\',\''+ph2+'\',\''+kleast+'\', \''+kwo+'\', \''+kt+'\', \''+pht+'\'  ,\''+kcomp+'\',\''+phcomp+'\',\''+state+'\',\''+city+'\', \''+locCCSDisplay+'\', \''+zip+'\',\''+mile+'\', \''+pdate+'\',\''+jtype+'\', \''+jexp+'\', \''+jedu+'\',\''+jsal+'\',\''+sort+'\',\''+searchUrl+'\')" title="Edit Email alert.">'+
                          'Email Alert'+
                          '</span>'
}

function changeFreq(id,key){    
   
   var freq = gbid("freq_"+id);  
   //url = "Alerts?op=changefreq&key="+key+"&freq="+freq.value+"&isrp="+rand();
   //createXMLHttpRequest();
   //req.open("GET",url,true);
   //req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
   //req.onreadystatechange = function getFreq(){               
     // if(req.readyState == 4){                  
       // if(req.status == 200){
        //var message = req.responseText;
          //if(message.indexOf("Email_Alert_OP_OK") == 0){
             //alert("change job agent frequency OK !");
          //}else if(message.indexOf("Email_Alert_OP_Error_Not_Found_Alert_Entry") == 0){
             //alert("Not found any job agent entry !");
          //}
        //}
      //}
    //}
  //req.send(null);
  window.location.href = "Alerts?op=changefreq&key="+key+"&freq="+freq.value; 
}
