﻿$().ready(function(){
    //msgwin('', 9999);
    $("#btnSubmit").click(function()
         {
			 if ($("#txtEmail").val() == "请填写您的Email"){
                alert("请填写您的邮箱。");
                return false;
                }
                var search_str = /^[\w\-\.]+@[\w\-\.]+(\.\w+)+$/;
               var email_val = $("#txtEmail").val();
               if(!search_str.test(email_val)){
                alert("邮箱格式不正确。");
                return false;
               }
			   
			   // 提交数据
			   $.ajax({url:"/common/Data.aspx?t=SubEmail&IP="+ IPData[0] +"&City="+ escape(IPData[2]),
	               type:"GET",
	               dataType:"html",
	               data:"key=" + $("#txtEmail").val(),
	               //beforeSend:function(){},
	               success:function(data){
					  	 if(data == "true"){$("#txtEmail").val();alert("订阅成功。");} else{ alert("此邮箱也存在,请别重复得交。");}
					   }
	              });
			   
               // $("form").submit();
                return true;
		 })
		 
		 $("#btn_search").click(function()
		     {
    		    if ($("#key").val() == "请输入目的地" || $("#key").val() == ""){
                alert("请填写关键字。");
                return false;
                }
		     }
		 )
		 
		  $("#user_btn_logiin").click(function()
		     {
    		    if ($("#tbUserName").val() == ""){
                alert("请输入用户名。");
                return false;
                }
                
                if ($("#tbUserPwd").val() == ""){
                alert("请输入密码。");
                return false;
                }
		     }
		 )
  })
    var timeset = null;
    function Show_TabADSMenu1(e,n){
       $(e).parent().attr('class',  'Menu_'+n );
	   var l = $('#PicMenu span').length;
	   $(e).addClass("Me_span_menu");
	   for(var i=1; i<=3; i++)
	   {
	       if (i == n)
		       $('#txtblk01_'+i).show();
           else
			   {
			   $('#txtblk01_'+i).hide();
			   $('#txtblk01menu_1'+i).removeClass("Me_span_menu");
		   }  
	   }
    }
    
    
//页面顶部弹出公告   
function msgwin(s, t) {
 
 var msgWinObj = document.getElementById('msgwin');
 if(!msgWinObj) {
  var msgWinObj = document.createElement("div");
  var msgObja = document.createElement("a");
  msgObja.href="#";
  msgWinObj.id = 'msgwin';
  msgWinObj.style.display = 'none';
  msgWinObj.appendChild(msgObja);
  //msgWinObj.style.position = 'absolute';
  //msgWinObj.style.zIndex = '100000';
  document.getElementById('append_parent').appendChild(msgWinObj);
 }
 msgWinObj.innerHTML = s;
 msgWinObj.style.display = '';
 msgWinObj.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=0)';
 msgWinObj.style.opacity = 0;
 var sTop = document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
 pbegin = sTop + (document.documentElement.clientHeight / 2);
 pend = sTop + (document.documentElement.clientHeight / 5);
 setTimeout(function () {showmsgwin(pbegin, pend, 0, t)}, 10);
 msgWinObj.style.left = ((document.documentElement.clientWidth - msgWinObj.clientWidth) / 2) + 'px';
 msgWinObj.style.top = pbegin + 'px';
}

function showmsgwin(b, e, a, t) {
 step = (b - e) / 10;
 var msgWinObj = document.getElementById('msgwin');
 newp = (parseInt(msgWinObj.style.top) - step);
 if(newp > e) {
  msgWinObj.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + a + ')';
  msgWinObj.style.opacity = a / 100;
  msgWinObj.style.top = newp + 'px';
  setTimeout(function () {showmsgwin(b, e, a += 10, t)}, 10);
 } else {
  msgWinObj.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=100)';
  msgWinObj.style.opacity = 1;
  setTimeout('displayOpacity(\'msgwin\', 100)', t);
 }
}
function displayOpacity(id, n) {
 if(!document.getElementById(id)) {
  return;
 }
 if(n >= 0) {
  n -= 10;
  document.getElementById(id).style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + n + ')';
  document.getElementById(id).style.opacity = n / 100;
  setTimeout('displayOpacity(\'' + id + '\',' + n + ')', 50);
 } else {
  document.getElementById(id).style.display = 'none';
  document.getElementById(id).style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=100)';
  document.getElementById(id).style.opacity = 1;
 }
}

// daojis

function hide()
	{
			$('#countdown').hide();
	}

function  Right(str,n)
	{
		var rstr = "00"+ str;
		return   rstr.substr(rstr.length-n,rstr.length)
	}

//倒计时	
function DigitalTime1()  
  {   
  var deadline= new Date("06/14/2011") //开幕倒计时  
  var symbol="6月14日"  
  var now = new Date()  
  var diff = -480 - now.getTimezoneOffset() //是北京时间和当地时间的时间差  
  var leave = (deadline.getTime() - now.getTime()) + diff*60000  
  var day = Math.floor(leave / (1000 * 60 * 60 * 24))  
  var hour = Math.floor(leave / (1000*3600)) - (day * 24)  
  var minute = Math.floor(leave / (1000*60)) - (day * 24 *60) - (hour * 60)  
  var second = Math.floor(leave / (1000)) - (day * 24 *60*60) - (hour * 60 * 60) - (minute*60)  
   
  var deadline_2= new Date("08/13/2011") //开幕后计时  
  var symbol_2="8月13日"  
  var now_2 = new Date()  
  var diff_2 = -480 - now.getTimezoneOffset() //是北京时间和当地时间的时间差  
  var leave_2 = (now_2.getTime() - deadline_2.getTime()) + diff_2*60000  
  var day_2 = Math.floor(leave_2 / (1000 * 60 * 60 * 24))  
  var hour_2 = Math.floor(leave_2 / (1000*3600)) - (day_2 * 24)  
  var minute_2 = Math.floor(leave_2 / (1000*60)) - (day_2 * 24 *60) - (hour_2 * 60)  
  var second_2 = Math.floor(leave_2 / (1000)) - (day_2 * 24 *60*60) - (hour_2 * 60 * 60) - (minute_2*60)  
    
  day=day+1;  
  return day; }
