String.prototype.trim = function()
{
   return this.replace(/(^\s+)|\s+$/g,"");
}
//关闭全部Windows
function CloseAll()
{
window.parent.location.reload();
//window.close();   
	//form_data.closeAll();
}

//从这里开始第一步
//targetUrl:页面转到路径 如果targetUrl为空代表不需要转到页面 只是判断是否登陆 
//info:是否需要ajaxWindows Bool类型 [True代表需要ajaxWindow] [False代表location.href]
//Width:宽度 Height:高度 Title:弹出页面标题
//closeInfo:判断是否需要叶面右上角的关闭按钮 0：没有 1：有
//Request:传入参数 例如：id=1&type=1
var cookie="0";
function NeedCookie(targetUrl,info,Title,Width,Height,closeInfo,Request)
{
	//首先读取Cookie 如果为0 证明Cookie为空
	var request = "random="+Math.random();
	new Ajax.Request(
		'/common/ajaxCookie.aspx',
		{
			method: 'post',
			postBody: request,
			onComplete: function(response) 
			{
				var t=response.responseText;
		        var dateArray = t.split(":");
		        cookie=dateArray[0];
		        var vip = dateArray[1];
		        var type = dateArray[2];//用户类型
				if (cookie=="0") 
				{
					//ajax_login(false, targetUrl,'登陆界面',info,Title,Width,Height,closeInfo,Request);
					alert('您尚未登录,请登录成功后再进行该操作.');
				} 
				else 
				{
					if (info == false)//如果不需要AjaxLogin 直接转到该页面
					{
						location.href = targetUrl;
					}
					else
					{
				    	//alert('您尚未登录,请登录成功后再进行该操作.');
						Windows.closeAll();
						ajaxOpenDialog(targetUrl,Title,Width,Height,closeInfo,Request) 
					}
				}
			}
		}
	);
}

//此方法是为了调用登陆页面
var loginDialog = null;
var redirectUrl = '';
var userinfo;
var userTitle;
var userwidth;
var userheight;
var RequestString;
var usercloseInfo;
function ajax_login(force, targetUrl, ajaxtitle,info,title,width,height,closeInfo,Request) 
{
	loginDialog = new Window(
		{
			className: "bluelighting",
			title: ajaxtitle || "该页面需要登录",
			parent: document.body,
			width: 850,
			height: 470,
			destroyOnClose: true,
			recenterAuto: true,
			closable: !force,
			resizable:false,
			draggable:false,
			maximizable: false
		}
	);
	loginDialog.getContent().update('<div class="working-img"></div>');
	loginDialog.showCenter(true);
	new Ajax.Request(
		'/common/login.aspx',
		{
			method: 'post',
			onSuccess: function(transport) {
				loginDialog.getContent().innerHTML = transport.responseText;
				
				if (targetUrl) {
					redirectUrl = targetUrl;
					userinfo = info;
					userTitle = title;
					userwidth = width;
					userheight = height;
					usercloseInfo = closeInfo;
					RequestString = Request;
				} else {
					windows.location.reload();
				}
			}
		}
	);
}

//此方法调用预约后台按钮事件
function doTutorOrder()
{
	//if (IsTutorOrder()==true)//首先判断内容是否填写完整并符合规格
	//{
		var post = "random="+Math.random();
		new Ajax.Request('/common/TutorOrderLoginData.aspx',
		{
			method: 'post',
			parameters: post,
			onSuccess: function(request)
			{
				var data = request.responseText;
				alert(data);
				window.parent.location.reload();
				//loginDialog.close();
				//window.location.reload();
			}
		})
	//}
}

//此方法调用预定后台按钮事件
function doTutorContract()
{
	if (IsTutorContract()==true)//首先判断内容是否填写完整并符合规格
	{
		new Ajax.Request('/common/TutorContractLoginData.aspx',
		{
			method: 'post',
			parameters: Form.serialize('login-form'),
			onSuccess: function(request)
			{
				var data = request.responseText;
				alert(data);
				//loginDialog.close();
				//window.location.reload();
			}
		})
	}
}

//此方法调用转到页面的按钮事件[登陆按钮 后台进行代码处理判断]
function doLogin()
{
	new Ajax.Request('/common/ajaxdo.aspx',
	{
		method: 'post',
		parameters: Form.serialize('login-form'),
		//parameters: request,
		onSuccess: function(request)
		{
			var data = request.responseText;
			if(data != "-1")// true 代表通过
			{
				//Windows.closeAll();

				if (redirectUrl!="")
				{
					if (userinfo==true)
					{
						
							ajaxOpenDialog(redirectUrl,userTitle,userwidth,userheight,usercloseInfo,RequestString);
						}
					else
					{	
						location.href = redirectUrl;
						location.reload();
						}
				}
				else
				{
					Windows.closeAll();
				}
			} 
			else 
			{
				//alert('无法登录，请检查您的输入');
				displayError('login-error', '无法登录，请检查您的输入');
			}
		}
	}
	);
}
//此方法调用转到页面的按钮事件[登陆按钮 后台进行代码处理判断]
function doLogin2()
{
	
	new Ajax.Request('/common/ajaxdo.aspx',
	{
		method: 'post',
		parameters: Form.serialize('login-form'),
		//parameters: request,
		onSuccess: function(request)
		{
			var data = request.responseText;
			
			if(data != "-1")// true 代表通过
			{
				//Windows.closeAll();
				
				if (redirectUrl!="")
				{
					if (userinfo==true)
					{
						
							ajaxOpenDialog(redirectUrl,userTitle,userwidth,userheight,usercloseInfo,RequestString);
						}
					else
					{	
						location.href = redirectUrl;
						location.reload();
						}
				}
				else
				{
					Windows.closeAll();
				}
			} 
			else 
			{
				//alert('无法登录，请检查您的输入');
				displayError('login-error', '无法登录，请检查您的输入');
			}
		}
	}
	);
}


//登陆错误方法
function displayError(info, message) 
{
	Element.update(info, '<img src="http://pic.78ic.com/images/login/zaadad.gif" alt="错误："  /> ' + message);

}

//根据已经弹出的AJAX对话框（登陆界面） 直接转到Url[目前专为TutorOrder编写]
function ajaxOpenDialog(url,title,width,height,closeInfo,Request) 
{
	if (Request!='')
	{	url = url + "?" + Request; }
	
	var c = true;//closable
	var m = true;//maximizable
	if (closeInfo=="0")//判断如果不需要关闭按钮的话
	{
		c = false;m=false;	
	}
	var dialog = new Window(
		{
			url: url, 
			className: "bluelighting",
			title: title,
			parent: document.body,
			width:width,
			height:height,
			destroyOnClose: true,
			recenterAuto: true,
			closable: c,
			minimizable: false,
			maximizable: m,
			//top:100, left:100,  width:300, height:200, zIndex:150, opacity:1, 
			resizable:false,
			draggable:false
		}
	);
	dialog.setDestroyOnClose();
    dialog.showCenter(true);

}


//此方法为课程评论 提交事件
//contact: 评论内容
//cid: 课程ID号
//courseType: 课程分类id号[1：大课程 2：小班 3：1对1辅导 4：答疑室 5：课件]
//courseName: 课程名称
//divHtml: 接收ajax返回值的控件
//textArea: 填写评论内容的控件(TextArea)
//pagesize: 每页个数
//Tid: 老师的UID
//SelectType:显示类别 [1：大课程 2：小班 3：1对1辅导 4：答疑室 5：课件 0：是前台直接进行评论] 例如:1,2,3
function postDataEvaluation(contact,cid,courseType,courseName,divHtml,textArea,pagesize,Tid,SelectType)
{
	//首先读取Cookie 如果为0 证明Cookie为空
	var request = "random="+Math.random();
	new Ajax.Request(
		'/common/ajaxCookie.aspx',
		{
			method: 'post',
			postBody: request,
			onComplete: function(response) 
			{
				cookie=response.responseText;
				//alert(cookie);
				if (cookie=="0") 
				{
					ajax_login(false, "",'登录界面',"","","","","1","");
				} 
				else 
				{
					if (contact.trim()!="")
					{
						var postbody="contact="+contact+"&CID="+cid+"&CourseType="+courseType+"&CourseName="+courseName+"&divHtml="+divHtml+"&pagesize="+pagesize+"&Tid="+Tid+"&SelectType="+SelectType+"&random="+Math.random();
				
						var myajax=new Ajax.Request
						 (
							  "/common/doAjaxCE.aspx",
							  {
								  method:'post',
								  postBody: postbody,
								  onFailure:function onFailure(request)
								  {
									 $(divHtml).innerHTML = request.responseText ;
								  },
								  onComplete:function showResponse(response)
								  {
										var t = response.responseText;
									  	
										$(divHtml).innerHTML=t;
								  }
							  }
						 )
					 }
					 $(textArea).innerHTML="";
				}
			}
		}
	);
	
}

//此方法为课程评论显示数据信息类
//pageindex:当前页码
//cid:课程ID号
//courseType:课程分类id号[1：大课程 2：小班 3：1对1辅导 4：答疑室 5：课件点播中心]
//divHtml: 接收ajax返回值的控件
//pagesize: 每页显示个数
//Tid: 老师的UID 
//SelectType:显示类别 [1：大课程 2：小班 3：1对1辅导 4：答疑室 5：课件点播中心 0：是前台直接进行评论] 例如:1,2,3
function loadDataEvaluation(pageindex,cid,courseType,divHtml,pagesize,Tid,SelectType)
{
	var postbody="CID="+cid+"&CourseType="+courseType+"&Page="+pageindex+"&divHtml="+divHtml+"&pagesize="+pagesize+"&Tid="+Tid+"&SelectType="+SelectType+"&random="+Math.random();

	var myajax=new Ajax.Request
		 (
			  "/common/doAjaxCE.aspx",
			  {
				  method:'post',
				  postBody: postbody,
				  onFailure:function onFailure(request)
				  {
					 $(divHtml).innerHTML = request.responseText ;
				  },
				  onComplete:function showResponse(response)
				  {
					  $(divHtml).innerHTML=response.responseText;
				  }
				  
			  }
		 )
}

//此方法为调用“学生老师课程介绍”
//info:student&teacher
function loadTutor_ST(info,divHtml)
{
	var postbody="info="+info+"&random="+Math.random();

	var myajax=new Ajax.Request
		 (
			  "/common/doAjaxTutor.aspx",
			  {
				  method:'post',
				  postBody: postbody,
				  onFailure:function onFailure(request)
				  {
					 $(divHtml).innerHTML = request.responseText ;
				  },
				  onComplete:function showResponse(response)
				  {
					  $(divHtml).innerHTML=response.responseText;
				  }
				  
			  }
		 )
}

//此方法为发布课程信息
//uid: 用户uid
//divHtml: 接收ajax返回值的控件
//info: all表示显示（课程+班级） one表示显示（回顾课程）
//page: 是否分页 0不分 1分
//pagesize: 页码
//pageindex: 当前页码
function loadCourseTutor(uid,divHtml,info,page,pagesize,pageindex)
{
	var postbody="uid="+uid+"&info="+info+"&Page="+page+"&PageSize="+pagesize+"&pageindex="+pageindex+"&random="+Math.random();

	var myajax=new Ajax.Request
		 (
			  "/common/doCourseTutor.aspx",
			  {
				  method:'post',
				  postBody: postbody,
				  onFailure:function onFailure(request)
				  {
					 alert("failure");
					 $(divHtml).innerHTML = request.responseText ;
				  },
				  onComplete:function showResponse(response)
				  {
					  $(divHtml).innerHTML=response.responseText;
				  }
				  
			  }
		 )
}

//此方法让控件只能输入数字
function OnKeyDown()
{
	if ( (event.keyCode ==8 || event.keyCode == 46) || 
	(event.keyCode >=48 && event.keyCode <=57) || 
	(event.keyCode >=96 && event.keyCode <=105) )
	{        
		event.returnValue = true;
		return true;
	}
	else 
	{
		event.returnValue = false;
		return false;
	}
}



//计算总时长
function CalcSumTime()
{
	var count = $F('count')	==""?"0":$F('count');
	var hours = $F('hours')==""?"0":$F('hours');

//	$F('sumhours') = Math.round(count);
}

//取得控件ID号
function getObject(objectId) 
{
    if(document.getElementById && document.getElementById(objectId)) 
	{
	// W3C DOM
	return document.getElementById(objectId);
    } 
	else if (document.all && document.all(objectId)) 
	{
	// MSIE 4 DOM
	return document.all(objectId);
    } 
	else if (document.layers && document.layers[objectId]) 
	{
	// NN 4 DOM.. note: this won't find nested layers
	return document.layers[objectId];
    } 
	else 
	{
	return false;
	}
}

///变换Tab导航
//i:控件ID
function changeArea(i)
{
	for(a=1;a<8;a++)
	{

		getObject('TitleImg'+a.toString()).className="white14b";
		getObject('TitleImg'+a.toString()).background="http://pic.78ic.com/images/bg_nav02.gif";
		getObject('HeadDiv'+a.toString()).style.display='none';
	}
		getObject('TitleImg'+i.toString()).background="http://pic.78ic.com/images/bg_nav01.gif";
		getObject('HeadDiv'+i.toString()).style.display='block';
		getObject('TitleImg'+a.toString()).className="white14b";
}

//判断用户Cookie
function ajaxCookie()
{
	var request = "random="+Math.random()+"&info=1";//需要显示用户信息
	
	var myajaxcookie= new Ajax.Request(
	'/common/ajaxCookie.aspx',
	{
		method: 'post',
		postBody: request,
		onComplete: function showResponse(response) 
					{
						var cookie=response.responseText;
						//alert(cookie);
						if (cookie!="0") 
						{
							 $('loginDiv').innerHTML=response.responseText;
						}
						else
						{
							 $('loginDiv').innerHTML="<table width=\"99%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"margin-right:10px;\">"+
							"<tr>"+
							"<td align=\"left\" valign=\"middle\">用户名：</td>"+
							"<td align=\"left\" valign=\"middle\"><input id=\"user\" name=\"textfield\" type=\"text\" class=\"loginrim03\" /></td>"+
							"<td align=\"left\" valign=\"middle\">密码：</td>"+
							"<td align=\"left\" valign=\"middle\"><input id=\"pwd\" name=\"textfield2\" type=\"password\" class=\"loginrim03\" /></td>"+
							"<td align=\"left\" valign=\"middle\">验证码：</td>"+
							"<td align=\"left\" valign=\"middle\"><input id=\"imgnum\" name=\"textfield3\" type=\"text\" class=\"loginrim04\"  /></td>"+
							"<td width=\"40\" align=\"left\" valign=\"middle\"><img id=\"ImgNums\" width=\"52\" height=\"20\" style=\"CURSOR: pointer\" alt=\"看不清楚，换一张\" onclick=\"ajaxSignOut('1');\"  src='/common/VerifyGenerateImg.aspx?i="+Math.random()+"' /></td>"+

							"<td align=\"center\" valign=\"middle\"><a href=\"#\"><img src=\"http://pic.78ic.com/images/menu_login.gif\" width=\"41\" height=\"17\" border=0 style=\"cursor:hand\" onclick=\"loadLoginTOP();\" /></a></td>"+
							"<td align=\"center\" valign=\"middle\"><a href=\"http://vip.78ic.com/\" target=\"_blank\"><img src=\"http://pic.78ic.com/images/vip_login.gif\" width=\"80\" height=\"17\" border=0 style=\"cursor:hand\"  /></a></td>"+
							"<td align=\"center\" valign=\"middle\"><a href=\"http://passport.78ic.com/regstudent.aspx\" target=\"_blank\"><img src=\"http://pic.78ic.com/images/xszcan.gif\" width=\"60\" height=\"17\" border=\"0\" /></a></td>"+
							"<td align=\"center\" valign=\"middle\"><a href=\"http://passport.78ic.com/regteacher.aspx\" target=\"_blank\"><img src=\"http://pic.78ic.com/images/jszccan.gif\" width=\"60\" height=\"17\" border=\"0\" /></a></td>"+
							"<td align=\"center\" valign=\"middle\" ><a href=\"http://passport.78ic.com/getpwd.aspx\" target=\"_blank\" class=\"zf_white\">忘记密码</a></td>"+
							"</tr>"+
							"</table>";
							
					}
					}
	})
}

//此方法调用Head里的登陆按钮
function loadLoginTOP()
{

	var loginName = $F('user');
	var pwd = $F('pwd');
	var ImgNum = $F('imgnum');
	if (loginName.trim()=="")
	{
		alert('请您填写用户名！');
		return;
	}
	if (pwd.trim()=="")
	{
		alert("请您填写密码！");
		return;
	}
	if (ImgNum.trim()=="")
	{
		alert("请您依照图片填写验证码！");
		return;
	}
	var postbody="loginName="+loginName+"&pwd="+pwd+"&ImgNum="+ImgNum+"&random="+Math.random();
	var rt="1";
	var myajax=new Ajax.Request
		 (
			  "http://www.78ic.com/common/ajaxLoginTop.aspx",
			  {
				  method:'post',
				  postBody: postbody,
				  onComplete:function showResponse(response)
				  {
					rt = response.responseText;
					//alert(rt);
					if (rt!="-1")
					{
						if (rt!="0")
						{
							
							$('loginDiv').innerHTML=response.responseText;
							
						}
						else
						{
							alert("登录失败！");    
						}
					}
					else
					{alert("登录失败！请您检查是否填写正确！");    }
				  }
				  
			  }
		 )

}

//用户退出 Head
function ajaxSignOut(num)
{
	var postbody="random="+Math.random();

	var myajax=new Ajax.Request
		 (
			  "http://www.78ic.com/common/ajaxSignOut.aspx",
			  {
				  method:'post',
				  postBody: postbody,
				  onComplete:function showResponse(response)
				  {
					  if (num!="1")
					  {
					  alert('用户退出成功！');
					  }
					  $('loginDiv').innerHTML="<table width=\"99%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"margin-right:10px;\">"+
							"<tr>"+
							"<td align=\"left\" valign=\"middle\">用户名：</td>"+
							"<td align=\"left\" valign=\"middle\"><input id=\"user\" name=\"textfield\" type=\"text\" class=\"loginrim03 \" /></td>"+
							"<td align=\"left\" valign=\"middle\">密码：</td>"+
							"<td align=\"left\" valign=\"middle\"><input id=\"pwd\" name=\"textfield2\" type=\"password\" class=\"loginrim03 \" /></td>"+
							"<td align=\"left\" valign=\"middle\">验证码：</td>"+
							"<td align=\"left\" valign=\"middle\"><input id=\"imgnum\" name=\"textfield3\" type=\"text\" style=\"width:50px;\" class=\"loginrim04 \" /></td>"+
							"<td width=\"40\" align=\"left\" valign=\"middle\" ><img id=\"ImgNums\"  width=\"52\" height=\"20\" style=\"CURSOR: pointer\" alt=\"看不清楚，换一张\" onclick=\"ajaxSignOut('1');\"  src='/common/VerifyGenerateImg.aspx?i="+Math.random()+"' /></td>"+
							"<td align=\"center\" valign=\"middle\"><a href=\"#\"><img src=\"http://pic.78ic.com/images/menu_login.gif\" width=\"41\" height=\"17\" border=0 style=\"cursor:hand\" onclick=\"loadLoginTOP();\" /></a></td>"+
							"<td align=\"center\" valign=\"middle\"><a href=\"http://vip.78ic.com/\" target=\"_blank\"><img src=\"http://pic.78ic.com/images/vip_login.gif\" width=\"80\" height=\"17\" border=0 style=\"cursor:hand\"  /></a></td>"+
							"<td align=\"center\" valign=\"middle\"><a href=\"http://passport.78ic.com/regstudent.aspx\" target=\"_blank\"><img src=\"http://pic.78ic.com/images/xszcan.gif\" width=\"60\" height=\"17\" border=\"0\" /></a></td>"+
							"<td align=\"center\" valign=\"middle\"><a href=\"http://passport.78ic.com/regteacher.aspx\" target=\"_blank\"><img src=\"http://pic.78ic.com/images/jszccan.gif\" width=\"60\" height=\"17\" border=\"0\" /></a></td>"+
							"<td align=\"center\" valign=\"middle\" ><a href=\"http://passport.78ic.com/getpwd.aspx\" target=\"_blank\" class=\"zf_white\">忘记密码</a></td>"+
							"</tr>"+
							"</table>";
				  }
				  
			  }
		 )
}

//老师空间的老师公告
function loadDataBulletin(uid,divHtml)
{
	var postbody="UID="+uid+"&random="+Math.random();

	var myajax=new Ajax.Request
		 (
			  "/common/doBulletin.aspx",
			  {
				  method:'post',
				  postBody: postbody,
				  onComplete:function showResponse(response)
				  {
					  $(divHtml).innerHTML=response.responseText;
				  }
				  
			  }
		 )
}

//此方法调用78ic的登陆按钮
//url:转到路径
//chk：是否同时登录清大IC客户端
function loadLogin78ic(url,chk)
{
	
	var loginName = $F('user');
	var pwd = $F('pwd');
	var ImgNum = $F('imgnum');
	if (loginName.trim()=="")
	{
		$('loginDiv').innerHTML="<img src='http://pic.78ic.com/images/login/zaadad.gif' />请您填写用户名！";
		return;
	}
	if (pwd.trim()=="")
	{
		$('loginDiv').innerHTML="<img src='http://pic.78ic.com/images/login/zaadad.gif' />请您填写密码！";
		return;
	}
	if (ImgNum.trim()=="")
	{
		$('loginDiv').innerHTML="<img src='http://pic.78ic.com/images/login/zaadad.gif' />请您依照图片填写验证码！";
		return;
	}
	var postbody="loginName="+loginName+"&pwd="+pwd+"&ImgNum="+ImgNum+"&random="+Math.random();

	var myajax=new Ajax.Request
		 (
			  "/common/ajaxLoginTop.aspx",
			  {
				  method:'post',
				  postBody: postbody,
				  onComplete:function showResponse(response)
				  {
					var rt = response.responseText;
					
					if (rt!="0")
					{
						if (chk==true)
						{
							//是否同时登录清大IC客户端
						}
						if (url!="")
						{
							alert('登录成功！');
							location.href=url;
						}
						else
						{
							$('loginDiv').innerHTML="登录成功！";
						}
					}
					else
					{
						//<img src="http://pic.78ic.com/images/login/mngdl_dlj2.gif" width="10" height="10" />
						$('loginDiv').innerHTML="<img src='http://pic.78ic.com/images/login/zaadad.gif' />登录失败！请检查信息是否填写正确！";
					}
				  }
				  
			  }
		 )
}

//该老师其它课程
//uid: 用户uid
//divHtml: 接收ajax返回值的控件
//Id <>排除的id号
//pagesize: 页码
//pageindex: 当前页码
//top:#top
function loadRECC(uid,Id,divHtml,pagesize,pageindex,top)
{
	var postbody="uid="+uid+"&Id="+Id+"&PageSize="+pagesize+"&pageindex="+pageindex+"&top="+top+"&random="+Math.random();

	var myajax=new Ajax.Request
		 (
			  "/common/OtherRECCourse.aspx",
			  {
				  method:'post',
				  postBody: postbody,
				  onComplete:function showResponse(response)
				  {
					  $(divHtml).innerHTML=response.responseText;
				  }
				  
			  }
		 )
}

//课节信息
//rid: 课程id号
//tid: 老师id号
//divHtml: 接收ajax返回值的控件
function loadRECS(rid,tid,divHtml)
{
	var postbody="RID="+rid+"&TID="+tid+"&random="+Math.random();

	var myajax=new Ajax.Request
		 (
			  "/common/OtherRECCourse.aspx",
			  {
				  method:'post',
				  postBody: postbody,
				  onComplete:function showResponse(response)
				  {
					  $(divHtml).innerHTML=response.responseText;
				  }
				  
			  }
		 )
}

//此方法调用"我要听课"事件
function RECExchangeClick()
{
	new Ajax.Request('/common/RECExchangeData.aspx',
	{
		method: 'post',
		parameters: Form.serialize('login-form'),
		onSuccess: function(request)
		{
			var data = request.responseText;
			alert('报名成功！');
			//loginDialog.close();
			//window.location.reload();
		}
	})
}

//此方法调用答疑室
function ajaxDoAskRoom(divHtml,Term,Course,pageindex,pagesize)
{
	var postbody="";
	if (Term!=""&&Course!="")
	{
		postbody="Term="+Term+"&Course="+Course+"&pageindex="+pageindex+"&pagesize="+pagesize+"&random="+Math.random();
	}
	var myajax=new Ajax.Request
		 (
			  "/common/ajaxAskRoom.aspx",
			  {
				  method:'post',
				  postBody: postbody,
				  onComplete:function showResponse(response)
				  {
					  $(divHtml).innerHTML=response.responseText;
				  }
				  
			  }
		 )
}

function ajaxDoAskTeacher(divHtml,Uid,pageindex,pagesize,top)
{
	if (Uid!="0")
	{
		var postbody="";
		postbody="Uid="+Uid+"&pageindex="+pageindex+"&pagesize="+pagesize+"&top="+top+"&random="+Math.random();
		var myajax=new Ajax.Request
		 (
			  "/common/ajaxAskRoom.aspx",
			  {
				  method:'post',
				  postBody: postbody,
				  onComplete:function showResponse(response)
				  {
					  $(divHtml).innerHTML=response.responseText;
				  }
				  
			  }
		 )
	}
}

function ajaxhonorScoreGroup(Uid,pageindex,pagesize)
{
	if (Uid!="0")
	{
		var postbody="";
		postbody="Uid="+Uid+"&pageindex="+pageindex+"&pagesize="+pagesize+"&random="+Math.random();
		var myajax=new Ajax.Request
		 (
			  "/common/honorScoreGroup.aspx",
			  {
				  method:'post',
				  postBody: postbody,
				  onComplete:function showResponse(response)
				  {
					  $('GroupList').innerHTML=response.responseText;
				  }
				  
			  }
		 )
	}
}

//info=0 总查询 1为个别查询
function ajaxdoSearch2(C,selectcourse,second,third,info)
{
	if (selectcourse=='-1')
	{
		alert('请选择课堂');
		return false;
	}
	else
	{
		var C1 = C;
		//if (C=="")
		//{
		//	C1=$F('FirstID2');
		//}

		var postbody="";
		postbody="Course="+selectcourse+"&C1="+C1+"&C2="+second+"&C3="+third+"&random="+Math.random();
		/////////////////////////////////////////////
			var myajax=new Ajax.Request
			 (

				  "/common/dosearch.aspx",
				  {
					  method:'post',
					  postBody: postbody,
					  onComplete:function showResponse(response)
					  {
						  var responseText = response.responseText;
						  //alert(responseText);
						  var tt;
						  if (info=="0")
						  {
						  tt="?Course="+escape(selectcourse)+"&C1="+escape(C1==''?'-1':C1)+"&C2="+escape(second==''?'-1':second)+"&C3="+escape(third==''?'-1':third);
						  }
						  else
						  {
							  tt="?Course="+escape(selectcourse)+"&C1="+escape(C1)+"&C2="+escape(second==''?'-1':second)+"&C3="+escape(third==''?'-1':third);
							}
						  if (responseText=="-1")
						  {
								location.href="http://www.78ic.com/searchmore.aspx"+tt;	
						  }
						  else
						  {
								location.href="http://www.78ic.com/searchresult.aspx"+tt;								  
						  }
						  window.location.href.reload();
					  }
					  
				  }
			 )

	}
}

function ajaxdoSearch()
{
	if ($F('selectcourse')=='-1')
	{
		alert('请选择课堂');
		return false;
	}
	else if ($F('selectTime')=='-1')
	{
		alert('请选择开课时间');
		return false;
	}
	else
	{

			var postbody="";
			postbody="Course="+$F('selectcourse')+"&C1="+$F('FirstID2')+"&C2="+$F('SecondID2')+"&C3="+$F('ThirdID2')+"&Time="+$F('selectTime')+"&random="+Math.random();
			var myajax=new Ajax.Request
			 (
				  "/common/dosearch.aspx",
				  {
					  method:'post',
					  postBody: postbody,
					  onComplete:function showResponse(response)
					  {
						  var responseText = response.responseText;
						  //alert(responseText)
						  var tt="?Course="+escape($F('selectcourse'))+"&C1="+escape($F('FirstID2')==''?'-1':$F('FirstID2'))+"&C2="+escape($F('SecondID2')==''?'-1':$F('SecondID2'))+"&C3="+escape($F('ThirdID2')==''?'-1':$F('ThirdID2'))+"&Time="+escape($F('selectTime'));
						  if (responseText=="-1")
						  {
								location.href="/search/searchmore.aspx"+tt;						  
						  }
						  else
						  {
								location.href="/search/Default.aspx"+tt;								  
						  }
						  window.location.href.reload();
					  }
					  
				  }
			 )

	}
}




function ajaxdoResultSearch(Course,C1,C2,C3,Time,pageindex,pagesize)
{
	var postbody="";
	if (C1=="-1")
	{C1="";}
	if (C2=="-1")
	{C2="";}
		if (C3=="-1")
	{C3="";}
	postbody="Course="+Course+"&C1="+C1+"&C2="+C2+"&C3="+C3+"&Time="+Time+"&random="+Math.random()+"&pageindex="+pageindex+"&pagesize="+pagesize;
		var myajax=new Ajax.Request
		 (
			  "http://www.78ic.com/common/dosearch.aspx?id=1",
			  {
				  method:'post',
				  postBody: postbody,
				  onComplete:function showResponse(response)
				  {
					  $('Result').innerHTML=response.responseText;
				  }
				  
			  }
		 )
}

function ajaxdoUnion(Info,Province,City,District,DivHtml)
{
	if (Province=="")
	{
		Province="-1"
	}
	if (City=="")
	{
		City="-1";
	}
	if (District=="")
	{
		District="-1";
	}
	var postbody="Info="+Info+"&Province="+Province+"&City="+City+"&District="+District+"&random="+Math.random();
	var myajax=new Ajax.Request
	 (
		  "/common/ajaxUnion.aspx",
		  {
			  method:'post',
			  postBody: postbody,
			  onComplete:function showResponse(response)
			  {
				  $(DivHtml).innerHTML=response.responseText;
			  }
			  
		  }
	 )

}

function OneOnOneTeacher(uid,pageindex,pagesize)
{
	var postbody="uid="+uid+"&pageindex="+pageindex+"&pagesize="+pagesize+"&random="+Math.random();
	var myajax=new Ajax.Request
	 (
		  "/common/ajaxTeacherOne.aspx",
		  {
			  method:'post',
			  postBody: postbody,
			  onComplete:function showResponse(response)
			  {
				  $('OneOnOneDiv').innerHTML=response.responseText;
			  }
			  
		  }
	 )
}