// JavaScript Document
var lightboxMorph = null;
cases = new Array();

cases['Personal Injury and Wrongful Death Claims'] = new Array(
	"Select a Case Type..."
	,"5:Airplane Accidents"
	,"16:Animal Attacks"
	,"162:Asbestos Injuries"
	,"151:Automobile Accidents"
	,"10:Bicycle Accidents"
	,"17:Boating/Swimming"
	,"20:Bus Accidents"
	,"160:Construction Accidents"
	,"129:Libel and Slander"
	,"164:Maritime/Jones Act"
	,"202:Mass Tort Litigation"
	,"11:Motorcycle Accidents"
	,"18:Other Accidents"
	,"21:Pedestrian Accidents"
	,"128:Property Damage"
	,"14:Railroad Accidents"
	,"19:Slips and Falls"
	,"130:Toxic Torts"
	,"22:Truck Accidents"
	,"15:Wrongful Death"
);

cases['Creditor and Debtor Law'] = new Array(
	"Select a Case Type..."
	,"12:Auto Reposessions"
	,"27:Business Workouts"
	,"92:Collection Cases"
	,"28:Credit Card Debt"
	,"13:Credit Problems"
	,"25:Creditors Rights"
	,"29:Eliminate Debts"
	,"26:Mortgage Foreclosures"
);

cases['Bankruptcy Law'] = new Array(
	"Select a Case Type..."
	,"189:Bankruptcy Litigation"
	,"23:Business Bankruptcy"
	,"24:Consumer Bankruptcy"
	,"30:Transactions"
);

cases['Corporation and Business Law'] = new Array(
	"Select a Case Type..."
	,"31:Business Litigation"
	,"34:Corporations"
	,"36:Franchise Law"
	,"156:Internet Law"
	,"37:Limited Liability Companies"
	,"175:Mergers and Acquisitions"
	,"33:Partnerships"
	,"174:Sports Law"
	,"35:Starting a Business"
);

cases['Gaming Law'] = new Array(
	"Select a Case Type..."
	,"203:Gaming Contracts"
	,"32:Gaming Law, General"
);

cases['Antitrust and Trade Regulations'] = new Array(
	"Select a Case Type..."
	,"190:Antitrust Cases"
	,"38:Trade Regulations"
	,"195:Unfair Competition"
);

cases['Consumer Claims and Protection'] = new Array(
	"Select a Case Type..."
	,"127:Defective Products"
	,"161:Equipment Failures"
	,"39:General Fraud"
	,"97:Guarantees"
	,"199:Harassing Phone Calls"
	,"41:Mail Fraud"
	,"42:Motor Vehicle Fraud"
	,"40:Telephone Fraud"
);

cases['Criminal and Traffic Law'] = new Array(
	"Select a Case Type..."
	,"43:Arrests and Searches"
	,"50:Assault"
	,"44:Burglary"
	,"208:Criminal Defense, General"
	,"51:Domestic Battery"
	,"57:Drug Crimes"
	,"45:Drunk Driving"
	,"52:Embezzlement"
	,"168:Federal Crimes"
	,"58:Gaming Crimes"
	,"46:Juvenile"
	,"53:Murder"
	,"60:Parole & Probation"
	,"157:Post Conviction Relief"
	,"47:Rape"
	,"54:Robbery"
	,"59:Sex Offenses"
	,"169:State Crimes"
	,"48:Tax Evasion"
	,"55:Theft Crimes"
	,"94:Traffic Law"
	,"56:Vehicle Accidents"
	,"49:White Collar Crime"
);

cases['Job Discrimination and Civil Rights'] = new Array(
	"Select a Case Type..."
	,"166:Age Discrimination"
	,"102:Americans with Disabilities Act"
	,"103:Civil Rights Law"
	,"62:Discrimination Claims"
	,"61:Harassment Issues"
	,"172:Job Discrimination"
	,"173:Sexual Harassment"
	,"171:Whistleblowers"
);

cases['Workers Compensation'] = new Array(
	"Select a Case Type..."
	,"228:Workers Compensation, Employee"
	,"227:Workers Compensation, Employer"
	,"63:Workers Compensation, General"
);

cases['Copyright and Trademark Law'] = new Array(
	"Select a Case Type..."
	,"115:Art Law"
	,"118:Communications Law"
	,"121:Computer Law"
	,"116:Copyright Law"
	,"119:Internet/Ecommerce"
	,"122:Patent Law"
	,"64:Rights of Publicity"
	,"65:Theatrical"
	,"117:Trade Secrets"
	,"120:Trademark Law"
);

cases['Wills, Trusts, Estate Planning and Probate Matters'] = new Array(
	"Select a Case Type..."
	,"66:Asset Protection"
	,"68:Elder Law"
	,"70:Estates"
	,"154:Guardianships"
	,"69:Probate"
	,"194:Trust and Estate Disputes"
	,"71:Trusts"
	,"67:Wills"
);

cases['Domestic Relations and Family Law'] = new Array(
	"Select a Case Type..."
	,"72:Adoption Law"
	,"77:Annulments"
	,"82:Child Custody"
	,"73:Child Support"
	,"218:Collaborative Law"
	,"78:Divorce Law"
	,"163:Domestic Mediation"
	,"83:Domestic Violence"
	,"197:Grandparent Rights"
	,"79:Guardianship"
	,"205:Juvenile Representation"
	,"74:Legal Separation"
	,"198:Name Changes"
	,"76:Parental Rights"
	,"155:Paternity"
	,"84:Pre-Nuptial Agreements"
	,"75:Property Division"
	,"80:Restraining Orders"
	,"204:Sexual Abuse Cases"
	,"85:Spousal Support"
	,"196:Surrogacy"
	,"209:Termination of Parental Rights"
	,"81:Visitation Issues"
);

cases['Banking Law'] = new Array(
	"Select a Case Type..."
	,"86:Banking Law, General"
);

cases['Corporate Finance and Securities Law'] = new Array(
	"Select a Case Type..."
	,"88:Broker Disputes"
	,"90:Commodities Law"
	,"87:Investment Terms"
	,"89:Raising Capital"
	,"193:Securities Fraud"
	,"91:Securities Law"
);

cases['General Practice Law'] = new Array(
	"Select a Case Type..."
	,"124:Arbitration"
	,"126:Civil Lawsuits"
	,"95:Contracts"
	,"93:Legal Remedies"
	,"96:Licenses"
	,"150:Mediation"
	,"125:Small Claims"
	,"98:Suing/Being Sued"
);

cases['Government Law'] = new Array(
	"Select a Case Type..."
	,"99:Agricultural Law"
	,"100:Education Law"
	,"179:FDA Issues"
	,"101:Public Contracts"
);

cases['Military Law'] = new Array(
	"Select a Case Type..."
	,"104:Military Law, General"
);

cases['Immigration and Customs Law'] = new Array(
	"Select a Case Type..."
	,"159:Asylum Cases"
	,"105:Citizenship"
	,"149:Deportation"
	,"167:Employer Sanctions"
	,"106:Permanent Residence"
	,"107:Visas"
);

cases['Insurance Law'] = new Array(
	"Select a Case Type..."
	,"108:Auto Insurance"
	,"111:Business Insurance"
	,"113:Disability Insurance"
	,"109:Health Insurance"
	,"112:Insurance Bad Faith"
	,"114:Life Insurance"
	,"110:Property Insurance"
);

cases['Appellate Practice'] = new Array(
	"Select a Case Type..."
	,"211:Appeals, General"
	,"123:Criminal Appeals"
	,"216:Domestic and Family Law Appeals"
);

cases['Real Estate Law'] = new Array(
	"Select a Case Type..."
	,"131:Buying/Selling a Home"
	,"135:Commercial Real Estate"
	,"138:Condemnation"
	,"152:Development"
	,"133:Homeowners Associations"
	,"137:Landlord/Tenant"
	,"134:Mortgage Matters"
	,"139:Real Estate Law, General"
	,"192:Real Estate Litigation"
	,"140:Zoning"
);

cases['Construction Law'] = new Array(
	"Select a Case Type..."
	,"136:Construction Defects"
	,"132:Construction Law, General"
	,"191:Construction Litigation"
);

cases['Taxation Law'] = new Array(
	"Select a Case Type..."
	,"141:Business Tax Law"
	,"144:Discharge of Federal Income Taxes"
	,"147:Estate Tax Law"
	,"142:Gift Tax Law"
	,"145:Income Tax Law"
	,"148:Property Tax Law"
	,"143:Sales and Use Tax Law"
	,"146:State Tax Law"
);

cases['Administrative Agency Matters'] = new Array(
	"Select a Case Type..."
	,"153:Administrative Proceedings"
);

cases['Labor Law'] = new Array(
	"Select a Case Type..."
	,"170:Employment Contracts"
	,"220:Terminating an Employee"
	,"158:Wage Claims"
	,"221:Wrongful Termination"
);

cases['Public Utility Matters'] = new Array(
	"Select a Case Type..."
	,"176:Project Development"
	,"177:Regulatory Issues"
	,"178:Transactions/Mergers"
	,"165:Utility and Energy Issues"
);

cases['Health Care Law'] = new Array(
	"Select a Case Type..."
	,"180:Antitrust"
	,"181:Bioethics"
	,"182:Credentials/Peer Review"
	,"183:Fraud/Abuse"
	,"207:Health Care Law, General"
	,"184:Licenses/Certification"
	,"185:Mergers/Transactions"
	,"186:Reimbursement"
	,"187:Research Compliance"
);

cases['Constitutional Law'] = new Array(
	"Select a Case Type..."
	,"217:Constitutional Law, General"
	,"188:First Amendment Issues"
);

cases['Social Security Law'] = new Array(
	"Select a Case Type..."
	,"200:Denied Disability Claims"
	,"201:Denied Supplemental Income Claims"
	,"226:Social Security Law, General"
);

cases['Mining Law'] = new Array(
	"Select a Case Type..."
	,"206:Mining Law, General"
);

cases['Environmental Law'] = new Array(
	"Select a Case Type..."
	,"210:Environmental Law, General"
);

cases['Professional Malpractice'] = new Array(
	"Select a Case Type..."
	,"212:Dental Malpractice"
	,"213:Medical Malpractice"
	,"214:Other Malpractice"
);

cases['Water Rights Law'] = new Array(
	"Select a Case Type..."
	,"215:Water Rights Law, General"
);

cases['International and Foreign Law'] = new Array(
	"Select a Case Type..."
	,"219:International Law, General"
);

cases['Legislative Matters'] = new Array(
	"Select a Case Type..."
	,"222:Legislative Matters, General"
);

cases['Pension, Profit Sharing and Employee Benefit Plans'] = new Array(
	"Select a Case Type..."
	,"225:Employee Benefit Plans"
	,"223:Pensions"
	,"224:Profit Sharing"
);

cases['Eminent Domain'] = new Array(
	"Select a Case Type..."
	,"231:Complete or Partial Taking"
	,"230:Condemnation"
	,"232:Easements and Rights of Way"
	,"229:Landowners Rights"
);


function addEditList(form, member_id) {
			var cities_serviced = "";
                        var query_string = '';
                        for(var i=0; i<form.elements.length; i++) {
				if(form.elements[i].name == 'city[]' && form.elements[i].options.length > 0) {
					query_string += "cities_serviced="; 
					for(var j=0; j<form.elements[i].options.length; j++)
						if(form.elements[i].options[j].selected) {
							query_string += form.elements[i].options[j].value + ", ";
							cities_serviced += ((cities_serviced != "") ? "," : "") + form.elements[i].options[j].value;
						}
					query_string += "&";
				} else
					query_string += form.elements[i].name + '=' + form.elements[i].value + '&';
			}
			if(document.getElementById('cities_serviced'))
				document.getElementById('cities_serviced').value = cities_serviced;
                        query_string += 'member_id=' + member_id;
			new Request({
				url: 'http://www.attorneyguide.com/addEditList.php',
				method: 'post',
				onSuccess: function(responseText, responseXML) {
				if(responseText == 'success')
					//form.innerHTML = 'Submission Successful!';
                                        form.submit();
				else
					//form.innerHTML = 'Submission Failed.<br />Response: '+responseText;
                                        form.submit();
				},
				onFailure: function(instance) {
					//form.innerHTML = 'Internal Error - Check Security Settings.';
                                        form.submit();
				}
			}).send(query_string);
                        return false;
}

function validateFindAttorney(form) {
    if( (document.getElementById('first_name').value == '(First Name)' || document.getElementById('first_name').value == '') &&
        (document.getElementById('last_name').value == '(Last Name)' || document.getElementById('last_name').value == '') ) {
        alert("Either a first name or last name is required to continue");
        return false;
    }
    if( document.getElementById('first_name').value == '(First Name)' ) {
      document.getElementById('first_name').value = '';
    }
    if( document.getElementById('last_name').value == '(Last Name)' ) {
      document.getElementById('last_name').value = '';
    }
    document.getElementById('temp_keywords').value = (document.getElementById('first_name').value == "")?document.getElementById('last_name').value:document.getElementById('first_name').value + " " + document.getElementById('last_name').value;
    var temp_name = document.getElementById('first_name').value;
    if ( temp_name.indexOf(' ') ){
      var name_split = temp_name.split(" ",2);
      document.getElementById('first_name').value = name_split[0];
      //document.getElementById('initial').value = name_split[1];
    }

			new Request({
				url: 'http://www.attorneyguide.com/index.php/search/check_feature_log',
				method: 'post',
				onSuccess: function(responseText, responseXML) {
				if(responseText == 'success')
                                        form.submit();
				/*else
					alert('Submission Failed. Response: '+responseText);*/
				},
				onFailure: function(instance) {
					//alert('Internal Error - Check Security Settings.');
				}
			}).send('first_name=' + document.getElementById('first_name').value + '&last_name=' + document.getElementById('last_name').value);

    return false;
}
function validateCertAttorney() {
    if( document.getElementById('practice_area').options[document.getElementById('practice_area').selectedIndex].value == "" ||
document.getElementById('case_type').options[document.getElementById('case_type').selectedIndex].value == "" ||
document.getElementById('city').options[document.getElementById('city').selectedIndex].value == "") {
        alert("All criteria is required to continue");
        return false;
    }
    return true;
}
function validateBasicSearch() {
    if( document.getElementById('city2').options[document.getElementById('city2').selectedIndex].value == "" ||
document.getElementById('practice_area2').options[document.getElementById('practice_area2').selectedIndex].value == "") {
        alert("All criteria is required to continue");
        return false;
    }
    return true;
}
function validateAdvancedSearch() {    
    if((document.getElementById('city').options[document.getElementById('city').selectedIndex].value == "" ||
document.getElementById('practice_area').options[document.getElementById('practice_area').selectedIndex].value == "") &&
(document.getElementById('firm_name').value == "") && (document.getElementById('keywords2').value == "") && (document.getElementById('last_name').value == "" || document.getElementById('last_name').value == "(Last Name)")) {
        alert("Either keywords, a last name, or all other fields are required to continue");
        return false;
    }
    if(document.getElementById('first_name').value == "(First Name)") document.getElementById('first_name').value = "";
    if(document.getElementById('last_name').value == "(Last Name)") document.getElementById('last_name').value = "";
    return true;
}
function updateCases(practice) {
    if (document.images) {
        // get text of actual selection
        var sel = practice.options[practice.selectedIndex].text;

        if (!sel) {
            sel = practice;
        }
        act = cases[sel];
        if (!act) {
            act = new Array("Select a Case Type...");
        }

        //practice.form.category[].length = act.length;
       practice.form.elements["category[]"].length = act.length;
        var subs='';
        for(i = 0; i < act.length; i++) {
            //practice.form.category[].options[i].text = act[i];
            if(act[i] != "Select a Case Type...") {
              var brokenstring = act[i].split(":")
             practice. form.elements["category[]"].options[i].value = brokenstring[0];
             practice. form.elements["category[]"].options[i].text = brokenstring[1];
              subs+=brokenstring[0]+'|';
            }
        }
       subs=subs.substr(0, subs.length-1);
      practice. form.elements["category[]"].options[0].value = subs;
    } else {
        alert("Your browser does not allow this script to modify the "
            + "cases selection lists. You should update your browser.");
    }
}
function updateCasesWithName(practice) {
    if (document.images) {
        // get text of actual selection
        var sel = practice.options[practice.selectedIndex].text;

        if (!sel) {
            sel = practice;
        }
        act = cases[sel];
        if (!act) {
            act = new Array("Select a Case Type...");
        }

        //practice.form.category[].length = act.length;
       practice.form.elements["category[]"].length = act.length;
        var subs='';
        for(i = 0; i < act.length; i++) {
            //practice.form.category[].options[i].text = act[i];
            if(act[i] != "Select a Case Type...") {
              var brokenstring = act[i].split(":")
             practice. form.elements["category[]"].options[i].value = brokenstring[1];
             practice. form.elements["category[]"].options[i].text = brokenstring[1];
              subs+=brokenstring[1]+', ';
            }
        }
       subs=subs.substr(0, subs.length-2);
      practice.form.elements["category[]"].options[0].value = subs;
    } else {
        alert("Your browser does not allow this script to modify the "
            + "cases selection lists. You should update your browser.");
    }
}
function showLightbox(obj) {
  if(lightboxMorph == null) {
    lightboxMorph = new Fx.Morph('lightbox', { duration: 200, transition: Fx.Transitions.Quad.easeIn, link: "cancel" });
    lightboxMorph.set({'opacity' : 0});
  }
  $('lightbox').innerHTML = '<a onclick="return hideLightbox()" href="/" class="close">Close</a>';
  switch(obj.href.substr(obj.href.lastIndexOf('/')+1)) {
	case 'practice_area':
		$('lightbox').innerHTML += '<strong>Practice Area</strong> - Please select from the drop down list an area of law that matches your issue, for example: Family Law or Criminal Law.';
		break;
	case 'case_type':
		$('lightbox').innerHTML += '<strong>Case Type</strong> - Please select from the drop down list the type of situation that matches your issue, for example: Divorce or Drunk Driving.';
		break;
  }
  lightboxMorph.start({ opacity: 1 });
}

function hideLightbox() {
  if(lightboxMorph == null) {
    lightboxMorph = new Fx.Morph('lightbox', { duration: 200, transition: Fx.Transitions.Quad.easeIn, link: "cancel" });
    lightboxMorph.set({'opacity' : 1 });
  }
  lightboxMorph.start({ opacity: 0 }).chain(function() {
      $('lightbox').innerHTML = "";
  });
  return false;
}

/**
 * --------------------------------------------------------------------
 * jQuery-Plugin "pngFix"
 * Version: 1.2, 09.03.2009
 * by Andreas Eberhard, andreas.eberhard@gmail.com
 *                      http://jquery.andreaseberhard.de/
 *
 * Copyright (c) 2007 Andreas Eberhard
 * Licensed under GPL (http://www.opensource.org/licenses/gpl-license.php)
 *
 * Changelog:
 *    09.03.2009 Version 1.2
 *    - Update for jQuery 1.3.x, removed @ from selectors
 *    11.09.2007 Version 1.1
 *    - removed noConflict
 *    - added png-support for input type=image
 *    - 01.08.2007 CSS background-image support extension added by Scott Jehl, scott@filamentgroup.com, http://www.filamentgroup.com
 *    31.05.2007 initial Version 1.0
 * --------------------------------------------------------------------
 * @example $(function(){$(document).pngFix();});
 * @desc Fixes all PNG's in the document on document.ready
 *
 * jQuery(function(){jQuery(document).pngFix();});
 * @desc Fixes all PNG's in the document on document.ready when using noConflict
 *
 * @example $(function(){$('div.examples').pngFix();});
 * @desc Fixes all PNG's within div with class examples
 *
 * @example $(function(){$('div.examples').pngFix( {blankgif:'ext.gif'} );});
 * @desc Fixes all PNG's within div with class examples, provides blank gif for input with png
 * --------------------------------------------------------------------
 */

(function($) {

jQuery.fn.pngFix = function(settings) {

	// Settings
	settings = jQuery.extend({
		blankgif: 'blank.gif'
	}, settings);

	var ie55 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 5.5") != -1);
	var ie6 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 6.0") != -1);

	if (jQuery.browser.msie && (ie55 || ie6)) {

		//fix images with png-source
		jQuery(this).find("img[src$=.png]").each(function() {

			jQuery(this).attr('width',jQuery(this).width());
			jQuery(this).attr('height',jQuery(this).height());

			var prevStyle = '';
			var strNewHTML = '';
			var imgId = (jQuery(this).attr('id')) ? 'id="' + jQuery(this).attr('id') + '" ' : '';
			var imgClass = (jQuery(this).attr('class')) ? 'class="' + jQuery(this).attr('class') + '" ' : '';
			var imgTitle = (jQuery(this).attr('title')) ? 'title="' + jQuery(this).attr('title') + '" ' : '';
			var imgAlt = (jQuery(this).attr('alt')) ? 'alt="' + jQuery(this).attr('alt') + '" ' : '';
			var imgAlign = (jQuery(this).attr('align')) ? 'float:' + jQuery(this).attr('align') + ';' : '';
			var imgHand = (jQuery(this).parent().attr('href')) ? 'cursor:hand;' : '';
			if (this.style.border) {
				prevStyle += 'border:'+this.style.border+';';
				this.style.border = '';
			}
			if (this.style.padding) {
				prevStyle += 'padding:'+this.style.padding+';';
				this.style.padding = '';
			}
			if (this.style.margin) {
				prevStyle += 'margin:'+this.style.margin+';';
				this.style.margin = '';
			}
			var imgStyle = (this.style.cssText);

			strNewHTML += '<span '+imgId+imgClass+imgTitle+imgAlt;
			strNewHTML += 'style="position:relative;white-space:pre-line;display:inline-block;background:transparent;'+imgAlign+imgHand;
			strNewHTML += 'width:' + jQuery(this).width() + 'px;' + 'height:' + jQuery(this).height() + 'px;';
			strNewHTML += 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader' + '(src=\'' + jQuery(this).attr('src') + '\', sizingMethod=\'scale\');';
			strNewHTML += imgStyle+'"></span>';
			if (prevStyle != ''){
				strNewHTML = '<span style="position:relative;display:inline-block;'+prevStyle+imgHand+'width:' + jQuery(this).width() + 'px;' + 'height:' + jQuery(this).height() + 'px;'+'">' + strNewHTML + '</span>';
			}

			jQuery(this).hide();
			jQuery(this).after(strNewHTML);

		});

		// fix css background pngs
		jQuery(this).find("*").each(function(){
			var bgIMG = jQuery(this).css('background-image');
			if(bgIMG.indexOf(".png")!=-1){
				var iebg = bgIMG.split('url("')[1].split('")')[0];
				jQuery(this).css('background-image', 'none');
				jQuery(this).get(0).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + iebg + "',sizingMethod='scale')";
			}
		});
		
		//fix input with png-source
		jQuery(this).find("input[src$=.png]").each(function() {
			var bgIMG = jQuery(this).attr('src');
			jQuery(this).get(0).runtimeStyle.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader' + '(src=\'' + bgIMG + '\', sizingMethod=\'scale\');';
   		jQuery(this).attr('src', settings.blankgif)
		});
	
	}
	
	return jQuery;

};

})(jQuery);
jQuery.noConflict();
jQuery(document).ready(function(){
                var calculatedWidth = 0;
                jQuery(document).pngFix( );
                jQuery('#nav li').each(function(i) { calculatedWidth += jQuery(this).width(); });
                jQuery('#nav').css('width',calculatedWidth);
                var calculatedWidth = 0;
                jQuery('#footer_nav li').each(function(i) { calculatedWidth += jQuery(this).width(); });
                jQuery('#footer_nav').css('width',calculatedWidth);
                jQuery('a').each(function(i) { jQuery(this).click(function(e) {this.blur();}); });
	});