function hideShow(strVar, intId)
	   {
	   		if(document.getElementById('demo').value =='When would you like to see a demo?')
			{
				document.getElementById('demo').value = ''; 
				$("#"+intId).show();
			}
			if(strVar.value != "")
			{
				$("#"+intId).show();
			}
			else
			{
				strVar.focus();
			}
	   }
	  /*  
	 $(document).ready(function () {
								
               $('#option1').datepicker();
                $('#option2').datepicker();

               /*<!-- $('#img_call_cal').click(function() {
                  $('#option1').focus();
                });
                
                $('#img_call_calendar').click(function() {
                  $('#option2').focus();
                });-->*-/
        });*/

	function validateEmailId(strVar)
 	{
		var strEmail = strVar.value;
		var strReg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
		if(strReg.test(strEmail) == false)
		{
			alert('Email address seems incorrect(Please check and make sure you use "@" and .com, .net, etc.)');
			strVar.value = '';
			strVar.focus();
		
			return false;
		}
		else
		{
			//hideShow(strVar,'6');
		}
 	}
	function CheckTime(strVar)
	{		
			
			date = strVar.value.split(':');
			var hour = date[0];
			var minutes  = date[1];
		
			
			var strErrorMsg = "";
			if(isNaN(hour) == true)
			{
				strErrorMsg += "Please enter proper value for Time.\n";	
			}
			else if(parseInt(hour) > '24')
			{		
				strErrorMsg += "Please enter proper value for Time.\n";
			}
			else if(minutes == '')
			{
				strErrorMsg += "Please enter proper value for Time.\n";
			}
			else if(parseInt(minutes) > '60')
			{
				strErrorMsg += "Please enter proper value for Time.\n";
			}
			
			if(strErrorMsg!='')
			{
				alert(strErrorMsg);
				strVar.value = '';
				strVar.focus();
			}
			
	}
	
	$("#phone").keypress(function(event) {
  // Backspace, tab, enter, end, home, left, right
  // We don't support the del key in Opera because del == . == 46.

  var controlKeys = [8, 9, 13, 35, 36, 37, 39];
  // IE doesn't support indexOf
  var isControlKey = controlKeys.join(",").match(new RegExp(event.which));
  // Some browsers just don't raise events for control keys. Easy.
  // e.g. Safari backspace.
  
  if (!event.which || // Control keys in most browsers. e.g. Firefox tab is 0
      (48<= event.which && event.which <= 57) ||   isControlKey) { // Opera assigns values for control keys.
    return;
  } else {
    event.preventDefault();
  }
});

function getState(strZipCode)
{
	
	$.ajax({
				type: "GET",
				//url: "http://localhost/meditab_new/med_zip.php?zip_code="+strZipCode,
				url: "http://www.meditab.com/med_zip.php?zip_code="+strZipCode,
				//url: "http://192.168.88.3/meditab-kirk/site/med_zip.php?zip_code="+strZipCode,
				cache:false,
				async:false,
				success: function(data) {
					if(data != "" && data != 'This is not a Valid zip') 
					{
						$('#state').val(data);	
						$('#state').show();
						
					}
					else
					{
						$('#state').hide();
					}
			}	
		});
}


function checkRequestForm()//checkFormValidation()
{	
    var strOrganization		=	document.getElementById("txt_organization").value;
    var strFirstName		=	document.getElementById("txt_first_name").value;
    var strEmail			=	document.getElementById("txt_email").value;
    //var strPhone			=	document.getElementById("txt_phone").value;
	var strPhoneOne         =   document.getElementById('phone1').value;
	var strPhoneTwo         =   document.getElementById('phone2').value;
	var strPhoneThree       =   document.getElementById('phone3').value;
  
    var strComment			=	document.getElementById("ta_comment").value;
 
    var blnValidate			=	true;
    var strErrorMsg			=	"";

    if((strOrganization == '' || strOrganization == null) || strOrganization == 'Organization')
    {
        strErrorMsg += "Please enter value for Practice Name. \n";
    }

    if(strFirstName == '' || strFirstName == null)
    {
        strErrorMsg += "Please enter value for Contact Name.\n";
    }

    if((strEmail == '' || strEmail == null) || strEmail == 'Email Address')
    {
        strErrorMsg += "Please enter value for Email.\n";
    }
    else
    {
       var strReg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
       if(strReg.test(strEmail) == false)
       {
            strErrorMsg += "Please enter a Valid Value for Email.\n";
       }
    }
	if(strPhoneOne == '' || strPhoneTwo == '' || strPhoneThree == '')
	{
		strErrorMsg += "Please enter value for Phone.\n";
		blnValidate = false;
	}
   
    if(strComment == '' )
    {
        strErrorMsg += "Please enter value of Message.\n";
    }
   
    if(strErrorMsg  != '')
    {
        alert(strErrorMsg);
        return false;
    }
	else
	{
//		document.interactive-demo.action = "php/interactive_demo_action.php";
		document.interactive_demo.submit();
		document.getElementById("submitButton").disabled = true;		
	}
}

function autotab(original,destination)
{
   	if (original.getAttribute&&original.value.length==original.getAttribute("maxlength"))
    destination.focus()
}

	
function onBlurMaskPhon(strTextBox,intStringLen)
{
    var strVal = strTextBox.value;
    var intInputStringLen = strVal.length;
    var intMaxStringLen = intStringLen;
    var $strMsg = '';
    var $strMessage = '';

    // if no digits....nada entered.....blank it.
    if (isNaN(strVal) || strVal == '' || strVal == null)
    {
            if(intStringLen != 5)
            {
               $strMsg = 'Please Enter Numeric Phone Number';
            }
            else
            {
                $strMsg = 'Please enter Numeric Extension';
            }
            alert($strMsg);
            strTextBox.focus();
            strTextBox.value = '';
            return false;
    }
    else
    {
        if(intInputStringLen != intMaxStringLen && intStringLen != 5)
        {
            $strMessage = 'Please enter '+intStringLen+' Digits only';
            alert($strMessage);
            strTextBox.focus();
            strTextBox.value = '';
            return false;
        }
    }
}
