  //         this ajax script is verion 1.0.2 based on a revision 4Q 2009-2010
  //                                                        noted : 2010-04-12
  function makeHttpRequest(url, callback_function, return_xml)
  {
    var http_request, response, i;
   
    var activex_ids = [
         'MSXML2.XMLHTTP.3.0',
         'MSXML2.XMLHTTP',
         'Microsoft.XMLHTTP'
       ];
   
    if (window.XMLHttpRequest) { 
    
      http_request = new XMLHttpRequest();
      if (http_request.overrideMimeType) {
        http_request.overrideMimeType('text/xml');
      }
    } else if (window.ActiveXObject) {                   
      for (i = 0; i < activex_ids.length; i++) {
        try {
          http_request = new ActiveXObject(activex_ids[i]);
        } catch (e) {}
      }
    }
   
    if (!http_request) {
      alert("Unfortunately your browser doesn\'t support this feature.");
      return false;
    }
   
    http_request.onreadystatechange = function() {
      if (http_request.readyState !== 4) {      
          return;
      }
      if (http_request.status !== 200) {
      
        alert("There was a problem with the request.(Code: " 
               + http_request.status + ')');
        return;
      }
      if (return_xml) 
      {        
         response = http_request.responseXML;
      } else {
         response = http_request.responseText;
      }
      
      callback_function(response);
    };
   
    http_request.open('GET', url, true);
    http_request.send(null);
  }
  
     
  //                                                      Browser Support Code
  //                       this version seems to have a higher acceptance rate
  //                         version update is 1.0.3 works from inside MySpace
  //                                                       edited : 2010-09-20
  function ajaxFunction(urlfile, urlparam, tardiv)
  {
      //                                    variable from the parameter passed
      //                                         are as follows or check below
      // urlfile - script to call
      // urlparam - is the url param to be passed on to urlfile
      //            like : 
      //                   ?age=12&sex=male&wpm=sample-string-or-something
      //
      // tardiv - this is the user defined display div for the reply or 
      //          return value from urlfile
      //
   	var ajaxRequest;               // The variable that makes Ajax possible!
   	
   	if (tardiv == "") { tardiv = "ajaxDiv"; }
   	
   	try{
   		//                                        Opera 8.0+, Firefox, Safari
   		ajaxRequest = new XMLHttpRequest();
   	} catch (e){
   		//                                         Internet Explorer Browsers
   		try{
   			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
   		} catch (e) {
   			try{
   				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
   			} catch (e){
   				//                                         Something went wrong
   				alert("Your browser broke!");
   				return false;
   			}
   		}
   	}
   	//         Create a function that will receive data sent from the server
   	//                      and it is expecting an echoed value from urlfile
   	ajaxRequest.onreadystatechange = function(){
   		if(ajaxRequest.readyState == 4){
   			var ajaxDisplay = document.getElementById(tardiv);
   			ajaxDisplay.innerHTML = ajaxRequest.responseText;
   		}
   	}
	
   	//                                 attempt to call via "GET" method here
   	ajaxRequest.open("GET", urlfile + urlparam, true);
   	ajaxRequest.send(null); 
  }
 
  
  function emailcheck(str)
  {
	var at="@";
	var dot=".";
	var lat=str.indexOf(at);
	var lstr=str.length;
	var ldot=str.indexOf(dot);
	
	if (str.indexOf(at)==-1){ return('0');
	}
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   return('0');
	}
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr)
	{
	    return('0');
	}
	if (str.indexOf(at,(lat+1))!=-1){ return('0');
	}

	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
	    return('0');
	}
	if (str.indexOf(dot,(lat+2))==-1){
	    return('0');
	}		
	if (str.indexOf(" ")!=-1){ 
	   return('0');
	}
 		return('1');					
  }
  
  //                       this will create a floating DIV on the current page
  //                  you need to add this to close thie current active window
  //                   code :
  //                   this.parentNode.parentNode.removeChild(this.parentNode)
  // 
  function createPopUp(popUpCode) 
  { 
     var div = document.createElement('div'); 
     
     div.innerHTML = popUpCode; 
     document.body.appendChild(div.firstChild); 
  }
  
  //             these functions are for the Cookies, like setting and testing
  //            it have been proven that some browser does not support the use
  //                                                          of Cookie at all
  //
  function nameDefined(ckie,nme)
  {
      var splitValues;
      var i;
      for (i=0;i<ckie.length;++i)
      {
         splitValues=ckie[i].split("=")
         if (splitValues[0]==nme) return true;
      }
      return false;
  }
  
  function delBlanks(strng)
  {
      var result="";
      var i;
      var chrn;
      for (i=0;i<strng.length;++i) {
         chrn=strng.charAt(i);
         if (chrn!=" ") result += chrn;
      }
      return result;
  }

  //                                                will get the stored Cookie
  //                                                       edited : 2010-03-24
  function getCookieValue(ckie, nme)
  {
      var splitValues;
      var i;
      
      for(i=0;i<ckie.length;++i) 
      {
         splitValues=ckie[i].split("=");
         if(splitValues[0]==nme) return splitValues[1];
      }
      return "";
  }
  
  function testCookie(cname, cvalue) 
  {                                       //        Tests to see if the cookie 
      var cookie=document.cookie;         //           with the name and value 
      var chkdCookie=delBlanks(cookie);   //        are on the client computer
      var nvpair=chkdCookie.split(";");
      
      if(nameDefined(nvpair,cname))       //    See if the name is in any pair
      {   
         tvalue=getCookieValue(nvpair,cname); //  Gets the value of the cookie
         if (tvalue == cvalue) return true
   	   else return false;
      }
      else return false;
  }
  
  //                                      verify and retreive the Cookie value
  //                                                       edited : 2010-03-24
  function fetchCookie(cname)
  {
     var cookie=document.cookie;          
     var chkdCookie=delBlanks(cookie);   
     var nvpair=chkdCookie.split(";");
     var tvalue="";

     if(nameDefined(nvpair,cname))
     {
        tvalue=getCookieValue(nvpair,cname);
     }  
     return tvalue;
  }

  //              this function creates or defines a COOKIE but with a limited
  //                                                       edited : 2010-04-25
  function remCookie(cname, cvalue, myperiod)
  {
     var futdate = new Date();
     var expdate = futdate.getTime();

     expdate += 3600 * 1000 * myperiod;
     futdate.setTime(expdate);

     //                                           Set the new cookie values up
     var newCookie = cname + "=" + cvalue + "; path=/;";
     newCookie += " expires=" + futdate.toGMTString();
     window.document.cookie = newCookie;
  }

  <!--  will return False if there are special characters in this variable -->
  <!--                                                 edited : 2010-04-08 -->
  function isSpecial(testvar)
  {
     var iChars = "!@#$%^&*()+=-[]\\\';,./{}|\":<>?";

      for (var i=0; i < testvar.length; i++) {
        if (iChars.indexOf(testvar.charAt(i)) != -1) {
             return false;
           }
      }
      return true;
  }


  //     this function will create a DIV that collapse and expand when clicked
  //              on by the user and requires a another DIV to hold the images
  //                   default state is tog = false which means normal tagging
  //              please note that this function was copied from www.leiron.be
  //                                                       edited : 2010-04-23
  var b_el=null;
  var tog=false;

  function ToggleBody(e_id, mytog)
  {
      var b_state='none';
      var img='images/collapse.gif';

      if (mytog == 1){ tog = true; }

      if (tog&&(b_el!=null)&&(b_el.id!=e_id+"Body")) b_el.style.display='none';

      if (document.getElementById){
         b_el=document.getElementById(e_id+"Body");
         u_img=document.getElementById(e_id+"Up");
      }
         else if (document.all)
         {
            b_el=document.all[e_id+"Body"];
            u_img=document.all[e_id+"Up"];
           }

      if (b_el!=null)
      {
         if (b_el[0])
         {
            b_el=b_el[0];
            u_img=u_img[0];
         }

         if (b_el.style.display=="none")
         {
            img="images/expand.gif";
            b_state='block';
         }

         u_img.src=img;
         b_el.style.display=b_state;
      }
      return false;
  }
  //                        note that for every DIV ID passed to this function
  //                        2 other are created and looks for the parameter as
  //                                 seen below :
  //                                              <div id="vinBody" > ...</div>
  //                                              <div id="vinUp" > ... .</div>
  // example code:
  //
  //     <td valign="middle" style="cursor:pointer" align="right"
  //       onclick="ToggleBody('vin',1);" width="100%">
  //        <font color="#421062">Transaction & Summary</font>
  //        &nbsp;
  //        <a name="vin"><img id="vinUp" width="15" height="14"
  //        alt="expand" src="images/expand.gif"></a>
  //     </td>
  //     ...
  //     <td valign="top">
  //       <div id="vinBody" valign="top">
  //           .. .
  //           ...
  //       </div>
  //     </td>


  //   clear the current form input data fields and please make sure to change
  //                     the form name called "vinz" to your current form name
  //                                                       edited : 2010-05-25
  function submit_form(frmname)
  {
     document.frmname.submit();
     document.frmname.reset();
  }


