/*
Preload images script
*/

var myimages=new Array();
function preloadimages(){
for (i=0;i<preloadimages.arguments.length;i++){
myimages[i]=new Image(); 
myimages[i].src=preloadimages.arguments[i]; 
}
}

//Enter path of images to be preloaded inside parenthesis. Extend list as desired.
preloadimages("http://localhost:9000/Houstonlawyersdirect/wp-content/themes/Houston_Lawyers_Direct/images/ro_02.gif","http://houstonlawyersdirect.com/wp-content/themes/Houston_Lawyers_Direct/images/ro_02.gif","http://houstonlawyersdirect.com/wp-content/themes/Houston_Lawyers_Direct/images/ro_03.gif","http://houstonlawyersdirect.com/wp-content/themes/Houston_Lawyers_Direct/images/ro_03.gif","http://houstonlawyersdirect.com/wp-content/themes/Houston_Lawyers_Direct/images/ro_05.gif","http://houstonlawyersdirect.com/wp-content/themes/Houston_Lawyers_Direct/images/ro_06.gif")


<!--
function FP_preloadImgs() {//v1.0
 var d=document,a=arguments; if(!d.FP_imgs) d.FP_imgs=new Array();
 for(var i=0; i<a.length; i++) { d.FP_imgs[i]=new Image; d.FP_imgs[i].src=a[i]; }
}
// -->


<!--
function favoris() {
if ( navigator.appName != 'Microsoft Internet Explorer' )
{ window.sidebar.addPanel("Houston Lawyers Direct","http://www.houstonlawyersdirect.com/",""); }
else { window.external.AddFavorite("http://www.houstonlawyersdirect.com/","Houston Lawyers Direct"); } }
// -->

/***********************************************
* Pop-it menu- Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var defaultMenuWidth="150px"; //set default menu width.

var linkset=new Array();
//SPECIFY MENU SETS AND THEIR LINKS. FOLLOW SYNTAX LAID OUT

linkset[0]='<a href="http://www.houstonlawyersdirect.com/wp-login.php">Login to Wordpress</a>';
linkset[0]+='<a href="http://www.houstonlawyersdirect.com/attorney/">Attorney Login</a>';


////No need to edit beyond here

var ie5=document.all && !window.opera; 
var ns6=document.getElementById; 

if (ie5||ns6)
document.write('<div id="popitmenu" onMouseover="clearhidemenu();" onMouseout="dynamichide(event)"></div>'); 

function iecompattest(){
return (document.compatMode && document.compatMode.indexOf("CSS")!=-1)? document.documentElement : document.body;
}

function showmenu(e, which, optWidth){
if (!document.all&&!document.getElementById)
return;
clearhidemenu();
menuobj=ie5? document.all.popitmenu : document.getElementById("popitmenu");
menuobj.innerHTML=which;
menuobj.style.width=(typeof optWidth!="undefined")? optWidth : defaultMenuWidth; 
menuobj.contentwidth=menuobj.offsetWidth;
menuobj.contentheight=menuobj.offsetHeight;
eventX=ie5? event.clientX : e.clientX;
eventY=ie5? event.clientY : e.clientY;
//Find out how close the mouse is to the corner of the window
var rightedge=ie5? iecompattest().clientWidth-eventX : window.innerWidth-eventX;
var bottomedge=ie5? iecompattest().clientHeight-eventY : window.innerHeight-eventY;
//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<menuobj.contentwidth)
//move the horizontal position of the menu to the left by it's width
menuobj.style.left=ie5? iecompattest().scrollLeft+eventX-menuobj.contentwidth+"px" : window.pageXOffset+eventX-menuobj.contentwidth+"px";
else
//position the horizontal position of the menu where the mouse was clicked
menuobj.style.left=ie5? iecompattest().scrollLeft+eventX+"px" : window.pageXOffset+eventX+"px";
//same concept with the vertical position
if (bottomedge<menuobj.contentheight)
menuobj.style.top=ie5? iecompattest().scrollTop+eventY-menuobj.contentheight+"px" : window.pageYOffset+eventY-menuobj.contentheight+"px";
else
menuobj.style.top=ie5? iecompattest().scrollTop+event.clientY+"px" : window.pageYOffset+eventY+"px";
menuobj.style.visibility="visible";
return false;
}

function contains_ns6(a, b) {
//Determines if 1 element in contained in another- by Brainjar.com
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function hidemenu(){
if (window.menuobj)
menuobj.style.visibility="hidden";
}

function dynamichide(e){
if (ie5&&!menuobj.contains(e.toElement))
hidemenu();
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
hidemenu();
}

function delayhidemenu(){
delayhide=setTimeout("hidemenu()",500);
}

function clearhidemenu(){
if (window.delayhide)
clearTimeout(delayhide);
}

if (ie5||ns6)
document.onclick=hidemenu;

google.load("maps", "2.x");
var mapset = false;
var xaddress;
var xpoint;
var xmap;
var gdir;

function load(address, point) {
    if (GBrowserIsCompatible()) {
        var map = new google.maps.Map2(document.getElementById("mapinternal"));
        xmap = map;

        map.setCenter(point, 13);
        var marker = new google.maps.Marker(point);
        map.addOverlay(marker);
        map.addControl(new google.maps.LargeMapControl());
        infoMessage = "<div style='font-size: 13px;'>";
        infoMessage += '<form action="#" onsubmit="getDirection(this.from.value); return false;" >';
        infoMessage += "Get directions from ";
        infoMessage += "<input type='text' name='from' value='' size='10' style='font-size: 13px; border: 1px solid #333333; background-color: #EBE6DC;' />";
        infoMessage += "to <span style='font-weight: bold;'>"+address+"</span> ";
        infoMessage += "<input type='submit' name='submit' value='Get Directions' style='background-color: #99B3CC; border: 1px solid #333333; font-weight: bold;' />";
        infoMessage += "</form></div>";
        marker.openInfoWindowHtml(infoMessage);
    }
}

function getDirection(from) {
    document.getElementById("directions").innerHTML = "";
    gdir = new google.maps.Directions(xmap, document.getElementById("directions"));
    gdir.load('from: '+xaddress+' to: '+from);
}

function showAddress(address) {
    xaddress = address;
    var geocoder = new GClientGeocoder();
    geocoder.getLatLng(
        address,
        function(point) {
            if(!point) {
                alert(address + 'not found');
            } else {
                xpoint = point;
                load(address, point);
            }
        }
    );
}

function prepareMapBg(address) {
    var width = document.body.offsetWidth;
    if(!width)
        width = document.documentElement.offsetWidth;

    bgtop = '50px';
    bgheight = '400px';
    bgwidth = '850px';
    bgleft = ((width/2) - 425)+'px';

    var bg = document.getElementById('mapbg');

    bg.style.top = bgtop;
    bg.style.left = bgleft;
    bg.style.height = bgheight;
    bg.style.width = bgwidth;
    bg.style.display = 'block';

    if(!mapset) {
        showAddress(address);
        mapset = true;
    }
}

function closeMapBg() {
    document.getElementById('mapbg').style.display = 'none';
}

function reloadMap() {
    if(mapset) {
        showAddress(xaddress);
        document.getElementById("directions").innerHTML = "<div style='font-size: 13px; text-align: center;'>Directions</div>";
    }
}

<!--

function dynAnimation() {}



function clickSwapImg() {}



function closeopen(id)

{    

    obj = document.getElementById(id);

    if ( obj.style.display == "none" ) obj.style.display = ""; else obj.style.display = "none";

}


function openterm()
{
    theURL = "http://www.houstonlawyersdirect.com/terms.php";
    winName = "forgetpassword";
    features = "top=0, left=0, width=730, height=593";
    window.open(theURL, winName, features);
}

function isEmail(s) {
    var reg = new RegExp('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$'); 
    return s == '' || reg.test(s) ;
}

function validate(frm)

{

errFlag = 1;

for ( x=0; x<frm.rdoIdCaseType.length; x++ ) {

    var obj = frm.rdoIdCaseType[x];

    if ( obj.checked ) errFlag = 0;

    }

if ( errFlag == 1 ) {

    alert("Please Select Type of Case"); return false;

    }

if ( frm.txtFirstName.value.split(" ").join("") == "" ) {

    alert("Please enter value for First Name"); frm.txtFirstName.select(); frm.txtFirstName.focus(); return false;

    }

if ( frm.txtLastName.value.split(" ").join("") == "" ) {

    alert("Please enter value for Last Name"); frm.txtLastName.select(); frm.txtLastName.focus(); return false;

    }

if ( frm.txtState.value.split(" ").join("") == "" ) {

    alert("Please enter value for State"); frm.txtState.select(); frm.txtState.focus(); return false;

    }

if ( frm.txtZip.value.split(" ").join("") == "" ) {

    alert("Please enter value for Zip"); frm.txtZip.select(); frm.txtZip.focus(); return false;

    }

if ( frm.txtCity.value.split(" ").join("") == "" ) {

    alert("Please enter value for City"); frm.txtCity.select(); frm.txtCity.focus(); return false;

    }

if ( frm.txtEmail.value.split(" ").join("") == "" ) {

    alert("Please enter value for Email"); frm.txtEmail.select(); frm.txtEmail.focus(); return false;

    }

if ( !isEmail(frm.txtEmail.value) ) {

    alert("Please enter a valid Email"); frm.txtEmail.select(); frm.txtEmail.focus(); return false;

    }

if ( frm.txtEmail.value != frm.txtreEmail.value ) {

    alert("Email and retyped Email must be same"); frm.txtreEmail.select(); frm.txtreEmail.focus(); return false;

    }

if ( frm.txtDayTimePhone.value.split(" ").join("") == "" ) {

    alert("Please enter value for Day Time Phone"); frm.txtDayTimePhone.select(); frm.txtDayTimePhone.focus(); return false;

    }

if ( frm.txtSecurityCode.value.split(" ").join("") == "" ) {

    alert("Please enter value for Security Code"); frm.txtSecurityCode.select(); frm.txtSecurityCode.focus(); return false;

    }

return true;

}
//]]>