$(document).ready(function($){

 $("#connect").submit( function() {
 
 PostToTrust();
        
 });


    $("#title").focus(); 
    $("#rowPreviousRoleOther").hide();
    
	$("#previousrole").change( function() {
		if ($("#previousrole").val() == "Other")
		    $("#rowPreviousRoleOther").show();
		else 
		    $("#rowPreviousRoleOther").hide();
	});
	
	if(showOther==1){
	$("#rowPreviousRoleOther").show();
	}
	
	
	/* SET HELP TEXT */
	
    $("#hoverEmail").hover(
      function () {
       $("#msgEmailTxt").show('slow');
      }, 
      function () {
       $("#msgEmailTxt").hide('slow');
      }
    );
    
     $("#hoverTelephone").hover(
      function () {
       $("#msgTelephoneTxt").show('slow');
      }, 
      function () {
       $("#msgTelephoneTxt").hide('slow');
      }
    );


});




// 
// 
//private void Valid()
//		{
//			var isValid=false;
//			
//			if(Request.QueryString["title"]!=null)
//			{
//			    $("#lbTitle").css("color","#ff9900");
//				isValid=true;
//			}
//			if(Request.QueryString["fname"]!=null)
//			{
//			    $("#lbFname").css("color","#ff9900");
//				isValid=true;
//			}
//			if(Request.QueryString["lname"]!=null)
//			{
//				$("#lbLname").css("color","#ff9900");
//				isValid=true;
//			}
//			if(Request.QueryString["email"]!=null)
//			{
//				if(Request.QueryString["email"].ToString()=="if")
//				{
//				$("#lbValidate").innerHTML("<br/>The personal email address provided is not valid");
//				}

//                $("#lbLname").css("color","#ff9900");
//				lbEmail.ForeColor=orange;
//				isValid=true;

//			}


//			if(Request.QueryString["telephone"]!=null)
//			{
//				lbTelephone.ForeColor=orange;
//				isValid=true;
//			}
//			if(Request.QueryString["city"]!=null)
//			{
//				lbCity.ForeColor=orange;
//				isValid=true;
//			}

//			if(Request.QueryString["country"]!=null)
//			{
//				lbCountry.ForeColor=orange;
//				isValid=true;
//			}
//			if(Request.QueryString["previouscompany"]!=null)
//			{
//				lbPrevCompany.ForeColor=orange;
//				isValid=true;
//			}
//			if(Request.QueryString["previousemail"]!=null)
//			{

//				if(Request.QueryString["previousemail"].ToString()=="if")
//				{
//					lbValidate.Text+="<br/>The previous employer email address provided is not valid";
//				}

//				lbPrevEmail.ForeColor=orange;
//				isValid=true;
//			}



//			if(Request.QueryString["terms"]!=null)
//			{
//				lbTerms.ForeColor=orange;
//				isValid=true;
//			}

//			if(Request.QueryString["products"]!=null)
//			{
//				lbProducts.ForeColor=orange;
//				isValid=true;
//			}

//			if(isValid == false)
//			{
//				lbValidate.Text+="<br/>Please enter all mandatory fields.";
//			}
//		}

function GetFormValues()
{
 var Values=new Array(14);
   Values[0] = $("title").attr("value");
   Values[1] = $("fname").attr("value");
   Values[2] = $("lname").attr("value");
   Values[3] = $("email").attr("value");
   Values[4] = $("telephone").attr("value");
   Values[5] = $("city").attr("value");
   Values[6] = $("country").attr("value");
   Values[7] = $("products").attr("value");
   Values[8] = $("previouscompany").attr("value");
   Values[9] = $("previousemail").attr("value");
   Values[10] = $("previoustelephone").attr("value");
   Values[11] = $("previousrole").attr("value");
   Values[12] = $("previousroleother").attr("value");
   Values[13] = $("terms").attr("value");
   
   return Values;
}

function PostToTrust()
{
 
 //alert("hello");


//            string strDescription = strPreviousCompany + "|" + strPreviousEmail + "|" + strPreviousRole;
//            StringBuilder str = new StringBuilder();
//            str.Append("title=" + strTitle + "&");
//            str.Append("first_name=" + strFname + "&");
//            str.Append("last_name=" + strLname + "&");
//            str.Append("email=" + strEmail + "&");
//            str.Append("telephone=" + strTelephone + ",");
//            str.Append("city=" + strCity + "&");
//            str.Append("00N40000001aap8=" + strCountry + "&"); //country
//            str.Append("00N40000001arj8=" + strProducts + "&");//product of interest
//            str.Append("lead_source=Web - Stay Connected\"&"); //lead source
//            str.Append("00N40000001arij=Financial\"&");//category of interest
//            str.Append("description=" + strDescription + "&");//description
//            str.Append("oid=00D30000000602X\"&");//oid
//            str.Append("retURL=http://online.thomsonreuters.com/stayconnected");//return url
//            
//            
//$.post("https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8", { 
//title: "John", 
//first_name: "John",
//last_name: "John",
//email: "John",
//telephone: "John",
//city: "2pm" },
//  function(data){
//    alert("Data Loaded: " + data);
//  });

}