  
$(function () {
	            $('#B_chatSalesRep').click(function () {
				      $('#chatSalesRep').fadeIn();
					  $('#chatCustServRep').hide();
					  $('#chatProductPro').hide();
					  $('#chatUsed').hide();
					  $('#liveChatOff').hide();
				    });
				
	            $('#B_chatCustServRep').click(function () {
					
					if( CSHoursFlag == true)
					{	
						$('#chatCustServRep').fadeIn();
						$('#chatSalesRep').hide();
						$('#chatProductPro').hide();
						$('#chatUsed').hide();
						$('#liveChatOff').hide();
						
						
					}
					else
					{
						$('#liveChatOff').fadeIn();
						$('#chatCustServRep').hide();
						$('#chatSalesRep').hide();
						$('#chatProductPro').hide();
						$('#chatUsed').hide();  
					}
				  });
	            
				$('#B_chatProductPro').click(function () {
				      $('#chatProductPro').fadeIn();
					  $('#chatCustServRep').hide();
					  $('#chatSalesRep').hide();
					  $('#chatUsed').hide();
					  $('#liveChatOff').hide();
				    });
				
				$('#B_chatUsed').click(function () {
				      $('#chatUsed').fadeIn();
					  $('#chatCustServRep').hide();
					  $('#chatSalesRep').hide();
					  $('#chatProductPro').hide();
					  $('#liveChatOff').hide();
				    });
				});
 
 function testResultsSR ()
	{
	var mytopic = document.chat_form_sales_rep.di.value;
	var mycustomername = document.chat_form_sales_rep.fname.value;
	var test = mycustomername.match(/^\s*$/);
	if(test != null)
	mycustomername = "";
		 
	if (mytopic != "" && mycustomername != "")
			{
				return;
			}
	else if (mytopic != "" && mycustomername == "")
			{
				alert('Please enter a name');
				return false;
			}
	else if (mytopic == "" && mycustomername != "")
			{
				alert('Please select a topic');
				return false;
			}
	else if (mytopic == "" && mycustomername == "")
			{
				alert('Please enter a name and select a topic.');
				return false;
			}
	}
		
function testResultsCS ()
	{
	var mytopic = document.chat_form_cust_serv.optionaldata3.value;
	var mycustomername = document.chat_form_cust_serv.fname.value;
	var test = mycustomername.match(/^\s*$/);
	if(test != null)
	mycustomername = "";
	
	if (mytopic != "" && mycustomername != "")
			{
				return;
			}
	else if (mytopic != "" && mycustomername == "")
			{
				alert('Please enter a name');
				return false;
			}
	else if (mytopic == "" && mycustomername != "")
			{
				alert('Please select a topic');
				return false;
			}
	else if (mytopic == "" && mycustomername == "")
			{
				alert('Please enter a name and select a topic.');
				return false;
			}
	}

function testResultsPP ()
	{
	var mytopic = document.chat_form_product_pro.di.value;
	var mycustomername = document.chat_form_product_pro.fname.value;
	var test = mycustomername.match(/^\s*$/);
	if(test != null)
	mycustomername = "";
	
	if (mytopic != "" && mycustomername != "")
			{
				return;
			}
	else if (mytopic != "" && mycustomername == "")
			{
				alert('Please enter a name');
				return false;
			}
	else if (mytopic == "" && mycustomername != "")
			{
				alert('Please select a topic');
				return false;
			}
	else if (mytopic == "" && mycustomername == "")
			{
				alert('Please enter a name and select a topic.');
				return false;
			}
	}

function testResultsUsed ()
	{
	var mytopic = document.chat_form_Used.di.value;
	var mycustomername = document.chat_form_Used.fname.value;
	var test = mycustomername.match(/^\s*$/);
	if(test != null)
	mycustomername = "";
	
	if (mytopic != "" && mycustomername != "")
			{
				return;
			}
	else if (mytopic != "" && mycustomername == "")
			{
				alert('Please enter a name');
				return false;
			}
	else if (mytopic == "" && mycustomername != "")
			{
				alert('Please select a topic');
				return false;
			}
	else if (mytopic == "" && mycustomername == "")
			{
				alert('Please enter a name and select a topic.');
				return false;
			}
	}

function gotoPage(someURL) {
    opener.location.href = someURL;
	window.location.href = "/BHPopUp.html"
    window.close(self);
}




