// JavaScript Document
var digits = "0123456789";
var phoneNumberDelimiters = "()- ";
var validWorldPhoneChars = phoneNumberDelimiters + "+";
var minDigitsInIPhoneNumber = 10;
function isInteger(s)
{   var i;
    for (i = 0; i < s.length; i++)
    {
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    return true;
}
function stripCharsInBag(s, bag)
{   var i;
    var returnString = "";
    for (i = 0; i < s.length; i++)
    {
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}
function checkInternationalPhone(strPhone)
{

s=stripCharsInBag(strPhone,validWorldPhoneChars);

return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);

}
function ValidForm()
{
  var firstname = document.getElementById('FirstName');
  var lastname = document.getElementById('LastName');
  var title = document.form_contactus.Title;
  var email = document.form_contactus.Email;
  var phone = document.form_contactus.Phone;
  var Mobile = document.form_contactus.Mobile;
  var website = document.form_contactus.Website;
  var LeadSource = document.form_contactus.LeadSource;
  var Industry = document.form_contactus.Industry;
  var NoofEmployees = document.form_contactus.NoofEmployees;
  var AnnualRevenue = document.form_contactus.AnnualRevenue;
  var services = document.form_contactus.Services;
   var Street = document.form_contactus.Street;
  var City = document.form_contactus.City;
  var country = document.form_contactus.Country;
  var Description = document.form_contactus.Description;
   var str=document.form_contactus.Description.value;

	var validate = document.form_contactus.validate;

  if (firstname.value == "")
    {
        window.alert("Please enter your First Name.");
       firstname.focus();
         return false;
    }
	 /*if (lastname.value == "")
    {
        window.alert("Please enter your Last Name.");
       lastname.focus();
         return false;
    }*/
	/* if (title.value == "")
    {
        window.alert("Please enter your Title.");
        title.focus();
         return false;
    }
*/
	 if (email.value == "")
    {
        window.alert("Please enter a valid Email.");
        email.focus();
        return false;
    }
    if (email.value.indexOf("@", 0) < 0)
    {
        window.alert("Please enter a valid Email.");
        email.focus();
        return false;
    }
    if (email.value.indexOf(".", 0) < 0)
    {
        window.alert("Please enter a valid Email.");
       email.focus();
         return false;
    }



if ((phone.value==null)||(phone.value=="")){
		alert("Please Enter your Phone Number")
		phone.focus()
		return false
	}
if (checkInternationalPhone(phone.value)==false){
		alert("Please Enter a Valid Phone Number")
		phone.value=""
		phone.focus()
		return false
	}

	/*if ((Mobile.value==null)||(Mobile.value=="")){
		alert("Please Enter your Mobile Number")
		Mobile.focus()
		return false
	}
*/

	if (website.value == "")
    {
        window.alert("Please enter your Website.");
       website.focus();
        return false;
    }
	/* if (LeadSource.selectedIndex < 1)
    {
        alert("Please select LeadSource.");
        LeadSource.focus();
        return false;
    }
	 if (Industry.selectedIndex < 1)
    {
        alert("Please select Industry.");
        Industry.focus();
        return false;
    }



	if (NoofEmployees.value == "")
    {
        window.alert("Please enter NoofEmployees.");
       NoofEmployees.focus();
        return false;
    }
	if (AnnualRevenue.value == "")
    {
        window.alert("Please enter AnnualRevenue.");
       AnnualRevenue.focus();
        return false;
    }*/
	if (services.selectedIndex < 1)
    {
        alert("Please select services.");
        services.focus();
        return false;
    }

	/*if (Street.value == "")
    {
        window.alert("Please enter Street.");
       Street.focus();
        return false;
    }*/
	if (City.value == "")
    {
        window.alert("Please enter City.");
      City.focus();
        return false;
    }
	if (country.value == "")
    {
        window.alert("Please enter your Country.");
        country.focus();
         return false;

	}

	if (Description.value == "")
    {
        window.alert("Please enter your Description.");
        Description.focus();
         return false;

	}

	if(str.match("viagra") || str.match("VIAGRA") ||  str.match("Viagra") || str.match("cialis") ||  str.match("CIALIS") || str.match("Cialis") )
	//if(in_array("",$array))
	{
		alert("This word is not allowed");
		Description.focus();
		return false;
	}

     if(imagevalue != validate.value)
     {
	alert("Plesae enter the exact validate code");
	validate.value = "";
	validate.focus();
	return false;
	}


//if(test==true)
//	document.form_contactus.submit();
}

var imagevalue="";
function fun()
{
 scrollPics();
 imagevalue = document.getElementById('one').innerHTML = random_generator(3);

}

function random_generator(digits){


var input = new Array ("A", "B", "C", "D", "E","F","G","H","I","J","K","L","M","N","O","P","Q",
"R","S","T","U","V","W","X","Y","Z");

var random_generator="";// Initialize the string to store random numbers
for(var i=1;i<digits+1;i++){ // Loop the number of times of required digits

if(Math.floor(Math.random() * 2) == 1){// to decide the digit should be numeric or alphabet
// Add one random alphabet
random_generator +=input[Math.floor(Math.random() * 2)]; // One char is added

}else{

// Add one numeric digit between 1 and 10
random_generator +=Math.floor(Math.random()*10); // one number is added
} // end of if else

} // end of for loop

return random_generator;
} // end of function

function valid(){
  var verification = document.form_contactus.verification;

if(imagevalue == verification.value)
	return true;
else
	{
	alert("Plesae enter the exact verification code");

	verification.value = "";
	verification.focus();
	return false;
	}
}
var m=0;
  var n=1090;
  var speed4=100;
function scrollPics() {
     document.getElementById('div1').style.left=m+'px';
     document.getElementById('div2').style.left=n+'px';
   m--;
   n--;
if(m==-1090) {
   m=1090;
 }
if(n==-1090) {
   n=1090;
 }
setTimeout('scrollPics()',speed4);
 } 