﻿
/********* Start 常量 *********/
var PROCESS_STRING = '数据处理中，请稍候...';
var REMEMBER_USERNAME = false;
/********* End 常量 ***********/

if(GetCookie("username") != undefined)
{
    if($("txtUsername"))
    {
        $("txtUsername").value = GetCookie("username");
    }
    
    if($("chkRemember"))
    {
        $("chkRemember").checked = true;
    }
}
if(GetCookie("autologin") == "true")
{
    if(GetCookie("password") != undefined)
    {
        if($("txtPassword"))
        {
            $("txtPassword").value = GetCookie("password");
        }
    }
    if($("chkAutoLogin"))
    {
        $("chkAutoLogin").checked = true;
    }
    Login_AndRedirect($('txtUsername').value, $('txtPassword').value, '/Default.aspx');
}


var Navigator = new Object();
if(navigator.userAgent.indexOf("MSIE") != -1)
{
    Navigator.IE = true;
    if(navigator.userAgent.indexOf("MSIE 6.0") != -1)
    {
        Navigator.IE6 = true;
    }
    if(navigator.userAgent.indexOf("MSIE 7.0") != -1)
    {
        Navigator.IE7 = true;
    }
}
if(navigator.userAgent.indexOf("Firefox") != -1)
{
    Navigator.Firefox = true;
}
if(!Navigator.IE6 && !Navigator.IE7 && !Navigator.Firefox)
{
    //alert('您的浏览器暂不支持，因此可能显示有问题，建议使用Microsoft IE 6.0+或Mozilla Firefox浏览');
}
function $(id)
{
    return document.getElementById(id);
}
function SetCookie(sName, sValue)
{
    var date = new Date();
    date.setFullYear(date.getFullYear() + 1);
    document.cookie = sName + "=" + escape(sValue) + "; domain=yi-qiao.cn; expires=" + date.toGMTString();
}
function GetCookie(sName)
{
    var aCookie = document.cookie.split("; ");
    for (var i = 0; i < aCookie.length; i++)
    {
        var aCrumb = aCookie[i].split("=");
        if (sName == aCrumb[0]) 
            return unescape(aCrumb[1]);
    }
    return null;
}
function GetPrefix()
{
    var url = window.location.href;
    var spaceIndex = url.indexOf('space.');
    var communityIndex = url.indexOf('qun.');
    alert(spaceIndex);
    alert(communityIndex);
    if(spaceIndex == -1)
    {
        if(communityIndex >= 0)
        {
            alert(url.indexOf('.yi-qiao.com'));
            var temp = url.substring(17,url.indexOf('.yi-qiao.cn'));
            alert(temp);
            return temp;
        }
        else
            return null;
    }
    else if(communityIndex == -1)
    {
        return url.substring(communityIndex+6,url.indexOf('.yi-qiao.cn'));
    }
    else
        return null;
}
function SetHomePage(url)
{
    document.body.style.behavior='url(#default#homepage)';
    document.body.setHomePage(url);
}
function FavSite(url, title)
{
    if (window.sidebar)
    {
        window.sidebar.addPanel(title,url,"");
    }
    else   if(  document.all )
    { 
        window.external.AddFavorite(url,title);
    }
    else
    {
        return true;
    }
} 
function NewWindow(url)
{
    window.open(url);
}
function Reload()
{
    window.location.href = window.location.href;
    //document.execCommand('Refresh');
}
function ToggleDisplay_none_block(controlID)
{
    var control = $(controlID);
    if (control.style.display == 'none')
    {
        control.style.display = 'block';
    }
    else
    {
        control.style.display = 'none';
    }
}
function ToggleDisplay(control)
{
    if (control.style.display == 'none')
    {
        control.style.display = 'block';
    }
    else
    {
        control.style.display = 'none';
    }
}
function SetDisplayNone(controlID)
{
    var control = $(controlID);
    control.style.display = 'none';
}
function SetDisplayBlock(controlID)
{
    var control = $(controlID);
    control.style.display = 'block';
}
function SetDisplayInline(controlID)
{
    var control = $(controlID);
    control.style.display = 'inline';
}
function SetHidden(controlID)
{
    var control = $(controlID);
    control.style.visibility = 'hidden';
}
function SetVisible(controlID)
{
    var control = $(controlID);
    control.style.visibility = 'visible';
}
function SetEnable(controlID)
{
    $(controlID).disabled = false;
}
function SetDisable(controlID)
{
    $(controlID).disabled = true;
}
function SetFocus(controlID)
{
    var control = $(controlID);
    try
    {
        control.focus();
    }
    catch(e){}
}
function SetFloatLeft(control)
{
    if(document.all)
    {
        control.style.styleFloat = 'left';
    }
    else
    {
        control.style.cssFloat = 'left';
    }
}
function SetFloatRight(control)
{
    if(document.all)
    {
        control.style.styleFloat = 'right';
    }
    else
    {
        control.style.cssFloat = 'right';
    }
}
function SetFrameHeight(height)
{
    if(height != null)
    {
        window.frameElement.style.height = height + "px";
    }
    else
    {
        window.frameElement.style.height = document.body.scrollHeight + "px";
    }
}
function SetFrameHeightAtLeast(height)
{
    if(document.body.scrollHeight < height)
    {
        SetFrameHeight(height);
    }
    else
    {
        SetFrameHeight();
    }
}
function AddFrameHeight(height)
{
    window.frameElement.style.height = window.frameElement.offsetHeight + height + "px";
}
function SetHeight(controlID,height)
{
    $(controlID).style.height = height + "px";
}
function SetMaxHeight(control,maxHeight)
{
    if(control.scrollHeight > maxHeight)
    {
        control.style.height = maxHeight + 'px';
        control.style.overflow = 'auto';
    }
    else
    {
        control.style.height = '';
        control.style.overflow = '';
    }
}
function IsNone(controlID)
{
    if($(controlID).style.display == "none")
    {
        return true;
    }
    return false;
}
function IsBlock(controlID)
{
    if($(controlID).style.display == "block")
    {
        return true;
    }
    return false;
}
function CancelBubble(e)
{
    if(document.all)
    {
        event.cancelBubble = true;
    }
    else
    {
        e.stopPropagation();
    }
}
function FireEvent(obj,eventName)
{
    if(document.all)
    {
        obj.fireEvent('on' + eventName);
    }
    else
    {
        var evt = document.createEvent('MouseEvents'); 
        evt.initEvent(eventName, 1, 1)
        obj.dispatchEvent(evt);
    }
}
function CancelEvent(e)
{
    if(document.all)
    {
        event.returnValue = false;
    }
    else
    {
        if (e)
        {
            e.preventDefault();
        }
    }   
}
function GetOffsetLeft(control)
{
    var offsetLeft = 0;
    while(control != null)
    {
        offsetLeft += control.offsetLeft;
        control = control.offsetParent;
    }
    return offsetLeft;
}
function GetOffsetTop(control)
{
    var offsetTop = 0;
    while(control != null)
    {
        offsetTop += control.offsetTop;
        control = control.offsetParent;
    }
    return offsetTop;
}
function Redirect(url)
{
    window.location.href = url;
}
function DisableContextMenu()
{
    document.oncontextmenu = ReturnFalse;
}
Function.createDelegate = function(object, method)
{
	if(arguments.length == 2)
    {
        return function()
        {        
            method.apply(object,arguments);
        }
    }
    if(arguments.length > 2)
    {
        var args = new Array();
        for(var i = 0; i < arguments.length - 2; i++)
	    {
		    args[i] = arguments[i + 2];
	    }
        return function()
        {
            method.apply(object,args);
        }
    }
}
var scriptQueue = new Array();
var isLoadingScript = false;
function AddScript(src,onload)
{
    scriptQueue[scriptQueue.length] = new ScriptObj(src,onload);
    if(!isLoadingScript)
    {
        CheckScriptQueue();
    } 
}
function ScriptObj(src,onload)
{
    this.Src = src;
    this.Onload = onload;
}
function CheckScriptQueue()
{
    if(scriptQueue.length > 0)
    {
        isLoadingScript = true;
        var scriptObj = scriptQueue[0];
        scriptQueue.splice(0,1);
        var script = document.createElement('script');
        script.language = 'javascript';
        script.type = 'text/javascript';
        script.src = scriptObj.Src;
        script.loadDone = scriptObj.Onload;
        script.onload = script.onreadystatechange = LoadScriptDone;
        var head = document.getElementsByTagName('head')[0];
        head.appendChild(script);
    }
    else
    {
        isLoadingScript = false;
    }
}
function LoadScriptDone()
{
    if(!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')
    {
        if(this.loadDone)
        {
            this.loadDone();
        }
        CheckScriptQueue();
    } 
}
function AddCSS(src)
{
    var css = document.createElement('link');
    css.rel	= 'stylesheet';
	css.type = 'text/css';
	css.href = src;
	var head = document.getElementsByTagName('head')[0];
    head.appendChild(css);
}
// 复制到剪贴板
function CopyToClipboard(control)
{
    if (control.createTextRange)
    {
        var range = control.createTextRange();
        range.select();
        range.execCommand('Copy');
    } 
    else
    {
        var flashcopier = 'flashcopier';
        if(!$(flashcopier)) 
        {
            var divholder = document.createElement('div');
            divholder.id = flashcopier;
            document.body.appendChild(divholder);
        }
        $(flashcopier).innerHTML = '';
        var divinfo = '<embed src="/images/_clipboard.swf" FlashVars="clipboard='
                    + escape(control.value) + '" width="0" height="0" type="application/x-shockwave-flash"></embed>';
        $(flashcopier).innerHTML = divinfo;
    }
}
function TrimEnd(stringToTrim)
{
    if (stringToTrim != null && stringToTrim.length > 0 )    
    {          
        var temp = stringToTrim.charAt(stringToTrim.length - 1);
        while (stringToTrim.length > 0  && temp == ' ')  
        {
            stringToTrim = stringToTrim.substr(0, stringToTrim.length - 1); 
            temp = stringToTrim.charAt(stringToTrim.length - 1);
        }
    }
    return stringToTrim;          
}
function TimeFormat(dateTime)
{
    if(typeof dateTime == 'string')
    {
        return dateTime.toLocaleString().substr(0,dateTime.toLocaleString().length - 3);
    }
    var minutes = dateTime.getMinutes();
    if (minutes < 10)
    {
        minutes = '0' + minutes;
    }
    var time = dateTime.getFullYear() + '-' + (dateTime.getMonth() + 1) + '-' + dateTime.getDate() + ' ' + dateTime.getHours() + ':' + minutes;
    return time;
}
function DateFormat(dateTime)
{
    return dateTime.getFullYear() + '-' + (dateTime.getMonth() + 1) + '-' + dateTime.getDate();
}
String.Format = function()
{
    if(arguments.length == 0)
    {
        return null;
    }
    var exp = arguments[0];
    for(var i = 1; i < arguments.length; i++)
    {
        var reg = new RegExp('\\{' + (i-1) + '\\}','gm');

        exp = exp.replace(reg, arguments[i]);
    }
    return exp;
}
function RssTimeFormat(dateTime)
{
    return dateTime.toLocaleString().substr(0,dateTime.toLocaleString().length - 7);
}
function TagsFormat(tags)
{
    var tagsFormated="";
    if(tags.length > 0)
    {
        for(var i = 0; i < tags.length - 1; i++)
        {
            if (typeof(tags[i].Name) != 'undefined')
            {
                tagsFormated += tags[i].Name + " ";  
            }
            else
            {
                tagsFormated += tags[i] + " "; 
            }
        }
        if (typeof(tags[tags.length - 1].Name) != 'undefined')
        {
            tagsFormated += tags[tags.length - 1].Name;
        }
        else
        {
           tagsFormated += tags[tags.length - 1];  
        }
    }
    return tagsFormated;
}
function HtmlEncode(s)
{
    var c,r = '';
    for(var i = 0; i < s.length; i ++)
    {
        c = s.substr(i,1);
        switch(c)
        {
            case "&" : r += "&amp;";break;
            case "<" : r += "&lt;";break;
            case ">" : r += "&gt;";break;
            case "\"": r += "&quot;";break;
            case "'" : r += "&#39;";break;
            default  : r += c;
        }
    }
    return r;
}
function HtmlDecode(s)
{
    for(var i = 0; i < s.length; i ++)
    {
        if(s.substr(i,1) != "&")
        {
            continue;
        }
        if(s.substr(i + 1, 4) == "amp;")
        {
            s = s.substring(0,i) + "&" + s.substring(i + 5, s.length);
            continue;
        }
        if(s.substr(i + 1, 3) == "lt;")
        {
            s = s.substring(0,i) + "<" + s.substring(i + 4, s.length);
            continue;
        }
        if(s.substr(i + 1, 3) == "gt;")
        {
            s = s.substring(0,i) + ">" + s.substring(i + 4, s.length);
            continue;
        }
        if(s.substr(i + 1, 5) == "quot;")
        {
            s = s.substring(0,i) + "\"" + s.substring(i + 6, s.length);
            continue;
        }
        if(s.substr(i + 1, 4) == "#39;")
        {
            s = s.substring(0,i) + "'" + s.substring(i + 5, s.length);
            continue;
        }
    }
    return s;
}
function ResizeImage(htmlNode, maxWidth)
{
    var imgNodes = htmlNode.getElementsByTagName('IMG'); 
    if (imgNodes!= null)
    {
        for (var i = 0; i < imgNodes.length; i++)
        {
            var node = imgNodes[i];
            if (node != null) 
            {
                if (node.offsetWidth > 150)
                {
                    node.style.display = 'block';
                }
                if (node.readyState == 'loaded' || node.readyState == 'complete')
                {
                    if (node.offsetWidth > maxWidth)
                    {
                            
                        node.style.height = (maxWidth / node.offsetWidth) * node.offsetHeight + 'px';
                        node.style.width = maxWidth + 'px';
                        if (node.parentNode.tagName != 'A')
                        {
                            node.oldAlt = node.alt;
                            node.alt = node.alt + '(点击查看原图)';
                            node.onclick = ViewImage;
                            node.style.cursor = 'pointer';
                        }
                    }
                }
                else
                {
			        node.MaxWidth = maxWidth;
				    node.onload = ResizeAfterLoad;
                }
            }           
        }
    } 
}
function ResizeImage(htmlNode, maxWidth, maxHeight)
{
    var imgNodes = htmlNode.getElementsByTagName('IMG'); 
    if (imgNodes!= null)
    {
        for (var i = 0; i < imgNodes.length; i++)
        {
            var node = imgNodes[i];
            if (node != null) 
            {
                if (node.offsetWidth > 150)
                {
                    node.style.display = 'block';
                }
                if (node.readyState == 'loaded' || node.readyState == 'complete')
                {
                    if (node.offsetWidth > maxWidth)
                    {
                            
                        node.style.height = (maxWidth / node.offsetWidth) * node.offsetHeight + 'px';
                        node.style.width = maxWidth + 'px';
                        if((maxWidth / node.offsetWidth) * node.offsetHeight > maxHeight)
                        {
                            node.style.width = (maxHeight / node.offsetHeight) * node.offsetWidth + 'px';
                            node.style.height = maxHeight + 'px';
                        }
                        if (node.parentNode.tagName != 'A')
                        {
                            node.oldAlt = node.alt;
//                            node.alt = node.alt + '(点击查看原图)';
//                            node.onclick = ViewImage;
//                            node.style.cursor = 'pointer';
                        }
                    }
                }
                else
                {
			        node.MaxWidth = maxWidth;
			        node.MaxHeight = maxHeight;
				    node.onload = ResizeAfterLoad;
                }
            }           
        }
    } 
}
function ResizeAfterLoad(e)
{
    var node;
    if(document.all)
    {
        node = window.event.srcElement;
	}
	else
	{
	    node = e.currentTarget;
	}
	if (node.offsetWidth > node.MaxWidth)
	{
		node.style.height = (node.MaxWidth / node.offsetWidth) * node.offsetHeight + 'px';
		node.style.width = node.MaxWidth + 'px';
		if((node.MaxWidth / node.offsetWidth) * node.offsetHeight > node.MaxHeight)
        {
            node.style.width = (node.MaxHeight / node.offsetHeight) * node.offsetWidth + 'px';
            node.style.height = node.MaxHeight + 'px';
        }
        if (node.parentNode.tagName != 'A')
        {
            node.oldAlt = node.alt;
            //node.alt = node.alt + '(点击查看原图)';
            //node.onclick = ViewImage;
            //node.style.cursor = 'pointer';
        }
	}
}
function ViewImage(evt)
{
    if(document.all)
    {
        var node = window.event.srcElement;
	}
	else
	{
	    var node = evt.srcElement;
	}   
    window.open(node.src);    
}
function GetString(s, length)
{
    if(s == null)
    {
        return null;
    }
    var temp = HtmlDecode(s);
    var needEncode = false;
    if(temp != s)
    {
        needEncode = true;
    }
    if(temp.length <= length)
    {
        return needEncode? HtmlEncode(temp):temp;
    }    
    return needEncode? HtmlEncode(temp.substr(0, length - 1) + "…"):(temp.substr(0, length - 1) + "…");
}
function CheckEnterKey(e,handler)
{
    if(e.keyCode != 13)
    {
        return true;
    }
    if(handler != null)
    {
        handler();
    }
    return false; 
}
function IsOverLap(div1,div2)
{
    if(GetOffsetLeft(div1) < GetOffsetLeft(div2) + div2.offsetWidth && GetOffsetLeft(div1) + div1.offsetWidth > GetOffsetLeft(div2) && GetOffsetTop(div1) < GetOffsetTop(div2) + div2.offsetHeight && GetOffsetTop(div1) + div1.offsetHeight > GetOffsetTop(div2))
    {
        return true;
    }
    if(GetOffsetLeft(div2) < GetOffsetLeft(div1) + div1.offsetWidth && GetOffsetLeft(div2) + div2.offsetWidth > GetOffsetLeft(div1) && GetOffsetTop(div2) < GetOffsetTop(div1) + div1.offsetHeight && GetOffsetTop(div2) + div2.offsetHeight > GetOffsetTop(div1))
    {
        return true;
    }
    return false;
}
function ReturnFalse()
{
    return false;
}
function FixPng(img)
{
    var arVersion = navigator.appVersion.split("MSIE")
    var version = parseFloat(arVersion[1])
	if ((version >= 5.5) && (version < 7) && (document.body.filters)) 
	{
		var span = document.createElement('span');
		span.id = img.id;
		span.className = img.className;
		span.title = img.title? img.title:img.alt;
		span.style.width = img.offsetWidth + 'px';
		span.style.height = img.offsetHeight + 'px';
		span.style.display = 'inline-block';
		span.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + img.src + '", sizingMethod="crop")';
		img.parentNode.replaceChild(span,img);
		return span;
    }
    else
    {
        return null;
    }
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function GetInputValue(name)
{
    var inputs = document.getElementsByName(name);
    var value = '';
    for(var i = 0; i < inputs.length; i++)
    {
        var input = inputs[i];
        var type = input.type;
        switch(type)
        {
            case 'text':
            case 'textarea':
            case 'hidden':
                value = input.value;
                break;
            case 'radio':
                if(input.checked)
                {
                    value = input.value;
                }
                break;
            case 'checkbox':
                var checkValue = '';
                if(input.checked)
                {
                    checkValue = input.value;
                }
                if(checkValue != '')
                {
                    if(value == '')
                    {
                        value = checkValue;
                    }
                    else
                    {
                        value += ',' + checkValue;
                    }
                }
                break;
            default:
                break;
        }
    }
    return value;
}
function SetInputValue(name, value)
{
    var inputs = document.getElementsByName(name);
    for(var i = 0; i < inputs.length; i++)
    {
        var input = inputs[i];
        input.value = value;
    }
}
function ResetSelects()
{
    var selects = document.getElementsByTagName('select');
    for(var i = 0; i < selects.length; i++)
    {
        selects[i].selectedIndex = 0;
    }
}

/*********************************** 显示图片（幻灯片效果） *************************************/
function ShowImage(imgControl, src, showEffect)
{
    imgControl.onload = function()
    {
        if(document.all)
        {
            if(showEffect == true)
            {
                imgControl.style.filter="blendTrans(duration=1)";
                imgControl.filters.blendTrans.Apply();
            }
        }
        
        imgControl.style.display = '';
        
        if(document.all)
        {
            if(showEffect == true)
            {
                imgControl.filters.blendTrans.Play();
            }
        }
    }
    
    if(src != '' &&  src != undefined && src != null)
    {
        imgControl.src = src.replace('~/', '/');
    }
}

/**************************************** 切换显示 *********************************************/
function SwitchDisplay(prefix, index, totalCount, display)
{
    for(var i=0; i<totalCount; i++)
    {
        if(i == index)
        {
            if(display == true)
            {
                $(prefix+i).style.display = '';
            }
            else
            {
                $(prefix+i).style.display = 'none';
            }
        }
        else
        {
            if(display == true)
            {
                $(prefix+i).style.display = 'none';
            }
            else
            {
                $(prefix+i).style.display = '';
            }
        }
    }
}

function SwitchStyle(prefix, index, totalCount, origionStyle, specStyle)
{
    for(var i=0; i<totalCount; i++)
    {
        if(i == index)
        {
            $(prefix+i).style = specStyle;
        }
        else
        {
            $(prefix+i).style = origionStyle;
        }
    }
}

function SwitchBold(prefix, index, totalCount)
{
    for(var i=0; i<totalCount; i++)
    {
        if(i == index)
        {
            $(prefix+i).style.fontWeight = 'bold';
        }
        else
        {
            $(prefix+i).style.fontWeight = 'normal';
        }
    }
}

function SwitchClassName(prefix, index, totalCount, origionClassName, specClassName)
{
    for(var i=0; i<totalCount; i++)
    {
        if(i == index)
        {
            $(prefix+i).className = specClassName;
        }
        else
        {
            if($(prefix+i))
            {
                $(prefix+i).className = origionClassName;
            }
        }
    }
}

function SwitchImageDisplay(prefix, index, totalCount, showEffect)
{
    for(var i=0; i<totalCount; i++)
    {
        if(i == index)
        {
            ShowImage($(prefix+i), $(prefix+i).src, showEffect);
        }
        else
        {
            if($(prefix+i))
            {
                $(prefix+i).style.display = 'none';
            }
        }
    }
}

//************************* 选择颜色  *****************************

function CallColorDlg(sInitColor)
{  
    if (sInitColor == null)
    {
        var sColor = dlgHelper.ChooseColorDlg();  
    }
    else  
    {
        var sColor = dlgHelper.ChooseColorDlg(sInitColor);  
    }
    sColor = sColor.toString(16);  
    if (sColor.length < 6)
    {  
        var sTempString = "000000".substring(0,6-sColor.length);  
        sColor = sTempString.concat(sColor);  
    }  
    return "#"+sColor;
} 

/**************************** 收藏夹 ****************************/

function AddFavorite(userID, contentType, extraID, title, url)
{
    if(!confirm("您确定要收藏此内容吗？"))
    {
        return;
    }
    
    if(!isLogin || userID <= 0)
    {
        alert("您尚未登录。");
        return;
    }

    ShowProcess(PROCESS_STRING);
    YiQiao.Web.WebService.Favorite.AddFavorite(userID, 1, contentType, extraID, title, url, function(result){
        HideProcess();
        if(result == 0)
        {
            alert("已添加到您的收藏夹中！");
        }
    });
}

/***************************** FCKEditor *******************************/

function GetFCKContentLength(controlID)
{
    var oEditor = FCKeditorAPI.GetInstance(controlID) ;
    var oDOM = oEditor.EditorDocument ;
    var iLength ;
    if ( document.all )        
    {
        iLength = oDOM.body.innerText.length ;
    }
    else                    
    {
        var r = oDOM.createRange() ;
        r.selectNodeContents( oDOM.body ) ;
        iLength = r.toString().length ;
    }
    return iLength
}  

function GetFCKContent(str)
{
     var oEditor = FCKeditorAPI.GetInstance(str) ;
     return oEditor.GetXHTML();
}  