var Navigator = new Object();
var  XMLHttpReqBox;
var XMLHttpReqShopBox;
var  XMLHttpReqBox1;
var XMLHttpReq;
var  XMLHttpReq4;
if(navigator.userAgent.indexOf("MSIE") != -1)
{
    Navigator.IE = true;
    if(navigator.userAgent.indexOf("MSIE 6.0") != -1)
    {
        Navigator.IE6 = true;
    }
    if(navigator.userAgent.indexOf("MSIE 7.0") != -1)
    {
        Navigator.IE7 = true;
    }
}
if(navigator.userAgent.indexOf("Firefox") != -1)
{
    Navigator.Firefox = true;
}
if(!Navigator.IE6 && !Navigator.IE7 && !Navigator.Firefox)
{
    alert('您的浏览器暂不支持，因此可能显示有问题，建议使用Microsoft IE 6.0+或Mozilla Firefox浏览');
}
function $(id)
{
    return document.getElementById(id);
}
//基本操作
function SetCookie(sName, sValue)
{
    var date = new Date();
    date.setFullYear(date.getFullYear() + 1);
    document.cookie = sName + "=" + escape(sValue) + "; domain=learning365.com; 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 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;
}
function ToggleDisplay_none_block(controlID)
{
    var control = $(controlID);
    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.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);
        }
    }
}

//居中
function ShowMiddle(div)
{
    var scrollYT, scrollXT;
    var topWindow = window.top;
    var topDocument = topWindow.document;
    if(div == null)
    {
        return;
    }
    if(document.all)
    {
        scrollYT = topDocument.body.scrollTop; 
				scrollXT = topDocument.body.scrollLeft;
    }
    else
    { 
			  scrollYT = topWindow.pageYOffset; 
		    scrollXT = topWindow.pageXOffset; 
	  }
    var top=0;
    if(topDocument.body.clientHeight>window.screen.availHeight){	
		top = Math.floor((window.screen.availHeight - div.offsetHeight) / 2) + scrollYT;
    }else{
		top = Math.floor((topDocument.body.clientHeight - div.offsetHeight) / 2) + scrollYT;

    }
	if(top < 0)
	{
	    top = 0;
	}
	var left = Math.floor((topDocument.body.clientWidth - div.offsetWidth) / 2) + scrollXT;
	if(left < 0)
	{
	    left = 0;
	}
    div.style.top = top + 'px';
    div.style.left = left + 'px';
}

function ShowMiddleClient(div,width,height)
{
    var scrollYT, scrollXT;
    var topWindow = window.top;
    var topDocument = topWindow.document;
    if(div == null)
    {
        return;
    }
    if(document.all)
    {
        scrollYT = topDocument.body.scrollTop; 
	 scrollXT = topDocument.body.scrollLeft;
    }
    else
    { 
	 scrollYT = topWindow.pageYOffset; 
	 scrollXT = topWindow.pageXOffset; 
     }
     
	var top = Math.floor((topDocument.body.clientHeight - div.offsetHeight) / 2) + scrollYT;
	if(top < 0)
	{
	    top = 0;
	}
	var left = Math.floor((topDocument.body.clientWidth - div.offsetWidth) / 2) + scrollXT;
	if(left < 0)
	{
	    left = 0;
	}
    div.style.top = (screen.height-height)/2 + 'px';
    div.style.left = (screen.width-width)/2+ 'px';
}





function CommonBox(content,title,left,top,width,height,moveable,middle,closeHandler)
{
    
     var table = window.top.document.createElement('table');
    table.cellSpacing = 0;
    table.cellPadding = 0;
    var row = table.insertRow(0);
    this.Title = row;
    var cell = row.insertCell(0);
    cell.innerHTML = '&nbsp;';
    cell.style.width = '17px';
	  cell.style.height = '35px';
    if(Navigator.IE6)
    {        
	    cell.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="http://www.learning365.com/Images/Commbox/left_top.png")';
    }
    else
    {
      cell.style.background = 'url(http://www.learning365.com/Images/Commbox/left_top.png) no-repeat';
    }
    cell = row.insertCell(1);
	  cell.style.height = '30px';

    if(Navigator.IE6)
    {        
	    cell.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="http://www.learning365.com/Images/Commbox/top.png",sizingMethod="scale")';
    }
    else
    {
        cell.style.background = 'url(http://www.learning365.com/Images/Commbox/top.png) repeat-x';
    }
    var spanTitle = window.top.document.createElement('span');
    spanTitle.innerHTML = title;
     spanTitle.id='comCaption';
    spanTitle.style.margin = '15px 0px 0px 5px';
    spanTitle.style.lineHeight = 'normal';
     spanTitle.style.fontSize='12px';
     
    SetFloatLeft(spanTitle);
    cell.appendChild(spanTitle); 
     var imgClose = window.top.document.createElement('img');
    imgClose.id = 'imgClose';
    imgClose.src = 'http://www.learning365.com/Images/Commbox/close.gif';
    imgClose.onclick = Function.createDelegate(this,this.Hide);
    imgClose.alt = '关闭';
    SetFloatRight(imgClose);
    cell.appendChild(imgClose);    
    cell = row.insertCell(2);
    cell.style.width = '17px';
     cell.style.height = '30px';
    if(Navigator.IE6)
    {        
	    cell.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="http://www.learning365.com/Images/Commbox/right_top.png")';
    }
    else
    {
        cell.style.background = 'url(http://www.learning365.com/Images/Commbox/right_top.png) no-repeat';
    }
     
    cell.innerHTML = '';
    row = table.insertRow(1);
    if(height)
    {
        row.style.height = height + 'px';
    }
    cell = row.insertCell(0);
    cell.innerHTML = '&nbsp;';
    cell.style.width = '17px';
    if(Navigator.IE6)
    {        
	    cell.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="http://www.learning365.com/Images/Commbox/left.png",sizingMethod="scale")';
    }
    else
    {
        cell.style.background = 'url(http://www.learning365.com/Images/Commbox/left.png) repeat-y';
    }
    cell = row.insertCell(1);
    cell.className = 'CenterCommon';
    if(width)
    {
        cell.style.width = width + 'px';
    }
    if (typeof content == 'object')
    {
        cell.appendChild(content);
    }
    else
    {
        cell.innerHTML = content;
    }
    this.divContent = cell;
    cell = row.insertCell(2);
    cell.innerHTML = '&nbsp;';
    cell.style.width = '17px';
    if(Navigator.IE6)
    {        
	    cell.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="http://www.learning365.com/Images/Commbox/right.png",sizingMethod="scale")';
    }
    else
    {
        cell.style.background = 'url(http://www.learning365.com/Images/Commbox/right.png) repeat-y';
    }
    row = table.insertRow(2);
    cell = row.insertCell(0);
    cell.innerHTML = '&nbsp;';
    cell.style.width = '17px';
    cell.style.height = '17px';
    if(Navigator.IE6)
    {        
	    cell.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="http://www.learning365.com/Images/Commbox/left_bottom.png")';
    }
    else
    {
        cell.style.background = 'url(http://www.learning365.com/Images/Commbox/left_bottom.png) no-repeat';
    }
    cell = row.insertCell(1);
    cell.style.height = '17px';
    if(Navigator.IE6)
    {        
	    cell.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="http://www.learning365.com/Images/Commbox/bottom.png",sizingMethod="scale")';
    }
    else
    {
        cell.style.background = 'url(http://www.learning365.com/Images/Commbox/bottom.png) repeat-x';
    }
    cell.innerHTML = '&nbsp;';
    cell = row.insertCell(2);
    cell.innerHTML = '&nbsp;';
    cell.style.width = '17px';
    cell.style.height = '17px';
    if(Navigator.IE6)
    {        
	    cell.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="http://www.learning365.com/Images/Commbox/right_bottom.png")';
    }
    else
    {
        cell.style.background = 'url(http://www.learning365.com/Images/Commbox/right_bottom.png) no-repeat';
    }
    
    this.divCommonBox = window.top.document.createElement('div');
    this.divCommonBox.id = 'divCommonBox';
    this.divCommonBox.appendChild(table);
    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.zIndex = this.defaultZIndex -1;
    document.body.style.zIndex=this.defaultZIndex -2;
     
    this.divBackground.style.display = 'none';
    var parent = window.top.document.body;
    parent.insertBefore(this.divBackground, parent.firstChild);  
    parent.insertBefore(this.divCommonBox, parent.firstChild);
    this.middle = middle;
    if(moveable == true)
    {
        //new Mover(this.divCommonBox, this.Title)
    }    
    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.body.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]);
        }
    }
}
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;
}

//Progress

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.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,false,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 ShowResultBox(message, success,swidth,sheight,wwidth,wheight)
{
     HideProcess();
    var title = '提示信息';
    var html = ''+
    '<div id="divResult" style="margin:"+swidth+"px auto "+swidth+"px auto;text-align:center;">'+
        message + '<br /><br /><center><input id="btnResultClose" type="button" onclick="HideResultBox()" value="确定" class="btnCommon2"/></center>'+
    '</div>';
    if(window.top.boxResult)
    {
        window.top.boxResult.SetContent(html);        
    }
    else
    {
        window.top.boxResult = new window.top.CommonBox(html,title,0,0,wwidth,wheight,false,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();
    }
}



function parse(xml) {
	var dom;
	try{
		dom = new ActiveXObject("Microsoft.XMLDOM");
		dom.async = false;
		dom.loadXML(xml);
	} catch (error) {
	  try{
			var parser = new DOMParser();
			dom = parser.parseFromString(xml, "text/xml");
			delete parser;
		} catch (error2) {
			if (debug)
				alert("XML parsing is not supported.");
	    }
	  }
	return dom;
}
function  createXMLHttpRequestBox()  {
    if(window.XMLHttpRequest)  { 
       XMLHttpReqBox  =  new  XMLHttpRequest();
     }
     else  if  (window.ActiveXObject)  { 
     try  {
       XMLHttpReqBox  =  new  ActiveXObject("Msxml2.XMLHTTP");
     }catch(e){
        try  {
           XMLHttpReqBox  =  new  ActiveXObject("Microsoft.XMLHTTP");
        }catch(e){}
     }
    }
}
function  createXMLHttpRequestBox1()  {
    if(window.XMLHttpRequest)  { 
       XMLHttpReqBox1  =  new  XMLHttpRequest();
     }
     else  if  (window.ActiveXObject)  { 
     try  {
       XMLHttpReqBox1  =  new  ActiveXObject("Msxml2.XMLHTTP");
     }catch(e){
        try  {
           XMLHttpReqBox1  =  new  ActiveXObject("Microsoft.XMLHTTP");
        }catch(e){}
     }
    }
}
function  createXMLHttpRequestShopBox()  {
    if(window.XMLHttpRequest)  { 
       XMLHttpReqShopBox  =  new  XMLHttpRequest();
     }
     else  if  (window.ActiveXObject)  { 
     try  {
       XMLHttpReqShopBox  =  new  ActiveXObject("Msxml2.XMLHTTP");
     }catch(e){
        try  {
           XMLHttpReqShopBox  =  new  ActiveXObject("Microsoft.XMLHTTP");
        }catch(e){}
     }
    }
}

function  sendRequestBox(username,isSendData,urlname,username1,password)  {
	  createXMLHttpRequestBox();
	  var  url  =  username;
         XMLHttpReqBox.open("GET", url+"?t="+Math.random()+"&UserName="+username1+"&UserPwd="+password,true);
         XMLHttpReqBox.onreadystatechange  =  processResponseBox;
         XMLHttpReqBox.send();
         
}
function  sendRequestBoxHome(username,isSendData,urlname,username1,password)  {
	  createXMLHttpRequestBox();
           var  url  =  username;
         XMLHttpReqBox.open("GET", url+"?t="+Math.random()+"&UserName="+username1+"&UserPwd="+password,true);
         XMLHttpReqBox.onreadystatechange  =  processResponseBoxHome;
         XMLHttpReqBox.send();
         
}

function  sendRequestShopBox(username,isSendData,urlname,username1,password)  {
	  createXMLHttpRequestShopBox();
	  var  url  =  username;
         XMLHttpReqShopBox.open("GET", url+"?t="+Math.random()+"&UserName="+username1+"&UserPwd="+password,true);
         XMLHttpReqShopBox.onreadystatechange  =  processResponseShopBox;
         XMLHttpReqShopBox.send();
         
}

function  sendRequestLogoutBox(username,urlname)  {
	  createXMLHttpRequestBox1();
	  var  url  =  username;
         XMLHttpReqBox1.open("GET", url,true);
	  XMLHttpReqBox1.onreadystatechange  =  processResponseLogoutBox;
         XMLHttpReqBox1.send();
         
}
function  IsDisplayLoginIQ()  {
	    var docm=parse(XMLHttpReq.responseText);
	    try{ 
	     if(docm.getElementsByTagName("Code")[0].firstChild.nodeValue=="D"){
	     	   var LoginTable="<table width=\"428\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"88\"><a style='cursor:hand'  href=\"#\" onclick=\"javascript:ToggleShowBuyBox();\"><img src=\"Images/p_gwc.gif\" width=\"19\" height=\"15\" border=\"0\" />购物车</a></td><td width=\"308\" height=\"26\"><a href=\"#\"  style='cursor:hand' onclick='javascript:ToggleLoginBox();'>登录</a>&nbsp;|&nbsp;<a href=\"#\" style=\"cursor:hand\" onclick='javascript:ToggleRegisterBox();'>免费注册</a>&nbsp;|&nbsp;<a href=\"#\" onClick=\"this.style.behavior='url(#default#homepage)';this.setHomePage('www.Learning365.com');\">设为首页</a>&nbsp;|&nbsp;<a href=\"javascript:window.external.AddFavorite('http://www.Learning365.com&#39;,'Learning365 学习在线')\">加入收藏夹</a></td></tr></table>";

                HasLogin="";
                   

	     	  document.getElementById("login").innerHTML=LoginTable; 
	     }else{
	     	if(docm.getElementsByTagName("UrlName")[0].firstChild.nodeValue=="Check_Is_Login.htm"){
	     		window.location.href="http://192.168.1.99:8080/coonowsite/User_Judian_Append.jsp?qid="+gqid;    		
	     	}else if(docm.getElementsByTagName("UrlName")[0].firstChild.nodeValue=="Check_Is_Login1.htm"){
	     		window.location.href="http://192.168.1.99:8080/coonowsite/User_Judian_Correct.jsp?qid="+gqid;    		
	     	}
	     	else{
	     	  var tmp="";
                  tmp=tmp+"<table width=\"428\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
		     tmp=tmp+"   <tr>"; 
                     tmp=tmp+"    <td width=\"78\"><a style='cursor:hand'  href=\"#\" onclick=\"javascript:ToggleShowBuyBox();\"><img src=\"Images/p_gwc.gif\" width=\"19\" height=\"15\" border=\"0\" />购物车</a></a></td>"; 
                     tmp=tmp+"    <td width=\"350\" align='left'>";
                     tmp=tmp+"<span class='txt05'>"+docm.getElementsByTagName("UserName")[0].firstChild.nodeValue+"</span>|";
                     tmp=tmp+"<a style='cursor:hand' href='../download/enter.exe' >我的课程中心</a>|";
                     tmp=tmp+"<a href='#' onClick=\"this.style.behavior='url(#default#homepage)';this.setHomePage('www.Learning365.com');\">设为首页</a>|<a href=\"javascript:window.external.AddFavorite('http://www.Learning365.com&#39;,'Learning365 学习在线')\">加入收藏夹</a>";
                     tmp=tmp+"<input type=\"button\" name=\"quit\" onclick=\"javascript:Logout();\" value=\"退出\" />";
                     tmp=tmp+"      </td>"; 
                     tmp=tmp+"  </tr>"; 
                     tmp=tmp+"</table>"; 
                  document.getElementById("login").innerHTML=tmp; 
	    	  HideProcess();

	    	}

	    }
	  }catch(e){}
	     
}
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   g(v){   
  try{return   v.match(/[\u4e00-\u9fa5]/g).length}catch(e){return   0}   
 }  
var boxAskQuestion=null;
function Toggle_Ask_Question(){
    ShowProcess("正在提问页面,请稍侯!"); 
    var width = 645;
    var height = 450;
    var html = '<iframe src=\"http://www.learning365.com/coonowsite/User_Ask_Question_com.jsp\" frameborder="0" width="' + width + 'px" height="' + height + 'px" scroll="no" ></iframe>';
    boxAskQuestion= null;
    if(boxAskQuestion== null)
    {
        boxAskQuestion= new CommonBox(html,'提问',0,0,width,0,false,true,null);
    }
    else
    {
        boxAskQuestion.SetContent(html);
    }
    boxAskQuestion.Toggle();
     HideProcess();


}




function  createXMLHttpRequest()  {
    if(window.XMLHttpRequest)  { 
       XMLHttpReq  =  new  XMLHttpRequest();
     }
     else  if  (window.ActiveXObject)  { 
     try  {
       XMLHttpReq  =  new  ActiveXObject("Msxml2.XMLHTTP");
     }catch(e){
        try  {
           XMLHttpReq  =  new  ActiveXObject("Microsoft.XMLHTTP");
        }catch(e){}
     }
    }
}
/**
==================================================================
CheckIsLoginIQ():检查是否登陆
==================================================================
*/
function CheckIsLoginIQ(urlname){
	createXMLHttpRequest();
	var  url1  =  "../User_Is_Login.jsp?urlname="+urlname+".htm&t="+Math.random();
        XMLHttpReq.open("get", url1,  true);
	XMLHttpReq.onreadystatechange  =  processDisplayIQ;
	XMLHttpReq.send(null);
}
function  processDisplayIQ()  {
      if(XMLHttpReq.readyState  ==  4){
        if(XMLHttpReq.status  ==  200){
        	IsDisplayLoginIQ();
        }  else  {
        	
        }
      }
}
function closeandredirect(urlname){
      top.window.location.href=urlname;

}
function  createXMLHttpRequest4()  {
	  
    if(window.XMLHttpRequest)  { 
       XMLHttpReq4  =  new  XMLHttpRequest();
     }
     else  if  (window.ActiveXObject)  { 
     try  {
       XMLHttpReq4  =  new  ActiveXObject("Msxml2.XMLHTTP");
     }catch(e){
        try  {
           XMLHttpReq4  =  new  ActiveXObject("Microsoft.XMLHTTP");
        }catch(e){}
     }
    }
    
}
function  sendRequest2(username,inum,isSendData)  {
		var  url  =  username;
		XMLHttpReq4.open("post", url,  true);
		XMLHttpReq4.onreadystatechange  =  processResponseNewQuestion;
		if(isSendData==1){
		  XMLDom=fillXMLDoc1(inum);
		  XMLHttpReq4.send(strData);
	  }else{
		  XMLHttpReq4.send(null);
	  }
		
}
function IsDisplayNewQuestion(){
	   var doc=parse(XMLHttpReq4.responseText);
	   var hotprofessor="";
	   if(doc.getElementsByTagName("Code")[0].firstChild==null||doc.getElementsByTagName("Code")[0].firstChild.nodeValue=="D"){
	    	 hotprofessor="<table width='98%' border='0' cellpadding='0' cellspacing='0' ><tr><td >暂无最新问题!</td></tr></table>";
	    	 document.getElementById("newquestion").innerHTML=hotprofessor;
	    }else{
	    	if(doc.getElementsByTagName("FileName")[0].firstChild.nodeValue==""){ 
	    	 hotprofessor="<table width='98%' border='0' cellpadding='0' cellspacing='0' >";
	    	}else{
	    	 hotprofessor="<table width='97%' border='0' cellpadding='0' cellspacing='0' >";
	    		} 
	    	 var list=doc.selectNodes("/Result/Question");
	    	 var tablecontent="";
	    	 var j=0;
	    	 for(j=0;j<list.length;j++) {
	    	     var doc3=parse(list[j].xml);
	    	     var mydate=new Date();
	    	     tablecontent=tablecontent+"<tr>";
	    	     tablecontent=tablecontent+"<td ><a href='coonowsite/QuestionShowCenter.htm?qid="+doc3.getElementsByTagName("QuestionID")[0].firstChild.nodeValue+"&date="+Math.random()+"' target='_blank' class='gray' title='"+doc3.getElementsByTagName("Content")[0].firstChild.nodeValue+"'>"+doc3.getElementsByTagName("Title")[0].firstChild.nodeValue+"</td>";
                     tablecontent=tablecontent+"</tr>";
                  }
         
                  hotprofessor=hotprofessor+tablecontent+"</table></td></tr></table>";
         
                  document.getElementById("newquestion").innerHTML=hotprofessor;
	    }
	    
	}
function fillXMLDoc1(inum){
	strData="<?xml version='1.0' encoding='GB2312'?><User_HotQuestion>";
	strData=strData+"<UserNum>"+escape(escapeXML(inum))+"</UserNum>";
	strData=strData+"</User_HotQuestion>";
	var xmlDom =null;
	xmlDom= CreateXMLParser();//new ActiveXObject("MSXML2.DOMDocument.4.0");
	xmlDom=parse(strData);
  return xmlDom;
}

function  processResponseNewQuestion()  {
      if(XMLHttpReq4.readyState  ==  4){
        if(XMLHttpReq4.status  ==  200){
					IsDisplayNewQuestion();
          
        }  else  {
        	
        }
      }
}

function getNewQuestions( inum, obji){
  createXMLHttpRequest4();	
  var url ="coonowsite/Index_NewQuestion.jsp?t="+Math.random();
  sendRequest2(url,inum,1)
}
function escapeXML(content) {
    if (content == undefined)
        return "";
    if (!content.length || !content.charAt)
        content = new String(content);
    var result = "";
    var length = content.length;
    for (var i = 0; i < length; i++) {
        var ch = content.charAt(i);
        switch (ch) {
            case '&':
                result += "&amp;";
                break;
            case '<':
                result += "&lt;";
                break;
            case '>':
                result += "&gt;";
                break;
            case '"':
                result += "&quot;";
                break;
            case '\'':
                result += "&apos;";
                break;
            default:
                result += ch;
        }
    }
    return result;
}
function parse(xml) {
	var dom;
	try{
		dom = new ActiveXObject("Microsoft.XMLDOM");
		dom.async = false;
		dom.loadXML(xml);
	} catch (error) {
	  try{
			var parser = new DOMParser();
			dom = parser.parseFromString(xml, "text/xml");
			delete parser;
		} catch (error2) {
			if (debug)
				alert("XML parsing is not supported.");
	    }
	  }
	return dom;
}
var boxLongRe = null;
function openLongRe(id){
    var file="http://61.172.200.157/ViewLongRe.asp?id="+id;
    var width = 900;
    var height = 500;
    var html = '<iframe src='+file+' frameborder="0" width="' + width + 'px" height="' + height + 'px" scroll="no" ></iframe>';
    boxLongRe = null;
    if(boxLongRe == null)
    {
        boxLongRe = new CommonBox(html,'相关新闻',0,0,width,0,false,true,null);
    }
    else
    {
        boxLongRe .SetContent(html);
    }
    boxLongRe .Toggle();

}
function ShowExamDialog()
{
    var width = 782;
    var height = 580;
     gGoodId=Math.random();
    var html = '<iframe src="../exam/index.html"  name="ExamDiaLog'+gGoodId+'" id="ExamDiaLog'+gGoodId+'" frameborder="0" width="' + width + 'px" height="' + height + 'px"  scrolling="no"></iframe>';
    boxRegister =null;
     if(boxRegister == null)
    {
        boxRegister = new CommonBox(html,'朗阁九周年庆--------第一听力',0,0,width,0,true,true,null);
    }
    else
    {
        boxRegister.SetContent(html);
    }
    boxRegister.Toggle();
}


