
$(document).ready(function() {
	
	$("#video_play").append("<iframe id='video' width='665' height='365' src='http://www.youtube.com/embed/7tCCKU3-Ytw?rel=0&autoplay=1' frameborder=0 allowfullscreen></iframe>");
	
	$(".thfirst").css("background-color","#FFFFFF");

	
	$("#videot_cont .th").click(function() {
		
	$("#videot_cont .th").css("background-color","#dddddd");

	var ch=$(this).parent().children().index(this)+1;
	
	if(ch==1)
	{
		$("iframe#video").attr('src','http://www.youtube.com/embed/7tCCKU3-Ytw?rel=0&autoplay=1');
		$(this).css("background-color","#FFFFFF");
		$("h2.videotitle").html("Integra: taking the &quot;fear&quot; out of outsourcing");

	}

	
	if(ch==2)
	{
		$("iframe#video").attr('src','http://www.youtube.com/embed/kaxmvGEAC6o?rel=0&autoplay=1');
		$("h2.videotitle").html("How to disaster proof your customer service");
		$(this).css("background-color","#FFFFFF");
	}
		
	if(ch==3)
	{
		$("iframe#video").attr('src','http://www.youtube.com/embed/MmSelBQXXFU?rel=0&autoplay=1');
		$(this).css("background-color","#FFFFFF");
		$("h2.videotitle").html("Listen to a customer of Integra");
	}
		
	});
	
});


function validchars(fldname,sts,msg)
	{		
		var fldlen = document.getElementById(fldname).value.length;
		var chksts = sts;
		if(chksts == "genchars")
		{
			var ichars = "@$%^*+=\\{}|<>";
		}
		else if(chksts == "mailchars")
		{
			var ichars = "!$#%^&*()+=-[]\\\':,/{}|\":<>?";
		}
		
		else if(chksts == "phonechars")
		{
			var ichars = "!@$#%^&*()+=[]\\\':,.{}|\":<>?abcdeghijklmnopqrstuvwxyzABCDEGHIJKLMNOPQRSTUVWXYZ";
		}
		
	
		for(var i=0;i < document.getElementById(fldname).value.length;i++)
		{
			if(ichars.indexOf(document.getElementById(fldname).value.charAt(i)) != -1)
			{
				alert(msg + " contain invalid characters");
				document.getElementById(fldname).focus();
				return false;
			}	
		}
	}
	
function chkspc(cntrl)
{
	var spchars;
	var spcsts;
	var len = document.getElementById(cntrl).value.length - 1;
	spchars = " ";
	spcsts = "f"; //false
	if(spchars.indexOf(document.getElementById(cntrl).value.charAt(0)) != -1)
	{
		spcsts = "t"; //true
		alert("Spaces are not allowed in the first place");				
	}
	else if(spchars.indexOf(document.getElementById(cntrl).value.charAt(len)) != -1)
	{
		spcsts = "t"; //true
		alert("Spaces are not allowed in the last place");								
	}
	if(spcsts == "t")
	{
		document.getElementById(cntrl).focus();
		return false;				
	}
}



var reEmail = /^[a-z0-9]([a-z0-9_\-\.]*)@([a-z0-9_\-\.]*)(\.[a-z]{2,3}(\.[a-z]{2}){0,2})$/i;

function echeck(strValue) 

				{

				  return reEmail.test(strValue);

				}
function validata()

				{

					if(document.frmenquiry.name.value == "")

					{

						alert("Name can't be blank");

						document.frmenquiry.name.focus();
					
						return false;

					}
					
					if(document.frmenquiry.company.value == "")

					{

						alert("Company can't be blank");

						document.frmenquiry.company.focus();

						return false

					}
						   
				
				if(document.frmenquiry.number.value == "")

					{

						alert("Phone Number can't be blank");

						document.frmenquiry.number.focus();

						return false

					}
				else if(document.frmenquiry.number.value != "")
					 if(chkspc("number")==false || validchars("number","phonechars","Phone")==false)

						{

							return false

						}
					
				
			   					
				if(document.frmenquiry.mail.value == "")

					{

						alert("Email ID can't be blank");

						document.frmenquiry.mail.focus();

						return false

					}
					
				else 
				{
				  if(document.frmenquiry.mail.value != "")
						if(chkspc("mail")==false || validchars("mail","mailchars","E-Mail")==false)

						{

							return false

						}
					
				if(echeck(document.frmenquiry.mail.value)==false)

					{		

						alert("Enter a valid email id");

						document.frmenquiry.mail.focus();

						return false

					}
				}
					if(document.frmenquiry.req.value == "")

					{

						alert("Requirements can't be blank");

						document.frmenquiry.req.focus();

						return false

					}
						   
													
				return true
				
	}		

