﻿var MiniSite = new Object();
$(document).ready(function(){ 
            G_Weather("","");
});
//大图标
function G_WeatherIconLarge(figure)
{
    var Large;
    if(figure.length > 0)
    {
       Large=figure+"_0_140.png";
    }
    return Large;
}
//小图标
function G_WeatherIconSmall(figure)
{
    var myDate = new Date();
    var Large;
    if(figure.length > 0)
    {
       Large=figure+"_0_70.png";
    }
    return Large;
}

//当天天气
function G_Weather(cityCode,cityName)
{
    var Tophtml='<p id="htmlValue" style="margin-bottom: 2px; width: 274px;*width: 274px; text-align: center; color: #0000EE;';
        Tophtml +='line-height: 20px; background-color: #7CCEFF"></p>';
        Tophtml +='<div style="height: 1px; width: 100%; background: #CACDD2; overflow: hidden;"></div>';
    var marContent = '';
    var buttomHtml = '';
    var html1 = '';
    //实时天气
    $.ajax({
        type: "post",
        async: false,
        url: "../Real.ashx",
        data: 'CityCode=' + cityCode,
        success: function(xml) {
            if(xml != null)
            {
                $(xml).find("city").each(function(i) {
                    //实时天气
                    Tophtml += '<div style="float: left; text-align: center; width: 274px; margin-top: 4px;background-color:#D8E9EC;">';
                    Tophtml += '<a href="http://www.go568.cn" target="_blank" style="text-decoration: none; font-size: 14px;">';
                    Tophtml += '' + $(this).attr("cityname") + '</a><strong style="font-size: 16px; padding-left: 40px;">';
                    Tophtml +='' + $(this).attr("temNow") + '℃</strong>(实时天气)</div>';
                    Tophtml += '<div style="height: 1px; width: 100%; background: #CACDD2; overflow: hidden;"></div>';
                    Tophtml += '<div style="float: left; width: 274px; margin-top: 2px; margin-bottom: 4px; background-color: #D8E9EC;">';
                    Tophtml += '<ul  style="float: left"><li style="text-align: left;margin-top: 8px; margin-bottom: 2px; width: 142px; line-height: 14px; margin-left:8px;">';
                    Tophtml += '' + $(this).attr("stateDetailed") + '</li>';
                    Tophtml += '<li style="text-align: left;margin-top: 8px; margin-bottom: 2px; width: 142px; line-height: 14px; margin-left:8px;">'
                    Tophtml += '' + $(this).attr("windState") + ' &nbsp;&nbsp;' + $(this).attr("windPower") + '</li>';
                    Tophtml += '<li style="text-align: left;margin-top: 8px; margin-bottom: 2px; width: 142px; margin-left:8px;">';
                    Tophtml += '<a href="http://www.568job.com" target="_blank"><img src="weather_imges/weather_meitu_1.jpg" border="0" /></a></li></ul>';
                    if(i == 0)
                    {
                        return false;
                    }
                });
            }
        }
    });
    $.ajax({
        type: "post",
        async: false,
        url: "../568weather.ashx",
        data: 'CityCode=' + escape(cityCode) + '&day=0',
        success: function(xml) {
            var temp_url = '';
            if (xml != null) {
                $(xml).find("Weather").each(function() {
                //小天气图标
                html1 += '<div style="width: 32px; background-color: #FBFBFB; font-size: 12px;">';
                html1 += '<img src="weather_imges/' + G_WeatherIconSmall($(this).find("figure1").text()) + '" width="30" height="30"></div>';
                Tophtml += '<ul  style="float:left; margin-left:1px; margin-top:8px;"><li>';
                Tophtml += '<img src="weather_imges/' + G_WeatherIconLarge($(this).find("figure1").text()) + '" align="芝麻天气" width="88" height="88">';
                Tophtml += '</li></ul></div>';
                //实时结束(提醒开始)
                marContent = $(this).find("ssd_s").text();
                //提醒结束（今天开始）
                buttomHtml += '<div style="float: left; width: 274px; margin-top: 0px; margin-bottom: 4px; background-color: #D8E9EC">';
                buttomHtml += '<div class="divbox" style="float: left; width: 88px; margin-right: 1px;">';
                buttomHtml += '<div style="float: left;margin-top: 4px; width: 50px;">';
                buttomHtml += '<img src="weather_imges/' + G_WeatherIconSmall($(this).find("figure1").text()) + '" align="芝麻天气" width="50" height="50"></div>';
                buttomHtml += '<div style="float: left; margin-top: 14px;">今天</div>';
                buttomHtml += '<div style="float: left; width:70px; margin-top: 2px; margin-left: 1px;padding-left:5px;">' + $(this).find("temperature2").text() + '℃～' + $(this).find("temperature1").text() + '℃</div></div>';
                buttomHtml += '<div style="float: left; margin: 0px 1px 0px 1px; height: 74px; width: 1px; background: #CACDD2;overflow: hidden;"></div>';
                //今天结束
                });
            }
        }
    });
    //明天
    $.ajax({
        type: "post",
        async: false,
        url: "../568weather.ashx",
        data: 'CityCode=' + escape(cityCode)+'&day=1',
        success: function(xml) {
            if(xml != null)
            {
                
                $(xml).find("Weather").each(function() {
                    //明天
                    buttomHtml +='<div class="divbox" style="float: left; width: 88px; margin-right: 1px;"><div style="float: left;margin-top: 4px; width: 50px;">';
                    buttomHtml +='<img src="weather_imges/'+G_WeatherIconSmall($(this).find("figure1").text())+'" align="芝麻天气" width="50" height="50"></div>';
                    buttomHtml +='<div style="float: left; margin-top: 14px;">明天</div>';
                    buttomHtml +='<div style="float: left; width:70px; margin-top: 2px; margin-left: 1px;padding-left:5px;">';
                    buttomHtml +=''+$(this).find("temperature2").text()+'℃～'+$(this).find("temperature1").text()+'℃</div>';
                    buttomHtml +='</div><div style="float: left; margin: 0px 1px 0px 1px; height: 74px; width: 1px; background: #CACDD2;overflow: hidden;"></div>';
                });
            }
        }
    });
    //后天
    $.ajax({
        type: "post",
        async: false,
        url: "../568weather.ashx",
        data: 'CityCode=' + escape(cityCode)+'&day=2',
        success: function(xml) {
            if(xml != null)
            {
                
                $(xml).find("Weather").each(function() {
                   buttomHtml +='<div class="divbox" style="float: left;width:88px; margin-right: 1px;"><div style="float: left;margin-top: 4px; width: 50px;">';
                    buttomHtml +='<img src="weather_imges/'+G_WeatherIconSmall($(this).find("figure1").text())+'" align="芝麻天气" width="50" height="50"></div>';
                    buttomHtml +='<div style="float: left; margin-top: 14px;">后天</div>';
                    buttomHtml +='<div style="float: left; width:70px; margin-top: 2px; margin-left: 1px;padding-left:5px;">';
                    buttomHtml +=''+$(this).find("temperature2").text()+'℃～'+$(this).find("temperature1").text()+'℃</div>';
                    buttomHtml +='</div>';
                });
            }
        }
    });
    Tophtml +="</div></div>";
    $("#weather1").html(html1);
    $("#TopHtml").html(Tophtml);
    $("#SmarContent").html(marContent);
    buttomHtml +="<script>$('#myLi').marquee('pointer').mouseover(function () {";
    buttomHtml +="$(this).trigger('stop');}).mouseout(function () {$(this).trigger('start');}).mousemove(function (event) {";
    buttomHtml +="if ($(this).data('drag') == true) {this.scrollLeft = $(this).data('scrollX') + ($(this).data('x') - event.clientX);";
    buttomHtml +="}});$('#racePop').css('display','none');</script>";
    $("#buttomHtml").html(buttomHtml);
 }
