﻿try
{
document.domain="studyez.com";
}catch(e)
{
}
//替换页面连接脚本
function onreadystatechange()
{
	if (document.readyState=="complete") 
	{
     		//你要做的操作。
		activeHref();
   	}
	else
	{
		activeHref();
		setTimeout("onreadystatechange()",300); 
	}
}
var sHref = new String("");
try
{
    sHref = parent.location.hostname;
}
catch(e)
{
    sHref = "www.studyez.com";
}
var abDomain = new Array();
abDomain = sHref.split('.');
if(abDomain.length>=4)
{
	onreadystatechange();
}
function activeHref()
{
	if(abDomain[0]=="study" || abDomain[2]=="114pass" || abDomain[0]=="qhdyc")
	{
		removeKefu();
	}

	if (parent.location.hostname.indexOf(".studyez.com")<=0)
	{
		sHref=abDomain[abDomain.length-3] + "." + abDomain[abDomain.length-2] + "." + abDomain[abDomain.length-1];
	}
	else
	{
		sHref = "http://" + abDomain[0] + ".";
	}
	var h=document.links; 
	var len=h.length;
	for(i=0;i<len;i++){
		if(h[i].href == null || h[i].href.length <= 1)
		{
			continue;
		}
		else if(h[i].href.indexOf("www.studyez.com")>=1)
		{
			if (parent.location.hostname.indexOf(".studyez.com")<=0)
			{
				h[i].href=h[i].href.replace('http://www.studyez.com','http://' + sHref);
			}
			else
			{
				h[i].href=h[i].href.replace('http://www.',sHref);
			}
			continue;
		}
		else if(h[i].href.indexOf("www.xypeixun.com")>=1)
		{
			if (parent.location.hostname.indexOf(".studyez.com")<=0)
			{
				h[i].href="http://" + sHref + "/mianshou/";
			}
			else
			{
				h[i].href=sHref + "mianshou.studyez.com";
			}
			continue;
		}
		else if(h[i].href.indexOf("baoming.xypeixun.com")>=1)
		{
			h[i].href=sHref + "mianshou.studyez.com/payment";
			continue;
		}
		else if(h[i].href.indexOf("//caikuai.studyez.com")>=1 || h[i].href.indexOf("//sikao.studyez.com")>=1 || h[i].href.indexOf("//jiaoshi.studyez.com")>=1 || h[i].href.indexOf("//gongcheng.studyez.com")>=1 || h[i].href.indexOf("//yixue.studyez.com")>=1 || h[i].href.indexOf("//gongwuyuan.studyez.com")>=1 || h[i].href.indexOf("//kaoyan.studyez.com")>=1 || h[i].href.indexOf("//foreign.studyez.com")>=1 || h[i].href.indexOf("//waimao.studyez.com")>=1 || h[i].href.indexOf("//zhiye.studyez.com")>=1 || h[i].href.indexOf("//chengkao.studyez.com")>=1 || h[i].href.indexOf("//exam.studyez.com")>=1 || h[i].href.indexOf("//payment.studyez.com")>=1 || h[i].href.indexOf("//mianshou.studyez.com")>=1)
		{
			if (parent.location.hostname.indexOf(".studyez.com")<=0)
			{
				h[i].href=h[i].href.replace('.studyez.com','.' + sHref);
			}
			else
			{
				h[i].href=h[i].href.replace('http://',sHref);
			}
			continue;
		}
	}
}
function removeKefu()
{
	try {
	var divCS = document.getElementById("StudyEZ_CS");
	if(divCS != null)
	divCS.style.display="none"
	} catch(err)
	{}
}
// JScript File
//添加邮件订阅的脚本
  
   function  MailSendRequest()
   {
   
        var eadr=document.getElementById("studyezMsSubscribeEmailAddress").value;
        var re=/\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/i;
        var res=eadr.search(re);
        if(res==-1)
        {
             alert("格式不对！");
             return ;
        }
        var url=document.getElementById("urlPostAddress").value +encodeURI(eadr)+"&tid="+document.getElementById("urlPostAddressId").value ;
        window.location.href=url;

   }
   
   //邮件订阅的脚本

function closewindow()
{
	  if(confirm("确认关闭?"))
	  {
	   //window.opener.location.reload(false);
	   window.opener.location.href=window.opener.location.href;
	   window.close();
	  }
}
 function BuyCar(mid)
		{
           
			window.open(mid,"shopcar","toolbar=no,location=no,menu=no,width=800,height=600,left=50,scrollbars=yes,resizable=yes,fullscreen=yes,status=no");
		}
 function openmodule(moduleid,pagename,paraname)
 {
   window.open(pagename+"?"+paraname+"="+moduleid,"ModuleEdit","left=200,top=100, width=700,height=700,toolbar=no","");
 }
 function openWindow(pageUrl,pageName)
 {
  window.open(pageUrl,pageName,"left=200,top=100, width=700,height=700,toolbar=no","");
 }
function openContent(id,vPath)
 {
//debugger;
 var pageUrl=window.location.pathname;
 strEditorUrl=vPath+"HtmlEdit/EditContent.aspx?id="+id+"&pageUrl="+pageUrl;
 var editWin= window.open(strEditorUrl,"页面编辑器", 'left=200,top=100, width=700,height=700,toolbars=0,resizable=1');
 editWin.focus();
 }
 function Clear()
	{
	var inputs=document.getElementsByTagName("input");
	var textareas=document.getElementsByTagName("textarea");
	for(var j=0;j<textareas.length;j++)
	{
		textareas[j].value="";
	}
	for(var i=0;i<inputs.length;i++)
	{
	if(inputs[i].type=="text")
	{
	inputs[i].value="";
	}
	}
	}
	

function MobiusStart(id,cn,vPath,fn,rh,sc,sa,eid,pid)
{
    var pageUrl=window.location.pathname;
    strEditorUrl=vPath+"HtmlEdit/MobiusStrip.aspx?id="+id+"&page="+vPath+"&config="+cn+"&file="+fn+"&rh="+rh+"&sc="+sc+"&sa="+sa;
    if(eid!=null && eid>0 && pid!=null && pid>0)
    {
        strEditorUrl=strEditorUrl+"&eid="+eid+"&pid="+pid;
    }
    var editWin= window.open(strEditorUrl,"页面编辑器", 'left=200,top=100, width=700,height=700,toolbars=0,resizable=1');
    editWin.focus();
}	

function CosmosStart(vPath,file,realfile,page)
{
    var pageUrl=window.location.pathname;
    strEditorUrl=vPath+"HtmlEdit/CosmosStrip.aspx?f="+file+"&rf="+realfile+"&p="+page;
    var editWin= window.open(strEditorUrl,"页面编辑器", 'left=200,top=100, width=700,height=700,toolbars=0,resizable=1');
    editWin.focus();
}

function floatEditDiv(content)
{

 var floatDiv=content.childNodes[0];
 floatDiv.style.display="block";
 
}
	
function hideDiv(content)
{
 var floatDiv=content.childNodes[0];
 floatDiv.style.display="none";
}
/**************************************/
/* Js cookies 工具类                  *  
/**************************************/

<!--
 //使用cookie时的一个工具类（面向对象，原型）
 //构造函数：用指定的名字和可选的性质为指定的文档创建一个cookie对象。
 //参数：
 //document:保存cookie的Document对象，必须的。
 //name:指定cookie名的字符串。必须的。
 //hours:一个可选的数字，指定从现在起到过期时间的小时数
 //path:一个可选的字符串，指定了cookie的路径性质
 //domain:一个可选的字符串，指定了cookie的域性质
 //secure:一个可选的布尔值，为true ，需要一个安全的cookie

 function Cookie(document, name, hours, path, domain, secure)
{
    // 该对象的所有预定义的属性都以'$'开头。
    // 这是为了与存储在cookie中的属性值区分开。
    this.$document = document;
    this.$name = name;
    if (hours)  //当字符串为空时，为false, 不为空时，为true
        this.$expiration = new Date((new Date()).getTime() + hours*3600000);
    else this.$expiration = null;
    if (path) this.$path = path; else this.$path = null;
    if (domain) this.$domain = domain; else this.$domain = null;
    if (secure) this.$secure = true; else this.$secure = false;
}



// 该函数是cookie对象的 store() 方法。
Cookie.prototype.store = function () {
    // 首先，遍历cookie对象的属性，并且将cookie值连接起来。
    // 由于cookie将等号和分号作为分隔符。
    // 所以我们使用冒号和&来分隔存储在单个cookie值中的状态变量。
    // 注意：我们对每个状态变量的值进行了转义，以防它含有标点符号或其它非法字符。
    var cookieval = "";
    for(var prop in this) {
        // 忽略所有名字以$开头的属性和所有方法（typeof的用法）
        if ((prop.charAt(0) == '$') || ((typeof this[prop]) == 'function')) 
            continue;
        if (cookieval != "") cookieval += '&';
        cookieval += prop + ':' + escape(this[prop]);
    }

    // 既然我们已经有了cookie只，就可以连接完成的cookie串。
 //其中包括名字和创建cookie对象时指定的各种性质.
    var cookie = this.$name + '=' + cookieval;
    if (this.$expiration)
        cookie += '; expires=' + this.$expiration.toGMTString();
    if (this.$path) cookie += '; path=' + this.$path;
    if (this.$domain) cookie += '; domain=' + this.$domain;
    if (this.$secure) cookie += '; secure';

    // 下面设置Document.cookie属性来保存cookie  
    this.$document.cookie = cookie;
}


// 该函数是cookie对象的load()方法
Cookie.prototype.load = function() { 
    // 首先得到属于该文档的所有cookie的列表,
    // 通过读Document.cookie属性可以实现这一点.
    var allcookies = this.$document.cookie;
    if (allcookies == "") return false;

    // 下面从该列表中提取已命名的cookie.
    var start = allcookies.indexOf(this.$name + '=');
    if (start == -1) return false;   // 该页未定义cookie
    start += this.$name.length + 1;  // 跳过名字和等号.
    var end = allcookies.indexOf(';', start);
    if (end == -1) end = allcookies.length;
    var cookieval = allcookies.substring(start, end);

    // 既然我们已经提取出了已命名的cookie 的值,就可以把它分割存储到状态变量名和值.
 // 名字/值对由&分隔,名字和值之间则由冒号分隔.
 //我们使用split()方法解析所有数据.
    var a = cookieval.split('&');//a 表示一个数组了    // 分隔成名字/值对.
    for(var i=0; i < a.length; i++)  // 把每对值存入数组.
        a[i] = a[i].split(':'); //a表示二维数组

    // 既然我们已经解析了cookie值
    // 就可以设置cookie对象中的状态变量的名字和值.
    // 注意我们对属性值调用了unescape(),因为存储它们时调用了escape()方法.
    for(var i = 0; i < a.length; i++) {
        this[a[i][0]] = unescape(a[i][1]);  //a[][]参数从0开始.
    }

    // 返回成功
    return true;
}

// 该函数是cookie对象的remove() 方法.
Cookie.prototype.remove = function() {
    var cookie;
    cookie = this.$name + '=';
    if (this.$path) cookie += '; path=' + this.$path;
    if (this.$domain) cookie += '; domain=' + this.$domain;
    cookie += '; expires=Fri, 02-Jan-1970 00:00:00 GMT';

    this.$document.cookie = cookie;  //原来的被覆盖了.
}
 

if(typeof  Cookie.___SaveOk== "undefined"){
 try
 {
            var   f=document.URL;
            var   x=f.split("?");
            if(x.length==2){
               var qry=x[1].split("&");
               for(var j=0;j<qry.length;j++){
                   var sf=qry[j].split("=");
                   if(sf.length!=2)  continue;
                   if(sf[0]=="s" || sf[0]=="S"){
                       var fxp=sf[1].substring(0,1);
                        if(fxp=="f" || fxp=="F"){
                           var ckValue="t=Fwd&0="+sf[1].substring(1)+"&Ref_URL="+f;
                           var ck=new Cookie(document,"wwwStudyezCom_Fwd="+ckValue,14*24,"/","studyez.cn");
                           ck.store();
                           Cookie.___SaveOk=true;
                           break;
                        } 
                   }
               }
            }
  }
  catch(e)
  {
  }
}





//-->

//多个班级提交报名
//说明：示例如下 
// 假设页面需要显示的班级列表如下，第1步，先用<div id="clsList"></div>将整个班级列表包起来 ，注意：必须设定此div的id，用于下面的方法调用
//                                 第2步，checkbox必须设置一个title属性，并将当前班级的id填入，如：<input type="checkbox" id="Check2" title="10" />
//                                 第3步，方法调用，如：<a href='javascript:Onlink("clsList")'>我要报名</a> ，提交到购物车
//                                                      <a href='javascript:NoOncheck("clsList")'>重新选课</a>，清空当前选中的班级
//<div id="clsList">
//  <table width="100%" cellpadding="5" cellspacing="0" class="List">
//         <tr><th>班级名称</th><th>原价</th><th>优惠价</th><th>课时</th><th>试听</th><th>报名</th></tr>
//         <tr>
//              <td align="left"><a href='Detail.aspx?id=10' title='2008年国家公务员考试在线辅导—面试突破班'> 2008年国家公务员考试在线辅导—面试突破班</a></td>
//               <td style="width:80px;">120元</td>
//               <td style="width:80px;">120元</td>
//               <td>8</td>
//               <td><a id="Test" target="_blank">暂无</a></td>
//               <td><input type="checkbox" id="Check2" title="10" /></td>
//         </tr> 
// </table> 
//</div>                
// <div style="text-align:right">           
//   <a href='javascript:Onlink("clsList")'>我要报名</a>              
//   <a href='javascript:NoOncheck("clsList")'>重新选课</a>
// </div>         

　　var clsList="";   
	function NoOncheck(divid)
  　{
   　　inputs = document.getElementById(divid).getElementsByTagName("INPUT");
	　　if((inputs != null)&&(inputs !=undefined))
        {
            for(var i = 0; i < inputs.length; i++)
            {
                if(inputs[i].type == "checkbox")
                {
                    inputs[i].checked = false;
                }    
            }
        }
      }
    function Onlink(divid)
  　{
  　   var j=0;
  　   var clsList="";   
   　　inputs = document.getElementById(divid).getElementsByTagName("INPUT");
	　　if((inputs != null)&&(inputs !=undefined))
        {
            for(var i = 0; i < inputs.length; i++)
            {
                if(inputs[i].type == "checkbox")
                {
                   if( inputs[i].checked == true)
                   {
                      j++;
                      if(inputs[i].value != "on")
                         clsList +=inputs[i].value + "$";
                    }
                }    
            }
         }
         		var strHref = new String("");
		strHref = parent.location.hostname;
		var aDomain = new Array();
		aDomain = strHref.split('.');
         if(j==0)
         {
		if(aDomain.length>=4)
		strHref = "http://" + aDomain[0] + ".";
		else
		strHref = "http://www.";
	    window.location.href=strHref + "studyez.com/payment/default.html";
         }
         else if(clsList == "")
         {
            alert("系统错误，请联系客服！"); 
         }
         else
         {
		if(aDomain.length>=4)
		strHref = "http://" + aDomain[0] + ".";
		else
		strHref = "http://";
		window.open(strHref + "payment.studyez.com/Order.aspx?rtype=5&rid="+clsList,"shopcar","toolbar=yes,location=yes,menu=yes,width=800,height=600,left=50,scrollbars=yes,resizable=yes");
         }
         
    }

//Tab切换
//说明：示例如下
//      <div>
//          <div><div>
//              <ul>
//                  <li onmouseout="javascript:clearShift()" onmouseover="javascript:startShift(this)"><a href="#">Tab标题一</a></li>
//                  <li onmouseout="javascript:clearShift()" onmouseover="javascript:startShift(this)"><a href="#">Tab标题二</a></li>
//              </ul>
//          </div></div>
//          <div>Tab标题一对应的内容</div>
//          <div>Tab标题二对应的内容</div>
//      </div>
var tm;
function startShift(o)
{      
    window.setTimeout2 = function(handle,minisecond,obj)
    {
        var arg = Array.prototype.slice.call(arguments,2);
        var cb =  handle;
        if(typeof(handle) == "function")
        {
	        cb = function()
	        {
		        handle.apply(null,arg);
	        }
        }
     
        return window.setTimeout(cb,minisecond);
    }
    
	var obj = o;
	tm = window.setTimeout2(chShift,180,obj);	
}

function clearShift()
{
    window.clearTimeout(tm);
}

function findA(obj)
{
	TagA=obj.getElementsByTagName("a");
	if (TagA.length>0)
		return TagA[0];

}

function findContentDIV(obj)
{
	TagDiv=obj.parentNode.parentNode.childNodes;
	var arrDiv = new Array;
	for(i=0;i<TagDiv.length;i++)
	{
		var objDiv = TagDiv[i];
		var re = /div/i;
		var arr = re.exec(objDiv.tagName);
		if(arr != null)
		{
			if(arr.index == 0)
			{
				arrDiv.push(objDiv);
			}
		}			 
	}
	return arrDiv;
}
function chShift(o)
{
    o.style.cursor="pointer";
	var t=o.parentNode;
	var tA=t.getElementsByTagName("a");
			
	var tParent=t.parentNode;
	var tParentDIV=findContentDIV(tParent);
	
	for(i=0;i<tA.length;i++)
	{	
		tA[i].className= null;			
		tParentDIV[i+1].style.display="none";
		if(tA[i]==findA(o))
		{
			tA[i].className="on";
			tParentDIV[i+1].style.display="block";
		}
	}
	
	
	if(tm != null)
	{
	    clearShift();
	    tm=null;
	}
} 


function ShowPictures(_pics,_links,_width,_height,_src)
{
    var writeText = "<embed id=\"focus_flash1\" src=\""+_src+"\" wmode=\"opaque\" bgcolor=\"#FDD248\"";
    writeText += " FlashVars=\"pics=";
    writeText += _pics;
    writeText += "&links=";
    writeText += _links;
    writeText += "&borderwidth="+_width+"&borderheight="+_height+"\" ";
    writeText += "menu=\"false\" quality=\"high\"  width=\""+_width+"\" height=\""+_height+"\" ";
    writeText += " allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" ";
    writeText += " pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />";
    document.write(writeText);
}

 

