//onerror=exfoerr;
var errtext="";
function exfoerr(msg,url,line){
	errtext="Error Displayed\n\n"
	errtext+="Error: " + msg + "\n"
	errtext+="URL: " + url + "\n"
	errtext+="Line Number: " + line + "\n\n"
	//alert(errtext);
	try{
		var sURL = "/include/functions.asp?action=sendJavaError&err=" + msg + "&url=" + url + "&line=" + line + "&user_id=" + user_id + "&time=" + Math.random();
		//alert(sURL);
		//document.body.style.cursor = "wait";
		//$.ajax({url: sURL, async: true});
	}
	catch(ex){
	}
	return true;
}
		 
var sliderPage = 0;
function checkFnameValueIn(fName) {
    if (fName.value == "First Name") {
        fName.value = "";
    }
}
function checkFnameValueOut(fName) {
    if (fName.value == "") {
        fName.value = "First Name";
    }
}
function checkLnameValueIn(lName) {
    if (lName.value == "Last Name") {
        lName.value = "";
    }
}
function checkLnameValueOut(lName) {
    if (lName.value == "") {
        lName.value = "Last Name";
    }
}
function checkEmailValueIn(email) {
    if (email.value == "Email Address") {
        email.value = "";
    }
}
function checkEmailValueOut(email) {
    if (email.value == "") {
        email.value = "Email Address";
    }
}
function checkPhoneValueIn(phone) {
    if (phone.value == 'Contact Phone') { 
		phone.value = '';
		$("#" + phone.id).mask("(999) 999-9999"); 
	}
}
function checkPhoneValueOut(phone) {
    if (phone.value.replace(/_/g, "").length != 14) {	
		$("#" + phone.id).unmask(); 
		phone.value = 'Contact Phone';
	}
}
function checkDateValueIn(date) {
    if (date.value == "Preferred Date") {
        date.value = "";
    }
}
function checkDateValueOut(date) {
    if (date.value == "") {
        date.value = "Preferred Date";
    }
}
function checkMileValueIn(mile) {
    if (mile.value == "Vehicle Mileage") {
        mile.value = "";
    }
}
function checkMileValueOut(mile) {
    if (mile.value == "") {
        mile.value = "Vehicle Mileage";
    }
}
function checkSCommentValueIn(comment) {
    if (comment.value == "Service Comments") {
        comment.value = "";
    }
}
function checkSCommentValueOut(comment) {
    if (comment.value == "") {
        comment.value = "Service Comments";
    }
}
function checkPCommentValueIn(comment) {
    if (comment.value == "What Parts Do You Need?") {
        comment.value = "";
    }
}
function checkPCommentValueOut(comment) {
    if (comment.value == "") {
        comment.value = "What Parts Do You Need?";
    }
}
function checkCommentValueIn(comment) {
    if (comment.value == "Comments") {
        comment.value = "";
    }
}
function checkCommentValueOut(comment) {
    if (comment.value == "") {
        comment.value = "Comments";
    }
}

function checkAddressValueIn(address) {
    if (address.value == "Address") {
        address.value = "";
    }
}
function checkAddressValueOut(address) {
    if (address.value == "") {
        address.value = "Address";
    }
}

function checkZipValueIn(zip) {
    if (zip.value == "Zip") {
        zip.value = "";
    }
}
function checkZipValueOut(zip) {
    if (zip.value == "") {
        zip.value = "Zip";
    }
	else{
		getCityState(zip);
	}
}

function checkStateValueIn(state) {
    if (state.value == "State") {
        state.value = "";
    }
}
function checkStateValueOut(state) {
    if (state.value == "") {
        state.value = "State";
    }
}

function checkCityValueIn(city) {
    if (city.value == "City") {
        city.value = "";
    }
}
function checkCityValueOut(city) {
    if (city.value == "") {
        city.value = "City";
    }
}
 
function checkOfferValueIn(offer) {
    if (offer.value == "Your Offer") {
        offer.value = "";
    }
}
function checkOfferValueOut(offer) {
    if (offer.value == "") {
        offer.value = "Your Offer";
    }
}
function addRemove(theBox) {
    var counter = 0;
    var allCoupons = document.getElementsByTagName("input");
    for (x = 0; x < allCoupons.length; x++) {
        if (allCoupons[x].name != "") {
            if (allCoupons[x].name.indexOf("printCoupon") >= 0) {
                if (allCoupons[x].checked) {
                    counter ++;
                }
            }
        }
    }
    document.getElementById("toPrintCount").innerHTML = counter + " Coupons to Print";
}

function printCoupons() {
    var coupons = "";
    var allCoupons = document.getElementsByTagName("input");
    for (x = 0; x < allCoupons.length; x++) {
        if (allCoupons[x].name != "") {
            if (allCoupons[x].name.indexOf("printCoupon") >= 0) {
                if (allCoupons[x].checked) {
                    coupons += allCoupons[x].value + ",";
                }
            }
        }
    }
    coupons = coupons.substring(0, coupons.length - 1);
    if (coupons != "") {
        var windowUrl = "print-Coupons.asp?coup=" + coupons;
        var uniqueName = new Date();
        var windowName = 'Print' + uniqueName.getTime();
        var printWindow = window.open(windowUrl, windowName);
    }
}

function setTech(techName, techImage, techPosition, techValue){
	document.getElementById("techName").innerHTML = techName;
	document.getElementById("techPost").innerHTML = techPosition;
	document.getElementById("techImg").src = techImage;
	document.getElementById("ddlServicePersonnel").value = techValue;
	document.getElementById("techInfo").style.display = "block";
}


function getModel(theModel){
	if (theModel != ""){
		var sURL = "include/functions.asp?action=getModelCount&model=" + theModel;
		document.body.style.cursor = "wait";
   		var aa = $.ajax({url: sURL, async: false }).responseText;
   		document.body.style.cursor = "default";
		var modelCount = parseInt(aa);
		if (modelCount > 0){
			updateUserSearch('', '' , theModel, '', 'N');
			location.href = "used-cars-preowned-vehicles-ma-inventory-used.asp?user_id=" + user_id;
			//location.href = "viewYearModel.asp?user_id=" + user_id + "&model=" + theModel;
		}
		else{
			location.href = "viewYearModel.asp?user_id=" + user_id + "&model=" + theModel;
		}
	}
}
function checkVINValueIn(vin) {
    if (vin.value == "JTDJT4K31A5555555") {
        vin.value = "";
    }
}
function checkVINValueOut(vin) {
    if (vin.value == "") {
        vin.value = "JTDJT4K31A5555555";
    }
}
function checkCostValueIn(vin) {
    if (vin.value == "Cost Range") {
        vin.value = "";
    }
}
function checkCostValueOut(vin) {
    if (vin.value == "") {
        vin.value = "Cost Range";
    }
}
function checkMileRangeValueIn(vin) {
    if (vin.value == "Mileage Range") {
        vin.value = "";
    }
}
function checkMileRangeValueOut(vin) {
    if (vin.value == "") {
        vin.value = "Mileage Range";
    }
}
function checkColorValueIn(vin) {
    if (vin.value == "Vehicle Color") {
        vin.value = "";
    }
}
function checkColorValueOut(vin) {
    if (vin.value == "") {
        vin.value = "Vehicle Color";
    }
}
		function handleError() {
	return true;
}

function getVehicleSpecs(vehVin, vehModel, vehTrim){
	if ((navigator.appName == 'Microsoft Internet Explorer') || (navigator.userAgent.toLowerCase().indexOf("msie") != -1)){
		getVehilceSpecsIE(vehVin, vehModel, vehTrim);
	}
	else{
		getVehicleSpecsOther(vehVin, vehModel, vehTrim);
	}
	
}
function getVehilceSpecsIE(vehVin, vehModel, vehTrim){
	try{
		var specification = "";
		var mechanicalSpec = "";
		var exteriorSpec = "";
		var interiorSpec = "";
		var safetySpec = "";
		//sURL = "http://10.10.1.86/chromeWS/default.aspx?vin=JTDBT4K33A1365170&modelcode=1441&vehicletrim=";
		sURL = "/chromeWS/default.aspx?vin=" + vehVin + "&modelcode=" + vehModel + "&vehicletrim=" + vehTrim;
		//alert(sURL);
		document.body.style.cursor = "wait";
		var xmasdfasdfl = $.ajax({url: sURL, async: false }).responseText;
		document.body.style.cursor = "default";
		var from = xmasdfasdfl.indexOf("<chromedata>")
		var to = xmasdfasdfl.indexOf("</chromedata>")
		xml2 = xmasdfasdfl.substr(from, to - from + 13)
		xml2 = xml2.replace(/<value \/>/g, "<value>N/A</value>");
		var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
		xmlDoc.loadXML('<?xml version="1.0" encoding="ISO-8859-1" ?>' + xml2 + "")
		var x=xmlDoc.getElementsByTagName("vehicleinfo");
		for (i=0;i<x.length;i++){ 
			var key = x[i].getElementsByTagName("key")[0].childNodes[0].nodeValue;
			var value = x[i].getElementsByTagName("value")[0].childNodes[0].nodeValue;
			var installed = x[i].getElementsByTagName("installed")[0].childNodes[0].nodeValue;
			if (installed.toLowerCase() == "true"){
				switch (key.toLowerCase()){
				case "mechanical": 
					mechanicalSpec += "<li>&nbsp;-&nbsp;" + value + "</li>";
					break;
				case "exterior":
					exteriorSpec += "<li>&nbsp;-&nbsp;" + value + "</li>";
					break;
				case "interior":
					interiorSpec += "<li>&nbsp;-&nbsp;" + value + "</li>";
					break;
				case "safety":
					safetySpec += "<li>&nbsp;-&nbsp;" + value + "</li>";
					break;
				}
			}
		}
		document.getElementById("mechanicalPlaceHolder").innerHTML = "<ul class='vehSpecs'>" + mechanicalSpec + "</ul>";
		document.getElementById("exteriorPlaceHolder").innerHTML = "<ul class='vehSpecs'>" + exteriorSpec + "</ul>";
		document.getElementById("interiorPlaceHolder").innerHTML = "<ul class='vehSpecs'>" + interiorSpec + "</ul>";
		document.getElementById("safetyPlaceHolder").innerHTML = "<ul class='vehSpecs'>" + safetySpec + "</ul>";
		
	
		var x=xmlDoc.getElementsByTagName("extendedTechnicalSpecification");
		for (i=0;i<x.length;i++){
			var key = x[i].getElementsByTagName("titleName")[0].childNodes[0].nodeValue;
			var value = x[i].getElementsByTagName("valuesField")[0].childNodes[0].firstChild.nodeValue;
			var installed = x[i].getElementsByTagName("valueUnit")[0].childNodes[0].nodeValue;
			if ((value!= "") && (value.indexOf("TBD") < 0) && (value.indexOf("N/A") < 0)){
				if (key.toLowerCase().indexOf("epa fuel economy est - hwy") >= 0){
					if (typeof(document.getElementById("lblHighwayMpg")) != 'undefined'){
						document.getElementById("lblHighwayMpg").innerHTML =value;
					}
				}
				if (key.toLowerCase().indexOf("epa fuel economy est - city") >= 0){
					if (typeof(document.getElementById("lblCityMpg")) != 'undefined'){
						document.getElementById("lblCityMpg").innerHTML =value;
					}
				}
				specification += "<li>&nbsp;-&nbsp;" + key + ": " + value + " ";
				if (installed.toLowerCase().indexOf("n/a") < 0){
					specification += installed;
				}
				specification += "</li>"; 
			}
			
			
		}
		document.getElementById("specsPlaceHolder").innerHTML = "<ul class='vehSpecs'>" + specification + "</ul>";
		engineType = xmlDoc.getElementsByTagName("engineType")[0].childNodes[0].nodeValue;
		displacementL = xmlDoc.getElementsByTagName("displacementL")[0].childNodes[0].nodeValue;
		if (typeof(document.getElementById("lblEngine")) != 'undefined'){
			if ((engineType + displacementL) != ""){
				document.getElementById("lblEngine").innerHTML = engineType + " " + displacementL + "L";
			}
			else{
				document.getElementById("lblEngine").value ="";
			}
		}
	}
	catch(err){
		var txt = "";
		txt+="Error description: " + err.message + "\n\n";
	}
}
function getVehicleSpecsOther(vehVin, vehModel, vehTrim){
		//http://chrome.bochtrack.com/chromeinterface_page/default.aspx?vin=JTDJT923075112740
		//window.onerror = handleError;

	try{
		var specification = "";
		var mechanicalSpec = "";
		var exteriorSpec = "";
		var interiorSpec = "";
		var safetySpec = "";
		sURL = "/chromeWS/default.aspx?vin=" + vehVin + "&modelcode=" + vehModel + "&vehicletrim=" + vehTrim;
		//alert(sURL);
		document.body.style.cursor = "wait";
		var xmldoc = $.ajax({url: sURL, async: false }).responseText;
		document.body.style.cursor = "default";
		document.getElementById("xmlDoc").innerHTML = xmldoc.replace(/<value \/>/g, "<value></value>");
		var root = document.getElementById("xmlDoc").getElementsByTagName('vehicleinfos').item(0);
		if (root != null){
           	for (var iNode = 0; iNode < root.childNodes.length; iNode++) {      
				var node = root.childNodes.item(iNode);
				var key = node.getElementsByTagName("key").item(0).innerHTML;
				var value = node.getElementsByTagName("value").item(0).innerHTML;
				var installed = node.getElementsByTagName("installed").item(0).innerHTML;
				if (installed.toLowerCase() == "true"){
					switch (key.toLowerCase()){
					case "mechanical": 
						mechanicalSpec += "<li>&nbsp;-&nbsp;" + value + "</li>";
						break;
					case "exterior":
						exteriorSpec += "<li>&nbsp;-&nbsp;" + value + "</li>";
						break;
					case "interior":
						interiorSpec += "<li>&nbsp;-&nbsp;" + value + "</li>";
						break;
					case "safety":
						safetySpec += "<li>&nbsp;-&nbsp;" + value + "</li>";
						break;
				   	}
			   	}
			}
			document.getElementById("mechanicalPlaceHolder").innerHTML = "<ul class='vehSpecs'>" + mechanicalSpec + "</ul>";
			document.getElementById("exteriorPlaceHolder").innerHTML = "<ul class='vehSpecs'>" + exteriorSpec + "</ul>";
			document.getElementById("interiorPlaceHolder").innerHTML = "<ul class='vehSpecs'>" + interiorSpec + "</ul>";
			document.getElementById("safetyPlaceHolder").innerHTML = "<ul class='vehSpecs'>" + safetySpec + "</ul>";
		}
		var root = document.getElementById("xmlDoc").getElementsByTagName('extendedTechnicalSpecifications').item(0);
		if (root != null){
			for (var iNode = 0; iNode < root.childNodes.length; iNode++) {
				var node = root.childNodes.item(iNode);
				var key = node.getElementsByTagName("titleName").item(0).innerHTML;
				if (node.getElementsByTagName("valuesField").item(0).childNodes.length > 1){
					var value = node.getElementsByTagName("valuesField").item(0).childNodes.item(0).innerHTML;
				}
				else{
					var value = node.getElementsByTagName("valuesField").item(0).innerHTML;
				}
				var installed = node.getElementsByTagName("valueUnit").item(0).innerHTML;
				if ((value!= "") && (value.indexOf("TBD") < 0)){
					if (key.toLowerCase().indexOf("epa fuel economy est - hwy") >= 0){
						if (typeof(document.getElementById("lblHighwayMpg")) != 'undefined'){
							document.getElementById("lblHighwayMpg").innerHTML =value;
						}
					}
					if (key.toLowerCase().indexOf("epa fuel economy est - city") >= 0){
						if (typeof(document.getElementById("lblCityMpg")) != 'undefined'){
							document.getElementById("lblCityMpg").innerHTML =value;
						}
					}
					specification += "<li>&nbsp;-&nbsp;" + key + ": " + value + " ";
					if (installed.toLowerCase().indexOf("n/a") < 0){
						specification += installed;
					}
					specification += "</li>"; 
				}
			}
			document.getElementById("specsPlaceHolder").innerHTML = "<ul class='vehSpecs'>" + specification + "</ul>";
		}
		
		
		engineType = document.getElementById("xmlDoc").getElementsByTagName('engineType').item(0).innerHTML;
		displacementL = document.getElementById("xmlDoc").getElementsByTagName('displacementL').item(0).innerHTML;
		if (typeof(document.getElementById("lblEngine")) != 'undefined'){
			if ((engineType + displacementL) != ""){
				document.getElementById("lblEngine").innerHTML = engineType + " " + displacementL + "L";
			}
			else{
				document.getElementById("lblEngine").value ="";
			}
		}
	}
	catch(err){
		var txt = "";
		txt+="Error description: " + err.message + "\n\n";
	}
}

function disclosureStocks(disclosure){
	var stocks = document.getElementById("stocks" + disclosure).value;
	var sURL = "/include/functions.asp?action=setStockSearch&stocks=" + stocks + "&user_id=" + user_id; 
	document.body.style.cursor = "wait";
	var xmldoc = $.ajax({url: sURL, async: false }).responseText;
	document.body.style.cursor = "default";
	location.href = "http://www.BochNewToYou.com/used-cars-preowned-vehicles-compare.asp?user_id=" + user_id ;
}

function updateUserSearch(whatyear, whatmake, whatmodel, whattrim, whatCondition, whatType, whatMSRP){
	whatCondition = typeof(whatCondition) != 'undefined' ? whatCondition : "N";
	whatType = typeof(whatType) != 'undefined' ? whatType : "";
	whatMSRP = typeof(whatMSRP) != 'undefined' ? whatMSRP : "";
	sURL = "/include/get_search.asp?action=upd_user_search&user_id=" + user_id + "&get_type=" + whatCondition + "&whatyear=" + whatyear + "&whatmake=" + whatmake + "&whatmodel=" + whatmodel + "&whattrim=" + whattrim  + "&whatvtype=" + whatType + "&whatmsrp=" + whatMSRP + "&random=" + Math.random(); //+ "&whatcolor=" + whatcolor  + "&whatvtype=" + whatvtype   
	//alert(sURL);
	document.body.style.cursor = "wait";
   	var aa = $.ajax({url: sURL, async: false }).responseText;
   	document.body.style.cursor = "default";
	if (whatCondition.toLowerCase() == 'n'){
		location.href = '/used-cars-preowned-vehicles-ma-inventory-used.asp?user_id=' + user_id;
	}
	else if (whatCondition.toLowerCase() == 'u'){
		location.href = '/used-cars-preowned-vehicles-ma-inventory-used.asp?user_id=' + user_id;
	}
}


function strip_invalid_char(whatchar){
	var ValidChars = "0123456789.";
	var Char;
	var P_Number = "";
	for (i = 0; i < whatchar.length; i++){ 
		Char = whatchar.charAt(i); 
		if (ValidChars.indexOf(Char) != -1){
			P_Number = P_Number + Char;
		}
	}
	return P_Number;
}

function calc_payment(){
	document.getElementById("trade").value = strip_invalid_char(document.getElementById("trade").value); 
	document.getElementById("rate").value = strip_invalid_char(document.getElementById("rate").value);
	var tradePay = 0;
	var tradeVal = 0;
	var sel_tr 			= document.getElementById("term") ;
	var sel_tr_Index 	= sel_tr.selectedIndex ;
	whatterm 			= sel_tr.options[sel_tr_Index].value ;
	if (document.getElementById("vehTradeIn")) {
		document.getElementById("vehTradeIn").value = strip_invalid_char(document.getElementById("vehTradeIn").value);
		tradeVal = parseFloat(document.getElementById("vehTradeIn").value);
	}
	if (document.getElementById("tradePayOff")) {
		document.getElementById("tradePayOff").value = strip_invalid_char(document.getElementById("tradePayOff").value);
		tradePay = parseFloat(document.getElementById("tradePayOff").value);
	}
	downpayment = parseFloat(document.getElementById("trade").value);
	loanamount = parseFloat(strip_invalid_char(document.getElementById("lblMsrp").innerHTML));
	var princ = loanamount - downpayment + (tradePay - tradeVal);
	var intr   = document.getElementById("rate").value / 1200;
	if(intr <= 0){
		intr = .0000001
	}
	calc_pay = princ * intr / (1 - (Math.pow(1/(1 + intr), whatterm)));
	document.getElementById("payment").innerHTML = "$" + parseInt(calc_pay);
 }
function getCityState(theZip){
	if (theZip.value.length ==5){
		var sURL = "include/functions.asp?action=getCityState&cityZip=" + theZip.value;
		document.body.style.cursor = "wait";
   		var aa = $.ajax({url: sURL, async: false }).responseText;
   		document.body.style.cursor = "default";
		var cityState = aa.split("|");
		document.getElementById("txtCity").value = jQuery.trim(cityState[0]);
		document.getElementById("txtState").value = jQuery.trim(cityState[1]);
	}
}

function getCityStateEmployer_CA(theZip){
	if (theZip.value.length ==5){
		var sURL = "include/functions.asp?action=getCityState&cityZip=" + theZip.value;
		document.body.style.cursor = "wait";
   		var aa = $.ajax({url: sURL, async: false }).responseText;
   		document.body.style.cursor = "default";
		var cityState = aa.split("|");
		document.getElementById("txtEmployerCity").value = jQuery.trim(cityState[0]);
		document.getElementById("txtEmployerState").value = jQuery.trim(cityState[1]);
	}
}

function isDate(dateStr) {
	var datePat = /^(\d{1,2})(\/|-)(\d{1,2})(\/|-)(\d{4})$/;
	var matchArray = dateStr.match(datePat); // is the format ok?
	if (matchArray == null) {
		//alert("Please enter date as either mm/dd/yyyy or mm-dd-yyyy.");
		return false;
	}
	
	month = matchArray[1]; // p@rse date into variables
	day = matchArray[3];
	year = matchArray[5];
	
	if (month < 1 || month > 12) { // check month range
		//alert("Month must be between 1 and 12.");
		return false;
	}
	
	if (day < 1 || day > 31) {
		//alert("Day must be between 1 and 31.");
		return false;
	}
	
	if ((month==4 || month==6 || month==9 || month==11) && day==31) {
		//alert("Month "+month+" doesn`t have 31 days!")
		return false;
	}
	
	if (month == 2) { // check for february 29th
		var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
		if (day > 29 || (day==29 && !isleap)) {
			//alert("February " + year + " doesn`t have " + day + " days!");
			return false;
		}
	}
	return true; // date is valid
}

function numbersonly(myfield, e, dec) {

  var key;
  var keychar;
  if (window.event)
    key = window.event.keyCode;
  else if (e)
    key = e.which;
  else
    return true;
  keychar = String.fromCharCode(key);

  // control keys
  if ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27) )
    return true;

  // numbers
  else if ((("0123456789").indexOf(keychar) > -1))
    return true;

  // decimal point jump
  else if (dec && (keychar == ".")) {
    myfield.form.elements[dec].focus();
    return false;
  } else
    return false;
}



// Format Phone Number This function is not in use yet!
var n;
var p;
var p1;
function ValidatePhone(){
	p=p1.value
	if(p.length==3){
		//d10=p.indexOf('(')
		pp=p;
		d4=p.indexOf('(')
		d5=p.indexOf(')')
		if(d4==-1){
			pp="("+pp;
		}
		if(d5==-1){
			pp=pp+")";
		}
		//pp="("+pp+")";
		document.frmPhone.txtphone.value="";
		document.frmPhone.txtphone.value=pp;
	}
	if(p.length>3){
		d1=p.indexOf('(')
		d2=p.indexOf(')')
		if (d2==-1){
			l30=p.length;
			p30=p.substring(0,4);
			//alert(p30);
			p30=p30+")"
			p31=p.substring(4,l30);
			pp=p30+p31;
			//alert(p31);
			document.frmPhone.txtphone.value="";
			document.frmPhone.txtphone.value=pp;
		}
	}
	if(p.length>5){
		p11=p.substring(d1+1,d2);
		if(p11.length>3){
		p12=p11;
		l12=p12.length;
		l15=p.length
		//l12=l12-3
		p13=p11.substring(0,3);
		p14=p11.substring(3,l12);
		p15=p.substring(d2+1,l15);
		document.frmPhone.txtphone.value="";
		pp="("+p13+")"+p14+p15;
		document.frmPhone.txtphone.value=pp;
		//obj1.value="";
		//obj1.value=pp;
		}
		l16=p.length;
		p16=p.substring(d2+1,l16);
		l17=p16.length;
		if(l17>3&&p16.indexOf('-')==-1){
			p17=p.substring(d2+1,d2+4);
			p18=p.substring(d2+4,l16);
			p19=p.substring(0,d2+1);
			//alert(p19);
		pp=p19+p17+"-"+p18;
		document.frmPhone.txtphone.value="";
		document.frmPhone.txtphone.value=pp;
		//obj1.value="";
		//obj1.value=pp;
	}
}
//}
setTimeout(ValidatePhone,100)
}
function getIt(m){
	n=m.name;
	//p1=document.forms[0].elements[n]
	p1=m
	ValidatePhone()
}
function testphone(obj1){
	p=obj1.value
	//alert(p)
	p=p.replace("(","")
	p=p.replace(")","")
	p=p.replace("-","")
	p=p.replace("-","")
	//alert(isNaN(p))
	if (isNaN(p)==true){
		alert("Check phone");
		return false;
	}
}


