function check()
{
   var	error;
   error='';
  if (document.getElementById("cname").value == '')
  {
    error+="Please Enter Name\n";
	document.getElementById("ma").style.color='#ff0000';
	document.getElementById("cname").focus();
  }
  
  if (document.getElementById("caddress").value == '')
  {
    error+="Please Enter Address\n";
	document.getElementById("ad").style.color='#ff0000';
	document.getElementById("caddress").focus();
  }
  
  if (document.getElementById("cemail").value == '')
  {
    error+="Please Enter Email\n";
	document.getElementById("em").style.color='#ff0000';
	document.getElementById("cemail").focus();
  }
  else { if (! (/^\w+[-_\.]*\w+@\w+-?\w+\.[a-z]{2,4}$/.test(document.getElementById("cemail").value)) ) 
  {
    error+="Please Type Correct Email<br/>";
	document.getElementById("em").style.color='#ff0000';
    document.getElementById("cemail").focus();
  }
  }


  if (document.getElementById("ccat").options[document.getElementById("ccat").selectedIndex].value == 0)
  {
    error+="Please Enter Type of Professional do you need\n";
	document.getElementById("tp").style.color='#ff0000';
	document.getElementById("ccat").focus();
  }
   

  if(error=='') {document.getElementById("contact_form").submit();}
  else
  {
	alert(error);  
  }

}

var head="display:''"
function doit(header, pThis){
header=document.getElementById(header);
var head=header.style
if (head.display=="none")
{
head.display="";
pThis.src='/images/ins_minus.gif';
}
else
{
head.display="none";
pThis.src='/images/ins_plus.gif';
}
}

startList = function() {
      if (document.all&&document.getElementById) {
            navRoot = document.getElementById("menu");
            for (i=0; i<navRoot.childNodes.length; i++) {
                  node = navRoot.childNodes[i];
                  if (node.nodeName=="LI") {
                        node.onmouseover=function() {
                              this.className+=" over";
                        }
                        node.onmouseout=function() {
                              this.className=this.className.replace (" over", "");
                        }
                  }
            }
      }
}
window.onload=startList;

if (document.images)
{
  pic1= new Image();
  pic1.src="images/menu/menu_1_over.gif";

  pic2= new Image();
  pic2.src="images/menu/menu_2_over.gif";

  pic3= new Image();
  pic3.src="images/menu/menu_3_over.gif";

  pic4= new Image();
  pic4.src="images/menu/menu_4_over.gif";

  pic5= new Image();
  pic5.src="images/menu/menu_5_over.gif";

  pic6= new Image();
  pic6.src="images/testimonials_over.jpg";

  pic7= new Image();
  pic7.src="images/free-referral-service_over.jpg";

  pic8= new Image();
  pic8.src="images/why_over.jpg";

  pic9= new Image();
  pic9.src="images/bg.gif";

  pic10= new Image();
  pic10.src="images/ins_plus.gif";

  pic11= new Image();
  pic11.src="images/lupa_over.gif";
  
  pic11= new Image();
  pic11.src="images/become_member_over.jpg";

}

function send_itBlock()
  {
         var n=document.forms['main_form'].category_search.value;
         var m=document.forms['main_form'].region_search.value;
         if((n==0)||(m==0))
           {
              alert("Please choose  items from the lists");
           }
         else
           {
             document.forms['main_form'].submit();
           }
  }

function send_it1Block(){
        var n=document.forms['main_firm1'].zip_search.value;
        if(n==''){
           alert("Please enter search request");
        }else{
         document.forms['main_firm1'].submit();
         }
}
function send_it2Block(){
        var n=document.forms['main_firm2'].keywords_search.value;
        if(n==''){
           alert("Please enter search request");
        }else{
         document.forms['main_firm2'].submit();
         }

}

function send_it_by_name(name)
  {
         document.forms[name].submit();
  }

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

function getReturnToSearch()
  {
        var k = location.href.lastIndexOf('/');
        s = location.href.substr(0,k+1);
        s = s +"search.php?return=777";
        top.location.href=s;
  }

function loadFrame(a)
  {
     tPath = '';
     if(a == 'search.php')
       tPath = "javascript: getReturnToSearch();";
     else
       tPath = a;

     parent.frameB.document.open();
     parent.frameB.document.write("<html>");
     parent.frameB.document.write("<head>");
     parent.frameB.document.write("<title>Return Box</title>");
     parent.frameB.document.write("<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>");
     //parent.frameB.document.write("<link rel=stylesheet href='css/mylawprofessionals.css' type='text/css'>");
     //parent.frameB.document.write("<script type='text/JavaScript' src='js/main.js'></script>");
     parent.frameB.document.write("</head>");
     parent.frameB.document.write("<body style='background-color: #d0dde6; padding: 0; margin: 0;'>");
     parent.frameB.document.write("<div align='center' class='text1' style='vertical-align:middle;'><img src='images/logo_window.png' style='behavior: url(png.htc); vertical-align:middle; padding: 0; margin: 0;'/><span style='vertical-align:middle;padding: 0; margin: 0;'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RETURN TO <a href='" + tPath + "' class='text1' target='_top'><b><u>MY PROFESSIONALS</u></b></a>, MY PROFESSIONALS BUSINESS NETWORK</span></div>");
     parent.frameB.document.write("</body>");
     parent.frameB.document.write("</html>");
     parent.frameB.document.close();
  }




//AJAX
function sendRequest(target, value, returnFunction)
  {
        var req = new Subsys_JsHttpRequest_Js();
        var send_array = Array();
        send_array['target'] = target;
        //gLoading.visLoad();

        req.onreadystatechange = function()
          {
             if (req.readyState == 4)
               {
                  if (req.responseJS)
                    {
                       if(req.responseJS.returned)
                         {
                            //gLoading.invisLoad();

                            if(returnFunction)
                              returnFunction(req.responseJS);
                         }
                    }
               }
          }
        req.caching = false;
        var k = location.href.lastIndexOf('/');
        var s = location.href.substr(0,k+1);
        for(var temp in value)
          {
             var temp_name = value[temp]['name'];
             var temp_value = value[temp]['value'];
             send_array[temp_name] = temp_value
          }

//        req.open('POST', s + 'other/dispatch_processorHandler.php', true);
        req.open('POST', '/other/dispatch_processorHandler.php', true);
        req.send( send_array );
  }
///////////////////////////////////////////////////////////////////

p15785875 = null;

function setCategoriesByGroup(fResponse)
  {
     if(p15785875 == null)
       return;
     t = p15785875.form.categorySearch.parentNode.innerHTML;
     t = t.replace(/<OPTION(.*)<\/OPTION>/ig, '!!!');
     t = t.replace('!!!', fResponse.content);
     p15785875.form.categorySearch.parentNode.innerHTML = t;


/*     t = document.getElementById('categorySearch').parentNode.innerHTML;
     t = t.replace(/<OPTION(.*)<\/OPTION>/ig, '!!!');
     t = t.replace('!!!', fResponse.content);

     document.getElementById('categorySearch').parentNode.innerHTML = t;
*/
  }

ps47637 = null;
  
function setRegionsByState(fResponse)
  {
     if(ps47637 == null)
       return;
     t = ps47637.form.regionSearch.parentNode.innerHTML;
     t = t.replace(/<OPTION(.*)<\/OPTION>/ig, '!!!');
     t = t.replace('!!!', fResponse.content);
     ps47637.form.regionSearch.parentNode.innerHTML = t;


/*     t = document.getElementById('categorySearch').parentNode.innerHTML;
     t = t.replace(/<OPTION(.*)<\/OPTION>/ig, '!!!');
     t = t.replace('!!!', fResponse.content);

     document.getElementById('categorySearch').parentNode.innerHTML = t;
*/
  }

function getCategoriesByGroup(fInitiator)
  {
     p15785875 = fInitiator;
     var tTarget   = 'getCategoriesByGroup';
     var tValue    = Array();


     tValue[0] = Array();
     tValue[0]['name'] = 'groupId';
     tValue[0]['value'] = fInitiator.options[fInitiator.selectedIndex].value;
     sendRequest(tTarget, tValue, setCategoriesByGroup);
  }

function getRegionsByState(fInitiator)
  {
     ps47637 = fInitiator;
     var tTarget   = 'getRegionsByState';
     var tValue    = Array();


     tValue[0] = Array();
     tValue[0]['name'] = 'stateId';
     tValue[0]['value'] = fInitiator.options[fInitiator.selectedIndex].value;
     sendRequest(tTarget, tValue, setRegionsByState);
  }
  

function hackSelect(elem)
  {
     if(typeof(elem.category_search) != 'undefined' )
       elem.category_search.options[elem.category_search.selectedIndex].value = elem.category_search.options[elem.category_search.selectedIndex].innerHTML;
  }