// JavaScript Document
function st_yes ( o, n )
{
	if( $(o).is(":checked ") )
	{
		$("#v_psrv"+n).val("Yes");
		$("#v_psrv_td"+n).show();
		//$("#v_psrt"+n).addClass('chk');
	}
}
function st_no ( o, n )
{
	if( $(o).is(":checked ") )
	{
		$("#v_psrv"+n).val("No");
		$("#v_psrv_td"+n).hide();
		//$("#v_psrt"+n).removeClass('chk').val('').css({ backgroundColor:"#ffffff"});
	}
}

function sot (n)
{
	if( $('#v_ot'+n).val()=='Other' )
		$("#iot"+n).show().addClass('chk');
	else
		$("#iot"+n).hide().removeClass('chk');

	if( $('#v_ot'+n).val()=='Car' )
		$("#wc"+n).hide();
	else
		$("#wc"+n).show();
}
function sP(str)
{
	L=str.length;
	c = 0;
	for(i=0;i<L;i++)
		if(str[i]=='@')c++;
	if(c > 1)
	{
		alert("Please enter single email!")
		return false;
	}
	return true;
}
function emailCheck()
{
	m = $("#or_email").val();
	reg=/[\w-]+@([\w-]+\.)+[\w]/; 
	if(reg.test(m) && sP(m)) 
	{
		$("#or_email").css({ backgroundColor:"#FFFFFF"});
		return true;
	}
	$("#or_email").css({ backgroundColor:"#FF9999"});
	return false;
}

function dr()
{
	sbmt = true;
	$(".chk").each(function(){
		if($(this).val())
		{
			$(this).css({ backgroundColor:"#ffffff"});
		}
		else
		{
			$(this).css({ backgroundColor:"#FF9999"});
			sbmt = false;
		}		
	});
	if(!document.calc.lb_ch1.checked)
	{
		sbmt = false;
		$("#lb_ch1").css({ backgroundColor:"#FF9999"});
	}
	else
		$("#lb_ch1").css({ backgroundColor:"#FFFFFF"});
		
	if(!emailCheck()) sbmt = false;
	if(sbmt)
		$("#calc").submit();
	else
	 alert("Please fill out required (highlighted) fields!");
}

