﻿         /*-------------------------------  AJAX ---------------------------------*/
          function xmlCreateLog() {
                var xmlHttp;
                if (typeof XMLHttpRequest != 'undefined') {
                    xmlHttp = new XMLHttpRequest();
                } else {
                    try {
                        xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
                    } catch (e) {
                        try {
                            xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                        } catch (E) {
                            xmlHttp = null;
                        }
                    }
                }
                return xmlHttp;
            }
            
          function xmlAsyncLog(url, callback, postData) {
                var req = xmlCreateLog();
                if (req == null) return;
                var method = (postData) ? "POST" : "GET";
                req.open(method, url, true);
                req.setRequestHeader('User-Agent', 'XMLHTTP/1.0');
                if (postData) req.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); 
                    req.onreadystatechange = function() {
                        if (req.readyState != 4) return;
                        if (req.status != 200 && req.status != 304) return;
                             callback(req);                 
                 }
                    req.send(postData);
            }
            
           
          function getLogComplete(xmlHttp){
            
                if ( xmlHttp.readyState == 4){
                       if (xmlHttp.status == 200){

                           //var lv =document.getElementById("dx01");
                           // lv.innerHTML = xmlHttp.responseText;

                       }
                    }
            
            }
            
         /*-------------------------------  AJAX ---------------------------------*/


            function error_image(xImgpage, xImgtype, xPath, cid, tid, xobj, size) {
                url = "/Service/ImageError.aspx?xpath=" + xPath + "&ximgtype=" + xImgtype + "&ximgpage=" + xImgpage + "&cid=" + cid + "&tid=" + tid;
                xmlAsyncLog(url, getLogComplete);
                
            if (xImgtype == 1 ){

            }else if (xImgtype == 2 ){
                        xobj.src="/images/Replacement/img_banner.jpg";
            }else if (xImgtype == 3 ){
            
                         if (size=='s') {
                            xobj.src="/images/Replacement/img_mapTent_S.jpg";
                        }else if (size=='m') {
                             xobj.src = "/images/Replacement/img_mapM.jpg";
                        }else {
                            xobj.src="/images/Replacement/img_mapTent_B.jpg";
                        }
                        
            }else if (xImgtype == 4 ){
            
                        if (size=='s') {
                            xobj.src="/images/Replacement/img_mapTent_S.jpg";
                        }else if (size=='m') {
                             xobj.src = "/images/Replacement/img_mapM.jpg";
                        }else {
                            xobj.src="/images/Replacement/img_mapTent_B.jpg";
                        }
                
            }else if (xImgtype == 5 ){
                         xobj.src="/images/Replacement/img_logo.jpg";    
            }



        }
       
        function LoadCarImage(xobj, path, img3, millerServer, height, weight) {

            var img = new Image();
            $(img).width(weight);
            $(img).height(height);
            $(img).load(function() {
                $(this).hide();
                xobj.parent().removeClass('pre-loading');
                xobj.append(this);
                $(this).fadeIn();
            }).error(function() {

                var xError = new Image();
                $(xError).width(weight);
                $(xError).height(height);
                $(xError).load(function() {
                    $(this).hide();
                    xobj.parent().removeClass('pre-loading');
                    xobj.append(this)
                    $(this).fadeIn();
                }).error(function() {
                    $(this).attr("src", "http://www.one2car.com/images/Replacement/img_mapTent_M.jpg");
                    $(this).hide();
                    xobj.parent().removeClass('pre-loading');
                    xobj.append(this);
                }).attr('src', millerServer + img3);

            }).attr('src', path);

        } 
        function LoadCarImageMain(xobj, path, mainServer, millerServer, height, weight) {
            var img = new Image();
            $(img).width(weight);
            $(img).height(height);
            $(img).load(function() {
                $(this).hide();
                xobj.parent().removeClass('pre-loading');
                xobj.append(this);
                $(this).fadeIn();
            }).error(function() {
                var xError = new Image();
                $(xError).width(weight);
                $(xError).height(height);
                $(xError).load(function() {
                    $(this).hide();
                    xobj.parent().removeClass('pre-loading');
                    xobj.append(this)
                    $(this).fadeIn();
                }).error(function() {
                    $(this).attr("src", "http://www.one2car.com/images/Replacement/img_mapTent_M.jpg");
                    $(this).hide();
                    xobj.parent().removeClass('pre-loading');
                    xobj.append(this);
                }).attr('src', millerServer + path);

            }).attr('src', mainServer + path);
        }
         function LoadCarImageHot(xobj, img3, bigImg, height, weight) {

            var img = new Image();
            $(img).width(weight);
            $(img).height(height);
            $(img).load(function() {
                $(this).hide();
                xobj.parent().removeClass('pre-loading');
                xobj.append(this);
                $(this).fadeIn();
            }).error(function() {
                var xError = new Image();
                $(xError).width(weight);
                $(xError).height(height);
                $(this).attr("src", "http://www.one2car.com/images/Replacement/img_mapTent_M.jpg");
                $(this).hide();
                xobj.parent().removeClass('pre-loading');
                xobj.append(this);
            }).attr('src', bigImg + img3);

        } 

