﻿
/********* Start 常量 *********/
var PROCESS_STRING = '数据处理中，请稍候...';
var REMEMBER_USERNAME = false;
/********* End 常量 ***********/

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.setHours(date.getHours() + 1);
    document.cookie = sName + "=" + escape(sValue) + "; domain=fuedf.org; 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 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;
    }
}

/************************  YQAlert Start  ********************************/
var YiQiaoAlertPanel;
function YQAlert(content, btnText, btnOnclickHandler, isRight)
{
    if(btnOnclickHandler == null || btnOnclickHandler == 'undefined')
    {
        btnOnclickHandler = "YiQiaoAlertPanel.close();";
    }
    else
    {
        btnOnclickHandler = "YiQiaoAlertPanel.close();" + btnOnclickHandler;
    }
    if(btnText == null || btnText == 'undefined')
    {
        btnText = '确 定';
    }
    var noteDiv
    var html = '';
    html += '<div class="close"><a href="javascript:void(0)" onclick="YiQiaoAlertPanel.close()" class="f3">[关闭]</a></div>';
    html += '<div class="content2">';
    if((isRight || isRight == null) || isRight == 'undefined')
    {
        html += '<div class="alert" style="height:50px">';
    }
    else
    {
        html += '<div class="alert" style="height:50px;background:url(/Themes/Theme3/images/regts_arr.gif) left 30px no-repeat">';
    }
    html += content;
    html += '</div>';
    html += '<div align="right"><input name="Submit" type="button" class="input2" id="Submit" onclick="'+btnOnclickHandler+'" value="'+btnText+'" /></div>';
    html += '</div>';
    html += '<div class="clear"></div>';

    noteDiv = InitialPopupMenu(false);
    noteDiv.id = 'YiQiaoNoteDiv';
    noteDiv.className = 'Direct_Successbox';
    noteDiv.style.display = 'none';
    noteDiv.innerHTML = html;
    
    YiQiaoAlertPanel = CreatePanel(noteDiv, true, false, null, null, 451, 100, false, false, false, null);
    YiQiaoAlertPanel.show();
    YiQiaoAlertPanel.setStyle("zIndex",99);
}

/************************  YQAlert End  ********************************/

/************************  YQConfirm Start ********************************/


function YQConfirm(content, confirmText, cancelText, confirmOnclickHandler, cancelOnclickHandler)
{
    if(confirmText == null || confirmText == 'undefined')
    {
        confirmText = "确 定";
    }
    if(cancelText == null || cancelText == 'undefined')
    {
        cancelText = "取 消";
    }
    if(confirmOnclickHandler == null)
    {
        confirmOnclickHandler = "YiQiaoConfirmPanel.close();return true;";
    }
    else
    {
        confirmOnclickHandler += ";YiQiaoConfirmPanel.close();return true;";
    }
    if(cancelOnclickHandler == null)
    {
        cancelOnclickHandler = "YiQiaoConfirmPanel.close();return false;";
    }
    else
    {
        cancelOnclickHandler += ";YiQiaoConfirmPanel.close();return false;";
    }
    var noteDiv
    var html = '';
    html += '<div class="close"><a href="javascript:void(0)" onclick="YiQiaoConfirmPanel.close()" class="f3">[关闭]</a></div>';
    html += '<div class="content2">';
    html += '<div class="alert" style="height:50px;background:url(/Themes/Theme3/images/tsarr2.gif) left 30px no-repeat">';
    html += content;
    html += '</div>';
    html += '<div align="right"><input name="Submit" class="input2" type="button" onclick="'+confirmOnclickHandler+'" id="Submit" value="'+confirmText+'" />    <input name="Submit" type="button" class="input2" value="'+cancelText+'" onclick="'+cancelOnclickHandler+'" id="Submit" /></div>';
    html += '</div>';
    html += '<div class="clear"></div>';
    var divMainLeft = Math.floor((document.body.offsetWidth - 451) / 2);
    var divMainTop = 200;
    
    noteDiv = InitialPopupMenu(false);
    noteDiv.id = 'YiQiaoNoteDiv';
    noteDiv.className = 'Direct_Successbox';
    noteDiv.style.display = 'none';
    noteDiv.innerHTML = html;
    
    YiQiaoConfirmPanel = CreatePanel(noteDiv, true, false, null, null, 451, 120, false, false, false, null);
    YiQiaoConfirmPanel.show();
    YiQiaoConfirmPanel.setStyle("zIndex",99);
}

/************************  YQConfirm End  ********************************/

/************************  YQPopConfirm Start ***************************/

function YQPopConfirm(control, content, confirmText, cancelText, confirmOnclickHandler, cancelOnclickHandler, type)
{
    if(confirmText == null || confirmText == 'undefined')
    {
        confirmText = "确 定";
    }
    if(cancelText == null || cancelText == 'undefined')
    {
        cancelText = "取 消";
    }
    if(type == null || type == 'undefined')
    {
        type = "down";
    }
    if(confirmOnclickHandler == null || confirmOnclickHandler == 'undefined')
    {
        confirmOnclickHandler = "YiQiaoPopConfirmPanel.Hide();return true;";
    }
    else
    {
        confirmOnclickHandler += ";YiQiaoPopConfirmPanel.Hide();return true;";
    }
    if(cancelOnclickHandler == null || cancelOnclickHandler == 'undefined')
    {
        cancelOnclickHandler = "YiQiaoPopConfirmPanel.Hide();return false;";
    }
    else
    {
        cancelOnclickHandler += ";YiQiaoPopConfirmPanel.Hide();return false;";
    }
    
    var noteDiv;
    var html = '';
    var divMainLeft = 0;
    var divMainTop = 0;
    
    if(type == "down")
    {
        html += '<div class="top">';
        html += '<div class="arr"></div>';
        html += '</div>';
        html += '<div class="border">';
        html += '<div class="content">'+content+'</div>';
        html += '<div class="but"><input name="" onclick="'+confirmOnclickHandler+'" type="button"  value="'+confirmText+'" class="button1" /> <input name="" type="button"  value="'+cancelText+'" onclick="'+cancelOnclickHandler+'"  class="button1" /></div>';
        html += '</div>';
        html += '<div class="bottom"></div>';
    }
    else if(type == "up")
    {
        html += '<div class="top"></div>';
        html += '<div class="border">';
        html += '<div class="content">'+content+'</div>';
        html += '<div class="but"><input name="" onclick="'+confirmOnclickHandler+'" type="button"  value="'+confirmText+'" class="button1" /> <input name="" type="button"  value="'+cancelText+'" onclick="'+cancelOnclickHandler+'"  class="button1" /></div>';
        html += '</div>';
        html += '<div class="bottom"><div class="arr"></div></div>';
    }
    
    if(control == null || control == 'defined')
    {
        divMainLeft = Math.floor((document.body.offsetWidth - 221) / 2);
        divMainTop = 200;
    }
    else
    {
        if(type == "up")
        {
            divMainLeft = GetOffsetLeft(control) + control.offsetWidth;
            divMainTop = GetOffsetTop(control) - 80;
        }
        else if(type == "down")
        {
            divMainLeft = GetOffsetLeft(control) - 221;
            divMainTop = GetOffsetTop(control) + control.offsetHeight;
        }
    }
    if(!window.YiQiaoPopConfirmPanel)
    {
        noteDiv = InitialPopupMenu(false);
        noteDiv.id = 'YiQiaoConfirmDiv';
        if(type == "up")
        {
            noteDiv.className = 'popoboxBlueAPI';
        }
        else if(type == "down")
        {
            noteDiv.className = 'popoboxOrangeAPI';
        }
        noteDiv.style.display = 'none';
        noteDiv.innerHTML = html;
        YiQiaoPopConfirmPanel = new PopupMenu(noteDiv, divMainLeft, divMainTop, 221, 0, false, false, null, false, true);
        YiQiaoPopConfirmPanel.Div.style.zIndex = 999;
        YiQiaoPopConfirmPanel.Show();
    }
    else
    {
        YiQiaoPopConfirmPanel.Hide();
        noteDiv = InitialPopupMenu(false);
        noteDiv.id = 'YiQiaoConfirmDiv';
        if(type == "up")
        {
            noteDiv.className = 'popoboxBlueAPI';
        }
        else if(type == "down")
        {
            noteDiv.className = 'popoboxOrangeAPI';
        }
        noteDiv.style.display = 'none';
        noteDiv.innerHTML = html;
        YiQiaoPopConfirmPanel = new PopupMenu(noteDiv, divMainLeft, divMainTop, 221, 0, false, false, null, false, true);
        YiQiaoPopConfirmPanel.Div.style.zIndex = 999;
        YiQiaoPopConfirmPanel.Show();
    }
}

/************************  YQPopConfirm End ***************************/


/*PageContainer Start*/
function PageContainer(content,pageSize)
{
    this.PageIndex = 0;
    this.Content = content;
    this.PageSize = pageSize;
}
PageContainer.prototype.GetPageIndex = function()
{
    return this.PageIndex;
}
PageContainer.prototype.GetCount = function()
{
    if (this.Content == null)
    {
        return 0;
    }
    return this.Content.length;
}
PageContainer.prototype.GetPageNum = function()
{
    return Math.ceil(this.GetCount() / this.PageSize);
}
PageContainer.prototype.IsLastPage = function()
{
    if (this.PageIndex == this.GetPageNum() - 1 || this.GetPageNum() == 0)
    {
        return true;
    }
    else
    {
        return false;
    }
}
PageContainer.prototype.IsFirstPage = function()
{
    if (this.PageIndex == 0)
    {
        return true;
    }
    else
    {
        return false;
    }
}
PageContainer.prototype.GetPage = function(index)
{
    if(index > this.GetPageNum() - 1 || index < 0)
    {
        return null;
    }
    this.PageIndex = index;
    if(index < this.GetPageNum() - 1)
    {
        var result = new Array(this.PageSize);
        for(var i = 0 ; i < this.PageSize ; i ++)
        {
            result[i] = this.Content[this.PageIndex * this.PageSize + i];            
        }
        return result;
    }
    else
    {
        var result = new Array(this.Content.length - this.PageSize * index);
        for(var i = 0 ; i < this.Content.length - this.PageSize * index ; i ++)
        {
            result[i] = this.Content[this.PageIndex * this.PageSize + i];            
        }
        return result;
    }
}
PageContainer.prototype.GetFirstPage = function()
{
    return this.GetPage(0);
}
PageContainer.prototype.GetLastPage = function()
{
    return this.GetPage(this.GetPageNum() - 1);
}
PageContainer.prototype.GetNextPage = function()
{
    return this.GetPage(this.PageIndex + 1);
}
PageContainer.prototype.GetPrePage = function()
{
    return this.GetPage(this.PageIndex - 1);
}
PageContainer.prototype.GetCurrentPage = function()
{
    return this.GetPage(this.PageIndex);
}
PageContainer.prototype.GetItem = function(itemIndex)
{
    if(itemIndex < 0 || itemIndex > this.Content.length - 1)
    {
        return null;
    }
    return this.Content[itemIndex];
}
PageContainer.prototype.DeleteItem = function(itemIndex)
{
    if(itemIndex < 0 || itemIndex > this.Content.length - 1)
    {
        return;
    }
    this.Content.splice(itemIndex,1);
}
PageContainer.prototype.DeleteItemInCurrentPage = function(indexInPage)
{
    this.DeleteItem(this.PageSize * this.PageIndex + indexInPage);
}
PageContainer.prototype.AddItemAt = function(atIndex,item)
{
    if(atIndex < 0 || atIndex > this.Content.length)
    {
        return;
    }
    this.Content.splice(atIndex,0,item);
}
PageContainer.prototype.AddItems = function(newContent)
{
    for(var i = 0; i < newContent.length; i ++)
    {
        this.AddItemAt(this.GetCount(),newContent[i]);       
    } 
}
/*PageContainer End*/
/*NPageContainer Start*/
function NPageContainer(getMethod,callback,pageSize)
{
    this.GetMethod = getMethod;
    this.PageSize = pageSize;
    this.Callback = callback;
    this.ItemCount = 0;
    this.PageCount = 0;
}
NPageContainer.prototype.GetFirstPage = function()
{
    this.PageIndex = 0;
    this.GetCurrentPage();
}
NPageContainer.prototype.GetPrePage = function()
{
    this.PageIndex = Math.max(0,this.PageIndex - 1);
    this.GetCurrentPage();
}
NPageContainer.prototype.GetNextPage = function()
{
    if(this.PageCount)
    {
        this.PageIndex = Math.min(this.PageCount - 1,this.PageIndex + 1);
        this.GetCurrentPage();
    }
}
NPageContainer.prototype.GetLastPage = function()
{
    if(this.PageCount)
    {
        this.PageIndex = this.PageCount - 1;
        this.GetCurrentPage();
    }
}
NPageContainer.prototype.GetCurrentPage = function()
{
    this.GetPage(this.PageIndex);
}
NPageContainer.prototype.GetPage = function(pageIndex)
{
    this.PageIndex = pageIndex;
    var callback = Function.createDelegate(this, this.GetPageSuccess);
    this.GetMethod(this.PageIndex,this.PageSize, callback);
}
NPageContainer.prototype.GetPageSuccess = function(result)
{
    if(result != null)
    {
        this.ItemCount = result.ItemCount;
        this.PageCount = Math.ceil(this.ItemCount / this.PageSize);
        if (result.Items == null || result.Items.length == 0)
        {
            if (this.PageIndex > this.PageCount - 1)
            {
                this.PageIndex = this.PageCount - 1; 
                this.GetCurrentPage();
            }  
            else
            {
                this.Callback(null);
            }
        }   
        else
        {
            this.Callback(result.Items);
        }
    }
}
NPageContainer.prototype.IsFirstPage = function()
{
    return (this.PageIndex == 0);
}
NPageContainer.prototype.IsLastPage = function()
{
    return (this.PageIndex == this.PageCount - 1);
}
/*PageContainer End*/
/*Popup Menu Start*/
var hasShown;
var _SelfClickClose;
var _OutClickClose;
var _CloseHandler;
var _PopupMenuContent;
/*
    弹出菜单（全局，只出现一个）
    content:需要显示的内容
    left:左顶点绝对位置
    top:上顶点绝对位置
    width:宽度
    height:高度
    selfClickClose:菜单内部点击是否关闭菜单
    outClickClose:菜单外部点击是否关闭菜单
    closeHandler:关闭是调用的外部函数句柄
*/
function TogglePopupMenu(content,left, top, width, height,selfClickClose,outClickClose,closeHandler)
{
    if(selfClickClose != null)
    {
        _SelfClickClose = selfClickClose;
    }
    else
    {
        _SelfClickClose = true;
    }
    if(outClickClose != null)
    {
        _OutClickClose = outClickClose;
    }
    else
    {
        _OutClickClose = true;
    }
    if(closeHandler != null)
    {
        _CloseHandler = closeHandler;
    }
    else
    {
        _CloseHandler = null;
    }
    var divPopupMenu = $("divPopupMenu");
    var divPopupMenuBg = $("divPopupMenuBg");
    var iframePopupMenu = $("iframePopupMenu");
    if(divPopupMenu == null)
    {
        divPopupMenu = document.createElement('div');
        divPopupMenu.id = 'divPopupMenu';
        divPopupMenu.style.position = 'absolute';
        divPopupMenu.className = 'divPopupMenu';
        divPopupMenuBg = document.createElement('div');
        divPopupMenuBg.id = 'divPopupMenuBg';
        divPopupMenuBg.style.position = 'absolute';
        iframePopupMenu = document.createElement('iframe');
        iframePopupMenu.id = 'iframePopupMenu';
        iframePopupMenu.frameBorder = '0';
        iframePopupMenu.allowTransparency = false;
        iframePopupMenu.src = "http://www.yi-qiao.cn/None.htm"
        divPopupMenuBg.appendChild(iframePopupMenu);        
        /*if(document.forms.length > 0)
        {
            var parent = document.forms[0];
        }
        else
        {
            var parent = document.body;
        }*/
        var parent = document.body;
        parent.insertBefore(divPopupMenuBg, parent.firstChild);
        parent.insertBefore(divPopupMenu, parent.firstChild);
    }    
    divPopupMenu.style.zIndex = 10;
    divPopupMenuBg.style.zIndex = 9;
    if(typeof content == 'object')
    {
        divPopupMenu.appendChild(content)
    }
    else
    {
        divPopupMenu.innerHTML = content;
    }
    if(width && width != 0)
    {
        divPopupMenu.style.width = width + "px";
    }
    /*if(height != 0)
    {
        divPopupMenu.style.height = height + "px";
    }*/
    if(left)
    {
        divPopupMenuBg.style.left = divPopupMenu.style.left = left + "px";
    }
    if(top)
    {
        divPopupMenuBg.style.top = divPopupMenu.style.top = top + "px";
    }
    hasShown = false;
    document.onclick = DocumentClick;
    if(_PopupMenuContent == content)//Normal Toggle
    {
        if(divPopupMenu.style.display == "block")
        {
            HideMenu();
        }
        else
        {
            divPopupMenuBg.style.display = divPopupMenu.style.display = "block";
            iframePopupMenu.style.width = divPopupMenuBg.style.width = divPopupMenu.offsetWidth + "px";
            iframePopupMenu.style.height = divPopupMenuBg.style.height = divPopupMenu.offsetHeight + "px";
            if(!document.all)
            {
                iframePopupMenu.style.display = 'none';
            }
            HideObjects_Popup();
        }
    }
    else//Open Another new Popup Menu
    {
        _PopupMenuContent = content;
        divPopupMenuBg.style.display = divPopupMenu.style.display = "block";
        iframePopupMenu.style.width = divPopupMenuBg.style.width = divPopupMenu.offsetWidth + "px";
        iframePopupMenu.style.height = divPopupMenuBg.style.height = divPopupMenu.offsetHeight + "px";
        if(height != 0)
        {
            SetMaxHeight(divPopupMenu,height);
            SetMaxHeight(divPopupMenuBg,height);
        }
        if(!document.all)
        {
            iframePopupMenu.style.display = 'none';
        }
        HideObjects_Popup();
    }
}
function DocumentClick(e)
{
    if(hasShown == false)
    {
        hasShown = true;
        return;
    }
    var divPopupMenu = $("divPopupMenu");
    if(divPopupMenu == null)
    {
        return;
    }
    var top = divPopupMenu.offsetTop;
    var left = divPopupMenu.offsetLeft;
    var width = divPopupMenu.offsetWidth;
    var height = divPopupMenu.offsetHeight;
    var x,y;
    if(document.all)
    {
        x = event.offsetX + GetOffsetLeft(event.srcElement);
        y = event.offsetY + GetOffsetTop(event.srcElement);
    }
    else
    {
        x = e.offsetX >= 0 ? e.offsetX:0;
        x += GetOffsetLeft(e.target);
        y = e.offsetY >= 0 ? e.offsetY:0;
        y += GetOffsetTop(e.target);
    }    
    if(_OutClickClose == true)
    {
        if(x < left || x > left + width || y < top || y > top + height)
        {
            HideMenu();
        }
    }
    if(_SelfClickClose == true)
    {
        if(x > left && x < left + width && y > top && y < top + height)
        {
            HideMenu();
        }
    }
}
function ChangeMenu(content)
{
    var divPopupMenu = $("divPopupMenu");
    var divPopupMenuBg = $("divPopupMenuBg");
    var iframePopupMenu = $("iframePopupMenu");
    if(divPopupMenu != null)
    {
        divPopupMenu.innerHTML = content;
        iframePopupMenu.style.width = divPopupMenuBg.style.width = divPopupMenu.offsetWidth + "px";
        iframePopupMenu.style.height = divPopupMenuBg.style.height = divPopupMenu.offsetHeight + "px";
    }
}
function HideMenu()
{   
    var divPopupMenu = $("divPopupMenu");
    var divPopupMenuBg = $("divPopupMenuBg");
    if(divPopupMenu == null || divPopupMenu.style.display == "none")
    {
        return;
    }
    divPopupMenuBg.style.display = divPopupMenu.style.display = "none";
    ShowObjects_Popup();
    if(_CloseHandler != null)
    {
        _CloseHandler();
    }    
    document.onclick = null;
}
function GetPopupMenuHeight()
{
    var divPopupMenu = $("divPopupMenu");
    if(divPopupMenu != null)
    {
        return divPopupMenu.offsetHeight;
    }
    else
    {
        return 0;
    }
}
function IsPopupMenuShown()
{
    var divPopupMenu = $("divPopupMenu");
    if(divPopupMenu != null && divPopupMenu.style.display == 'block')
    {
        return true;
    }
    return false;
}
function SetPopupMenuPosition(left,top)
{
    $("divPopupMenu").style.left = $("divPopupMenuBg").style.left = left + 'px';
    $("divPopupMenu").style.top = $("divPopupMenuBg").style.top = top + 'px';
}
function ResizePopupMenu(width,height)
{
    var divPopupMenu = $("divPopupMenu");
    var divPopupMenuBg = $("divPopupMenuBg");
    var iframePopupMenu = $("iframePopupMenu");
    if(width == 0)
    {
        iframePopupMenu.style.width = divPopupMenuBg.style.width = divPopupMenu.offsetWidth + "px";        
    }
    else
    {
        iframePopupMenu.style.width = divPopupMenuBg.style.width = divPopupMenu.style.width = width + "px";
    }
    if(height == 0)
    {
        iframePopupMenu.style.height = divPopupMenuBg.style.height = divPopupMenu.offsetHeight + "px";
    }
    else
    {
        iframePopupMenu.style.height = divPopupMenuBg.style.height = divPopupMenu.style.height = height + "px";
    }
}
function SetZIndex(zIndex)
{
    var divPopupMenu = $("divPopupMenu");
    var divPopupMenuBg = $("divPopupMenuBg");
    if(divPopupMenu != null)
    {
        divPopupMenu.style.zIndex = zIndex;
    }
    if(divPopupMenuBg != null)
    {
        divPopupMenuBg.style.zIndex = zIndex - 1;
    }
}
function SetBgColor(control)
{
    control.className = 'divPopupOn';
}
function RemoveBgColor(control)
{
    control.className = 'divPopupOff';
}
var hiddenObjects_Popup = new Array();
function HideObjects_Popup()
{
    var divPopupMenu = $('divPopupMenu');
    var objects = document.getElementsByTagName('object');
    for(var i = 0; i < objects.length; i++)
    {
        if(IsOverLap(objects[i],divPopupMenu) && objects[i].style.visibility != 'hidden')
        {
            objects[i].style.visibility = 'hidden';
            hiddenObjects_Popup.push(objects[i]);
        }
    }
    var embeds = document.getElementsByTagName('embed');
    for(var i = 0; i < embeds.length; i++)
    {
        if(IsOverLap(embeds[i],divPopupMenu) && embeds[i].style.visibility != 'hidden')
        {
            embeds[i].style.visibility = 'hidden';
            hiddenObjects_Popup.push(embeds[i]);
        }
    }
}
function ShowObjects_Popup()
{
    var divPopupMenu = $('divPopupMenu');
    for(var i = hiddenObjects_Popup.length - 1; i >= 0 ; i--)
    {
        var object = hiddenObjects_Popup.pop();
        object.style.visibility = 'visible';
    }
}
function InitialPopupMenu(hasBackgroud)
{
    var divBackground;
    var parent = window.document.body;
    if(!$("divCommonBoxBackground"))
    {
        divBackground = window.document.createElement('div');
        divBackground.id = 'divCommonBoxBackground';
        divBackground.style.position = 'absolute';
        divBackground.style.left = '0px';
        divBackground.style.top = '0px';
        divBackground.style.background = '#000000';
        divBackground.style.width = Math.max(window.top.document.documentElement.scrollWidth,window.top.document.documentElement.clientWidth) + 'px';
        divBackground.style.height = Math.max(window.top.document.documentElement.scrollHeight,window.top.document.documentElement.clientHeight) + 'px';
        divBackground.style.display = "none";
   
        if(document.all)
        {
            divBackground.style.filter = 'Alpha(Opacity=70)';
        }
        else
        {
            divBackground.style.MozOpacity = 0.7;
        }
        
        //parent.insertBefore(divBackground, parent.firstChild);  
    }
    else
    {
        divBackground = $("divCommonBoxBackground");
        if(hasBackgroud)
        {
            divBackground.style.display = 'block';
        }
        else
        {
            //divBackground.style.display = 'hidden';
        }
    }
    
    var contentDiv = window.document.createElement('div');
    contentDiv.style.position = "absolute";
    parent.insertBefore(contentDiv, parent.firstChild);
    
    
    return contentDiv;
}
/*Popup Menu End*/
/*OO PopupMenu Start*/
/*
    弹出菜单（面向对象）
    divElement:需要显示的div
    left:左顶点绝对位置
    top:上顶点绝对位置
    width:宽度
    height:高度
    selfClickClose:菜单内部点击是否关闭菜单
    outClickClose:菜单外部点击是否关闭菜单
    isMenu:是否是浮动菜单，类似短消息二级浮动菜单
    hideSelect:是否在弹出时关闭所有与其有交叉的下拉框（修正 ie6 bug）
*/
function PopupMenu(divElement, left, top, width, height, selfClickClose, outClickClose, closeHandler, isMenu, hideSelect)
{
    this.Div = divElement;
    this.Left = left;
    this.Top = top;
    this.Width = width;
    this.Height = height;
    this.SelfClickClose = selfClickClose;
    this.OutClickClose = outClickClose;
    this.CloseHandler = closeHandler;
    this.IsMenu = isMenu;
    this.HideSelect = hideSelect;
    this.HasShown = false;
    this.Visible = false;
    this.Div.style.zIndex = 10;
    this.HideObjects = new Array();
}
PopupMenu.prototype.DocClick = function(e)
{
//    if(this.HasShown == false)
//    {
//        this.HasShown = true;
//        return;
//    }
    if(document.all)
    {
        var x = event.offsetX + GetOffsetLeft(event.srcElement);
        var y = event.offsetY + GetOffsetTop(event.srcElement);
    }
    else
    {
        var x = e.offsetX >= 0 ? e.offsetX:0;
        x += GetOffsetLeft(e.target);
        var y = e.offsetY >= 0 ? e.offsetY:0;
        y += GetOffsetTop(e.target);
    }
    var left = GetOffsetLeft(this.Div);
    var top = GetOffsetTop(this.Div);
    var width = this.Div.offsetWidth;
    var height = this.Div.offsetHeight;
    if(this.OutClickClose == true)
    {        
        if(x < left || x > left + width || y < top || y > top + height)
        {
            this.Hide();
        }
    }
    if(this.SelfClickClose == true)
    {
        if(x > left && x < left + width && y > top && y < top + height)
        {
            this.Hide();
        }
    }
}
PopupMenu.prototype.Show = function(left,top)
{
    if(left != null)
    {
        this.Left = left;
    }
    if(top != null)
    {
        this.Top = top;
    }
    
    this.Visible = true;
    if(this.HideTimer)
    {
        clearTimeout(this.HideTimer);
    }
    if(this.Div.style.display == 'block')
    {
        this.Div.style.left = this.Left + "px";
        this.Div.style.top = this.Top + "px"; 
        return;
    }    
    this.Div.style.display = "block";  
    if(this.Width && this.Width != 0)
    {
        this.Div.style.width = this.Width  + "px";
    }
    if(this.Height && this.Height != 0)
    {
        this.Div.style.height = this.Height + "px";
    }
    this.Div.offsetWidth  + "px";
    this.Div.offsetHeight + "px";
    this.Div.style.left = this.Left + "px";
    this.Div.style.top = this.Top + "px";    
    this.Div.style.position = "absolute";    
   
    document.body.insertBefore(this.Div,document.body.firstChild);
    
    if(this.IsMenu)
    {
        this.Div.onmouseover = Function.createDelegate(this,this.Show);
        this.Div.onmouseout = Function.createDelegate(this,this.DelayHide);
    }
    this.HasShown = false;
    this.preDocClick = document.onclick;
    document.onclick = Function.createDelegate(this, this.DocClick);
    var objects = document.getElementsByTagName('object');
    for(var i = 0; i < objects.length; i++)
    {
        if(IsOverLap(objects[i],this.Div) && objects[i].style.visibility != 'hidden')
        {
            objects[i].style.visibility = 'hidden';
            this.HideObjects.push(objects[i]);
        }
    }
    var embeds = document.getElementsByTagName('embed');
    for(var i = 0; i < embeds.length; i++)
    {
        if(IsOverLap(embeds[i],this.Div) && embeds[i].style.visibility != 'hidden')
        {
            embeds[i].style.visibility = 'hidden';
            this.HideObjects.push(embeds[i]);
        }
    }
    if(this.HideSelect)
    {
        var selects = document.getElementsByTagName('select');
        for(var i = 0; i < selects.length; i++)
        {
            if(selects[i].style.visibility == 'hidden')
            {  
                continue;
            }
            selects[i].style.visibility = 'hidden';
            this.HideObjects.push(selects[i]);
        }
    }
}
PopupMenu.prototype.DelayHide = function()
{
    this.HideTimer = setTimeout(Function.createDelegate(this,this.Hide),500);
}
PopupMenu.prototype.Hide = function()
{
    this.Visible = false;
    if(this.Div.style.display == "none")
    {
        return;
    }
    this.Div.style.display = "none";
    if(this.CloseHandler != null)
    {
        this.CloseHandler();
    }
    document.body.removeChild(this.Div);
    document.onclick = this.preDocClick; 
    
//    if(this.HideSelect)
//    {
        var length = this.HideObjects.length;
        for(var i = 0; i < length; i++)
        {
            var select = this.HideObjects.pop();
            select.style.visibility = '';
        }
//    }
}
PopupMenu.prototype.Toggle = function()
{
    if(this.Visible)
    {
        this.Hide();
    }
    else
    {
        this.Show();
    }
}
PopupMenu.prototype.GetPopupMenuHeight = function()
{
    return this.Div.offsetHeight;
}
PopupMenu.prototype.ChangeMenu = function(content)
{
    this.Div.innerHTML = content;
}
PopupMenu.prototype.SetZIndex = function(zIndex)
{
    this.Div.style.zIndex = zIndex;
}
/*OO PopupMenu End*/
/*
    弹出框（半透明黑底色）
    content:显示内容
    title:框左上角标题
    left:左顶点绝对位置
    top:上顶点绝对位置
    width:宽度
    height:高度
    middle:是否居中，若是则top和left将被忽略
    closeHandler:关闭是调用的外部函数句柄
*/
function CommonBox(content, title, left, top, width, height, middle, closeHandler)
{
    var div = window.top.document.createElement('div');
    var divTitle = window.top.document.createElement('div');
    div.appendChild(divTitle);
    var spanTitle = window.top.document.createElement('span');
    spanTitle.innerHTML = title;
    spanTitle.style.lineHeight = 'normal';
    SetFloatLeft(spanTitle);
    divTitle.appendChild(spanTitle);    
    var imgClose = window.top.document.createElement('img');
    imgClose.id = 'imgClose';
    imgClose.style.position = 'absolute';
    imgClose.style.width = '9px';
    imgClose.style.height = '9px';
    imgClose.style.cursor = 'pointer';
    imgClose.style.right = '10px';
    imgClose.src = 'http://www.yi-qiao.cn/images/close_common.gif';
    imgClose.onclick = Function.createDelegate(this,this.Hide);
    imgClose.alt = '关闭';
    divTitle.appendChild(imgClose);
    this.divContent = window.top.document.createElement('div');
    div.appendChild(this.divContent);
    if(height)
    {
        this.divContent.style.height = height + 'px';
    }    
    if(width)
    {
        this.divContent.style.width = width + 'px';
    }
    this.divContent.style.clear = 'both';
    if (typeof content == 'object')
    {
        this.divContent.appendChild(content);
    }
    else
    {
        this.divContent.innerHTML = content;
    }    
    
    this.divCommonBox = window.top.document.createElement('div');
    this.divCommonBox.style.position = 'absolute';
    this.divCommonBox.style.background = '#EEEEEE';
    this.divCommonBox.style.padding = '10px';
    this.divCommonBox.style.fontSize = '12px';
    this.divCommonBox.appendChild(div);
    this.defaultZIndex = 150;
    this.divCommonBox.style.zIndex = this.defaultZIndex;
    if(left)
    {
        this.divCommonBox.style.left = left + 'px';
    }
    if(top)
    {
        this.divCommonBox.style.top = top + 'px';
    }
    this.divCommonBox.style.display = 'none';    
    this.divBackground = window.top.document.createElement('div');
    this.divBackground.id = 'divCommonBoxBackground';
	this.divBackground.style.position = 'absolute';
	this.divBackground.style.left = '0px';
	this.divBackground.style.top = '0px';
	this.divBackground.style.background = '#000000';
    this.divBackground.style.zIndex = this.defaultZIndex - 1;
    this.divBackground.style.display = 'none';
    if(document.all)
    {
        this.divBackground.style.filter = 'Alpha(Opacity=70)';
    }
    else
    {
        this.divBackground.style.MozOpacity = 0.7;
    }
    var parent = window.top.document.body;
    parent.insertBefore(this.divBackground, parent.firstChild);  
    parent.insertBefore(this.divCommonBox, parent.firstChild);
    this.middle = middle;
    this.CloseHandler = closeHandler;
    this.HiddenObjects = new Array();
}
CommonBox.prototype.Show = function(left,top)
{
    if(left != null)
    {
        this.divCommonBox.style.left = left + 'px';
    }
    if(top != null)
    {
        this.divCommonBox.style.top = top + 'px';
    }
    this.divCommonBox.style.display = "block";
    this.divBackground.style.left = '0px';
    this.divBackground.style.top = '0px';
    this.divBackground.style.width = Math.max(window.top.document.documentElement.scrollWidth,window.top.document.documentElement.clientWidth) + 'px';
    this.divBackground.style.height = Math.max(window.top.document.documentElement.scrollHeight,window.top.document.documentElement.clientHeight) + 'px';
    this.divBackground.style.display = "block";
    if(this.middle == true)
    {
        ShowMiddle(this.divCommonBox);
    }
    var objects = document.getElementsByTagName('object');
    for(var i = 0; i < objects.length; i++)
    {
        if(IsOverLap(objects[i],this.divCommonBox) && objects[i].style.visibility != 'hidden')
        {
            objects[i].style.visibility = 'hidden';
            this.HiddenObjects.push(objects[i]);
        }
    }
    var embeds = document.getElementsByTagName('embed');
    for(var i = 0; i < embeds.length; i++)
    {
        if(IsOverLap(embeds[i],this.divCommonBox) && embeds[i].style.visibility != 'hidden')
        {
            embeds[i].style.visibility = 'hidden';
            this.HiddenObjects.push(embeds[i]);
        }
    }
    var selects = document.getElementsByTagName('select');
    for(var i = 0; i < selects.length; i++)
    {
        if(selects[i].style.visibility == 'hidden')
        {  
            continue;
        }
        selects[i].style.visibility = 'hidden';
        this.HiddenObjects.push(selects[i]);
    }
}
CommonBox.prototype.Hide = function()
{
    this.divCommonBox.style.display = "none";
    this.divBackground.style.display = "none";
    for(var i = this.HiddenObjects.length - 1; i >= 0 ; i--)
    {
        var object = this.HiddenObjects.pop();
        object.style.visibility = 'visible';
    }
    if(this.CloseHandler != null)
    {
        this.CloseHandler();
    }
}
CommonBox.prototype.SetContent = function(content)
{
    this.divContent.innerHTML = content;    
}
CommonBox.prototype.Toggle = function(left,top)
{
    if(this.divCommonBox.style.display == "block")
    {
        this.Hide();
    }
    else
    {
        this.Show(left,top);
    }
}
CommonBox.prototype.SetZIndex = function(zIndex)
{
    this.divCommonBox.style.zIndex = zIndex;
    this.divBackground.style.zIndex = zIndex - 1;
}
function ShowProcess(message)
{
    var topWindow = window.top;
    var topDocument = topWindow.document;
    var divProcess = topDocument.getElementById('divProcess');
    if(divProcess != null)
    {
        divProcess.style.display = 'block';
        divProcess.innerHTML = message;
    }
    else
    {
        divProcess = topDocument.createElement('div');
        divProcess.id = 'divProcess';
        divProcess.style.position = 'absolute';
        divProcess.style.padding = '3px';
        divProcess.style.color = '#FFFFFF';
        divProcess.style.fontSize = '12px';
        divProcess.style.fontWeight = 'bold';
        divProcess.style.backgroundColor = '#CC0000';
        divProcess.style.zIndex = 100;
        divProcess.innerHTML = message;
        topDocument.body.insertBefore(divProcess, topDocument.body.firstChild);
        if(topWindow.addEventListener)
        {
            window.addEventListener('scroll', MoveProcess, false);
            window.addEventListener('resize', MoveProcess, false);
        }
        else if(window.attachEvent)
        {
            window.attachEvent('onscroll', MoveProcess);
	        window.attachEvent('onresize', MoveProcess);
        }
    }
    MoveProcess();
}
function HideProcess()
{
    var divProcess = window.top.$('divProcess');
    if(divProcess != null)
    {
        divProcess.style.display = 'none';
    }
}
function MoveProcess()
{
    var scrollYT, scrollXT;
    var topWindow = window.top;
    var topDocument = topWindow.document;
    var divProcess = topDocument.getElementById('divProcess');
    if(divProcess == null)
    {
        return;
    }
    if(document.all)
    {
        scrollYT = topDocument.documentElement.scrollTop; 
		scrollXT = topDocument.body.scrollLeft;
    }
    else
    { 
		scrollYT = topWindow.pageYOffset; 
		scrollXT = topWindow.pageXOffset; 
	}
	divProcess.style.top = scrollYT + 1 + "px";
	divProcess.style.right = -scrollXT + "px";
	divProcess.style.top = scrollYT + "px";
	
}
function ShowResultBox(message, success)
{
    HideProcess();
    var title = '提示';
    var html = ''+
    '<div id="divResult" style="margin:20px auto 20px auto;text-align:center;">'+
        message + '<br /><br /><input id="btnResultClose" type="button" onclick="HideResultBox()" value="确定" class="btnCommon2"/>'+
    '</div>';
    if(window.top.boxResult)
    {
        window.top.boxResult.SetContent(html);        
    }
    else
    {
        window.top.boxResult = new window.top.CommonBox(html,title,0,0,200,100,true,null);
    }
    window.top.boxResult.SetZIndex(window.top.boxResult.defaultZIndex + 2);
    window.top.boxResult.Show();
    window.top.$('btnResultClose').focus();
    if(success)
    {        
        setTimeout("HideResultBox()",1000);
    }    
}
function HideResultBox()
{
    if(window.top.boxResult)
    {
        window.top.boxResult.Hide();
    }
}
/*Login Related*/
function GetPassword()
{
    var html = '<div style="text-align:center;">您可以通过用户名或注册邮箱获取密码：<br /><br />';
    html += '用 户 名：<input type="text" id="txtUsername_GetPassword" onblur="CheckUsername_GetPassword(this.value)" /><br /><br />';
    html += '注册邮箱：<input type="text" id="txtEmail_GetPassword" onblur="CheckEmail_GetPassword(this.value)" /><br /><br />';
    html += '<input type="button" onclick="DoGetPassword();" value="获取密码" />';
    html += '</div>';
    if(!window.boxGetPassword)
    {
        boxGetPassword = new CommonBox(html, '获取密码', 0, 0, 250, 125, true, null);
    }
    boxGetPassword.SetContent(html);
    boxGetPassword.Show();
}
var usernameValidated = true;
function CheckUsername_GetPassword(uName)
{
    usernameValidated = true;
    Qibu.Web.WebService.Register.ValidateUserName(uName, function(result){
        if(result)
        {
            usernameValidated = false;
        }
    });
}
var emailValidated = true;
function CheckEmail_GetPassword(mail)
{
    emailValidated = true;
    if(!emailCheck(mail))
    {
        emailValidated = false;
    }
}
function DoGetPassword()
{
    var username = $('txtUsername_GetPassword').value;
    var email = $('txtEmail_GetPassword').value;
    if(username == '')
    {
        alert('用户名为必填！');
        return;
    }
    if(!usernameValidated)
    {
        alert('此用户名不存在！');
        return;
    }
    if(email == '')
    {
        alert('邮件地址为必填！');
        return;
    }
    if(!emailValidated)
    {
        alert('邮件地址格式不正确！');
        return; 
    }
    
    ShowProcess('正在提交请求，请稍候...');
    Qibu.Web.WebService.User.GetPassword(username, email, GetPasswordSuccess);
    if(window.boxGetPassword)
    {
        boxGetPassword.Hide();
    }
}
function GetPasswordSuccess(result)
{
    HideProcess();
    switch(result)
    {
        case 0:
            ShowResultBox('我们会将您的密码发送至您的注册邮箱。系统可能存在一定的延时，请耐心等待',false);
            break;
        case 1:
            ShowResultBox('您的注册邮箱尚未通过验证，无法获取密码',false);
            break;
        case 2:
            ShowResultBox('您的用户名不存在，请确认后重试',false);
            break;
        case 3:
            ShowResultBox('您输入的身份证号不正确，请确认后重试',false);
            break;
        default:
            ShowResultBox('有错误发生，请重试',false);
            break;
    }    
}

function ResendValidateMail()
{
    var html = '<div style="text-align:center;">您可以通过用户名及注册邮箱申请重发激活：<br /><br />';
    html += '用 户 名：<input type="text" id="txtUsername_Resend" /><br /><br />';
    html += '注册邮箱：<input type="text" id="txtEmail_Resend" /><br /><br />';
    html += '<input type="button" onclick="DoResendValidateMail();" value="重发激活" />';
    html += '</div>';
    if(!window.boxResendValidateMail)
    {
        boxResendValidateMail = new CommonBox(html, '重发激活', 0, 0, 250, 125, true, null);
    }
    boxResendValidateMail.SetContent(html);
    boxResendValidateMail.Show();
}
function DoResendValidateMail()
{
    var username = $('txtUsername_Resend').value;
    var email = $('txtEmail_Resend').value;
    if(username == '' || email == '')
    {
        alert('请填写完整！');
        return;
    }
    
    ShowProcess('正在提交请求，请稍候...');
    Qibu.Web.WebService.User.ResendValidateEmail(username, email, ResendValidateEmailSuccess);
    if(window.boxResendValidateMail)
    {
        boxResendValidateMail.Hide();
    }
}
function ResendValidateEmailSuccess(result)
{
    HideProcess();
    switch(result)
    {
        case 0:
            ShowResultBox('激活邮件已发送至您的注册邮箱，请注意查收',false);
            break;
        case 1:
            ShowResultBox('您的注册邮箱和用户名无法匹配，请重新输入',false);
            boxResendValidateMail.Show();
            break;
        case 2:
            ShowResultBox('您的用户名不存在，请确认后重试',false);
            break;
        default:
            ShowResultBox('有错误发生，请重试',false);
            break;
    }    
}

var _username = null;

function LoginImmediate(username, password)
{
    Qibu.Web.WebService.User.Login(username, password, GetResultFromLogin_NotRedirect);
    SetCookie(username);
}
function Login(username,password)
{
    if(username == "")
    {
        YQAlert("请填写用户名", null, null, false);
        return;
    }        
    if(password == "")
    {
        YQAlert("请填写密码", null, null, false);
        return;
    }    
    _username = username;
    PLogin(username, password);
    
}
function GetResultFromLogin(result)
{
    HideProcess();
    if(result == 0)
    {
//        SetCookie(_username);
//        var url = window.location.href;
//        if(url.indexOf('ReturnUrl=') > -1)
//        {
//            url = unescape(url.substr(url.indexOf('ReturnUrl=') + 10));            
//        }
//        //Redirect(url);
//        //window.open("http://www.yi-qiao.cn/Index4.aspx");
//        Redirect('http://space.' + _username + '.yi-qiao.cn/owner');
        alert("登陆成功！");
    }
    if(result == -1)
    {
        alert("该用户名不存在");
    }
    if(result == -2)
    {
        alert("密码错误");
    }
    if(result == -3)
    {
        alert("有错误发生");
    }
    if(result == -4)
    {
        alert("您的邮箱尚未确认，请速前往确认！");
    }
}
function PLogin(username, password)
{
    _username = username;
    Qibu.Web.WebService.User.Login(username, password,GetResultFromLogin);
    //window.open('http://www.pulmonary-rehabilitation.com.cn/Login.aspx?username='+username+'&password='+password, "win", "fullscreen");
    
    ShowProcess('正在登陆，请稍候...');
}

// 登录后不转向，刷新本页
function Login_NotRedirect(username,password)
{
    if(username == "")
    {
        alert("请填写用户名", null, null, false);
        return;
    }        
    if(password == "")
    {
        alert("请填写密码", null, null, false);
        return;
    }
    
    _username = username;
    window.setTimeout('Qibu.Web.WebService.User.Login("'+username+'", "'+password+'",GetResultFromLogin_NotRedirect);', 3000);
    SetCookie(username);
    ShowProcess('正在登陆，请稍候...');
}  
function GetResultFromLogin_NotRedirect(result)
{
    HideProcess();
    if(result == 0)
    {
        SetCookie(_username);
        Reload();
    }
    if(result == -1)
    {
        YQAlert("该用户名不存在", null, null, false);
    }
    if(result == -2)
    {
        YQAlert("密码错误", null, null, false);
    }
    if(result == -3)
    {
        YQAlert("有错误发生", null, null, false);
    }
    if(result == -4)
    {
        ShowBlockedPanel();
        Qibu.Web.WebService.User.Logout(function(){});
    }
}

// 登录后跳转到制定URL,刷新本页
function Login_AndRedirect(username,password,url)
{
    if(username == "", null, null, false)
    {
        alert("请填写用户名");
        return;
    }        
    if(password == "", null, null, false)
    {
        alert("请填写密码");
        return;
    }    
    _username = username;
    Qibu.Web.WebService.User.Login_Redirect(username, password, url, GetResultFromLogin_AndRedirect);
    
    ShowProcess('正在登陆，请稍候...');
}  
function GetResultFromLogin_AndRedirect(result)
{
    HideProcess();
    if(result[0] == 0)
    {
        SetCookie(_username);
        window.location.href = result[1];
    }
    if(result[0] == -1)
    {
        alert("该用户名不存在");
    }
    if(result[0] == -2)
    {
        alert("密码错误");
    }
    if(result[0] == -3)
    {
        alert("有错误发生");
    }
    if(result[0] == -4)
    {
        alert("您的邮箱尚未确认，请速前往确认！");
    }
}

function LogoutImmediate()
{
    Qibu.Web.WebService.User.Logout(LogoutSuccess);
}
function Logout()
{
    PLogout();
}
function LogoutSuccess(result)
{
    if(result == true)
    {
        //Reload();
        //window.location.redirect
        window.location.href = window.location.href;
    }
    else
    {
        YQAlert("注销失败，请重试", null, null, false);
    }
}
function PLogout()
{
    //window.setTimeout('Qibu.Web.WebService.User.Logout(LogoutSuccess);', 4000);
    //window.open('http://www.pulmonary-rehabilitation.com.cn/Login.aspx?username='+username+'&password='+password, "win", "fullscreen");
    Qibu.Web.WebService.User.Logout(LogoutSuccess);
    ShowProcess('正在注销，请稍候...');
}

function ShowMiddle(div)
{
    var scrollYT, scrollXT;
    var topWindow = window.top;
    var topDocument = topWindow.document;
    if(div == null)
    {
        return;
    }
    if(document.all)
    {
        scrollYT = topDocument.documentElement.scrollTop; 
		scrollXT = topDocument.documentElement.scrollLeft;
    }
    else
    { 
		scrollYT = topWindow.pageYOffset; 
		scrollXT = topWindow.pageXOffset; 
	}
	var top = Math.floor((topDocument.documentElement.clientHeight - div.offsetHeight) / 2) + scrollYT;
	if(top < 0)
	{
	    top = 0;
	}
	var left = Math.floor((topDocument.documentElement.clientWidth - div.offsetWidth) / 2) + scrollXT;
	if(left < 0)
	{
	    left = 0;
	}
    div.style.top = top + 'px';
    div.style.left = left + 'px';
}

function UIGenerator_CreateLinklistTable(targetDocument, linkList)
{
    var table = targetDocument.createElement('TABLE');
    table.width = "100%";
    table.border = 0;
    table.align = "center";
    table.cellPadding = 0;
    table.cellSpacing = 0;
    table.style = "word-break:break-all;width:100%";
    for (var i = 0; i < linkList.length; i++)
    {
        row = table.insertRow(-1);
        cell = row.insertCell(-1);
        var div = document.createElement('div');
        div.style.width = "100%";
        div.style.overflow = "hidden";
        div.style.lineHeight = "auto";
        div.className = "divBottomLine1";
        div.appendChild(linkList[i]);
        cell.appendChild(div);
    }
    return table;
}
function UIGenerator_CreateList_HTML(linkList)
{
    
    var html = '<table width=100% border=0 align="center" cellPadding=0 cellSpacing=0 style="word-break: break-all;overflow:hidden;width:100%">';    
    for (var i = 0; i < linkList.length; i++)
    {
        html += '<tr><td><div class="divBottomLine1" style="width:100%;overflow:hidden">' + linkList[i] + '</div></td></tr>';
    }
    html += '</table>';
    return html
}
function RemoveElementEvents(element)
{
    if (element != null)
    { 
        if (typeof(element.onclick) != 'undefined' && element.onclick != ViewImage)
        {   
            element.onclick = null;
        }        
        if (typeof(element.onload) != 'undefined')
        {   
            element.onload = null;
        }
        if (typeof(element.onmouseout) != 'undefined')
        {   
            element.onmouseout = null;
        }
        if (typeof(element.onmouseover) != 'undefined')
        {   
            element.onmouseover = null;
        }
        if (typeof(element.onmouseup) != 'undefined')
        {   
            element.onmouseup = null;
        }
        if (typeof(element.onblur) != 'undefined')
        {   
            element.onblur = null;
        }
        if (typeof(element.onactivate) != 'undefined')
        {   
            element.onload = null;
        }
        if (typeof(element.onactivate) != 'undefined')
        {   
            element.onload = null;
        }
        if (typeof(element.onmousedown) != 'undefined')
        {   
            element.onmousedown = null;
        }if (typeof(element.onmousemove) != 'undefined')
        {   
            element.onmousemove = null;
        }
        if (typeof(element.onmouseup) != 'undefined')
        {   
            element.onmouseup = null;
        }
        if (typeof(element.onkeypress) != 'undefined')
        {   
            element.onkeypress = null;
        }
        // to do
        
        var oChilds = element.childNodes;
        for (var i = oChilds.length - 1; i >= 0; i--)
        {
            if(oChilds[i].tagName && (oChilds[i].tagName.toLowerCase() == 'script' || oChilds[i].tagName.toLowerCase() == 'link'))
            {
                element.removeChild(oChilds[i]);
            }
            else
            {
                RemoveElementEvents(oChilds[i]);           
            }
        }
    }    
}
function IsSafeElement(e)
{
    if(e.onabort || e.onactive|| e.onafterprint || e.onafterupdate || e.onbeforeactive || e.onbeforecopy || e.onbeforecut || e.onbeforedeactive || e.onbeforeeditfocus || e.onbeforepaste || e.onbeforeprint ||
     e.onbeforeupload || e.onbeforeupdate || e.onblur || e.onbounce || e.oncellchange || e.onchange || e.onclick || e.oncontextmenu || e.oncontrolselect || e.oncopy || e.oncut || e.ondataavailable || e.ondatasetchanged ||
     e.ondatasetcomplete || e.ondblclick || e.ondeactive || e.ondrag || e.ondragend || e.ondragenter || e.ondragleave || e.ondragover || e.ondragstart || e.ondrop || e.onerror || e.onerrorupdate || e.onfilterchange ||
     e.onfinish || e.onfocus || e.onfocusin || e.onfocusout || e.onhelp || e.keydown || e.onkeypress || e.onkeyup || e.onlayoutcomplete || e.onload || e.onlosecapture || e.onmousedown || e.onmouseenter || e.onmouseleave ||
     e.onmousemove || e.onmouseout || e.onmouseover || e.onmouseup || e.onmousewheel || e.onmove || e.onmoveend || e.onmovestart || e.onpaste || e.onpropertychange || e.onreadystatechange || e.onreset || e.onresize ||
     e.onresizeend || e.onresizestart || e.onrowenter || e.onrowdelete || e.onrowinserted || e.onscroll || e.onselect || e.onselectionchange || e.onselectstart || e.onstart || e.onstop || e.onsubmit || e.onunload)
    {
        alert('由于安全原因，不允许定义事件');
        return false;
    }
    if(e.tagName && e.tagName.toLowerCase() == 'script')
    {
        alert('由于安全原因，不允许运行脚本');
        return false;
    }
    if(e.tagName && e.tagName.toLowerCase() == 'link')
    {
        alert('由于安全原因，不允许使用<Link>标签');
        return false;
    }
    if(e.tagName && e.tagName.toLowerCase() == 'style')
    {
        if(e.innerHTML.toLowerCase().indexOf('javascript:') != -1)
        {
            alert('请勿在<style>标签中使用脚本进行黑客行为');
            return false;
        }
    }
    if(e.attributes)
    {
        for(var i = 0; i < e.attributes.length; i++)
        {
            if(e.attributes[i].value.toLowerCase().indexOf('javascript:') != -1)
            {
                alert('由于安全原因，不允许运行脚本');
                return false;
            }
        }
    }
    for(var i = 0; i < e.childNodes.length; i++)
    {
        if(!IsSafeElement(e.childNodes[i]))
        {
            return false;
        }
    }
    return true;   
}
function ReplaceEnter(strContent)
{
    var returnData = strContent;
    while(returnData.indexOf('\n') != -1)
    {
        returnData = returnData.replace('\n', '<br />');
    }
    return returnData;
}
function ReplaceBR(strContent)
{
    var returnData = strContent;
    while(returnData.indexOf('<br />') != -1)
    {
        returnData = returnData.replace('<br />', '\n');
    }
    return returnData;
}
function RemoveBR(strContent)
{
    var returnData = strContent;
    while(returnData.indexOf('<br>') != -1)
    {
        returnData = returnData.replace('<br>', ' ');
    }
    return returnData;
}
function UpdatePortalVisit(portalID)
{
    Qibu.Web.WebService.User.UpdatePortalVisit(portalID); 
}
/**********Friend Related Begin**********/
/// <summary>
/// 获取当前用户与目标用户之间的关系
/// </summary>
/// <param name="targetUserID">目标用户</param>
/// <param name="feedbackHandler">处理反馈的函数</param>
function GetUserRelation(targetUserID, feedbackHandler)
{
    Qibu.Web.WebService.Friend.GetUserRelation(targetUserID, feedbackHandler);
}

/// <summary>
/// 加为好友
/// </summary>
/// <param name="friendID">要添加的对象的用户ID</param>
function AddNewFriend(friendID)
{
    var html = '';
    if(friendID == null || friendID == 'undefined')
    {
        InitialAddFriendPanel();
    }
    else
    {
        GetUserRelation(friendID, CheckAddFriendCondition);
    }
}

/// <summary>
/// 加为黑名单
/// </summary>
/// <param name="userID">要加黑名单的对象的用户ID</param>
function BlockUser(userID)
{
    GetUserRelation(userID, CheckBlockFriendCondition);
}

/// <summary>
/// 处理加好友前对两者之间关系的验证反馈
/// </summary>
/// <param name="result">反馈</param>
function CheckAddFriendCondition(result)
{
    if(result == null)
    {
        alert("您执行了非法操作！");
    }
    else
    {
        switch(result[0])
        {
            case -1:
                alert("您执行了非法操作！");
                break;
            case 0:
                InitialAddFriendPanel(result[1]);
                break;
            case 1:
                alert('您已经发出过好友邀请，不必重复发送！');
                break;
            case 2:
                alert('你们已经是好友了！');
                break;
            case 3:
                alert('您的好友邀请被对方屏蔽了！');
                break;
            case 4:
                alert('该用户不存在！');
                break;
            case 5:
                alert('自己就不必邀请自己了吧！');
                break;
            case 6:
                InitialAddFriendPanel(result[1]);
                break;
        }
    }
}
function ApplyFriend(userID, targetUserID, reason)
{
    Qibu.Web.WebService.Friend.ApplyFriend(userID, targetUserID, reason, function(result){
        switch(result)
        {
            case 0:
                alert("已成功发送邀请！");
                break;
            case 1:
                alert("您已经发送过邀请！");
                break;
            case 2:
                alert("你们已经是好友！");
                break;
            case 3:
                alert("您已经被对方列入黑名单，不能提交好友邀请！");
                break;
            case 4:
                alert("该用户不存在！");
                break;
            case 5:
                alert("您不能加自己为好友！");
                break;
        }
    });
}
/// <summary>
/// 处理加黑名单前对两者之间关系的验证反馈
/// </summary>
/// <param name="result">反馈</param>
function CheckBlockFriendCondition(result)
{
    if(result == null)
    {
        alert("您执行了非法操作！");
    }
    else
    {
        switch(result[0])
        {
            case -1:
                YQAlert("您执行了非法操作！");
                break;
            case 4:
                YQAlert('该用户不存在！');
                break;
            case 5:
                YQAlert('自己是不可以把自己加入黑名单的哦！');
                break;
            case 6:
                YQAlert('他已经在您的黑名单中了！');
                break;
            default:
                YQConfirm("您确定要将"+result[1]+"加为黑名单吗？<br /><br />操作成功后他将无法访问您的门户，给您发消息或加您为好友，请您谨慎考虑。", null, null, 'BlockUserByUserID('+result[2]+')', null);
                break;
        }
    }
}
///// <summary>
///// 删除好友
///// </summary>
///// <param name="result">反馈</param>
//function RemoveFriend(e)
//{
//    if(typeof e == 'number')
//    {
//        if(confirm('确定删除该联系人？'))
//        {       
//            Qibu.Web.WebService.Friend.RemoveFriend(e,RemoveFriendSuccess);
//            ShowProcess('正在删除联系人，请稍候...');
//        }
//    }
//    else
//    {
//        HideCard();
//        CancelEvent(e);
//        var userID = document.all? event.srcElement.userID: e.target.userID;
//        var username = document.all? event.srcElement.username: e.target.username;
//        if(confirm('确定删除该联系人' + username + '？'))
//        {       
//            Qibu.Web.WebService.Friend.RemoveFriend(userID,RemoveFriendSuccess);
//            ShowProcess('正在删除联系人，请稍候...');
//        }
//    }
//}
//function RemoveFriendSuccess(result)
//{
//    HideProcess();
//    if(result == false)
//    {
//        ShowResultBox('有错误发生，请重试',false);
//    }
//    else
//    {
//        ShowResultBox('已成功删除联系人',true);
//        if(GetFriends)
//        {
//            GetFriends();
//        }
//    }
//}
/**********Friend Related End**********/
/**********Group Related Begin**********/
function NeedLogin()
{
    ShowResultBox('您尚未登陆！',false);
}
function CreateGroup()
{
    if(!isAuthenticated)
    {
        NeedLogin();
        return;
    }
    var url = String.Format('http://space.{0}.yi-qiao.cn/management/creategroup.aspx', username);
    Redirect(url);
}
function MyGroups()
{
    if(!isAuthenticated)
    {
        NeedLogin();
        return;
    }
    var url = String.Format('http://space.{0}.yi-qiao.cn/grouplist.aspx', username);
    Redirect(url);
}
function JoinGroup(_portalID)
{
    if(!isAuthenticated)
    {
        NeedLogin();
        return;
    }
    if(_portalID == null)
    {   
        _portalID = portalID;
    }  
    Qibu.Web.WebService.Group.Join(_portalID,JoinGroupSuccess);
    ShowProcess('正在申请加入医群圈，请稍候...');    
}
function JoinGroupSuccess(result)
{
    HideProcess();
    if(result == 0)
    {
        ShowResultBox('成功加入该群',true);
    }
    if(result == 1)
    {
        ShowResultBox('申请成功，请等待管理员批准',false);
    }
    if(result == 2)
    {
        ShowResultBox('该群不允许新成员加入',false);
    }
    if(result == 3)
    {
        ShowResultBox('您已申请加入该群，请勿重复申请',false);
    }
    if(result == 4)
    {
        ShowResultBox('您已是该群成员',false);
    }
    if(result == -1)
    {
        ShowResultBox('有错误发生，请重试',false);
    }
    window.location.href=window.location.href;
}
function SecedeGroup(e)
{
    if(confirm('确定退出该群？'))
    {
        if(typeof e == 'number')
        {   
            Qibu.Web.WebService.Group.Secede(e,SecedeSuccess);
            
        }
        else
        {
            var portalID = document.all? event.srcElement.portalID: e.target.portalID;
            Qibu.Web.WebService.Group.Secede(portalID,SecedeSuccess);
            CancelEvent(e);
        }
        ShowProcess('正在退出该群，请稍候...');        
    }
}
function SecedeSuccess(result)
{
    HideProcess();
    if(result == -1)
    {
        ShowResultBox('有错误发生，请重试',false);
    }
    else if(result == 1)
    {
        ShowResultBox('您是该群唯一管理员，请先指定一管理员后才能退出该群',false);
    }
    else
    {
        window.location.href = window.location.href;
    }
}
/**********Group Related End**********/
function GetContentTypeName(contentType)
{        
    var name;
    switch(contentType)
    {
        case 0:
            name = '博客';
            break;
        case 1:
            name = '图片';
            break;
        case 3:
            name = '门户';
            break;
    }
    return name;
}
function CountLeftWord(max, input, control)
{
    var value = input.value;
    if (value.length > max) 
    {
        input.value = input.value.substr(0,max);
    }
    var count = Math.max(0, max - value.length);
    control.innerHTML = count;
}
/**********User Card Begin**********/
function ShowUserCard(control,userID)
{
    if(userID == 3605)
    {
        return;
    }
    Qibu.Web.WebService.User.GetUserCardInfo(userID,GetUserCardInfoSuccess);
    var left = GetOffsetLeft(control) + control.offsetWidth;
    var top = GetOffsetTop(control);
    var divUserCard = document.createElement('div');
    divUserCard.id = 'divUserCard';
    divUserCard.innerHTML = '<div style="border:solid 1px #CCCCCC;background:yellow">正在获取名片信息...</div>';
    if(!window.popupUserCard)
    {
        popupUserCard = new PopupMenu(divUserCard,left,top,null,null,false,false,null,true,false);
    }
    popupUserCard.ChangeMenu(divUserCard.innerHTML);
    popupUserCard.Show(left,top);
}
function ShowUserCard(control,userID,show)
{
    if(userID == 3605)
    {
        return;
    }
    Qibu.Web.WebService.User.GetUserCardInfo(userID,GetUserCardInfoSuccess);
    var left = GetOffsetLeft(control) + control.offsetWidth;
    if(show == "left")
    {
        left = GetOffsetLeft(control) - 280;
    }
    var top = GetOffsetTop(control);
    var divUserCard = document.createElement('div');
    divUserCard.id = 'divUserCard';
    divUserCard.innerHTML = '<div style="border:solid 1px #CCCCCC;background:yellow">正在获取名片信息...</div>';
    if(!window.popupUserCard)
    {
        popupUserCard = new PopupMenu(divUserCard,left,top,null,null,false,false,null,true,false);
    }
    popupUserCard.ChangeMenu(divUserCard.innerHTML);
    popupUserCard.Show(left,top);
}
function ShowUserCard_InfoOnly(control,userID)
{
    if(userID == 3605)
    {
        return;
    }
    Qibu.Web.WebService.User.GetUserCardInfo(userID,GetUserCardInfoOnlySuccess);
    var left = GetOffsetLeft(control) - 280;
    var top = GetOffsetTop(control);
    var divUserCard = document.createElement('div');
    divUserCard.id = 'divUserCard';
    divUserCard.innerHTML = '<div style="border:solid 1px #CCCCCC;background:yellow">正在获取名片信息...</div>';
    if(!window.popupUserCard)
    {
        popupUserCard = new PopupMenu(divUserCard,left,top,null,null,false,false,null,true,false);
    }
    popupUserCard.ChangeMenu(divUserCard.innerHTML);
    popupUserCard.Show(left,top);
}
function HideUserCard()
{
    if(window.popupUserCard)
    {
        popupUserCard.DelayHide();
    }
}
function GetUserCardInfoSuccess(result)
{
    if(result == null)
    {
        return;
    }
    
    var user = result;
    var html = '';
    if(user.Role == '公众')
    {
        var className = user.IsOnline ? 'OrangeTheme' : 'Offline';
        html += String.Format('<div class="UserCard {0}">',className);
        html += '<div class="CardBody">';
        html += '<ul>';
        html += String.Format('<li><div class="left" style="float:left;width:150px"><img src="Themes/UserCard/ico02.gif" /><a href="http://space.{2}.yi-qiao.cn" class="CardUser">{0}</a><br /><span style="font-size:12px;color:black">(公众)</span></div><div class="UserState_online"></div>',user.RealName);
        
        if (!user.Validated) 
        {
            html +=String.Format('<div class="UserState_Fauthent"></div><div class="right" style="display:none">性别：{0}</div></li>',user.Gender);
        }
        else
        {
            html +=String.Format('<div class="UserState_Tauthent"></div><div class="right" style="display:none">性别：{0}</div></li>',user.Gender);
        }
        //html += '<div class="right" style="display:none">性别：{1}</div></li>',user.NickName,user.Gender,user.Username);
        html += String.Format('<br /><li>所在地区：{0}</li>', user.CityName);
        html += '<li style="height:30px">关注疾病：';
        if(user.Diseases == null || user.Diseases.length == 0)
        {
            html += '无关注疾病';
        }
        else
        {
            var index = -1;
            var showCount = 0;
            var showLimit = 2;
            if (user.Diseases.length>=2)
            {
                var temp = Math.floor(Math.random() * user.Diseases.length);
                for(;showCount < showLimit; showCount++)
                {
                    while(index == temp)
                    {
                        temp = Math.floor(Math.random() * user.Diseases.length);
                    }
                    index = temp;
                    html += user.Diseases[index] + ' ';
                    if(showCount == showLimit)
                    {
                        break;
                    }
                }
                    
                html += '…';            
             }
             else
             {
                  for(var i = 0; i < user.Diseases.length; i++)
                  {
                      html += user.Diseases[i] + ' ';
                  }
             }
        }
        html += '</li>';
        html += String.Format("<li>最近登录：{0}</li>", TimeFormat(user.LoginTime));
//        html += '<li>个人爱好：<span class="f">';
//        if(user.Hobbies == null || user.Hobbies.length == 0)
//        {
//            html += '无兴趣爱好';
//        }
//        else
//        {
//            if (user.Hobbies.length>9)
//            {
//                  for(var i = 0; i < 10; i++)
//                  {
//                      html += user.Hobbies[i] + ' ';
//                  }
//                  html += '…';            
//             }
//             else
//             {
//                  for(var i = 0; i < user.Hobbies.length; i++)
//                  {
//                      html += user.Hobbies[i] + ' ';
//                  }
//             }
//        }
//        html += '</span></li>';
//        html += '<li>';
//        html += '<div class="left" style="width:60px">总体简介：</div>';
//        if (user.Description.length>45)
//        {
//           user.Description = user.Description.substring(0, 45);
//           html += String.Format('<div class="left f" style="width:200px">{0}… </div>',user.Description);
//        }
//        else
//        {
//           html += String.Format('<div class="left f" style="width:200px">{0}</div>',user.Description);
//        }
//        html += '</li>';
        html += '</ul>';
        html += '</div>';
        html += String.Format('<div class="CardOperat"><a href="http://space.'+username+'.yi-qiao.cn/Management/MessageEdit.aspx?targetUsername={0}">发送消息</a>|<a href="javascript:Touch(userID, {1})">发送问候</a>|<a href="javascript:AddNewFriend({1})">加入好友</a>|<a href="javascript:BlockUser({1})">加黑名单</a></div>',user.Username,user.UserID);
        html += '</div>';
    }
    else if(user.Role == '医生')
    {
        var className = user.IsOnline ? 'GreenTheme' : 'Offline';
        var isvalidated;
        html += String.Format('<div class="UserCard {0}">',className);
        html += '<div class="CardBody">';
        html += '<ul>';
        html += String.Format('<li><div class="left" style="float:left;width:150px"><img src="Themes/UserCard/ico03.gif" /><a href="http://space.{2}.yi-qiao.cn" class="CardUser">{0}</a><br /><span style="font-size:12px;color:black">(医生)</span></div><div class="UserState_online"></div>',user.RealName,user.DoctorType==null?"医生":user.DoctorType,user.Username);
        if (!user.Validated) 
        {
            html +=String.Format('<div class="UserState_Fauthent"></div><div class="right" style="display:none">性别：{0}</div></li>',user.Gender);
        }
        else
        {
            html +=String.Format('<div class="UserState_Tauthent"></div><div class="right" style="display:none">性别：{0}</div></li>',user.Gender);
        }
        html += String.Format('<br /><li>所在医院：{0}</li>', user.HospitalName);	 
        html += String.Format('<li>所在科室：{0}</li>', user.SectionName);
        html += String.Format("<li>最近登录：{0}</li>", TimeFormat(user.LoginTime));
        
//        var count = 3;
//        var profession = '';
//        if(user.ProfessionNames != null && user.ProfessionNames.length > 0)
//        {
//            for(var i=0; i<(user.ProfessionNames.length>count?3:user.ProfessionNames.length); i++)
//            {
//                profession += user.ProfessionNames[i] + ';';
//            }
//        }
//        else
//        {
//            profession = "未透露";
//        }
//        
//        var position = '';
//        if(user.PositionNames != null && user.PositionNames.length > 0)
//        {
//            for(var i=0; i<(user.PositionNames.length>count?3:user.PositionNames.length); i++)
//            {
//                position += user.PositionNames[i] + ';';
//            }
//        }
//        else
//        {
//            position = "未透露";
//        }
//        
//        html += String.Format('<li>职称：{0}</li>', profession);
//        html += String.Format('<li>职务：{0}</li>', position);
//        html += String.Format('<li></li>');
//        html += '<li>专业擅长：';
//        if(user.Domains == null || user.Domains.length == 0)
//        {
//            html += '无专业擅长';
//        }
//        else
//        {   
//            if (user.Domains.length>9)
//            {
//                  for(var i = 0; i < 10; i++)
//                  {
//                      html += user.Domains[i] + ' ';
//                  }
//                  html += '…';
//             }
//             else
//             {
//                  for(var i = 0; i < user.Domains.length; i++)
//                  {
//                      html += user.Domains[i] + ' ';
//                  }
//             }
//        }
//        html += '</li><br />';
//        html += '<li>个人爱好：<span class="f">';
//        if(user.Hobbies == null || user.Hobbies.length == 0)
//        {
//            html += '无个人爱好';
//        }
//        else
//        {
//            if (user.Hobbies.length>9)
//            {
//                  for(var i = 0; i < 10; i++)
//                  {
//                      html += user.Hobbies[i] + ' ';
//                  }
//                  html += '…';            
//             }
//             else
//             {
//                  for(var i = 0; i < user.Hobbies.length; i++)
//                  {
//                      html += user.Hobbies[i] + ' ';
//                  }
//             }
//        }
//        html += '</span></li>';
//        html += '<li>';
//        html += '<div class="left" style="width:60px">总体简介：</div>';
//        if (user.Description.length>45)
//        {
//           user.Description = user.Description.substring(0, 45);
//           html += String.Format('<div class="left f" style="width:200px">{0}… </div>',user.Description);
//        }
//        else
//        {
//           html += String.Format('<div class="left f" style="width:200px">{0}</div>',user.Description);
//        }
//        html += '</li>';
        html += '</ul>';
        html += '</div>';
        html += String.Format('<div class="CardOperat"><a href="http://space.'+username+'.yi-qiao.cn/Management/MessageEdit.aspx?targetUsername={0}">发送消息</a>|<a href="javascript:Touch(userID, {1})">发送问候</a>|<a href="javascript:AddNewFriend({1})">加入好友</a>|<a href="javascript:BlockUser({1})">加黑名单</a></div>',user.Username,user.UserID);
        html += '</div>';
    }
    else if(user.Role == '企业代表')
    {
        var className = user.IsOnline ? 'BlueTheme' : 'Offline';
        html += String.Format('<div class="UserCard {0}">',className);
        html += '<div class="CardBody">';
        html += '<ul>';
        
        if (!user.Validated)
        {
            html += String.Format('<li><div class="left" style="float:left;width:150px"><img src="Themes/UserCard/ico01.gif" /><a href="http://space.{2}.yi-qiao.cn" class="CardUser">{0}</a><br /><span style="font-size:12px;color:black">(企业代表)</span></div><div class="UserState_online"></div><div class="UserState_Fauthent"></div><div class="right" style="display:none">性别：{1}</div></li>',user.RealName,user.Gender,user.Username);
        }
        else
        {
            html += String.Format('<li><div class="left" style="float:left;width:150px"><img src="Themes/UserCard/ico01.gif" /><a href="http://space.{2}.yi-qiao.cn" class="CardUser">{0}</a><br /><span style="font-size:12px;color:black">(企业代表)</span></div><div class="UserState_online"></div><div class="UserState_Tauthent"></div><div class="right" style="display:none">性别：{1}</div></li>',user.RealName,user.Gender,user.Username);
        }
        html += String.Format('<br /><li>公司名称：{0}</li>', user.CompanyName);
        html += String.Format("<li>最近登录：{0}</li>", TimeFormat(user.LoginTime));
//        html += '<li style="height:30px">关注领域：';
//        if(user.Diseases == null || user.Diseases.length == 0)
//        {
//            html += '无关注领域';
//        }
//        else
//        {
//            if (user.Diseases.length>9)
//            {
//                  for(var i = 0; i < 10; i++)
//                  {
//                      html += user.Diseases[i] + ' ';
//                  }
//                  html += '…';            
//             }
//             else
//             {
//                  for(var i = 0; i < user.Diseases.length; i++)
//                  {
//                      html += user.Diseases[i] + ' ';
//                  }
//             }
//        }
//        html += '</li><br />';
//        html += '<li>个人爱好：<span class="f">';
//        if(user.Hobbies == null || user.Hobbies.length == 0)
//        {
//            html += '无个人爱好';
//        }
//        else
//        {
//            if (user.Hobbies.length>9)
//            {
//                  for(var i = 0; i < 10; i++)
//                  {
//                      html += user.Hobbies[i] + ' ';
//                  }
//                  html += '…';            
//             }
//             else
//             {
//                  for(var i = 0; i < user.Hobbies.length; i++)
//                  {
//                      html += user.Hobbies[i] + ' ';
//                  }
//             }
//        }
//        html += '</span></li>';
//        html += '<li>';
//        html += '<div class="left" style="width:60px">总体简介：</div>';
//        if (user.Description.length>45)
//        {
//           user.Description = user.Description.substring(0, 45);
//           html += String.Format('<div class="left f" style="width:200px">{0}… </div>',user.Description);
//        }
//        else
//        {
//           html += String.Format('<div class="left f" style="width:200px">{0}</div>',user.Description);
//        }
//        html += '</li>';
        html += '</ul>';
        html += '</div>';
        html += String.Format('<div class="CardOperat"><a href="http://space.'+username+'.yi-qiao.cn/Management/MessageEdit.aspx?targetUsername={0}">发送消息</a>|<a href="javascript:Touch(userID, {1})">发送问候</a>|<a href="javascript:AddNewFriend({1})">加入好友</a>|<a href="javascript:BlockUser({1})">加黑名单</a></div>',user.Username,user.UserID);
        html += '</div>';
    }
    else
    {
        var className = user.IsOnline ? 'BlueTheme' : 'Offline';
        html += String.Format('<div class="UserCard {0}">',className);
        html += '<div class="CardBody">';
        html += '<ul>';
        if (!user.Validated)
        {
            html += String.Format('<li><div class="left" style="float:left;width:150px"><img src="Themes/UserCard/ico01.gif" /><a href="http://space.{2}.yi-qiao.cn" class="CardUser">{0}</a><br /><span style="font-size:12px;color:black">(公司帐号)</span></div><div class="UserState_online"></div><div class="UserState_Fauthent"></div><div class="right" style="display:none">性别：{1}</div></li>',user.RealName,user.Gender,user.Username);
        }
        else
        {
            html += String.Format('<li><div class="left" style="float:left;width:150px"><img src="Themes/UserCard/ico01.gif" /><a href="http://space.{2}.yi-qiao.cn" class="CardUser">{0}</a><br /><span style="font-size:12px;color:black">(公司帐号)</span></div><div class="UserState_online"></div><div class="UserState_Tauthent"></div><div class="right" style="display:none">性别：{1}</div></li>',user.RealName,user.Gender,user.Username);
        }
        html += String.Format('<br /><li>加入时间：{0}</li>', user.RegisterTime);
        var productNames = "";
        if(user.ProductNames != null)
        {
            for(var i=0; i<user.ProductNames.length; i++)
            {
                if(i == 3)
                {
                    break;
                }
                productNames += '<a href="ent/ProductShow.aspx?productID='+user.ProductIDs[i]+'" target="_blank">' + user.ProductNames[i] + '</a> ';
            }
        }
        html += String.Format("<li>公司产品：{0}</li>", productNames);
        html += String.Format("<li>公司简介：{0}</li>", user.EntDescription);
//        html += '<li style="height:30px">关注领域：';
//        if(user.Diseases == null || user.Diseases.length == 0)
//        {
//            html += '无关注领域';
//        }
//        else
//        {
//            if (user.Diseases.length>9)
//            {
//                  for(var i = 0; i < 10; i++)
//                  {
//                      html += user.Diseases[i] + ' ';
//                  }
//                  html += '…';            
//             }
//             else
//             {
//                  for(var i = 0; i < user.Diseases.length; i++)
//                  {
//                      html += user.Diseases[i] + ' ';
//                  }
//             }
//        }
//        html += '</li><br />';
//        html += '<li>个人爱好：<span class="f">';
//        if(user.Hobbies == null || user.Hobbies.length == 0)
//        {
//            html += '无个人爱好';
//        }
//        else
//        {
//            if (user.Hobbies.length>9)
//            {
//                  for(var i = 0; i < 10; i++)
//                  {
//                      html += user.Hobbies[i] + ' ';
//                  }
//                  html += '…';            
//             }
//             else
//             {
//                  for(var i = 0; i < user.Hobbies.length; i++)
//                  {
//                      html += user.Hobbies[i] + ' ';
//                  }
//             }
//        }
//        html += '</span></li>';
//        html += '<li>';
//        html += '<div class="left" style="width:60px">总体简介：</div>';
//        if (user.Description.length>45)
//        {
//           user.Description = user.Description.substring(0, 45);
//           html += String.Format('<div class="left f" style="width:200px">{0}… </div>',user.Description);
//        }
//        else
//        {
//           html += String.Format('<div class="left f" style="width:200px">{0}</div>',user.Description);
//        }
//        html += '</li>';
        html += '</ul>';
        html += '</div>';
        if(user.ShowJoinEnt == true)
        {
            html += String.Format('<div class="CardOperat" style="text-align:right"><a href="ent/EntShow.aspx?entID={2}" target="_blank">企业主页</a>|<a href="ent/EntComment.aspx?entID={2}" target="_blank">企业留言</a>|<a href="Reg/EnterpriseJoin.aspx?entID={2}&userID={1}" target="_blank">加入企业</a></div>',user.Username,user.UserID,user.EntID);
        }
        else
        {
            html += String.Format('<div class="CardOperat" style="text-align:right"><a href="ent/EntShow.aspx?entID={2}" target="_blank">企业主页</a>|<a href="ent/EntComment.aspx?entID={2}" target="_blank">企业留言</a></div>',user.Username,user.UserID,user.EntID);
        }
        html += '</div>';
    }
    if($('divUserCard'))
    {
        $('divUserCard').innerHTML = html;
    }
}
function GetUserCardInfoOnlySuccess(result)
{
    if(result == null)
    {
        return;
    }
    
    var user = result;
    var html = '';
    if(user.Role == '公众')
    {
        var className = user.IsOnline ? 'OrangeTheme' : 'Offline';
        html += String.Format('<div class="UserCard {0}">',className);
        html += '<div class="CardBody">';
        html += '<ul>';
        html += String.Format('<li><div class="left" style="float:left;width:150px"><img src="Themes/UserCard/ico02.gif"><a href="http://space.{2}.yi-qiao.cn" class="CardUser">{0}</a><br /><span style="font-size:12px;color:black">(公众)</span></div>',user.RealName);
        
        if (!user.Validated) 
        {
            html +=String.Format('<div class="UserState_Fauthent"></div><div class="right" style="display:none">性别：{0}</div></li>',user.Gender);
        }
        else
        {
            html +=String.Format('<div class="UserState_Tauthent"></div><div class="right" style="display:none">性别：{0}</div></li>',user.Gender);
        }
        html += String.Format('<br /><li>所在地区：{0}</li>', user.CityName);
        html += '<li style="height:30px">关注疾病：';
        if(user.Diseases == null || user.Diseases.length == 0)
        {
            html += '无关注疾病';
        }
        else
        {
            var index = -1;
            var showCount = 0;
            var showLimit = 2;
            if (user.Diseases.length>=2)
            {
                var temp = Math.floor(Math.random() * user.Diseases.length);
                for(;showCount < showLimit; showCount++)
                {
                    while(index == temp)
                    {
                        temp = Math.floor(Math.random() * user.Diseases.length);
                    }
                    index = temp;
                    html += user.Diseases[index] + ' ';
                    if(showCount == showLimit)
                    {
                        break;
                    }
                }
                    
                html += '…';            
             }
             else
             {
                  for(var i = 0; i < user.Diseases.length; i++)
                  {
                      html += user.Diseases[i] + ' ';
                  }
             }
        }
        html += '</li>';
        html += String.Format("<li>最近登录：{0}</li>", TimeFormat(user.LoginTime));
//        html += '<li>个人爱好：<span class="f">';
//        if(user.Hobbies == null || user.Hobbies.length == 0)
//        {
//            html += '无个人爱好';
//        }
//        else
//        {
//            if (user.Hobbies.length>9)
//            {
//                  for(var i = 0; i < 10; i++)
//                  {
//                      html += user.Hobbies[i] + ' ';
//                  }
//                  html += '…';            
//             }
//             else
//             {
//                  for(var i = 0; i < user.Hobbies.length; i++)
//                  {
//                      html += user.Hobbies[i] + ' ';
//                  }
//             }
//        }
//        html += '</span></li>';
//        html += '<li>';
//        html += '<div class="left" style="width:60px">总体简介：</div>';
//        if (user.Description.length>45)
//        {
//           user.Description = user.Description.substring(0, 45);
//           html += String.Format('<div class="left f" style="width:200px">{0}… </div>',user.Description);
//        }
//        else
//        {
//           html += String.Format('<div class="left f" style="width:200px">{0}</div>',user.Description);
//        }
//        html += '</li>';
        html += '</ul>';
        html += '</div>';
        //html += String.Format('<div class="CardOperat"><a href="javascript:Message(\'{0}\')">发送消息</a> | <a href="javascript:AddNewFriend({1})">加入好友</a> | <a href="javascript:BlockUser({1})">阻止该人</a></div>',user.Username,user.UserID);
        html += '</div>';
    }
    else if(user.Role == '医生')
    {
        var className = user.IsOnline ? 'GreenTheme' : 'Offline';
        var isvalidated;
        html += String.Format('<div class="UserCard {0}">',className);
        html += '<div class="CardBody">';
        html += '<ul>';
        html += String.Format('<li><div class="left" style="float:left;width:150px"><img src="Themes/UserCard/ico03.gif" /><a href="http://space.{2}.yi-qiao.cn" class="CardUser">{0}</a><br /><span style="font-size:12px;color:black">(医生)</span></div><div class="UserState_online"></div>',user.RealName,user.DoctorType==null?"医生":user.DoctorType,user.Username);
        if (!user.Validated) 
        {
            html +=String.Format('<div class="UserState_Fauthent"></div><div class="right" style="display:none">性别：{0}</div></li>',user.Gender);
        }
        else
        {
            html +=String.Format('<div class="UserState_Tauthent"></div><div class="right" style="display:none">性别：{0}</div></li>',user.Gender);
        }
        html += String.Format('<br /><li>所在医院：{0}</li>', user.HospitalName);	 
        html += String.Format('<li>所在科室：{0}</li>', user.SectionName);
        html += String.Format("<li>最近登录：{0}</li>", TimeFormat(user.LoginTime));
//        html += '<li>专业擅长：';
//        if(user.Domains == null || user.Domains.length == 0)
//        {
//            html += '无专业擅长';
//        }
//        else
//        {   
//            if (user.Domains.length>9)
//            {
//                  for(var i = 0; i < 10; i++)
//                  {
//                      html += user.Domains[i] + ' ';
//                  }
//                  html += '…';
//             }
//             else
//             {
//                  for(var i = 0; i < user.Domains.length; i++)
//                  {
//                      html += user.Domains[i] + ' ';
//                  }
//             }
//        }
//        html += '</li><br />';
//        html += '<li>个人爱好：<span class="f">';
//        if(user.Hobbies == null || user.Hobbies.length == 0)
//        {
//            html += '无个人爱好';
//        }
//        else
//        {
//            if (user.Hobbies.length>9)
//            {
//                  for(var i = 0; i < 10; i++)
//                  {
//                      html += user.Hobbies[i] + ' ';
//                  }
//                  html += '…';            
//             }
//             else
//             {
//                  for(var i = 0; i < user.Hobbies.length; i++)
//                  {
//                      html += user.Hobbies[i] + ' ';
//                  }
//             }
//        }
//        html += '</span></li>';
//        html += '<li>';
//        html += '<div class="left" style="width:60px">总体简介：</div>';
//        if (user.Description.length>45)
//        {
//           user.Description = user.Description.substring(0, 45);
//           html += String.Format('<div class="left f" style="width:200px">{0}… </div>',user.Description);
//        }
//        else
//        {
//           html += String.Format('<div class="left f" style="width:200px">{0}</div>',user.Description);
//        }
//        html += '</li>';
        html += '</ul>';
        html += '</div>';
        //html += String.Format('<div class="CardOperat"><a href="javascript:Message(\'{0}\')">发送消息</a> | <a href="javascript:AddNewFriend({1})">加入好友</a> | <a href="javascript:BlockUser({1})">阻止该人</a></div>',user.Username,user.UserID);
        html += '</div>';
    }
    else if(user.Role == '企业代表')
    {
        var className = user.IsOnline ? 'BlueTheme' : 'Offline';
        html += String.Format('<div class="UserCard {0}">',className);
        html += '<div class="CardBody">';
        html += '<ul>';
        if (!user.Validated)
        {
            html += String.Format('<li><div class="left" style="float:left;width:150px"><img src="Themes/UserCard/ico01.gif" /><a href="http://space.{2}.yi-qiao.cn" class="CardUser">{0}</a><br /><span style="font-size:12px;color:black">(企业代表)</span></div><div class="UserState_online"></div><div class="UserState_Fauthent"></div><div class="right" style="display:none">性别：{1}</div></li>',user.RealName,user.Gender,user.Username);
        }
        else
        {
            html += String.Format('<li><div class="left" style="float:left;width:150px"><img src="Themes/UserCard/ico01.gif" /><a href="http://space.{2}.yi-qiao.cn" class="CardUser">{0}</a><br /><span style="font-size:12px;color:black">(企业代表)</span></div><div class="UserState_online"></div><div class="UserState_Tauthent"></div><div class="right" style="display:none">性别：{1}</div></li>',user.RealName,user.Gender,user.Username);
        }
        html += String.Format('<br /><li>公司名称：{0}</li>', user.CompanyName);
        html += String.Format("<li>最近登录：{0}</li>", TimeFormat(user.LoginTime));
//        html += '<li style="height:30px">关注领域：';
//        if(user.Diseases == null || user.Diseases.length == 0)
//        {
//            html += '无关注领域';
//        }
//        else
//        {
//            if (user.Diseases.length>9)
//            {
//                  for(var i = 0; i < 10; i++)
//                  {
//                      html += user.Diseases[i] + ' ';
//                  }
//                  html += '…';            
//             }
//             else
//             {
//                  for(var i = 0; i < user.Diseases.length; i++)
//                  {
//                      html += user.Diseases[i] + ' ';
//                  }
//             }
//        }
//        html += '</li><br />';
//        html += '<li>个人爱好：<span class="f">';
//        if(user.Hobbies == null || user.Hobbies.length == 0)
//        {
//            html += '无个人爱好';
//        }
//        else
//        {
//            if (user.Hobbies.length>9)
//            {
//                  for(var i = 0; i < 10; i++)
//                  {
//                      html += user.Hobbies[i] + ' ';
//                  }
//                  html += '…';            
//             }
//             else
//             {
//                  for(var i = 0; i < user.Hobbies.length; i++)
//                  {
//                      html += user.Hobbies[i] + ' ';
//                  }
//             }
//        }
//        html += '</span></li>';
//        html += '<li>';
//        html += '<div class="left" style="width:60px">总体简介：</div>';
//        if (user.Description.length>45)
//        {
//           user.Description = user.Description.substring(0, 45);
//           html += String.Format('<div class="left f" style="width:200px">{0}… </div>',user.Description);
//        }
//        else
//        {
//           html += String.Format('<div class="left f" style="width:200px">{0}</div>',user.Description);
//        }
//        html += '</li>';
        html += '</ul>';
        html += '</div>';
        //html += String.Format('<div class="CardOperat"><a href="javascript:Message(\'{0}\')">发送消息</a> | <a href="javascript:AddNewFriend({1})">加入好友</a> | <a href="javascript:BlockUser({1})">阻止该人</a></div>',user.Username,user.UserID);
        html += '</div>';
    }
    else
    {
        var className = user.IsOnline ? 'BlueTheme' : 'Offline';
        html += String.Format('<div class="UserCard {0}">',className);
        html += '<div class="CardBody">';
        html += '<ul>';
        if (!user.Validated)
        {
            html += String.Format('<li><div class="left" style="float:left;width:150px"><img src="Themes/UserCard/ico01.gif" /><a href="http://space.{2}.yi-qiao.cn" class="CardUser">{0}</a><br /><span style="font-size:12px;color:black">(公司帐号)</span></div><div class="UserState_online"></div><div class="UserState_Fauthent"></div><div class="right" style="display:none">性别：{1}</div></li>',user.RealName,user.Gender,user.Username);
        }
        else
        {
            html += String.Format('<li><div class="left" style="float:left;width:150px"><img src="Themes/UserCard/ico01.gif" /><a href="http://space.{2}.yi-qiao.cn" class="CardUser">{0}</a><br /><span style="font-size:12px;color:black">(公司帐号)</span></div><div class="UserState_online"></div><div class="UserState_Tauthent"></div><div class="right" style="display:none">性别：{1}</div></li>',user.RealName,user.Gender,user.Username);
        }
        html += String.Format('<br /><li>加入时间：{0}</li>', user.RegisterTime);
        var productNames = "";
        if(user.ProductNames != null)
        {
            for(var i=0; i<user.ProductNames.length; i++)
            {
                if(i == 3)
                {
                    break;
                }
                productNames += '<a href="ent/ProductShow.aspx?productID='+user.ProductIDs[i]+'" target="_blank">' + user.ProductNames[i] + '</a> ';
            }
        }
        html += String.Format("<li>公司产品：{0}</li>", productNames);
        html += String.Format("<li>公司简介：{0}</li>", user.EntDescription);
//        html += '<li style="height:30px">关注领域：';
//        if(user.Diseases == null || user.Diseases.length == 0)
//        {
//            html += '无关注领域';
//        }
//        else
//        {
//            if (user.Diseases.length>9)
//            {
//                  for(var i = 0; i < 10; i++)
//                  {
//                      html += user.Diseases[i] + ' ';
//                  }
//                  html += '…';            
//             }
//             else
//             {
//                  for(var i = 0; i < user.Diseases.length; i++)
//                  {
//                      html += user.Diseases[i] + ' ';
//                  }
//             }
//        }
//        html += '</li><br />';
//        html += '<li>个人爱好：<span class="f">';
//        if(user.Hobbies == null || user.Hobbies.length == 0)
//        {
//            html += '无个人爱好';
//        }
//        else
//        {
//            if (user.Hobbies.length>9)
//            {
//                  for(var i = 0; i < 10; i++)
//                  {
//                      html += user.Hobbies[i] + ' ';
//                  }
//                  html += '…';            
//             }
//             else
//             {
//                  for(var i = 0; i < user.Hobbies.length; i++)
//                  {
//                      html += user.Hobbies[i] + ' ';
//                  }
//             }
//        }
//        html += '</span></li>';
//        html += '<li>';
//        html += '<div class="left" style="width:60px">总体简介：</div>';
//        if (user.Description.length>45)
//        {
//           user.Description = user.Description.substring(0, 45);
//           html += String.Format('<div class="left f" style="width:200px">{0}… </div>',user.Description);
//        }
//        else
//        {
//           html += String.Format('<div class="left f" style="width:200px">{0}</div>',user.Description);
//        }
//        html += '</li>';
        html += '</ul>';
        html += '</div>';
        //html += String.Format('<div class="CardOperat"><a href="javascript:Message(\'{0}\')">发送消息</a> | <a href="javascript:AddNewFriend({1})">加入好友</a> | <a href="javascript:BlockUser({1})">阻止该人</a></div>',user.Username,user.UserID);
        html += '</div>';
    }
    if($('divUserCard'))
    {
        var divUserCard = $('divUserCard');
        divUserCard.innerHTML = html;
        var spos = System.Document.getScrollPosition();
        var dsize = System.Document.getVisibleDocumentSize();
        var esize = System.Document.getElementSize(divUserCard);
        var left = (dsize.width - esize.width)/2 + spos.left;
        var top = (dsize.height -esize.height)/2 + spos.top;
        divUserCard.style.left = left + "px";
        divUserCard.style.top = top + "px";  
    }
}
/**********User Card End**********/
function flashWrite( id, flashUri, vWidth, vHeight, winMode ) {
    var _obj_ = "";

    _obj_ = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="' + vWidth + '" height="' + vHeight + '" id="' + id + '" align="middle">';
       _obj_ += '<param name="movie" value="' + flashUri + '" />';
    _obj_ += '<param name="quality" value="high" />';
    _obj_ += '<param name="wmode" value="' + winMode + '" /> ';
    _obj_ += '<embed src="' + flashUri + '" quality="high" wmode="' + winMode + '" bgcolor="#ffffff" width="' + vWidth +'" height="' + vHeight + '" id="' + id + '" align="middle" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></embed> ';
    _obj_ += '</object>';
    document.writeln( _obj_ );
}

function flashObjectGenerate( id, flashUri, vWidth, vHeight, winMode ) {
    var _obj_ = "";

    _obj_ = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="' + vWidth + '" height="' + vHeight + '" id="' + id + '" align="middle">';
    _obj_ += '<param name="movie" value="' + flashUri + '" />';
    _obj_ += '<param name="quality" value="high" />';
    _obj_ += '<param name="wmode" value="' + winMode + '" /> ';
    _obj_ += '<embed src="' + flashUri + '" quality="high" wmode="' + winMode + '" bgcolor="#ffffff" width="' + vWidth +'" height="' + vHeight + '" id="' + id + '" align="middle" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></embed> ';
    _obj_ += '</object>';

    return _obj_;
}

function CreateFlashObject(id, flashUrl,vWidth, vHeight)
{
    var flash = new System.Controls.FlashPlayer(flashUrl, vWidth, vHeight);
	flash.setParameter("allowScriptAccess","always");
	flash.setAttribute("id",id);
	flash.write();
	return flash;
}

function SetFlashLink(flashObject, linkUrl, linkTarget)
{
    System.Event.PageLoad(function(){
        $(flashObject.getAttribute("id")).setVar(linkUrl);
        $(flashObject.getAttribute("id")).setTarget(linkTarget);
    });
}

/**********Credit Start***********/

function CalculateByRate(input, outputElement, rateStr, partIndex)
{
    // 解析rate
    var rates = rateStr.split(':');
    var total = 0;
    for(var i=0; i<rates.length; i++)
    {
        if(!isNaN(rates[i]))
        {
            total += parseInt(rates[i]);
        }
        else
        {
            alert("比例输入格式及字符不合法");
            return;
        }
    }
    if(isNaN(input))
    {
        alert("应输入数字！");
        return;
    }
    var output = Math.round(input * rates[partIndex] / total);
    outputElement.innerHTML = output;
}

function ToggleMenu(level, origionClassName, newClassName, changeParent)
{
    var menuLevel = $("level"+level);
    if(changeParent)
    {
        var parentClass = menuLevel.parentNode.className;
        if(parentClass == origionClassName)
        {
            menuLevel.parentNode.className = newClassName;
        }
        else if(parentClass == newClassName)
        {
            menuLevel.parentNode.className = origionClassName;
        }
    }
    else
    {
        var className = menuLevel.className;
        if(className == origionClassName)
        {
            menuLevel.className = newClassName;
        }
        else if(className == newClassName)
        {
            menuLevel.className = origionClassName;
        }
    }
    
    var display = menuLevel.style.display;
    
    if(display != "none")
    {
        menuLevel.style.display = "none";
    }
    else
    {
        menuLevel.style.display = "";
    }
    
}




//**********************************************************************************************************************************************************、

personNames = new Array(/*"我的积分","我的日历","我的活动",*/"医桥首页","我的展示","个人首页","我的好友","留言板","我的博客","我的相册","我的圈子");
personLinks = new Array(/*"我的积分","我的日历","我的活动",*/"http://www.yi-qiao.cn","http://space.@username.yi-qiao.cn","http://space.@username.yi-qiao.cn/owner","http://space.@username.yi-qiao.cn/FriendList.aspx","http://space.@username.yi-qiao.cn/QuickReply.aspx","http://space.@username.yi-qiao.cn/Blog","http://space.@username.yi-qiao.cn/Photo","http://space.@username.yi-qiao.cn/GroupList.aspx");

resourceNames = new Array(/*"名医博客",*/"资讯选编","专网导航","文献检索"/*,"专业论坛","诊疗指南"*/,"资源下载");
resourceLinks = new Array(/*"名医博客",*/"http://www.yi-qiao.cn/ArticleList.aspx","http://www.yi-qiao.cn/NavigationList.aspx","/Assist/RedirectToWanFang.aspx"/*,"http://www.yi-qiao.cn/TopicMain.aspx","http://www.yi-qiao.cn/ArticleList.aspx?type=5"*/,"http://www.yi-qiao.cn/File/dataList.aspx");

activityNames = new Array(/*"在线讲坛","分享文库",*/"CME","意向问卷"/*,"电子阅览"*/, "互助问答");
activityLinks = new Array(/*"在线讲坛","分享文库",*/"http://www.yi-qiao.cn/cme/cmemain.aspx","http://www.yi-qiao.cn/invest/investmain.aspx"/*,"http://www.yi-qiao.cn/File/video.aspx"*/, "http://www.yi-qiao.cn/QAQuestionList.aspx");

subjectNames = new Array("会议报道","在线讲坛"/*,"访谈","研讨","病案"*/);
subjectLinks = new Array("http://www.yi-qiao.cn/2007huximeeting/subject/SubjectMeeting_08.aspx","http://www.yi-qiao.cn/Lecture/Seminars_TalksIng.aspx"/*,"访谈","研讨","病案"*/);

socialNames = new Array("医博客","医图片","医群圈","医论坛","医游戏", "找会员", "找圈子");
socialLinks = new Array("http://www.yi-qiao.cn/BlogMain.aspx","http://www.yi-qiao.cn/PhotoMain.aspx","http://www.yi-qiao.cn/GroupMain.aspx","http://www.yi-qiao.cn/bbs/","http://space.@username.yi-qiao.cn/game/","http://www.yi-qiao.cn/Search_User.aspx","http://www.yi-qiao.cn/Search_Group.aspx");

serviceNames = new Array("资讯定制", "资源查找", "文件处理", "课件制作", "文献翻译", "软件使用帮助");
serviceLinks = new Array("#", "#", "#", "#", "#", "#");

communityNames = new Array(/*"BI公司",*/ "呼吸康复");
communityLinks = new Array(/*"http://www.yi-qiao.cn/ent/EntShow.aspx?entID=1",*/"http://www.pulmonary-rehabilitation.com.cn/");

myActivityNames = new Array("我的问卷", "我的CME");
myActivityLinks = new Array("http://space.@username.yi-qiao.cn/Management/MyHistoryInvest.aspx", "http://space.@username.yi-qiao.cn/Management/MyCmeList.aspx");

myProfileNames = new Array("头像上传", "重要资料修改", "其它资料修改", "密码修改");
myProfileLinks = new Array("http://space.@username.yi-qiao.cn/Management/UploadPortrait.aspx", "http://space.@username.yi-qiao.cn/Management/ImportantInfo.aspx", "http://space.@username.yi-qiao.cn/Management/OtherInfo.aspx", "http://space.@username.yi-qiao.cn/Management/ChangePassword.aspx");

entActivityNavNames = new Array("创建活动", "活动管理");
entActivityNavLinks = new Array("http://www.yi-qiao.cn/ent/admin/AddActivity.aspx?entID=@entID", "http://www.yi-qiao.cn/ent/admin/EntActivityList.aspx?entID=@entID");

cmeNavNames = new Array("创建活动", "活动管理");
cmeNavLinks = new Array("http://www.yi-qiao.cn/ent/admin/AddCme.aspx?entID=@entID", "http://www.yi-qiao.cn/ent/admin/ActivityList.aspx?entID=@entID&contentType=7");

investNavNames = new Array("创建活动", "活动管理");
investNavLinks = new Array("http://www.yi-qiao.cn/ent/admin/AddNewInvest.aspx?entID=@entID", "http://www.yi-qiao.cn/ent/admin/ActivityList.aspx?entID=@entID&contentType=12");

lectureNavNames = new Array("创建活动", "活动管理");
lectureNavLinks = new Array("http://www.yi-qiao.cn/ent/admin/AddLecture.aspx?entID=@entID", "http://www.yi-qiao.cn/ent/admin/ActivityList.aspx?entID=@entID&contentType=14");

expressNavNames = new Array("创建活动", "活动管理");
expressNavLinks = new Array("http://www.yi-qiao.cn/ent/admin/AddExpress.aspx?entID=@entID", "http://www.yi-qiao.cn/ent/admin/ExpressList.aspx?entID=@entID");

caseNavNames = new Array("创建活动", "活动实例", "活动管理");
caseNavLinks = new Array("http://www.yi-qiao.cn/EntTool/病案讨论/case7.aspx", "http://www.yi-qiao.cn/EntTool/病案讨论/index.aspx", "http://www.yi-qiao.cn/EntTool/病案讨论/case10.aspx");

daNavNames = new Array("创建活动", "活动实例", "活动管理");
daNavLinks = new Array("http://www.yi-qiao.cn/EntTool/资料后台 - 上传资料.aspx", "http://www.yi-qiao.cn/EntTool/资料页前台/data1.aspx", "http://www.yi-qiao.cn/EntTool/资料后台 - 上传列表.aspx");

ebookNavNames = new Array("创建活动", "活动实例", "活动管理");
ebookNavLinks = new Array("http://www.yi-qiao.cn/EntTool/资料后台 - 上传资料.aspx", "http://www.yi-qiao.cn/EntTool/资料页前台/data2.aspx", "http://www.yi-qiao.cn/EntTool/资料后台 - 上传列表.aspx");

qaNavNames = new Array("我的提问", "我的回答");
qaNavLinks = new Array("http://space.@username.yi-qiao.cn/Management/QAQuestionList.aspx", "http://space.@username.yi-qiao.cn/Management/QAAnswerList.aspx");


var popupMenu,popupPanel,menuPosition;
function ShowActivityNavigation(html, targetElement, adjustLeft, adjustTop)
{
    var targetLeft = (document.body.clientWidth - 790) / 2;
    var targetTop = GetOffsetTop(targetElement);
    var tempDiv = document.createElement("div");
    tempDiv.innerHTML = html;

    popupMenu = new PopupMenu(tempDiv,targetLeft+adjustLeft,targetTop+adjustTop, 500,0,false,false, null,true);
    popupMenu.Show();
    
}
function ShowNavigation(names, links, targetElement, adjustLeft, adjustTop)
{
    var html = '';
    html += '<div class="mousemenu1" id="navDiv">';
    html += '<div class="mousemenuarr"><img src="Themes/Theme3/images/mousemenu_arr.gif" /></div>';
    html += '<div class="mousemenubox">';
    html += '<ul>';
    for(var i=0; i<links.length; i++)
    {
        var target = '';
        var style = '';
        
        // 特殊条件设定 - 弹新窗口
        if("会议报道,文献检索,在线讲坛,BI公司,呼吸康复,资讯选编,专网导航,诊疗指南,医博客,医图片,医群圈,医论坛,医游戏,我的相册,我的圈子,找会员,找圈子,资源下载".indexOf(names[i]) >= 0)
        {
            //html += '<li><a href="'+links[i].replace("@username",username)+'" target="_blank">'+names[i]+'</a></li>';
            target = ' target="_blank"';
        }
        // 特殊条件设定 - 链接颜色 - 新
        if("医论坛".indexOf(names[i]) >= 0)
        {
            style = 'color:Red';
        }
        if(!window.entID)
        {
            entID = 0;
        }
        html += '<li><a href="'+links[i].replace("@username",username).replace("@entID",entID)+'" '+target+' style="'+style+'">'+names[i]+'</a></li>';
    }
    html += '</ul>'; 
    html += '</div>';
    html += '<div class="b"></div>';
    html += '</div>';
    var targetLeft = (document.body.clientWidth - 790) / 2;
    var targetTop = GetOffsetTop(targetElement);
    //alert(targetLeft + "," +targetTop);
    var tempDiv = document.createElement("div");
    tempDiv.innerHTML = html;

    popupMenu = new PopupMenu(tempDiv,targetLeft+adjustLeft,targetTop+adjustTop, 85,0,false,false, null,true);
    popupMenu.Show();
    
}
function ShowPortalNavigation(names, links, targetElement, adjustLeft, adjustTop)
{
    var html = '';
    html += '<div class="mousemenu2">';
    html += '<div class="t"></div>';
    html += '<div class="mousemenubox">';
    html += '<ul>';
    for(var i=0; i<links.length; i++)
    {
        var target = '';
        var style = '';
        
        // 特殊条件设定 - 弹新窗口
        if("会议报道,文献检索,在线讲坛,创建活动,活动实例,活动管理,BI公司,呼吸康复,资讯选编,专网导航,诊疗指南,医博客,医图片,医群圈,医论坛,医游戏,我的相册,我的圈子,找会员,找圈子,资源下载".indexOf(names[i]) >= 0)
        {
            //html += '<li><a href="'+links[i].replace("@username",username)+'" target="_blank">'+names[i]+'</a></li>';
            target = ' target="_blank"';
        }
        // 特殊条件设定 - 链接颜色 - 新
        if("医论坛".indexOf(names[i]) >= 0)
        {
            style = 'color:Red';
        }
        
        html += '<li><a href="'+links[i].replace("@username",username)+'" '+target+' style="'+style+'">'+names[i]+'</a></li>';
    }
    html += '</ul>'; 
    html += '</div>';
    html += '<div class="b"></div>';
    html += '</div>';
    var targetLeft = GetOffsetLeft(targetElement);
    var targetTop = GetOffsetTop(targetElement);
    menuPosition = {left:targetLeft+adjustLeft,top:targetTop+adjustTop};
    var tempDiv = document.createElement("div");
    tempDiv.innerHTML = html;

    popupMenu = new PopupMenu(tempDiv,targetLeft+adjustLeft,targetTop+adjustTop, 85,0,false,false, null,true);
    popupMenu.Show();
    popupPanel = CreatePanel(tempDiv, false, false, null, null, 85, 100, false, false, false, null);
    popupPanel.show();
    popupPanel.setPosition(menuPosition);
    tempDiv.innerHTML = popupPanel.element.innerHTML;
    popupMenu = new PopupMenu(tempDiv,targetLeft+adjustLeft,targetTop+adjustTop, 85,0,false,false, null,true);
    popupMenu.Show();
    //System.Event.addEventListener(popupMenu.element,"mouseover",function(){clearTimeout(popupMenu.DelayTimer);popupMenu.setPosition(menuPosition);},false);
    //System.Event.addEventListener(popupMenu.element,"mouseout",function(){popupMenu.close();},false);
//    popupMenu = new System.Controls.Menu(tempDiv);
//    popupMenu.show();
//    popupMenu.setPosition(menuPosition);
}
function HideNavigation()
{
    popupMenu.DelayHide();
    //popupMenu.DelayTimer = window.setTimeout('popupMenu.Hide()', 100);
}

/**********Credit End************/

/**********Send Email************/

function SendEmail(sender, senderName, reciever, recieverName, title, content, SuccessHandler)
{
    Qibu.Web.WebService.User.SendEmail(sender, senderName, reciever, recieverName, title, content, SuccessHandler);
}

/**********Send Email End ********/

/********** Initial Panel ********/
/*
    弹出菜单（面向对象）
    divElement:需要显示的div
    isFix:是否跟随屏幕滚动                          默认为true
    canMove:是否可以使用鼠标移动其位置              默认为false
    left:左顶点绝对位置                             默认为0
    top:上顶点绝对位置                              默认为0
    width:宽度                                      默认为divElement的宽度
    height:高度                                     默认为divElement的高度
    showBackground:是否在弹出时将背景打灰           默认为false
    selfClickClose:菜单内部点击是否关闭菜单         默认为false
    outClickClose:菜单外部点击是否关闭菜单          默认为false
*/
function CreatePanel(divElement, isFixed, canMove, left, top, width, height, showBackground, selfClickClose, outClickClose, closeHandler) 
{
    divElement.style.left = "0px";
    divElement.style.top = "0px";
    divElement.style.display = "none";
    var panel = new System.Controls.Panel(divElement);
    
    // 设置大小
    var size = {width:width,height:height};
    if(width == undefined || width == null || height == undefined || height == null)
    {
        size = System.Document.getElementSize(divElement);
    }
    panel.setSize(size);
    
    // 设置位置锁定
    if(isFixed == false)
    {
        panel.isFixed = false;
    }
    else
    {
        panel.isFixed = true;
    }
    
    // 设置是否可移动位置
    if(canMove == true)
    {
        panel.canMove = true;
    }
    else
    {
        panel.canMove = false;
    }
    
    // 设置位置（预设，如果选择了isFix = true，则显示后需要再次设置以保证位置正确）
    var position = {left:left,top:top};
    if(left == undefined || left == null)
    {
        position.left = 0;
    }
    if( top == undefined || top == null)
    {
        position.top = 0;
    }
    panel.setPosition(position);
    
    // 设置背景
    if(showBackground == true)
    {
        //panel.setSize();
    }
    
    // 设置内部点击关闭
    if(selfClickClose == true)
    {
        System.Event.addEventListener(panel.element, "click", panel.close.createDelegate(panel), false);
    }
    
    // 设置外部点击关闭
    if(outClickClose == true)
    {
        
    }
    
    // 设置关闭panel事件的响应
    if(closeHandler != null && closeHandler != undefined)
    {
        panel.close = closeHandler;
    }
    
    divElement.style.display = "none";
    return panel;
}

function getAreaCenterPosition(width, height)
{
    var areaPosition = System.Document.getVisibleAreaPosition();
    var leftPosition = areaPosition[0].left + ((areaPosition[1].left - areaPosition[0].left)/2) - width;
    var topPosition = areaPosition[0].top + ((areaPosition[1].top - areaPosition[0].top)/2) - height;
    
    return {left:leftPosition,top:topPosition};
}

function ShowDiv(showDiv, divWidth, divHeight)
{
    if(showDiv == undefined)
    {
        return undefined;
    }
    else
    {
        divPanel = CreatePanel(showDiv, true, false, null, null, divWidth, divHeight, false, false, false, null);
        
        divPanel.show();
        
        var spos = System.Document.getScrollPosition();
        var dsize = System.Document.getVisibleDocumentSize();
        var esize = System.Document.getElementSize(showDiv);
        var divLeft = Math.floor((dsize.width - esize.width)/2) + spos.left;
        var divTop = Math.floor((dsize.height - esize.height)/2) + spos.top;
        
        divPanel.setPosition({top:divTop,left:divLeft});
        
        divPanel.setStyle("zIndex",99999);
        
        return divPanel;
    }
}

function GetCenterPosition(showDiv)
{
    var spos = System.Document.getScrollPosition();
    var dsize = System.Document.getVisibleDocumentSize();
    var esize = System.Document.getElementSize(showDiv);
    var divLeft = Math.floor((dsize.width - esize.width)/2) + spos.left;
    var divTop = Math.floor((dsize.height - esize.height)/2) + spos.top;
    
    return {top:divTop,left:divLeft};
}

function ClosePanel(panelList)
{
    panelList[panelList.length-1].close();
    panelList.splice(panelList.length-1, 1)
}

/********** Initial Panel End ******/

/********** 推荐给好友 ************/

/// <summary>
/// 推荐给好友
/// </summary>
/// <param name="usernames">要推荐的好友用户名，用";"隔开</param>
/// <param name="title">标题</param>
/// <param name="content">内容</param>
/// <param name="recommendContentType">推荐内容类别,见BusinessFacade.Enumeration.ContentType</param>
/// <param name="targetLink">推荐目标链接</param>
/// <param name="targetName">推荐目标名称</param>
/// <param name="feedbackHandler">处理反馈的函数</param>
/// <returns>发送失败的用户名列表</returns>
function SendRecommendToFiends(usernames, title, content, recommendContentType, recommendContentLink, recommendContentName, feedbackHandler)
{
    ShowProcess("发送数据中，请稍后...");
    Qibu.Web.WebService.Friend.SendRecommandToFriend(usernames, title, content, recommendContentType, recommendContentLink, recommendContentName, feedbackHandler);
}

/******************************************************************************************************/

/******************************************** 更新邮件 **********************************************/

function InitialNewEmailPanel(userID, actionPage)
{
    if(!window.setNewEmailPanel)
    {
        var setNewEmailDiv = InitialPopupMenu();
        setNewEmailDiv.id = "setNewEmailDiv";
        setNewEmailDiv.className = "Direct_Successbox";
        setNewEmailDiv.style.width = "472px";
        setNewEmailDiv.display = 'none';
    }
    else
    {
        setNewEmailPanel.show();
    }
    
    var html = '';
    
    html += '<form id="form2" action="'+actionPage+'?id='+userID+'" method="post">';
    html += '<div class="close"><a href="javascript:void(0)" onclick="setNewEmailPanel.close()" class="f3">[关闭]</a></div>';
    html += '<div class="content">';
    html += '<div class="alert"><strong>您修改后我们将会在您的新邮箱中发送激活信，请注意查收！</strong>';
    html += '<div> <strong>输入您的新邮箱：</strong>';    
    html += '<input name="txtNewEmail" type="text" class="input3" id="txtNewEmail" style="width:130px" />';    
    html += '@<input name="txtNewEmailTail" type="text" class="input3" id="txtNewEmailTail" style="width:60px" />';    
    html += '</div>';    
    html += '</div>';  
    html += '<div class="op" align="right" style="padding-right:10px"><input name="Submit" type="submit" class="input2" id="Submit" value="确 认" /> <input name="Submit" type="button" onclick="setNewEmailPanel.close()" class="input2" id="Submit" value="取 消" /></div>';  
    html += '</div>';
    html += '<div class="clear"></div>';  
    html += '</form>';
    $("setNewEmailDiv").innerHTML = html;
    
    setNewEmailPanel = CreatePanel($("setNewEmailDiv"), true, false, null, null, 472, 170, false, false, false, null);
    setNewEmailPanel.show();
    setNewEmailPanel.setStyle("zIndex",99);
}

/******************************************************************************************************/

/******************************************** 更新手机 **********************************************/

function InitialNewMobilePanel(userID, actionPage)
{
    if(!window.setNewMobilePanel)
    {
        var setNewMobileDiv = InitialPopupMenu();
        setNewMobileDiv.id = "setNewMobileDiv";
        setNewMobileDiv.className = "Direct_Successbox";
        setNewMobileDiv.style.width = "472px";
        setNewMobileDiv.display = 'none';
    }
    else
    {
        setNewMobilePanel.show();
    }
    
    var html = '';
    
    html += '<form id="form2" action="'+actionPage+'?id='+userID+'" method="post">';
    html += '<div class="close"><a href="javascript:void(0)" onclick="setNewMobilePanel.close()" class="f3">[关闭]</a></div>';
    html += '<div class="content">';
    html += '<div class="alert"><strong></strong>';
    html += '<div> <strong>输入您的新手机：</strong>';    
    html += '<input name="txtNewMobile" type="text" class="input3" id="txtNewMobile" style="width:130px" />';    
    html += '</div>';    
    html += '</div>';  
    html += '<div class="op" align="right" style="padding-right:10px"><input name="Submit" type="submit" class="input2" id="Submit" value="确 认" /> <input name="Submit" type="button" onclick="setNewMobilePanel.close()" class="input2" id="Submit" value="取 消" /></div>';  
    html += '</div>';
    html += '<div class="clear"></div>';  
    html += '</form>';
    $("setNewMobileDiv").innerHTML = html;
    
    setNewMobilePanel = CreatePanel($("setNewMobileDiv"), true, false, null, null, 472, 170, false, false, false, null);
    setNewMobilePanel.show();
    setNewMobilePanel.setStyle("zIndex",99);
}

/******************************************************************************************************/

/******************************************** 选择好友界面 **********************************************/
var selectFriendPanel;

function InitialFriendSelectPanel(userID)
{

    if(!window.selectFriendPanel)
    {
        var selFriendDiv = InitialPopupMenu();
        selFriendDiv.id = "selFriendDiv";
        selFriendDiv.className = "popbox";
        selFriendDiv.style.width = "461px";
        selFriendDiv.style.height = "313px";
        selFriendDiv.style.display = 'none';

        var html = '';
        html += '<div class="content">';
        html += '<div class="bg" style="height:299px">';
        html += '<div style="position:absolute;right:10px; bottom:10px;width:200px;text-align:right">';
        html += '<input name="Submit" type="button" class="xx_bluebutton" value="确 定" onclick="$(\'txtRecievers\').value = GetFriendNames();selectFriendPanel.close()" /> ';
        html += '<input name="Submit" type="button" class="xx_bluebutton" value="取 消" onclick="window.location.href = window.location.href;selectFriendPanel.close()" />';
        html += '</div>';
        html += '<div class="close" style="float:right;display:none"> <a href="javascript:selectFriendPanel.close()">[关闭]</a> </div>';
        html += '<div> 选择好友分类：';
        html += '<select id="selApplyFriendType" onchange="if(this.selectedIndex==this.options.length-1){GetFriendByUserIDPaged('+userID+', this.value, 0, 0, 10000, GetFriendByFriendTypeSuccess)}else{GetFriendByUserIDPaged('+userID+', -1, this.value, 0, 10000, GetFriendByFriendTypeSuccess)}">';
        html += '<option value="0">请选择好友分类</option>';
        html += '</select>';
        //        html += '<select>';
        //        html += '<option>选择分类2级 </option>';
        //        html += '</select>';
        html += '</div>';
        html += '<div style="padding-top:5px;">';
        html += '<div style="float:left;width:144px;height:170px">';
        html += '<div style="text-align:center;height:30px;line-height:30px">候选名单</div>';
        html += '<div style="text-align:center;">';
        html += '<select id="friendList" multiple="multiple"  size="10"  style="width: 135px;height:132px"></select>';
        html += '</div>';
        html += '</div>';
        html += '<div style="float:left;width:68px;padding-top:55px">';
        html += '<input name="Submit" type="button" class="xx_bluebutton" value="添加 >>" onclick="AddSelectedFriend()" />';
        html += '<br />';
        html += '<input name="Submit" type="button" class="xx_bluebutton" value="全部 >>" onclick="AddAllFriends()" />';
        html += '<br />';
        html += '<input name="Submit" type="button" class="xx_bluebutton" value="<< 取消" onclick="RemoveSelectedFriend()" />';
        html += '</div>';
        html += '<div style="float:left;width:144px;height:170px">';
        html += '<div style="text-align:center;height:30px;line-height:30px">已选择的名单</div>';
        html += '<div style="text-align:center;">';
        html += '<select id="candidateList" multiple="multiple"  size="10"  style="width: 135px;height:132px "></select>';
        html += '</div>';
        html += '</div>';
        html += '<div class="clear"></div>';
        html += '</div>';
        html += '<div style="height:24px;line-height:24px; text-indent:7px"> 您共选择了<span id="candidateNumberSpan">0</span>名好友。 </div>';
        html += '</div>';
        html += '</div>';

        selFriendDiv.innerHTML = html;
        selectFriendPanel = CreatePanel($("selFriendDiv"), true, false, 0, 0, 461, 313, false, false, false, null);
        selectFriendPanel.show();
        selectFriendPanel.setStyle("zIndex",99);
    }
    else
    {
        selectFriendPanel.setInnerHTML($("selFriendDiv").innerHTML, true);
        selectFriendPanel.show();
    }

    GetNotEmptyFriendTypes();
    window.setTimeout( 
        'if($("selApplyFriendType").selectedIndex==$("selApplyFriendType").options.length-1){GetFriendByUserIDPaged('+userID+', $("selApplyFriendType").value, 0, 0, 10000, GetFriendByFriendTypeSuccess)}else{GetFriendByUserIDPaged('+userID+', -1, $("selApplyFriendType").value, 0, 10000, GetFriendByFriendTypeSuccess)}',1000
    )
}

function GetFriendByFriendTypeSuccess(result)
{
    HideProcess();
    if(result[0] == null)
    {
        alert('获取失败');
        return;
    }
    for(var i=0; i<$("friendList").options.length; i++)
    {
        $("friendList").remove(0);
        i--;
    }
    var ci = 0;
    for(var i=0; i<result[0].length; i++)
    {
        var selected = false;
        for(var j=0; j<$("candidateList").options.length; j++)
        {
            if($("candidateList").options[j].value == result[0][i].Username)
            {
                selected = true;
            }
        }
        if(!selected)
        {
            $("friendList").options[ci++] = new Option(result[0][i].Realname + '[' + result[0][i].Username + ']', result[0][i].Username);
        }
    }
}

function AddSelectedFriend()
{
    var candidateList = $("candidateList");
    var doctorList = $("friendList");
    for(var i=0; i<doctorList.options.length; i++)
    {
        var ci = candidateList.options.length;
        if(doctorList.options[i].selected)
        {
            //check out whether this item is already in the candidate list
            var isExisting = false;
            for(var j=0;j<ci;j++)
            {
                if(doctorList.options[i].value == candidateList.options[j].value)
                {
                   isExisting = true;
                   break; 
                }
            }
            if(!isExisting)
            {
                candidateList.options[ci] = new Option(doctorList.options[i].text, doctorList.options[i].value);
                doctorList.remove(i--);
            }
        }
    }
    //updateDoctorsNum();
    $("candidateNumberSpan").innerHTML = candidateList.options.length;
}

function AddAllFriends()
{
    var candidateList = $get("candidateList");
    var doctorList = $get("friendList");
    var length = doctorList.options.length;
    for(var i=0; i<length; i++)
    {
        if(doctorList.options[i])
        {
            var ci = candidateList.options.length;
            var isExisting = false;
            for(var j=0;j<ci;j++)
            {
                if(doctorList.options[i].value == candidateList.options[j].value)
                {
                   isExisting = true;
                   break; 
                }
            }
            if(!isExisting)
            {
                candidateList.options[ci] = new Option(doctorList.options[i].text, doctorList.options[i].value);
                doctorList.remove(i);
                i--;
            }
        }
    }
    //updateDoctorsNum();
    $("candidateNumberSpan").innerHTML = candidateList.options.length;
}

function RemoveSelectedFriend()
{
    var candidateList = $get("candidateList");
    var doctorList = $get("friendList");
    
    for(var i=0; i<candidateList.options.length; i++)
    {
        var ci = doctorList.options.length;
        if(candidateList.options[i].selected)
        {
            var isExisting = false;
            for(var j=0;j<ci;j++)
            {
                if(candidateList.options[i].value == doctorList.options[j].value)
                {
                   isExisting = true;
                   break; 
                }
            }
            if(!isExisting)
            {
                doctorList.options[ci] = new Option(candidateList.options[i].text, candidateList.options[i].value);
                candidateList.remove(i--);
            }
        }
    }
    //updateDoctorsNum();
    $("candidateNumberSpan").innerHTML = candidateList.options.length;
}

function GetFriendNames()
{
    var candidateList = $get("candidateList");
    
    var userNames = new Array();
    for(var i=0; i<candidateList.options.length; i++)
    {
        userNames[i] = candidateList.options[i].value;
    }
    
    var names="";
    for (var i = 0; i < userNames.length; i++)
    {
        names += userNames[i]+ ";";
    }
    $("recieverNumberSpan").innerHTML = userNames.length;
    return names;
}

/******************************************************************************************************/

/******************************************** 选择省市界面 **********************************************/

var citys;
var selectedProvince;
var htmlcity = '';
var htmltemp = '';
var Provinces = '';
var selectedProvinceID = 0;
var selectedCityID = 0;
var targetControl;
/// <summary>
/// 生成选择省市的界面
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="control">锚定的控件</param>
function InitialCitysSelectPanel(control)
{
    if(!window.selectCityPanel)
    {
        var selCityDiv = InitialPopupMenu();
        selCityDiv.id = "selCityDiv";
        selCityDiv.className = "ball";
        selCityDiv.style.width = "515px";
        selCityDiv.style.display = 'none';
        targetControl = control;
        LoadProvinces();
    }
    else
    {
        var divMainLeft = GetOffsetLeft(control);
        var divMainTop = GetOffsetTop(control) + 20;
        selectCityPanel.show();
        selectCityPanel.setPosition({left:divMainLeft,top:divMainTop});
    }
}
/// <summary>
/// 获取所有省市列表
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="feedBackFunction">处理反馈的函数</param>
function LoadProvinces(feedBackFunction)
{
    if(feedBackFunction == undefined)
    {
        feedBackFunction = LoadProvincesSuccess;
    }
    Qibu.Web.WebService.Register.GetAllProvinces(feedBackFunction);
}
/// <summary>
/// 根据省ID，获取该省的城市列表
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="ProvincesID">选定的省ID</param>
/// <param name="feedBackFunction">处理反馈的函数</param>
function LoadCity(ProvincesID, feedBackFunction)
{
    if(feedBackFunction == undefined)
    {
        feedBackFunction = LoadCitySuccess;
    }
    Qibu.Web.WebService.Register.GetCityByProvinceID(ProvincesID,feedBackFunction);
}
/// <summary>
/// 默认的省市列表获取反馈处理函数
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="result">反馈</param>
function LoadProvincesSuccess(result)
{
    var columnNumber = 12;
    //HideProcess();
    if(result == null)
    {
        alert("系统错误");
    }
    
    Provinces = result;
    
    htmlcity = '';
    htmlcity += '<div>';
    htmlcity += '<div class="ball_xian"></div>';
    htmlcity += '<div class="close"><a href="javascript:void(0)" onclick="selectCityPanel.close()" class="fr4" style="color:#03317e">[关闭]</a></div>';
    htmlcity += '<div class="clear"></div>';
    htmlcity += '</div>';
    htmlcity += '<div class="ball_bg">';
    htmlcity += '<div class="sheng">';
    htmlcity += '<div class="mingcheng">';
    htmlcity += '<ul>';
    
    var rowNumber = Math.floor((Provinces.length - 1) / columnNumber) + 1;
    
    for(var i=0; i<rowNumber; i++)
    {
        htmlcity += '<li>';
        
        for(var j=i*columnNumber; j<(i+1)*columnNumber; j++)
        {
            if(j == Provinces.length)
            {
                break;
            }
            htmlcity += '<div class="m1"><a href="javascript:void(0)" onfocus="LoadCity('+Provinces[j].ProvinceID+');selectedProvince='+j+';SwitchProvinceStyle('+j+', \'aProvince\')" class="fr4" style="color:#03317e" id="aProvince'+j+'">'+Provinces[j].Name+'</a></div> ';
        }
        htmlcity += '<div class="clear"></div>            ';
        htmlcity += '</li>';
    }
    htmlcity += '</ul>                   ';
    htmlcity += '</div> ';
    htmlcity += '</div>';
    htmlcity += '<div id="divCityList"></div>';
    htmlcity += '</div>';
    
    $("selCityDiv").innerHTML = htmlcity;
    
    var divMainLeft = GetOffsetLeft(targetControl);
    var divMainTop = GetOffsetTop(targetControl) + 20;
    if(!window.selectCityPanel)
    {
        selectCityPanel = CreatePanel($("selCityDiv"), false, false, divMainLeft, divMainTop, 515, 340, false, false, false, null);
        selectCityPanel.show();
        selectCityPanel.setStyle("zIndex",99);
        selectCityPanel.setPosition({left:divMainLeft,top:divMainTop});
    }
    else
    {
        selectCityPanel.setInnerHTML($("selCityDiv").innerHTML, true);
        selectCityPanel.show();
        selectCityPanel.setPosition({left:divMainLeft,top:divMainTop});
    }
}

function SwitchProvinceStyle(index, prefix)
{
    if(Provinces != null && Provinces != undefined)
    {
        for(var i=0; i<Provinces.length; i++)
        {
            if($(prefix+i))
            {
                if( i == index)
                {
                    $(prefix+i).style.fontWeight = 'bold';
                }
                else
                {
                    $(prefix+i).style.fontWeight = 'normal';
                }
            }
        }
    }
}
/// <summary>
/// 默认的城市列表获取反馈处理函数
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="result">反馈</param>
function LoadCitySuccess(result)
{
    var columnNumber = 9;
    //HideProcess();
    if(result == null)
    {
        alert("系统错误");
    }
    
    citys = result;
    resultList = result;
    htmlcity.replace(htmltemp,' ');
    

    htmltemp = '';
    
    htmltemp += '<ul class="chengshi">';
    
    var rowNumber = Math.floor((citys.length - 1) / columnNumber) + 1;
    
//    for(var i=0; i<rowNumber; i++)
//    {
//        htmlcity += '<li>';
//        for(var j=i*columnNumber; j<(i+1)*columnNumber; j++)
//        {
//            if(j == citys.length)
//            {
//                break;
//            }
//            var className = "s1";
//            if(citys[j].Name.length > 3)
//            {
//                className = "s2";
//                columnNumber -= 1;
//            }
//            if(citys[j].Name.length > 8)
//            {
//                className = "s3";
//                columnNumber -= 2;
//            }
//            htmltemp += '<div class="'+className+'"><a href="javascript:void(0)" onclick="$(\'txtcity\').value = \''+Provinces[selectedProvince].Name+' '+citys[j].Name+'\';selectedCityID='+citys[j].CityID+';selectCityPanel.close();if(ValidateCityLocus){ValidateCityLocus($(\'txtcity\').value);if($(\'selHospital\')){LoadHospitalByCityID('+citys[j].CityID+')}}" class="fr4" style="color:#03317e">'+citys[j].Name+'</a></div> ';
//        }
//        htmltemp += '<div class="clear"></div>            ';
//        htmltemp += '</li>';
//        columnNumber = 9;
//    }
    
    var col = 1;
    for(var i=0; i<citys.length;i++)
    {
        if(col == 1)
        {
            htmltemp += '<li>';
        }
        var className = "s1";
        if(citys[i].Name.length > 3)
        {
            className = "s2";
            col += 1;
        }
        if(citys[i].Name.length > 8)
        {
            className = "s3";
            col += 2;
        }
        if(col > columnNumber)
        {
            htmltemp += '<div class="clear"></div>            ';
            htmltemp += '</li>';
            i--;
            col = 1;
            continue;
        }
        htmltemp += '<div class="'+className+'"><a href="javascript:void(0)" onclick="$(\'txtcity\').value = \''+Provinces[selectedProvince].Name+' '+citys[i].Name+'\';selectedCityID='+citys[i].CityID+';selectCityPanel.close();if(ValidateCityLocus){ValidateCityLocus($(\'txtcity\').value);if($(\'selHospital\')){LoadHospitalByCityID('+citys[i].CityID+')}}" class="fr4" style="color:#03317e">'+citys[i].Name+'</a></div> ';
        col++;
    }
    htmltemp += '<div class="clear"></div>            ';
    htmltemp += '</li>';
    htmltemp += '</ul>     ';
    
    $("divCityList").innerHTML = htmltemp;
    selectCityPanel.setInnerHTML($("selCityDiv").innerHTML, true);
}

/******************************************************************************************************/

/******************************************** 选择职称、职务、团体协会、专业关注、专业擅长界面 **********************************************/

var Positions;
var Professions;
var Associations;
var Hobbys;

var DiseaseTypes = new Array("内科疾病","皮肤性病科疾病","传染病科疾病","耳鼻喉科疾病","骨科疾病","外科疾病","男科疾病","精神病科疾病","中医科疾病","小儿科疾病","急诊科疾病","结核病科疾病","康复医学科疾病","口腔科疾病","介入治疗科疾病","烧伤科疾病","肿瘤科疾病","妇产科疾病","眼科疾病","预防保健科疾病","运动医学科疾病","疼痛科疾病","营养科疾病");
var OutputElementID = "";

/// <summary>
/// 生成选择职务的界面
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="control">锚定的控件</param>
/// <param name="feedBackFunction">处理反馈的函数</param>
function InitialPositionSelectPanel(control, feedBackFunction)
{
    targetControl = control;
    if(!window.selectPositionPanel)
    {
        var selPositionDiv = InitialPopupMenu();
        selPositionDiv.id = "selPositionDiv";
        selPositionDiv.className = "Direct_selectbox";
        selPositionDiv.style.width = "532px";
        selPositionDiv.style.display = 'none';
    }
    LoadPosition(feedBackFunction);
}
/// <summary>
/// 获取所有职务列表
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="feedBackFunction">处理反馈的函数</param>
function LoadPosition(feedBackFunction)
{
    if(feedBackFunction == undefined)
    {
        feedBackFunction = LoadPositionSuccess;
    }
    Qibu.Web.WebService.Register.GetAllPositions(feedBackFunction);
}

/// <summary>
/// 默认的职务列表获取反馈处理函数
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="result">反馈</param>
function LoadPositionSuccess(result)
{
    if(result == null)
    {
        alert("系统错误");
    }
    var txtPosition = $("txtPosition");
    
    Positions = result;
    resultList = result;
    
    html = '';
   
    html += '<div class="tit" style="background:url(/Themes/Admin/titbar.gif) 5px 8px no-repeat;height:20px">';
    html += '<div class="abs" style="background:#eefaff;right:0"><a href="javascript:void(0)" onclick="selectPositionPanel.close()">[关闭]</a></div>';
    html += '</div>';
    html += '<div class="content" style="width:519px;padding-left:15px">';
    html += '<ul class="domain">';
    for(var i=0; i<Positions.length; i++)
    {
        html += '<li><input type="checkbox" value="'+Positions[i].Name+'" id="chkPosition'+i+'" />'+Positions[i].Name+'</li>';
    }
    html += '</ul>';
    html += '<div class="clear"></div>';
    html += '<div style="padding:0 0 8px 10px">';
    html += '<input name="Submit22" type="button" class="input2" id="Submit22" value="确 定" onclick="OutputPosition($(\'txtPosition\'));" />   ';
    html += '<input name="Submit222" type="button" class="input2" id="Submit222" value="关 闭" onclick="selectPositionPanel.close()" />   ';
    html += '<input name="Submit222" type="button" class="input2" id="Submit222" value="全 选" onclick="ChangeAllChecked(\'checked\', \'chkPosition\')" />   ';
    html += '<input name="Submit222" type="button" class="input2" id="Submit222" value="清 空" onclick="ChangeAllChecked(\'\', \'chkPosition\')" />   ';
    html += '</div>';

    $("selPositionDiv").innerHTML = html;
    var divMainLeft, divMainTop;
    var fixed = false;
    if(targetControl == undefined)
    {
        fixed = true;
    }
    else
    {
        divMainLeft = GetOffsetLeft(targetControl);
        divMainTop = GetOffsetTop(targetControl) + 18;
    }
    if(!window.selectPositionPanel)
    {
        selectPositionPanel = CreatePanel($("selPositionDiv"), fixed, false, divMainLeft, divMainTop, 550, 250, false, false, false, null);
        selectPositionPanel.show();
        selectPositionPanel.setStyle("zIndex",99);
        if(!fixed)
        {
            selectPositionPanel.setPosition({left:divMainLeft,top:divMainTop});
        }
    }
    else
    {
        selectPositionPanel.show();
        if(!fixed)
        {
            selectPositionPanel.setPosition({left:divMainLeft,top:divMainTop});
        }
    }
}

/// <summary>
/// 在目标控件中显示选择的结果
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="outputElement">目标控件</param>
function OutputPosition(outputElement)
{
    var Names = "";
    for(var i=0; i<Positions.length; i++)
    {
        if($("chkPosition"+i).checked)
        {
            Names += $("chkPosition"+i).value + ";";
        }
    }
    outputElement.value = Names;
    selectPositionPanel.close();
    if(window.ValidatePosition)
    {
        ValidatePosition();
    }
}


/// <summary>
/// 生成选择职称的界面
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="control">锚定的控件</param>
/// <param name="feedBackFunction">处理反馈的函数</param>
function InitialProfessionSelectPanel(control, feedBackFunction)
{
    targetControl = control;
    if(!window.selectProfessionPanel)
    {
        var selProfessionDiv = InitialPopupMenu();
        selProfessionDiv.id = "selProfessionDiv";
        selProfessionDiv.className = "Direct_msgbox";
        selProfessionDiv.style.width = "532px";
        selProfessionDiv.display = 'none';
    }
    
    LoadProfession(feedBackFunction);
}
/// <summary>
/// 获取所有职称列表
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="feedBackFunction">处理反馈的函数</param>
function LoadProfession(feedBackFunction)
{
    if(feedBackFunction == undefined)
    {
        feedBackFunction = LoadProfessionSuccess;
    }
    Qibu.Web.WebService.Register.GetAllProfessions(feedBackFunction);
}

/// <summary>
/// 默认的职称列表获取反馈处理函数
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="result">反馈</param>
function LoadProfessionSuccess(result)
{
    if(result == null)
    {
        alert("系统错误");
    }
    var txtProfession = $("txtProfession");
    
    Professions = result;
    resultList = result;
    
    html = '';
  
    html += '<div class="tit" style="background:url(/Themes/Admin/titbar.gif) 5px 8px no-repeat;height:20px">';
    html += '<div class="abs" style="background:#eefaff;right:0"><a href="javascript:void(0)" onclick="selectProfessionPanel.close()">[关闭]</a></div>';
    html += '</div>';
    html += '<div class="content" style="width:519px;padding-left:15px">';
    html += '<ul class="domain">';
    for(var i=0; i<Professions.length; i++)
    {
        html += '<li><input type="checkbox" value="'+Professions[i].Name+'" id="chkProfession'+i+'" />'+Professions[i].Name+'</li>';
    }
    html += '</ul>';
    html += '<div class="clear"></div>';
    html += '<div style="padding:0 0 8px 10px">';
    html += '<input name="Submit22" type="button" class="input2" id="Submit22" value="确 定" onclick="OutputProfession($(\'txtProfession\'));" />   ';
    html += '<input name="Submit222" type="button" class="input2" id="Submit222" value="关 闭" onclick="selectProfessionPanel.close()" />   ';
    html += '<input name="Submit222" type="button" class="input2" id="Submit222" value="全 选" onclick="ChangeAllChecked(\'checked\', \'chkProfession\')" />   ';
    html += '<input name="Submit222" type="button" class="input2" id="Submit222" value="清 空" onclick="ChangeAllChecked(\'\', \'chkProfession\')" />   ';
    html += '</div>';

    $("selProfessionDiv").innerHTML = html;
    
    var divMainLeft, divMainTop;
    var fixed = false;
    if(targetControl == undefined)
    {
        fixed = true;
    }
    else
    {
        divMainLeft = GetOffsetLeft(targetControl);
        divMainTop = GetOffsetTop(targetControl) + 18;
    }
    if(!window.selectProfessionPanel)
    {
        selectProfessionPanel = CreatePanel($("selProfessionDiv"), fixed, false, divMainLeft, divMainTop, 550, 250, false, false, false, null);
        selectProfessionPanel.show();
        selectProfessionPanel.setStyle("zIndex",99);
        if(!fixed)
        {
            selectProfessionPanel.setPosition({left:divMainLeft,top:divMainTop});
        }
    }
    else
    {
        selectProfessionPanel.show();
        if(!fixed)
        {
            selectProfessionPanel.setPosition({left:divMainLeft,top:divMainTop});
        }
    }
}

/// <summary>
/// 在目标控件中显示选择的结果
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="outputElement">目标控件</param>
function OutputProfession(outputElement)
{
    var Names = "";
    for(var i=0; i<Professions.length; i++)
    {
        if($("chkProfession"+i).checked)
        {
            Names += $("chkProfession"+i).value + ";";
        }
    }
    outputElement.value = Names;
    selectProfessionPanel.close();
    if(window.ValidateProfession)
    {
        ValidateProfession();
    }
}


/// <summary>
/// 生成选择专业分类的界面
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="control">锚定的控件</param>
/// <param name="feedBackFunction">处理反馈的函数</param>
function InitialProfessionFieldSelectPanel(control, feedBackFunction)
{
    targetControl = control;
    if(!window.selectProfessionFieldPanel)
    {
        var selProfessionFieldDiv = InitialPopupMenu();
        selProfessionFieldDiv.id = "selProfessionFieldDiv";
        selProfessionFieldDiv.className = "Direct_msgbox";
        selProfessionFieldDiv.style.width = "532px";
        selProfessionFieldDiv.display = 'none';
    }
    
    LoadProfessionField(feedBackFunction);
}


/// <summary>
/// 获取所有专业分类列表
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="feedBackFunction">处理反馈的函数</param>
function LoadProfessionField(feedBackFunction)
{
    if(feedBackFunction == undefined)
    {
        feedBackFunction = LoadProfessionFieldSuccess;
    }
    Qibu.Web.WebService.Register.GetAllProfessionFields(feedBackFunction);
}

/// <summary>
/// 默认的专业分类列表获取反馈处理函数
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="result">反馈</param>
function LoadProfessionFieldSuccess(result)
{
    if(result == null)
    {
        alert("系统错误");
    }
    var txtProfessionField = $("txtProfessionField");
    
    ProfessionFields = result;
    resultList = result;
    
    html = '';
  
    html += '<div class="tit" style="background:url(/Themes/Admin/titbar.gif) 5px 8px no-repeat;height:20px">';
    html += '<div class="abs" style="background:#eefaff;right:0"><a href="javascript:void(0)" onclick="selectProfessionFieldPanel.close()">[关闭]</a></div>';
    html += '</div>';
    html += '<div class="content" style="width:519px;padding-left:15px">';
    html += '<ul class="domain">';
    for(var i=0; i<ProfessionFields.length; i++)
    {
        html += '<li><input type="checkbox" value="'+ProfessionFields[i].Name+'" id="chkProfessionField'+i+'" />'+ProfessionFields[i].Name+'</li>';
    }
    html += '</ul>';
    html += '<div class="clear"></div>';
    html += '<div style="padding:0 0 8px 10px">';
    html += '<input name="Submit22" type="button" class="input2" id="Submit22" value="确 定" onclick="OutputProfessionField($(\'txtProfessionField\'));" />   ';
    html += '<input name="Submit222" type="button" class="input2" id="Submit222" value="关 闭" onclick="selectProfessionFieldPanel.close()" />   ';
    html += '<input name="Submit222" type="button" class="input2" id="Submit222" value="全 选" onclick="ChangeAllChecked(\'checked\', \'chkProfessionField\')" />   ';
    html += '<input name="Submit222" type="button" class="input2" id="Submit222" value="清 空" onclick="ChangeAllChecked(\'\', \'chkProfessionField\')" />   ';
    html += '</div>';

    $("selProfessionFieldDiv").innerHTML = html;
    
    var divMainLeft, divMainTop;
    var fixed = false;
    if(targetControl == undefined)
    {
        fixed = true;
    }
    else
    {
        divMainLeft = GetOffsetLeft(targetControl);
        divMainTop = GetOffsetTop(targetControl) + 18;
    }
    if(!window.selectProfessionFieldPanel)
    {
        selectProfessionFieldPanel = CreatePanel($("selProfessionFieldDiv"), fixed, false, divMainLeft, divMainTop, 550, 250, false, false, false, null);
        selectProfessionFieldPanel.show();
        selectProfessionFieldPanel.setStyle("zIndex",99);
        if(!fixed)
        {
            selectProfessionFieldPanel.setPosition({left:divMainLeft,top:divMainTop});
        }
    }
    else
    {
        selectProfessionFieldPanel.show();
        if(!fixed)
        {
            selectProfessionFieldPanel.setPosition({left:divMainLeft,top:divMainTop});
        }
    }
}

/// <summary>
/// 在目标控件中显示选择的结果
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="outputElement">目标控件</param>
function OutputProfessionField(outputElement)
{
    var Names = "";
    for(var i=0; i<ProfessionFields.length; i++)
    {
        if($("chkProfessionField"+i).checked)
        {
            Names += $("chkProfessionField"+i).value + ";";
        }
    }
    outputElement.value = Names;
    selectProfessionFieldPanel.close();
    if(window.ValidateProfessionField)
    {
        ValidateProfessionField();
    }
}

/// <summary>
/// 生成选择团体协会的界面
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="control">锚定的控件</param>
/// <param name="feedBackFunction">处理反馈的函数</param>
function InitialAssociationSelectPanel(control, feedBackFunction)
{
    targetControl = control;
    if(!window.selectAssociationPanel)
    {
        var selAssociationDiv = InitialPopupMenu();
        selAssociationDiv.id = "selAssociationDiv";
        selAssociationDiv.className = "Direct_msgbox";
        selAssociationDiv.style.width = "532px";
        selAssociationDiv.display = 'none';
    }
    LoadAssociation(feedBackFunction);
}

/// <summary>
/// 获取所有团体协会列表
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="feedBackFunction">处理反馈的函数</param>
function LoadAssociation(feedBackFunction)
{
    if(feedBackFunction == undefined)
    {
        feedBackFunction = LoadAllAssociationSuccess;
    }
    Qibu.Web.WebService.Register.GetAllAssociations(feedBackFunction);
}

/// <summary>
/// 默认的团体协会列表获取反馈处理函数
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="result">反馈</param>
function LoadAllAssociationSuccess(result)
{
    if(result == null)
    {
        alert("系统错误");
    }
    var txtAssociation = $("txtAssociation");
    
    Associations = result;
    resultList = result;
    
    html = '';
  
    html += '<div class="tit" style="background:url(/Themes/Admin/titbar.gif) 5px 8px no-repeat;height:20px">';
    html += '<div class="abs" style="background:#eefaff;right:0"><a href="javascript:void(0)" onclick="selectAssociationPanel.close()">[关闭]</a></div>';
    html += '</div>';
    html += '<div class="content" style="width:519px;padding-left:15px;overflow:auto">';
    html += '<ul class="domain">';
    for(var i=0; i<Associations.length; i++)
    {
        if(newAssociationID == Associations[i].AssociationID)
        {
            html += '<li style="width:170px;font-size:12px"><input type="checkbox" value="'+Associations[i].Name+'" checked="checked" id="chkAssociation'+i+'" />'+Associations[i].Name+'</li>';
        }
        else
        {
            html += '<li style="width:170px;font-size:12px"><input type="checkbox" value="'+Associations[i].Name+'" id="chkAssociation'+i+'" />'+Associations[i].Name+'</li>';
        }
    }
    html += '</ul>';
    html += '<div class="clear"></div>';
    html += '<div style="padding:0 0 8px 10px">';
    html += '<input name="Submit22" type="button" class="input2" id="Submit22" value="确 定" onclick="OutputAssociation(targetControl);ValidateAssociation()" />   ';
    html += '<input name="Submit222" type="button" class="input2" id="Submit222" value="关 闭" onclick="selectAssociationPanel.close()" />   ';
    html += '<input name="Submit222" type="button" class="input2" id="Submit222" value="全 选" onclick="ChangeAllChecked(\'checked\', \'chkAssociation\')" />   ';
    html += '<input name="Submit222" type="button" class="input2" id="Submit222" value="清 空" onclick="ChangeAllChecked(\'\', \'chkAssociation\')" />   ';
    html += '</div>';

    $("selAssociationDiv").innerHTML = html;
    
    var divMainLeft, divMainTop;
    var fixed = false;
    if(targetControl == undefined)
    {
        fixed = true;
    }
    else
    {
        divMainLeft = GetOffsetLeft(targetControl);
        divMainTop = GetOffsetTop(targetControl) + 18;
    }
    if(!window.selectAssociationPanel)
    {
        selectAssociationPanel = CreatePanel($("selAssociationDiv"), fixed, false, divMainLeft, divMainTop, 550, 800, false, false, false, null);
        selectAssociationPanel.show();
        selectAssociationPanel.setStyle("zIndex",99);
        if(!fixed)
        {
            selectAssociationPanel.setPosition({left:divMainLeft,top:divMainTop});
        }
    }
    else
    {
        selectAssociationPanel.show();
        if(!fixed)
        {
            selectAssociationPanel.setPosition({left:divMainLeft,top:divMainTop});
        }
    }
}

/// <summary>
/// 在目标控件中显示选择的结果
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="outputElement">目标控件</param>
function OutputAssociation(outputElement)
{
    var Names = "";
    for(var i=0; i<Associations.length; i++)
    {
        if($("chkAssociation"+i).checked)
        {
            Names += $("chkAssociation"+i).value + ";";
        }
    }
    outputElement.value = Names;
    selectAssociationPanel.close();
    if(window.ValidateAssociation)
    {
        ValidateAssociation();
    }
}

/// <summary>
/// 获取所有疾病列表
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="control">锚定的控件</param>
/// <param name="feedBackFunction">处理反馈的函数</param>
function InitialDiseaseSelectPanel(control, feedBackFunction)
{
    targetControl = control;
    var divMainLeft, divMainTop;
    var fixed = false;
    if(targetControl == undefined)
    {
        alert("您未指定显示输出的控件！");
        return;
        fixed = true;
    }
    else
    {
        divMainLeft = GetOffsetLeft(targetControl);
        divMainTop = GetOffsetTop(targetControl) + 18;
    }
    if(!window.selectDiseasePanel)
    {
        var selSectionDiv = InitialPopupMenu();
        selSectionDiv.id = "selDiseaseDiv";
        selSectionDiv.className = "Direct_msgbox";
        selSectionDiv.style.width = "532px";
        selSectionDiv.display = 'none';
        //LoadDiseases();
        var html = '';
  
        html += '<div class="tit" style="background:url(/Themes/Admin/titbar.gif) 5px 8px no-repeat;height:20px">';
        html += '<div class="abs" style="background:#eefaff;right:0"><a href="javascript:void(0)" onclick="selectDiseasePanel.close()">[关闭]</a></div>';
        html += '</div>';
        html += '<div class="content" style="width:519px;padding-left:15px">';
        html += '<ul class="domain">';
        for(var i=0; i<DiseaseTypes.length; i++)
        {
            html += '<li><a href="javascript:void(0)" onclick="LoadDiseasesByDiseaseType(\''+DiseaseTypes[i]+'\')">'+DiseaseTypes[i]+'</a></li>';
        }
        html += '</ul>';
        html += '<div class="clear"></div>';
        html += '</div>';
        html += '<div id="diseaseSectionListDiv"></div>';
        
        $("selDiseaseDiv").innerHTML = html;
        
        
        selectDiseasePanel = CreatePanel($("selDiseaseDiv"), fixed, false, divMainLeft, divMainTop, 550, 600, false, false, false, null);
        selectDiseasePanel.show();
        selectDiseasePanel.setStyle("zIndex",99);
        if(!fixed)
        {
            selectDiseasePanel.setPosition({left:divMainLeft,top:divMainTop});
        }
    }
    else
    {
        $("diseaseSectionListDiv").innerHTML = '';
        selectDiseasePanel.show();
        if(!fixed)
        {
            selectDiseasePanel.setPosition({left:divMainLeft,top:divMainTop});
        }
    }
}
/// <summary>
/// 根据疾病类别，获取疾病列表
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="diseaseType">疾病类别</param>
/// <param name="feedBackFunction">处理反馈的函数</param>
function LoadDiseasesByDiseaseType(diseaseType, feedBackFunction)
{
    ShowProcess(PROCESS_STRING);
    if(feedBackFunction == undefined)
    {
        feedBackFunction = LoadDiseaseSuccess;
    }
    Qibu.Web.WebService.Register.GetDiseasesByDiseaseType(diseaseType, LoadDiseaseSuccess);
}
/// <summary>
/// 获取疾病列表的反馈处理函数
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="result">反馈</param>
function LoadDiseaseSuccess(result)
{
    HideProcess();
    if(result == null)
    {
        alert("系统错误");
    }
    var diseaseListDiv = $("diseaseSectionListDiv");
    
    diseases = result;
    resultList = result;
    var diseaseSection = '';
    
    var html = '';
  
    html += '<div class="tit" style="background:url(/Themes/Admin/titbar.gif) 5px 8px no-repeat;height:20px">';
    html += '<div class="abs" style="background:#eefaff;right:0"></div>';
    html += '</div>';
    html += '<div class="content" style="width:519px;padding-left:15px">';
    html += '<ul class="domain">';
    for(var i=0; i<diseases.length; i++)
    {
        if(diseaseSection != diseases[i].DiseaseSection)
        {
            diseaseSection = diseases[i].DiseaseSection;
            html += '<li><a href="javascript:void(0)" onclick="ShowDisease(\''+diseases[i].DiseaseSection+'\')">'+diseases[i].DiseaseSection+'</a></li>';
        }
    }
    html += '</ul>';
    html += '<div class="clear"></div>';
    html += '</div>';
    html += '<div id="diseaseListDiv"></div>';
    
    diseaseListDiv.innerHTML = html;
}
/// <summary>
/// 显示疾病列表
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="diseaseSection">疾病类别列表</param>
function ShowDisease(diseaseSection)
{
    var html = '';
    html += '<div class="tit" style="background:url(/Themes/Admin/titbar.gif) 5px 8px no-repeat;height:20px">';
    html += '<div class="abs" style="background:#eefaff;right:0"></div>';
    html += '</div>';
    html += '<div class="content" style="width:519px;padding-left:15px">';
    html += '<ul class="domain">';
    for(var i=0; i<resultList.length; i++)
    {
        if(diseaseSection == diseases[i].DiseaseSection)
        {
            html += '<li><input type="checkbox" value="'+diseases[i].Name+'" id="chkDisease'+i+'" />'+diseases[i].Name+'</li>';
        }
    }
    html += '</ul>';
    html += '<div class="clear"></div>';
    html += '<div style="padding:0 0 8px 10px">';
    html += '<input name="Submit22" type="button" class="input2" id="Submit22" value="确 定" onclick="OutputDiseases(targetControl);if(window.ValidateSpecialize && window.$(\'txtSpecialize\')){ValidateSpecialize()};if(window.ValidateConcern && window.$(\'txtConcern\')){ValidateConcern();}if(window.ValidateDomain && window.$(\'txtDomain\')){ValidateDomain();}" />   ';
    html += '<input name="Submit222" type="button" class="input2" id="Submit222" value="关 闭" onclick="selectDiseasePanel.close()" />   ';
    html += '<input name="Submit222" type="button" class="input2" id="Submit222" value="全 选" onclick="ChangeAllChecked(\'checked\', \'chkDisease\')" />   ';
    html += '<input name="Submit222" type="button" class="input2" id="Submit222" value="清 空" onclick="ChangeAllChecked(\'\', \'chkDisease\')" />   ';
    html += '</div>';
    
    $("diseaseListDiv").innerHTML = html;
}
/// <summary>
/// 输出选择的疾病列表
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="outputControl">输出控件</param>
function OutputDiseases(outputControl)
{
    var diseaseNames = "";
    for(var i=0; i<resultList.length; i++)
    {
        if($("chkDisease"+i))
        {
            if($("chkDisease"+i).checked)
            {
                diseaseNames += $("chkDisease"+i).value + ";";
            }
        }
    }
    outputControl.value = diseaseNames;
    selectDiseasePanel.close();
}

/// <summary>
/// 获取所有兴趣爱好列表
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="control">锚定的控件</param>
/// <param name="feedBackFunction">处理反馈的函数</param>
function InitialHobbySelectPanel(control, feedBackFunction)
{
    targetControl = control;
    if(!window.selectHobbyPanel)
    {
        var selHobbyDiv = InitialPopupMenu();
        selHobbyDiv.id = "selHobbyDiv";
        selHobbyDiv.className = "Direct_msgbox";
        selHobbyDiv.style.width = "532px";
        selHobbyDiv.display = 'none';
    }
    LoadHobby(feedBackFunction);
}

/// <summary>
/// 获取兴趣爱好列表的反馈处理函数
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="feedBackFunction">处理反馈的函数</param>
function LoadHobby(feedBackFunction)
{
    if(feedBackFunction == undefined)
    {
        feedBackFunction = LoadHobbySuccess;
    }
    Qibu.Web.WebService.Register.GetAllHobbies(feedBackFunction);
}

/// <summary>
/// 获取兴趣爱好列表的反馈处理函数
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="result">反馈</param>
function LoadHobbySuccess(result)
{
    if(result == null)
    {
        alert("系统错误");
    }
    var txtHobby = $("txtHobby");
    
    Hobbys = result;
    resultList = result;
    
    html = '';
  
    html += '<div class="tit" style="background:url(/Themes/Admin/titbar.gif) 5px 8px no-repeat;height:20px">';
    html += '<div class="abs" style="background:#eefaff;right:0"><a href="javascript:void(0)" onclick="selectHobbyPanel.close()">[关闭]</a></div>';
    html += '</div>';
    html += '<div class="content" style="width:519px;padding-left:15px">';
    html += '<ul class="domain">';
    for(var i=0; i<Hobbys.length; i++)
    {
        html += '<li><input type="checkbox" value="'+Hobbys[i].Name+'" id="chkHobby'+i+'" />'+Hobbys[i].Name+'</li>';
    }
    html += '</ul>';
    html += '<div class="clear"></div>';
    html += '<div style="padding:0 0 8px 10px">';
    html += '<input name="Submit22" type="button" class="input2" id="Submit22" value="确 定" onclick="OutputHobby(targetControl)" />   ';
    html += '<input name="Submit222" type="button" class="input2" id="Submit222" value="关 闭" onclick="selectHobbyPanel.close()" />   ';
    html += '<input name="Submit222" type="button" class="input2" id="Submit222" value="全 选" onclick="ChangeAllChecked(\'checked\', \'chkHobby\')" />   ';
    html += '<input name="Submit222" type="button" class="input2" id="Submit222" value="清 空" onclick="ChangeAllChecked(\'\', \'chkHobby\')" />   ';
    html += '</div>';

    $("selHobbyDiv").innerHTML = html;
    
    var divMainLeft, divMainTop;
    var fixed = false;
    if(targetControl == undefined)
    {
        alert("您未指定显示输出的控件！");
        return;
        fixed = true;
    }
    else
    {
        divMainLeft = GetOffsetLeft(targetControl);
        divMainTop = GetOffsetTop(targetControl) + 18;
    }
    
    if(!window.selectHobbyPanel)
    {
        selectHobbyPanel = CreatePanel($("selHobbyDiv"), fixed, false, divMainLeft, divMainTop, 550, 200, false, false, false, null);
        selectHobbyPanel.show();
        selectHobbyPanel.setStyle("zIndex",99);
        if(!fixed)
        {
            selectHobbyPanel.setPosition({left:divMainLeft,top:divMainTop});
        }
    }
    else
    {
        selectHobbyPanel.show();
        if(!fixed)
        {
            selectHobbyPanel.setPosition({left:divMainLeft,top:divMainTop});
        }
    }
}

/// <summary>
/// 输出选择的疾病列表
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="outputElement">输出控件</param>
function OutputHobby(outputElement)
{
    var hobbyNames = "";
    for(var i=0; i<Hobbys.length; i++)
    {
        if($("chkHobby"+i).checked)
        {
            hobbyNames += $("chkHobby"+i).value + ";";
        }
    }
    outputElement.value = hobbyNames;
    selectHobbyPanel.close();
}

/// <summary>
/// 获取所有专业关注,专业擅长,关注领域列表
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="control">锚定的控件</param>
/// <param name="feedBackFunction">处理反馈的函数</param>
function InitiallingyuSelectPanel(control, feedBackFunction)
{
    targetControl = control;
    if(!window.selectDomainPanel)
    {
        var selDomainDiv = InitialPopupMenu();
        selDomainDiv.id = "selDomainDiv";
        selDomainDiv.className = "Direct_msgbox";
        selDomainDiv.style.width = "532px";
        selDomainDiv.display = 'none';
    }
    LoadDomain(feedBackFunction);
}

/// <summary>
/// 获取所有专业关注,专业擅长,关注领域列表
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="feedBackFunction">处理反馈的函数</param>
function LoadDomain(feedBackFunction)
{
    if(feedBackFunction == undefined)
    {
        feedBackFunction = LoadDomainSuccess;
    }
    Qibu.Web.WebService.Register.GetAllDomains(feedBackFunction);
}

/// <summary>
/// 获取专业关注,专业擅长,关注领域列表的反馈处理函数
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="result">反馈</param>
function LoadDomainSuccess(result)
{
    if(result == null)
    {
        alert("系统错误");
    }
    var txtDomain = $("txtDomain");
    
    Domains = result;
    resultList = result;
    
    html = '';
  
    html += '<div class="tit" style="background:url(/Themes/Admin/titbar.gif) 5px 8px no-repeat;height:20px">';
    html += '<div class="abs" style="background:#eefaff;right:0"><a href="javascript:void(0)" onclick="selectHobbyPanel.Hide()">[关闭]</a></div>';
    html += '</div>';
    html += '<div class="content" style="width:519px;padding-left:15px">';
    html += '<ul class="domain">';
    for(var i=0; i<Domains.length; i++)
    {
        html += '<li><input type="checkbox" value="'+Domains[i].Name+'" id="chkDomain'+i+'" />'+Domains[i].Name+'</li>';
    }
    html += '</ul>';
    html += '<div class="clear"></div>';
    html += '<div style="padding:0 0 8px 10px">';
    html += '<input name="Submit22" type="button" class="input2" id="Submit22" value="确 定" onclick="OutputDomain(targetControl)" />   ';
    html += '<input name="Submit222" type="button" class="input2" id="Submit222" value="关 闭" onclick="selectDomainPanel.close()" />   ';
    html += '<input name="Submit222" type="button" class="input2" id="Submit222" value="全 选" onclick="ChangeAllChecked(\'checked\')" />   ';
    html += '<input name="Submit222" type="button" class="input2" id="Submit222" value="清 空" onclick="ChangeAllChecked(\'\')" />   ';
    html += '</div>';

    $("selDomainDiv").innerHTML = html;
    
    
    var divMainLeft, divMainTop;
    var fixed = false;
    if(targetControl == undefined)
    {
        alert("您未指定显示输出的控件！");
        return;
        fixed = true;
    }
    else
    {
        divMainLeft = GetOffsetLeft(targetControl);
        divMainTop = GetOffsetTop(targetControl) + 18;
    }
    
    if(!window.selectDomainPanel)
    {
        selectDomainPanel = CreatePanel($("selDomainDiv"), fixed, false, divMainLeft, divMainTop, 550, 600, false, false, false, null);
        selectDomainPanel.show();
        selectDomainPanel.setStyle("zIndex",99);
        if(!fixed)
        {
            selectDomainPanel.setPosition({left:divMainLeft,top:divMainTop});
        }
    }
    else
    {
        selectDomainPanel.show();
        if(!fixed)
        {
            selectDomainPanel.setPosition({left:divMainLeft,top:divMainTop});
        }
    }
}

/// <summary>
/// 输出选择的疾病列表
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="outputElement">输出控件</param>
function OutputDomain(outputElement)
{
    var domainNames = "";
    for(var i=0; i<Domains.length; i++)
    {
        if($("chkDomain"+i).checked)
        {
            domainNames += $("chkDomain"+i).value + ";";
        }
    }
    outputElement.value += domainNames;
    selectDomainPanel.close();
}


/// <summary>
/// 获取所有科室列表
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="control">锚定的控件</param>
/// <param name="feedBackFunction">处理反馈的函数</param>
var sections;
var controlChanged = false;
function InitialSectionSelectPanel(control, feedBackFunction)
{
    if(targetControl != control)
    {
        controlChanged = true;
    }
    else
    {
        controlChanged = false;
    }
    targetControl = control;
    if(!window.selectSectionPanel)
    {
        var selSectionDiv = InitialPopupMenu();
        selSectionDiv.id = "selSectionDiv";
        selSectionDiv.className = "Direct_msgbox";
        selSectionDiv.style.width = "532px";
        selSectionDiv.display = 'none';
        LoadAllSections(LoadSectionSuccess);
    }
    else
    {
        divMainLeft = GetOffsetLeft(targetControl);
        divMainTop = GetOffsetTop(targetControl) + 18;
        selectSectionPanel.show();
        
        if(controlChanged)
        {
            for(var i=0; i<resultList.length; i++)
            {
                if($("chkSection"+i))
                {
                    $("chkSection"+i).checked = false;
                }
            }
        }
        selectSectionPanel.setPosition({left:divMainLeft,top:divMainTop});
    }
}

/// <summary>
/// 获取科室列表的反馈处理函数
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="result">反馈</param>
function LoadSectionSuccess(result)
{
    HideProcess();
    if(result == null)
    {
        alert("系统错误");
    }
    var txtSelSection = $("txtSelSection");
    
    sections = result;
    resultList = result;
    
    var html = '';
  
    html += '<div class="tit" style="background:url(/Themes/Admin/titbar.gif) 5px 8px no-repeat;height:20px">';
    html += '<div class="abs" style="background:#eefaff;right:0"><a href="javascript:void(0)" onclick="selectSectionPanel.close()">[关闭]</a></div>';
    html += '</div>';
    html += '<div class="content" style="width:519px;padding-left:15px">';
    html += '<ul class="domain">';
    for(var i=0; i<sections.length; i++)
    {
        if(targetControl.value.indexOf(sections[i].Name) >= 0)
        {
            html += '<li><input type="checkbox" checked="checked" value="'+sections[i].SectionID+'" id="chkSection'+i+'" />'+sections[i].Name+'</li>';
        }
        else
        {
            html += '<li><input type="checkbox" value="'+sections[i].SectionID+'" id="chkSection'+i+'" />'+sections[i].Name+'</li>';
        }
    }
    html += '</ul>';
    html += '<div class="clear"></div>';
    html += '</div>';
    html += '<div style="padding:0 0 8px 10px">';
    html += '<input name="Submit22" type="button" class="input2" id="Submit22" value="确 定" onclick="OutputSections(targetControl);if(window.ValidateSection){ValidateSection();}" />   ';
    html += '<input name="Submit222" type="button" class="input2" id="Submit222" value="关 闭" onclick="selectSectionPanel.close()" />   ';
    html += '<input name="Submit222" type="button" class="input2" id="Submit222" value="全 选" onclick="ChangeAllChecked(\'checked\', \'chkSection\')" />   ';
    html += '<input name="Submit222" type="button" class="input2" id="Submit222" value="清 空" onclick="ChangeAllChecked(\'\', \'chkSection\')" />   ';
    html += '</div>';
    
    $("selSectionDiv").innerHTML = html;
    
    var divMainLeft, divMainTop;
    var fixed = false;
    if(targetControl == undefined)
    {
        alert("您未指定显示输出的控件！");
        return;
        fixed = true;
    }
    else
    {
        divMainLeft = GetOffsetLeft(targetControl);
        divMainTop = GetOffsetTop(targetControl) + 18;
    }
    
    if(!window.selectSectionPanel)
    {
        selectSectionPanel = CreatePanel($("selSectionDiv"), fixed, false, divMainLeft, divMainTop, 532, 500, false, false, false, null);
        selectSectionPanel.show();
        selectSectionPanel.setStyle("zIndex",99);
        if(!fixed)
        {
            selectSectionPanel.setPosition({left:divMainLeft,top:divMainTop});
        }
    }
    else
    {
        selectSectionPanel.show();
        if(!fixed)
        {
            selectSectionPanel.setPosition({left:divMainLeft,top:divMainTop});
        }
    }
}

/// <summary>
/// 输出选择的科室列表
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="outputElement">输出控件</param>
function OutputSections(outputControl)
{
    var sectionNames = "";
    for(var i=0; i<sections.length; i++)
    {
        if($("chkSection"+i).checked)
        {
            sectionNames += $("chkSection"+i).nextSibling.nodeValue + ";";
        }
    }
    if(!outputControl)
    {
        $("txtSelSection").value = sectionNames;
    }
    else
    {
        outputControl.value = sectionNames;
    }
    selectSectionPanel.close();
}




/*************************************************************************************/

/********** 获取用户相关选项（医院，科室，职称，职务，团体协会，毕业院校） ************/

/// <summary>
/// 根据城市ID,获取该城市中的所有医院
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="cityID">城市ID</param>
/// <param name="feedBackFunction">反馈处理函数</param>
var newHospitalID = 0;
var newRefresherID = 0;
var newAssociationID = 0;
function LoadHospitalByCityID(cityID, feedBackFunction)
{
    ShowProcess(PROCESS_STRING);
    if(feedBackFunction == undefined)
    {
        feedBackFunction = LoadHospitalSuccess;
    }
    Qibu.Web.WebService.Register.GetHospitalByCityID(cityID, LoadHospitalSuccess);
}

/// <summary>
/// 默认的医院列表获取反馈处理函数
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="result">反馈</param>
function LoadHospitalSuccess(result)
{
    HideProcess();
    if(result == null)
    {
        alert("系统错误");
    }
    resultList = result;
    
    if((newHospitalID == 0 && newRefresherID == 0) || (newHospitalID > 0 && newRefresherID == 0))
    {
        for(var i=0; i<$("selHospital").options.length; i++)
        {
            $("selHospital").remove(0);
        }
        $("selHospital").options[0] = new Option("请选择医院", "0");
        for(var i=1; i<=resultList.length; i++)
        {
            $("selHospital").options[i] = new Option(resultList[i-1].Name, resultList[i-1].HospitalID);
            if(newHospitalID == resultList[i-1].HospitalID)
            {
                $("selHospital").selectedIndex = i;
            }
        }
    }
    
    if(((newHospitalID == 0 && newRefresherID == 0) || (newHospitalID == 0 && newRefresherID > 0)) && $("selRefresher"))
    {
        for(var i=0; i<$("selRefresher").options.length; i++)
        {
            $("selRefresher").remove(0);
        }
        $("selRefresher").options[0] = new Option("请选择进修机构", "0");
        
        for(var i=1; i<=resultList.length; i++)
        {
            $("selRefresher").options[i] = new Option(resultList[i-1].Name, resultList[i-1].Name);
            if(newRefresherID == resultList[i-1].HospitalID)
            {
                $("selRefresher").selectedIndex = i;
            }
        }
    }
}

function LoadAllEnterprises(order, feedBackFunction)
{
    ShowProcess(PROCESS_STRING);
    
    Qibu.Web.WebService.Enterprise.GetEntlistPaged(order, 0, 100000, feedBackFunction);
}

function LoadAllProductsByEntID(entID, feedBackFunction)
{
    ShowProcess(PROCESS_STRING);
    
    YiQiao.Ent.Web.WebService.EntProduct.GetProductByEntIDAndCategoryIDPaged(entID, 0, 0, 100000, feedBackFunction);
}

/// <summary>
/// 获取科室列表函数
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="feedBackFunction">处理反馈的函数</param>
function LoadAllSections(feedBackFunction)
{
    ShowProcess(PROCESS_STRING);
    
    if(feedBackFunction == undefined)
    {
        feedBackFunction = LoadAllSectionsSuccess;
    }
    
    Qibu.Web.WebService.Register.GetAllSections(feedBackFunction);
}
/// <summary>
/// 默认的科室列表获取反馈处理函数
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="result">反馈</param>
function LoadAllSectionsSuccess(result)
{
    HideProcess();
    if(result == null)
    {
        alert("系统错误");
    }
    resultList = result;
    for(var i=0; i<$("selSection").options.length; i++)
    {
        $("selSection").remove(i);
        i--;
    }
    
    $("selSection").options[0] = new Option("请选择", "0");
    for(var i=1; i<=resultList.length; i++)
    {
        $("selSection").options[i] = new Option(resultList[i-1].Name, resultList[i-1].SectionID);
    }
}


/// <summary>
/// 获取毕业院校列表的函数
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="feedBackFunction">处理反馈的函数</param>
function LoadAllGraduateSchools(feedBackFunction)
{
    ShowProcess(PROCESS_STRING);
    
    if(feedBackFunction == undefined)
    {
        feedBackFunction = LoadGraduateSchoolSuccess;
    }
    
    Qibu.Web.WebService.Register.GetAllGraduateSchools(LoadGraduateSchoolSuccess);
}

/// <summary>
/// 处理获取的毕业院校列表
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="result">反馈</param>
function LoadGraduateSchoolSuccess(result)
{
    HideProcess();
    if(result == null)
    {
        alert("系统错误");
    }
    resultList = result;
    for(var i=0; i<$("selGraduateSchool").options.length; i++)
    {
        $("selGraduateSchool").remove(i);
        i--;
    }
    $("selGraduateSchool").options[0] = new Option("请选择毕业院校", "");
    
    for(var i=0; i<resultList.length; i++)
    {
        $("selGraduateSchool").options[i+1] = new Option(resultList[i].Name, resultList[i].GraduateSchoolID);
        if(window.selectedSchoolID && resultList[i].GraduateSchoolID == selectedSchoolID)
        {
            $("selGraduateSchool").selectedIndex = i+1;
        }
    }
}

/// <summary>
/// 获取企业列表函数
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="feedBackFunction">处理反馈的函数</param>
function LoadAllCompany(feedBackFunction)
{
    ShowProcess(PROCESS_STRING);
    
    if(feedBackFunction == undefined)
    {
        feedBackFunction = LoadAllCompanySuccess;
    }
    
    Qibu.Web.WebService.Register.GetAllCompany(feedBackFunction);
}

/// <summary>
/// 处理获取的毕业院校列表
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="result">反馈</param>
function LoadAllCompanySuccess(result)
{
    HideProcess();
    if(result == null)
    {
        alert("系统错误");
    }
    resultList = result;
    for(var i=0; i<$("selCompany").options.length; i++)
    {
        $("selCompany").remove(i);
        i--;
    }
    $("selCompany").options[0] = new Option("请选择企业", "");
    
    for(var i=0; i<resultList.length; i++)
    {
        $("selCompany").options[i+1] = new Option(resultList[i].Name, resultList[i].CompanyID);
    }
}
/**************************************************************************************************/

/**************************************** Start 生成Module级联菜单 ***************************************************/

var totalLevel = 0;
var moduleIDList = new Array();
var selectedModuleID = 0;
var currentLevel = 0;

function GetChildModules(level, moduleID, feedBackFunction)
{
    ShowProcess(PROCESS_STRING);
    currentLevel = level;
    if(level >= 0)
    {
        selectedModuleID = moduleID;
        moduleIDList[currentLevel] = selectedModuleID;
        for(var i=level+1; i<totalLevel+1; i++)
        {
            if($("selModule"+i))
            {
                $("selModule"+i).style.display = 'none';
            }
        }
        totalLevel = currentLevel + 1;
    }
    Qibu.Web.WebService.Module.GetChildModules(moduleID, feedBackFunction);
}

function GetLinkedChildeModulesSuccess(result)
{
    GetChildeModulesSuccess(result);
    if(currentLevel + 1 < moduleIDList.length)
    {
        GetChildModules(currentLevel, moduleIDList[currentLevel], GetLinkedChildeModulesSuccess);
    }
}

function GetChildeModulesSuccess(result)
{
    HideProcess();
    if(result == null)
    {
        alert("获取失败！");
    }
    else
    {
        if(result.length == 0)
        {
            return;
        }
        else
        {
            if(totalLevel > 0)
            {
                selectedModuleID = 0;
            }
            currentLevel += 1;
            
            if($("selModule"+currentLevel))
            {
                var len = $("selModule"+currentLevel).options.length;
                for(var i=0; i<len; i++)
                {
                    $("selModule"+currentLevel).remove(0);
                }
                $("selModule"+currentLevel).options[0] = new Option("请选择"+(currentLevel+1)+"级分类", "0");
                for(var i=0; i<result.length; i++)
                {
                    $("selModule"+currentLevel).options[i+1] = new Option(result[i].Name, result[i].ModuleID);
                }
                
                $("selModule"+currentLevel).style.display = '';
                totalLevel = currentLevel+1;
            }
            else
            {
                var html = '';
                html += '<select id="selModule'+totalLevel+'" style="width:100px" onchange="GetChildModules('+totalLevel+', this.value, GetChildeModulesSuccess)">';
                html += '<option value="0">请选择'+(totalLevel+1)+'级分类</option>';
                for(var i=0; i<result.length; i++)
                {
                    html += '<option value="' + result[i].ModuleID + '">' + result[i].Name + '</option>';
                }
                html += '</select> ';
                
                $("spanModuleList").innerHTML += html;
                $("selModule"+totalLevel).selectedIndex = 0;
                for(var i=0; i<totalLevel; i++)
                {
                    if(moduleIDList[i] != undefined)
                    {
                        $("selModule"+i).value = moduleIDList[i];
                    }
                }
                
                totalLevel++;
            }
            
            if( moduleIDList[currentLevel] != undefined)
            {
                $("selModule"+currentLevel).value = moduleIDList[currentLevel];
            }
        }
    }
}

/**********************************************************************************************************************/

/**************************************** Start DisplayPageBar ***************************************************/

var pageIndexDisplayNum = 5;

var pageSize = 10;
var pageIndex = 0;
var pageCount = 0;
var itemCount = 0;
var startPageIndex = 0;

function DisplayPageBar(FirstPageFun, PrePageFun, GetPageFun, NextPageFun, LastPageFun, PageBarDiv)
{
    var pageNum = Math.ceil(this.itemCount / this.pageSize);  // 页码从0开始，如果没有任何数据则为0
    pageCount = pageNum;
    var currentPageIndex = pageIndex<0?0:pageIndex;
    var displayNum = 0;
    var table = '';
    if(pageNum <= 5)    // startPageIndex = 0;
    {
        displayNum = pageNum == 0?1:pageNum;    
    }
    else if(pageNum > 5)
    {
        displayNum = pageIndexDisplayNum;
        
        if(currentPageIndex+2 >= pageNum)
        {
            startPageIndex = pageNum - 5;
        }
        else
        {
            startPageIndex = currentPageIndex - 2;
            if(startPageIndex < 0)
            {
                startPageIndex = 0;
            }
        }
        
    }
    table += '<div class="abs" style="line-height:22px;"><div style="float:right;padding-top:1px"> 页</div><div style="float:right"><input type="text" style="width:25px" onfocus="this.value=\'\'" onblur="if(OnlyHasNumber(this.value) && this.value > 0){'+GetPageFun+'(this.value-1)}" value="'+(pageIndex+1)+'" onkeydown="if(event.keyCode == 13) if(OnlyHasNumber(this.value) && this.value > 0){'+GetPageFun+'(this.value-1)}"></div>';
    if(currentPageIndex > 0)   // 页数多于1页，并且不是最后页
    {
        table+='<div style="float:right;"><a href="javascript:void(0)" onclick="'+FirstPageFun+'()" class="lj_1">首页</a>&nbsp;&nbsp;';
        table+='<a href="javascript:void(0)" onclick="'+PrePageFun+'()" class="lj_1">上一页</a>&nbsp;&nbsp;';
    }
    else
    {
        table+='<div style="float:right">首页&nbsp;&nbsp; ';
        table+='上一页&nbsp;&nbsp; ';
    }
    for(var i=0; i<displayNum; i++)
    {
        if(startPageIndex + i == currentPageIndex)
        {
            table+=' <u><b>'+(startPageIndex+i+1)+'</u></b> '
        }
        else
        {
            table+=' <a href="javascript:void(0)" onclick="'+GetPageFun+'('+(startPageIndex+i)+')" class="lj_1">'+(startPageIndex+i+1)+'</a> ';
        }
    }
    
    if(pageNum > 1 && currentPageIndex + 1 < pageNum)   // 页数多于1页，并且不是最后页
    {
        table+='&nbsp;&nbsp;<a href="javascript:void(0)" onclick="'+NextPageFun+'()" class="lj_1">下一页</a>';
        table+='&nbsp;&nbsp;<a href="javascript:void(0)" onclick="'+LastPageFun+'()" class="lj_1">末页</a>&nbsp;&nbsp;';
    }
    else
    {
        table+='&nbsp;&nbsp;下一页';
        table+='&nbsp;&nbsp;末页&nbsp;&nbsp;';
    }
    table += '到 </div>';
    //table += '| 共'+pageNum+'页';
    table += '</div>';
    
    PageBarDiv.innerHTML = table;
}

/**************************************** End DisplayPageBar ***************************************************/

/********** 添加用户相关选项（医院，团体协会，进修机构） ************/

/// <summary>
/// 添加新的进修机构
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="cityID">城市ID</param>
/// <param name="hospitalName">新机构的名称</param>
/// <param name="feedBackFunction">反馈处理函数</param>
function AddNewRefresher(cityID, hospitalName, feedBackFunction)
{
    newRefresherID = 0;
    newHospitalID = 0;
    if(hospitalName.length == 0)
    {
        YQAlert("您还未输入新的进修机构名称", null, null, false);
        return;
    }
    if(cityID == "" || cityID <= 0)
    {
        YQAlert("您还未输入您所在的城市", null, null, false);
        return;
    }
    if(feedBackFunction == undefined)
    {
        feedBackFunction = AddNewRefresherSuccess;
    }
    Qibu.Web.WebService.Register.AddNewHospital(cityID, hospitalName, AddNewRefresherSuccess);
}

/// <summary>
/// 默认的添加新进修机构的反馈处理函数
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="result">反馈</param>
function AddNewRefresherSuccess(result)
{
    if(result == 0)
    {
        var newProvince = $("newProvince2");
        var newCity = $("newCity2");
        
        selectedCityID = newCity.value;
        existHospitalID = result;
        
        LoadHospitalByCityID(newCity.value);
    }
    else if(result == -1)
    {
        YQAlert("添加失败, 您还未选择您所在的省市", null, null, false);
    }
    else if(result == -2)
    {
        YQAlert("添加失败, 发生系统错误", null, null, false);
    }
    else if(result > 0)
    {
        newRefresherID = result;
        var oldCity = $("txtCity");
        var newCity = $("newCity2")
        LoadHospitalByCityID(newCity.value);
    }
    $("newHospitalDiv").style.display = "none";
}

/// <summary>
/// 添加新的医院
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="cityID">城市ID</param>
/// <param name="hospitalName">新机构的名称</param>
/// <param name="feedBackFunction">反馈处理函数</param>
function AddNewHospital(cityID, hospitalName, feedBackFunction)
{
    newHospitalID = 0;
    newRefresherID = 0;
    if(hospitalName.length == 0)
    {
        YQAlert("您还未输入新的进修机构名称", null, null, false);
        return;
    }
    if(cityID == "" || cityID <= 0)
    {
        YQAlert("您还未输入您所在的城市", null, null, false);
        return;
    }
    if(feedBackFunction == undefined)
    {
        feedBackFunction = AddNewHospitalSuccess;
    }
    Qibu.Web.WebService.Register.AddNewHospital(cityID, hospitalName, AddNewHospitalSuccess);
}

/// <summary>
/// 默认的添加新医院的反馈处理函数
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="result">反馈</param>
function AddNewHospitalSuccess(result)
{
    if(result == 0)
    {
        var oldCity = $("txtCity");
        existHospitalID = result;
        LoadHospitalByCityID(selectedCityID);
        ValidateCityLocus();
    }
    else if(result == -1)
    {
        YQAlert("添加失败, 您还未选择您所在的省市", null, null, false);
    }
    else if(result == -2)
    {
        YQAlert("添加失败, 发生系统错误", null, null, false);
    }
    else if(result > 0)
    {
        newHospitalID = result;
        LoadHospitalByCityID(selectedCityID);
    }
    $("newHospitalDiv").style.display = "none";
}

/// <summary>
/// 添加新的团体协会
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="cityID">城市ID</param>
/// <param name="name">新协会的名称</param>
/// <param name="control">内容输出的控件</param>
/// <param name="feedBackFunction">反馈处理函数</param>
function AddNewAssociation(name, control, feedBackFunction)
{
    targetControl = control;
    if(name.length == 0)
    {
        YQAlert("您还未输入新的团体协会名称", null, null, false);
        return;
    }
    if(feedBackFunction == undefined)
    {
        feedBackFunction = AddNewAssociationSuccess;
    }
    Qibu.Web.WebService.Register.AddNewAssociation(name, feedBackFunction);
}

/// <summary>
/// 默认的添加新团体协会的反馈处理函数
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="result">反馈</param>
function AddNewAssociationSuccess(result)
{
    if(result < 0)
    {
        alert("添加失败");
    }
    else
    {
        $('newAssociationDiv').style.display = 'none';
        newAssociationID = result;
        InitialAssociationSelectPanel(targetControl);
    }
}

/// <summary>
/// 添加新的毕业院校
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="schoolName">学校名称</param>
/// <param name="feedBackFunction">处理反馈的函数</param>
function AddNewGraduateSchool(schoolName, feedBackFunction)
{
    //var schoolName = $('newGraduateSchoolName').value;
    if(schoolName.length == 0)
    {
        YQAlert("您还未输入您的毕业院校名称", null, null, false);
        return;
    }
    if(feedBackFunction == undefined)
    {
        feedBackFunction = AddNewGraduateSchoolSuccess;
    }
    Qibu.Web.WebService.Register.AddNewGraduateSchool(schoolName, feedBackFunction);
}

/// <summary>
/// 默认的添加新毕业院校的反馈处理函数
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="result">反馈</param>
function AddNewGraduateSchoolSuccess(result)
{
    if(result < 0)
    {
        alert("添加失败");
    }
    else
    {
        selectedSchoolID = result;
        LoadAllGraduateSchools();
    }
}

/**********************************/


/********** 彩色渐变颜色 ******/

var colors = new Array("#000000","#0000FF","#80FFFF","#80FF80","#FFFF00","#FF8000","#FF00FF","#FF0000");

delay = 100 // 变色停顿时间（毫秒）
link = 0;
vlink = 0;
function linkDance(controlID) 
{
    link = (link+1)%colors.length;
    if(controlID == null || controlID == undefined || !window.$(controlID))
    {
        return;
    }
    $(controlID).style.color = colors[link];
    setTimeout("linkDance('"+controlID+"')",delay);
}

/********************************/

/********** 显示被查封的弹出框 **********/

function ShowBlockedPanel()
{
    isAuthored = false;
    
    var html = '';
    html += '<div class="popbox2" style="width:480px;height:267px;">';
    html += '<div class="content" style="width:480px;height:267px;">';
    html += '<div style="position:absolute; right:5px; bottom:55px; width:80px; text-align:left">';
    html += '<input name="Submit4" type="button" class="input2" id="Submit4" value="确 认" onclick="SendYqMessage();blockedPanel.close();Logout();" />';
    html += '</div>';
    html += '<div style="background-image:url(/Themes/Admin/popbox2_vbg6.gif);margin-right:4px;height:263px;border-left:1px solid #6bcbe4;border-top:1px solid #6bcbe4;border-right:1px solid #6bcbe4; border-bottom:2px solid #6bcbe4;">';
    html += '<div class="close op" style="float:right;"> <a href="javascript:void(0)" onclick="blockedPanel.close();" class="font12px02327e">[关闭]</a> </div>';
    html += '<div style="padding:0px 0px 15px 25px;">';
    html += '<div style="float:left;padding-top:15px" ><img src="Themes/Admin/ca.gif" alt="进程管理" /></div>';
    html += '<div style="float:left; font-size:12px; padding:20px 0px 0px 25px; width:260px;" >您的帐号已被管理员查封</div>      ';
    html += '</div>';
    html += '<div class="clear"></div>';
    html += '<div style="padding-left:112px;">';
    html += '<div style=" height:20px;">给我们留言<span style="color:red">(请注意留下您的帐号的基本信息)</span>：</div>';
    html += '<div><textarea cols="35" rows="4"  id="msgContentTemp">帐    号：\r\n邮件地址：\r\n联系电话：</textarea></div>';
    html += '<div style="color:#818181; padding-top:5px;">(您可输入200个字)</div>';
    html += '<div style="padding-top:10px;"> <a href="contact_us.html" class="tc" target="_blank">>> 其他方式联系我们</a><br/>';
    html += '<a href="agreement.html" class="tc" target="_blank">>> 查看《医桥用户条款》</a></div>';
    html += '</div>';
    html += '</div>';
    html += '</div>';
    html += '</div>';
    
    var blockUserDiv = window.document.createElement('div');
    blockUserDiv.id = 'blockUserDiv';
    blockUserDiv.className = 'popbox2';
    blockUserDiv.style.width = '380px';
    blockUserDiv.style.height = '267px';
    blockUserDiv.style.background = '#ffffff';
    blockUserDiv.innerHTML = html;
    
    blockedPanel = CreatePanel(blockUserDiv, true, false, 0, 0, 480, 267, false, false, false, null);
    blockedPanel.show();
}

/********************************/

/**************************** 举报 *********************************/

function Accuse(title, contentType, extraID, moduleName,  moduleID, content, url)
{
    Qibu.Web.WebService.Admin.AddAccuse(title, contentType, extraID, moduleID, moduleName, content, url, function(result){
        if(!result)
        {
            alert("举报失败！");
        }
        else
        {
            YQAlert("举报成功！");
        }
    });
}

/*******************************************************************/

/********** 在指定的控件上覆盖一层iframe用于添加链接 **********/

function CreateLinkIframe(control, width, height, linkTarget, linkUrl)
{
    alert(1);
    var linkIframeDiv = window.document.createElement('div');
    var html = '<a href="'+linkUrl+'" target="'+linkTarget+'"></a>';
    linkIframeDiv.innerHTML = html;
    linkIframePanel = CreatePanel(linkIframeDiv, false, false, 0, 0, width, height, false, false, false, null);
    linkIframePanel.alpha = 0;
    linkIframePanel.show();
    linkIframePanel.setStyle("zIndex",99);
    linkIframePanel.setPosition(System.Document.getAbsolutePosition(control));
}

/********************************/
/********** pageUnload **********/
var isDirty = false;
var dirtyAlertString = '您的正处于编辑状态，点击确认将丢失您所编辑的内容。';
function SetDirty(bool)
{
    isDirty = bool;
}
window.onbeforeunload = function ()
{
    if(isDirty)
    {
        //return dirtyAlertString;
    }
}
/*******************************/
var W3CDOM = (document.createElement && document.getElementsByTagName);
function initFileUploads(imageUrl) 
{	
	if (!W3CDOM) return;
	var fakeFileUpload = document.createElement('div');
	fakeFileUpload.className = 'fakefile';
	var fakeInput = document.createElement('input');
	fakeInput.type = "text";
	fakeInput.id = "fakeInput";
	fakeInput.name = "fakeInput";
	fakeInput.style.position = "absolute";
	fakeInput.style.top = "2px";
	fakeInput.style.width = "127px";
	//fakeInput.style.paddingTop = "-3px";
	fakeFileUpload.appendChild(fakeInput);
	fakeFileUpload.innerHTML += ' ';
	var image = document.createElement('img');
	image.src=imageUrl;
	image.style.position = "absolute";
	image.style.left = "137px";
	fakeFileUpload.appendChild(image);
	var x = document.getElementsByTagName('input');
	for (var i=0;i<x.length;i++) 
	{
		if (x[i].type != 'file') continue;
		if (x[i].parentNode.className != 'fileinputs') continue;
		x[i].className = 'hiddenFile';	
		var clone = fakeFileUpload.cloneNode(true);
		x[i].parentNode.appendChild(clone);
		x[i].relatedElement = clone.getElementsByTagName('input')[0];
		x[i].onchange = x[i].onmouseout = function () 
		{
			this.relatedElement.value = this.value;
		}
	}
}

/// <summary>
/// 将某个字符串进行缩略
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="str">要缩略的字符串</param>
/// <param name="length">要缩略到的长度</param>
/// <param name="addDot">是否要添加省略号</param>
function ShortString(str, length, addDot)
{
    var returnStr = str.substring(0, length);
    if(addDot)
    {
        returnStr += str.length > length ? '...' : '';
    }
    return returnStr;
}

function LogOut()
{
    for(var i=topLevel; i>=0; i--)
    {
        SetCookie("level"+i, "false");
    }
    window.top.location.href = window.top.location.href;
}


var loginLevel = 0; // 标示当前需要的登录级别，0="level0", 1="level1".....
var topLevel = 1;   // 标示当前网站中设定的最高级别；
var requiredPwd = {0:"fudanxht", 1:"fudanxht"};

function HasRight(level)
{
    var login;
    for(var i=topLevel; i>=level; i--)
    {
        login = GetCookie("level"+i);
        if(login == requiredPwd[i])
        {
            return true;
        }
    }
    return false;
}

function LogIn()
{
    if(HasRight(loginLevel))
    {
        return;
    }
    
    //var pwd = window.prompt("请输入登录密码：", "")
    try
    {
        var pwd = window.showModalDialog("/Xianghuitang/Include/password.html",null,"dialogHeight:30px;dialogWidth:400px;status:no;help:no;resizable:no;edge:raised;center:yes;");
        tryCount++;
        if(pwd != requiredPwd[loginLevel])
        {   
            for(var i=loginLevel+1; i<=topLevel; i++)
            {
                if(requiredPwd[i] == pwd)
                {
                    SetCookie("level"+i, requiredPwd[i]);
                    return;
                }
            }
            if(pwd == null || pwd == undefined)
            {
                window.top.location.href="http://www.fuedf.org/";
            }
            else
            {
                if(tryCount == 3)
                {
                    alert("对不起，您输入的密码错误！您已经尝试了3次，将为您转到网站首页！");
                    window.location.href="http://www.fuedf.org/";
                }
                else
                {
                    alert("对不起，您输入的密码错误！请重新输入");
                    LogIn();
                }
            }
            
        }
        else
        {
            SetCookie("level"+loginLevel, requiredPwd[loginLevel]);
            return;
        }
    }
    catch(e)
    {
        alert("请设置您的浏览器，取消对www.fuedf.org域名的弹出窗口的阻止！");
        if(window.document.all)
        {
            document.execCommand("stop");
        }
    }
}

/// <summary>
/// 获取某个函数的
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="myFunction">要缩略的字符串</param>
function GetFunctionName(myFunction)
{
    var functionStr = myFunction.toString();
    return functionStr.match(/^function\s+(\S+)\s*\(/)[1]
}

/// <summary>
/// 判断某字符串是否只网址的格式
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="str">要判断的字符串</param>
function IsUrl(str) 
{
    var regUrl = /(http\:\/\/)?([\w.]+)(\/[\w-   \.\/\?%&=]*)?/; 
    var result = str.match(regUrl); 
    if(result != null)   
    {
        return true;
    }
    else
    {
        return false;
    } 
} 

/// <summary>
/// 判断某字符串是否只由按照'yyyy-MM-dd'的格式
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="String">要判断的字符串</param>
function CheckIfDate(String)
{
    var iaMonthDays = [31,28,31,30,31,30,31,31,30,31,30,31];
    var iaDate = new Array(3);
    var year, month, day;

    iaDate = String.toString().split("-")
    if (iaDate.length != 3)
    {
        return false;
    }
    if (iaDate[1].length > 2 || iaDate[2].length > 2) 
    {
        return false;
    }
    year = parseFloat(iaDate[0]);
    month = parseFloat(iaDate[1]);
    day = parseFloat(iaDate[2]);

    if (year < 1900 || year > 2100)
    {
        return false;
    }
    if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0))
    { 
        iaMonthDays[1] = 29;
    }
    if (month < 1 || month > 12)
    { 
        return false;
    }
    if (day < 1 || day > iaMonthDays[month - 1])
    { 
        return false;
    }
    return true;
} 

/// <summary>
/// 判断某字符串是否只由按照'yyyy-MM-dd HH:mm:ss'的格式
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="str">要判断的字符串</param>
function CheckIfDateTime(str)
{                         
    var a = str.match(/^(\d{0,4})-(\d{0,2})-(\d{0,2}) (\d{0,2}):(\d{0,2}):(\d{0,2})$/);
    if (a == null) return false;
    if ( a[2]>=13 || a[3]>=32 || a[4]>=24 || a[5]>=60 || a[6]>=60) return false;
    return true; 
}

/// <summary>
/// 判断某字符串是否只由英文字母和数字组成
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="String">要判断的字符串</param>
function CheckIfEnglish(String) 
{ 
    var Letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890";
    var i; 
    var c; 
    for( i = 0; i < String.length; i ++ ) 
    { 
        c = String.charAt( i ); if (Letters.indexOf( c ) < 0) return false; 
    }
    return true;
}


/// <summary>
/// 判断某字符串是否只由中文组成
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="String">要判断的字符串</param>
function isChinese(String)
{
    var pattern=/^[^\x00-\xff]+$/;
    if(pattern.test(String))
    {
        //包含中文
        return true;
    }
    else
    {
        //不包含中文
        return false;
    }
}

/// <summary>
/// 判断某字符串是否只由小写英文字母组成
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="String">要判断的字符串</param>
function OnlyHasLowerLetter(String)
{
    //var Letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890_";
    var Letters = "abcdefghijklmnopqrstuvwxyz";
    var i; 
    var c; 
    for( i = 0; i < String.length; i ++ ) 
    { 
        c = String.charAt( i ); if (Letters.indexOf( c ) < 0) return false; 
    }
    return true;
}

/// <summary>
/// 判断某字符串是否只由大写英文字母组成
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="String">要判断的字符串</param>
function OnlyHasUpperLetter(String)
{
    //var Letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890_";
    var Letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    var i; 
    var c; 
    for( i = 0; i < String.length; i ++ ) 
    { 
        c = String.charAt( i ); if (Letters.indexOf( c ) < 0) return false; 
    }
    return true;
}

/// <summary>
/// 判断某字符串是否只由数字组成
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="String">要判断的字符串</param>
function OnlyHasNumber(String)
{
    //var Letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890_";
    var Letters = "1234567890";
    var i; 
    var c; 
    for( i = 0; i < String.length; i ++ ) 
    { 
        c = String.charAt( i ); if (Letters.indexOf( c ) < 0) return false; 
    }
    return true;
}

/// <summary>
/// 判断某字符串是否同时包含大写字母,小写字母,数字
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="String">要判断的字符串</param>
function HasAllLetter(String)
{
    var Letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890";
    var lower = 0;
    var upper = 0;
    var number = 0;
    var i; 
    var c; 
    for( i = 0; i < String.length; i ++ ) 
    { 
        c = String.charAt( i );
        var  index = Letters.indexOf( c );
        if (index < 0)
        {
            return false; 
        }
        else
        {
            if(index >= 0 && index <= 25)
            {
                upper++;
            }
            else if(index > 25 && index <= 51)
            {
                lower++;
            }
            if(index > 51 && index <= 61)
            {
                number++;
            } 
        }
    }
    if( lower == 0 || upper == 0 || number == 0)
    {
        return false;
    }
    return true;
}


/// <summary>
/// 判断电话号码是否符合中国的电话号码规范
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="String">要判断的字符串</param>
function phoneCheck(phoneStr)
{
    return /^(((\()?\d{2,4}(\))?[-(\s)*]){0,2})?(\d{7,8})$/.test(phoneStr);
}

/// <summary>
/// 判断手机号码是否符合规范
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="String">要判断的字符串</param>
function mobileCheck(mobileStr)
{
    return /^1[3-5][0-9]\d{8}$/.test(mobileStr) || /^2\d{7}$/.test(mobileStr);
}

/// <summary>
/// 判断电子邮件地址是否符合规范
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="String">要判断的字符串</param>
function emailCheck (emailStr) 
{
    var emailPat=/^\w+([\.\-]\w+)*\@\w+([\.\-]\w+)*\.\w+$/;
    var matchArray=emailStr.match(emailPat);
    if (matchArray==null) {
        return false;
    }
    return true;
}

/// <summary>
/// 将所有的同类checkbox的check状态更改为指定的值
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="checked">更改的状态</param>
function ChangeAllChecked(checked, prefix)
{
    if(resultList == null)
    {
        return;
    }
    if(prefix == undefined)
    {
        prefix = "chk";
    }
    for(var i = 0 ; i < resultList.length; i ++)
    {
        var chk = $(prefix + i);
        if(chk != undefined)
        {
            chk.checked = checked;
        }
    }
}

/// <summary>
/// 比较两个时间字符串（格式为yyyy-MM-dd的大小）
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="checked">更改的状态</param>
function CompareDate (startTime, endTime)
{
    tmpBeginTime = new Date(startTime.replace(/-/g,"\/"));
    tmpEndTime = new Date(endTime.replace(/-/g,"\/"));
    if ( tmpBeginTime > tmpEndTime )
    {
        return 1;
    }
    else if( tmpBeginTime < tmpEndTime )
    {
        return -1;
    }
    else
    {
        return 0;
    }
}

/// <summary>
/// 比较两个时间字符串（格式为yyyy-MM-dd HH:mm:ss的大小）
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="checked">更改的状态</param>
function CompareDateTime (startTime, endTime)
{
    var beginTimes=beginTime.substring(0,10).split('-');
    var endTimes=endTime.substring(0,10).split('-');

    beginTime=beginTimes[1]+'-'+beginTimes[2]+'-'+beginTimes[0]+' '+beginTime.substring(10,19);
    endTime=endTimes[1]+'-'+endTimes[2]+'-'+endTimes[0]+' '+endTime.substring(10,19);

    var a =(Date.parse(endTime)-Date.parse(beginTime))/3600/1000;

    if(a<0){
    return -1;
    }else if (a>0){
    return 1;
    }else if (a==0){
    return 0;
    }else{
    return 'exception'
    } 
}

/// <summary>
/// 根据文件名称获取文件扩展名
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="filename">文件名</param>
function GetFileExtension(filename)
{
    return filename.substring(filename.lastIndexOf('.')+1);
}

/// <summary>
/// 根据文件名称获取文件名
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="filename">文件名</param>
function GetFileName(filename)
{
    return filename.substring(0, filename.lastIndexOf('.')-1);
}

/// <summary>
/// 根据访问地址获取访问的文件名
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="url">访问地址</param>
function GetFileNameFromUrl(url)
{
    return url.substring(url.lastIndexOf('/')+1);
}

/// <summary>
/// 根据访问地址获取访问的文件名
/// IE6 FF1.5.0.3 Opera9.20
/// </summary>
/// <param name="path">访问地址</param>
function GetFileNameFromPath(path)
{
    return path.substring(path.lastIndexOf('\\')+1);
}

/********************************************************** 记住密码 ****************************************************************/
function RememberUser()
{
    if(document.cookie !="")
    {
        var temp = GetCookie('username');
        if(temp != undefined)
        {
            $('txtLoginUsername').value=GetCookie('username');
        }
        if($("txtLoginUsername").value != '')
        {
            $("chkRememberUser").checked = true;
        }
        //$('txtLoginPassword').value=GetCookie('password');    
    }
}
// 用正则表达式将前后空格,用空字符串替代(PS:因为js没有现成的trim,所以要加上这个)
String.prototype.trim = function()   
{       
    return this.replace(/(^\s*)|(\s*$)/g, "");
}

function GetCookie(objName)
{    
    var arrStr = document.cookie.split(";");
    
    for(var i = 0;i < arrStr.length;i++)
    {
        var temp = arrStr[i].split("=");
        if(objName.trim()==temp[0].trim())
        {                
            return temp[1];
        }                            
    }
}

/*********************************** 显示图片（幻灯片效果） *************************************/
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($(prefix+i))
            {
                if(display == true)
                {
                    $(prefix+i).style.display = '';
                }
                else
                {
                    $(prefix+i).style.display = 'none';
                }
            }
        }
        else
        {
            if($(prefix+i))
            {
                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($(prefix+i))
        {
            if(i == index)
            {
                $(prefix+i).style = specStyle;
            }
            else
            {
                $(prefix+i).style = origionStyle;
            }
        }
    }
}

function SwitchClassName(prefix, index, totalCount, origionClassName, specClassName)
{
    for(var i=0; i<totalCount; i++)
    {
        if($(prefix+i))
        {
            if(i == index)
            {
                $(prefix+i).className = specClassName;
            }
            else
            {
                $(prefix+i).className = origionClassName;
            }
        }
    }
}

function SwitchImageDisplay(prefix, index, totalCount, showEffect)
{
    for(var i=0; i<totalCount; i++)
    {
        if($(prefix+i))
        {
            if(i == index)
            {
                ShowImage($(prefix+i), $(prefix+i).src, showEffect);
            }
            else
            {
                $(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;
} 
