﻿// JavaScript Document
jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '; path=/';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};


function lightbox(){
	$('#gallery a').lightBox();
}

function searchUrl()
{
	window.location.href='http://www.winavi.com/Tag'+"/"+document.getElementById("searchValueId").value;
}
function searchUrl1()
{
	window.location.href='http://www.winavi.com/Tag'+"/"+document.getElementById("searchValueId1").value;
}
function searchUrl2()
{
	window.location.href='http://www.winavi.com/Tag'+"/"+document.getElementById("searchValueId2").value;
}
function wsj(){
	var width = $(window).width();
	var height = $(".all").height();
	var h = document.documentElement.clientHeight;
	var layout = "<div class='layout'></div>";
	$(layout).css({
		"opacity": 0.5,
		"width": width,
		"height": height
	}).appendTo("body");
	if(h<674){
		$(".wsj").css("margin-top", "-72px").show();	
	} else {
		$(".wsj").css("top",(h-674)/2 + "px").hide();	
	}
	if(h<674){
		$(window).scroll( function() { $(".wsj").css("margin-top", "0px")} );
	}
}
function displayImg(){
	/*if(!getCookie('wsj') && getCookie('wsj') != 'IJFWNJKN82JFW#2') {
		setCookie('wsj', 'IJFWNJKN82JFW#2');
		setTimeout("wsj()", 700);
	}*/
	$('.animateBody').cycle({
		fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
		pager:  '.animateNav'
	});
	$(".animateBody").hover(
 		 function () {
    		$(this).cycle('pause');
  		 },
	 	 function () {
		    $(this).cycle('resume');
	     }
	);	
}
$(function(){
	var animateNum = $('.animateNav span').length;
	//alert(animateNum);
	var animateContent = $('.animateBody');
	var animateObj = animateContent.children("div");
	var contentWidth = animateNum * 962;
	var n = 0;
	var t;
	/*$('.animateNav span').click(function(){
		clearInterval(t);
		var index = $(this).html()-1;
		n = index;
		if(!animateContent.is(":animated")) {
			$(this).css("background-color", "#4A6EA6").siblings().css("background-color", "#202431");
			animateObj.filter(":visible").fadeTo(300, 0.6, function(){
				animateObj.filter(":visible").hide();
				animateObj.eq(n).fadeTo(400, 1);
				clearInterval(t);		
				t = setInterval(AutoDisplay, 5000);
			});*/
	
			/*var offset = ($(this).html()-1) * 962;
			
			$(this).css("background-color", "#4A6EA6").siblings().css("background-color", "#202431");
			animateContent.animate({"left":-offset+'px'},500,"linear",function(){
				clearInterval(t);		
				t = setInterval(AutoDisplay, 10000);
			});*/
		//}
	//});

	/*$('.animateBody').cycle({
		fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
		pager:  '.animateNav'
	});

	$(".animateBody").hover(
 		 function () {
    		$(this).cycle('pause');
  		 },
	 	 function () {
		    $(this).cycle('resume');
	     }
	);*/

	function AutoDisplay(){
		n = n > 1 ? 0:++n;
		$('.animateNav span').eq(n).trigger('click');
	}
	
	t = setInterval(AutoDisplay, 5000);

	/***product hover***/
	var sitelan;
	$('.naviBg .topMenuNavi li:eq(1)').hover(function(){
		sitelan = $(this).children('a').html();
		$('.hiddenMenu').show();
	}, function(){
		$('.hiddenMenu').hide();	
	});
	$('.hiddenMenu').hover(function(){
		$(this).show();
	}, function(){
		$(this).hide();	
	});


	$('.hiddenMenuLeft ul li').hover(function(){
		var currentLiIndex = $('.hiddenMenuLeft ul li').index($(this));
		var currentContent;
		//alert($('.hiddenMenuRight ul').html());
		
		if(sitelan == 'Products') {
			switch(currentLiIndex)
			{
				case 0: currentContent = '<li><a href="http://all-in-one-converter.winavi.com" target="_blank">All-In-One Converter</a></li><li><a href="http://video-converter.winavi.com" target="_blank">Video Converter</a></li>'; break;
				case 1: currentContent = '<li><a href="http://blurayripper.winavi.com" target="_blank">Blu-ray Ripper</a></li><li><a href="http://dvdripper.winavi.com" target="_blank">DVD Ripper</a></li>'; break;
				case 2: currentContent = '<li><a href="http://video-converter.winavi.com" target="_blank">Video Converter</a></li><li><a href="http://all-in-one-converter.winavi.com" target="_blank">All-In-One Converter</a></li><li><a href="http://flv-converter.winavi.com" target="_blank">FLV Converter</a></li><li><a href="http://youtube-download.winavi.com" target="_blank">YouTube Download</a></li><li><a href="http://video-capture.winavi.com" target="_blank">Video Capture</a></li></ul>'; break;
				case 3: currentContent = '<li><a href="http://blurayripper.winavi.com" target="_blank">Blu-ray Ripper</a></li>'; break;
				case 4: currentContent = '<li><a href="http://dvdripper.winavi.com" target="_blank">DVD Ripper</a></li><li><a href="http://dvd-copy.winavi.com" target="_blank">DVD Copy</a></li>'; break;
				case 5: currentContent = '<li><a href="http://psp-3gp-mp4.winavi.com" target="_blank">3GP/MP4/PSP/iPod Converter</a></li><li><a href="http://iphone-converter.winavi.com">iPhone Converter</a></li><li><a href="http://ipod-converter.winavi.com">iPod Converter</a></li><li><a href="http://ipad-converter.winavi.com">iPad Converter</a></li>'; break;
			}	
		} else if(sitelan == 'Produkte') {
			switch(currentLiIndex)
			{
				case 0: currentContent = '<li><a href="http://all-in-one-konverter.winavi.com" target="_blank">All-In-One Konverter</a></li><li><a href="http://video-konverter.winavi.com" target="_blank">Video Konverter</a></li>'; break;
				case 1: currentContent = '<li><a href="http://bluray-ripper.winavi.com" target="_blank">Blu-ray Ripper</a></li><li><a href="http://dvd-ripper.winavi.com" target="_blank">DVD Ripper</a></li>'; break;
				case 2: currentContent = '<li><a href="http://video-konverter.winavi.com" target="_blank">Video Konverter</a></li><li><a href="http://all-in-one-konverter.winavi.com" target="_blank">All-In-One Konverter</a></li><li><a href="http://flv-converter.winavi.com" target="_blank">FLV Konverter</a></li><li><a href="http://youtube-download.winavi.com" target="_blank">YouTube Download</a></li><li><a href="http://video-capture.winavi.com" target="_blank">Video Capture</a></li></ul>'; break;
				case 3: currentContent = '<li><a href="http://bluray-ripper.winavi.com" target="_blank">Blu-ray Ripper</a></li>'; break;
				case 4: currentContent = '<li><a href="http://dvd-ripper.winavi.com" target="_blank">DVD Ripper</a></li><li><a href="http://dvd-copy.winavi.com" target="_blank">DVD Copy</a></li>'; break;
				case 5: currentContent = '<li><a href="http://psp-3gp-mp4.winavi.com" target="_blank">3GP/MP4/PSP/iPod Konverter</a></li><li><a href="http://iphone-converter.winavi.com">iPhone Konverter</a></li><li><a href="http://ipod-converter.winavi.com">iPod Konverter</a></li><li><a href="http://ipad-converter.winavi.com">iPad Converter</a></li>'; break;
			}	
		} else if(sitelan == 'Productos') {
			switch(currentLiIndex)
			{
				case 0: currentContent = '<li><a href="http://allinone.es.winavi.com" target="_blank">All-in-One Convertidor</a></li><li><a href="http://videoconverter.es.winavi.com" target="_blank">Video Convertidor</a></li>'; break;
				case 1: currentContent = '<li><a href="http://blurayripper.es.winavi.com" target="_blank">Blu-ray Ripper</a></li><li><a href="http://dvdripper.es.winavi.com" target="_blank">DVD Ripper</a></li>'; break;
				case 2: currentContent = '<li><a href="http://videoconverter.es.winavi.com" target="_blank">Video Convertidor</a></li><li><a href="http://allinone.es.winavi.com" target="_blank">All-in-One Convertidor</a></li><li><a href="http://flv-converter.winavi.com" target="_blank">FLV Convertidor</a></li><li><a href="http://youtube-download.winavi.com" target="_blank">YouTube Download</a></li><li><a href="http://video-capture.winavi.com" target="_blank">Video Capture</a></li></ul>'; break;
				case 3: currentContent = '<li><a href="http://blurayripper.winavi.com" target="_blank">Blu-ray Ripper</a></li>'; break;
				case 4: currentContent = '<li><a href="http://dvdripper.es.winavi.com" target="_blank">DVD Ripper</a></li><li><a href="http://dvd-copy.winavi.com" target="_blank">DVD Copia</a></li>'; break;
				case 5: currentContent = '<li><a href="http://psp-3gp-mp4.winavi.com" target="_blank">3GP/MP4/PSP/iPod Convertidor</a></li><li><a href="http://iphone-converter.winavi.com">iPhone Convertidor</a></li><li><a href="http://ipod-converter.winavi.com">iPod Convertidor</a></li><li><a href="http://ipad-converter.winavi.com">iPad Converter</a></li>'; break;
			}	
		}
		$('.hiddenMenuRight ul').html(currentContent);
		$(this).addClass('naviCurrent').siblings().removeClass('naviCurrent');
	}, function(){});
	
	
	for(var i=0; i<document.links.length; i++)
    document.links[i].onfocus=function(){this.blur()} 
	var listMenuNode = $('.proListMenu > li > a');
	listMenuNode.click(function(){
		ulNode = $(this).next('ul');
		ulNode.toggle();
		if(ulNode.is(":visible")) {
			$(this).css("color", "#1F79E0");
			$(this).parent().css("background-image", "url(uploads/images/winavi/dropdownpointer.png)");
		} else {
			$(this).css("color", "#666");
			$(this).parent().css("background-image", "url(uploads/images/winavi/rightpointer.png)");
		}
		return false;
	});
	$('.proListMenu > li').hover(function(){
		if($(this).children('a').next('ul').is(":visible")) {
			return false;	
		} else {
			$(this).css("background-image", "url(uploads/images/winavi/rightblue.png)");	
		}
	}, function(){
		if($(this).children('a').next('ul').is(":visible")) {
			return false;	
		} else {
			$(this).css("background-image", "url(uploads/images/winavi/rightpointer.png)");	
		}
	});
	listMenuNode.hover(function(){
		if($(this).html() == 'Cooperation') {
			return false;
		}
		$(this).css("color", "#1F79E0");						
	}, function(){
		if($(this).next('ul').is(":visible")) {
			return false;	
		} else {
			$(this).css("color", "#666");
		}
	});
	/*$(".topdownloadlist li a").hover(function(){
		$(this).parent('li').css("background-image", "url(uploads/images/winavi/rightblue.png)");
	}, function(){
		$(this).parent('li').css("background-image", "url(uploads/images/winavi/rightpointer.png)");
	});*/
	var hidMenu = $('.hidMenu');
	var naviBar = $(".ANaviTopUl li:eq(1)")
	naviBar.hover(function(){
		$(this).children('img').attr('src', 'uploads/images/winavi/droporg.gif');
		$(this).css("background-color", "#CDE7FE");	
		hidMenu.show();
	}, function(){
		$(this).children('img').attr('src', 'uploads/images/winavi/toprighthover.gif');
		$(this).css("background-color", "");	
		hidMenu.hide();
	});
	hidMenu.hover(function(){
		naviBar.children('img').attr('src', 'uploads/images/winavi/droporg.gif');
		naviBar.css("background-color", "#CDE7FE");	
		$(this).show();					   
	}, function(){
		naviBar.children('img').attr('src', 'uploads/images/winavi/toprighthover.gif');
		naviBar.css("background-color", "");	
		$(this).hide();	
	});
})

function  topdownloadlistOver(obj) {
	$(obj).parent('li').css("background-image", "url(uploads/images/winavi/rightblue.png)");
}

function  topdownloadlistOut(obj) {
	$(obj).parent('li').css("background-image", "url(uploads/images/winavi/rightpointer.png)");
}

function showTab(objHide, objShow) {
	var h = $("#"+objHide);
	var s = $("#"+objShow);
	h.hide();
	if(objHide == 'reviewTab1'){
		$('.urLeftTopNav').css("background", "url(uploads/images/winavi/reviewTab2.png) no-repeat 0 0px");
	} else {
		$('.urLeftTopNav').css("background", "url(uploads/images/winavi/reviewTab1.png) no-repeat 0 0px");
	}
	$('.'+objShow).css("color", "white");
	$('.'+objHide).css("color", "#525252");
	s.show();
}

/****** form ******/
//del by zw
/*function validate_form() {
  validity = true;
  if (!check_empty(document.form.NAME.value))
        { validity = false; alert('Please type your full name!'); return false; }
  if (!check_email(document.form.EMAIL.value))
        { validity = false; alert('Please tyre your E-mail address! '); return false; }
  if (!check_empty(document.form.DESCRIPTION.value))
        { validity = false; alert('Please type the the message!'); return false; }
  return validity;
}*/

//add zw
function validate_form() {
	
  var validity = true;
  var mess = '';
  if (!check_empty(document.form.NAME.value))
        {  alert('Please type your full name!');return false; }
  else if (!check_email(document.form.EMAIL.value))
        { alert('Please tyre your E-mail address!');return false;  }
  else if (!check_empty(document.form.SUB.value))
        {  alert('Please type the subject!'); return false;}
  else if (!check_empty(document.form.DESCRIPTION.value))
        { alert('Please type the  message!');return false; }
  else if (check_empty(document.form.FILE.value))
        { 
			var postfix = document.form.FILE.value.match(/^(.*)(\.)(.{1,8})$/)[3].toLowerCase();
			if(!(postfix == "zip"))   
			{   
			 alert('Only .zip format is available, \n please compress your file to zip less than 5M and upload');
			  return false;			   
			}
		}
  else if (!check_empty(document.form.authcode.value)){
	   alert('Please type the  Auth Code!'); return false;
	 }else{
		 var authcode = document.getElementById('authcode').value.toUpperCase();
		 if(authcode!= getCookie("authcode")){
			alert('Please check your Auth Code!');return false; 
		 }
	 }
   return validity;
}

function getCookie(c_name)
{
	if (document.cookie.length>0)
	  {
	  c_start=document.cookie.indexOf(c_name + "=")
	  if (c_start!=-1)
		{ 
		c_start=c_start + c_name.length+1 
		c_end=document.cookie.indexOf(";",c_start)
		if (c_end==-1) c_end=document.cookie.length
		return unescape(document.cookie.substring(c_start,c_end))
		} 
	  }
	 return ""
}

function ck_ticket(){
	/*if (!check_empty(document.getElementById('DESCRIPTION').value))
        { alert('Please type the  message!');return false; }
  else */if (check_empty(document.getElementById('FILE').value))
        { 
			var postfix = document.getElementById('FILE').value.match(/^(.*)(\.)(.{1,8})$/)[3].toLowerCase();
			if(!(postfix == "zip"))   
			{   
			  alert('Only .zip format is available, \n please compress your file to zip less than 5M and upload');
			  return false;			   
			}
		}
  else if (!check_empty(document.getElementById('authcode').value)){
	   alert('Please type the  Auth Code!'); return false;
	 }else{
		 var authcode = document.getElementById('authcode').value.toUpperCase();
		 if(authcode!= getCookie("authcode")){
			alert('Please check your Auth Code!');return false; 
		 }
	 }
	
}

function validate_formt1() {
  validity = validate_form();
  if(validity){
	  if (!check_empty(document.form.SOFT.value))
			{ validity = false; alert('Please Select software! '); return false; }
	  if (!check_empty(document.form.VER.value))
			{ validity = false; alert('Please type the Version number!'); return false; }
  }
  return validity;
}
///end add


function check_empty(text) {
  return (text.length > 0);
}

function check_email(address) {
  if ((address == "")
    || (address.indexOf ('@') == -1)
    || (address.indexOf ('.') == -1))
      return false;
  return true;
}

function selLanguage(value){
	$.cookie('winavi_client_browser_language', value);
	//window.location.href = window.location.href;
	window.location.href = 'http://all-in-one-converter.winavi.com';
	/*switch(value) {
		case 'zh': window.location.href = 'http://big5.winavi.com/allinone'; break;
		case 'de': window.location.href = 'http://de.winavi.com'; break;
		case 'en': window.location.href = 'http://all-in-one-converter.winavi.com'; break;
	}*/
}
function selLanguageIndex(value, site){
	$.cookie('winavi_client_browser_language', value);
	var url = '';
	switch(site) {
		case 'winavi' : url = 'http://www.winavi.com'; break;
		case 'de' : url = "http://de.winavi.com"; break;
		case 'it' : url = "http://www.winavi.it"; break;
		case 'blurayripper' : url = 'http://blurayripper.winavi.com'; break;
		case 'vc_en' : url = "http://video-converter.winavi.com"; break;
		case 'vc_de' : url = "http://video-konverter.winavi.com"; break;
		case 'vc_zh' : url = "http://big5.winavi.com/videoconverter"; break;
		case 'aio_zh' : url = "http://big5.winavi.com/allinone"; break;
		case 'aio_en' : url = "http://all-in-one-converter.winavi.com"; break;
		case 'aio_de' : url = "http://all-in-one-konverter.winavi.com"; break;
		case 'blurayripper' : url = "http://blurayripper.winavi.com"; break;
		case 'bluray-ripper' : url = "http://bluray-ripper.winavi.com"; break;
		case 'es' : url = "http://dvdripper.es.winavi.com"; break;
		default : url = 'http://www.winavi.com'; break;
	}
	window.location.href = url;
}

function CheckData(strTitle,strInput,strType,blNeed)
{
	switch (strType)
	{
		case "email":
			var pattern = /^[a-zA-Z0-9_\-\.]+@([a-zA-Z0-9\-]+\.)+[a-zA-Z]{2,5}$/;
			var msg = "";
			if (strInput != "")
			{
				var msg = "\n\n- The email you have typed is: " + strInput;
					msg += "   \n\n- Please check the spelling carefully!";
			}
			else
			{
				var msg = "\n\n- This field is required, can't be null!";
			}
		break;
		case "message":
			var pattern = /^.+$/;
			var msg = "\n\nThe Message field is required!";
		break;
	}
	strInput = strInput.replace(/(^\s*)|(\s*$)/g,"");
	if ((strInput == "") && blNeed)
	{
		alert ("Please input your " + strTitle + "!  "+ msg);
		return false;
	}

	if (strInput != "")
	{
		var result = strInput.match(pattern);
		if (result == null)
		{
			alert ("Please type the valid  " + strTitle + "!  " + msg);
			return false;
		}
	}
	return true;
}

function checkblurayform(){
	var email = $("#email").val();
	var username = $("#username").val();
	var yzm = $("#yzm").val();
	var address = $("#address").val();
	var blurayarea = $("#blurayarea").val();
	var status = $("input[name='bluray']").attr("checked");
	if(status) {
		if (!CheckData("E-mail",email,"email",true) || !CheckData("Your Name",username,"message",true) || !CheckData("Your Address",address,"message",true) || !CheckData("Vertification Code",yzm,"message",true)) {
			return;
		} else if (blurayarea.length < 5) {
			alert('Message less than 5 chars, please try again.');
			return;
			} else {
			$("#subforminfo").ajaxStart(function(){
				$(this).show();
			});
			$("#subforminfo").ajaxStop(function(){
				$(this).hide();
			});
			var url = 'bluray/sendmail.php?email='+email+'&username='+encodeURIComponent(username)+'&yzm='+yzm+'&address='+encodeURIComponent(address)+'&blurayarea='+encodeURIComponent(blurayarea);
			$.post(url, function(data){
				alert(data);
				window.location.href = window.location.href;
			})
		}	
	} else {
		if (!CheckData("E-mail",email,"email",true) || !CheckData("Your Name",username,"message",true) || !CheckData("Vertification Code",yzm,"message",true)) {
			return;
		} else if (blurayarea.length < 5) {
			alert('Message less than 5 chars, please try again.');
			return;
			} else {
			$("#subforminfo").ajaxStart(function(){
				$(this).show();
			});
			$("#subforminfo").ajaxStop(function(){
				$(this).hide();
			});
			var url = 'bluray/feedback.php?email='+email+'&username='+encodeURIComponent(username)+'&yzm='+yzm+'&address='+encodeURIComponent(address)+'&blurayarea='+encodeURIComponent(blurayarea);
			$.post(url, function(data){
				alert(data);
				//window.location.href = window.location.href;
				if(data == 'feedback success') {
					window.location.href = window.location.href;
				}
			})
		}	
	}
}
function showticket(){
	var ticket_id = document.getElementById('ticket_id').value;	
	var mail = document.getElementById('ckemail').value;
	var url = 'ckemail.php?ticket_id='+ticket_id+'&mail='+mail;
	$.post(url, function(data){
			if(data>0){
				ticket_detail(ticket_id);	
			}else{
				alert('Please type your e-mail that you specified when first asking your question!');	
			}
	})
}

function ticket_detail(ticket_id){
	var url = 'showticket.php?ticket_id='+ticket_id;
	$.post(url, function(data){
		$(".proLeft").html(data);
	})
}

function IsURL(str_url){
	var strRegex = "^((https|http|ftp|rtsp|mms)?://)"  
	+ "?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?" //ftp的user@  
	+ "(([0-9]{1,3}\.){3}[0-9]{1,3}" // IP形式的URL- 199.194.52.184  
	+ "|" // 允许IP和DOMAIN（域名）
	+ "([0-9a-z_!~*'()-]+\.)*" // 域名- www.  
	+ "([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\." // 二级域名  
	+ "[a-z]{2,6})" // first level domain- .com or .museum  
	+ "(:[0-9]{1,4})?" // 端口- :80  
	+ "((/?)|" // a slash isn't required if there is no file name  
	+ "(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$";  
	var re=new RegExp(strRegex);  
	//re.test()
	if (re.test(str_url)){
		return (true);  
	}else{  
		return (false);  
	}
} 

function checkgiveawayform() {
	var email = $("#email").val();
	var username = $("#username").val();
	var yzm = $("#yzm").val();
	if (!CheckData("E-mail",email,"email",true) || !CheckData("Your Name",username,"message",true) || !CheckData("Vertification Code",yzm,"message",true)) {
		return;
	} else {
		$("#subforminfo").ajaxStart(function(){
			$(this).show();
		});
		$("#subforminfo").ajaxStop(function(){
			$(this).hide();
		});
		var url = 'giveaway.php?email='+email+'&username='+encodeURIComponent(username)+'&yzm='+yzm;
		$.post(url, function(data){
			alert(data);
			window.location.href = window.location.href;
		})
	}	
}

function checkstudentform() {
	var email = $("#email").val();
	var username = $("#username").val();
	var yzm = $("#yzm").val();
	var reg = /^[0-9a-zA-Z_\-\.]+@[0-9a-zA-Z_\-]+(\.edu)*$/; 
	var regLink = /http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- .\/?%&=]*)?/; 
	var linkUrl = $("#vlink").val();
	if (!CheckData("E-mail",email,"email",true) || !CheckData("Your Name",username,"message",true) || !CheckData("Vertification Code",yzm,"message",true)) {
		return;
	} else if(!reg.test(email)){ 
		alert('Sorry, '+email+' not recognized as academic email.');
		return;
	} else if(!regLink.test(linkUrl)){
		alert('please check your url...');
		return;
	} else {
		$("#subforminfo").ajaxStart(function(){
			$(this).show();
		});
		$("#subforminfo").ajaxStop(function(){
			$(this).hide();
		});
		var url = 'student.php?email='+email+'&username='+encodeURIComponent(username)+'&yzm='+yzm+'&url='+encodeURIComponent(linkUrl);
		$.post(url, function(data){
			alert(data);
			window.location.href = window.location.href;
		})
	}	
}
