//图片自适应
function ImageLoad(_width,_height){
    var getImgSize = function(element){
        if(element.clientWidth){
            return {width:element.clientWidth,height:element.clientHeight};
        }
        if(element.style.width){
            return {width:parseInt(element.style.width),height:parseInt(element.style.height)};
        }
        if(element.currentStyle){
            return {width:element.currentStyle.width,height:element.currentStyle.height};
        }
        if(document.defaultView && document.defaultView.getComputedStyle){
            return {width:document.defaultView.getComputedStyle(element,"").getPropertyValue("width"),
                    height:document.defaultView.getComputedStyle(element,"").getPropertyValue("height")};
        }
    }

    var fun = function(){
        var size = getImgSize(this);
        if(size)
        {
            if (size.width > _width || size.height > _height){
                if (size.width > size.height){
	                this.width = _width;
                }
                else if (size.height > size.width){
	                this.height = _height;
                }
                else{
	                this.height = _height;
                }
            }
        }
    };
    
    var getfun = function(object,fun1){
        var args = Array.prototype.slice.call(arguments).slice(2);
        return function(){
            fun1.apply(object,[window.event || arguments[0]].concat(args));
        };
    };
            
    (function(){
        if(window.attachEvent){
            if("complete" == this.readyState){
                fun.apply(this,arguments);
                setTimeout(getfun(this,arguments.callee),500);
            }
            else{
                setTimeout(getfun(this,arguments.callee),500);
            }
        }
        else{
            fun.apply(this,arguments);
            setTimeout(getfun(this,arguments.callee),500);
        }
    }).apply(this,arguments);
}

function ShowPhoto(index)
{
    for(var i = 1;i<=7;i++)
    {
        if(document.getElementById("photodiv"+i))
        {
            document.getElementById("photodiv"+i).style.display="none";
        }
        if(document.getElementById("photoli"+i))
        {  
            document.getElementById("photoli"+i).className="";
        }
    }
    if(document.getElementById("imgPhotoId"+index).src=="");
    {
        ImageLoad.apply(document.getElementById("imgPhotoId"+index),[521,391]);
        document.getElementById("imgPhotoId"+index).src=document.getElementById("inputPhotoId"+index).value;     
//        var mainulr;
//        mainulr = document.getElementById("inputPhotoId"+index).value;
//        getFootClick(mainulr);
    }
    document.getElementById("photodiv"+index).style.cssText = "";
    document.getElementById("photodiv"+index).style.display = "";
//    document.getElementById("photoType").innerHTML = document.getElementById("photoType"+index).value;
//    document.getElementById("photoPlace").innerHTML = document.getElementById("photoPlace"+index).value;
//    document.getElementById("photoHeader").innerHTML = "<a href=\"javascript:void(0);\" onclick=\"javascript:GoToUrl('"+document.getElementById("photoPlaceLink"+index).value+"');\">了解更多"+document.getElementById("photoPlace"+index).value+"的情况</a>";
    if(document.getElementById("orderID"))
        document.getElementById("orderID").value = index;
    document.getElementById("photoli"+index).className="current";
    document.getElementById("phototitle").value = document.getElementById("phototitle"+index).value;
    document.getElementById("photolink").value = "http://destguides.ctrip.com" + document.getElementById("photolink"+index).value;
}

function GoToUrl(url)
{
    (opener || parent).location.href=url;
    window.close();
}

function nofind(img,src){  
    img.onerror=null; 
    img.src=src; 
}

function getFootClick(url)
{
    var allUrl="";
    allUrl = window.location.href + "#" + url;
    
    jQuery.ajax({
                    type: "GET",
                    url: "/Destguides/AjaxNew/GetMembersFootLink.ashx",
                    dateType: "plain",
                    data: {
	                    url:allUrl
                    },
                    success: function(data){
                        
                    }
                });
}

