//About Woynarski Law Office
var menu_AW=new Array()
menu_AW[0]='<a href="about-woynarski-law-office.php">&nbsp;About Woynarski Law Office</a>'
menu_AW[1]='<a href="privacy-policy.php">&nbsp;Privacy Policy</a>'

//Client services
var menu_CS=new Array()
menu_CS[0]='<a href="information.php">&nbsp;Information Sheets</a>'
menu_CS[1]='<a href="forms.php">&nbsp;Forms</a>'
menu_CS[2]='<a href="client-response-questionaire.php">&nbsp;Client Feedback</a>'

//Practice Areas
var menu_PA=new Array()
menu_PA[0]='<a href="general.php">&nbsp;General Legal Services</a>'
menu_PA[1]='<a href="civil-litigation.php">&nbsp;Civil Litigation</a>'
menu_PA[2]='<a href="business.php">&nbsp;Business Law</a>'
menu_PA[3]='<a href="estates.php">&nbsp;Estate Planning</a>'
menu_PA[4]='<a href="family.php">&nbsp;Family Law</a>'
menu_PA[5]='<a href="real-estate.php">&nbsp;Real Estate Law</a>'
		
//Staff Profiles
var menu_SP=new Array()
menu_SP[0]='<a href="ronald-woynarski.php">&nbsp;Ronald Woynarski</a>'
menu_SP[1]='<a href="barb-vanlauwe.php">&nbsp;Barb vanLauwe</a>'
menu_SP[2]='<a href="carol-iwaniuk.php">&nbsp;Carol Iwaniuk</a>'
menu_SP[3]='<a href="laura-croft.php">&nbsp;Laura Croft</a>'


var menuwidth='150px' //default menu width
var menubgcolor='#FFFFFF'  //menu bgcolor
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top="-500px"
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)

dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu

/* Show error message*/

window.alert = function(msg) {
        // should be add in IE brower if hideControl used 
        msg="<p>"+msg+"</p>";
   showControl("errmessage");
   document.getElementById('errmessage').innerHTML = msg;
   /* window.setTimeout(function() {
       document.getElementById('errmessage').innerHTML = '';
   }, 2000); */
  
}

/* Show error message*/

function showMessage(msg) {
    msg="<p>"+msg+"</p>";
    // should be add in IE brower if hideControl used 
   showControl("errmessage");
   document.getElementById('errmessage').innerHTML = msg;
}
//show div passed in
function showControl(controlId)
{
    if (document.getElementById)
    {
        // this is the way the standards work
        document.getElementById(controlId).style.visibility = "visible";
        document.getElementById(controlId).style.display = "block";
    }
    else if (document.all)
    {
        // this is the way old msie versions work
        document.all[controlId].style.visibility = "visible";
        document.getElementById(controlId).style.display = "block";
    }
    else if (document.layers)
    {
        // this is the way nn4 works
        document.layers[controlId].visibility = "visible";
        document.getElementById(controlId).style.display = "block";
    }
}

//hide div passed in
function hideControl(controlId)
{
    if (document.getElementById)
    {
        // this is the way the standards work
        document.getElementById(controlId).style.visibility = "hidden";
        document.getElementById(controlId).style.display = "none";
    }
    else if (document.all)
    {
        // this is the way old msie versions work
        document.all[controlId].style.visibility = "hidden";
        document.getElementById(controlId).style.display = "none";
    }
    else if (document.layers)
    {
        // this is the way nn4 works
        document.layers[controlId].visibility = "hidden";
        document.getElementById(controlId).style.display = "none";
    }
}

function validateRequestInput(form)
{
 
 
    var errorMsg="";
	
	
 	var radio_choice = false;
	
	// client name 
    var checkInputVar=form.clientname;

   	if (isNotNull(trim(checkInputVar.value))==false){
	errorMsg="Input Error! Please enter your name."
	alert( errorMsg );
    checkInputVar.focus();
    return false;
	}
	

	for (var i=1; i<=12; i++)  {
	var checkInputVar=eval("form.question"+i);
	
    radio_choice = false;

     // Loop from zero to the one minus the number of radio button selections
    for (counter = 0; counter < 5; counter++)
    {
        if (checkInputVar[counter].checked)radio_choice = true; 
    }

    if (!radio_choice)
    {
        errorMsg="Input Error! You must choose an answer to the agree-disagree questions. Quesion number "+i;
	    alert( errorMsg );
        return (false);
    }
	
	}
	
    //confidentiality
  
    var checkInputVar=form.confidentiality;
	
    radio_choice = false;

     // Loop from zero to the one minus the number of radio button selections
    for (counter = 0; counter < 2; counter++)
    {
        if (checkInputVar[counter].checked)radio_choice = true; 
    }

    if (!radio_choice)
    {
        errorMsg="Input Error! You must choose an answer to the quesion 'May we contact you if we would like to follow up on your feedback?'";
	    alert( errorMsg );
        return (false);
    }
	
	
	 
	


	
	return true;

 }
  

function clearErrormsg()
{
	  // should be add in IE brower  
   hideControl("errmessage");
	  document.getElementById('errmessage').innerHTML = '';
	  
}


function isNotNull(s)
{
	s=trim(s);
	
	if ((s==null)||(s=="") || (s.lengh==0)){
		return false
	}
	return true;
	
}


 
function isEmpty(s)
   {
      return ((s == null) || (s.length == 0))
 }

 
//removes leading and trailing spaces in the string passed in.

function trim( string_to_trim )
{ 
  while (string_to_trim.charAt(0) == " ")
  { 
    // remove leading spaces 
    string_to_trim = string_to_trim.substring(1); 
  } 
  
  while (string_to_trim.charAt(string_to_trim.length - 1) == " ")
  { 
    // remove trailing spaces 
    string_to_trim = string_to_trim.substring(0,string_to_trim.length - 1); 
  } 
  
  return string_to_trim; 
}

