function print_details(URL) {
		var id='print';
		var autoResizeWin=window.open(URL,id,"width=650,height=842,menubar=0,toolbar=0,location=0,resizable=0,scrollbars=1");
		if(autoResizeWin)
			return false;
		else
			return true;
}

function checkbox_validation(){
	count=0;
	for(i=0;i<document.check.c.length;i++){
		if(document.check.c[i].checked == true){
			count++;
		}
	}
	
	if(count<2){
		alert("You have to select atleast tow cars!");	
		return false;
	}else if(count > 3){
		alert("You can select maximum three cars!");
		return false;
	}else{
		return true;	
	}
	
}

function checkbox_val(){
var comp = document.getElementsByName("c[]");
var compchecked = 0;

for(i=0; i<comp.length; i++){
	if(comp[i].checked){
		compchecked++;	
	}
	
}
	
	if(compchecked < 2 || compchecked > 3){
		alert("Please select minimum 2 and maximum 3 cars.");	
		return false;
	}

}

function test(){
	var counter=0;
	var check = document.getElementById ('check');
	if(check){
		var inputs = check.getElementsByTagName('input');
		if(inputs){
			for (var i = 0; i < inputs.length; ++i) {
				counter++;
      			if (inputs[i].type == 'checkbox' && inputs[i].checked == 'true'){
      			//inputs[i].checked = inputs[i].value == 'two';
      			alert('hello world FINAL......');	
   				}
				   		
			}
			
		}			
	}
	alert(counter);
}



function textCounter(field, countfield, maxlimit) 
{
	if (field.value.length > maxlimit) 
		field.value = field.value.substring(0, maxlimit);
	else 
		countfield.value = maxlimit - field.value.length;
} 

function inqvalidate(form){
	
  var make 		= form.maker.value;
  var brand 	= form.brand.value;
  var model		= form.model.value;
  var trans		= form.trans.value;
  var fuel		= form.fuel.value;
  var cc		= form.engine.value;
  		
  var fname = form.fname.value;
  var lname = form.lname.value;
  var email = form.email.value;
  var address = form.address1.value;
  var tel = form.telephone.value;
  var country = form.country.value;	
	
  var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
  var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
  var messageRegex = new RegExp(/<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/gim);
	

  if(!fname.match(nameRegex) || fname == "") {
    alert('You have entered an invalid name.');
    return false;
  }		

  if(lanme == "") {
    alert('You must enter your last name.');
    return false;
  }
  if(!lname.match(nameRegex)) {
    alert('You have entered an invalid name.');
    return false;
  }	
  if(email == "") {
    alert('<strong>Error</strong><br />You must enter your email.');
    return false;
  }
  if(!email.match(emailRegex)) {
    alert('<strong>Error</strong><br />You have entered an invalid email.');
    return false;
  }
  if(tel == "") {
    alert('<strong>Error</strong><br />You must enter your mobile.');
    return false;
  }
 if(Address1 == "") {
    alert('<strong>Error</strong><br />You must enter your Address.');
    return false;
  }	
   if(country == "") {
    alert('<strong>Error</strong><br />You must select your country.');
    return false;
  }	
  
   if(make == "") {
    alert('<strong>Error</strong><br />You must select vehicle maker.');
    return false;
  }	
  
  if(brand == "") {
    alert('<strong>Error</strong><br />You must select vehicle brand.');
    return false;
  }	
  
  if(model == "") {
    alert('<strong>Error</strong><br />You must select vehicle model.');
    return false;
  }	
  
  if(trans == "") {
    alert('<strong>Error</strong><br />You must select transmission.');
    return false;
  }	
  if(fuel == "") {
    alert('<strong>Error</strong><br />You must select fuel type.');
    return false;
  }	
  if(cc == "") {
    alert('<strong>Error</strong><br />You must enter engine cc.');
    return false;
  }	  
    
	
  return true;
	
}

