function showhide_tag(tag)
{
	var r=document.getElementById('residential');
	var c=document.getElementById('commercial');
	if(tag == 'residential')
	{
		c.style.display='none';
		r.style.display='';

	}
	else
	{
		c.style.display='';
		r.style.display='none';
	}

}


function cellphone(val)
{
    var intPattern = /^[+-]?[0-9]{10,15}$/;
	if(intPattern.test(val))
		return true;
	else
		return false;
}
function checkInteger( evt )
{
    var ch;             // the character to process
    
    var keyOK = false;  // presume it's bad

    var isSpecial;      // non-printing character?
    
    var source;         // the event source
    
    var intPattern = /^[0-9]{0,3}[-]?[0-9]{0,3}[-]?[0-9]{0,4}$/;

    if (!evt)
    {
        evt = window.event;
    }

    ch = evt.charCode;
    if (!ch)
    {
        ch = evt.keyCode;
    }

    isSpecial = ( ch == evt.DOM_VK_TAB || ch == evt.DOM_VK_BACK_SPACE || ch == evt.DOM_VK_LEFT || ch == evt.DOM_VK_RIGHT);

    if (isSpecial)
    {
        keyOK = true;
    }
    else
    {
        ch = String.fromCharCode( ch );
		
        if (evt.target) 
        {
            source = evt.target;
        }
        else
        {
            source = evt.srcElement;
        }
		var str=source.value+'';
		
		if((str.length == 3) || (str.length == 7))
		{
			if(ch != '-')
			{
				source.value=source.value+'-';
			}
		}
		else
		{
			if(ch == '-')
			{
				ch = 'Q';
			}

		}

        keyOK = intPattern.test( source.value + ch );
    }
    return keyOK;
}


function checkInteger_2( evt )
{
    var ch;             // the character to process
    
    var keyOK = false;  // presume it's bad

    var isSpecial;      // non-printing character?
    
    var source;         // the event source
    
    var intPattern = /^[0-9]{0,10}$/;

    if (!evt)
    {
        evt = window.event;
    }

    ch = evt.charCode;
    if (!ch)
    {
        ch = evt.keyCode;
    }

    isSpecial = ( ch == evt.DOM_VK_TAB || ch == evt.DOM_VK_BACK_SPACE || ch == evt.DOM_VK_LEFT || ch == evt.DOM_VK_RIGHT);

    if (isSpecial)
    {
        keyOK = true;
    }
    else
    {
        ch = String.fromCharCode( ch );
		
        if (evt.target) 
        {
            source = evt.target;
        }
        else
        {
            source = evt.srcElement;
        }
		var str=source.value+'';
		
        keyOK = intPattern.test( source.value + ch );
    }
    return keyOK;
}
