var host = location.host;
var domainArray = host.split('.');
var domainSize  = domainArray.length;
var cnDomain    = ['com','net','org','gov','edu'];
if (domainArray[domainSize - 1] == 'cn') {
    var secondDomain = domainArray[domainSize - 2];
    if (in_array(secondDomain,cnDomain)){
	var thirdDomain = domainArray[domainSize - 3];
	document.domain = thirdDomain + '.' + secondDomain + '.' + domainArray[domainSize - 1];
    }
}else {
    document.domain = domainArray[domainSize - 2] + '.' + domainArray[domainSize - 1];
}
window.onload = function() {
    if (document.domain == 'qudao168.com') {
	__resetIframeSrc("pping_iframe");
    }
}
function __resetIframeSrc(id)
{	
    var iframe = document.getElementById(id);
    var src    = iframe.src;
    if (!src.match('comment.qudao168.com\/view\/replies_iframe.php')) {
	var newSrc = src.replace(/http:\S+\/view/,"http://comment.qudao168.com/view");
	iframe.src = newSrc;
    }
}

function __pping_resize()
{
    this.divIdAttributeValue = 'pping_iframe_placehold';
    this.FFextraHeight=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1] >= 0.1 ? 16 : 0;

    this.resize = function() {
        try {
            var objs = this.get_objs_by_id(this.divIdAttributeValue);
            for(var i=0;i<objs.length;i++) {
                this.change_size_single(objs[i].divObj, objs[i].ifrObj);
            }
        } catch(e){}
    };
    this.get_objs_by_id = function(divIdValue) {
        var divs = document.getElementsByTagName('DIV');
        var objs = [];
        for(var i=0;i<divs.length;i++) {
            var div = divs[i];
            if(div.getAttribute('id') == divIdValue) {
                var obj = new Object;
                obj.divObj = div;
                obj.ifrObj = div.getElementsByTagName('IFRAME')[0];
                if(obj.ifrObj) {
                    objs.push(obj);
                }
            }
        }
        return objs;
    };
    this.change_size_single = function(divObj, ifrObj) {
        if (divObj && !window.opera) {
            if (ifrObj.contentDocument && ifrObj.contentDocument.body.offsetHeight>=0){
                    divObj.style.height = ifrObj.contentDocument.body.offsetHeight+this.FFextraHeight +"px"; 
                    ifrObj.height = ifrObj.contentDocument.body.offsetHeight+this.FFextraHeight;
            } else if (ifrObj.Document && ifrObj.Document.body.scrollHeight){
                divObj.style.height = ifrObj.Document.body.scrollHeight;
                ifrObj.height = ifrObj.Document.body.scrollHeight;
            }
        }
    };
}
function in_array(v,a){
    for(key in a){
       if(a[key] == v){
	   return true;
       }
    }
    return false;
 }