function finpop(theURL,winName,features) 
{ 
  window.open(theURL,"w","","");
}
function kellypop(theURL,winName,features) 
{ 
  window.open(theURL,"w","","");
}

function focus()
{
	document.form1.txtmanufacturer.focus();
}		

function pop1()
{

//top.location.href="https://extranet.autobenefits.com/app-templates/app-h/QuickApp.aspx?partnerid=BurnsvilleToyota";
w=screen.width;
h=screen.height; 
window.open('https://extranet.autobenefits.com/app-templates/app-h/QuickApp.aspx?partnerid=BurnsvilleToyota','tkp2','width="+w+",height="+h+",top=0,left=0,scrollbars=yes,resizable=yes,toolbar=yes,status=yes,address=yes');
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function finpop(theURL,winName,features) { 
  window.open(theURL,"w","","");
}

function kellypop(theURL,winName,features) { 
  window.open(theURL,"w","","");
}

function fnnamechk(obj)
{
	obj.value=trimString(obj.value);
	Page_ClientValidate();
}

function trimString (str)
{
	var str1;
	str1=str;
	return str1.replace(/^\s+/g, '').replace(/\s+$/g, '');
}
function stripCharsNotInBag (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 inputPhone(oControl,lExt)
{
	// strip out any non-valid characters
	cPhone = stripCharsNotInBag(oControl.value,'0123456789-');

	// check for empties
	if (cPhone == '')
	{
		oControl.value = cPhone;
		return null;
	}
	
	// check if the first char is a 1, remove it after there are 2 chars
	if ((cPhone.length == 2) && (cPhone.substring(0,1) == '1'))
		cPhone = cPhone.substring(1,cPhone.length);

	// strip all formatting chars
	cPhone = stripCharsNotInBag(cPhone,'0123456789');

	if (cPhone != '1')
	{
		// add the formatting chars back in
		cPhone = cPhone;

		if (cPhone.length > 2)
			cPhone = cPhone.substring(0,3)+'-'+cPhone.substring(3,cPhone.length);

		if (cPhone.length > 5)
			cPhone = cPhone.substring(0,7)+'-'+cPhone.substring(7,cPhone.length);

		// check for extension
		//if ((cPhone.length > 13) || ((cPhone.length==13) && (lExt) && (oControl.value.substring(oControl.value.length-1,oControl.value.length).toLowerCase()=='x')))
	//	{
	//		if (lExt)
	//			cPhone = cPhone.substring(0,13)+' x'+cPhone.substring(13,cPhone.length);
	//		else
	//			cPhone = cPhone.substring(0,13);
	//	}

	}

	// return the new value
	oControl.value = cPhone;
}