// JavaScript Document
var time = null;
function showTab(idIndex){
	show = "document.getElementById('" + idIndex + "').style.display = 'block'";
	time = setTimeout(show,10);
}
function hideTab(idIndex){
	show = "document.getElementById('" + idIndex + "').style.display = 'none'";
	time = setTimeout(show,10);
}
function stopTimeOut(){
	clearTimeout(time);
}

var scrollWidth;

function position() {
	if(document.body.scrollWidth>780) {
	x_poz=document.body.scrollWidth/2 - 154;
	document.getElementById('criminal').style.left = x_poz+'px';
	x_poz=document.body.scrollWidth/2 - 154;
	document.getElementById('sex_crimes').style.left = x_poz+'px';
	x_poz=document.body.scrollWidth/2 - 154;
	document.getElementById('federal_law').style.left = x_poz+'px';
	x_poz=document.body.scrollWidth/2 - 154;
	document.getElementById('personal').style.left = x_poz+'px';
	x_poz=document.body.scrollWidth/2 - 154;
	document.getElementById('malpractice').style.left = x_poz+'px';
	x_poz=document.body.scrollWidth/2 - 154;
	document.getElementById('real_estate').style.left = x_poz+'px';
	} else {
		x_poz=240;
		document.getElementById('criminal').style.left = x_poz+'px';
		document.getElementById('sex_crimes').style.left = x_poz+'px';
		document.getElementById('federal_law').style.left = x_poz+'px';
		document.getElementById('personal').style.left = x_poz+'px';
		document.getElementById('malpractice').style.left = x_poz+'px';
		document.getElementById('real_estate').style.left = x_poz+'px';
		}
}
function showHide(k)
{
	s = ""+document.getElementById("aq_"+k).innerHTML;
	if (s=="»»»")
	{
		document.getElementById("section_"+k).style.display = "block";
		document.getElementById("aq_"+k).innerHTML = "&laquo;&laquo;&laquo;";
	}else
	{
		document.getElementById("section_"+k).style.display = "none";
		document.getElementById("aq_"+k).innerHTML = "&raquo;&raquo;&raquo;";
	}
	return false;
}

function gid(id)
{
	return document.getElementById(id);
}

function formSubmit()
{
	var send = true;
	send *= k = gid("nm").value.length;
	if (k)
	gid("nm_txt").style.color = "#656565";
	else
	gid("nm_txt").style.color = "#FF0000";

	send *= k = gid("ad").value.length;
	if (k)
	gid("ad_txt").style.color = "#656565";
	else
	gid("ad_txt").style.color = "#FF0000";

	send *= k = gid("ct").value.length;
	if (k)
	gid("ct_txt").style.color = "#656565";
	else
	gid("ct_txt").style.color = "#FF0000";

	send *= k = gid("st").value.length;
	if (k)
	gid("st_txt").style.color = "#656565";
	else
	gid("st_txt").style.color = "#FF0000";

	r = /^\d{5}$/;
	send *= k = gid("zp").value.search(r)+1;
	if (k)
	gid("zp_txt").style.color = "#656565";
	else
	gid("zp_txt").style.color = "#FF0000";

	send *= k = gid("ph").value.length;
	if (k)
	gid("ph_txt").style.color = "#656565";
	else
	gid("ph_txt").style.color = "#FF0000";

	r = /^[a-z]+\.?[-_.a-z0-9]*@[a-z][-_.a-z0-9]+\.[a-z]{2,3}$/i;
	send *= k = gid("ml").value.search(r)+1;
	if (k)
	gid("ml_txt").style.color = "#656565";
	else
	gid("ml_txt").style.color = "#FF0000";

	r = /^.{1,1000}$/;
	send *= k = gid("in").value.search(r)+1;
	if (k)
	gid("in_txt").style.color = "#656565";
	else
	gid("in_txt").style.color = "#FF0000";

	$.get("php/check_antibot.php?sec_code=" + $('#sec_code').val(), function(data){
        if ('f' == data){
            send = false;
            gid("captcha_txt").style.color = "#FF0000";
        } else {
            gid("captcha_txt").style.color = "#656565";
        }
        if (send)
		return true;
	else
	{
		alert("Please fill in correctly required fields.");
		return false;
	}
        });
        return false;
}