//help system functions!
var cX = 0; var cY = 0;

function UpdateCursorPosition(e){ cX = e.pageX; cY = e.pageY;}

function UpdateCursorPositionDocAll(e){ cX = event.clientX; cY = event.clientY;}
if(document.all) { document.onmousemove = UpdateCursorPositionDocAll; }
else { document.onmousemove = UpdateCursorPosition; }

function getYOffset() {    var pageY;    if(typeof(window.pageYOffset)=='number') {       pageY=window.pageYOffset;    }    else {       pageY=document.documentElement.scrollTop;    }    return pageY;}

function delayclose(thediv){
	//alert(thediv);	
	setTimeout("document.getElementById('"+thediv+"').style.display='none';",6000);
}

function getY( oElement )
{
var iReturnValue = 0;
while( oElement != null ) {
iReturnValue += oElement.offsetTop;
oElement = oElement.offsetParent;
}
return iReturnValue;
}

function getX( oElement )
{
var iReturnValue = 0;
while( oElement != null ) {
iReturnValue += oElement.offsetLeft;
oElement = oElement.offsetParent;
}
return iReturnValue;
}


function AssignPosition(d) {
//d.style.left = (cX+10 - 20) + "px";
//d.style.left = "0px";
//var howmuch = 10 - getYOffset();
//d.style.top = (cY+howmuch - 20) + "px";
//d.style.top = "0px";

var dd = document.getElementById(d);
da=d+"A";
da=d+"A";

//return;
var x = getX(document.getElementById(da));
var y = getY(document.getElementById(da));
dd.style.left=x - 20;
dd.style.top=y - 20;
}

function HideContent(d) {
if(d.length < 1) { return; }
document.getElementById(d).style.display = "none";
}

function ShowContent(d) {
if(d.length < 1) { return; }
var dd = document.getElementById(d)
AssignPosition(d);
dd.style.display = "block";
}

function ReverseContentDisplay(d) {
if(d.length < 1) { return; }
var dd = document.getElementById(d)
AssignPosition(d);
if(dd.style.display == "none") { dd.style.display = "block"; }
else { dd.style.display = "none"; }
}




//end help system finctions


function openreportfrommanager(link,reportname,id){
    if (link.length < 1) {
        alert("Not enough data available to to create report at this time.");
        return;
    }
    var startdate, enddate,number,campaignid,componentid,artifactid;    
    startdate = document.forms["reportform"].elements["startdate"].value;
    enddate = document.forms["reportform"].elements["enddate"].value;
    campaignid = document.forms["reportform"].elements["campaignid"].value;
    componentid = document.forms["reportform"].elements["componentid"].value;
    artifactid = document.forms["reportform"].elements["artifactid"].value;
    if ((startdate==("mm/dd/yy")) || (enddate==("mm/dd/yy"))) {
        alert("Please pick a Start and End Date for your report");
        return;
    } 
     
     
    var reportsWindow=window.open(link + "?startdate=" + startdate + "&enddate=" + enddate + "&id=" + id + "&campaignid=" + campaignid + "&componentid=" + componentid + "&artifactid=" + artifactid, reportname,
                                  '"toolbar=yes, directories=yes, location=yes, status=yes, menubar=yes,' +
                                  'resizable=yes, scrollbars=yes, width=1050,height=800"');
    reportsWindow.focus();
}





function openReports(){
    var reportsWindow=window.open("/system/reports/reportsselection.jsp", "Reports",
                                  '"toolbar=no, directories=no, location=no, status=no, menubar=no,' +
                                  'resizable=yes, scrollbars=yes, width=700,height=500"');
    reportsWindow.focus();
}

function fixit()
    {
    var numberOfElements = document.theForm.elements.length;
    var x = 0;
    while (x < numberOfElements)
    {
    // replace all the single, double quotes:

    var singQuot = /\'/g;
    var dubQuot = /\"/g;
    var theQuoteString = document.theForm.elements[x].value;
    theQuoteString = theQuoteString.replace(singQuot, "&#39;");
    theQuoteString = theQuoteString.replace(dubQuot, "&#34;");
    document.theForm.elements[x].value = theQuoteString;
    x++;
    }

return true;
}

function popRealtorDemo(){
    var RDemoView=window.open("/realtor/default.jsp", "RealtorDemoWindow",
                                  '"toolbar=no, directories=no, location=no, status=no, menubar=no,' +
                                  'resizable=yes, scrollbars=yes, width=800,height=600"');


   //RDemoView.moveTo((screen.width/2)-(750/2),(screen.height/2)-(660/2));


}

function popSchoolDemo(){
    var SDemoView=window.open("/vaned/default.jsp", "SchoolDemoWindow",
                                  '"toolbar=no, directories=no, location=no, status=no, menubar=no,' +
                                  'resizable=yes, scrollbars=yes, width=800,height=600"');


    //SDemoView.moveTo((screen.width/2)-(750/2),(screen.height/2)-(660/2));


}

function getCustomerPhoneWindow(){
    var customerPhone=window.open("/windows/getCustomerPhoneWindow.jsp", "CustomerPhoneWindow",
                                  '"toolbar=no, directories=no, location=no, status=no, menubar=no,' +
                                  'resizable=yes, scrollbars=yes, width=700,height=500"');


    //customerPhone.moveTo((screen.width/2)-(700/2),(screen.height/2)-(500/2));


}

function getCustomerPhoneWindowI(){

    var i,j;
    i = document.forms[0].email.value;
    j = document.forms[0].email.value;

    i = i.substr(0,(i.indexOf('@')));
    j = j.substring(j.indexOf('@')+1);

    document.forms[0].email1.value = i;
    document.forms[0].email2.value = j;




    var customerPhone=window.open("http://www.clickforacall.com/windows/getCustomerPhoneWindow.jsp", "CustomerPhoneWindow",
                                  '"toolbar=no, directories=no, location=no, status=no, menubar=no,' +
                                  'resizable=yes, scrollbars=yes, width=700,height=500"');


    //customerPhone.moveTo((screen.width/2)-(700/2),(screen.height/2)-(500/2));


}

function getCustomerPhoneWindowAuto(){
    var customerPhone=window.open("http://www.clickforacall.com/windows/getCustomerPhoneWindow.jsp", "CustomerPhoneWindow",
                                  '"toolbar=no, directories=no, location=no, status=no, menubar=no,' +
                                  'resizable=yes, scrollbars=yes, width=700,height=500"');


    //customerPhone.moveTo((screen.width/2)-(700/2),(screen.height/2)-(500/2));


}

function getCustomerPhoneWindowAutoDemo(){
    var customerPhone=window.open("/windows/getCustomerPhoneWindowDemo.jsp", "CustomerPhoneWindowDemo",
                                  '"toolbar=no, directories=no, location=no, status=no, menubar=no,' +
                                  'resizable=yes, scrollbars=yes, width=700,height=500"');

    customerPhone.focus();
    //customerPhone.moveTo((screen.width/2)-(700/2),(screen.height/2)-(500/2));


}

function getCustomerPhoneWindowAutoDemoDealer(){
    var customerPhone=window.open("http://www.clickforacall.com/dealerdotcom/getCustomerPhoneWindowDemo.jsp", "DealerCustomerPhoneWindowDemo",
                                  '"toolbar=no, directories=no, location=no, status=no, menubar=no,' +
                                  'resizable=yes, scrollbars=yes, width=700,height=500"');

    customerPhone.focus();
    //customerPhone.moveTo((screen.width/2)-(700/2),(screen.height/2)-(500/2));


}








function getCustomerPhoneWindowRealtorDemo(){
    var customerPhone=window.open("/windows/getCustomerPhoneWindowRDemo.jsp", "CustomerPhoneWindowDemo",
                                  '"toolbar=no, directories=no, location=no, status=no, menubar=no,' +
                                  'resizable=yes, scrollbars=yes, width=700,height=500"');

    customerPhone.focus();
    //customerPhone.moveTo((screen.width/2)-(700/2),(screen.height/2)-(500/2));


}

function getCustomerPhoneWindowRealtorDemo(mlsid,address){

        var customerPhone=window.open("/windows/getCustomerPhoneWindowRDemo.jsp?mlsid=" + mlsid + "&address=" + address, "CustomerPhoneWindowDemo",
                                  '"toolbar=no, directories=no, location=no, status=no, menubar=no,' +
                                  'resizable=yes, scrollbars=yes, width=700,height=500"');
customerPhone.focus();
  return false;
}









function getCustomerPhoneWindowA(){ //used to connect MAIN Click for a call calls.
    var customerPhone=window.open("/windows/getCustomerPhoneWindowA.jsp", "ClientPhoneWindow",
                                  '"toolbar=no, directories=no, location=no, status=no, menubar=no,' +
                                  'resizable=yes, scrollbars=yes, width=400,height=350"');


    //customerPhone.moveTo((screen.width/2)-(700/2),(screen.height/2)-(500/2));


}

function getCustomerPhoneWindowWName(){ //used to connect MAIN Click for a call calls.
    var customerPhone=window.open("/customerwindows/CFAC/phonewindow.jsp", "ClientPhoneWindow",
                                  '"toolbar=no, directories=no, location=no, status=no, menubar=no,' +
                                  'resizable=yes, scrollbars=yes, width=600,height=400"');


    //customerPhone.moveTo((screen.width/2)-(700/2),(screen.height/2)-(500/2));


}



function getCustomerPhoneWindowCFAMDemo(){
    var customerPhone=window.open("/windows/getCustomerPhoneWindowCFAMDemo.jsp", "ClientPhoneWindow",
                                  '"toolbar=no, directories=no, location=no, status=no, menubar=no,' +
                                  'resizable=yes, scrollbars=yes, width=400,height=350"');


    //customerPhone.moveTo((screen.width/2)-(700/2),(screen.height/2)-(500/2));


}

function submitCustomerPhone(){
            if(( document.forms[0].customerPhoneA.value.length != 3) || ( document.forms[0].customerPhoneB.value.length != 3) || ( document.forms[0].customerPhoneC.value.length != 4)){
                alert("Phone Number must be 10 digits")
            }else{
                document.forms[0].customerPhone.value = document.forms[0].customerPhoneA.value + document.forms[0].customerPhoneB.value + document.forms[0].customerPhoneC.value;


                    window.opener.document.forms[0].customerPhone.value=document.forms[0].customerPhone.value;
                    window.opener.document.forms[0].OriginationDelay.value=document.forms[0].OriginationDelay.value; //delay value is set
                    if(window.opener.document.forms[0].OriginationDelay.value>0){
                         alert("Thank you, you will recieve a call on Line: " + window.opener.document.forms[0].customerPhone.value + " in " + window.opener.document.forms[0].OriginationDelay.value + " minutes");
                    }else
                    {
                         alert("Thank you, you will recieve a call on Line: " + window.opener.document.forms[0].customerPhone.value);
                    }

                    window.opener.document.forms[0].submit();
                    window.close();

            }

    }

function submitCustomerPhoneAutoDemo(){
              var myString;
            for (var i=0;i<document.forms[0].elements.length;i++) {
                myString = document.forms[0].elements[i].value;
                myString=myString.replace("'","");
                document.forms[0].elements[i].value=myString;
            }

    if(( document.carform.customerPhoneA.value.length != 3) || ( document.carform.customerPhoneB.value.length != 3) || ( document.carform.customerPhoneC.value.length != 4)){
                alert("Phone Numbers must be 10 digits")
            }else{
                document.carform.customerPhone.value = document.carform.customerPhoneA.value + document.carform.customerPhoneB.value + document.carform.customerPhoneC.value;

                    //alert("Thank you, you will recieve a call on Line: " + document.carform.customerPhone.value);
                   // window.opener.document.forms[0].customerPhone.value=document.forms[0].customerPhone.value;
                   // window.opener.document.forms[0].OriginationDelay.value=document.forms[0].OriginationDelay.value; //delay value is set
                  document.carform.submit();
                 //window.close();

            }

    }

function submitCustomerPhoneRealtorDemo(){
              var myString;
            for (var i=0;i<document.forms[0].elements.length;i++) {
                myString = document.forms[0].elements[i].value;
                myString=myString.replace("'","");
                document.forms[0].elements[i].value=myString;
            }

    if(( document.houseform.customerPhoneA.value.length != 3) || ( document.houseform.customerPhoneB.value.length != 3) || ( document.houseform.customerPhoneC.value.length != 4)){
                alert("Phone Numbers must be 10 digits")
            }else{
                document.houseform.customerPhone.value = document.houseform.customerPhoneA.value + document.houseform.customerPhoneB.value + document.houseform.customerPhoneC.value;

                    //alert("Thank you, you will recieve a call on Line: " + document.carform.customerPhone.value);
                   // window.opener.document.forms[0].customerPhone.value=document.forms[0].customerPhone.value;
                   // window.opener.document.forms[0].OriginationDelay.value=document.forms[0].OriginationDelay.value; //delay value is set
                  document.houseform.submit();
                 //window.close();

            }

    }


function submitCustomerPhoneA(){

            var myString;
            for (var i=0;i<document.forms[0].elements.length;i++) {
                myString = document.forms[0].elements[i].value;
                myString=myString.replace("'","");
                document.forms[0].elements[i].value=myString;
            }



            if(( document.forms[0].customerPhoneA.value.length != 3) || ( document.forms[0].customerPhoneB.value.length != 3) || ( document.forms[0].customerPhoneC.value.length != 4)){
                alert("Phone Numbers must be 10 digits")
            }else{
                document.forms[0].customerPhone.value = document.forms[0].customerPhoneA.value + document.forms[0].customerPhoneB.value + document.forms[0].customerPhoneC.value;

                   // alert("Thank you, you will recieve a call on Line: " + document.forms[0].customerPhone.value);
                   // window.opener.document.forms[0].customerPhone.value=document.forms[0].customerPhone.value;
                   // window.opener.document.forms[0].OriginationDelay.value=document.forms[0].OriginationDelay.value; //delay value is set
                //alert("thank You");
                document.forms[0].submit();
                //window.close();

            }

    }



function submitCustomerPhoneCFAMDemo(){
            if(( document.forms[0].customerPhoneA.value.length != 3) || ( document.forms[0].customerPhoneB.value.length != 3) || ( document.forms[0].customerPhoneC.value.length != 4)){
                alert("Phone Numbers must be 10 digits")
            }else{
                document.forms[0].customerPhone.value = document.forms[0].customerPhoneA.value + document.forms[0].customerPhoneB.value + document.forms[0].customerPhoneC.value;

                    alert("Thank you, you will recieve a call on Line: " + document.forms[0].customerPhone.value);
                   // window.opener.document.forms[0].customerPhone.value=document.forms[0].customerPhone.value;
                   // window.opener.document.forms[0].OriginationDelay.value=document.forms[0].OriginationDelay.value; //delay value is set
                  document.forms[0].submit();
                  //window.close();

            }

    }

function maybeSubmitClientReg(){

    //if((document.forms[0].elements[0].value != "" & document.forms[0].elements[1].value != "") && (document.forms[0].elements[0].value.length == 10 && document.forms[0].elements[1].value.length == 10)){
    //fixit();
  //parse through and take out any special characters....
            var myString;
            for (var i=0;i<document.forms[0].elements.length;i++) {
                myString = document.forms[0].elements[i].value;
                myString=myString.replace("'","");
                document.forms[0].elements[i].value=myString;
            }

    if(( document.forms[0].clientPhone1A.value.length != 3) || ( document.forms[0].clientPhone1B.value.length != 3) || ( document.forms[0].clientPhone1C.value.length != 4)){
                alert("1'st Phone Number must be 10 digits")
                document.forms[0].elements[4].focus()
            }else{

                document.forms[0].clientPhone1.value = document.forms[0].clientPhone1A.value + document.forms[0].clientPhone1B.value + document.forms[0].clientPhone1C.value;
                document.forms[0].submit();


            }





    }


function maybeSubmitSubReg(){

    //if((document.forms[0].elements[0].value != "" & document.forms[0].elements[1].value != "") && (document.forms[0].elements[0].value.length == 10 && document.forms[0].elements[1].value.length == 10)){
    //fixit();
  //parse through and take out any special characters....
            var myString;
            var dosubmit = true;
            for (var i=0;i<document.forms[0].elements.length;i++) {
                myString = document.forms[0].elements[i].value;
                myString=myString.replace("'","");
                document.forms[0].elements[i].value=myString;
            }

    for (var i=0;i<document.forms[0].elements.length;i++) {
        if(i<4){
            if( document.forms[0].elements[i].value == ""){
                        alert("All form fields marked with * must be filled in! ")
                        document.forms[0].elements[i].focus();
                        dosubmit = false;
                        return;
                    }else{
                    }
        }
            }
   if(( document.forms[0].dealerPhone1A.value.length != 3) || ( document.forms[0].dealerPhone1B.value.length != 3) || ( document.forms[0].dealerPhone1C.value.length != 4)){
                alert("1'st Phone Number must be 10 digits")
                document.forms[0].elements[5].focus()
                dosubmit = false;
                return;
            }else{
                document.forms[0].dealerPhone1.value = document.forms[0].dealerPhone1A.value + document.forms[0].dealerPhone1B.value + document.forms[0].dealerPhone1C.value;
            }
    if(dosubmit == true){
    document.forms[0].submit();
    }

    }


function maybeSubmitDealerReg(){

    //if((document.forms[0].elements[0].value != "" & document.forms[0].elements[1].value != "") && (document.forms[0].elements[0].value.length == 10 && document.forms[0].elements[1].value.length == 10)){
    //fixit();
  //parse through and take out any special characters....
            var myString;
            var dosubmit = true;
            for (var i=0;i<document.forms[0].elements.length;i++) {
                myString = document.forms[0].elements[i].value;
                myString=myString.replace("'","");
                document.forms[0].elements[i].value=myString;
            }



    for (var i=0;i<document.forms[0].elements.length;i++) {
        if(i != 3 && i != 5 && i != 12 && i != 13 && i != 14 && i != 15  && i != 16  && i != 18 ){
            if( document.forms[0].elements[i].value == ""){
                        alert("All form fields marked with * must be filled in! ")
                        document.forms[0].elements[i].focus();
                        dosubmit = false;
                        return;
                    }else{

                    }
        }


            }





   if(( document.forms[0].dealerPhone1A.value.length != 3) || ( document.forms[0].dealerPhone1B.value.length != 3) || ( document.forms[0].dealerPhone1C.value.length != 4)){
                alert("1'st Phone Number must be 10 digits")
                document.forms[0].elements[5].focus()
                dosubmit = false;
                return;
            }else{

                document.forms[0].dealerPhone1.value = document.forms[0].dealerPhone1A.value + document.forms[0].dealerPhone1B.value + document.forms[0].dealerPhone1C.value;



            }





    if(dosubmit == true){
    document.forms[0].submit();
    }

    }


function maybeSubmitDealerRegv2(){

    //if((document.forms[0].elements[0].value != "" & document.forms[0].elements[1].value != "") && (document.forms[0].elements[0].value.length == 10 && document.forms[0].elements[1].value.length == 10)){
    //fixit();
  //parse through and take out any special characters....
            var myString;
            var dosubmit = true;
            for (var i=0;i<document.forms[0].elements.length;i++) {
                myString = document.forms[0].elements[i].value;
                myString=myString.replace("'","");
                document.forms[0].elements[i].value=myString;
            }



    for (var i=0;i<document.forms[0].elements.length;i++) {
        if(i != 2  && i != 11 && i != 12 && i != 13 && i != 10  && i != 14  && i != 16 ){
            if( document.forms[0].elements[i].value == ""){
                        alert("All form fields marked with * must be filled in! " + i)
                        document.forms[0].elements[i].focus();
                        dosubmit = false;
                        return;
                    }else{

                    }
        }


            }





   if(( document.forms[0].dealerPhone1A.value.length != 3) || ( document.forms[0].dealerPhone1B.value.length != 3) || ( document.forms[0].dealerPhone1C.value.length != 4)){
                alert("1'st Phone Number must be 10 digits")
                document.forms[0].elements[5].focus()
                dosubmit = false;
                return;
            }else{

                document.forms[0].dealerPhone1.value = document.forms[0].dealerPhone1A.value + document.forms[0].dealerPhone1B.value + document.forms[0].dealerPhone1C.value;



            }





    if(dosubmit == true){
    document.forms[0].submit();
    }

    }




function maybeSubmitSubAccount(){

    //if((document.forms[0].elements[0].value != "" & document.forms[0].elements[1].value != "") && (document.forms[0].elements[0].value.length == 10 && document.forms[0].elements[1].value.length == 10)){
    //fixit();
  //parse through and take out any special characters....
            var myString;
            var dosubmit = true;
            for (var i=0;i<document.forms[0].elements.length;i++) {
                myString = document.forms[0].elements[i].value;
                myString=myString.replace("'","");
                document.forms[0].elements[i].value=myString;
            }



    for (var i=0;i<document.forms[0].elements.length;i++) {
    if(i!=5){
            if( document.forms[0].elements[i].value == ""){
                        alert("All form fields marked with * must be filled in! ")
                        document.forms[0].elements[i].focus();
                        dosubmit = false;
                        return;
                    }else{

                    }
        }
    }

    if(document.forms[0].elements[0].value == "SELECT"){
        alert("Please select the dealership!");
        document.forms[0].elements[0].focus();
    }
   if(( document.forms[0].dealerPhone1A.value.length != 3) || ( document.forms[0].dealerPhone1B.value.length != 3) || ( document.forms[0].dealerPhone1C.value.length != 4)){
                alert("Phone Number must be 10 digits")
                document.forms[0].elements[5].focus()
                dosubmit = false;
                return;
            }else{

                document.forms[0].dealerPhone1.value = document.forms[0].dealerPhone1A.value + document.forms[0].dealerPhone1B.value + document.forms[0].dealerPhone1C.value;



            }


    if(dosubmit == true){
    document.forms[0].submit();
    }

    }



function maybesubmitemail(){
    if(( document.getElementById("getemailbutton").length < 5)){
                alert("You must enter an email address.");
                document.forms[1].elements[0].focus();
            }else{
                ddocument.forms[1].elements[3].disabled=true;
                document.getemail.submit();
            }
    }


function maybeupdatedealer(){



   // if(( document.getemail.email.value.length < 5)){
     //           alert("You must enter an email address.");
       //         document.getemail.email.focus();
         //   }else{
                document.forms[0].submitButton.disabled=true;
                document.forms[0].submit();


       //     }





    }


function maybeSubmitDealerOptions(){

    //if((document.forms[0].elements[0].value != "" & document.forms[0].elements[1].value != "") && (document.forms[0].elements[0].value.length == 10 && document.forms[0].elements[1].value.length == 10)){
    //fixit();
  //parse through and take out any special characters....
            var myString;
            for (var i=0;i<document.forms[0].elements.length;i++) {
                myString = document.forms[0].elements[i].value;
                myString=myString.replace("'","");
                document.forms[0].elements[i].value=myString;
            }

    if(( document.forms[0].outboundphone1A.value.length != 3) || ( document.forms[0].outboundphone1B.value.length != 3) || ( document.forms[0].outboundphone1C.value.length != 4)){
                alert("Phone Numbers must be 10 digits")
                document.forms[0].elements[0].focus()
                return;
            }else{

                document.forms[0].outboundphone1.value = document.forms[0].outboundphone1A.value + document.forms[0].outboundphone1B.value + document.forms[0].outboundphone1C.value;
                document.forms[0].outboundphone2.value = document.forms[0].outboundphone2A.value + document.forms[0].outboundphone2B.value + document.forms[0].outboundphone2C.value;
                document.forms[0].outboundphone3.value = document.forms[0].outboundphone3A.value + document.forms[0].outboundphone3B.value + document.forms[0].outboundphone3C.value;
                document.forms[0].FailurePhone1.value = document.forms[0].FailurePhone1A.value + document.forms[0].FailurePhone1B.value + document.forms[0].FailurePhone1C.value;

                document.forms[0].submit();
            }

   /* if(( document.forms[0].FailurePhone1A.value.length != 3) || ( document.forms[0].FailurePhone1B.value.length != 3) || ( document.forms[0].FailurePhone1C.value.length != 4)){
                alert("Phone Numbers must be 10 digits")
                document.forms[0].elements[16].focus()
            }else{
                document.forms[0].FailurePhone1.value = document.forms[0].FailurePhone1A.value + document.forms[0].FailurePhone1B.value + document.forms[0].FailurePhone1C.value;

                document.forms[0].submit();
            }
*/

   // if(document.forms[0].elements[0].value.length < 3 || document.forms[0].elements[0].value == ""){
   //   alert("You must fill in all of the required fields! (those marked with *)");
    //}


 //document.forms[0].submit();


    }

function maybeSubmit02(){
    //if((document.forms[0].elements[0].value != "" & document.forms[0].elements[1].value != "") && (document.forms[0].elements[0].value.length == 10 && document.forms[0].elements[1].value.length == 10)){
            if(( document.forms[0].agentPhone1A.value.length != 3) || ( document.forms[0].agentPhone1B.value.length != 3) || ( document.forms[0].agentPhone1C.value.length != 4)){
                alert("Phone Number must be 10 digits")
            }else{

                document.forms[0].agentPhone1.value = document.forms[0].agentPhone1A.value + document.forms[0].agentPhone1B.value + document.forms[0].agentPhone1C.value;
                document.forms[0].submit();


            }
    }


function maybechangepassword(){

    var dosubmit = true;

    if(document.forms[0].dealeremail.value == ""){
        alert("Please enter your login!");
        dosubmit = false;
        return;
    }

    if(document.forms[0].oldpass.value == ""){
        alert("Please enter your old password!");
        dosubmit = false;
        return;
    }

      if(document.forms[0].newpass1.value == ""){
        alert("Please enter your new password!");
        dosubmit = false;
        return;
    }

       if(document.forms[0].newpass2.value == ""){
        alert("Please enter new password twice!");
        dosubmit = false;
        return;
    }


    if(document.forms[0].newpass1.value != document.forms[0].newpass2.value){
        alert("Both password inputs must match!");
        dosubmit = false;
        return;
    }

    if(dosubmit){
        document.forms[0].submit();
    }
}



function redirectoptions(){
    //alert("about to redirect to /system/manage/options.jsp?dealersubid="+ document.chooseoptionset.dealersubid.value);
    window.location = "/system/manage/options.jsp?optionid=" + document.chooseoptionset.dealersubid.value;

}

function redirectdealership(){
    //alert("about to redirect to /system/manage/options.jsp?dealersubid="+ document.chooseoptionset.dealersubid.value);
    window.location = "/system/auth.jsp?dealerid=" + document.selectuser.dealerid.value;

}




//auto jump code!********************************************************************************
  var downStrokeField;
function autojump(fieldName,nextFieldName,fakeMaxLength)
{
var myForm=document.forms[document.forms.length - 1];
var myField=myForm.elements[fieldName];
myField.nextField=myForm.elements[nextFieldName];

if (myField.maxLength == null)
   myField.maxLength=fakeMaxLength;

myField.onkeydown=autojump_keyDown;
myField.onkeyup=autojump_keyUp;
}

function autojumpv2(fieldName,nextFieldName,fakeMaxLength,formname)
{
var myForm=document.forms[formname];
var myField=myForm.elements[fieldName];
myField.nextField=myForm.elements[nextFieldName];

if (myField.maxLength == null)
   myField.maxLength=fakeMaxLength;

myField.onkeydown=autojump_keyDown;
myField.onkeyup=autojump_keyUp;
}



function autojump_keyDown()
{
this.beforeLength=this.value.length;
downStrokeField=this;
}

function autojump_keyUp()
{
if (
   (this == downStrokeField) &&
   (this.value.length > this.beforeLength) &&
   (this.value.length >= this.maxLength)
   )
   this.nextField.focus();
downStrokeField=null;
}
//auto jump code!********************************************************************************
function URLEncode(arg1)
{
	// The Javascript escape and unescape functions do not correspond
	// with what browsers actually do...
	var SAFECHARS = "0123456789" +					// Numeric
					"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +	// Alphabetic
					"abcdefghijklmnopqrstuvwxyz" +
					"-_.!~*'()";					// RFC2396 Mark characters
	var HEX = "0123456789ABCDEF";

	var plaintext = arg1;
	var encoded = "";
	for (var i = 0; i < plaintext.length; i++ ) {
		var ch = plaintext.charAt(i);
	    if (ch == " ") {
		    encoded += "+";				// x-www-urlencoded, rather than %20
		} else if (SAFECHARS.indexOf(ch) != -1) {
		    encoded += ch;
		} else {
		    var charCode = ch.charCodeAt(0);
			if (charCode > 255) {
			    alert( "Unicode Character '" 
                        + ch 
                        + "' cannot be encoded using standard URL encoding.\n" +
				          "(URL encoding only supports 8-bit characters.)\n" +
						  "A space (+) will be substituted." );
				encoded += "+";
			} else {
				encoded += "%";
				encoded += HEX.charAt((charCode >> 4) & 0xF);
				encoded += HEX.charAt(charCode & 0xF);
			}
		}
	} // for

	
	return encoded;
}

function URLDecode(arg1)
{
   // Replace + with ' '
   // Replace %xx with equivalent character
   // Put [ERROR] in output if %xx is invalid.
   var HEXCHARS = "0123456789ABCDEFabcdef"; 
   var encoded = arg1;
   var plaintext = "";
   var i = 0;
   while (i < encoded.length) {
       var ch = encoded.charAt(i);
	   if (ch == "+") {
	       plaintext += " ";
		   i++;
	   } else if (ch == "%") {
			if (i < (encoded.length-2) 
					&& HEXCHARS.indexOf(encoded.charAt(i+1)) != -1 
					&& HEXCHARS.indexOf(encoded.charAt(i+2)) != -1 ) {
				plaintext += unescape( encoded.substr(i,3) );
				i += 3;
			} else {
				alert( 'Bad escape combination near ...' + encoded.substr(i) );
				plaintext += "%[ERROR]";
				i++;
			}
		} else {
		   plaintext += ch;
		   i++;
		}
	} // while
   
   return plaintext;
}

function mapIt(number,startdate,enddate){
	
	startdate=URLEncode(startdate);
	enddate=URLEncode(enddate);
	
	var sessionMap=window.open("/system/smart800/mapwindow.jsp?number="+number + 
    							"&startdate="+startdate + "&enddate="+
    							enddate, "Maping_Window",'"toolbar=no, directories=no, location=no, status=no, menubar=no,'
    								+ 'resizable=yes, scrollbars=yes, width=1025,height=800"');

    sessionMap.focus();
    //customerPhone.moveTo((screen.width/2)-(700/2),(screen.height/2)-(500/2));
}

function getStarted(number,startdate,enddate){
	
	var getStarted=window.open("/system/smart800/gettingstarted.jsp?number="+number + 
    							"&startdate="+startdate + "&enddate="+
    							enddate, "Help_Window",'"toolbar=no, directories=no, location=no, status=no, menubar=no,'
    								+ 'resizable=yes, scrollbars=yes, width=1025,height=800"');

    getStarted.focus();
    //customerPhone.moveTo((screen.width/2)-(700/2),(screen.height/2)-(500/2));
}


function notecard(entitytpe,elementid){	
	
		
	var notecard=window.open("/system/smart800/notecardmanager.jsp?entitytype=" + entitytpe + "&id=" + elementid, "",'"toolbar=no, directories=no, location=no, status=no, menubar=no,'
    								+ 'resizable=no, scrollbars=no, width=600,height=800"');

    notecard.focus();
    //customerPhone.moveTo((screen.width/2)-(700/2),(screen.height/2)-(500/2));
}

function notecard2(entitytpe,elementid){	
	
		
	var notecard=window.open("/system/smart800/notecardmanager2.jsp?entitytype=" + entitytpe + "&id=" + elementid, "",'"toolbar=no, directories=no, location=no, status=no, menubar=no,'
    								+ 'resizable=no, scrollbars=no, width=600,height=800"');

    notecard.focus();
    //customerPhone.moveTo((screen.width/2)-(700/2),(screen.height/2)-(500/2));
}






