// BOOKMARK

function addBookmark(title, url) {
        if (window.sidebar) { // firefox
              window.sidebar.addPanel(title, url,"");
        } else if( document.all ) { //MSIE
                window.external.AddFavorite( url, title);
        } else {
               alert("Sorry, your browser doesn't support this");
        }
}
// COPY FIELDS

function CopyFields(f) {
  if(f.same.checked == true) {
  	if (f.state.value !=='Texas'){
  	alert('We Are Only Licensed To Preform Inspections In Texas');
  	}
    else {
	    f.PAddress.value = f.street.value;
	    f.PCity.value = f.city.value;
	    f.PZip.value = f.zip.value;
	    }
  }
    else if (f.same.checked == false) {
    f.PAddress.value = '';
    f.PCity.value = '';
    f.PZip.value = '';
  }
}


function autoTab(element, nextElement) {
    if (element.value.length == element.maxLength && nextElement != null) {
        element.form.elements[nextElement].focus();
    }
}



//// NEW WINDOWS


function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'titlebar=no,toolbar=no,scrollbars=no,directories=no,location=no,statusbar=no,menubar=no,resizable=no,width=350,height=250,left = 515,top = 259');");
}


var newwindow;
function pop(url)
{
	
	newwindow=window.open(url,'name','height=200,width=200');
	if (window.focus) {newwindow.focus()}
}




var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)

if (window.focus) {NewWindow.focus()}


}



///SHOW HIDE DIVS

function showHide(inID) {
     if (document.getElementById(inID).style.display == 'none') {
          document.getElementById(inID).style.display = 'block';
     } else {
          document.getElementById(inID).style.display = 'none';
     }
}

// SHOW ONLY
function Show(inID) {
     if (document.getElementById(inID).style.display == 'none') {
          document.getElementById(inID).style.display = 'block';
     } else {
          document.getElementById(inID).style.display = 'block';
     }
}

// HIDE ONLY
function Hide(inID) {
     if (document.getElementById(inID).style.display == 'block') {
          document.getElementById(inID).style.display = 'none';
     } else {
          document.getElementById(inID).style.display = 'none';
     }
}

// AGREE SUBMIT

function ButtonCheck(f) {
  if(f.agree.checked == false) {
  	alert('Please read and agree to our terms before logging in.');
  	}
  	}
	
	
var checkobj

function agreesubmit(el){
checkobj=el
if (document.all||document.getElementById){
for (i=0;i<checkobj.form.length;i++){  //hunt down submit button
var tempobj=checkobj.form.elements[i]
if(tempobj.type.toLowerCase()=="submit")
tempobj.disabled=!checkobj.checked
}
}
}

function defaultagree(el){
if (!document.all&&!document.getElementById){
if (window.checkobj&&checkobj.checked)
return true
else{
alert("Please read/accept terms to submit form")
return false
}
}
}


// DISABLE RIGHT CLICK
var message="Call Paul's Today: (850) 222-6808";

///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}

function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("alert(message);return false")