﻿// JavaScript Document
//首页显示 效果的js 文件
var i;
function LearningChart(i){
	if(i==1)
	{
		dialog("学习列表","iframe:/CN/programs/learningchart/Program_learningchart2-3.html","560px","300px","iframe");
	}
	else if(i==2)
	{
		dialog("学习列表","iframe:/CN/programs/learningchart/Program_learningchart4-6.html","560px","300px","iframe");
	}
	else
	{
		dialog("学习列表","iframe:/CN/programs/learningchart/Program_learningchart7-12.html","560px","300px","iframe");
	}
}
function search_shool_cn()
{
	dialog("培训中心","iframe:/CN/other/Search.html","840px","550px","iframe");
}
//换大图
$(document).ready(
				  function(){
	$('#curentsmallfirst1').val('1');
	$('#curentsmallsecond1').val('1');
	$('#curentsmallthree1').val('1');
	
	$('#curentsmallfirst2').val('1');
	$('#curentsmallsecond2').val('1');
	$('#curentsmallthree2').val('1');
	
	$('#curentsmallfirst3').val('1');
	$('#curentsmallsecond3').val('1');
	$('#curentsmallthree3').val('1');
	
	$('#curentsmallfirst4').val('1');
	$('#curentsmallsecond4').val('1');
	$('#curentsmallthree4').val('1');
	
	$('#curentsmallfirst5').val('1');
	$('#curentsmallsecond5').val('1');
	$('#curentsmallthree5').val('1');
	$('#meg_email').hide();
				  })
	function mid_click_fun(num){
	 //alert(num);
		var curenrnum = $('#curentnum').val();
		//alert(curenrnum);
		//$('#big'+curenrnum).hide();
		$('#big1').hide();
		$('#big2').hide();
		$('#big3').hide();
		$('#big4').hide();
		$('#big5').hide();
		$('#big'+num).show();
		$('#curentnum').val(num);
	
	}
	//切换小框内容
	function changeSmallImg(img,position){
		 var i = 5; 
		 var curent = parseInt(document.getElementById('curentsmall'+position).value);
		 if(img=='pri'){
		 	curentpri = (curent>1)?(curent-1):5;
		 }
		 if(img =='next'){
		 	curentpri = (curent<5)?(curent+1):1;
		 }
	
		 $('#small'+position+'content1').hide();
		  $('#small'+position+'content2').hide();
		   $('#small'+position+'content3').hide();
		    $('#small'+position+'content4').hide();
			 $('#small'+position+'content5').hide();
		 $('#small'+position+'content'+curentpri).show();
		 $('#curentsmall'+position).val(curentpri);
	
	}
	
	//切换中英文
	function cn_en(lang){
		var thisurl = document.URL;  
		var oldstr = (lang=="en")?"CN":"EN";
		var str = (lang=="en")?"EN":"CN";
		var newurl = thisurl.replace("/"+oldstr+"/","/"+str+"/");
		window.location.href=newurl;
 
 	}
	
	//得到 填写的email值 并提交
	function emailpost(){
	
		var email = $('#purchemail').val();
		if(emailcheck(email)==true){//对email格式进行验证
			$.ajax({
				type: "POST",
				url: "emailpost.php",//可在提交页设置隐藏的url来替换
				data:"email="+email,
				success: function(msg){
					//alert(msg);
				dialog("信息提示","text:提交成功！","200px","auto","text"); 
				}
			});
		}
	
	}
	//简单验证email 可扩展
	function emailcheck(email){
		if (!email||!email.match( /^.+@.+$/ ) )
		{
			dialog("信息提示","text:请正确填写邮箱地址！","200px","auto","text");
			//alert("EMAIL 错误！请重新输入");     
			$('#purchemail').focus();
			return false;
		} else{
			$('#meg_email').hide();
			return true;
		}
		
	
	
	}
	/*$(document).ready(function(){
		$('#mail_submit').click({
			emailpost();
		
		})
	
	})*/
	function chenkempty(){
	var email=document.loginform.username.value;
    if(email =="" ){
	return false;
	}
	else
	{
	return true;
	}
}

function printPage() {
            var newWin = window.open('printer', '', '');
            //newWin.moveTo(10000,10000); 
            var titleHTML = document.getElementById("pr_text").innerHTML;
            newWin.document.write(titleHTML);
            newWin.document.location.reload();
            newWin.print();
            newWin.close();
        } 