$(function(){
var Jiagle = {};
Jiagle.Visit = function (args) {
var el = args.htmlId ? args.htmlId : $('#show_time'), t = el.html();
if (!t) return;
t = t.split("/");
var d = new Date(), h = d.getHours(), m = d.getMinutes(), s = d.getSeconds(),
y = d.getYear(), o = d.getMonth(), a = d.getDate(), p;
y = y < 2000 ? y + 1900 : y;
// h = 23 - h;
m = 59 - m;
s = 59 - s;
y = parseInt(t[0]) - y;
o = parseInt(t[1]) - o - 1;
a = parseInt(t[2]) - a;
if(parseInt(t[3])<=h){
h = h - parseInt(t[3]);
a = a - 1;
h = 23 - h;
}else{
h = parseInt(t[3]) - h;
}
a = (a+(o*31)+(y*12*31));
showTime();
setInterval(showTime, 1000);
function showTime() {
s--;
if (s < 0) {
s = 60 + s;
m = m - 1;
}
if (m < 0) {
m = 60 + m;
h = h - 1;
}
if (h < 0) {
h = 24 + h;
a = a - 1;
}
if (a < 0) {
a = 31 + a;
o = o - 1;
}
if (o < 0) {
o = 12 + o;
y = y - 1;
}
if(a<10){
var a1='0'+String(a);
}else{
a1 = a;
}
if(h<10){
var h1='0'+String(h);
}else{
h1 = h;
}
if(m<10){
var m1='0'+String(m);
}else{
m1 = m;
}
if(s<10){
var s1='0'+String(s);
}else{
s1 = s;
}
p ='
'+ a1 + '
天
'+ h1 +'
时
:
'+ m1 + '
分
:
'+ s1+'
秒
';
el.html(p);
}
//el.after("");
};
var ullenth=$('#main #caigousl li').length*265;
var t= -266;
var tsl=t;
$('#main #caigousl .anlinext').click(
function () {
if( t<-ullenth){
$('#main #caigousl ul').css('marginLeft','0');
t=tsl;
}
$('#main #caigousl ul').animate({'marginLeft':t},300);
t=t+tsl;
}
);
$('#main #caigousl .anliprev').click(
function () {
if( t>-100){
$('#main #caigousl ul').css('marginLeft',-ullenth);
t=-ullenth;
}
$('#main #caigousl ul').animate({'marginLeft':t-tsl},300);
t=t-tsl;}
);
// slide
// $(document).scroll(
// function () {
//
// if($(document).scrollTop()>30){
// $('#top').css({'position':'fixed'});
//
// }
//
// if($(document).scrollTop()==0 ){
// $('#top').css({'position':' relative'});
// }
//
// }
// );
// var windowHeight = $(window).height();
// var bottomTop=windowHeight-$('#main .social').height();
//$('#main .social').css('top',bottomTop);
if($('#main .social').hasClass('social')){
$(".social").parent().append('');
}
// top
$(".left_child_nav").click(function(){
$("#location_left").animate({left:"0%"},250).show();
// $(".hotel_logo").animate({right:"0px"},250);
$("body").prepend('');
$("#top").find("nav").find("#location_left").after('')
$("#mask_childmenu").click(function(){
$("#location_left").animate({left:"-100%"},250);
// $(".hotel_logo").animate({right:"48%"},250);
$(this).remove();
$(".mask_childmenu").remove();
});
$(".mask_childmenu").click(function(){
$("#location_left").animate({left:"-100%"},250);
// $(".hotel_logo").animate({right:"48%"},250);
$(this).remove();
$("#mask_childmenu").remove();
});
});
$(".top .left_child_nav").click(function(){
$("#location_left").animate({left:"-100%"},250);
// $(".hotel_logo").animate({right:"48%"},250);
$("#mask_childmenu").remove();
$(".mask_childmenu").remove();
});
$(".right_xiala").click(function(){
xiala_logo();
})
function xiala_logo(){
$(".right_contect").fadeIn();
$(".right_contect").fadeIn("slow");
$(".right_contect").fadeIn("250");
$("body").prepend('');
$("#mask_xialachildmenu").click(function(){
$(".right_contect").fadeOut();
$(".right_contect").fadeOut("slow");
$(".right_contect").fadeOut("250");
$(this).remove();
});
}
$("#header.right_logo").click(function(){
xiala_logo();
})
function close(){
$(".right_contect").fadeOut();
$(".right_contect").fadeOut("slow");
$(".right_contect").fadeOut("250");
$("#mask_xialachildmenu").remove();
}
$(".right_xiala_logo").click(function(){
close();
});
$(".right_xiala_child").click(function(){
close();
});
var fag = 1;
$(".show_zhanqu").click(function(){
if(fag == 1){
$(".child_zhanqu").show(250);
fag = 0;
}else{
$(".child_zhanqu").hide(250);
fag = 1;
}
});
var fag1 = 1;
$(".gaikuang").click(function(){
if(fag1 == 1){
$(".child_gaokuang").show(250);
fag1 = 0;
}else{
$(".child_gaokuang").hide(250);
fag1 = 1;
}
});
// 上海展
$('#head .menu_contect li').click(function () {
var index=$('#head .menu_contect li').index(this);
$('#head .right_xiala p').hide();
$('#head .right_xiala p').eq(index).show();
}
);
$('#invitation_input').css('height',$(window).height()-90);
$('#invitation_input.invitation').css('height',$(window).height());
////--------////
new Jiagle.Visit({htmlId:$("#show_time")});
new Jiagle.Visit({htmlId:$("#show_time2")});
});